aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-02-10 07:25:42 -0500
committerIngo Molnar <mingo@elte.hu>2009-02-10 07:25:42 -0500
commitf9915bfef3c64ea0b0b960dd1b999b584a7ef460 (patch)
treeec8d1c35a542e4c8e08b5a2be380b2bdef9a10d0 /fs
parentb91facc367366b3f71375f337eb5997ec9ab4e69 (diff)
parentacd895795d35d7c6405f20301a846d16998795ec (diff)
Merge branches 'tracing/ftrace' and 'tracing/urgent' into tracing/core
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/ctree.c3
-rw-r--r--fs/btrfs/locking.c22
-rw-r--r--fs/btrfs/locking.h2
-rw-r--r--fs/lockd/svclock.c6
4 files changed, 6 insertions, 27 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 551177c0011a..35443cc4b9a9 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -1530,8 +1530,7 @@ again:
1530 * for higher level blocks, try not to allocate blocks 1530 * for higher level blocks, try not to allocate blocks
1531 * with the block and the parent locks held. 1531 * with the block and the parent locks held.
1532 */ 1532 */
1533 if (level > 0 && !prealloc_block.objectid && 1533 if (level > 0 && !prealloc_block.objectid) {
1534 btrfs_path_lock_waiting(p, level)) {
1535 u32 size = b->len; 1534 u32 size = b->len;
1536 u64 hint = b->start; 1535 u64 hint = b->start;
1537 1536
diff --git a/fs/btrfs/locking.c b/fs/btrfs/locking.c
index 68fd9ccf1805..9ebe9385129b 100644
--- a/fs/btrfs/locking.c
+++ b/fs/btrfs/locking.c
@@ -236,25 +236,3 @@ int btrfs_tree_locked(struct extent_buffer *eb)
236 return test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags) || 236 return test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags) ||
237 spin_is_locked(&eb->lock); 237 spin_is_locked(&eb->lock);
238} 238}
239
240/*
241 * btrfs_search_slot uses this to decide if it should drop its locks
242 * before doing something expensive like allocating free blocks for cow.
243 */
244int btrfs_path_lock_waiting(struct btrfs_path *path, int level)
245{
246 int i;
247 struct extent_buffer *eb;
248
249 for (i = level; i <= level + 1 && i < BTRFS_MAX_LEVEL; i++) {
250 eb = path->nodes[i];
251 if (!eb)
252 break;
253 smp_mb();
254 if (spin_is_contended(&eb->lock) ||
255 waitqueue_active(&eb->lock_wq))
256 return 1;
257 }
258 return 0;
259}
260
diff --git a/fs/btrfs/locking.h b/fs/btrfs/locking.h
index d92e707f5870..6bb0afbff928 100644
--- a/fs/btrfs/locking.h
+++ b/fs/btrfs/locking.h
@@ -26,8 +26,6 @@ int btrfs_tree_locked(struct extent_buffer *eb);
26int btrfs_try_tree_lock(struct extent_buffer *eb); 26int btrfs_try_tree_lock(struct extent_buffer *eb);
27int btrfs_try_spin_lock(struct extent_buffer *eb); 27int btrfs_try_spin_lock(struct extent_buffer *eb);
28 28
29int btrfs_path_lock_waiting(struct btrfs_path *path, int level);
30
31void btrfs_set_lock_blocking(struct extent_buffer *eb); 29void btrfs_set_lock_blocking(struct extent_buffer *eb);
32void btrfs_clear_lock_blocking(struct extent_buffer *eb); 30void btrfs_clear_lock_blocking(struct extent_buffer *eb);
33#endif 31#endif
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
index 6063a8e4b9f3..763b78a6e9de 100644
--- a/fs/lockd/svclock.c
+++ b/fs/lockd/svclock.c
@@ -427,7 +427,7 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
427 goto out; 427 goto out;
428 case -EAGAIN: 428 case -EAGAIN:
429 ret = nlm_lck_denied; 429 ret = nlm_lck_denied;
430 goto out; 430 break;
431 case FILE_LOCK_DEFERRED: 431 case FILE_LOCK_DEFERRED:
432 if (wait) 432 if (wait)
433 break; 433 break;
@@ -443,6 +443,10 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
443 goto out; 443 goto out;
444 } 444 }
445 445
446 ret = nlm_lck_denied;
447 if (!wait)
448 goto out;
449
446 ret = nlm_lck_blocked; 450 ret = nlm_lck_blocked;
447 451
448 /* Append to list of blocked */ 452 /* Append to list of blocked */