diff options
author | Dave Chinner <dchinner@redhat.com> | 2011-03-22 07:23:36 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-03-24 21:16:31 -0400 |
commit | 250df6ed274d767da844a5d9f05720b804240197 (patch) | |
tree | b74f49a86c4451d9e3e82f90e3f791163025be21 /include/linux | |
parent | 3dc8fe4dca9cd3e4aa828ed36451e2bcfd2350da (diff) |
fs: protect inode->i_state with inode->i_lock
Protect inode state transitions and validity checks with the
inode->i_lock. This enables us to make inode state transitions
independently of the inode_lock and is the first step to peeling
away the inode_lock from the code.
This requires that __iget() is done atomically with i_state checks
during list traversals so that we don't race with another thread
marking the inode I_FREEING between the state check and grabbing the
reference.
Also remove the unlock_new_inode() memory barrier optimisation
required to avoid taking the inode_lock when clearing I_NEW.
Simplify the code by simply taking the inode->i_lock around the
state change and wakeup. Because the wakeup is no longer tricky,
remove the wake_up_inode() function and open code the wakeup where
necessary.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/fs.h | 2 | ||||
-rw-r--r-- | include/linux/quotaops.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 4dda076c24a1..ed6fdcc1484c 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1647,7 +1647,7 @@ struct super_operations { | |||
1647 | }; | 1647 | }; |
1648 | 1648 | ||
1649 | /* | 1649 | /* |
1650 | * Inode state bits. Protected by inode_lock. | 1650 | * Inode state bits. Protected by inode->i_lock |
1651 | * | 1651 | * |
1652 | * Three bits determine the dirty state of the inode, I_DIRTY_SYNC, | 1652 | * Three bits determine the dirty state of the inode, I_DIRTY_SYNC, |
1653 | * I_DIRTY_DATASYNC and I_DIRTY_PAGES. | 1653 | * I_DIRTY_DATASYNC and I_DIRTY_PAGES. |
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index eb354f6f26b3..26f9e3612e0f 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h | |||
@@ -277,7 +277,7 @@ static inline int dquot_alloc_space(struct inode *inode, qsize_t nr) | |||
277 | /* | 277 | /* |
278 | * Mark inode fully dirty. Since we are allocating blocks, inode | 278 | * Mark inode fully dirty. Since we are allocating blocks, inode |
279 | * would become fully dirty soon anyway and it reportedly | 279 | * would become fully dirty soon anyway and it reportedly |
280 | * reduces inode_lock contention. | 280 | * reduces lock contention. |
281 | */ | 281 | */ |
282 | mark_inode_dirty(inode); | 282 | mark_inode_dirty(inode); |
283 | } | 283 | } |