diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2012-08-03 06:23:28 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2012-09-24 05:47:00 -0400 |
commit | 3b1d0b9d0b6f4b76293c8f30cc95aa946bd34150 (patch) | |
tree | c286ba44c4ec57f3eef931491bfd8ef27f970922 /fs | |
parent | 3983903a712e74548fa08ef25d68e55b8e4349c6 (diff) |
GFS2: Update rgblk_free() to use rbm
Replace open coded version with a call to gfs2_rbm_from_block()
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/gfs2/rgrp.c | 44 |
1 files changed, 14 insertions, 30 deletions
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index 0c1be38f8370..06476b34a1b9 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -1890,46 +1890,30 @@ static u64 gfs2_alloc_extent(const struct gfs2_rbm *rbm, bool dinode, | |||
1890 | static struct gfs2_rgrpd *rgblk_free(struct gfs2_sbd *sdp, u64 bstart, | 1890 | static struct gfs2_rgrpd *rgblk_free(struct gfs2_sbd *sdp, u64 bstart, |
1891 | u32 blen, unsigned char new_state) | 1891 | u32 blen, unsigned char new_state) |
1892 | { | 1892 | { |
1893 | struct gfs2_rgrpd *rgd; | 1893 | struct gfs2_rbm rbm; |
1894 | struct gfs2_bitmap *bi = NULL; | ||
1895 | u32 length, rgrp_blk, buf_blk; | ||
1896 | unsigned int buf; | ||
1897 | 1894 | ||
1898 | rgd = gfs2_blk2rgrpd(sdp, bstart, 1); | 1895 | rbm.rgd = gfs2_blk2rgrpd(sdp, bstart, 1); |
1899 | if (!rgd) { | 1896 | if (!rbm.rgd) { |
1900 | if (gfs2_consist(sdp)) | 1897 | if (gfs2_consist(sdp)) |
1901 | fs_err(sdp, "block = %llu\n", (unsigned long long)bstart); | 1898 | fs_err(sdp, "block = %llu\n", (unsigned long long)bstart); |
1902 | return NULL; | 1899 | return NULL; |
1903 | } | 1900 | } |
1904 | 1901 | ||
1905 | length = rgd->rd_length; | ||
1906 | |||
1907 | rgrp_blk = bstart - rgd->rd_data0; | ||
1908 | |||
1909 | while (blen--) { | 1902 | while (blen--) { |
1910 | for (buf = 0; buf < length; buf++) { | 1903 | gfs2_rbm_from_block(&rbm, bstart); |
1911 | bi = rgd->rd_bits + buf; | 1904 | bstart++; |
1912 | if (rgrp_blk < (bi->bi_start + bi->bi_len) * GFS2_NBBY) | 1905 | if (!rbm.bi->bi_clone) { |
1913 | break; | 1906 | rbm.bi->bi_clone = kmalloc(rbm.bi->bi_bh->b_size, |
1907 | GFP_NOFS | __GFP_NOFAIL); | ||
1908 | memcpy(rbm.bi->bi_clone + rbm.bi->bi_offset, | ||
1909 | rbm.bi->bi_bh->b_data + rbm.bi->bi_offset, | ||
1910 | rbm.bi->bi_len); | ||
1914 | } | 1911 | } |
1915 | 1912 | gfs2_trans_add_bh(rbm.rgd->rd_gl, rbm.bi->bi_bh, 1); | |
1916 | gfs2_assert(rgd->rd_sbd, buf < length); | 1913 | gfs2_setbit(rbm.rgd, NULL, rbm.bi, rbm.offset, new_state); |
1917 | |||
1918 | buf_blk = rgrp_blk - bi->bi_start * GFS2_NBBY; | ||
1919 | rgrp_blk++; | ||
1920 | |||
1921 | if (!bi->bi_clone) { | ||
1922 | bi->bi_clone = kmalloc(bi->bi_bh->b_size, | ||
1923 | GFP_NOFS | __GFP_NOFAIL); | ||
1924 | memcpy(bi->bi_clone + bi->bi_offset, | ||
1925 | bi->bi_bh->b_data + bi->bi_offset, | ||
1926 | bi->bi_len); | ||
1927 | } | ||
1928 | gfs2_trans_add_bh(rgd->rd_gl, bi->bi_bh, 1); | ||
1929 | gfs2_setbit(rgd, NULL, bi, buf_blk, new_state); | ||
1930 | } | 1914 | } |
1931 | 1915 | ||
1932 | return rgd; | 1916 | return rbm.rgd; |
1933 | } | 1917 | } |
1934 | 1918 | ||
1935 | /** | 1919 | /** |