aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs
diff options
context:
space:
mode:
authorJes Sorensen <jes@sgi.com>2006-01-09 18:59:24 -0500
committerIngo Molnar <mingo@hera.kernel.org>2006-01-09 18:59:24 -0500
commit1b1dcc1b57a49136f118a0f16367256ff9994a69 (patch)
treeb0b36d4f41d28c9d6514fb309d33c1a084d6309b /fs/reiserfs
parent794ee1baee1c26be40410233e6c20bceb2b03c08 (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/reiserfs')
-rw-r--r--fs/reiserfs/file.c10
-rw-r--r--fs/reiserfs/inode.c14
-rw-r--r--fs/reiserfs/ioctl.c4
-rw-r--r--fs/reiserfs/super.c4
-rw-r--r--fs/reiserfs/tail_conversion.c2
-rw-r--r--fs/reiserfs/xattr.c34
-rw-r--r--fs/reiserfs/xattr_acl.c6
7 files changed, 37 insertions, 37 deletions
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c
index 7892a865b58a..127e7d2cabdd 100644
--- a/fs/reiserfs/file.c
+++ b/fs/reiserfs/file.c
@@ -49,7 +49,7 @@ static int reiserfs_file_release(struct inode *inode, struct file *filp)
49 } 49 }
50 50
51 reiserfs_write_lock(inode->i_sb); 51 reiserfs_write_lock(inode->i_sb);
52 down(&inode->i_sem); 52 mutex_lock(&inode->i_mutex);
53 /* freeing preallocation only involves relogging blocks that 53 /* freeing preallocation only involves relogging blocks that
54 * are already in the current transaction. preallocation gets 54 * are already in the current transaction. preallocation gets
55 * freed at the end of each transaction, so it is impossible for 55 * freed at the end of each transaction, so it is impossible for
@@ -100,7 +100,7 @@ static int reiserfs_file_release(struct inode *inode, struct file *filp)
100 err = reiserfs_truncate_file(inode, 0); 100 err = reiserfs_truncate_file(inode, 0);
101 } 101 }
102 out: 102 out:
103 up(&inode->i_sem); 103 mutex_unlock(&inode->i_mutex);
104 reiserfs_write_unlock(inode->i_sb); 104 reiserfs_write_unlock(inode->i_sb);
105 return err; 105 return err;
106} 106}
@@ -1342,7 +1342,7 @@ static ssize_t reiserfs_file_write(struct file *file, /* the file we are going t
1342 if (unlikely(!access_ok(VERIFY_READ, buf, count))) 1342 if (unlikely(!access_ok(VERIFY_READ, buf, count)))
1343 return -EFAULT; 1343 return -EFAULT;
1344 1344
1345 down(&inode->i_sem); // locks the entire file for just us 1345 mutex_lock(&inode->i_mutex); // locks the entire file for just us
1346 1346
1347 pos = *ppos; 1347 pos = *ppos;
1348 1348
@@ -1532,12 +1532,12 @@ static ssize_t reiserfs_file_write(struct file *file, /* the file we are going t
1532 generic_osync_inode(inode, file->f_mapping, 1532 generic_osync_inode(inode, file->f_mapping,
1533 OSYNC_METADATA | OSYNC_DATA); 1533 OSYNC_METADATA | OSYNC_DATA);
1534 1534
1535 up(&inode->i_sem); 1535 mutex_unlock(&inode->i_mutex);
1536 reiserfs_async_progress_wait(inode->i_sb); 1536 reiserfs_async_progress_wait(inode->i_sb);
1537 return (already_written != 0) ? already_written : res; 1537 return (already_written != 0) ? already_written : res;
1538 1538
1539 out: 1539 out:
1540 up(&inode->i_sem); // unlock the file on exit. 1540 mutex_unlock(&inode->i_mutex); // unlock the file on exit.
1541 return res; 1541 return res;
1542} 1542}
1543 1543
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index a5e3a0ddbe53..ffa34b861bdb 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -40,12 +40,12 @@ void reiserfs_delete_inode(struct inode *inode)
40 40
41 /* The = 0 happens when we abort creating a new inode for some reason like lack of space.. */ 41 /* The = 0 happens when we abort creating a new inode for some reason like lack of space.. */
42 if (!(inode->i_state & I_NEW) && INODE_PKEY(inode)->k_objectid != 0) { /* also handles bad_inode case */ 42 if (!(inode->i_state & I_NEW) && INODE_PKEY(inode)->k_objectid != 0) { /* also handles bad_inode case */
43 down(&inode->i_sem); 43 mutex_lock(&inode->i_mutex);
44 44
45 reiserfs_delete_xattrs(inode); 45 reiserfs_delete_xattrs(inode);
46 46
47 if (journal_begin(&th, inode->i_sb, jbegin_count)) { 47 if (journal_begin(&th, inode->i_sb, jbegin_count)) {
48 up(&inode->i_sem); 48 mutex_unlock(&inode->i_mutex);
49 goto out; 49 goto out;
50 } 50 }
51 reiserfs_update_inode_transaction(inode); 51 reiserfs_update_inode_transaction(inode);
@@ -59,11 +59,11 @@ void reiserfs_delete_inode(struct inode *inode)
59 DQUOT_FREE_INODE(inode); 59 DQUOT_FREE_INODE(inode);
60 60
61 if (journal_end(&th, inode->i_sb, jbegin_count)) { 61 if (journal_end(&th, inode->i_sb, jbegin_count)) {
62 up(&inode->i_sem); 62 mutex_unlock(&inode->i_mutex);
63 goto out; 63 goto out;
64 } 64 }
65 65
66 up(&inode->i_sem); 66 mutex_unlock(&inode->i_mutex);
67 67
68 /* check return value from reiserfs_delete_object after 68 /* check return value from reiserfs_delete_object after
69 * ending the transaction 69 * ending the transaction
@@ -551,7 +551,7 @@ static int convert_tail_for_hole(struct inode *inode,
551 551
552 /* we don't have to make sure the conversion did not happen while 552 /* we don't have to make sure the conversion did not happen while
553 ** we were locking the page because anyone that could convert 553 ** we were locking the page because anyone that could convert
554 ** must first take i_sem. 554 ** must first take i_mutex.
555 ** 555 **
556 ** We must fix the tail page for writing because it might have buffers 556 ** We must fix the tail page for writing because it might have buffers
557 ** that are mapped, but have a block number of 0. This indicates tail 557 ** that are mapped, but have a block number of 0. This indicates tail
@@ -586,7 +586,7 @@ static inline int _allocate_block(struct reiserfs_transaction_handle *th,
586 BUG_ON(!th->t_trans_id); 586 BUG_ON(!th->t_trans_id);
587 587
588#ifdef REISERFS_PREALLOCATE 588#ifdef REISERFS_PREALLOCATE
589 if (!(flags & GET_BLOCK_NO_ISEM)) { 589 if (!(flags & GET_BLOCK_NO_IMUX)) {
590 return reiserfs_new_unf_blocknrs2(th, inode, allocated_block_nr, 590 return reiserfs_new_unf_blocknrs2(th, inode, allocated_block_nr,
591 path, block); 591 path, block);
592 } 592 }
@@ -2318,7 +2318,7 @@ static int map_block_for_writepage(struct inode *inode,
2318 /* this is where we fill in holes in the file. */ 2318 /* this is where we fill in holes in the file. */
2319 if (use_get_block) { 2319 if (use_get_block) {
2320 retval = reiserfs_get_block(inode, block, bh_result, 2320 retval = reiserfs_get_block(inode, block, bh_result,
2321 GET_BLOCK_CREATE | GET_BLOCK_NO_ISEM 2321 GET_BLOCK_CREATE | GET_BLOCK_NO_IMUX
2322 | GET_BLOCK_NO_DANGLE); 2322 | GET_BLOCK_NO_DANGLE);
2323 if (!retval) { 2323 if (!retval) {
2324 if (!buffer_mapped(bh_result) 2324 if (!buffer_mapped(bh_result)
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c
index 81fc00285f60..ba8bf8df6dc7 100644
--- a/fs/reiserfs/ioctl.c
+++ b/fs/reiserfs/ioctl.c
@@ -120,7 +120,7 @@ static int reiserfs_unpack(struct inode *inode, struct file *filp)
120 /* we need to make sure nobody is changing the file size beneath 120 /* we need to make sure nobody is changing the file size beneath
121 ** us 121 ** us
122 */ 122 */
123 down(&inode->i_sem); 123 mutex_lock(&inode->i_mutex);
124 124
125 write_from = inode->i_size & (blocksize - 1); 125 write_from = inode->i_size & (blocksize - 1);
126 /* if we are on a block boundary, we are already unpacked. */ 126 /* if we are on a block boundary, we are already unpacked. */
@@ -156,7 +156,7 @@ static int reiserfs_unpack(struct inode *inode, struct file *filp)
156 page_cache_release(page); 156 page_cache_release(page);
157 157
158 out: 158 out:
159 up(&inode->i_sem); 159 mutex_unlock(&inode->i_mutex);
160 reiserfs_write_unlock(inode->i_sb); 160 reiserfs_write_unlock(inode->i_sb);
161 return retval; 161 return retval;
162} 162}
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 42afb5bef111..397d9590c8f2 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -2211,7 +2211,7 @@ static ssize_t reiserfs_quota_write(struct super_block *sb, int type,
2211 size_t towrite = len; 2211 size_t towrite = len;
2212 struct buffer_head tmp_bh, *bh; 2212 struct buffer_head tmp_bh, *bh;
2213 2213
2214 down(&inode->i_sem); 2214 mutex_lock(&inode->i_mutex);
2215 while (towrite > 0) { 2215 while (towrite > 0) {
2216 tocopy = sb->s_blocksize - offset < towrite ? 2216 tocopy = sb->s_blocksize - offset < towrite ?
2217 sb->s_blocksize - offset : towrite; 2217 sb->s_blocksize - offset : towrite;
@@ -2250,7 +2250,7 @@ static ssize_t reiserfs_quota_write(struct super_block *sb, int type,
2250 inode->i_version++; 2250 inode->i_version++;
2251 inode->i_mtime = inode->i_ctime = CURRENT_TIME; 2251 inode->i_mtime = inode->i_ctime = CURRENT_TIME;
2252 mark_inode_dirty(inode); 2252 mark_inode_dirty(inode);
2253 up(&inode->i_sem); 2253 mutex_unlock(&inode->i_mutex);
2254 return len - towrite; 2254 return len - towrite;
2255} 2255}
2256 2256
diff --git a/fs/reiserfs/tail_conversion.c b/fs/reiserfs/tail_conversion.c
index c92e124f628e..196e971c03c9 100644
--- a/fs/reiserfs/tail_conversion.c
+++ b/fs/reiserfs/tail_conversion.c
@@ -205,7 +205,7 @@ int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_in
205 1) * p_s_sb->s_blocksize; 205 1) * p_s_sb->s_blocksize;
206 pos1 = pos; 206 pos1 = pos;
207 207
208 // we are protected by i_sem. The tail can not disapper, not 208 // we are protected by i_mutex. The tail can not disapper, not
209 // append can be done either 209 // append can be done either
210 // we are in truncate or packing tail in file_release 210 // we are in truncate or packing tail in file_release
211 211
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index 02091eaac0b4..f1895f0a278e 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -67,11 +67,11 @@ static struct dentry *create_xa_root(struct super_block *sb)
67 goto out; 67 goto out;
68 } else if (!xaroot->d_inode) { 68 } else if (!xaroot->d_inode) {
69 int err; 69 int err;
70 down(&privroot->d_inode->i_sem); 70 mutex_lock(&privroot->d_inode->i_mutex);
71 err = 71 err =
72 privroot->d_inode->i_op->mkdir(privroot->d_inode, xaroot, 72 privroot->d_inode->i_op->mkdir(privroot->d_inode, xaroot,
73 0700); 73 0700);
74 up(&privroot->d_inode->i_sem); 74 mutex_unlock(&privroot->d_inode->i_mutex);
75 75
76 if (err) { 76 if (err) {
77 dput(xaroot); 77 dput(xaroot);
@@ -219,7 +219,7 @@ static struct dentry *get_xa_file_dentry(const struct inode *inode,
219 } else if (flags & XATTR_REPLACE || flags & FL_READONLY) { 219 } else if (flags & XATTR_REPLACE || flags & FL_READONLY) {
220 goto out; 220 goto out;
221 } else { 221 } else {
222 /* inode->i_sem is down, so nothing else can try to create 222 /* inode->i_mutex is down, so nothing else can try to create
223 * the same xattr */ 223 * the same xattr */
224 err = xadir->d_inode->i_op->create(xadir->d_inode, xafile, 224 err = xadir->d_inode->i_op->create(xadir->d_inode, xafile,
225 0700 | S_IFREG, NULL); 225 0700 | S_IFREG, NULL);
@@ -268,7 +268,7 @@ static struct file *open_xa_file(const struct inode *inode, const char *name,
268 * and don't mess with f->f_pos, but the idea is the same. Do some 268 * and don't mess with f->f_pos, but the idea is the same. Do some
269 * action on each and every entry in the directory. 269 * action on each and every entry in the directory.
270 * 270 *
271 * we're called with i_sem held, so there are no worries about the directory 271 * we're called with i_mutex held, so there are no worries about the directory
272 * changing underneath us. 272 * changing underneath us.
273 */ 273 */
274static int __xattr_readdir(struct file *filp, void *dirent, filldir_t filldir) 274static int __xattr_readdir(struct file *filp, void *dirent, filldir_t filldir)
@@ -426,7 +426,7 @@ int xattr_readdir(struct file *file, filldir_t filler, void *buf)
426 int res = -ENOTDIR; 426 int res = -ENOTDIR;
427 if (!file->f_op || !file->f_op->readdir) 427 if (!file->f_op || !file->f_op->readdir)
428 goto out; 428 goto out;
429 down(&inode->i_sem); 429 mutex_lock(&inode->i_mutex);
430// down(&inode->i_zombie); 430// down(&inode->i_zombie);
431 res = -ENOENT; 431 res = -ENOENT;
432 if (!IS_DEADDIR(inode)) { 432 if (!IS_DEADDIR(inode)) {
@@ -435,7 +435,7 @@ int xattr_readdir(struct file *file, filldir_t filler, void *buf)
435 unlock_kernel(); 435 unlock_kernel();
436 } 436 }
437// up(&inode->i_zombie); 437// up(&inode->i_zombie);
438 up(&inode->i_sem); 438 mutex_unlock(&inode->i_mutex);
439 out: 439 out:
440 return res; 440 return res;
441} 441}
@@ -480,7 +480,7 @@ static inline __u32 xattr_hash(const char *msg, int len)
480/* Generic extended attribute operations that can be used by xa plugins */ 480/* Generic extended attribute operations that can be used by xa plugins */
481 481
482/* 482/*
483 * inode->i_sem: down 483 * inode->i_mutex: down
484 */ 484 */
485int 485int
486reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer, 486reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer,
@@ -535,7 +535,7 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer,
535 /* Resize it so we're ok to write there */ 535 /* Resize it so we're ok to write there */
536 newattrs.ia_size = buffer_size; 536 newattrs.ia_size = buffer_size;
537 newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; 537 newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
538 down(&xinode->i_sem); 538 mutex_lock(&xinode->i_mutex);
539 err = notify_change(fp->f_dentry, &newattrs); 539 err = notify_change(fp->f_dentry, &newattrs);
540 if (err) 540 if (err)
541 goto out_filp; 541 goto out_filp;
@@ -598,7 +598,7 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer,
598 } 598 }
599 599
600 out_filp: 600 out_filp:
601 up(&xinode->i_sem); 601 mutex_unlock(&xinode->i_mutex);
602 fput(fp); 602 fput(fp);
603 603
604 out: 604 out:
@@ -606,7 +606,7 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer,
606} 606}
607 607
608/* 608/*
609 * inode->i_sem: down 609 * inode->i_mutex: down
610 */ 610 */
611int 611int
612reiserfs_xattr_get(const struct inode *inode, const char *name, void *buffer, 612reiserfs_xattr_get(const struct inode *inode, const char *name, void *buffer,
@@ -793,7 +793,7 @@ reiserfs_delete_xattrs_filler(void *buf, const char *name, int namelen,
793 793
794} 794}
795 795
796/* This is called w/ inode->i_sem downed */ 796/* This is called w/ inode->i_mutex downed */
797int reiserfs_delete_xattrs(struct inode *inode) 797int reiserfs_delete_xattrs(struct inode *inode)
798{ 798{
799 struct file *fp; 799 struct file *fp;
@@ -946,7 +946,7 @@ int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs)
946 946
947/* 947/*
948 * Inode operation getxattr() 948 * Inode operation getxattr()
949 * Preliminary locking: we down dentry->d_inode->i_sem 949 * Preliminary locking: we down dentry->d_inode->i_mutex
950 */ 950 */
951ssize_t 951ssize_t
952reiserfs_getxattr(struct dentry * dentry, const char *name, void *buffer, 952reiserfs_getxattr(struct dentry * dentry, const char *name, void *buffer,
@@ -970,7 +970,7 @@ reiserfs_getxattr(struct dentry * dentry, const char *name, void *buffer,
970/* 970/*
971 * Inode operation setxattr() 971 * Inode operation setxattr()
972 * 972 *
973 * dentry->d_inode->i_sem down 973 * dentry->d_inode->i_mutex down
974 */ 974 */
975int 975int
976reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value, 976reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value,
@@ -1008,7 +1008,7 @@ reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value,
1008/* 1008/*
1009 * Inode operation removexattr() 1009 * Inode operation removexattr()
1010 * 1010 *
1011 * dentry->d_inode->i_sem down 1011 * dentry->d_inode->i_mutex down
1012 */ 1012 */
1013int reiserfs_removexattr(struct dentry *dentry, const char *name) 1013int reiserfs_removexattr(struct dentry *dentry, const char *name)
1014{ 1014{
@@ -1091,7 +1091,7 @@ reiserfs_listxattr_filler(void *buf, const char *name, int namelen,
1091/* 1091/*
1092 * Inode operation listxattr() 1092 * Inode operation listxattr()
1093 * 1093 *
1094 * Preliminary locking: we down dentry->d_inode->i_sem 1094 * Preliminary locking: we down dentry->d_inode->i_mutex
1095 */ 1095 */
1096ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size) 1096ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size)
1097{ 1097{
@@ -1289,9 +1289,9 @@ int reiserfs_xattr_init(struct super_block *s, int mount_flags)
1289 if (!IS_ERR(dentry)) { 1289 if (!IS_ERR(dentry)) {
1290 if (!(mount_flags & MS_RDONLY) && !dentry->d_inode) { 1290 if (!(mount_flags & MS_RDONLY) && !dentry->d_inode) {
1291 struct inode *inode = dentry->d_parent->d_inode; 1291 struct inode *inode = dentry->d_parent->d_inode;
1292 down(&inode->i_sem); 1292 mutex_lock(&inode->i_mutex);
1293 err = inode->i_op->mkdir(inode, dentry, 0700); 1293 err = inode->i_op->mkdir(inode, dentry, 0700);
1294 up(&inode->i_sem); 1294 mutex_unlock(&inode->i_mutex);
1295 if (err) { 1295 if (err) {
1296 dput(dentry); 1296 dput(dentry);
1297 dentry = NULL; 1297 dentry = NULL;
diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c
index a47ac9aac8b2..2dc953504cc0 100644
--- a/fs/reiserfs/xattr_acl.c
+++ b/fs/reiserfs/xattr_acl.c
@@ -174,7 +174,7 @@ static void *posix_acl_to_disk(const struct posix_acl *acl, size_t * size)
174/* 174/*
175 * Inode operation get_posix_acl(). 175 * Inode operation get_posix_acl().
176 * 176 *
177 * inode->i_sem: down 177 * inode->i_mutex: down
178 * BKL held [before 2.5.x] 178 * BKL held [before 2.5.x]
179 */ 179 */
180struct posix_acl *reiserfs_get_acl(struct inode *inode, int type) 180struct posix_acl *reiserfs_get_acl(struct inode *inode, int type)
@@ -237,7 +237,7 @@ struct posix_acl *reiserfs_get_acl(struct inode *inode, int type)
237/* 237/*
238 * Inode operation set_posix_acl(). 238 * Inode operation set_posix_acl().
239 * 239 *
240 * inode->i_sem: down 240 * inode->i_mutex: down
241 * BKL held [before 2.5.x] 241 * BKL held [before 2.5.x]
242 */ 242 */
243static int 243static int
@@ -312,7 +312,7 @@ reiserfs_set_acl(struct inode *inode, int type, struct posix_acl *acl)
312 return error; 312 return error;
313} 313}
314 314
315/* dir->i_sem: down, 315/* dir->i_mutex: locked,
316 * inode is new and not released into the wild yet */ 316 * inode is new and not released into the wild yet */
317int 317int
318reiserfs_inherit_default_acl(struct inode *dir, struct dentry *dentry, 318reiserfs_inherit_default_acl(struct inode *dir, struct dentry *dentry,