diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-09-29 15:18:18 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-29 15:18:18 -0400 |
commit | d352ac68148b69937d39ca5d48bcc4478e118dbf (patch) | |
tree | 7951dd7311999d9e77766acdc7f8e93de97874d8 /fs/btrfs/locking.c | |
parent | 9a5e1ea1e1e539e244a54afffc330fc368376ab9 (diff) |
Btrfs: add and improve comments
This improves the comments at the top of many functions. It didn't
dive into the guts of functions because I was trying to
avoid merging problems with the new allocator and back reference work.
extent-tree.c and volumes.c were both skipped, and there is definitely
more work todo in cleaning and commenting the code.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/locking.c')
-rw-r--r-- | fs/btrfs/locking.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/btrfs/locking.c b/fs/btrfs/locking.c index 0cc314c10d66..e30aa6e2958f 100644 --- a/fs/btrfs/locking.c +++ b/fs/btrfs/locking.c | |||
@@ -25,6 +25,15 @@ | |||
25 | #include "extent_io.h" | 25 | #include "extent_io.h" |
26 | #include "locking.h" | 26 | #include "locking.h" |
27 | 27 | ||
28 | /* | ||
29 | * locks the per buffer mutex in an extent buffer. This uses adaptive locks | ||
30 | * and the spin is not tuned very extensively. The spinning does make a big | ||
31 | * difference in almost every workload, but spinning for the right amount of | ||
32 | * time needs some help. | ||
33 | * | ||
34 | * In general, we want to spin as long as the lock holder is doing btree searches, | ||
35 | * and we should give up if they are in more expensive code. | ||
36 | */ | ||
28 | int btrfs_tree_lock(struct extent_buffer *eb) | 37 | int btrfs_tree_lock(struct extent_buffer *eb) |
29 | { | 38 | { |
30 | int i; | 39 | int i; |
@@ -57,6 +66,10 @@ int btrfs_tree_locked(struct extent_buffer *eb) | |||
57 | return mutex_is_locked(&eb->mutex); | 66 | return mutex_is_locked(&eb->mutex); |
58 | } | 67 | } |
59 | 68 | ||
69 | /* | ||
70 | * btrfs_search_slot uses this to decide if it should drop its locks | ||
71 | * before doing something expensive like allocating free blocks for cow. | ||
72 | */ | ||
60 | int btrfs_path_lock_waiting(struct btrfs_path *path, int level) | 73 | int btrfs_path_lock_waiting(struct btrfs_path *path, int level) |
61 | { | 74 | { |
62 | int i; | 75 | int i; |