aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBob Peterson <rpeterso@redhat.com>2011-03-22 13:52:44 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2011-04-20 03:53:35 -0400
commit0d95326d9bd39f6eae80b91392b308c5fa8b1a0f (patch)
treefcb34235afd36e192823295567f08fa05311b190
parent95c8e17f2f00f6af7474fac0e4050a79db6c3cea (diff)
GFS2: remove *leaf_call_t and simplify leaf_dealloc
Since foreach_leaf is only called with leaf_dealloc as its only possible call function, we can simplify the code by making it call leaf_dealloc directly. This simplifies the code and eliminates the need for leaf_call_t, the generic call method. This is a first small step in simplifying the directory leaf deallocation code. Signed-off-by: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
-rw-r--r--fs/gfs2/dir.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index f789c5732b7c..0bb5f6bed591 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -82,11 +82,11 @@
82struct qstr gfs2_qdot __read_mostly; 82struct qstr gfs2_qdot __read_mostly;
83struct qstr gfs2_qdotdot __read_mostly; 83struct qstr gfs2_qdotdot __read_mostly;
84 84
85typedef int (*leaf_call_t) (struct gfs2_inode *dip, u32 index, u32 len,
86 u64 leaf_no, void *data);
87typedef int (*gfs2_dscan_t)(const struct gfs2_dirent *dent, 85typedef int (*gfs2_dscan_t)(const struct gfs2_dirent *dent,
88 const struct qstr *name, void *opaque); 86 const struct qstr *name, void *opaque);
89 87
88static int leaf_dealloc(struct gfs2_inode *dip, u32 index, u32 len,
89 u64 leaf_no);
90 90
91int gfs2_dir_get_new_buffer(struct gfs2_inode *ip, u64 block, 91int gfs2_dir_get_new_buffer(struct gfs2_inode *ip, u64 block,
92 struct buffer_head **bhp) 92 struct buffer_head **bhp)
@@ -1770,13 +1770,11 @@ int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename,
1770/** 1770/**
1771 * foreach_leaf - call a function for each leaf in a directory 1771 * foreach_leaf - call a function for each leaf in a directory
1772 * @dip: the directory 1772 * @dip: the directory
1773 * @lc: the function to call for each each
1774 * @data: private data to pass to it
1775 * 1773 *
1776 * Returns: errno 1774 * Returns: errno
1777 */ 1775 */
1778 1776
1779static int foreach_leaf(struct gfs2_inode *dip, leaf_call_t lc, void *data) 1777static int foreach_leaf(struct gfs2_inode *dip)
1780{ 1778{
1781 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); 1779 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode);
1782 struct buffer_head *bh; 1780 struct buffer_head *bh;
@@ -1823,7 +1821,7 @@ static int foreach_leaf(struct gfs2_inode *dip, leaf_call_t lc, void *data)
1823 len = 1 << (dip->i_depth - be16_to_cpu(leaf->lf_depth)); 1821 len = 1 << (dip->i_depth - be16_to_cpu(leaf->lf_depth));
1824 brelse(bh); 1822 brelse(bh);
1825 1823
1826 error = lc(dip, index, len, leaf_no, data); 1824 error = leaf_dealloc(dip, index, len, leaf_no);
1827 if (error) 1825 if (error)
1828 goto out; 1826 goto out;
1829 1827
@@ -1855,7 +1853,7 @@ out:
1855 */ 1853 */
1856 1854
1857static int leaf_dealloc(struct gfs2_inode *dip, u32 index, u32 len, 1855static int leaf_dealloc(struct gfs2_inode *dip, u32 index, u32 len,
1858 u64 leaf_no, void *data) 1856 u64 leaf_no)
1859{ 1857{
1860 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); 1858 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode);
1861 struct gfs2_leaf *tmp_leaf; 1859 struct gfs2_leaf *tmp_leaf;
@@ -1978,7 +1976,7 @@ int gfs2_dir_exhash_dealloc(struct gfs2_inode *dip)
1978 int error; 1976 int error;
1979 1977
1980 /* Dealloc on-disk leaves to FREEMETA state */ 1978 /* Dealloc on-disk leaves to FREEMETA state */
1981 error = foreach_leaf(dip, leaf_dealloc, NULL); 1979 error = foreach_leaf(dip);
1982 if (error) 1980 if (error)
1983 return error; 1981 return error;
1984 1982