Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 128895
b: refs/heads/master
c: 777e6bd
h: refs/heads/master
i:
  128893: 8898aa1
  128891: a476fbc
  128887: d5f3e65
  128879: 35cecf7
  128863: 5551b29
  128831: e1dab76
  128767: b5be283
v: v3
  • Loading branch information
Chris Mason committed Sep 25, 2008
1 parent bd7751a commit 6316572
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0986fe9eac24fd186927c3b87af51d62f8ab92cd
refs/heads/master: 777e6bd706ee40897545463871de5b456fbc46dc
11 changes: 4 additions & 7 deletions trunk/fs/btrfs/disk-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ int btrfs_bio_wq_end_io(struct btrfs_fs_info *info, struct bio *bio,
return 0;
}

static int congested_async(struct btrfs_fs_info *info, int iodone)
int btrfs_congested_async(struct btrfs_fs_info *info, int iodone)
{
int limit = 256 * info->fs_devices->open_devices;

Expand All @@ -438,9 +438,6 @@ static int congested_async(struct btrfs_fs_info *info, int iodone)
if (atomic_read(&info->nr_async_submits) > limit)
return 1;

limit = 8192 * info->fs_devices->open_devices;
if (iodone)
limit = (limit * 3) / 2;
return atomic_read(&info->nr_async_bios) > limit;
}

Expand All @@ -454,7 +451,7 @@ static void run_one_async_submit(struct btrfs_work *work)
atomic_dec(&fs_info->nr_async_submits);

if ((async->bio->bi_rw & (1 << BIO_RW)) &&
!congested_async(fs_info, 1)) {
!btrfs_congested_async(fs_info, 1)) {
clear_bdi_congested(&fs_info->bdi, WRITE);
}
async->submit_bio_hook(async->inode, async->rw, async->bio,
Expand Down Expand Up @@ -963,7 +960,7 @@ static int btrfs_congested_fn(void *congested_data, int bdi_bits)
struct backing_dev_info *bdi;

if ((bdi_bits & (1 << BDI_write_congested)) &&
congested_async(info, 0))
btrfs_congested_async(info, 0))
return 1;

list_for_each(cur, &info->fs_devices->devices) {
Expand Down Expand Up @@ -1844,7 +1841,7 @@ void btrfs_btree_balance_dirty(struct btrfs_root *root, unsigned long nr)
struct extent_io_tree *tree;
u64 num_dirty;
u64 start = 0;
unsigned long thresh = 16 * 1024 * 1024;
unsigned long thresh = 2 * 1024 * 1024;
tree = &BTRFS_I(root->fs_info->btree_inode)->io_tree;

if (current_is_pdflush())
Expand Down
1 change: 1 addition & 0 deletions trunk/fs/btrfs/disk-io.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,5 @@ int btrfs_bio_wq_end_io(struct btrfs_fs_info *info, struct bio *bio,
int btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, struct inode *inode,
int rw, struct bio *bio, int mirror_num,
extent_submit_bio_hook_t *submit_bio_hook);
int btrfs_congested_async(struct btrfs_fs_info *info, int iodone);
#endif
36 changes: 31 additions & 5 deletions trunk/fs/btrfs/transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,12 +303,12 @@ int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans,
struct btrfs_root *root)
{
int ret;
int err;
int err = 0;
int werr = 0;
struct extent_io_tree *dirty_pages;
struct page *page;
struct inode *btree_inode = root->fs_info->btree_inode;
u64 start;
u64 start = 0;
u64 end;
unsigned long index;

Expand All @@ -317,12 +317,15 @@ int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans,
}
dirty_pages = &trans->transaction->dirty_pages;
while(1) {
ret = find_first_extent_bit(dirty_pages, 0, &start, &end,
ret = find_first_extent_bit(dirty_pages, start, &start, &end,
EXTENT_DIRTY);
if (ret)
break;
clear_extent_dirty(dirty_pages, start, end, GFP_NOFS);
while(start <= end) {
if (btrfs_congested_async(root->fs_info, 0))
congestion_wait(WRITE, HZ/10);
cond_resched();

index = start >> PAGE_CACHE_SHIFT;
start = (u64)(index + 1) << PAGE_CACHE_SHIFT;
page = find_lock_page(btree_inode->i_mapping, index);
Expand All @@ -343,7 +346,30 @@ int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans,
page_cache_release(page);
}
}
err = filemap_fdatawait(btree_inode->i_mapping);
while(1) {
ret = find_first_extent_bit(dirty_pages, 0, &start, &end,
EXTENT_DIRTY);
if (ret)
break;

clear_extent_dirty(dirty_pages, start, end, GFP_NOFS);
while(start <= end) {
index = start >> PAGE_CACHE_SHIFT;
start = (u64)(index + 1) << PAGE_CACHE_SHIFT;
page = find_get_page(btree_inode->i_mapping, index);
if (!page)
continue;
if (PageDirty(page)) {
lock_page(page);
err = write_one_page(page, 0);
if (err)
werr = err;
}
wait_on_page_writeback(page);
page_cache_release(page);
cond_resched();
}
}
if (err)
werr = err;
return werr;
Expand Down

0 comments on commit 6316572

Please sign in to comment.