aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ioctl.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/ioctl.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/ioctl.c')
-rw-r--r--fs/btrfs/ioctl.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index c48f2e931ea0..9b0526872b7b 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -2976,7 +2976,7 @@ static long btrfs_ioctl_logical_to_ino(struct btrfs_root *root,
2976{ 2976{
2977 int ret = 0; 2977 int ret = 0;
2978 int size; 2978 int size;
2979 u64 extent_offset; 2979 u64 extent_item_pos;
2980 struct btrfs_ioctl_logical_ino_args *loi; 2980 struct btrfs_ioctl_logical_ino_args *loi;
2981 struct btrfs_data_container *inodes = NULL; 2981 struct btrfs_data_container *inodes = NULL;
2982 struct btrfs_path *path = NULL; 2982 struct btrfs_path *path = NULL;
@@ -3007,15 +3007,17 @@ static long btrfs_ioctl_logical_to_ino(struct btrfs_root *root,
3007 } 3007 }
3008 3008
3009 ret = extent_from_logical(root->fs_info, loi->logical, path, &key); 3009 ret = extent_from_logical(root->fs_info, loi->logical, path, &key);
3010 btrfs_release_path(path);
3010 3011
3011 if (ret & BTRFS_EXTENT_FLAG_TREE_BLOCK) 3012 if (ret & BTRFS_EXTENT_FLAG_TREE_BLOCK)
3012 ret = -ENOENT; 3013 ret = -ENOENT;
3013 if (ret < 0) 3014 if (ret < 0)
3014 goto out; 3015 goto out;
3015 3016
3016 extent_offset = loi->logical - key.objectid; 3017 extent_item_pos = loi->logical - key.objectid;
3017 ret = iterate_extent_inodes(root->fs_info, path, key.objectid, 3018 ret = iterate_extent_inodes(root->fs_info, path, key.objectid,
3018 extent_offset, build_ino_list, inodes); 3019 extent_item_pos, build_ino_list,
3020 inodes);
3019 3021
3020 if (ret < 0) 3022 if (ret < 0)
3021 goto out; 3023 goto out;