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 /fs/ocfs2/alloc.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 'fs/ocfs2/alloc.c')
-rw-r--r-- | fs/ocfs2/alloc.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index 465f797451ee..6b9812db3779 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -966,7 +966,7 @@ static int ocfs2_truncate_log_append(struct ocfs2_super *osb, | |||
966 | mlog_entry("start_blk = %"MLFu64", num_clusters = %u\n", start_blk, | 966 | mlog_entry("start_blk = %"MLFu64", num_clusters = %u\n", start_blk, |
967 | num_clusters); | 967 | num_clusters); |
968 | 968 | ||
969 | BUG_ON(!down_trylock(&tl_inode->i_sem)); | 969 | BUG_ON(mutex_trylock(&tl_inode->i_mutex)); |
970 | 970 | ||
971 | start_cluster = ocfs2_blocks_to_clusters(osb->sb, start_blk); | 971 | start_cluster = ocfs2_blocks_to_clusters(osb->sb, start_blk); |
972 | 972 | ||
@@ -1108,7 +1108,7 @@ bail: | |||
1108 | return status; | 1108 | return status; |
1109 | } | 1109 | } |
1110 | 1110 | ||
1111 | /* Expects you to already be holding tl_inode->i_sem */ | 1111 | /* Expects you to already be holding tl_inode->i_mutex */ |
1112 | static int __ocfs2_flush_truncate_log(struct ocfs2_super *osb) | 1112 | static int __ocfs2_flush_truncate_log(struct ocfs2_super *osb) |
1113 | { | 1113 | { |
1114 | int status; | 1114 | int status; |
@@ -1123,7 +1123,7 @@ static int __ocfs2_flush_truncate_log(struct ocfs2_super *osb) | |||
1123 | 1123 | ||
1124 | mlog_entry_void(); | 1124 | mlog_entry_void(); |
1125 | 1125 | ||
1126 | BUG_ON(!down_trylock(&tl_inode->i_sem)); | 1126 | BUG_ON(mutex_trylock(&tl_inode->i_mutex)); |
1127 | 1127 | ||
1128 | di = (struct ocfs2_dinode *) tl_bh->b_data; | 1128 | di = (struct ocfs2_dinode *) tl_bh->b_data; |
1129 | tl = &di->id2.i_dealloc; | 1129 | tl = &di->id2.i_dealloc; |
@@ -1198,9 +1198,9 @@ int ocfs2_flush_truncate_log(struct ocfs2_super *osb) | |||
1198 | int status; | 1198 | int status; |
1199 | struct inode *tl_inode = osb->osb_tl_inode; | 1199 | struct inode *tl_inode = osb->osb_tl_inode; |
1200 | 1200 | ||
1201 | down(&tl_inode->i_sem); | 1201 | mutex_lock(&tl_inode->i_mutex); |
1202 | status = __ocfs2_flush_truncate_log(osb); | 1202 | status = __ocfs2_flush_truncate_log(osb); |
1203 | up(&tl_inode->i_sem); | 1203 | mutex_unlock(&tl_inode->i_mutex); |
1204 | 1204 | ||
1205 | return status; | 1205 | return status; |
1206 | } | 1206 | } |
@@ -1363,7 +1363,7 @@ int ocfs2_complete_truncate_log_recovery(struct ocfs2_super *osb, | |||
1363 | mlog(0, "cleanup %u records from %"MLFu64"\n", num_recs, | 1363 | mlog(0, "cleanup %u records from %"MLFu64"\n", num_recs, |
1364 | tl_copy->i_blkno); | 1364 | tl_copy->i_blkno); |
1365 | 1365 | ||
1366 | down(&tl_inode->i_sem); | 1366 | mutex_lock(&tl_inode->i_mutex); |
1367 | for(i = 0; i < num_recs; i++) { | 1367 | for(i = 0; i < num_recs; i++) { |
1368 | if (ocfs2_truncate_log_needs_flush(osb)) { | 1368 | if (ocfs2_truncate_log_needs_flush(osb)) { |
1369 | status = __ocfs2_flush_truncate_log(osb); | 1369 | status = __ocfs2_flush_truncate_log(osb); |
@@ -1395,7 +1395,7 @@ int ocfs2_complete_truncate_log_recovery(struct ocfs2_super *osb, | |||
1395 | } | 1395 | } |
1396 | 1396 | ||
1397 | bail_up: | 1397 | bail_up: |
1398 | up(&tl_inode->i_sem); | 1398 | mutex_unlock(&tl_inode->i_mutex); |
1399 | 1399 | ||
1400 | mlog_exit(status); | 1400 | mlog_exit(status); |
1401 | return status; | 1401 | return status; |
@@ -1840,7 +1840,7 @@ start: | |||
1840 | 1840 | ||
1841 | mlog(0, "clusters_to_del = %u in this pass\n", clusters_to_del); | 1841 | mlog(0, "clusters_to_del = %u in this pass\n", clusters_to_del); |
1842 | 1842 | ||
1843 | down(&tl_inode->i_sem); | 1843 | mutex_lock(&tl_inode->i_mutex); |
1844 | tl_sem = 1; | 1844 | tl_sem = 1; |
1845 | /* ocfs2_truncate_log_needs_flush guarantees us at least one | 1845 | /* ocfs2_truncate_log_needs_flush guarantees us at least one |
1846 | * record is free for use. If there isn't any, we flush to get | 1846 | * record is free for use. If there isn't any, we flush to get |
@@ -1875,7 +1875,7 @@ start: | |||
1875 | goto bail; | 1875 | goto bail; |
1876 | } | 1876 | } |
1877 | 1877 | ||
1878 | up(&tl_inode->i_sem); | 1878 | mutex_unlock(&tl_inode->i_mutex); |
1879 | tl_sem = 0; | 1879 | tl_sem = 0; |
1880 | 1880 | ||
1881 | ocfs2_commit_trans(handle); | 1881 | ocfs2_commit_trans(handle); |
@@ -1890,7 +1890,7 @@ bail: | |||
1890 | ocfs2_schedule_truncate_log_flush(osb, 1); | 1890 | ocfs2_schedule_truncate_log_flush(osb, 1); |
1891 | 1891 | ||
1892 | if (tl_sem) | 1892 | if (tl_sem) |
1893 | up(&tl_inode->i_sem); | 1893 | mutex_unlock(&tl_inode->i_mutex); |
1894 | 1894 | ||
1895 | if (handle) | 1895 | if (handle) |
1896 | ocfs2_commit_trans(handle); | 1896 | ocfs2_commit_trans(handle); |
@@ -1994,7 +1994,7 @@ int ocfs2_prepare_truncate(struct ocfs2_super *osb, | |||
1994 | goto bail; | 1994 | goto bail; |
1995 | } | 1995 | } |
1996 | 1996 | ||
1997 | down(&ext_alloc_inode->i_sem); | 1997 | mutex_lock(&ext_alloc_inode->i_mutex); |
1998 | (*tc)->tc_ext_alloc_inode = ext_alloc_inode; | 1998 | (*tc)->tc_ext_alloc_inode = ext_alloc_inode; |
1999 | 1999 | ||
2000 | status = ocfs2_meta_lock(ext_alloc_inode, | 2000 | status = ocfs2_meta_lock(ext_alloc_inode, |
@@ -2026,7 +2026,7 @@ static void ocfs2_free_truncate_context(struct ocfs2_truncate_context *tc) | |||
2026 | if (tc->tc_ext_alloc_locked) | 2026 | if (tc->tc_ext_alloc_locked) |
2027 | ocfs2_meta_unlock(tc->tc_ext_alloc_inode, 1); | 2027 | ocfs2_meta_unlock(tc->tc_ext_alloc_inode, 1); |
2028 | 2028 | ||
2029 | up(&tc->tc_ext_alloc_inode->i_sem); | 2029 | mutex_unlock(&tc->tc_ext_alloc_inode->i_mutex); |
2030 | iput(tc->tc_ext_alloc_inode); | 2030 | iput(tc->tc_ext_alloc_inode); |
2031 | } | 2031 | } |
2032 | 2032 | ||