Commit 03f8c41c authored by Andreas Gruenbacher's avatar Andreas Gruenbacher

gfs2: Stop messing with ip->i_rgd in the rlist code

In the resource group list code, keep the last resource group added in
the last position in the array.  Check against that instead of messing
with ip->i_rgd.
Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
parent ee9c7f9a
...@@ -2559,19 +2559,35 @@ void gfs2_rlist_add(struct gfs2_inode *ip, struct gfs2_rgrp_list *rlist, ...@@ -2559,19 +2559,35 @@ void gfs2_rlist_add(struct gfs2_inode *ip, struct gfs2_rgrp_list *rlist,
if (gfs2_assert_warn(sdp, !rlist->rl_ghs)) if (gfs2_assert_warn(sdp, !rlist->rl_ghs))
return; return;
if (ip->i_rgd && rgrp_contains_block(ip->i_rgd, block)) /*
rgd = ip->i_rgd; * The resource group last accessed is kept in the last position.
else */
if (rlist->rl_rgrps) {
rgd = rlist->rl_rgd[rlist->rl_rgrps - 1];
if (rgrp_contains_block(rgd, block))
return;
rgd = gfs2_blk2rgrpd(sdp, block, 1); rgd = gfs2_blk2rgrpd(sdp, block, 1);
} else {
rgd = ip->i_rgd;
if (!rgd || !rgrp_contains_block(rgd, block))
rgd = gfs2_blk2rgrpd(sdp, block, 1);
}
if (!rgd) { if (!rgd) {
fs_err(sdp, "rlist_add: no rgrp for block %llu\n", (unsigned long long)block); fs_err(sdp, "rlist_add: no rgrp for block %llu\n",
(unsigned long long)block);
return; return;
} }
ip->i_rgd = rgd; ip->i_rgd = rgd;
for (x = 0; x < rlist->rl_rgrps; x++) for (x = 0; x < rlist->rl_rgrps; x++) {
if (rlist->rl_rgd[x] == rgd) if (rlist->rl_rgd[x] == rgd) {
swap(rlist->rl_rgd[x],
rlist->rl_rgd[rlist->rl_rgrps - 1]);
return; return;
}
}
if (rlist->rl_rgrps == rlist->rl_space) { if (rlist->rl_rgrps == rlist->rl_space) {
new_space = rlist->rl_space + 10; new_space = rlist->rl_space + 10;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment