aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2011-06-30 14:42:28 -0400
committerChris Mason <chris.mason@oracle.com>2011-07-27 12:46:25 -0400
commitbab39bf998133510f2dad08158006197ec0dabea (patch)
tree0ea50b2b07a9f75988829de6c42b6936e2355545 /fs/btrfs/ctree.h
parentdf98b6e2c52f65665eaf0fc23e647fb64335b289 (diff)
Btrfs: use a worker thread to do caching
A user reported a deadlock when copying a bunch of files. This is because they were low on memory and kthreadd got hung up trying to migrate pages for an allocation when starting the caching kthread. The page was locked by the person starting the caching kthread. To fix this we just need to use the async thread stuff so that the threads are already created and we don't have to worry about deadlocks. Thanks, Reported-by: Roman Mamedov <rm@romanrm.ru> Signed-off-by: Josef Bacik <josef@redhat.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r--fs/btrfs/ctree.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 406c33876605..9f6f342900c9 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -767,7 +767,6 @@ struct btrfs_space_info {
767 struct list_head block_groups[BTRFS_NR_RAID_TYPES]; 767 struct list_head block_groups[BTRFS_NR_RAID_TYPES];
768 spinlock_t lock; 768 spinlock_t lock;
769 struct rw_semaphore groups_sem; 769 struct rw_semaphore groups_sem;
770 atomic_t caching_threads;
771 wait_queue_head_t wait; 770 wait_queue_head_t wait;
772}; 771};
773 772
@@ -828,6 +827,7 @@ struct btrfs_caching_control {
828 struct list_head list; 827 struct list_head list;
829 struct mutex mutex; 828 struct mutex mutex;
830 wait_queue_head_t wait; 829 wait_queue_head_t wait;
830 struct btrfs_work work;
831 struct btrfs_block_group_cache *block_group; 831 struct btrfs_block_group_cache *block_group;
832 u64 progress; 832 u64 progress;
833 atomic_t count; 833 atomic_t count;
@@ -1036,6 +1036,8 @@ struct btrfs_fs_info {
1036 struct btrfs_workers endio_write_workers; 1036 struct btrfs_workers endio_write_workers;
1037 struct btrfs_workers endio_freespace_worker; 1037 struct btrfs_workers endio_freespace_worker;
1038 struct btrfs_workers submit_workers; 1038 struct btrfs_workers submit_workers;
1039 struct btrfs_workers caching_workers;
1040
1039 /* 1041 /*
1040 * fixup workers take dirty pages that didn't properly go through 1042 * fixup workers take dirty pages that didn't properly go through
1041 * the cow mechanism and make them safe to write. It happens 1043 * the cow mechanism and make them safe to write. It happens