[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>
This commit is contained in:
committed by
Ingo Molnar
parent
794ee1baee
commit
1b1dcc1b57
@@ -184,13 +184,13 @@ static void update_bus(struct dentry *bus)
|
||||
bus->d_inode->i_gid = busgid;
|
||||
bus->d_inode->i_mode = S_IFDIR | busmode;
|
||||
|
||||
down(&bus->d_inode->i_sem);
|
||||
mutex_lock(&bus->d_inode->i_mutex);
|
||||
|
||||
list_for_each_entry(dev, &bus->d_subdirs, d_u.d_child)
|
||||
if (dev->d_inode)
|
||||
update_dev(dev);
|
||||
|
||||
up(&bus->d_inode->i_sem);
|
||||
mutex_unlock(&bus->d_inode->i_mutex);
|
||||
}
|
||||
|
||||
static void update_sb(struct super_block *sb)
|
||||
@@ -201,7 +201,7 @@ static void update_sb(struct super_block *sb)
|
||||
if (!root)
|
||||
return;
|
||||
|
||||
down(&root->d_inode->i_sem);
|
||||
mutex_lock(&root->d_inode->i_mutex);
|
||||
|
||||
list_for_each_entry(bus, &root->d_subdirs, d_u.d_child) {
|
||||
if (bus->d_inode) {
|
||||
@@ -219,7 +219,7 @@ static void update_sb(struct super_block *sb)
|
||||
}
|
||||
}
|
||||
|
||||
up(&root->d_inode->i_sem);
|
||||
mutex_unlock(&root->d_inode->i_mutex);
|
||||
}
|
||||
|
||||
static int remount(struct super_block *sb, int *flags, char *data)
|
||||
@@ -333,10 +333,10 @@ static int usbfs_empty (struct dentry *dentry)
|
||||
static int usbfs_unlink (struct inode *dir, struct dentry *dentry)
|
||||
{
|
||||
struct inode *inode = dentry->d_inode;
|
||||
down(&inode->i_sem);
|
||||
mutex_lock(&inode->i_mutex);
|
||||
dentry->d_inode->i_nlink--;
|
||||
dput(dentry);
|
||||
up(&inode->i_sem);
|
||||
mutex_unlock(&inode->i_mutex);
|
||||
d_delete(dentry);
|
||||
return 0;
|
||||
}
|
||||
@@ -346,7 +346,7 @@ static int usbfs_rmdir(struct inode *dir, struct dentry *dentry)
|
||||
int error = -ENOTEMPTY;
|
||||
struct inode * inode = dentry->d_inode;
|
||||
|
||||
down(&inode->i_sem);
|
||||
mutex_lock(&inode->i_mutex);
|
||||
dentry_unhash(dentry);
|
||||
if (usbfs_empty(dentry)) {
|
||||
dentry->d_inode->i_nlink -= 2;
|
||||
@@ -355,7 +355,7 @@ static int usbfs_rmdir(struct inode *dir, struct dentry *dentry)
|
||||
dir->i_nlink--;
|
||||
error = 0;
|
||||
}
|
||||
up(&inode->i_sem);
|
||||
mutex_unlock(&inode->i_mutex);
|
||||
if (!error)
|
||||
d_delete(dentry);
|
||||
dput(dentry);
|
||||
@@ -380,7 +380,7 @@ static loff_t default_file_lseek (struct file *file, loff_t offset, int orig)
|
||||
{
|
||||
loff_t retval = -EINVAL;
|
||||
|
||||
down(&file->f_dentry->d_inode->i_sem);
|
||||
mutex_lock(&file->f_dentry->d_inode->i_mutex);
|
||||
switch(orig) {
|
||||
case 0:
|
||||
if (offset > 0) {
|
||||
@@ -397,7 +397,7 @@ static loff_t default_file_lseek (struct file *file, loff_t offset, int orig)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
up(&file->f_dentry->d_inode->i_sem);
|
||||
mutex_unlock(&file->f_dentry->d_inode->i_mutex);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -480,7 +480,7 @@ static int fs_create_by_name (const char *name, mode_t mode,
|
||||
}
|
||||
|
||||
*dentry = NULL;
|
||||
down(&parent->d_inode->i_sem);
|
||||
mutex_lock(&parent->d_inode->i_mutex);
|
||||
*dentry = lookup_one_len(name, parent, strlen(name));
|
||||
if (!IS_ERR(dentry)) {
|
||||
if ((mode & S_IFMT) == S_IFDIR)
|
||||
@@ -489,7 +489,7 @@ static int fs_create_by_name (const char *name, mode_t mode,
|
||||
error = usbfs_create (parent->d_inode, *dentry, mode);
|
||||
} else
|
||||
error = PTR_ERR(dentry);
|
||||
up(&parent->d_inode->i_sem);
|
||||
mutex_unlock(&parent->d_inode->i_mutex);
|
||||
|
||||
return error;
|
||||
}
|
||||
@@ -528,7 +528,7 @@ static void fs_remove_file (struct dentry *dentry)
|
||||
if (!parent || !parent->d_inode)
|
||||
return;
|
||||
|
||||
down(&parent->d_inode->i_sem);
|
||||
mutex_lock(&parent->d_inode->i_mutex);
|
||||
if (usbfs_positive(dentry)) {
|
||||
if (dentry->d_inode) {
|
||||
if (S_ISDIR(dentry->d_inode->i_mode))
|
||||
@@ -538,7 +538,7 @@ static void fs_remove_file (struct dentry *dentry)
|
||||
dput(dentry);
|
||||
}
|
||||
}
|
||||
up(&parent->d_inode->i_sem);
|
||||
mutex_unlock(&parent->d_inode->i_mutex);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
Reference in New Issue
Block a user