Commit 8b5860a3 authored by Andreas Gruenbacher's avatar Andreas Gruenbacher Committed by Bob Peterson

gfs2: truncate: Remove unnecessary oldsize parameters

Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
parent 80990f40
...@@ -1017,13 +1017,14 @@ static int gfs2_journaled_truncate(struct inode *inode, u64 oldsize, u64 newsize ...@@ -1017,13 +1017,14 @@ static int gfs2_journaled_truncate(struct inode *inode, u64 oldsize, u64 newsize
return 0; return 0;
} }
static int trunc_start(struct inode *inode, u64 oldsize, u64 newsize) static int trunc_start(struct inode *inode, u64 newsize)
{ {
struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_sbd *sdp = GFS2_SB(inode); struct gfs2_sbd *sdp = GFS2_SB(inode);
struct address_space *mapping = inode->i_mapping; struct address_space *mapping = inode->i_mapping;
struct buffer_head *dibh = NULL; struct buffer_head *dibh = NULL;
int journaled = gfs2_is_jdata(ip); int journaled = gfs2_is_jdata(ip);
u64 oldsize = inode->i_size;
int error; int error;
if (journaled) if (journaled)
...@@ -1519,7 +1520,6 @@ static int trunc_end(struct gfs2_inode *ip) ...@@ -1519,7 +1520,6 @@ static int trunc_end(struct gfs2_inode *ip)
/** /**
* do_shrink - make a file smaller * do_shrink - make a file smaller
* @inode: the inode * @inode: the inode
* @oldsize: the current inode size
* @newsize: the size to make the file * @newsize: the size to make the file
* *
* Called with an exclusive lock on @inode. The @size must * Called with an exclusive lock on @inode. The @size must
...@@ -1528,12 +1528,12 @@ static int trunc_end(struct gfs2_inode *ip) ...@@ -1528,12 +1528,12 @@ static int trunc_end(struct gfs2_inode *ip)
* Returns: errno * Returns: errno
*/ */
static int do_shrink(struct inode *inode, u64 oldsize, u64 newsize) static int do_shrink(struct inode *inode, u64 newsize)
{ {
struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_inode *ip = GFS2_I(inode);
int error; int error;
error = trunc_start(inode, oldsize, newsize); error = trunc_start(inode, newsize);
if (error < 0) if (error < 0)
return error; return error;
if (gfs2_is_stuffed(ip)) if (gfs2_is_stuffed(ip))
...@@ -1548,10 +1548,9 @@ static int do_shrink(struct inode *inode, u64 oldsize, u64 newsize) ...@@ -1548,10 +1548,9 @@ static int do_shrink(struct inode *inode, u64 oldsize, u64 newsize)
void gfs2_trim_blocks(struct inode *inode) void gfs2_trim_blocks(struct inode *inode)
{ {
u64 size = inode->i_size;
int ret; int ret;
ret = do_shrink(inode, size, size); ret = do_shrink(inode, inode->i_size);
WARN_ON(ret != 0); WARN_ON(ret != 0);
} }
...@@ -1645,7 +1644,6 @@ int gfs2_setattr_size(struct inode *inode, u64 newsize) ...@@ -1645,7 +1644,6 @@ int gfs2_setattr_size(struct inode *inode, u64 newsize)
{ {
struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_inode *ip = GFS2_I(inode);
int ret; int ret;
u64 oldsize;
BUG_ON(!S_ISREG(inode->i_mode)); BUG_ON(!S_ISREG(inode->i_mode));
...@@ -1659,13 +1657,12 @@ int gfs2_setattr_size(struct inode *inode, u64 newsize) ...@@ -1659,13 +1657,12 @@ int gfs2_setattr_size(struct inode *inode, u64 newsize)
if (ret) if (ret)
goto out; goto out;
oldsize = inode->i_size; if (newsize >= inode->i_size) {
if (newsize >= oldsize) {
ret = do_grow(inode, newsize); ret = do_grow(inode, newsize);
goto out; goto out;
} }
ret = do_shrink(inode, oldsize, newsize); ret = do_shrink(inode, newsize);
out: out:
gfs2_rsqa_delete(ip, NULL); gfs2_rsqa_delete(ip, NULL);
return ret; return ret;
......
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