aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2012-08-03 06:10:30 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2012-09-24 05:46:59 -0400
commit3983903a712e74548fa08ef25d68e55b8e4349c6 (patch)
treefa1bf649afd50e59462cc9cd39785f0b3c1ad663
parent5b924ae2dcb1cc5e78445a0cedb5a3673bb5ad8a (diff)
GFS2: Update gfs2_get_block_type() to use rbm
Use the new gfs2_rbm_from_block() function to replace an open coded version of the same code. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
-rw-r--r--fs/gfs2/rgrp.c25
1 files changed, 6 insertions, 19 deletions
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index bd3b926949d0..0c1be38f8370 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -1824,27 +1824,14 @@ void gfs2_inplace_release(struct gfs2_inode *ip)
1824 1824
1825static unsigned char gfs2_get_block_type(struct gfs2_rgrpd *rgd, u64 block) 1825static unsigned char gfs2_get_block_type(struct gfs2_rgrpd *rgd, u64 block)
1826{ 1826{
1827 struct gfs2_bitmap *bi = NULL; 1827 struct gfs2_rbm rbm = { .rgd = rgd, };
1828 u32 length, rgrp_block, buf_block; 1828 int ret;
1829 unsigned int buf;
1830 unsigned char type;
1831
1832 length = rgd->rd_length;
1833 rgrp_block = block - rgd->rd_data0;
1834
1835 for (buf = 0; buf < length; buf++) {
1836 bi = rgd->rd_bits + buf;
1837 if (rgrp_block < (bi->bi_start + bi->bi_len) * GFS2_NBBY)
1838 break;
1839 }
1840
1841 gfs2_assert(rgd->rd_sbd, buf < length);
1842 buf_block = rgrp_block - bi->bi_start * GFS2_NBBY;
1843 1829
1844 type = gfs2_testbit(rgd, bi->bi_bh->b_data + bi->bi_offset, 1830 ret = gfs2_rbm_from_block(&rbm, block);
1845 bi->bi_len, buf_block); 1831 WARN_ON_ONCE(ret != 0);
1846 1832
1847 return type; 1833 return gfs2_testbit(rgd, rbm.bi->bi_bh->b_data + rbm.bi->bi_offset,
1834 rbm.bi->bi_len, rbm.offset);
1848} 1835}
1849 1836
1850 1837