gfs2-utils: RHEL7 - libgfs2: Ignore an empty rgrp plan if a length is specified

Andrew Price andyp at fedoraproject.org
Mon Sep 8 17:34:24 UTC 2014


Gitweb:        http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=49b82ed70345c20df233fa3b0a2f7d7eeae9012d
Commit:        49b82ed70345c20df233fa3b0a2f7d7eeae9012d
Parent:        26805ae36207c447b84f10853300d49d93745f30
Author:        Andrew Price <anprice at redhat.com>
AuthorDate:    Thu Aug 21 15:36:58 2014 +0100
Committer:     Andrew Price <anprice at redhat.com>
CommitterDate: Fri Sep 5 14:57:46 2014 +0100

libgfs2: Ignore an empty rgrp plan if a length is specified

lgfs2_rindex_entry_new previously failed if the rgrp layout plan was
empty even if the caller specified an rgrp length.

Also tidy up a couple of function comments.

Signed-off-by: Andrew Price <anprice at redhat.com>
---
 gfs2/libgfs2/rgrp.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/gfs2/libgfs2/rgrp.c b/gfs2/libgfs2/rgrp.c
index 7063288..f780e00 100644
--- a/gfs2/libgfs2/rgrp.c
+++ b/gfs2/libgfs2/rgrp.c
@@ -428,7 +428,7 @@ uint64_t lgfs2_rindex_entry_new(lgfs2_rgrps_t rgs, struct gfs2_rindex *ri, uint6
 		plan = 0;
 	else if (rgs->plan[1].num > 0)
 		plan = 1;
-	else
+	else if (len == 0)
 		return 0;
 
 	if (plan >= 0 && (len == 0 || len == rgs->plan[plan].len)) {
@@ -450,7 +450,9 @@ uint64_t lgfs2_rindex_entry_new(lgfs2_rgrps_t rgs, struct gfs2_rindex *ri, uint6
 }
 
 /**
- * Return the rindex structure relating to a a resource group.
+ * Return the rindex structure relating to a resource group.
+ * The return type is const to advise callers that making changes to this
+ * structure directly isn't wise. libgfs2 functions should be used instead.
  */
 const struct gfs2_rindex *lgfs2_rgrp_index(lgfs2_rgrp_t rg)
 {
@@ -458,7 +460,9 @@ const struct gfs2_rindex *lgfs2_rgrp_index(lgfs2_rgrp_t rg)
 }
 
 /**
- * Return the rgrp structure relating to a a resource group.
+ * Return the rgrp structure relating to a resource group.
+ * The return type is const to advise callers that making changes to this
+ * structure directly isn't wise. libgfs2 functions should be used instead.
  */
 const struct gfs2_rgrp *lgfs2_rgrp_rgrp(lgfs2_rgrp_t rg)
 {


More information about the cluster-commits mailing list