Commit 281b4952 authored by Andreas Gruenbacher's avatar Andreas Gruenbacher Committed by Bob Peterson

gfs2: Rename bitmap.bi_{len => bytes}

This field indicates the size of the bitmap in bytes, similar to how the
bi_blocks field indicates the size of the bitmap in blocks.

In count_unlinked, replace an instance of bi_bytes * GFS2_NBBY by
bi_blocks.
Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
Reviewed-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
parent ad899458
...@@ -92,7 +92,7 @@ struct gfs2_bitmap { ...@@ -92,7 +92,7 @@ struct gfs2_bitmap {
unsigned long bi_flags; unsigned long bi_flags;
u32 bi_offset; u32 bi_offset;
u32 bi_start; u32 bi_start;
u32 bi_len; u32 bi_bytes;
u32 bi_blocks; u32 bi_blocks;
}; };
......
...@@ -81,7 +81,7 @@ static void maybe_release_space(struct gfs2_bufdata *bd) ...@@ -81,7 +81,7 @@ static void maybe_release_space(struct gfs2_bufdata *bd)
if (sdp->sd_args.ar_discard) if (sdp->sd_args.ar_discard)
gfs2_rgrp_send_discards(sdp, rgd->rd_data0, bd->bd_bh, bi, 1, NULL); gfs2_rgrp_send_discards(sdp, rgd->rd_data0, bd->bd_bh, bi, 1, NULL);
memcpy(bi->bi_clone + bi->bi_offset, memcpy(bi->bi_clone + bi->bi_offset,
bd->bd_bh->b_data + bi->bi_offset, bi->bi_len); bd->bd_bh->b_data + bi->bi_offset, bi->bi_bytes);
clear_bit(GBF_FULL, &bi->bi_flags); clear_bit(GBF_FULL, &bi->bi_flags);
rgd->rd_free_clone = rgd->rd_free; rgd->rd_free_clone = rgd->rd_free;
rgd->rd_extfail_pt = rgd->rd_free; rgd->rd_extfail_pt = rgd->rd_free;
......
...@@ -90,7 +90,7 @@ static inline void gfs2_setbit(const struct gfs2_rbm *rbm, bool do_clone, ...@@ -90,7 +90,7 @@ static inline void gfs2_setbit(const struct gfs2_rbm *rbm, bool do_clone,
{ {
unsigned char *byte1, *byte2, *end, cur_state; unsigned char *byte1, *byte2, *end, cur_state;
struct gfs2_bitmap *bi = rbm_bi(rbm); struct gfs2_bitmap *bi = rbm_bi(rbm);
unsigned int buflen = bi->bi_len; unsigned int buflen = bi->bi_bytes;
const unsigned int bit = (rbm->offset % GFS2_NBBY) * GFS2_BIT_SIZE; const unsigned int bit = (rbm->offset % GFS2_NBBY) * GFS2_BIT_SIZE;
byte1 = bi->bi_bh->b_data + bi->bi_offset + (rbm->offset / GFS2_NBBY); byte1 = bi->bi_bh->b_data + bi->bi_offset + (rbm->offset / GFS2_NBBY);
...@@ -108,8 +108,8 @@ static inline void gfs2_setbit(const struct gfs2_rbm *rbm, bool do_clone, ...@@ -108,8 +108,8 @@ static inline void gfs2_setbit(const struct gfs2_rbm *rbm, bool do_clone,
fs_warn(sdp, "rgrp=0x%llx bi_start=0x%x biblk: 0x%llx\n", fs_warn(sdp, "rgrp=0x%llx bi_start=0x%x biblk: 0x%llx\n",
(unsigned long long)rbm->rgd->rd_addr, bi->bi_start, (unsigned long long)rbm->rgd->rd_addr, bi->bi_start,
(unsigned long long)bi->bi_bh->b_blocknr); (unsigned long long)bi->bi_bh->b_blocknr);
fs_warn(sdp, "bi_offset=0x%x bi_len=0x%x block=0x%llx\n", fs_warn(sdp, "bi_offset=0x%x bi_bytes=0x%x block=0x%llx\n",
bi->bi_offset, bi->bi_len, bi->bi_offset, bi->bi_bytes,
(unsigned long long)gfs2_rbm_to_block(rbm)); (unsigned long long)gfs2_rbm_to_block(rbm));
dump_stack(); dump_stack();
gfs2_consist_rgrpd(rbm->rgd); gfs2_consist_rgrpd(rbm->rgd);
...@@ -381,7 +381,7 @@ static u32 gfs2_free_extlen(const struct gfs2_rbm *rrbm, u32 len) ...@@ -381,7 +381,7 @@ static u32 gfs2_free_extlen(const struct gfs2_rbm *rrbm, u32 len)
if (bi->bi_clone) if (bi->bi_clone)
start = bi->bi_clone; start = bi->bi_clone;
start += bi->bi_offset; start += bi->bi_offset;
end = start + bi->bi_len; end = start + bi->bi_bytes;
BUG_ON(rbm.offset & 3); BUG_ON(rbm.offset & 3);
start += (rbm.offset / GFS2_NBBY); start += (rbm.offset / GFS2_NBBY);
bytes = min_t(u32, len / GFS2_NBBY, (end - start)); bytes = min_t(u32, len / GFS2_NBBY, (end - start));
...@@ -466,7 +466,7 @@ void gfs2_rgrp_verify(struct gfs2_rgrpd *rgd) ...@@ -466,7 +466,7 @@ void gfs2_rgrp_verify(struct gfs2_rgrpd *rgd)
count[x] += gfs2_bitcount(rgd, count[x] += gfs2_bitcount(rgd,
bi->bi_bh->b_data + bi->bi_bh->b_data +
bi->bi_offset, bi->bi_offset,
bi->bi_len, x); bi->bi_bytes, x);
} }
if (count[0] != rgd->rd_free) { if (count[0] != rgd->rd_free) {
...@@ -781,21 +781,21 @@ static int compute_bitstructs(struct gfs2_rgrpd *rgd) ...@@ -781,21 +781,21 @@ static int compute_bitstructs(struct gfs2_rgrpd *rgd)
bytes = bytes_left; bytes = bytes_left;
bi->bi_offset = sizeof(struct gfs2_rgrp); bi->bi_offset = sizeof(struct gfs2_rgrp);
bi->bi_start = 0; bi->bi_start = 0;
bi->bi_len = bytes; bi->bi_bytes = bytes;
bi->bi_blocks = bytes * GFS2_NBBY; bi->bi_blocks = bytes * GFS2_NBBY;
/* header block */ /* header block */
} else if (x == 0) { } else if (x == 0) {
bytes = sdp->sd_sb.sb_bsize - sizeof(struct gfs2_rgrp); bytes = sdp->sd_sb.sb_bsize - sizeof(struct gfs2_rgrp);
bi->bi_offset = sizeof(struct gfs2_rgrp); bi->bi_offset = sizeof(struct gfs2_rgrp);
bi->bi_start = 0; bi->bi_start = 0;
bi->bi_len = bytes; bi->bi_bytes = bytes;
bi->bi_blocks = bytes * GFS2_NBBY; bi->bi_blocks = bytes * GFS2_NBBY;
/* last block */ /* last block */
} else if (x + 1 == length) { } else if (x + 1 == length) {
bytes = bytes_left; bytes = bytes_left;
bi->bi_offset = sizeof(struct gfs2_meta_header); bi->bi_offset = sizeof(struct gfs2_meta_header);
bi->bi_start = rgd->rd_bitbytes - bytes_left; bi->bi_start = rgd->rd_bitbytes - bytes_left;
bi->bi_len = bytes; bi->bi_bytes = bytes;
bi->bi_blocks = bytes * GFS2_NBBY; bi->bi_blocks = bytes * GFS2_NBBY;
/* other blocks */ /* other blocks */
} else { } else {
...@@ -803,7 +803,7 @@ static int compute_bitstructs(struct gfs2_rgrpd *rgd) ...@@ -803,7 +803,7 @@ static int compute_bitstructs(struct gfs2_rgrpd *rgd)
sizeof(struct gfs2_meta_header); sizeof(struct gfs2_meta_header);
bi->bi_offset = sizeof(struct gfs2_meta_header); bi->bi_offset = sizeof(struct gfs2_meta_header);
bi->bi_start = rgd->rd_bitbytes - bytes_left; bi->bi_start = rgd->rd_bitbytes - bytes_left;
bi->bi_len = bytes; bi->bi_bytes = bytes;
bi->bi_blocks = bytes * GFS2_NBBY; bi->bi_blocks = bytes * GFS2_NBBY;
} }
...@@ -815,11 +815,11 @@ static int compute_bitstructs(struct gfs2_rgrpd *rgd) ...@@ -815,11 +815,11 @@ static int compute_bitstructs(struct gfs2_rgrpd *rgd)
return -EIO; return -EIO;
} }
bi = rgd->rd_bits + (length - 1); bi = rgd->rd_bits + (length - 1);
if ((bi->bi_start + bi->bi_len) * GFS2_NBBY != rgd->rd_data) { if ((bi->bi_start + bi->bi_bytes) * GFS2_NBBY != rgd->rd_data) {
if (gfs2_consist_rgrpd(rgd)) { if (gfs2_consist_rgrpd(rgd)) {
gfs2_rindex_print(rgd); gfs2_rindex_print(rgd);
fs_err(sdp, "start=%u len=%u offset=%u\n", fs_err(sdp, "start=%u len=%u offset=%u\n",
bi->bi_start, bi->bi_len, bi->bi_offset); bi->bi_start, bi->bi_bytes, bi->bi_offset);
} }
return -EIO; return -EIO;
} }
...@@ -1146,8 +1146,8 @@ static u32 count_unlinked(struct gfs2_rgrpd *rgd) ...@@ -1146,8 +1146,8 @@ static u32 count_unlinked(struct gfs2_rgrpd *rgd)
goal = 0; goal = 0;
buffer = bi->bi_bh->b_data + bi->bi_offset; buffer = bi->bi_bh->b_data + bi->bi_offset;
WARN_ON(!buffer_uptodate(bi->bi_bh)); WARN_ON(!buffer_uptodate(bi->bi_bh));
while (goal < bi->bi_len * GFS2_NBBY) { while (goal < bi->bi_blocks) {
goal = gfs2_bitfit(buffer, bi->bi_len, goal, goal = gfs2_bitfit(buffer, bi->bi_bytes, goal,
GFS2_BLKST_UNLINKED); GFS2_BLKST_UNLINKED);
if (goal == BFITNOENT) if (goal == BFITNOENT)
break; break;
...@@ -1319,7 +1319,7 @@ int gfs2_rgrp_send_discards(struct gfs2_sbd *sdp, u64 offset, ...@@ -1319,7 +1319,7 @@ int gfs2_rgrp_send_discards(struct gfs2_sbd *sdp, u64 offset,
u32 trimmed = 0; u32 trimmed = 0;
u8 diff; u8 diff;
for (x = 0; x < bi->bi_len; x++) { for (x = 0; x < bi->bi_bytes; x++) {
const u8 *clone = bi->bi_clone ? bi->bi_clone : bi->bi_bh->b_data; const u8 *clone = bi->bi_clone ? bi->bi_clone : bi->bi_bh->b_data;
clone += bi->bi_offset; clone += bi->bi_offset;
clone += x; clone += x;
...@@ -1752,7 +1752,7 @@ static int gfs2_rbm_find(struct gfs2_rbm *rbm, u8 state, u32 *minext, ...@@ -1752,7 +1752,7 @@ static int gfs2_rbm_find(struct gfs2_rbm *rbm, u8 state, u32 *minext,
if (state != GFS2_BLKST_UNLINKED && bi->bi_clone) if (state != GFS2_BLKST_UNLINKED && bi->bi_clone)
buffer = bi->bi_clone + bi->bi_offset; buffer = bi->bi_clone + bi->bi_offset;
initial_offset = rbm->offset; initial_offset = rbm->offset;
offset = gfs2_bitfit(buffer, bi->bi_len, rbm->offset, state); offset = gfs2_bitfit(buffer, bi->bi_bytes, rbm->offset, state);
if (offset == BFITNOENT) if (offset == BFITNOENT)
goto bitmap_full; goto bitmap_full;
rbm->offset = offset; rbm->offset = offset;
...@@ -2236,7 +2236,7 @@ static struct gfs2_rgrpd *rgblk_free(struct gfs2_sbd *sdp, u64 bstart, ...@@ -2236,7 +2236,7 @@ static struct gfs2_rgrpd *rgblk_free(struct gfs2_sbd *sdp, u64 bstart,
GFP_NOFS | __GFP_NOFAIL); GFP_NOFS | __GFP_NOFAIL);
memcpy(bi->bi_clone + bi->bi_offset, memcpy(bi->bi_clone + bi->bi_offset,
bi->bi_bh->b_data + bi->bi_offset, bi->bi_bh->b_data + bi->bi_offset,
bi->bi_len); bi->bi_bytes);
} }
gfs2_trans_add_meta(rbm.rgd->rd_gl, bi->bi_bh); gfs2_trans_add_meta(rbm.rgd->rd_gl, bi->bi_bh);
bi_prev = bi; bi_prev = bi;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment