summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
authorZhao Lei2016-01-07 11:38:48 +0100
committerDavid Sterba2016-02-18 10:27:23 +0100
commit2fefd5583f8b86171c898f90cadac7c09ccf9d73 (patch)
tree6f5c406bc2dc0ba63c36f3fb19e2462c9f42739c /fs/btrfs/ctree.h
parentbtrfs: reada: simplify dev->reada_in_flight processing (diff)
downloadkernel-qcow2-linux-2fefd5583f8b86171c898f90cadac7c09ccf9d73.tar.gz
kernel-qcow2-linux-2fefd5583f8b86171c898f90cadac7c09ccf9d73.tar.xz
kernel-qcow2-linux-2fefd5583f8b86171c898f90cadac7c09ccf9d73.zip
btrfs: reada: limit max works count
Reada creates 2 works for each level of tree recursively. In case of a tree having many levels, the number of created works is 2^level_of_tree. Actually we don't need so many works in parallel, this patch limits max works to BTRFS_MAX_MIRRORS * 2. The per-fs works_counter will be also used for btrfs_reada_wait() to check is there are background workers. Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r--fs/btrfs/ctree.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index e557e05d2318..e43d987e1c99 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -1822,6 +1822,9 @@ struct btrfs_fs_info {
spinlock_t reada_lock;
struct radix_tree_root reada_tree;
+ /* readahead works cnt */
+ atomic_t reada_works_cnt;
+
/* Extent buffer radix tree */
spinlock_t buffer_lock;
struct radix_tree_root buffer_radix;