summaryrefslogtreecommitdiffstats
path: root/fs/ufs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-06-16 18:15:07 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2015-07-06 17:39:22 -0400
commit2401aa29ab5c42cc34853a5c1457fbf66593690f (patch)
tree28d304b6ff1a6ee778ad61ae40cf36e341edc592 /fs/ufs
parent3b7a3a05e8b006a73c406230b3d2d3da920779d9 (diff)
downloadop-kernel-dev-2401aa29ab5c42cc34853a5c1457fbf66593690f.zip
op-kernel-dev-2401aa29ab5c42cc34853a5c1457fbf66593690f.tar.gz
ufs: move truncate_setsize() down into ufs_truncate()
just prior to __ufs_truncate_blocks(), with matching change of calling conventions Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ufs')
-rw-r--r--fs/ufs/truncate.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/fs/ufs/truncate.c b/fs/ufs/truncate.c
index 5a2e708..6f56036 100644
--- a/fs/ufs/truncate.c
+++ b/fs/ufs/truncate.c
@@ -370,7 +370,7 @@ static int ufs_trunc_tindirect(struct inode *inode)
return retry;
}
-static int ufs_alloc_lastblock(struct inode *inode)
+static int ufs_alloc_lastblock(struct inode *inode, loff_t size)
{
int err = 0;
struct super_block *sb = inode->i_sb;
@@ -382,7 +382,7 @@ static int ufs_alloc_lastblock(struct inode *inode)
struct buffer_head *bh;
u64 phys64;
- lastfrag = (i_size_read(inode) + uspi->s_fsize - 1) >> uspi->s_fshift;
+ lastfrag = (size + uspi->s_fsize - 1) >> uspi->s_fshift;
if (!lastfrag)
goto out;
@@ -466,14 +466,14 @@ static void __ufs_truncate_blocks(struct inode *inode)
ufsi->i_lastfrag = DIRECT_FRAGMENT;
}
-int ufs_truncate(struct inode *inode, loff_t old_i_size)
+int ufs_truncate(struct inode *inode, loff_t size)
{
struct super_block *sb = inode->i_sb;
int err = 0;
UFSD("ENTER: ino %lu, i_size: %llu, old_i_size: %llu\n",
- inode->i_ino, (unsigned long long)i_size_read(inode),
- (unsigned long long)old_i_size);
+ inode->i_ino, (unsigned long long)size,
+ (unsigned long long)i_size_read(inode));
if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
S_ISLNK(inode->i_mode)))
@@ -482,14 +482,14 @@ int ufs_truncate(struct inode *inode, loff_t old_i_size)
return -EPERM;
lock_ufs(sb);
- err = ufs_alloc_lastblock(inode);
+ err = ufs_alloc_lastblock(inode, size);
- if (err) {
- i_size_write(inode, old_i_size);
+ if (err)
goto out;
- }
- block_truncate_page(inode->i_mapping, inode->i_size, ufs_getfrag_block);
+ block_truncate_page(inode->i_mapping, size, ufs_getfrag_block);
+
+ truncate_setsize(inode, size);
__ufs_truncate_blocks(inode);
inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
@@ -525,12 +525,7 @@ int ufs_setattr(struct dentry *dentry, struct iattr *attr)
return error;
if (ia_valid & ATTR_SIZE && attr->ia_size != inode->i_size) {
- loff_t old_i_size = inode->i_size;
-
- /* XXX(truncate): truncate_setsize should be called last */
- truncate_setsize(inode, attr->ia_size);
-
- error = ufs_truncate(inode, old_i_size);
+ error = ufs_truncate(inode, attr->ia_size);
if (error)
return error;
}
OpenPOWER on IntegriCloud