]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commitf8eff47369cd1eb8b1a44d755d512bf344de7bc4
treea47e9a69b67d9399ae17f3ba5f093ce796ede144
parentfead33c690925bdd072144e16161c99cb00775a2
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