[GFS2] Remove pointless argument relating to truncate

For some reason a function pointer was being passed through
the truncate code which only ever took one value. This removes
the function pointer and replaces it with a single call to
the function in question.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
This commit is contained in:
Steven Whitehouse 2006-01-24 10:37:06 +00:00
parent 8ca05c60de
commit aa6a85a971
3 changed files with 8 additions and 12 deletions

View File

@ -841,8 +841,7 @@ static int truncator_journaled(struct gfs2_inode *ip, uint64_t size)
return 0; return 0;
} }
static int trunc_start(struct gfs2_inode *ip, uint64_t size, static int trunc_start(struct gfs2_inode *ip, uint64_t size)
gfs2_truncator_t truncator)
{ {
struct gfs2_sbd *sdp = ip->i_sbd; struct gfs2_sbd *sdp = ip->i_sbd;
struct buffer_head *dibh; struct buffer_head *dibh;
@ -873,7 +872,7 @@ static int trunc_start(struct gfs2_inode *ip, uint64_t size,
if (do_div(junk, sdp->sd_jbsize)) if (do_div(junk, sdp->sd_jbsize))
error = truncator_journaled(ip, size); error = truncator_journaled(ip, size);
} else if (size & (uint64_t)(sdp->sd_sb.sb_bsize - 1)) } else if (size & (uint64_t)(sdp->sd_sb.sb_bsize - 1))
error = truncator(ip, size); error = gfs2_truncator_page(ip, size);
if (!error) { if (!error) {
ip->i_di.di_size = size; ip->i_di.di_size = size;
@ -980,12 +979,11 @@ static int trunc_end(struct gfs2_inode *ip)
* Returns: errno * Returns: errno
*/ */
static int do_shrink(struct gfs2_inode *ip, uint64_t size, static int do_shrink(struct gfs2_inode *ip, uint64_t size)
gfs2_truncator_t truncator)
{ {
int error; int error;
error = trunc_start(ip, size, truncator); error = trunc_start(ip, size);
if (error < 0) if (error < 0)
return error; return error;
if (error > 0) if (error > 0)
@ -1009,8 +1007,7 @@ static int do_shrink(struct gfs2_inode *ip, uint64_t size,
* Returns: errno * Returns: errno
*/ */
int gfs2_truncatei(struct gfs2_inode *ip, uint64_t size, int gfs2_truncatei(struct gfs2_inode *ip, uint64_t size)
gfs2_truncator_t truncator)
{ {
int error; int error;
@ -1020,7 +1017,7 @@ int gfs2_truncatei(struct gfs2_inode *ip, uint64_t size,
if (size > ip->i_di.di_size) if (size > ip->i_di.di_size)
error = do_grow(ip, size); error = do_grow(ip, size);
else else
error = do_shrink(ip, size, truncator); error = do_shrink(ip, size);
return error; return error;
} }

View File

@ -23,8 +23,7 @@ int gfs2_block_map(struct gfs2_inode *ip,
uint64_t *dblock, uint32_t *extlen); uint64_t *dblock, uint32_t *extlen);
typedef int (*gfs2_truncator_t) (struct gfs2_inode * ip, uint64_t size); typedef int (*gfs2_truncator_t) (struct gfs2_inode * ip, uint64_t size);
int gfs2_truncatei(struct gfs2_inode *ip, uint64_t size, int gfs2_truncatei(struct gfs2_inode *ip, uint64_t size);
gfs2_truncator_t truncator);
int gfs2_truncatei_resume(struct gfs2_inode *ip); int gfs2_truncatei_resume(struct gfs2_inode *ip);
int gfs2_file_dealloc(struct gfs2_inode *ip); int gfs2_file_dealloc(struct gfs2_inode *ip);

View File

@ -994,7 +994,7 @@ static int setattr_size(struct inode *inode, struct iattr *attr)
return error; return error;
} }
error = gfs2_truncatei(ip, attr->ia_size, gfs2_truncator_page); error = gfs2_truncatei(ip, attr->ia_size);
if (error) if (error)
return error; return error;