diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-10-11 14:23:13 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-10-11 14:23:13 -0400 |
commit | 474a503d4bf77ae0cbe484dd0842a2648c0b1c28 (patch) | |
tree | 70e3e4023209e741546491a58622bd45fb13e308 /fs/btrfs/tree-log.c | |
parent | d43c36dc6b357fa1806800f18aa30123c747a6d1 (diff) | |
parent | ac6889cbb254be1ffea376bea4a96ce9be0e0ed0 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable
* git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable:
Btrfs: fix file clone ioctl for bookend extents
Btrfs: fix uninit compiler warning in cow_file_range_nocow
Btrfs: constify dentry_operations
Btrfs: optimize back reference update during btrfs_drop_snapshot
Btrfs: remove negative dentry when deleting subvolumne
Btrfs: optimize fsync for the single writer case
Btrfs: async delalloc flushing under space pressure
Btrfs: release delalloc reservations on extent item insertion
Btrfs: delay clearing EXTENT_DELALLOC for compressed extents
Btrfs: cleanup extent_clear_unlock_delalloc flags
Btrfs: fix possible softlockup in the allocator
Btrfs: fix deadlock on async thread startup
Diffstat (limited to 'fs/btrfs/tree-log.c')
-rw-r--r-- | fs/btrfs/tree-log.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 7827841b55cb..4edfdc2acc5f 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -137,11 +137,20 @@ static int start_log_trans(struct btrfs_trans_handle *trans, | |||
137 | 137 | ||
138 | mutex_lock(&root->log_mutex); | 138 | mutex_lock(&root->log_mutex); |
139 | if (root->log_root) { | 139 | if (root->log_root) { |
140 | if (!root->log_start_pid) { | ||
141 | root->log_start_pid = current->pid; | ||
142 | root->log_multiple_pids = false; | ||
143 | } else if (root->log_start_pid != current->pid) { | ||
144 | root->log_multiple_pids = true; | ||
145 | } | ||
146 | |||
140 | root->log_batch++; | 147 | root->log_batch++; |
141 | atomic_inc(&root->log_writers); | 148 | atomic_inc(&root->log_writers); |
142 | mutex_unlock(&root->log_mutex); | 149 | mutex_unlock(&root->log_mutex); |
143 | return 0; | 150 | return 0; |
144 | } | 151 | } |
152 | root->log_multiple_pids = false; | ||
153 | root->log_start_pid = current->pid; | ||
145 | mutex_lock(&root->fs_info->tree_log_mutex); | 154 | mutex_lock(&root->fs_info->tree_log_mutex); |
146 | if (!root->fs_info->log_root_tree) { | 155 | if (!root->fs_info->log_root_tree) { |
147 | ret = btrfs_init_log_root_tree(trans, root->fs_info); | 156 | ret = btrfs_init_log_root_tree(trans, root->fs_info); |
@@ -1985,7 +1994,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, | |||
1985 | if (atomic_read(&root->log_commit[(index1 + 1) % 2])) | 1994 | if (atomic_read(&root->log_commit[(index1 + 1) % 2])) |
1986 | wait_log_commit(trans, root, root->log_transid - 1); | 1995 | wait_log_commit(trans, root, root->log_transid - 1); |
1987 | 1996 | ||
1988 | while (1) { | 1997 | while (root->log_multiple_pids) { |
1989 | unsigned long batch = root->log_batch; | 1998 | unsigned long batch = root->log_batch; |
1990 | mutex_unlock(&root->log_mutex); | 1999 | mutex_unlock(&root->log_mutex); |
1991 | schedule_timeout_uninterruptible(1); | 2000 | schedule_timeout_uninterruptible(1); |
@@ -2011,6 +2020,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, | |||
2011 | root->log_batch = 0; | 2020 | root->log_batch = 0; |
2012 | root->log_transid++; | 2021 | root->log_transid++; |
2013 | log->log_transid = root->log_transid; | 2022 | log->log_transid = root->log_transid; |
2023 | root->log_start_pid = 0; | ||
2014 | smp_mb(); | 2024 | smp_mb(); |
2015 | /* | 2025 | /* |
2016 | * log tree has been flushed to disk, new modifications of | 2026 | * log tree has been flushed to disk, new modifications of |