Btrfs: Fixes for 2.6.18 enterprise kernels
2.6.18 seems to get caught in an infinite loop when
cancel_rearming_delayed_workqueue is called more than once, so this switches
to cancel_delayed_work, which is arguably more correct.
Also, balance_dirty_pages can run into problems with 2.6.18 based kernels
because it doesn't have the per-bdi dirty limits. This avoids calling
balance_dirty_pages on the btree inode unless there is actually something
to balance, which is a good optimization in general.
Finally there's a compile fix for ordered-data.h
Signed-off-by: Chris Mason <chris.mason@oracle.com>
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index c85cb48..9826942 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -814,6 +814,9 @@
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) {
@@ -838,12 +841,13 @@
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);
}