[Cluster-devel] [PATCH 12/14] libgfs2: Stick to the (rgrp) plan in lgfs2_rindex_entry_new
Andrew Price
anprice at redhat.com
Thu Apr 3 15:12:45 UTC 2014
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 at redhat.com>
---
gfs2/libgfs2/rgrp.c | 21 ++++++++++++---------
1 file 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;
--
1.8.5.3
More information about the Cluster-devel
mailing list