summaryrefslogtreecommitdiff
path: root/fs/btrfs/fs.h
diff options
context:
space:
mode:
authorBoris Burkov <boris@bur.io>2023-03-28 15:45:20 -0700
committerDavid Sterba <dsterba@suse.com>2023-10-12 16:44:11 +0200
commitbd7c1ea3a302aba727a1ced9937ec84c6407724e (patch)
tree753922744491aae09f86d86c4d6f8f9e8fca1ba4 /fs/btrfs/fs.h
parent5343cd9364ea26c9f4f78896a87ed1b5b5e652d9 (diff)
btrfs: qgroup: check generation when recording simple quota delta
Simple quotas count extents only from the moment the feature is enabled. Therefore, if we do something like: 1. create subvol S 2. write F in S 3. enable quotas 4. remove F 5. write G in S then after 3. and 4. we would expect the simple quota usage of S to be 0 (putting aside some metadata extents that might be written) and after 5., it should be the size of G plus metadata. Therefore, we need to be able to determine whether a particular quota delta we are processing predates simple quota enablement. To do this, store the transaction id when quotas were enabled. In fs_info for immediate use and in the quota status item to make it recoverable on mount. When we see a delta, check if the generation of the extent item is less than that of quota enablement. If so, we should ignore the delta from this extent. Signed-off-by: Boris Burkov <boris@bur.io> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/fs.h')
-rw-r--r--fs/btrfs/fs.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/btrfs/fs.h b/fs/btrfs/fs.h
index e8fcf34f208a..2bd9bedc7095 100644
--- a/fs/btrfs/fs.h
+++ b/fs/btrfs/fs.h
@@ -687,6 +687,7 @@ struct btrfs_fs_info {
/* Protected by qgroup_rescan_lock */
bool qgroup_rescan_running;
u8 qgroup_drop_subtree_thres;
+ u64 qgroup_enable_gen;
/*
* If this is not 0, then it indicates a serious filesystem error has