]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: account ticket size at add/delete time
authorNikolay Borisov <nborisov@suse.com>
Tue, 10 Mar 2020 09:00:35 +0000 (11:00 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 23 Mar 2020 16:01:55 +0000 (17:01 +0100)
commit04b075ca5ef25e7937fe6243faa9b3fe168b6cb5
treefc1e73dc39b5788350afaec5e31a3dc3a185ccc5
parent2d3817979d7cb3fd9e7b9d85fe496603fe2f5f05
btrfs: account ticket size at add/delete time

Instead of iterating all pending tickets on the normal/priority list to
sum their total size the cost can be amortized across ticket addition/
removal. This turns O(n) + O(m) (where n is the size of the normal list
and m of the priority list) into O(1). This will mostly have effect in
workloads that experience heavy flushing.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/space-info.c
fs/btrfs/space-info.h