Pass the resource group and bitmap index to gfs2_rgrp_send_discards separately: one of the next patches will remove bi_bh from struct gfs2_bitmap, so we'll need to get it from the resource group in the future.
Signed-off-by: Andreas Gruenbacher <agrue...@redhat.com> --- fs/gfs2/lops.c | 3 ++- fs/gfs2/rgrp.c | 11 +++++------ fs/gfs2/rgrp.h | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c index 94dcab655bc02..2db478768b229 100644 --- a/fs/gfs2/lops.c +++ b/fs/gfs2/lops.c @@ -81,7 +81,8 @@ static void maybe_release_space(struct gfs2_bufdata *bd) if (bi->bi_clone == NULL) return; 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, rgd, + index, 1, NULL); memcpy(bi->bi_clone + bi->bi_offset, bd->bd_bh->b_data + bi->bi_offset, bi->bi_bytes); clear_bit(GBF_FULL, &bi->bi_flags); diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index 7a93568fdc709..a86358afb33e7 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c @@ -1343,10 +1343,10 @@ void gfs2_rgrp_go_unlock(struct gfs2_holder *gh) } int gfs2_rgrp_send_discards(struct gfs2_sbd *sdp, u64 offset, - struct buffer_head *bh, - const struct gfs2_bitmap *bi, unsigned minlen, - u64 *ptrimmed) + struct buffer_head *bh, struct gfs2_rgrpd *rgd, + unsigned int bii, unsigned minlen, u64 *ptrimmed) { + struct gfs2_bitmap *bi = rgd->rd_bits + bii; struct super_block *sb = sdp->sd_vfs; u64 blk; sector_t start = 0; @@ -1472,10 +1472,9 @@ int gfs2_fitrim(struct file *filp, void __user *argp) if (!(rgd->rd_flags & GFS2_RGF_TRIMMED)) { /* Trim each bitmap in the rgrp */ for (x = 0; x < rgd->rd_length; x++) { - struct gfs2_bitmap *bi = rgd->rd_bits + x; ret = gfs2_rgrp_send_discards(sdp, - rgd->rd_data0, NULL, bi, minlen, - &amt); + rgd->rd_data0, NULL, rgd, x, + minlen, &amt); if (ret) { gfs2_glock_dq_uninit(&gh); goto out; diff --git a/fs/gfs2/rgrp.h b/fs/gfs2/rgrp.h index 499079a9dbbed..4af09a548c358 100644 --- a/fs/gfs2/rgrp.h +++ b/fs/gfs2/rgrp.h @@ -75,7 +75,8 @@ extern u64 gfs2_ri_total(struct gfs2_sbd *sdp); extern void gfs2_rgrp_dump(struct seq_file *seq, struct gfs2_glock *gl); extern int gfs2_rgrp_send_discards(struct gfs2_sbd *sdp, u64 offset, struct buffer_head *bh, - const struct gfs2_bitmap *bi, unsigned minlen, u64 *ptrimmed); + struct gfs2_rgrpd *rgd, unsigned int bii, + unsigned minlen, u64 *ptrimmed); extern int gfs2_fitrim(struct file *filp, void __user *argp); /* This is how to tell if a reservation is in the rgrp tree: */ -- 2.20.1