diff options
author | Chris Mason <chris.mason@oracle.com> | 2011-05-28 07:00:39 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2011-05-28 07:00:39 -0400 |
commit | ff5714cca971848963b87d6b477c16ca8abbaa54 (patch) | |
tree | 17ee34b9b5e00804df4059503f82f6f1d94383a9 /fs/btrfs/disk-io.c | |
parent | 174ba50915b08dcfd07c8b5fb795b46a165fa09a (diff) | |
parent | d90c732122a1f6d0efe388a8a204f67f144b2eb3 (diff) |
Merge branch 'for-chris' of
git://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-work into for-linus
Conflicts:
fs/btrfs/disk-io.c
fs/btrfs/extent-tree.c
fs/btrfs/free-space-cache.c
fs/btrfs/inode.c
fs/btrfs/transaction.c
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 98b6a71decba..a203d363184d 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -1505,24 +1505,24 @@ static int transaction_kthread(void *arg) | |||
1505 | vfs_check_frozen(root->fs_info->sb, SB_FREEZE_WRITE); | 1505 | vfs_check_frozen(root->fs_info->sb, SB_FREEZE_WRITE); |
1506 | mutex_lock(&root->fs_info->transaction_kthread_mutex); | 1506 | mutex_lock(&root->fs_info->transaction_kthread_mutex); |
1507 | 1507 | ||
1508 | spin_lock(&root->fs_info->new_trans_lock); | 1508 | spin_lock(&root->fs_info->trans_lock); |
1509 | cur = root->fs_info->running_transaction; | 1509 | cur = root->fs_info->running_transaction; |
1510 | if (!cur) { | 1510 | if (!cur) { |
1511 | spin_unlock(&root->fs_info->new_trans_lock); | 1511 | spin_unlock(&root->fs_info->trans_lock); |
1512 | goto sleep; | 1512 | goto sleep; |
1513 | } | 1513 | } |
1514 | 1514 | ||
1515 | now = get_seconds(); | 1515 | now = get_seconds(); |
1516 | if (!cur->blocked && | 1516 | if (!cur->blocked && |
1517 | (now < cur->start_time || now - cur->start_time < 30)) { | 1517 | (now < cur->start_time || now - cur->start_time < 30)) { |
1518 | spin_unlock(&root->fs_info->new_trans_lock); | 1518 | spin_unlock(&root->fs_info->trans_lock); |
1519 | delay = HZ * 5; | 1519 | delay = HZ * 5; |
1520 | goto sleep; | 1520 | goto sleep; |
1521 | } | 1521 | } |
1522 | transid = cur->transid; | 1522 | transid = cur->transid; |
1523 | spin_unlock(&root->fs_info->new_trans_lock); | 1523 | spin_unlock(&root->fs_info->trans_lock); |
1524 | 1524 | ||
1525 | trans = btrfs_join_transaction(root, 1); | 1525 | trans = btrfs_join_transaction(root); |
1526 | BUG_ON(IS_ERR(trans)); | 1526 | BUG_ON(IS_ERR(trans)); |
1527 | if (transid == trans->transid) { | 1527 | if (transid == trans->transid) { |
1528 | ret = btrfs_commit_transaction(trans, root); | 1528 | ret = btrfs_commit_transaction(trans, root); |
@@ -1613,7 +1613,7 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1613 | INIT_LIST_HEAD(&fs_info->ordered_operations); | 1613 | INIT_LIST_HEAD(&fs_info->ordered_operations); |
1614 | INIT_LIST_HEAD(&fs_info->caching_block_groups); | 1614 | INIT_LIST_HEAD(&fs_info->caching_block_groups); |
1615 | spin_lock_init(&fs_info->delalloc_lock); | 1615 | spin_lock_init(&fs_info->delalloc_lock); |
1616 | spin_lock_init(&fs_info->new_trans_lock); | 1616 | spin_lock_init(&fs_info->trans_lock); |
1617 | spin_lock_init(&fs_info->ref_cache_lock); | 1617 | spin_lock_init(&fs_info->ref_cache_lock); |
1618 | spin_lock_init(&fs_info->fs_roots_radix_lock); | 1618 | spin_lock_init(&fs_info->fs_roots_radix_lock); |
1619 | spin_lock_init(&fs_info->delayed_iput_lock); | 1619 | spin_lock_init(&fs_info->delayed_iput_lock); |
@@ -1645,6 +1645,7 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1645 | fs_info->max_inline = 8192 * 1024; | 1645 | fs_info->max_inline = 8192 * 1024; |
1646 | fs_info->metadata_ratio = 0; | 1646 | fs_info->metadata_ratio = 0; |
1647 | fs_info->defrag_inodes = RB_ROOT; | 1647 | fs_info->defrag_inodes = RB_ROOT; |
1648 | fs_info->trans_no_join = 0; | ||
1648 | 1649 | ||
1649 | fs_info->thread_pool_size = min_t(unsigned long, | 1650 | fs_info->thread_pool_size = min_t(unsigned long, |
1650 | num_online_cpus() + 2, 8); | 1651 | num_online_cpus() + 2, 8); |
@@ -1709,7 +1710,6 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1709 | fs_info->do_barriers = 1; | 1710 | fs_info->do_barriers = 1; |
1710 | 1711 | ||
1711 | 1712 | ||
1712 | mutex_init(&fs_info->trans_mutex); | ||
1713 | mutex_init(&fs_info->ordered_operations_mutex); | 1713 | mutex_init(&fs_info->ordered_operations_mutex); |
1714 | mutex_init(&fs_info->tree_log_mutex); | 1714 | mutex_init(&fs_info->tree_log_mutex); |
1715 | mutex_init(&fs_info->chunk_mutex); | 1715 | mutex_init(&fs_info->chunk_mutex); |
@@ -2479,13 +2479,13 @@ int btrfs_commit_super(struct btrfs_root *root) | |||
2479 | down_write(&root->fs_info->cleanup_work_sem); | 2479 | down_write(&root->fs_info->cleanup_work_sem); |
2480 | up_write(&root->fs_info->cleanup_work_sem); | 2480 | up_write(&root->fs_info->cleanup_work_sem); |
2481 | 2481 | ||
2482 | trans = btrfs_join_transaction(root, 1); | 2482 | trans = btrfs_join_transaction(root); |
2483 | if (IS_ERR(trans)) | 2483 | if (IS_ERR(trans)) |
2484 | return PTR_ERR(trans); | 2484 | return PTR_ERR(trans); |
2485 | ret = btrfs_commit_transaction(trans, root); | 2485 | ret = btrfs_commit_transaction(trans, root); |
2486 | BUG_ON(ret); | 2486 | BUG_ON(ret); |
2487 | /* run commit again to drop the original snapshot */ | 2487 | /* run commit again to drop the original snapshot */ |
2488 | trans = btrfs_join_transaction(root, 1); | 2488 | trans = btrfs_join_transaction(root); |
2489 | if (IS_ERR(trans)) | 2489 | if (IS_ERR(trans)) |
2490 | return PTR_ERR(trans); | 2490 | return PTR_ERR(trans); |
2491 | btrfs_commit_transaction(trans, root); | 2491 | btrfs_commit_transaction(trans, root); |
@@ -3024,10 +3024,13 @@ static int btrfs_cleanup_transaction(struct btrfs_root *root) | |||
3024 | 3024 | ||
3025 | WARN_ON(1); | 3025 | WARN_ON(1); |
3026 | 3026 | ||
3027 | mutex_lock(&root->fs_info->trans_mutex); | ||
3028 | mutex_lock(&root->fs_info->transaction_kthread_mutex); | 3027 | mutex_lock(&root->fs_info->transaction_kthread_mutex); |
3029 | 3028 | ||
3029 | spin_lock(&root->fs_info->trans_lock); | ||
3030 | list_splice_init(&root->fs_info->trans_list, &list); | 3030 | list_splice_init(&root->fs_info->trans_list, &list); |
3031 | root->fs_info->trans_no_join = 1; | ||
3032 | spin_unlock(&root->fs_info->trans_lock); | ||
3033 | |||
3031 | while (!list_empty(&list)) { | 3034 | while (!list_empty(&list)) { |
3032 | t = list_entry(list.next, struct btrfs_transaction, list); | 3035 | t = list_entry(list.next, struct btrfs_transaction, list); |
3033 | if (!t) | 3036 | if (!t) |
@@ -3052,23 +3055,18 @@ static int btrfs_cleanup_transaction(struct btrfs_root *root) | |||
3052 | t->blocked = 0; | 3055 | t->blocked = 0; |
3053 | if (waitqueue_active(&root->fs_info->transaction_wait)) | 3056 | if (waitqueue_active(&root->fs_info->transaction_wait)) |
3054 | wake_up(&root->fs_info->transaction_wait); | 3057 | wake_up(&root->fs_info->transaction_wait); |
3055 | mutex_unlock(&root->fs_info->trans_mutex); | ||
3056 | 3058 | ||
3057 | mutex_lock(&root->fs_info->trans_mutex); | ||
3058 | t->commit_done = 1; | 3059 | t->commit_done = 1; |
3059 | if (waitqueue_active(&t->commit_wait)) | 3060 | if (waitqueue_active(&t->commit_wait)) |
3060 | wake_up(&t->commit_wait); | 3061 | wake_up(&t->commit_wait); |
3061 | mutex_unlock(&root->fs_info->trans_mutex); | ||
3062 | |||
3063 | mutex_lock(&root->fs_info->trans_mutex); | ||
3064 | 3062 | ||
3065 | btrfs_destroy_pending_snapshots(t); | 3063 | btrfs_destroy_pending_snapshots(t); |
3066 | 3064 | ||
3067 | btrfs_destroy_delalloc_inodes(root); | 3065 | btrfs_destroy_delalloc_inodes(root); |
3068 | 3066 | ||
3069 | spin_lock(&root->fs_info->new_trans_lock); | 3067 | spin_lock(&root->fs_info->trans_lock); |
3070 | root->fs_info->running_transaction = NULL; | 3068 | root->fs_info->running_transaction = NULL; |
3071 | spin_unlock(&root->fs_info->new_trans_lock); | 3069 | spin_unlock(&root->fs_info->trans_lock); |
3072 | 3070 | ||
3073 | btrfs_destroy_marked_extents(root, &t->dirty_pages, | 3071 | btrfs_destroy_marked_extents(root, &t->dirty_pages, |
3074 | EXTENT_DIRTY); | 3072 | EXTENT_DIRTY); |
@@ -3082,8 +3080,10 @@ static int btrfs_cleanup_transaction(struct btrfs_root *root) | |||
3082 | kmem_cache_free(btrfs_transaction_cachep, t); | 3080 | kmem_cache_free(btrfs_transaction_cachep, t); |
3083 | } | 3081 | } |
3084 | 3082 | ||
3083 | spin_lock(&root->fs_info->trans_lock); | ||
3084 | root->fs_info->trans_no_join = 0; | ||
3085 | spin_unlock(&root->fs_info->trans_lock); | ||
3085 | mutex_unlock(&root->fs_info->transaction_kthread_mutex); | 3086 | mutex_unlock(&root->fs_info->transaction_kthread_mutex); |
3086 | mutex_unlock(&root->fs_info->trans_mutex); | ||
3087 | 3087 | ||
3088 | return 0; | 3088 | return 0; |
3089 | } | 3089 | } |