aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/README.Locking
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jffs2/README.Locking')
-rw-r--r--fs/jffs2/README.Locking22
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
17The alloc_sem is a per-filesystem semaphore, used primarily to ensure 17The alloc_sem is a per-filesystem mutex, used primarily to ensure
18contiguous allocation of space on the medium. It is automatically 18contiguous allocation of space on the medium. It is automatically
19obtained during space allocations (jffs2_reserve_space()) and freed 19obtained during space allocations (jffs2_reserve_space()) and freed
20upon write completion (jffs2_complete_reservation()). Note that 20upon write completion (jffs2_complete_reservation()). Note that
@@ -41,10 +41,10 @@ if the wbuf is currently holding any data is permitted, though.
41Ordering constraints: See f->sem. 41Ordering constraints: See f->sem.
42 42
43 43
44 File Semaphore f->sem 44 File Mutex f->sem
45 --------------------- 45 ---------------------
46 46
47This is the JFFS2-internal equivalent of the inode semaphore i->i_sem. 47This is the JFFS2-internal equivalent of the inode mutex i->i_sem.
48It protects the contents of the jffs2_inode_info private inode data, 48It protects the contents of the jffs2_inode_info private inode data,
49including the linked list of node fragments (but see the notes below on 49including the linked list of node fragments (but see the notes below on
50erase_completion_lock), etc. 50erase_completion_lock), etc.
@@ -60,14 +60,14 @@ lead to deadlock, unless we played games with unlocking the i_sem
60before calling the space allocation functions. 60before calling the space allocation functions.
61 61
62Instead of playing such games, we just have an extra internal 62Instead of playing such games, we just have an extra internal
63semaphore, which is obtained by the garbage collection code and also 63mutex, which is obtained by the garbage collection code and also
64by the normal file system code _after_ allocation of space. 64by the normal file system code _after_ allocation of space.
65 65
66Ordering constraints: 66Ordering 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
87Note that the per-inode list of physical nodes (f->nodes) is a special 87Note that the per-inode list of physical nodes (f->nodes) is a special
88case. Any changes to _valid_ nodes (i.e. ->flash_offset & 1 == 0) in 88case. Any changes to _valid_ nodes (i.e. ->flash_offset & 1 == 0) in
89the list are protected by the file semaphore f->sem. But the erase 89the list are protected by the file mutex f->sem. But the erase code
90code may remove _obsolete_ nodes from the list while holding only the 90may remove _obsolete_ nodes from the list while holding only the
91erase_completion_lock. So you can walk the list only while holding the 91erase_completion_lock. So you can walk the list only while holding the
92erase_completion_lock, and can drop the lock temporarily mid-walk as 92erase_completion_lock, and can drop the lock temporarily mid-walk as
93long as the pointer you're holding is to a _valid_ node, not an 93long 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
127This semaphore is only used by the erase code which frees obsolete 127This mutex is only used by the erase code which frees obsolete node
128node references and the jffs2_garbage_collect_deletion_dirent() 128references and the jffs2_garbage_collect_deletion_dirent() function.
129function. The latter function on NAND flash must read _obsolete_ nodes 129The latter function on NAND flash must read _obsolete_ nodes to
130to determine whether the 'deletion dirent' under consideration can be 130determine whether the 'deletion dirent' under consideration can be
131discarded or whether it is still required to show that an inode has 131discarded or whether it is still required to show that an inode has
132been unlinked. Because reading from the flash may sleep, the 132been unlinked. Because reading from the flash may sleep, the
133erase_completion_lock cannot be held, so an alternative, more 133erase_completion_lock cannot be held, so an alternative, more