Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 128759
b: refs/heads/master
c: d6bfde8
h: refs/heads/master
i:
  128757: b2d1010
  128755: 1184e01
  128751: a521036
v: v3
  • Loading branch information
Chris Mason committed Sep 25, 2008
1 parent 0b1d857 commit a9424ba
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 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: 2fff734fafa742236aecbdcdc8b1ff4d221cbaca
refs/heads/master: d6bfde8765668c8687de72f7a40f52acdf4f2f19
24 changes: 19 additions & 5 deletions trunk/fs/btrfs/disk-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1548,6 +1548,7 @@ int close_ctree(struct btrfs_root *root)
btrfs_commit_transaction(trans, root);
ret = btrfs_write_and_wait_transaction(NULL, root);
BUG_ON(ret);

write_ctree_super(NULL, root);
mutex_unlock(&fs_info->fs_mutex);

Expand Down Expand Up @@ -1583,17 +1584,17 @@ int close_ctree(struct btrfs_root *root)
extent_io_tree_empty_lru(&fs_info->extent_ins);
extent_io_tree_empty_lru(&BTRFS_I(fs_info->btree_inode)->io_tree);

flush_workqueue(end_io_workqueue);
flush_workqueue(async_submit_workqueue);
flush_workqueue(end_io_workqueue);

truncate_inode_pages(fs_info->btree_inode->i_mapping, 0);

flush_workqueue(end_io_workqueue);
destroy_workqueue(end_io_workqueue);

flush_workqueue(async_submit_workqueue);
destroy_workqueue(async_submit_workqueue);

flush_workqueue(end_io_workqueue);
destroy_workqueue(end_io_workqueue);

iput(fs_info->btree_inode);
#if 0
while(!list_empty(&fs_info->hashers)) {
Expand Down Expand Up @@ -1663,8 +1664,21 @@ void btrfs_throttle(struct btrfs_root *root)

void btrfs_btree_balance_dirty(struct btrfs_root *root, unsigned long nr)
{
balance_dirty_pages_ratelimited_nr(
struct extent_io_tree *tree;
u64 num_dirty;
u64 start = 0;
unsigned long thresh = 16 * 1024 * 1024;
tree = &BTRFS_I(root->fs_info->btree_inode)->io_tree;

if (current_is_pdflush())
return;

num_dirty = count_range_bits(tree, &start, (u64)-1,
thresh, EXTENT_DIRTY);
if (num_dirty > thresh) {
balance_dirty_pages_ratelimited_nr(
root->fs_info->btree_inode->i_mapping, 1);
}
}

void btrfs_set_buffer_defrag(struct extent_buffer *buf)
Expand Down
1 change: 1 addition & 0 deletions trunk/fs/btrfs/ordered-data.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include <linux/gfp.h>
#include <linux/slab.h>
#include <linux/blkdev.h>
#include "ctree.h"
#include "transaction.h"
#include "btrfs_inode.h"
Expand Down
8 changes: 6 additions & 2 deletions trunk/fs/btrfs/transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,9 @@ void btrfs_transaction_cleaner(struct work_struct *work)
int ret;

mutex_lock(&root->fs_info->fs_mutex);
if (root->fs_info->closing)
goto out;

mutex_lock(&root->fs_info->trans_mutex);
cur = root->fs_info->running_transaction;
if (!cur) {
Expand All @@ -838,12 +841,13 @@ void btrfs_transaction_cleaner(struct work_struct *work)

void btrfs_transaction_queue_work(struct btrfs_root *root, int delay)
{
queue_delayed_work(trans_wq, &root->fs_info->trans_work, delay);
if (!root->fs_info->closing)
queue_delayed_work(trans_wq, &root->fs_info->trans_work, delay);
}

void btrfs_transaction_flush_work(struct btrfs_root *root)
{
cancel_rearming_delayed_workqueue(trans_wq, &root->fs_info->trans_work);
cancel_delayed_work(&root->fs_info->trans_work);
flush_workqueue(trans_wq);
}

Expand Down

0 comments on commit a9424ba

Please sign in to comment.