diff options
author | Mark Fasheh <mark.fasheh@oracle.com> | 2006-01-10 18:41:43 -0500 |
---|---|---|
committer | Mark Fasheh <mark.fasheh@oracle.com> | 2006-02-03 16:47:19 -0500 |
commit | 251b6eccbeff4f0f8a3509769b327705e899f5dd (patch) | |
tree | 7da835c3bebc8150a1a1ae6abb681a1e1a9c5f36 /fs/ocfs2 | |
parent | aee93ac4b7ad461255939248d0d51566cff77e05 (diff) |
[OCFS2] Make ip_io_sem a mutex
ip_io_sem is now ip_io_mutex.
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r-- | fs/ocfs2/buffer_head_io.c | 10 | ||||
-rw-r--r-- | fs/ocfs2/inode.c | 6 | ||||
-rw-r--r-- | fs/ocfs2/inode.h | 4 | ||||
-rw-r--r-- | fs/ocfs2/journal.c | 4 | ||||
-rw-r--r-- | fs/ocfs2/super.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/uptodate.c | 10 |
6 files changed, 18 insertions, 18 deletions
diff --git a/fs/ocfs2/buffer_head_io.c b/fs/ocfs2/buffer_head_io.c index d424041b38e9..bae3d7548bea 100644 --- a/fs/ocfs2/buffer_head_io.c +++ b/fs/ocfs2/buffer_head_io.c | |||
@@ -58,7 +58,7 @@ int ocfs2_write_block(struct ocfs2_super *osb, struct buffer_head *bh, | |||
58 | goto out; | 58 | goto out; |
59 | } | 59 | } |
60 | 60 | ||
61 | down(&OCFS2_I(inode)->ip_io_sem); | 61 | mutex_lock(&OCFS2_I(inode)->ip_io_mutex); |
62 | 62 | ||
63 | lock_buffer(bh); | 63 | lock_buffer(bh); |
64 | set_buffer_uptodate(bh); | 64 | set_buffer_uptodate(bh); |
@@ -82,7 +82,7 @@ int ocfs2_write_block(struct ocfs2_super *osb, struct buffer_head *bh, | |||
82 | brelse(bh); | 82 | brelse(bh); |
83 | } | 83 | } |
84 | 84 | ||
85 | up(&OCFS2_I(inode)->ip_io_sem); | 85 | mutex_unlock(&OCFS2_I(inode)->ip_io_mutex); |
86 | out: | 86 | out: |
87 | mlog_exit(ret); | 87 | mlog_exit(ret); |
88 | return ret; | 88 | return ret; |
@@ -125,13 +125,13 @@ int ocfs2_read_blocks(struct ocfs2_super *osb, u64 block, int nr, | |||
125 | flags &= ~OCFS2_BH_CACHED; | 125 | flags &= ~OCFS2_BH_CACHED; |
126 | 126 | ||
127 | if (inode) | 127 | if (inode) |
128 | down(&OCFS2_I(inode)->ip_io_sem); | 128 | mutex_lock(&OCFS2_I(inode)->ip_io_mutex); |
129 | for (i = 0 ; i < nr ; i++) { | 129 | for (i = 0 ; i < nr ; i++) { |
130 | if (bhs[i] == NULL) { | 130 | if (bhs[i] == NULL) { |
131 | bhs[i] = sb_getblk(sb, block++); | 131 | bhs[i] = sb_getblk(sb, block++); |
132 | if (bhs[i] == NULL) { | 132 | if (bhs[i] == NULL) { |
133 | if (inode) | 133 | if (inode) |
134 | up(&OCFS2_I(inode)->ip_io_sem); | 134 | mutex_unlock(&OCFS2_I(inode)->ip_io_mutex); |
135 | status = -EIO; | 135 | status = -EIO; |
136 | mlog_errno(status); | 136 | mlog_errno(status); |
137 | goto bail; | 137 | goto bail; |
@@ -220,7 +220,7 @@ int ocfs2_read_blocks(struct ocfs2_super *osb, u64 block, int nr, | |||
220 | ocfs2_set_buffer_uptodate(inode, bh); | 220 | ocfs2_set_buffer_uptodate(inode, bh); |
221 | } | 221 | } |
222 | if (inode) | 222 | if (inode) |
223 | up(&OCFS2_I(inode)->ip_io_sem); | 223 | mutex_unlock(&OCFS2_I(inode)->ip_io_mutex); |
224 | 224 | ||
225 | mlog(ML_BH_IO, "block=(%"MLFu64"), nr=(%d), cached=%s\n", block, nr, | 225 | mlog(ML_BH_IO, "block=(%"MLFu64"), nr=(%d), cached=%s\n", block, nr, |
226 | (!(flags & OCFS2_BH_CACHED) || ignore_cache) ? "no" : "yes"); | 226 | (!(flags & OCFS2_BH_CACHED) || ignore_cache) ? "no" : "yes"); |
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index d4ecc0627716..8122489c5762 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c | |||
@@ -903,10 +903,10 @@ void ocfs2_clear_inode(struct inode *inode) | |||
903 | "Clear inode of %"MLFu64", inode is locked\n", | 903 | "Clear inode of %"MLFu64", inode is locked\n", |
904 | oi->ip_blkno); | 904 | oi->ip_blkno); |
905 | 905 | ||
906 | mlog_bug_on_msg(down_trylock(&oi->ip_io_sem), | 906 | mlog_bug_on_msg(!mutex_trylock(&oi->ip_io_mutex), |
907 | "Clear inode of %"MLFu64", io_sem is locked\n", | 907 | "Clear inode of %"MLFu64", io_mutex is locked\n", |
908 | oi->ip_blkno); | 908 | oi->ip_blkno); |
909 | up(&oi->ip_io_sem); | 909 | mutex_unlock(&oi->ip_io_mutex); |
910 | 910 | ||
911 | /* | 911 | /* |
912 | * down_trylock() returns 0, down_write_trylock() returns 1 | 912 | * down_trylock() returns 0, down_write_trylock() returns 1 |
diff --git a/fs/ocfs2/inode.h b/fs/ocfs2/inode.h index 9b0177433653..84c507961287 100644 --- a/fs/ocfs2/inode.h +++ b/fs/ocfs2/inode.h | |||
@@ -46,10 +46,10 @@ struct ocfs2_inode_info | |||
46 | struct list_head ip_io_markers; | 46 | struct list_head ip_io_markers; |
47 | int ip_orphaned_slot; | 47 | int ip_orphaned_slot; |
48 | 48 | ||
49 | struct semaphore ip_io_sem; | 49 | struct mutex ip_io_mutex; |
50 | 50 | ||
51 | /* Used by the journalling code to attach an inode to a | 51 | /* Used by the journalling code to attach an inode to a |
52 | * handle. These are protected by ip_io_sem in order to lock | 52 | * handle. These are protected by ip_io_mutex in order to lock |
53 | * out other I/O to the inode until we either commit or | 53 | * out other I/O to the inode until we either commit or |
54 | * abort. */ | 54 | * abort. */ |
55 | struct list_head ip_handle_list; | 55 | struct list_head ip_handle_list; |
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index 303c8d96457f..65bd69d1c710 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c | |||
@@ -401,7 +401,7 @@ int ocfs2_journal_access(struct ocfs2_journal_handle *handle, | |||
401 | * j_trans_barrier for us. */ | 401 | * j_trans_barrier for us. */ |
402 | ocfs2_set_inode_lock_trans(OCFS2_SB(inode->i_sb)->journal, inode); | 402 | ocfs2_set_inode_lock_trans(OCFS2_SB(inode->i_sb)->journal, inode); |
403 | 403 | ||
404 | down(&OCFS2_I(inode)->ip_io_sem); | 404 | mutex_lock(&OCFS2_I(inode)->ip_io_mutex); |
405 | switch (type) { | 405 | switch (type) { |
406 | case OCFS2_JOURNAL_ACCESS_CREATE: | 406 | case OCFS2_JOURNAL_ACCESS_CREATE: |
407 | case OCFS2_JOURNAL_ACCESS_WRITE: | 407 | case OCFS2_JOURNAL_ACCESS_WRITE: |
@@ -416,7 +416,7 @@ int ocfs2_journal_access(struct ocfs2_journal_handle *handle, | |||
416 | status = -EINVAL; | 416 | status = -EINVAL; |
417 | mlog(ML_ERROR, "Uknown access type!\n"); | 417 | mlog(ML_ERROR, "Uknown access type!\n"); |
418 | } | 418 | } |
419 | up(&OCFS2_I(inode)->ip_io_sem); | 419 | mutex_unlock(&OCFS2_I(inode)->ip_io_mutex); |
420 | 420 | ||
421 | if (status < 0) | 421 | if (status < 0) |
422 | mlog(ML_ERROR, "Error %d getting %d access to buffer!\n", | 422 | mlog(ML_ERROR, "Error %d getting %d access to buffer!\n", |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 364d64bd5f10..c44075d4b576 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -932,7 +932,7 @@ static void ocfs2_inode_init_once(void *data, | |||
932 | oi->ip_dir_start_lookup = 0; | 932 | oi->ip_dir_start_lookup = 0; |
933 | 933 | ||
934 | init_rwsem(&oi->ip_alloc_sem); | 934 | init_rwsem(&oi->ip_alloc_sem); |
935 | init_MUTEX(&(oi->ip_io_sem)); | 935 | mutex_init(&oi->ip_io_mutex); |
936 | 936 | ||
937 | oi->ip_blkno = 0ULL; | 937 | oi->ip_blkno = 0ULL; |
938 | oi->ip_clusters = 0; | 938 | oi->ip_clusters = 0; |
diff --git a/fs/ocfs2/uptodate.c b/fs/ocfs2/uptodate.c index 50c8fb3de0a3..300b5bedfb21 100644 --- a/fs/ocfs2/uptodate.c +++ b/fs/ocfs2/uptodate.c | |||
@@ -388,7 +388,7 @@ out_free: | |||
388 | } | 388 | } |
389 | } | 389 | } |
390 | 390 | ||
391 | /* Item insertion is guarded by ip_io_sem, so the insertion path takes | 391 | /* Item insertion is guarded by ip_io_mutex, so the insertion path takes |
392 | * advantage of this by not rechecking for a duplicate insert during | 392 | * advantage of this by not rechecking for a duplicate insert during |
393 | * the slow case. Additionally, if the cache needs to be bumped up to | 393 | * the slow case. Additionally, if the cache needs to be bumped up to |
394 | * a tree, the code will not recheck after acquiring the lock -- | 394 | * a tree, the code will not recheck after acquiring the lock -- |
@@ -418,7 +418,7 @@ void ocfs2_set_buffer_uptodate(struct inode *inode, | |||
418 | (unsigned long long) bh->b_blocknr); | 418 | (unsigned long long) bh->b_blocknr); |
419 | 419 | ||
420 | /* No need to recheck under spinlock - insertion is guarded by | 420 | /* No need to recheck under spinlock - insertion is guarded by |
421 | * ip_io_sem */ | 421 | * ip_io_mutex */ |
422 | spin_lock(&oi->ip_lock); | 422 | spin_lock(&oi->ip_lock); |
423 | if (ocfs2_insert_can_use_array(oi, ci)) { | 423 | if (ocfs2_insert_can_use_array(oi, ci)) { |
424 | /* Fast case - it's an array and there's a free | 424 | /* Fast case - it's an array and there's a free |
@@ -440,7 +440,7 @@ void ocfs2_set_buffer_uptodate(struct inode *inode, | |||
440 | 440 | ||
441 | /* Called against a newly allocated buffer. Most likely nobody should | 441 | /* Called against a newly allocated buffer. Most likely nobody should |
442 | * be able to read this sort of metadata while it's still being | 442 | * be able to read this sort of metadata while it's still being |
443 | * allocated, but this is careful to take ip_io_sem anyway. */ | 443 | * allocated, but this is careful to take ip_io_mutex anyway. */ |
444 | void ocfs2_set_new_buffer_uptodate(struct inode *inode, | 444 | void ocfs2_set_new_buffer_uptodate(struct inode *inode, |
445 | struct buffer_head *bh) | 445 | struct buffer_head *bh) |
446 | { | 446 | { |
@@ -451,9 +451,9 @@ void ocfs2_set_new_buffer_uptodate(struct inode *inode, | |||
451 | 451 | ||
452 | set_buffer_uptodate(bh); | 452 | set_buffer_uptodate(bh); |
453 | 453 | ||
454 | down(&oi->ip_io_sem); | 454 | mutex_lock(&oi->ip_io_mutex); |
455 | ocfs2_set_buffer_uptodate(inode, bh); | 455 | ocfs2_set_buffer_uptodate(inode, bh); |
456 | up(&oi->ip_io_sem); | 456 | mutex_unlock(&oi->ip_io_mutex); |
457 | } | 457 | } |
458 | 458 | ||
459 | /* Requires ip_lock. */ | 459 | /* Requires ip_lock. */ |