aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Whitehouse <steve@men-an-tol.chygwyn.com>2006-01-24 05:37:06 -0500
committerSteven Whitehouse <steve@men-an-tol.chygwyn.com>2006-01-24 05:37:06 -0500
commitaa6a85a971065b013a71a399c3fc4312e2dd81eb (patch)
treeae2d11d0ec557f17cce29e79b18df29b78f9b0f7
parent8ca05c60de49c3bb523a435abc216b6b6eeb1067 (diff)
[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>
-rw-r--r--fs/gfs2/bmap.c15
-rw-r--r--fs/gfs2/bmap.h3
-rw-r--r--fs/gfs2/ops_inode.c2
3 files changed, 8 insertions, 12 deletions
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index 967cbc68195a..ff4a9175b4e1 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -841,8 +841,7 @@ static int truncator_journaled(struct gfs2_inode *ip, uint64_t size)
841 return 0; 841 return 0;
842} 842}
843 843
844static int trunc_start(struct gfs2_inode *ip, uint64_t size, 844static int trunc_start(struct gfs2_inode *ip, uint64_t size)
845 gfs2_truncator_t truncator)
846{ 845{
847 struct gfs2_sbd *sdp = ip->i_sbd; 846 struct gfs2_sbd *sdp = ip->i_sbd;
848 struct buffer_head *dibh; 847 struct buffer_head *dibh;
@@ -873,7 +872,7 @@ static int trunc_start(struct gfs2_inode *ip, uint64_t size,
873 if (do_div(junk, sdp->sd_jbsize)) 872 if (do_div(junk, sdp->sd_jbsize))
874 error = truncator_journaled(ip, size); 873 error = truncator_journaled(ip, size);
875 } else if (size & (uint64_t)(sdp->sd_sb.sb_bsize - 1)) 874 } else if (size & (uint64_t)(sdp->sd_sb.sb_bsize - 1))
876 error = truncator(ip, size); 875 error = gfs2_truncator_page(ip, size);
877 876
878 if (!error) { 877 if (!error) {
879 ip->i_di.di_size = size; 878 ip->i_di.di_size = size;
@@ -980,12 +979,11 @@ static int trunc_end(struct gfs2_inode *ip)
980 * Returns: errno 979 * Returns: errno
981 */ 980 */
982 981
983static int do_shrink(struct gfs2_inode *ip, uint64_t size, 982static int do_shrink(struct gfs2_inode *ip, uint64_t size)
984 gfs2_truncator_t truncator)
985{ 983{
986 int error; 984 int error;
987 985
988 error = trunc_start(ip, size, truncator); 986 error = trunc_start(ip, size);
989 if (error < 0) 987 if (error < 0)
990 return error; 988 return error;
991 if (error > 0) 989 if (error > 0)
@@ -1009,8 +1007,7 @@ static int do_shrink(struct gfs2_inode *ip, uint64_t size,
1009 * Returns: errno 1007 * Returns: errno
1010 */ 1008 */
1011 1009
1012int gfs2_truncatei(struct gfs2_inode *ip, uint64_t size, 1010int gfs2_truncatei(struct gfs2_inode *ip, uint64_t size)
1013 gfs2_truncator_t truncator)
1014{ 1011{
1015 int error; 1012 int error;
1016 1013
@@ -1020,7 +1017,7 @@ int gfs2_truncatei(struct gfs2_inode *ip, uint64_t size,
1020 if (size > ip->i_di.di_size) 1017 if (size > ip->i_di.di_size)
1021 error = do_grow(ip, size); 1018 error = do_grow(ip, size);
1022 else 1019 else
1023 error = do_shrink(ip, size, truncator); 1020 error = do_shrink(ip, size);
1024 1021
1025 return error; 1022 return error;
1026} 1023}
diff --git a/fs/gfs2/bmap.h b/fs/gfs2/bmap.h
index 25ea32905c67..b83b5924828f 100644
--- a/fs/gfs2/bmap.h
+++ b/fs/gfs2/bmap.h
@@ -23,8 +23,7 @@ int gfs2_block_map(struct gfs2_inode *ip,
23 uint64_t *dblock, uint32_t *extlen); 23 uint64_t *dblock, uint32_t *extlen);
24 24
25typedef int (*gfs2_truncator_t) (struct gfs2_inode * ip, uint64_t size); 25typedef int (*gfs2_truncator_t) (struct gfs2_inode * ip, uint64_t size);
26int gfs2_truncatei(struct gfs2_inode *ip, uint64_t size, 26int gfs2_truncatei(struct gfs2_inode *ip, uint64_t size);
27 gfs2_truncator_t truncator);
28int gfs2_truncatei_resume(struct gfs2_inode *ip); 27int gfs2_truncatei_resume(struct gfs2_inode *ip);
29int gfs2_file_dealloc(struct gfs2_inode *ip); 28int gfs2_file_dealloc(struct gfs2_inode *ip);
30 29
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c
index 89417a6cb723..6fff30ef8b70 100644
--- a/fs/gfs2/ops_inode.c
+++ b/fs/gfs2/ops_inode.c
@@ -994,7 +994,7 @@ static int setattr_size(struct inode *inode, struct iattr *attr)
994 return error; 994 return error;
995 } 995 }
996 996
997 error = gfs2_truncatei(ip, attr->ia_size, gfs2_truncator_page); 997 error = gfs2_truncatei(ip, attr->ia_size);
998 if (error) 998 if (error)
999 return error; 999 return error;
1000 1000