diff options
author | Boris Burkov <boris@bur.io> | 2023-03-28 13:43:47 -0700 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2023-10-12 16:44:11 +0200 |
commit | 1e0e9d5771c33d2c17a7f2a0e2a419aca91bb1a0 (patch) | |
tree | 08da40e215e15ce7801f1a59b433263b00dfc579 /fs/btrfs/qgroup.h | |
parent | 6ed05643ddb166c0fddabac8ee092659006214a9 (diff) | |
download | linux-stable-1e0e9d5771c33d2c17a7f2a0e2a419aca91bb1a0.tar.gz linux-stable-1e0e9d5771c33d2c17a7f2a0e2a419aca91bb1a0.tar.bz2 linux-stable-1e0e9d5771c33d2c17a7f2a0e2a419aca91bb1a0.zip |
btrfs: add helper for recording simple quota deltas
Rather than re-computing shared/exclusive ownership based on backrefs
and walking roots for implicit backrefs, simple quotas does an increment
when creating an extent and a decrement when deleting it. Add the API
for the extent item code to use to track those events.
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 | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/btrfs/qgroup.h b/fs/btrfs/qgroup.h index 0441d2ff5a49..1e0eb04ef96c 100644 --- a/fs/btrfs/qgroup.h +++ b/fs/btrfs/qgroup.h @@ -269,6 +269,19 @@ struct btrfs_qgroup { struct kobject kobj; }; +struct btrfs_squota_delta { + /* The fstree root this delta counts against. */ + u64 root; + /* The number of bytes in the extent being counted. */ + u64 num_bytes; + /* The number of bytes reserved for this extent. */ + u64 rsv_bytes; + /* Whether we are using or freeing the extent. */ + bool is_inc; + /* Whether the extent is data or metadata. */ + bool is_data; +}; + static inline u64 btrfs_qgroup_subvolid(u64 qgroupid) { return (qgroupid & ((1ULL << BTRFS_QGROUP_LEVEL_SHIFT) - 1)); @@ -407,5 +420,7 @@ int btrfs_qgroup_trace_subtree_after_cow(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct extent_buffer *eb); void btrfs_qgroup_destroy_extent_records(struct btrfs_transaction *trans); bool btrfs_check_quota_leak(struct btrfs_fs_info *fs_info); +int btrfs_record_squota_delta(struct btrfs_fs_info *fs_info, + struct btrfs_squota_delta *delta); #endif |