aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/scrub.c
diff options
context:
space:
mode:
authorJan Schmidt <list.btrfs@jan-o-sch.net>2011-12-02 08:56:41 -0500
committerJan Schmidt <list.btrfs@jan-o-sch.net>2012-01-05 04:49:43 -0500
commit4692cf58aa7b81f721c1653d48db99ea41421d58 (patch)
tree0a5bf889142252d91bcc8df33a9c63c18024fe70 /fs/btrfs/scrub.c
parent8da6d5815c592b713ecaf4f4f8b631f8359c96c4 (diff)
Btrfs: new backref walking code
The old backref iteration code could only safely be used on commit roots. Besides this limitation, it had bugs in finding the roots for these references. This commit replaces large parts of it by btrfs_find_all_roots() which a) really finds all roots and the correct roots, b) works correctly under heavy file system load, c) considers delayed refs. Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Diffstat (limited to 'fs/btrfs/scrub.c')
-rw-r--r--fs/btrfs/scrub.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index c27bcb67f330..b5edff25a53f 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -309,7 +309,7 @@ static void scrub_print_warning(const char *errstr, struct scrub_bio *sbio,
309 u8 ref_level; 309 u8 ref_level;
310 unsigned long ptr = 0; 310 unsigned long ptr = 0;
311 const int bufsize = 4096; 311 const int bufsize = 4096;
312 u64 extent_offset; 312 u64 extent_item_pos;
313 313
314 path = btrfs_alloc_path(); 314 path = btrfs_alloc_path();
315 315
@@ -329,12 +329,13 @@ static void scrub_print_warning(const char *errstr, struct scrub_bio *sbio,
329 if (ret < 0) 329 if (ret < 0)
330 goto out; 330 goto out;
331 331
332 extent_offset = swarn.logical - found_key.objectid; 332 extent_item_pos = swarn.logical - found_key.objectid;
333 swarn.extent_item_size = found_key.offset; 333 swarn.extent_item_size = found_key.offset;
334 334
335 eb = path->nodes[0]; 335 eb = path->nodes[0];
336 ei = btrfs_item_ptr(eb, path->slots[0], struct btrfs_extent_item); 336 ei = btrfs_item_ptr(eb, path->slots[0], struct btrfs_extent_item);
337 item_size = btrfs_item_size_nr(eb, path->slots[0]); 337 item_size = btrfs_item_size_nr(eb, path->slots[0]);
338 btrfs_release_path(path);
338 339
339 if (ret & BTRFS_EXTENT_FLAG_TREE_BLOCK) { 340 if (ret & BTRFS_EXTENT_FLAG_TREE_BLOCK) {
340 do { 341 do {
@@ -351,7 +352,7 @@ static void scrub_print_warning(const char *errstr, struct scrub_bio *sbio,
351 } else { 352 } else {
352 swarn.path = path; 353 swarn.path = path;
353 iterate_extent_inodes(fs_info, path, found_key.objectid, 354 iterate_extent_inodes(fs_info, path, found_key.objectid,
354 extent_offset, 355 extent_item_pos,
355 scrub_print_warning_inode, &swarn); 356 scrub_print_warning_inode, &swarn);
356 } 357 }
357 358