All of lore.kernel.org
 help / color / mirror / Atom feed
* master - cleanup: just switch error path
@ 2016-05-05 22:01 Zdenek Kabelac
  0 siblings, 0 replies; only message in thread
From: Zdenek Kabelac @ 2016-05-05 22:01 UTC (permalink / raw)
  To: lvm-devel

Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f6575ec824964ee2f830746e12b12a887c95e7f7
Commit:        f6575ec824964ee2f830746e12b12a887c95e7f7
Parent:        d1ecbfa52d3f35c8702ca50f30577daa8c324eb9
Author:        Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate:    Thu May 5 23:12:30 2016 +0200
Committer:     Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Thu May 5 23:52:06 2016 +0200

cleanup: just switch error path

Check for error case in if() like we normally do.
Let code continue on success.
---
 lib/metadata/lv_manip.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 45dd1f5..9bfef45 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -7771,16 +7771,16 @@ struct logical_volume *lv_create_single(struct volume_group *vg,
 			if (!(lv = _lv_create_an_lv(vg, lp, lp->pool_name)))
 				return_NULL;
 
-			if (lv_is_cache(lv)) {
-				/* Here it's been converted via lvcreate */
-				log_print_unless_silent("Logical volume %s is now cached.",
-							display_lvname(lv));
-				return lv;
+			if (!lv_is_cache(lv)) {
+				log_error(INTERNAL_ERROR "Logical volume is not cache %s.",
+					  display_lvname(lv));
+				return NULL;
 			}
 
-			log_error(INTERNAL_ERROR "Logical volume is not cache %s.",
-				  display_lvname(lv));
-			return NULL;
+			/* Convertion via lvcreate */
+			log_print_unless_silent("Logical volume %s is now cached.",
+						display_lvname(lv));
+			return lv;
 		} else {
 			log_error(INTERNAL_ERROR "Creation of pool for unsupported segment type %s.",
 				  lp->segtype->name);



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-05-05 22:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-05 22:01 master - cleanup: just switch error path Zdenek Kabelac

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.