Commit f3e0f3da authored by Al Viro's avatar Al Viro

ufs: kill more lock_ufs() calls

a) move it inside ufs_truncate()
b) ufs_free_inode() doesn't need it - it's serialized on ->s_lock
c) ufs_write_inode() doesn't need it either (and can be called without
it anyway).
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent d770e558
...@@ -867,11 +867,7 @@ static int ufs_update_inode(struct inode * inode, int do_sync) ...@@ -867,11 +867,7 @@ static int ufs_update_inode(struct inode * inode, int do_sync)
int ufs_write_inode(struct inode *inode, struct writeback_control *wbc) int ufs_write_inode(struct inode *inode, struct writeback_control *wbc)
{ {
int ret; return ufs_update_inode(inode, wbc->sync_mode == WB_SYNC_ALL);
lock_ufs(inode->i_sb);
ret = ufs_update_inode(inode, wbc->sync_mode == WB_SYNC_ALL);
unlock_ufs(inode->i_sb);
return ret;
} }
int ufs_sync_inode (struct inode *inode) int ufs_sync_inode (struct inode *inode)
...@@ -890,22 +886,17 @@ void ufs_evict_inode(struct inode * inode) ...@@ -890,22 +886,17 @@ void ufs_evict_inode(struct inode * inode)
if (want_delete) { if (want_delete) {
loff_t old_i_size; loff_t old_i_size;
/*UFS_I(inode)->i_dtime = CURRENT_TIME;*/ /*UFS_I(inode)->i_dtime = CURRENT_TIME;*/
lock_ufs(inode->i_sb);
mark_inode_dirty(inode); mark_inode_dirty(inode);
ufs_update_inode(inode, IS_SYNC(inode)); ufs_update_inode(inode, IS_SYNC(inode));
old_i_size = inode->i_size; old_i_size = inode->i_size;
inode->i_size = 0; inode->i_size = 0;
if (inode->i_blocks && ufs_truncate(inode, old_i_size)) if (inode->i_blocks && ufs_truncate(inode, old_i_size))
ufs_warning(inode->i_sb, __func__, "ufs_truncate failed\n"); ufs_warning(inode->i_sb, __func__, "ufs_truncate failed\n");
unlock_ufs(inode->i_sb);
} }
invalidate_inode_buffers(inode); invalidate_inode_buffers(inode);
clear_inode(inode); clear_inode(inode);
if (want_delete) { if (want_delete)
lock_ufs(inode->i_sb);
ufs_free_inode(inode); ufs_free_inode(inode);
unlock_ufs(inode->i_sb);
}
} }
...@@ -457,6 +457,7 @@ int ufs_truncate(struct inode *inode, loff_t old_i_size) ...@@ -457,6 +457,7 @@ int ufs_truncate(struct inode *inode, loff_t old_i_size)
if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
return -EPERM; return -EPERM;
lock_ufs(sb);
err = ufs_alloc_lastblock(inode); err = ufs_alloc_lastblock(inode);
if (err) { if (err) {
...@@ -486,6 +487,7 @@ int ufs_truncate(struct inode *inode, loff_t old_i_size) ...@@ -486,6 +487,7 @@ int ufs_truncate(struct inode *inode, loff_t old_i_size)
ufsi->i_lastfrag = DIRECT_FRAGMENT; ufsi->i_lastfrag = DIRECT_FRAGMENT;
mark_inode_dirty(inode); mark_inode_dirty(inode);
out: out:
unlock_ufs(sb);
UFSD("EXIT: err %d\n", err); UFSD("EXIT: err %d\n", err);
return err; return err;
} }
...@@ -506,9 +508,7 @@ int ufs_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -506,9 +508,7 @@ int ufs_setattr(struct dentry *dentry, struct iattr *attr)
/* XXX(truncate): truncate_setsize should be called last */ /* XXX(truncate): truncate_setsize should be called last */
truncate_setsize(inode, attr->ia_size); truncate_setsize(inode, attr->ia_size);
lock_ufs(inode->i_sb);
error = ufs_truncate(inode, old_i_size); error = ufs_truncate(inode, old_i_size);
unlock_ufs(inode->i_sb);
if (error) if (error)
return error; return error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment