diff options
author | Boris Burkov <boris@bur.io> | 2023-03-29 00:45:20 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2023-10-12 16:44:11 +0200 |
commit | bd7c1ea3a302aba727a1ced9937ec84c6407724e (patch) | |
tree | 753922744491aae09f86d86c4d6f8f9e8fca1ba4 /fs/btrfs/qgroup.h | |
parent | btrfs: qgroup: simple quota auto hierarchy for nested subvolumes (diff) | |
download | linux-bd7c1ea3a302aba727a1ced9937ec84c6407724e.tar.xz linux-bd7c1ea3a302aba727a1ced9937ec84c6407724e.zip |
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/qgroup.h')
-rw-r--r-- | fs/btrfs/qgroup.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/qgroup.h b/fs/btrfs/qgroup.h index 9858244eef20..855a4f978761 100644 --- a/fs/btrfs/qgroup.h +++ b/fs/btrfs/qgroup.h @@ -276,6 +276,8 @@ struct btrfs_squota_delta { u64 num_bytes; /* The number of bytes reserved for this extent. */ u64 rsv_bytes; + /* The generation the extent was created in. */ + u64 generation; /* Whether we are using or freeing the extent. */ bool is_inc; /* Whether the extent is data or metadata. */ |