aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-05-18 13:28:27 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-05-18 13:28:27 -0400
commitde428b63b16f9c74a24228a517713e8c65f79475 (patch)
tree0bb56423173f59e6237cf0cbc8052f72fb997347 /fs/btrfs/disk-io.c
parent098f59c2512426926722a96f82af127bd91fb5e4 (diff)
Btrfs: allocator optimizations, truncate readahead
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 678456d1e2f9..4c0262b57664 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -257,24 +257,30 @@ static struct address_space_operations btree_aops = {
257int readahead_tree_block(struct btrfs_root *root, u64 blocknr) 257int readahead_tree_block(struct btrfs_root *root, u64 blocknr)
258{ 258{
259 struct buffer_head *bh = NULL; 259 struct buffer_head *bh = NULL;
260 int ret = 0;
260 261
261 bh = btrfs_find_create_tree_block(root, blocknr); 262 bh = btrfs_find_create_tree_block(root, blocknr);
262 if (!bh) 263 if (!bh)
263 return 0; 264 return 0;
264 if (buffer_uptodate(bh)) 265 if (buffer_uptodate(bh)) {
266 ret = 1;
265 goto done; 267 goto done;
266 if (test_set_buffer_locked(bh)) 268 }
269 if (test_set_buffer_locked(bh)) {
270 ret = 1;
267 goto done; 271 goto done;
272 }
268 if (!buffer_uptodate(bh)) { 273 if (!buffer_uptodate(bh)) {
269 get_bh(bh); 274 get_bh(bh);
270 bh->b_end_io = end_buffer_read_sync; 275 bh->b_end_io = end_buffer_read_sync;
271 submit_bh(READ, bh); 276 submit_bh(READ, bh);
272 } else { 277 } else {
273 unlock_buffer(bh); 278 unlock_buffer(bh);
279 ret = 1;
274 } 280 }
275done: 281done:
276 brelse(bh); 282 brelse(bh);
277 return 0; 283 return ret;
278} 284}
279 285
280struct buffer_head *read_tree_block(struct btrfs_root *root, u64 blocknr) 286struct buffer_head *read_tree_block(struct btrfs_root *root, u64 blocknr)