From b7eba890a228f591fea2889b901267ba5de7839b Mon Sep 17 00:00:00 2001 From: Andreas Gruenbacher Date: Thu, 21 Jun 2018 07:42:37 -0500 Subject: gfs2: Eliminate redundant ip->i_rgd GFS2 remembers the last rgrp used for allocations in ip->i_rgd. However, block allocations are made by way of a reservations structure, ip->i_res, which keeps the last rgrp in ip->i_res.rs_rgd, and ip->i_res is kept in sync with ip->i_res.rs_rgd, so it's redundant. Get rid of ip->i_rgd and just use ip->i_res.rs_rgd in its place. Based on patches by Robert Peterson. Signed-off-by: Andreas Gruenbacher Signed-off-by: Bob Peterson --- fs/gfs2/trans.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'fs/gfs2/trans.h') diff --git a/fs/gfs2/trans.h b/fs/gfs2/trans.h index 1e6e7da25a17..ad70087d0597 100644 --- a/fs/gfs2/trans.h +++ b/fs/gfs2/trans.h @@ -30,9 +30,11 @@ struct gfs2_glock; * block, or all of the blocks in the rg, whichever is smaller */ static inline unsigned int gfs2_rg_blocks(const struct gfs2_inode *ip, unsigned requested) { - if (requested < ip->i_rgd->rd_length) + struct gfs2_rgrpd *rgd = ip->i_res.rs_rbm.rgd; + + if (requested < rgd->rd_length) return requested + 1; - return ip->i_rgd->rd_length; + return rgd->rd_length; } extern int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks, -- cgit v1.2.3