]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
gfs2: Don't clear GBF_FULL flags in rs_deltree
authorAndreas Gruenbacher <agruenba@redhat.com>
Tue, 6 Oct 2020 13:16:16 +0000 (15:16 +0200)
committerAndreas Gruenbacher <agruenba@redhat.com>
Mon, 18 Jan 2021 15:56:37 +0000 (16:56 +0100)
Removing a reservation doesn't make any actual space available, so don't clear
the GBF_FULL flags in that case.  Otherwise, we'll only spend more time
scanning the bitmaps unnecessarily.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/rgrp.c

index faf9f21f3e98b1c5e2d5bf2bbf558e13f6e3ed68..f585a13cebde012b2da1b73e0e9c3340380c06f9 100644 (file)
@@ -327,20 +327,6 @@ static bool gfs2_rbm_add(struct gfs2_rbm *rbm, u32 blocks)
        }
 }
 
-static struct gfs2_bitmap *gfs2_block_to_bitmap(struct gfs2_rgrpd *rgd,
-                                               u64 block)
-{
-       unsigned int delta = (sizeof(struct gfs2_rgrp) -
-                             sizeof(struct gfs2_meta_header)) * GFS2_NBBY;
-       unsigned int rblock, bii;
-
-       if (!rgrp_contains_block(rgd, block))
-               return NULL;
-       rblock = block - rgd->rd_data0;
-       bii = (rblock + delta) / rgd->rd_sbd->sd_blocks_per_bitmap;
-       return rgd->rd_bits + bii;
-}
-
 /**
  * gfs2_unaligned_extlen - Look for free blocks which are not byte aligned
  * @rbm: Position to search (value/result)
@@ -660,25 +646,16 @@ static void __rs_deltree(struct gfs2_blkreserv *rs)
        RB_CLEAR_NODE(&rs->rs_node);
 
        if (rs->rs_free) {
-               u64 last_block = rs->rs_start + rs->rs_free - 1;
-               struct gfs2_bitmap *start, *last;
-
                /* return reserved blocks to the rgrp */
                BUG_ON(rs->rs_rgd->rd_reserved < rs->rs_free);
                rs->rs_rgd->rd_reserved -= rs->rs_free;
+
                /* The rgrp extent failure point is likely not to increase;
                   it will only do so if the freed blocks are somehow
                   contiguous with a span of free blocks that follows. Still,
                   it will force the number to be recalculated later. */
                rgd->rd_extfail_pt += rs->rs_free;
                rs->rs_free = 0;
-               start = gfs2_block_to_bitmap(rgd, rs->rs_start);
-               last = gfs2_block_to_bitmap(rgd, last_block);
-               if (!start || !last)
-                       return;
-               do
-                       clear_bit(GBF_FULL, &start->bi_flags);
-               while (start++ != last);
        }
 }