aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/rgrp.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/rgrp.c')
-rw-r--r--fs/gfs2/rgrp.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 08b3a8002aca..3088fb25656d 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -1560,7 +1560,7 @@ fail:
1560 1560
1561/** 1561/**
1562 * gfs2_rlist_add - add a RG to a list of RGs 1562 * gfs2_rlist_add - add a RG to a list of RGs
1563 * @sdp: the filesystem 1563 * @ip: the inode
1564 * @rlist: the list of resource groups 1564 * @rlist: the list of resource groups
1565 * @block: the block 1565 * @block: the block
1566 * 1566 *
@@ -1570,9 +1570,10 @@ fail:
1570 * 1570 *
1571 */ 1571 */
1572 1572
1573void gfs2_rlist_add(struct gfs2_sbd *sdp, struct gfs2_rgrp_list *rlist, 1573void gfs2_rlist_add(struct gfs2_inode *ip, struct gfs2_rgrp_list *rlist,
1574 u64 block) 1574 u64 block)
1575{ 1575{
1576 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
1576 struct gfs2_rgrpd *rgd; 1577 struct gfs2_rgrpd *rgd;
1577 struct gfs2_rgrpd **tmp; 1578 struct gfs2_rgrpd **tmp;
1578 unsigned int new_space; 1579 unsigned int new_space;
@@ -1581,12 +1582,15 @@ void gfs2_rlist_add(struct gfs2_sbd *sdp, struct gfs2_rgrp_list *rlist,
1581 if (gfs2_assert_warn(sdp, !rlist->rl_ghs)) 1582 if (gfs2_assert_warn(sdp, !rlist->rl_ghs))
1582 return; 1583 return;
1583 1584
1584 rgd = gfs2_blk2rgrpd(sdp, block); 1585 if (ip->i_rgd && rgrp_contains_block(ip->i_rgd, block))
1586 rgd = ip->i_rgd;
1587 else
1588 rgd = gfs2_blk2rgrpd(sdp, block);
1585 if (!rgd) { 1589 if (!rgd) {
1586 if (gfs2_consist(sdp)) 1590 fs_err(sdp, "rlist_add: no rgrp for block %llu\n", (unsigned long long)block);
1587 fs_err(sdp, "block = %llu\n", (unsigned long long)block);
1588 return; 1591 return;
1589 } 1592 }
1593 ip->i_rgd = rgd;
1590 1594
1591 for (x = 0; x < rlist->rl_rgrps; x++) 1595 for (x = 0; x < rlist->rl_rgrps; x++)
1592 if (rlist->rl_rgd[x] == rgd) 1596 if (rlist->rl_rgd[x] == rgd)