From 879fd32f7cbd0fe14b7ebe04266648545d94d085 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Tue, 20 Mar 2012 15:35:07 -0700 Subject: [PATCH] hammer2 - Avoid unnecessary IO * 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 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sys/vfs/hammer2/hammer2_chain.c b/sys/vfs/hammer2/hammer2_chain.c index 622c3614f7..c66eb14b04 100644 --- a/sys/vfs/hammer2/hammer2_chain.c +++ b/sys/vfs/hammer2/hammer2_chain.c @@ -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. @@ -2015,6 +2014,12 @@ hammer2_chain_flush_pass1(hammer2_mount_t *hmp, hammer2_chain_t *chain) atomic_set_int(&chain->flags, HAMMER2_CHAIN_MOVED); } + /* + * 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 -- 2.41.0