mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-13 16:50:05 +00:00
ufs: don't bother with lock_ufs()/unlock_ufs() for directory access
We are already serialized by ->i_mutex and operations on different directories are independent. These calls are just rudiments of blind BKL conversion and they should've been removed back then. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
514d748f69
commit
a50e4a02ad
@ -56,11 +56,9 @@ static struct dentry *ufs_lookup(struct inode * dir, struct dentry *dentry, unsi
|
|||||||
if (dentry->d_name.len > UFS_MAXNAMLEN)
|
if (dentry->d_name.len > UFS_MAXNAMLEN)
|
||||||
return ERR_PTR(-ENAMETOOLONG);
|
return ERR_PTR(-ENAMETOOLONG);
|
||||||
|
|
||||||
lock_ufs(dir->i_sb);
|
|
||||||
ino = ufs_inode_by_name(dir, &dentry->d_name);
|
ino = ufs_inode_by_name(dir, &dentry->d_name);
|
||||||
if (ino)
|
if (ino)
|
||||||
inode = ufs_iget(dir->i_sb, ino);
|
inode = ufs_iget(dir->i_sb, ino);
|
||||||
unlock_ufs(dir->i_sb);
|
|
||||||
return d_splice_alias(inode, dentry);
|
return d_splice_alias(inode, dentry);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,24 +74,16 @@ static int ufs_create (struct inode * dir, struct dentry * dentry, umode_t mode,
|
|||||||
bool excl)
|
bool excl)
|
||||||
{
|
{
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
int err;
|
|
||||||
|
|
||||||
UFSD("BEGIN\n");
|
|
||||||
|
|
||||||
inode = ufs_new_inode(dir, mode);
|
inode = ufs_new_inode(dir, mode);
|
||||||
err = PTR_ERR(inode);
|
if (IS_ERR(inode))
|
||||||
|
return PTR_ERR(inode);
|
||||||
|
|
||||||
if (!IS_ERR(inode)) {
|
inode->i_op = &ufs_file_inode_operations;
|
||||||
inode->i_op = &ufs_file_inode_operations;
|
inode->i_fop = &ufs_file_operations;
|
||||||
inode->i_fop = &ufs_file_operations;
|
inode->i_mapping->a_ops = &ufs_aops;
|
||||||
inode->i_mapping->a_ops = &ufs_aops;
|
mark_inode_dirty(inode);
|
||||||
mark_inode_dirty(inode);
|
return ufs_add_nondir(dentry, inode);
|
||||||
lock_ufs(dir->i_sb);
|
|
||||||
err = ufs_add_nondir(dentry, inode);
|
|
||||||
unlock_ufs(dir->i_sb);
|
|
||||||
}
|
|
||||||
UFSD("END: err=%d\n", err);
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ufs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev)
|
static int ufs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev)
|
||||||
@ -110,9 +100,7 @@ static int ufs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev
|
|||||||
init_special_inode(inode, mode, rdev);
|
init_special_inode(inode, mode, rdev);
|
||||||
ufs_set_inode_dev(inode->i_sb, UFS_I(inode), rdev);
|
ufs_set_inode_dev(inode->i_sb, UFS_I(inode), rdev);
|
||||||
mark_inode_dirty(inode);
|
mark_inode_dirty(inode);
|
||||||
lock_ufs(dir->i_sb);
|
|
||||||
err = ufs_add_nondir(dentry, inode);
|
err = ufs_add_nondir(dentry, inode);
|
||||||
unlock_ufs(dir->i_sb);
|
|
||||||
}
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@ -121,18 +109,17 @@ static int ufs_symlink (struct inode * dir, struct dentry * dentry,
|
|||||||
const char * symname)
|
const char * symname)
|
||||||
{
|
{
|
||||||
struct super_block * sb = dir->i_sb;
|
struct super_block * sb = dir->i_sb;
|
||||||
int err = -ENAMETOOLONG;
|
int err;
|
||||||
unsigned l = strlen(symname)+1;
|
unsigned l = strlen(symname)+1;
|
||||||
struct inode * inode;
|
struct inode * inode;
|
||||||
|
|
||||||
if (l > sb->s_blocksize)
|
if (l > sb->s_blocksize)
|
||||||
goto out_notlocked;
|
return -ENAMETOOLONG;
|
||||||
|
|
||||||
lock_ufs(dir->i_sb);
|
|
||||||
inode = ufs_new_inode(dir, S_IFLNK | S_IRWXUGO);
|
inode = ufs_new_inode(dir, S_IFLNK | S_IRWXUGO);
|
||||||
err = PTR_ERR(inode);
|
err = PTR_ERR(inode);
|
||||||
if (IS_ERR(inode))
|
if (IS_ERR(inode))
|
||||||
goto out;
|
return err;
|
||||||
|
|
||||||
if (l > UFS_SB(sb)->s_uspi->s_maxsymlinklen) {
|
if (l > UFS_SB(sb)->s_uspi->s_maxsymlinklen) {
|
||||||
/* slow symlink */
|
/* slow symlink */
|
||||||
@ -149,17 +136,13 @@ static int ufs_symlink (struct inode * dir, struct dentry * dentry,
|
|||||||
}
|
}
|
||||||
mark_inode_dirty(inode);
|
mark_inode_dirty(inode);
|
||||||
|
|
||||||
err = ufs_add_nondir(dentry, inode);
|
return ufs_add_nondir(dentry, inode);
|
||||||
out:
|
|
||||||
unlock_ufs(dir->i_sb);
|
|
||||||
out_notlocked:
|
|
||||||
return err;
|
|
||||||
|
|
||||||
out_fail:
|
out_fail:
|
||||||
inode_dec_link_count(inode);
|
inode_dec_link_count(inode);
|
||||||
unlock_new_inode(inode);
|
unlock_new_inode(inode);
|
||||||
iput(inode);
|
iput(inode);
|
||||||
goto out;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ufs_link (struct dentry * old_dentry, struct inode * dir,
|
static int ufs_link (struct dentry * old_dentry, struct inode * dir,
|
||||||
@ -168,8 +151,6 @@ static int ufs_link (struct dentry * old_dentry, struct inode * dir,
|
|||||||
struct inode *inode = d_inode(old_dentry);
|
struct inode *inode = d_inode(old_dentry);
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
lock_ufs(dir->i_sb);
|
|
||||||
|
|
||||||
inode->i_ctime = CURRENT_TIME_SEC;
|
inode->i_ctime = CURRENT_TIME_SEC;
|
||||||
inode_inc_link_count(inode);
|
inode_inc_link_count(inode);
|
||||||
ihold(inode);
|
ihold(inode);
|
||||||
@ -180,7 +161,6 @@ static int ufs_link (struct dentry * old_dentry, struct inode * dir,
|
|||||||
iput(inode);
|
iput(inode);
|
||||||
} else
|
} else
|
||||||
d_instantiate(dentry, inode);
|
d_instantiate(dentry, inode);
|
||||||
unlock_ufs(dir->i_sb);
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,7 +169,6 @@ static int ufs_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode)
|
|||||||
struct inode * inode;
|
struct inode * inode;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
lock_ufs(dir->i_sb);
|
|
||||||
inode_inc_link_count(dir);
|
inode_inc_link_count(dir);
|
||||||
|
|
||||||
inode = ufs_new_inode(dir, S_IFDIR|mode);
|
inode = ufs_new_inode(dir, S_IFDIR|mode);
|
||||||
@ -210,12 +189,10 @@ static int ufs_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode)
|
|||||||
err = ufs_add_link(dentry, inode);
|
err = ufs_add_link(dentry, inode);
|
||||||
if (err)
|
if (err)
|
||||||
goto out_fail;
|
goto out_fail;
|
||||||
unlock_ufs(dir->i_sb);
|
|
||||||
|
|
||||||
unlock_new_inode(inode);
|
unlock_new_inode(inode);
|
||||||
d_instantiate(dentry, inode);
|
d_instantiate(dentry, inode);
|
||||||
out:
|
return 0;
|
||||||
return err;
|
|
||||||
|
|
||||||
out_fail:
|
out_fail:
|
||||||
inode_dec_link_count(inode);
|
inode_dec_link_count(inode);
|
||||||
@ -224,8 +201,7 @@ out_fail:
|
|||||||
iput (inode);
|
iput (inode);
|
||||||
out_dir:
|
out_dir:
|
||||||
inode_dec_link_count(dir);
|
inode_dec_link_count(dir);
|
||||||
unlock_ufs(dir->i_sb);
|
return err;
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ufs_unlink(struct inode *dir, struct dentry *dentry)
|
static int ufs_unlink(struct inode *dir, struct dentry *dentry)
|
||||||
@ -255,7 +231,6 @@ static int ufs_rmdir (struct inode * dir, struct dentry *dentry)
|
|||||||
struct inode * inode = d_inode(dentry);
|
struct inode * inode = d_inode(dentry);
|
||||||
int err= -ENOTEMPTY;
|
int err= -ENOTEMPTY;
|
||||||
|
|
||||||
lock_ufs(dir->i_sb);
|
|
||||||
if (ufs_empty_dir (inode)) {
|
if (ufs_empty_dir (inode)) {
|
||||||
err = ufs_unlink(dir, dentry);
|
err = ufs_unlink(dir, dentry);
|
||||||
if (!err) {
|
if (!err) {
|
||||||
@ -264,7 +239,6 @@ static int ufs_rmdir (struct inode * dir, struct dentry *dentry)
|
|||||||
inode_dec_link_count(dir);
|
inode_dec_link_count(dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unlock_ufs(dir->i_sb);
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user