* [PATCH] Btrfs: fix qgroup rescan to work with skinny metadata
@ 2014-01-23 21:45 Josef Bacik
2014-01-23 23:42 ` Filipe David Manana
0 siblings, 1 reply; 3+ messages in thread
From: Josef Bacik @ 2014-01-23 21:45 UTC (permalink / raw)
To: linux-btrfs
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>
---
fs/btrfs/qgroup.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index d22e0a1..7d04026 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,
mutex_unlock(&fs_info->qgroup_rescan_lock);
for (; slot < btrfs_header_nritems(scratch_leaf); ++slot) {
+ u64 num_bytes;
+
btrfs_item_key_to_cpu(scratch_leaf, &found, slot);
- if (found.type != BTRFS_EXTENT_ITEM_KEY)
+ if (found.type != BTRFS_EXTENT_ITEM_KEY ||
+ found.type != BTRFS_METADATA_ITEM_KEY)
continue;
+ if (found.type == BTRFS_METADATA_ITEM_KEY)
+ num_bytes = fs_info->extent_root->leafsize;
+ else
+ num_bytes = found.offset;
+
ret = btrfs_find_all_roots(trans, fs_info, found.objectid,
tree_mod_seq_elem.seq, &roots);
if (ret < 0)
@@ -1944,12 +1952,12 @@ qgroup_rescan_leaf(struct btrfs_fs_info *fs_info, struct btrfs_path *path,
struct btrfs_qgroup_list *glist;
qg = (struct btrfs_qgroup *)(uintptr_t) unode->aux;
- qg->rfer += found.offset;
- qg->rfer_cmpr += found.offset;
+ qg->rfer += num_bytes;
+ qg->rfer_cmpr += num_bytes;
WARN_ON(qg->tag >= seq);
if (qg->refcnt - seq == roots->nnodes) {
- qg->excl += found.offset;
- qg->excl_cmpr += found.offset;
+ qg->excl += num_bytes;
+ qg->excl_cmpr += num_bytes;
}
qgroup_dirty(fs_info, qg);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] Btrfs: fix qgroup rescan to work with skinny metadata
2014-01-23 21:45 [PATCH] Btrfs: fix qgroup rescan to work with skinny metadata Josef Bacik
@ 2014-01-23 23:42 ` Filipe David Manana
2014-01-23 23:44 ` Josef Bacik
0 siblings, 1 reply; 3+ messages in thread
From: Filipe David Manana @ 2014-01-23 23:42 UTC (permalink / raw)
To: Josef Bacik; +Cc: linux-btrfs@vger.kernel.org
On Thu, Jan 23, 2014 at 9:45 PM, Josef Bacik <jbacik@fb.com> wrote:
> 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>
> ---
> fs/btrfs/qgroup.c | 18 +++++++++++++-----
> 1 file changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
> index d22e0a1..7d04026 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,
> mutex_unlock(&fs_info->qgroup_rescan_lock);
>
> for (; slot < btrfs_header_nritems(scratch_leaf); ++slot) {
> + u64 num_bytes;
> +
> btrfs_item_key_to_cpu(scratch_leaf, &found, slot);
> - if (found.type != BTRFS_EXTENT_ITEM_KEY)
> + if (found.type != BTRFS_EXTENT_ITEM_KEY ||
> + found.type != BTRFS_METADATA_ITEM_KEY)
> continue;
Hi Josef,
Shouldn't it be && instead of || ?
thanks
> + if (found.type == BTRFS_METADATA_ITEM_KEY)
> + num_bytes = fs_info->extent_root->leafsize;
> + else
> + num_bytes = found.offset;
> +
> ret = btrfs_find_all_roots(trans, fs_info, found.objectid,
> tree_mod_seq_elem.seq, &roots);
> if (ret < 0)
> @@ -1944,12 +1952,12 @@ qgroup_rescan_leaf(struct btrfs_fs_info *fs_info, struct btrfs_path *path,
> struct btrfs_qgroup_list *glist;
>
> qg = (struct btrfs_qgroup *)(uintptr_t) unode->aux;
> - qg->rfer += found.offset;
> - qg->rfer_cmpr += found.offset;
> + qg->rfer += num_bytes;
> + qg->rfer_cmpr += num_bytes;
> WARN_ON(qg->tag >= seq);
> if (qg->refcnt - seq == roots->nnodes) {
> - qg->excl += found.offset;
> - qg->excl_cmpr += found.offset;
> + qg->excl += num_bytes;
> + qg->excl_cmpr += num_bytes;
> }
> qgroup_dirty(fs_info, qg);
>
> --
> 1.8.3.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Filipe David Manana,
"Reasonable men adapt themselves to the world.
Unreasonable men adapt the world to themselves.
That's why all progress depends on unreasonable men."
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] Btrfs: fix qgroup rescan to work with skinny metadata
2014-01-23 23:42 ` Filipe David Manana
@ 2014-01-23 23:44 ` Josef Bacik
0 siblings, 0 replies; 3+ messages in thread
From: Josef Bacik @ 2014-01-23 23:44 UTC (permalink / raw)
To: fdmanana; +Cc: linux-btrfs@vger.kernel.org
On 01/23/2014 06:42 PM, Filipe David Manana wrote:
> On Thu, Jan 23, 2014 at 9:45 PM, Josef Bacik <jbacik@fb.com> wrote:
>> 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>
>> ---
>> fs/btrfs/qgroup.c | 18 +++++++++++++-----
>> 1 file changed, 13 insertions(+), 5 deletions(-)
>>
>> diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
>> index d22e0a1..7d04026 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,
>> mutex_unlock(&fs_info->qgroup_rescan_lock);
>>
>> for (; slot < btrfs_header_nritems(scratch_leaf); ++slot) {
>> + u64 num_bytes;
>> +
>> btrfs_item_key_to_cpu(scratch_leaf, &found, slot);
>> - if (found.type != BTRFS_EXTENT_ITEM_KEY)
>> + if (found.type != BTRFS_EXTENT_ITEM_KEY ||
>> + found.type != BTRFS_METADATA_ITEM_KEY)
>> continue;
> Hi Josef,
>
> Shouldn't it be && instead of || ?
>
Yes it should, thanks,
Josef
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-01-23 23:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-23 21:45 [PATCH] Btrfs: fix qgroup rescan to work with skinny metadata Josef Bacik
2014-01-23 23:42 ` Filipe David Manana
2014-01-23 23:44 ` Josef Bacik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox