]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: extent-tree: Detect bytes_may_use underflow earlier
authorQu Wenruo <wqu@suse.com>
Wed, 24 Oct 2018 12:24:01 +0000 (20:24 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 17 Dec 2018 13:51:25 +0000 (14:51 +0100)
commitcf4c5efe95019cde92f27bb50d8aa4137e6a5335
tree6d845a630f5a031fc0ef2d365eb243579b2185ba
parented050d89058902dc347fe72987f1ed84279ee297
btrfs: extent-tree: Detect bytes_may_use underflow earlier

Although we have space_info::bytes_may_use underflow detection in
btrfs_free_reserved_data_space_noquota(), we have more callers who are
subtracting number from space_info::bytes_may_use.

So instead of doing underflow detection for every caller, introduce a
new wrapper update_bytes_may_use() to replace open coded bytes_may_use
modifiers.

This also introduce a macro to declare more wrappers, but currently
space_info::bytes_may_use is the mostly interesting one.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-tree.c