Skip to contentSkip to conversation

btrfs: quota: Set rescan progress to (u64)-1 if we hit last leaf

PATCH In review Qu Wenruo 3 participants 3 messages Jun 27, 2018 – Jun 28, 2018 Btrfs file system

lore
Share & tools
lore

Qu Wenruo

author
#0 lore raw

PATCH 1/1 btrfs: quota: Set rescan progress to (u64)-1 if we hit last leaf

Commit ff3d27a048d9 ("btrfs: qgroup: Finish rescan when hit the last leaf of extent tree") added a new exit for rescan finish.

However after finishing quota rescan, we set fs_info->qgroup_rescan_progress to (u64)-1 before we exit through the original exit path.
While we missed that assignment of (u64)-1 in the new exit path.

The end result is, the quota status item doesn't have the same value. (-1 vs the last bytenr + 1)
Although it doesn't affect quota accounting, it's still better to keep the original behavior.

Fixes ff3d27a048d9 ("btrfs: qgroup: Finish rescan when hit the last leaf of extent tree")

---
changelog:
v2:
Commit message update, as the bug only changes the resulting quota status item without impacting the behavior.

---
 fs/btrfs/qgroup.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/btrfs/qgroup.c +3 -1
index 1874a6d2e6f5..99f2b9ce0f15 100644
@@ -2680,8 +2680,10 @@ qgroup_rescan_leaf(struct btrfs_fs_info *fs_info, struct btrfs_path *path,
 		free_extent_buffer(scratch_leaf);
 	}
 
-	if (done && !ret)
+	if (done && !ret) {
 		ret = 1;
+		fs_info->qgroup_rescan_progress.objectid = (u64)-1;
+	}
 	return ret;
 }
 
Signature · 1 line
2.18.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · Qu Wenruo

Commit ff3d27a048d9 ("btrfs: qgroup: Finish rescan when hit the last leaf of extent tree") added a new exit for rescan finish.

However after finishing quota rescan, we set fs_info->qgroup_rescan_progress to (u64)-1 before we exit through the original exit path.
While we missed that assignment of (u64)-1 in the new exit path.

The end result is, the quota status item doesn't have the same value. (-1 vs the last bytenr + 1)
Although it doesn't affect quota accounting, it's still better to keep the original behavior.

Quoted 8 lines
Fixes ff3d27a048d9 ("btrfs: qgroup: Finish rescan when hit the last leaf of extent tree")

---
changelog:
v2:
Commit message update, as the bug only changes the resulting quota status item without impacting the behavior.

(As you said, the problem I reported in
https://marc.info/?t=152999303500007&r=1&w=2 is not related to this change)

Thanks,
Tomohiro Misono

Quoted 21 lines
---
 fs/btrfs/qgroup.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/btrfs/qgroup.c +3 -1
index 1874a6d2e6f5..99f2b9ce0f15 100644
@@ -2680,8 +2680,10 @@ qgroup_rescan_leaf(struct btrfs_fs_info *fs_info, struct btrfs_path *path,
 		free_extent_buffer(scratch_leaf);
 	}
 
-	if (done && !ret)
+	if (done && !ret) {
 		ret = 1;
+		fs_info->qgroup_rescan_progress.objectid = (u64)-1;
+	}
 	return ret;
 }
 
#2 lore raw
In reply to Qu Wenruo
Quoted 8 lines · Qu Wenruo

Commit ff3d27a048d9 ("btrfs: qgroup: Finish rescan when hit the last leaf of extent tree") added a new exit for rescan finish.

However after finishing quota rescan, we set fs_info->qgroup_rescan_progress to (u64)-1 before we exit through the original exit path.
While we missed that assignment of (u64)-1 in the new exit path.

Quoted 8 lines

The end result is, the quota status item doesn't have the same value. (-1 vs the last bytenr + 1)
Although it doesn't affect quota accounting, it's still better to keep the original behavior.

Fixes ff3d27a048d9 ("btrfs: qgroup: Finish rescan when hit the last leaf of extent tree")

Thanks, added to 4.18 queue.