diff options
author | Bob Peterson <rpeterso@redhat.com> | 2013-09-11 13:44:02 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2013-09-17 10:15:13 +0100 |
commit | 7e230f5774336c5c180d8aeab0e2cb1326c73fa3 (patch) | |
tree | 56b733f9e0ef00e4aa022adcd6a3c1e41fab1a84 /fs/gfs2/rgrp.c | |
parent | 6aa7640f306a1dd0923d29d9190c5686907d5140 (diff) | |
download | linux-7e230f5774336c5c180d8aeab0e2cb1326c73fa3.tar.gz linux-7e230f5774336c5c180d8aeab0e2cb1326c73fa3.tar.bz2 linux-7e230f5774336c5c180d8aeab0e2cb1326c73fa3.zip |
GFS2: introduce bi_blocks for optimization
This patch introduces a new field in the bitmap structure called
bi_blocks. Its purpose is to save us from constantly multiplying
bi_len by the constant GFS2_NBBY. It also paves the way for more
optimization in a future patch.
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/rgrp.c')
-rw-r--r-- | fs/gfs2/rgrp.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index 7a6fa03bb32a..7d64a27683d9 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c @@ -262,7 +262,7 @@ static int gfs2_rbm_from_block(struct gfs2_rbm *rbm, u64 block) rbm->bi = rbm->rgd->rd_bits; rbm->offset = (u32)(rblock); /* Check if the block is within the first block */ - if (rbm->offset < rbm->bi->bi_len * GFS2_NBBY) + if (rbm->offset < rbm->bi->bi_blocks) return 0; /* Adjust for the size diff between gfs2_meta_header and gfs2_rgrp */ @@ -743,18 +743,21 @@ static int compute_bitstructs(struct gfs2_rgrpd *rgd) bi->bi_offset = sizeof(struct gfs2_rgrp); bi->bi_start = 0; bi->bi_len = bytes; + bi->bi_blocks = bytes * GFS2_NBBY; /* header block */ } else if (x == 0) { bytes = sdp->sd_sb.sb_bsize - sizeof(struct gfs2_rgrp); bi->bi_offset = sizeof(struct gfs2_rgrp); bi->bi_start = 0; bi->bi_len = bytes; + bi->bi_blocks = bytes * GFS2_NBBY; /* last block */ } else if (x + 1 == length) { bytes = bytes_left; bi->bi_offset = sizeof(struct gfs2_meta_header); bi->bi_start = rgd->rd_bitbytes - bytes_left; bi->bi_len = bytes; + bi->bi_blocks = bytes * GFS2_NBBY; /* other blocks */ } else { bytes = sdp->sd_sb.sb_bsize - @@ -762,6 +765,7 @@ static int compute_bitstructs(struct gfs2_rgrpd *rgd) bi->bi_offset = sizeof(struct gfs2_meta_header); bi->bi_start = rgd->rd_bitbytes - bytes_left; bi->bi_len = bytes; + bi->bi_blocks = bytes * GFS2_NBBY; } bytes_left -= bytes; |