]> git.ipfire.org Git - thirdparty/linux.git/commit
btrfs: qgroup: use btrfs_qgroup_enabled() in ioctls
authorFilipe Manana <fdmanana@suse.com>
Tue, 1 Jul 2025 14:25:14 +0000 (15:25 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 21 Jul 2025 22:07:37 +0000 (00:07 +0200)
commita943812bfffb38e6b416ee359d3db1f6974c5dfe
tree7175afbd1d4c52dbc0c26aa2aace7a6acb6bd9e8
parent08530d6e638427e7e1344bd67bacc03882ba95b9
btrfs: qgroup: use btrfs_qgroup_enabled() in ioctls

We have a publicly exported btrfs_qgroup_enabled() and an ioctl.c private
qgroup_enabled() helper. Both of these test if qgroups are enabled, the
first check if the flag BTRFS_FS_QUOTA_ENABLED is set in fs_info->flags
while the second checks if fs_info->quota_root is not NULL while holding
the mutex fs_info->qgroup_ioctl_lock.

We can get away with the private ioctl.c:qgroup_enabled(), as all entry
points into the qgroup code check if fs_info->quota_root is NULL or not
while holding the mutex fs_info->qgroup_ioctl_lock, and returning the
error -ENOTCONN in case it's NULL.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ioctl.c