]> git.ipfire.org Git - thirdparty/linux.git/commit - fs/btrfs/ctree.h
btrfs: qgroup: Use root::qgroup_meta_rsv_* to record qgroup meta reserved space
authorQu Wenruo <wqu@suse.com>
Tue, 12 Dec 2017 07:34:34 +0000 (15:34 +0800)
committerDavid Sterba <dsterba@suse.com>
Sat, 31 Mar 2018 00:01:04 +0000 (02:01 +0200)
commit8287475a20552af66b32c07704dbdbeeb898ac1f
treea47e9a69b67d9399ae17f3ba5f093ce796ede144
parent4f5427ccce5d9cb8e2c8f98b49e744e523d246ec
btrfs: qgroup: Use root::qgroup_meta_rsv_* to record qgroup meta reserved space

For quota disabled->enable case, it's possible that at reservation time
quota was not enabled so no bytes were really reserved, while at release
time, quota was enabled so we will try to release some bytes we didn't
really own.

Such situation can cause metadata reserveation underflow, for both types,
also less possible for per-trans type since quota enable will commit
transaction.

To address this, record qgroup meta reserved bytes into
root::qgroup_meta_rsv_pertrans and ::prealloc.
So at releasing time we won't free any bytes we didn't reserve.

For DATA, it's already handled by io_tree, so nothing needs to be done
there.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.h
fs/btrfs/disk-io.c
fs/btrfs/qgroup.c