Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 128778
b: refs/heads/master
c: cb03c74
h: refs/heads/master
v: v3
  • Loading branch information
Chris Mason committed Sep 25, 2008
1 parent c8b4816 commit d2bc7af
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 211c17f51f46dc6c308c742098273dd46b5ca59c
refs/heads/master: cb03c743c6486e4efb8be6bdf7bf23177826d156
1 change: 1 addition & 0 deletions trunk/fs/btrfs/ctree.h
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@ struct btrfs_fs_info {
struct work_struct async_submit_work;
spinlock_t end_io_work_lock;
spinlock_t async_submit_work_lock;
atomic_t nr_async_submits;

#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,18)
struct work_struct trans_work;
Expand Down
9 changes: 9 additions & 0 deletions trunk/fs/btrfs/disk-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ int btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, struct inode *inode,

spin_lock(&fs_info->async_submit_work_lock);
list_add_tail(&async->list, &fs_info->async_submit_work_list);
atomic_inc(&fs_info->nr_async_submits);
spin_unlock(&fs_info->async_submit_work_lock);

queue_work(async_submit_workqueue, &fs_info->async_submit_work);
Expand Down Expand Up @@ -906,10 +907,16 @@ static int btrfs_congested_fn(void *congested_data, int bdi_bits)
{
struct btrfs_fs_info *info = (struct btrfs_fs_info *)congested_data;
int ret = 0;
int limit = 256 * info->fs_devices->open_devices;
struct list_head *cur;
struct btrfs_device *device;
struct backing_dev_info *bdi;

if ((bdi_bits & (1 << BDI_write_congested)) &&
atomic_read(&info->nr_async_submits) > limit) {
return 1;
}

list_for_each(cur, &info->fs_devices->devices) {
device = list_entry(cur, struct btrfs_device, dev_list);
if (!device->bdev)
Expand Down Expand Up @@ -1117,6 +1124,7 @@ static void btrfs_async_submit_work(struct work_struct *work)
}
next = fs_info->async_submit_work_list.next;
list_del(next);
atomic_dec(&fs_info->nr_async_submits);
spin_unlock(&fs_info->async_submit_work_lock);

async = list_entry(next, struct async_submit_bio, list);
Expand Down Expand Up @@ -1179,6 +1187,7 @@ struct btrfs_root *open_ctree(struct super_block *sb,
INIT_LIST_HEAD(&fs_info->dirty_cowonly_roots);
INIT_LIST_HEAD(&fs_info->space_info);
btrfs_mapping_init(&fs_info->mapping_tree);
atomic_set(&fs_info->nr_async_submits, 0);
fs_info->sb = sb;
fs_info->max_extent = (u64)-1;
fs_info->max_inline = 8192 * 1024;
Expand Down

0 comments on commit d2bc7af

Please sign in to comment.