summaryrefslogtreecommitdiff
path: root/fs/nilfs2/btree.c
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2010-07-18 05:42:25 +0400
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2010-07-23 05:02:15 +0400
commit4e13e66bee2d792c1aae21797f16c181024834eb (patch)
tree1fa51dade28bc025d9bda0e09dec1f202281a498 /fs/nilfs2/btree.c
parent464ece88630d0fb715ca942eabb1da825046a534 (diff)
downloadlinux-4e13e66bee2d792c1aae21797f16c181024834eb.tar.xz
nilfs2: introduce check flag to btree node buffer
nilfs_btree_get_block() now may return untested buffer due to read-ahead. This adds a new flag for buffer heads so that the btree code can check whether the buffer is already verified or not. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/btree.c')
-rw-r--r--fs/nilfs2/btree.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c
index 1b5321c0bcac..d3faa0bba171 100644
--- a/fs/nilfs2/btree.c
+++ b/fs/nilfs2/btree.c
@@ -370,8 +370,16 @@ static int nilfs_btree_node_broken(const struct nilfs_btree_node *node,
int nilfs_btree_broken_node_block(struct buffer_head *bh)
{
- return nilfs_btree_node_broken((struct nilfs_btree_node *)bh->b_data,
+ int ret;
+
+ if (buffer_nilfs_checked(bh))
+ return 0;
+
+ ret = nilfs_btree_node_broken((struct nilfs_btree_node *)bh->b_data,
bh->b_size, bh->b_blocknr);
+ if (likely(!ret))
+ set_buffer_nilfs_checked(bh);
+ return ret;
}
static struct nilfs_btree_node *