diff options
author | David Woodhouse <dwmw2@infradead.org> | 2008-04-22 10:13:40 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2008-04-22 10:13:40 -0400 |
commit | ced22070363ef50e4a47aadd003a81ebeaa3f917 (patch) | |
tree | 66f094dce47a5a0f8f9936308fffe57e2c50255a /fs/jffs2/README.Locking | |
parent | 52f8301437a0ba744265e0549ee7239eb85426fc (diff) |
[JFFS2] semaphore->mutex conversion
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'fs/jffs2/README.Locking')
-rw-r--r-- | fs/jffs2/README.Locking | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/fs/jffs2/README.Locking b/fs/jffs2/README.Locking index d14d5a4dc5ac..3ea36554107f 100644 --- a/fs/jffs2/README.Locking +++ b/fs/jffs2/README.Locking | |||
@@ -14,7 +14,7 @@ be fairly close. | |||
14 | alloc_sem | 14 | alloc_sem |
15 | --------- | 15 | --------- |
16 | 16 | ||
17 | The alloc_sem is a per-filesystem semaphore, used primarily to ensure | 17 | The alloc_sem is a per-filesystem mutex, used primarily to ensure |
18 | contiguous allocation of space on the medium. It is automatically | 18 | contiguous allocation of space on the medium. It is automatically |
19 | obtained during space allocations (jffs2_reserve_space()) and freed | 19 | obtained during space allocations (jffs2_reserve_space()) and freed |
20 | upon write completion (jffs2_complete_reservation()). Note that | 20 | upon write completion (jffs2_complete_reservation()). Note that |
@@ -41,10 +41,10 @@ if the wbuf is currently holding any data is permitted, though. | |||
41 | Ordering constraints: See f->sem. | 41 | Ordering constraints: See f->sem. |
42 | 42 | ||
43 | 43 | ||
44 | File Semaphore f->sem | 44 | File Mutex f->sem |
45 | --------------------- | 45 | --------------------- |
46 | 46 | ||
47 | This is the JFFS2-internal equivalent of the inode semaphore i->i_sem. | 47 | This is the JFFS2-internal equivalent of the inode mutex i->i_sem. |
48 | It protects the contents of the jffs2_inode_info private inode data, | 48 | It protects the contents of the jffs2_inode_info private inode data, |
49 | including the linked list of node fragments (but see the notes below on | 49 | including the linked list of node fragments (but see the notes below on |
50 | erase_completion_lock), etc. | 50 | erase_completion_lock), etc. |
@@ -60,14 +60,14 @@ lead to deadlock, unless we played games with unlocking the i_sem | |||
60 | before calling the space allocation functions. | 60 | before calling the space allocation functions. |
61 | 61 | ||
62 | Instead of playing such games, we just have an extra internal | 62 | Instead of playing such games, we just have an extra internal |
63 | semaphore, which is obtained by the garbage collection code and also | 63 | mutex, which is obtained by the garbage collection code and also |
64 | by the normal file system code _after_ allocation of space. | 64 | by the normal file system code _after_ allocation of space. |
65 | 65 | ||
66 | Ordering constraints: | 66 | Ordering constraints: |
67 | 67 | ||
68 | 1. Never attempt to allocate space or lock alloc_sem with | 68 | 1. Never attempt to allocate space or lock alloc_sem with |
69 | any f->sem held. | 69 | any f->sem held. |
70 | 2. Never attempt to lock two file semaphores in one thread. | 70 | 2. Never attempt to lock two file mutexes in one thread. |
71 | No ordering rules have been made for doing so. | 71 | No ordering rules have been made for doing so. |
72 | 72 | ||
73 | 73 | ||
@@ -86,8 +86,8 @@ a simple spin_lock() rather than spin_lock_bh(). | |||
86 | 86 | ||
87 | Note that the per-inode list of physical nodes (f->nodes) is a special | 87 | Note that the per-inode list of physical nodes (f->nodes) is a special |
88 | case. Any changes to _valid_ nodes (i.e. ->flash_offset & 1 == 0) in | 88 | case. Any changes to _valid_ nodes (i.e. ->flash_offset & 1 == 0) in |
89 | the list are protected by the file semaphore f->sem. But the erase | 89 | the list are protected by the file mutex f->sem. But the erase code |
90 | code may remove _obsolete_ nodes from the list while holding only the | 90 | may remove _obsolete_ nodes from the list while holding only the |
91 | erase_completion_lock. So you can walk the list only while holding the | 91 | erase_completion_lock. So you can walk the list only while holding the |
92 | erase_completion_lock, and can drop the lock temporarily mid-walk as | 92 | erase_completion_lock, and can drop the lock temporarily mid-walk as |
93 | long as the pointer you're holding is to a _valid_ node, not an | 93 | long as the pointer you're holding is to a _valid_ node, not an |
@@ -124,10 +124,10 @@ Ordering constraints: | |||
124 | erase_free_sem | 124 | erase_free_sem |
125 | -------------- | 125 | -------------- |
126 | 126 | ||
127 | This semaphore is only used by the erase code which frees obsolete | 127 | This mutex is only used by the erase code which frees obsolete node |
128 | node references and the jffs2_garbage_collect_deletion_dirent() | 128 | references and the jffs2_garbage_collect_deletion_dirent() function. |
129 | function. The latter function on NAND flash must read _obsolete_ nodes | 129 | The latter function on NAND flash must read _obsolete_ nodes to |
130 | to determine whether the 'deletion dirent' under consideration can be | 130 | determine whether the 'deletion dirent' under consideration can be |
131 | discarded or whether it is still required to show that an inode has | 131 | discarded or whether it is still required to show that an inode has |
132 | been unlinked. Because reading from the flash may sleep, the | 132 | been unlinked. Because reading from the flash may sleep, the |
133 | erase_completion_lock cannot be held, so an alternative, more | 133 | erase_completion_lock cannot be held, so an alternative, more |