GFS2: optimize rbm_from_block wrt bi_start
authorBob Peterson <rpeterso@redhat.com>
Wed, 11 Sep 2013 18:44:01 +0000 (13:44 -0500)
committerSteven Whitehouse <swhiteho@redhat.com>
Tue, 17 Sep 2013 09:14:39 +0000 (10:14 +0100)
In function gfs2_rbm_from_block, it starts by checking if the block
falls within the first bitmap. It does so by checking if the rbm's
offset is less than (rbm->bi->bi_start + rbm->bi->bi_len) * GFS2_NBBY.
However, the first bitmap will always have bi_start==0. Therefore
this is an unnecessary calculation in a function that gets called
billions of times. This patch removes the reference to bi_start.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
fs/gfs2/rgrp.c

index 69317435faa723c9288d390407d9343fb6bf1096..7a6fa03bb32ab77791efdb2d51ef8366653e62ee 100644 (file)
@@ -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_start + rbm->bi->bi_len) * GFS2_NBBY)
+       if (rbm->offset < rbm->bi->bi_len * GFS2_NBBY)
                return 0;
 
        /* Adjust for the size diff between gfs2_meta_header and gfs2_rgrp */