aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs/xattr.c
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/xattr.c
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/xattr.c')
-rw-r--r--fs/reiserfs/xattr.c34
1 files changed, 17 insertions, 17 deletions
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;