summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fb.com>2014-01-23 16:45:10 -0500
committerChris Mason <clm@fb.com>2014-01-28 16:20:27 -0500
commit3a6d75e846224542151e9ff186cb89df5a6ca2c6 (patch)
tree4eebd7319c7789444e673f5915b8f5c8364dd7b6
parent580f0a678ebeba85d30b6a7f22ce32c472263c72 (diff)
Btrfs: fix qgroup rescan to work with skinny metadata
Could have sworn I fixed this before but apparently not. This makes us pass btrfs/022 with skinny metadata enabled. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Chris Mason <clm@fb.com>
-rw-r--r--fs/btrfs/qgroup.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index d22e0a14dde2..472302a2d745 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -1897,9 +1897,17 @@ qgroup_rescan_leaf(struct btrfs_fs_info *fs_info, struct btrfs_path *path,
1897 mutex_unlock(&fs_info->qgroup_rescan_lock); 1897 mutex_unlock(&fs_info->qgroup_rescan_lock);
1898 1898
1899 for (; slot < btrfs_header_nritems(scratch_leaf); ++slot) { 1899 for (; slot < btrfs_header_nritems(scratch_leaf); ++slot) {
1900 u64 num_bytes;
1901
1900 btrfs_item_key_to_cpu(scratch_leaf, &found, slot); 1902 btrfs_item_key_to_cpu(scratch_leaf, &found, slot);
1901 if (found.type != BTRFS_EXTENT_ITEM_KEY) 1903 if (found.type != BTRFS_EXTENT_ITEM_KEY &&
1904 found.type != BTRFS_METADATA_ITEM_KEY)
1902 continue; 1905 continue;
1906 if (found.type == BTRFS_METADATA_ITEM_KEY)
1907 num_bytes = fs_info->extent_root->leafsize;
1908 else
1909 num_bytes = found.offset;
1910
1903 ret = btrfs_find_all_roots(trans, fs_info, found.objectid, 1911 ret = btrfs_find_all_roots(trans, fs_info, found.objectid,
1904 tree_mod_seq_elem.seq, &roots); 1912 tree_mod_seq_elem.seq, &roots);
1905 if (ret < 0) 1913 if (ret < 0)
@@ -1944,12 +1952,12 @@ qgroup_rescan_leaf(struct btrfs_fs_info *fs_info, struct btrfs_path *path,
1944 struct btrfs_qgroup_list *glist; 1952 struct btrfs_qgroup_list *glist;
1945 1953
1946 qg = (struct btrfs_qgroup *)(uintptr_t) unode->aux; 1954 qg = (struct btrfs_qgroup *)(uintptr_t) unode->aux;
1947 qg->rfer += found.offset; 1955 qg->rfer += num_bytes;
1948 qg->rfer_cmpr += found.offset; 1956 qg->rfer_cmpr += num_bytes;
1949 WARN_ON(qg->tag >= seq); 1957 WARN_ON(qg->tag >= seq);
1950 if (qg->refcnt - seq == roots->nnodes) { 1958 if (qg->refcnt - seq == roots->nnodes) {
1951 qg->excl += found.offset; 1959 qg->excl += num_bytes;
1952 qg->excl_cmpr += found.offset; 1960 qg->excl_cmpr += num_bytes;
1953 } 1961 }
1954 qgroup_dirty(fs_info, qg); 1962 qgroup_dirty(fs_info, qg);
1955 1963