diff options
author | Jes Sorensen <jes@sgi.com> | 2006-01-09 18:59:24 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@hera.kernel.org> | 2006-01-09 18:59:24 -0500 |
commit | 1b1dcc1b57a49136f118a0f16367256ff9994a69 (patch) | |
tree | b0b36d4f41d28c9d6514fb309d33c1a084d6309b /include | |
parent | 794ee1baee1c26be40410233e6c20bceb2b03c08 (diff) |
[PATCH] mutex subsystem, semaphore to mutex: VFS, ->i_sem
This patch converts the inode semaphore to a mutex. I have tested it on
XFS and compiled as much as one can consider on an ia64. Anyway your
luck with it might be different.
Modified-by: Ingo Molnar <mingo@elte.hu>
(finished the conversion)
Signed-off-by: Jes Sorensen <jes@sgi.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/ext3_fs_i.h | 2 | ||||
-rw-r--r-- | include/linux/fs.h | 7 | ||||
-rw-r--r-- | include/linux/jffs2_fs_i.h | 4 | ||||
-rw-r--r-- | include/linux/nfsd/nfsfh.h | 6 | ||||
-rw-r--r-- | include/linux/pipe_fs_i.h | 2 | ||||
-rw-r--r-- | include/linux/reiserfs_fs.h | 2 |
6 files changed, 12 insertions, 11 deletions
diff --git a/include/linux/ext3_fs_i.h b/include/linux/ext3_fs_i.h index 2914f7b07156..e71dd98dbcae 100644 --- a/include/linux/ext3_fs_i.h +++ b/include/linux/ext3_fs_i.h | |||
@@ -87,7 +87,7 @@ struct ext3_inode_info { | |||
87 | #ifdef CONFIG_EXT3_FS_XATTR | 87 | #ifdef CONFIG_EXT3_FS_XATTR |
88 | /* | 88 | /* |
89 | * Extended attributes can be read independently of the main file | 89 | * Extended attributes can be read independently of the main file |
90 | * data. Taking i_sem even when reading would cause contention | 90 | * data. Taking i_mutex even when reading would cause contention |
91 | * between readers of EAs and writers of regular file data, so | 91 | * between readers of EAs and writers of regular file data, so |
92 | * instead we synchronize on xattr_sem when reading or changing | 92 | * instead we synchronize on xattr_sem when reading or changing |
93 | * EAs. | 93 | * EAs. |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 4c82219b0fae..01654b218e42 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -219,6 +219,7 @@ extern int dir_notify_enable; | |||
219 | #include <linux/prio_tree.h> | 219 | #include <linux/prio_tree.h> |
220 | #include <linux/init.h> | 220 | #include <linux/init.h> |
221 | #include <linux/sched.h> | 221 | #include <linux/sched.h> |
222 | #include <linux/mutex.h> | ||
222 | 223 | ||
223 | #include <asm/atomic.h> | 224 | #include <asm/atomic.h> |
224 | #include <asm/semaphore.h> | 225 | #include <asm/semaphore.h> |
@@ -484,7 +485,7 @@ struct inode { | |||
484 | unsigned long i_blocks; | 485 | unsigned long i_blocks; |
485 | unsigned short i_bytes; | 486 | unsigned short i_bytes; |
486 | spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ | 487 | spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ |
487 | struct semaphore i_sem; | 488 | struct mutex i_mutex; |
488 | struct rw_semaphore i_alloc_sem; | 489 | struct rw_semaphore i_alloc_sem; |
489 | struct inode_operations *i_op; | 490 | struct inode_operations *i_op; |
490 | struct file_operations *i_fop; /* former ->i_op->default_file_ops */ | 491 | struct file_operations *i_fop; /* former ->i_op->default_file_ops */ |
@@ -1191,7 +1192,7 @@ int sync_inode(struct inode *inode, struct writeback_control *wbc); | |||
1191 | * directory. The name should be stored in the @name (with the | 1192 | * directory. The name should be stored in the @name (with the |
1192 | * understanding that it is already pointing to a a %NAME_MAX+1 sized | 1193 | * understanding that it is already pointing to a a %NAME_MAX+1 sized |
1193 | * buffer. get_name() should return %0 on success, a negative error code | 1194 | * buffer. get_name() should return %0 on success, a negative error code |
1194 | * or error. @get_name will be called without @parent->i_sem held. | 1195 | * or error. @get_name will be called without @parent->i_mutex held. |
1195 | * | 1196 | * |
1196 | * get_parent: | 1197 | * get_parent: |
1197 | * @get_parent should find the parent directory for the given @child which | 1198 | * @get_parent should find the parent directory for the given @child which |
@@ -1213,7 +1214,7 @@ int sync_inode(struct inode *inode, struct writeback_control *wbc); | |||
1213 | * nfsd_find_fh_dentry() in either the @obj or @parent parameters. | 1214 | * nfsd_find_fh_dentry() in either the @obj or @parent parameters. |
1214 | * | 1215 | * |
1215 | * Locking rules: | 1216 | * Locking rules: |
1216 | * get_parent is called with child->d_inode->i_sem down | 1217 | * get_parent is called with child->d_inode->i_mutex down |
1217 | * get_name is not (which is possibly inconsistent) | 1218 | * get_name is not (which is possibly inconsistent) |
1218 | */ | 1219 | */ |
1219 | 1220 | ||
diff --git a/include/linux/jffs2_fs_i.h b/include/linux/jffs2_fs_i.h index ef85ab56302b..ad565bf9dcc1 100644 --- a/include/linux/jffs2_fs_i.h +++ b/include/linux/jffs2_fs_i.h | |||
@@ -8,11 +8,11 @@ | |||
8 | #include <asm/semaphore.h> | 8 | #include <asm/semaphore.h> |
9 | 9 | ||
10 | struct jffs2_inode_info { | 10 | struct jffs2_inode_info { |
11 | /* We need an internal semaphore similar to inode->i_sem. | 11 | /* We need an internal mutex similar to inode->i_mutex. |
12 | Unfortunately, we can't used the existing one, because | 12 | Unfortunately, we can't used the existing one, because |
13 | either the GC would deadlock, or we'd have to release it | 13 | either the GC would deadlock, or we'd have to release it |
14 | before letting GC proceed. Or we'd have to put ugliness | 14 | before letting GC proceed. Or we'd have to put ugliness |
15 | into the GC code so it didn't attempt to obtain the i_sem | 15 | into the GC code so it didn't attempt to obtain the i_mutex |
16 | for the inode(s) which are already locked */ | 16 | for the inode(s) which are already locked */ |
17 | struct semaphore sem; | 17 | struct semaphore sem; |
18 | 18 | ||
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h index bb842ea41033..0798b7781a6e 100644 --- a/include/linux/nfsd/nfsfh.h +++ b/include/linux/nfsd/nfsfh.h | |||
@@ -294,7 +294,7 @@ fill_post_wcc(struct svc_fh *fhp) | |||
294 | /* | 294 | /* |
295 | * Lock a file handle/inode | 295 | * Lock a file handle/inode |
296 | * NOTE: both fh_lock and fh_unlock are done "by hand" in | 296 | * NOTE: both fh_lock and fh_unlock are done "by hand" in |
297 | * vfs.c:nfsd_rename as it needs to grab 2 i_sem's at once | 297 | * vfs.c:nfsd_rename as it needs to grab 2 i_mutex's at once |
298 | * so, any changes here should be reflected there. | 298 | * so, any changes here should be reflected there. |
299 | */ | 299 | */ |
300 | static inline void | 300 | static inline void |
@@ -317,7 +317,7 @@ fh_lock(struct svc_fh *fhp) | |||
317 | } | 317 | } |
318 | 318 | ||
319 | inode = dentry->d_inode; | 319 | inode = dentry->d_inode; |
320 | down(&inode->i_sem); | 320 | mutex_lock(&inode->i_mutex); |
321 | fill_pre_wcc(fhp); | 321 | fill_pre_wcc(fhp); |
322 | fhp->fh_locked = 1; | 322 | fhp->fh_locked = 1; |
323 | } | 323 | } |
@@ -333,7 +333,7 @@ fh_unlock(struct svc_fh *fhp) | |||
333 | 333 | ||
334 | if (fhp->fh_locked) { | 334 | if (fhp->fh_locked) { |
335 | fill_post_wcc(fhp); | 335 | fill_post_wcc(fhp); |
336 | up(&fhp->fh_dentry->d_inode->i_sem); | 336 | mutex_unlock(&fhp->fh_dentry->d_inode->i_mutex); |
337 | fhp->fh_locked = 0; | 337 | fhp->fh_locked = 0; |
338 | } | 338 | } |
339 | } | 339 | } |
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h index 1767073df26f..b12e59c75752 100644 --- a/include/linux/pipe_fs_i.h +++ b/include/linux/pipe_fs_i.h | |||
@@ -37,7 +37,7 @@ struct pipe_inode_info { | |||
37 | memory allocation, whereas PIPE_BUF makes atomicity guarantees. */ | 37 | memory allocation, whereas PIPE_BUF makes atomicity guarantees. */ |
38 | #define PIPE_SIZE PAGE_SIZE | 38 | #define PIPE_SIZE PAGE_SIZE |
39 | 39 | ||
40 | #define PIPE_SEM(inode) (&(inode).i_sem) | 40 | #define PIPE_MUTEX(inode) (&(inode).i_mutex) |
41 | #define PIPE_WAIT(inode) (&(inode).i_pipe->wait) | 41 | #define PIPE_WAIT(inode) (&(inode).i_pipe->wait) |
42 | #define PIPE_READERS(inode) ((inode).i_pipe->readers) | 42 | #define PIPE_READERS(inode) ((inode).i_pipe->readers) |
43 | #define PIPE_WRITERS(inode) ((inode).i_pipe->writers) | 43 | #define PIPE_WRITERS(inode) ((inode).i_pipe->writers) |
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index 001ab82df051..e276c5ba2bb7 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h | |||
@@ -1857,7 +1857,7 @@ void padd_item(char *item, int total_length, int length); | |||
1857 | #define GET_BLOCK_CREATE 1 /* add anything you need to find block */ | 1857 | #define GET_BLOCK_CREATE 1 /* add anything you need to find block */ |
1858 | #define GET_BLOCK_NO_HOLE 2 /* return -ENOENT for file holes */ | 1858 | #define GET_BLOCK_NO_HOLE 2 /* return -ENOENT for file holes */ |
1859 | #define GET_BLOCK_READ_DIRECT 4 /* read the tail if indirect item not found */ | 1859 | #define GET_BLOCK_READ_DIRECT 4 /* read the tail if indirect item not found */ |
1860 | #define GET_BLOCK_NO_ISEM 8 /* i_sem is not held, don't preallocate */ | 1860 | #define GET_BLOCK_NO_IMUX 8 /* i_mutex is not held, don't preallocate */ |
1861 | #define GET_BLOCK_NO_DANGLE 16 /* don't leave any transactions running */ | 1861 | #define GET_BLOCK_NO_DANGLE 16 /* don't leave any transactions running */ |
1862 | 1862 | ||
1863 | int restart_transaction(struct reiserfs_transaction_handle *th, | 1863 | int restart_transaction(struct reiserfs_transaction_handle *th, |