diff options
Diffstat (limited to 'include/linux/reiserfs_fs.h')
| -rw-r--r-- | include/linux/reiserfs_fs.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index c96c1858fe2c..1ba3cf6edfbb 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h | |||
| @@ -62,6 +62,12 @@ void reiserfs_write_unlock(struct super_block *s); | |||
| 62 | int reiserfs_write_lock_once(struct super_block *s); | 62 | int reiserfs_write_lock_once(struct super_block *s); |
| 63 | void reiserfs_write_unlock_once(struct super_block *s, int lock_depth); | 63 | void reiserfs_write_unlock_once(struct super_block *s, int lock_depth); |
| 64 | 64 | ||
| 65 | #ifdef CONFIG_REISERFS_CHECK | ||
| 66 | void reiserfs_lock_check_recursive(struct super_block *s); | ||
| 67 | #else | ||
| 68 | static inline void reiserfs_lock_check_recursive(struct super_block *s) { } | ||
| 69 | #endif | ||
| 70 | |||
| 65 | /* | 71 | /* |
| 66 | * Several mutexes depend on the write lock. | 72 | * Several mutexes depend on the write lock. |
| 67 | * However sometimes we want to relax the write lock while we hold | 73 | * However sometimes we want to relax the write lock while we hold |
| @@ -92,11 +98,31 @@ void reiserfs_write_unlock_once(struct super_block *s, int lock_depth); | |||
| 92 | static inline void reiserfs_mutex_lock_safe(struct mutex *m, | 98 | static inline void reiserfs_mutex_lock_safe(struct mutex *m, |
| 93 | struct super_block *s) | 99 | struct super_block *s) |
| 94 | { | 100 | { |
| 101 | reiserfs_lock_check_recursive(s); | ||
| 95 | reiserfs_write_unlock(s); | 102 | reiserfs_write_unlock(s); |
| 96 | mutex_lock(m); | 103 | mutex_lock(m); |
| 97 | reiserfs_write_lock(s); | 104 | reiserfs_write_lock(s); |
| 98 | } | 105 | } |
| 99 | 106 | ||
| 107 | static inline void | ||
| 108 | reiserfs_mutex_lock_nested_safe(struct mutex *m, unsigned int subclass, | ||
| 109 | struct super_block *s) | ||
| 110 | { | ||
| 111 | reiserfs_lock_check_recursive(s); | ||
| 112 | reiserfs_write_unlock(s); | ||
| 113 | mutex_lock_nested(m, subclass); | ||
| 114 | reiserfs_write_lock(s); | ||
| 115 | } | ||
| 116 | |||
| 117 | static inline void | ||
| 118 | reiserfs_down_read_safe(struct rw_semaphore *sem, struct super_block *s) | ||
| 119 | { | ||
| 120 | reiserfs_lock_check_recursive(s); | ||
| 121 | reiserfs_write_unlock(s); | ||
| 122 | down_read(sem); | ||
| 123 | reiserfs_write_lock(s); | ||
| 124 | } | ||
| 125 | |||
| 100 | /* | 126 | /* |
| 101 | * When we schedule, we usually want to also release the write lock, | 127 | * When we schedule, we usually want to also release the write lock, |
| 102 | * according to the previous bkl based locking scheme of reiserfs. | 128 | * according to the previous bkl based locking scheme of reiserfs. |
