summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/space-info.h
diff options
context:
space:
mode:
authorNikolay Borisov <nborisov@suse.com>2020-03-10 10:00:35 +0100
committerDavid Sterba <dsterba@suse.com>2020-03-23 17:01:55 +0100
commitdb161806dc5615a42893a1df7d803d12890699d9 (patch)
treefc1e73dc39b5788350afaec5e31a3dc3a185ccc5 /fs/btrfs/space-info.h
parentbtrfs: implement migratepage callback for data pages (diff)
downloadlinux-db161806dc5615a42893a1df7d803d12890699d9.tar.xz
linux-db161806dc5615a42893a1df7d803d12890699d9.zip
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>
Diffstat (limited to '')
-rw-r--r--fs/btrfs/space-info.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/btrfs/space-info.h b/fs/btrfs/space-info.h
index 24514cd2c6c1..0a5001ef1481 100644
--- a/fs/btrfs/space-info.h
+++ b/fs/btrfs/space-info.h
@@ -54,6 +54,13 @@ struct btrfs_space_info {
struct list_head ro_bgs;
struct list_head priority_tickets;
struct list_head tickets;
+
+ /*
+ * Size of space that needs to be reclaimed in order to satisfy pending
+ * tickets
+ */
+ u64 reclaim_size;
+
/*
* tickets_id just indicates the next ticket will be handled, so note
* it's not stored per ticket.