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 /mm/filemap.c | |
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 'mm/filemap.c')
-rw-r--r-- | mm/filemap.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index 478f4c74cc31..5fca2737c971 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -61,7 +61,7 @@ generic_file_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, | |||
61 | * ->swap_lock (exclusive_swap_page, others) | 61 | * ->swap_lock (exclusive_swap_page, others) |
62 | * ->mapping->tree_lock | 62 | * ->mapping->tree_lock |
63 | * | 63 | * |
64 | * ->i_sem | 64 | * ->i_mutex |
65 | * ->i_mmap_lock (truncate->unmap_mapping_range) | 65 | * ->i_mmap_lock (truncate->unmap_mapping_range) |
66 | * | 66 | * |
67 | * ->mmap_sem | 67 | * ->mmap_sem |
@@ -73,9 +73,9 @@ generic_file_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, | |||
73 | * ->lock_page (access_process_vm) | 73 | * ->lock_page (access_process_vm) |
74 | * | 74 | * |
75 | * ->mmap_sem | 75 | * ->mmap_sem |
76 | * ->i_sem (msync) | 76 | * ->i_mutex (msync) |
77 | * | 77 | * |
78 | * ->i_sem | 78 | * ->i_mutex |
79 | * ->i_alloc_sem (various) | 79 | * ->i_alloc_sem (various) |
80 | * | 80 | * |
81 | * ->inode_lock | 81 | * ->inode_lock |
@@ -276,7 +276,7 @@ static int wait_on_page_writeback_range(struct address_space *mapping, | |||
276 | * integrity" operation. It waits upon in-flight writeout before starting and | 276 | * integrity" operation. It waits upon in-flight writeout before starting and |
277 | * waiting upon new writeout. If there was an IO error, return it. | 277 | * waiting upon new writeout. If there was an IO error, return it. |
278 | * | 278 | * |
279 | * We need to re-take i_sem during the generic_osync_inode list walk because | 279 | * We need to re-take i_mutex during the generic_osync_inode list walk because |
280 | * it is otherwise livelockable. | 280 | * it is otherwise livelockable. |
281 | */ | 281 | */ |
282 | int sync_page_range(struct inode *inode, struct address_space *mapping, | 282 | int sync_page_range(struct inode *inode, struct address_space *mapping, |
@@ -290,9 +290,9 @@ int sync_page_range(struct inode *inode, struct address_space *mapping, | |||
290 | return 0; | 290 | return 0; |
291 | ret = filemap_fdatawrite_range(mapping, pos, pos + count - 1); | 291 | ret = filemap_fdatawrite_range(mapping, pos, pos + count - 1); |
292 | if (ret == 0) { | 292 | if (ret == 0) { |
293 | down(&inode->i_sem); | 293 | mutex_lock(&inode->i_mutex); |
294 | ret = generic_osync_inode(inode, mapping, OSYNC_METADATA); | 294 | ret = generic_osync_inode(inode, mapping, OSYNC_METADATA); |
295 | up(&inode->i_sem); | 295 | mutex_unlock(&inode->i_mutex); |
296 | } | 296 | } |
297 | if (ret == 0) | 297 | if (ret == 0) |
298 | ret = wait_on_page_writeback_range(mapping, start, end); | 298 | ret = wait_on_page_writeback_range(mapping, start, end); |
@@ -301,7 +301,7 @@ int sync_page_range(struct inode *inode, struct address_space *mapping, | |||
301 | EXPORT_SYMBOL(sync_page_range); | 301 | EXPORT_SYMBOL(sync_page_range); |
302 | 302 | ||
303 | /* | 303 | /* |
304 | * Note: Holding i_sem across sync_page_range_nolock is not a good idea | 304 | * Note: Holding i_mutex across sync_page_range_nolock is not a good idea |
305 | * as it forces O_SYNC writers to different parts of the same file | 305 | * as it forces O_SYNC writers to different parts of the same file |
306 | * to be serialised right until io completion. | 306 | * to be serialised right until io completion. |
307 | */ | 307 | */ |
@@ -1892,7 +1892,7 @@ generic_file_direct_write(struct kiocb *iocb, const struct iovec *iov, | |||
1892 | /* | 1892 | /* |
1893 | * Sync the fs metadata but not the minor inode changes and | 1893 | * Sync the fs metadata but not the minor inode changes and |
1894 | * of course not the data as we did direct DMA for the IO. | 1894 | * of course not the data as we did direct DMA for the IO. |
1895 | * i_sem is held, which protects generic_osync_inode() from | 1895 | * i_mutex is held, which protects generic_osync_inode() from |
1896 | * livelocking. | 1896 | * livelocking. |
1897 | */ | 1897 | */ |
1898 | if (written >= 0 && ((file->f_flags & O_SYNC) || IS_SYNC(inode))) { | 1898 | if (written >= 0 && ((file->f_flags & O_SYNC) || IS_SYNC(inode))) { |
@@ -2195,10 +2195,10 @@ ssize_t generic_file_aio_write(struct kiocb *iocb, const char __user *buf, | |||
2195 | 2195 | ||
2196 | BUG_ON(iocb->ki_pos != pos); | 2196 | BUG_ON(iocb->ki_pos != pos); |
2197 | 2197 | ||
2198 | down(&inode->i_sem); | 2198 | mutex_lock(&inode->i_mutex); |
2199 | ret = __generic_file_aio_write_nolock(iocb, &local_iov, 1, | 2199 | ret = __generic_file_aio_write_nolock(iocb, &local_iov, 1, |
2200 | &iocb->ki_pos); | 2200 | &iocb->ki_pos); |
2201 | up(&inode->i_sem); | 2201 | mutex_unlock(&inode->i_mutex); |
2202 | 2202 | ||
2203 | if (ret > 0 && ((file->f_flags & O_SYNC) || IS_SYNC(inode))) { | 2203 | if (ret > 0 && ((file->f_flags & O_SYNC) || IS_SYNC(inode))) { |
2204 | ssize_t err; | 2204 | ssize_t err; |
@@ -2220,9 +2220,9 @@ ssize_t generic_file_write(struct file *file, const char __user *buf, | |||
2220 | struct iovec local_iov = { .iov_base = (void __user *)buf, | 2220 | struct iovec local_iov = { .iov_base = (void __user *)buf, |
2221 | .iov_len = count }; | 2221 | .iov_len = count }; |
2222 | 2222 | ||
2223 | down(&inode->i_sem); | 2223 | mutex_lock(&inode->i_mutex); |
2224 | ret = __generic_file_write_nolock(file, &local_iov, 1, ppos); | 2224 | ret = __generic_file_write_nolock(file, &local_iov, 1, ppos); |
2225 | up(&inode->i_sem); | 2225 | mutex_unlock(&inode->i_mutex); |
2226 | 2226 | ||
2227 | if (ret > 0 && ((file->f_flags & O_SYNC) || IS_SYNC(inode))) { | 2227 | if (ret > 0 && ((file->f_flags & O_SYNC) || IS_SYNC(inode))) { |
2228 | ssize_t err; | 2228 | ssize_t err; |
@@ -2256,9 +2256,9 @@ ssize_t generic_file_writev(struct file *file, const struct iovec *iov, | |||
2256 | struct inode *inode = mapping->host; | 2256 | struct inode *inode = mapping->host; |
2257 | ssize_t ret; | 2257 | ssize_t ret; |
2258 | 2258 | ||
2259 | down(&inode->i_sem); | 2259 | mutex_lock(&inode->i_mutex); |
2260 | ret = __generic_file_write_nolock(file, iov, nr_segs, ppos); | 2260 | ret = __generic_file_write_nolock(file, iov, nr_segs, ppos); |
2261 | up(&inode->i_sem); | 2261 | mutex_unlock(&inode->i_mutex); |
2262 | 2262 | ||
2263 | if (ret > 0 && ((file->f_flags & O_SYNC) || IS_SYNC(inode))) { | 2263 | if (ret > 0 && ((file->f_flags & O_SYNC) || IS_SYNC(inode))) { |
2264 | int err; | 2264 | int err; |
@@ -2272,7 +2272,7 @@ ssize_t generic_file_writev(struct file *file, const struct iovec *iov, | |||
2272 | EXPORT_SYMBOL(generic_file_writev); | 2272 | EXPORT_SYMBOL(generic_file_writev); |
2273 | 2273 | ||
2274 | /* | 2274 | /* |
2275 | * Called under i_sem for writes to S_ISREG files. Returns -EIO if something | 2275 | * Called under i_mutex for writes to S_ISREG files. Returns -EIO if something |
2276 | * went wrong during pagecache shootdown. | 2276 | * went wrong during pagecache shootdown. |
2277 | */ | 2277 | */ |
2278 | static ssize_t | 2278 | static ssize_t |