hammer2 - Avoid unnecessary IO
authorMatthew Dillon <dillon@apollo.backplane.com>
Tue, 20 Mar 2012 22:35:07 +0000 (15:35 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Tue, 20 Mar 2012 22:35:07 +0000 (15:35 -0700)
* With the new strategy we no longer have to build smaller blocksizes into
  larger buffers.

  When flushing embedded data we can now getblk() the block instead of
  bread() it.

* DELETED nodes have to be explicitly flushed to remove references
  associated with MODIFY1 and MOVE.

* There's no need to flush meta-data associated with a deleted node.

sys/vfs/hammer2/hammer2_chain.c

index 622c361..c66eb14 100644 (file)
@@ -1913,7 +1913,6 @@ hammer2_chain_flush_pass1(hammer2_mount_t *hmp, hammer2_chain_t *chain)
        hammer2_blockref_t *bref;
        hammer2_off_t pbase;
        struct buf *bp;
-       int error;
 
        /*
         * Flush any children of this chain entry.
@@ -2016,6 +2015,12 @@ hammer2_chain_flush_pass1(hammer2_mount_t *hmp, hammer2_chain_t *chain)
        }
 
        /*
+        * Deleted nodes do not have to be flushed.
+        */
+       if (chain->flags & HAMMER2_CHAIN_DELETED)
+               return;
+
+       /*
         * If this is part of a recursive flush we can go ahead and write
         * out the buffer cache buffer and pass a new bref back up the chain.
         *
@@ -2047,9 +2052,7 @@ hammer2_chain_flush_pass1(hammer2_mount_t *hmp, hammer2_chain_t *chain)
                         * The data is embedded, we have to acquire the
                         * buffer cache buffer and copy the data into it.
                         */
-                       bp = NULL;
-                       error = bread(hmp->devvp, pbase, chain->bytes, &bp);
-                       KKASSERT(error == 0); /* XXX */
+                       bp = getblk(hmp->devvp, pbase, chain->bytes, 0, 0);
 
                        /*
                         * Copy the data to the buffer, mark the buffer