Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=529ac229d44... Commit: 529ac229d44cfac4046e4b45ebd8b3f801252fd6 Parent: 31fcba75fa1fa6651bc7e633f0fc655cd6ba16d6 Author: Andrew Price anprice@redhat.com AuthorDate: Thu Apr 3 06:30:07 2014 -0500 Committer: Andrew Price anprice@redhat.com CommitterDate: Thu Apr 3 06:30:07 2014 -0500
libgfs2: Stick to the (rgrp) plan in lgfs2_rindex_entry_new
lgfs2_rindex_entry_new() was ignoring the plan any time len was not 0, even if len matched the next rgrp length in the plan. This was causing problems in mkfs when the journal-adjusted rgrp size was the same as the normal rgrp size. Decrement the count of the appropriate rgrp size if the length matches.
Signed-off-by: Andrew Price anprice@redhat.com --- gfs2/libgfs2/rgrp.c | 21 ++++++++++++--------- 1 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/gfs2/libgfs2/rgrp.c b/gfs2/libgfs2/rgrp.c index d70dfc5..901a7bf 100644 --- a/gfs2/libgfs2/rgrp.c +++ b/gfs2/libgfs2/rgrp.c @@ -433,21 +433,24 @@ void lgfs2_rgrps_free(lgfs2_rgrps_t *rgs) */ uint64_t lgfs2_rindex_entry_new(lgfs2_rgrps_t rgs, struct gfs2_rindex *ri, uint64_t addr, uint32_t len) { + int plan = -1; errno = EINVAL; if (!ri) return 0;
errno = ENOSPC; - if (len == 0) { - if (rgs->plan[0].num > 0) { - len = rgs->plan[0].len; - rgs->plan[0].num--; - } else if (rgs->plan[1].num > 0) { - len = rgs->plan[1].len; - rgs->plan[1].num--; - } else - return 0; + if (rgs->plan[0].num > 0) + plan = 0; + else if (rgs->plan[1].num > 0) + plan = 1; + else + return 0; + + if (plan >= 0 && (len == 0 || len == rgs->plan[plan].len)) { + len = rgs->plan[plan].len; + rgs->plan[plan].num--; } + if (addr + len > rgs->devlen) return 0;