All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: master - lvconvert: flip return value of _raid_split_image_conversion
Date: Tue,  8 Sep 2020 22:03:39 +0000 (GMT)	[thread overview]
Message-ID: <20200908220339.4D7CB386F038@sourceware.org> (raw)

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8d6f1f9768da5a66b8f5153d13c96f50f411155f
Commit:        8d6f1f9768da5a66b8f5153d13c96f50f411155f
Parent:        dddf63ebc397705dc04a548c7a80ad9cad5ce4c2
Author:        Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate:    Fri Sep 4 20:55:02 2020 +0200
Committer:     Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Tue Sep 8 21:23:03 2020 +0200

lvconvert: flip return value of _raid_split_image_conversion

Use '0' for error and '1' as success.
Also drop INTERNAL_ERROR from path - as this error
is ATM used for invalid devices.
(i.e. test lvconvert-raid1-split-trackchanges.sh)
---
 tools/lvconvert.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 0adc61e36..d420eb52f 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -1167,7 +1167,7 @@ static int _raid_split_image_conversion(struct logical_volume *lv)
 	if (lv_is_raid_with_tracking(lv)) {
 		log_error("Conversion of tracking raid1 LV %s is not supported.",
 			  display_lvname(lv));
-		return 1;
+		return 0;
 	}
 
 	if (lv_is_raid_image(lv) &&
@@ -1175,19 +1175,19 @@ static int _raid_split_image_conversion(struct logical_volume *lv)
 		(void) dm_strncpy(raidlv_name, lv->name, s - lv->name);
 
 		if (!(tmp_lv = find_lv(lv->vg, raidlv_name))) {
-			log_error(INTERNAL_ERROR "Failed to find RaidLV of RAID subvolume %s.",
+			log_error("Failed to find RaidLV of RAID subvolume %s.",
 				  display_lvname(lv));
-			return 1;
+			return 0;
 		}
 
 		if (lv_is_raid_with_tracking(tmp_lv)) {
 			log_error("Conversion of tracked raid1 subvolume %s is not supported.",
 				  display_lvname(lv));
-			return 1;
+			return 0;
 		}
 	}
 
-	return 0;
+	return 1;
 }
 
 /*
@@ -1205,8 +1205,8 @@ static int _lvconvert_mirrors(struct cmd_context *cmd,
 	uint32_t new_mimage_count = 0;
 	uint32_t new_log_count = 0;
 
-	if (_raid_split_image_conversion(lv))
-		return 0;
+	if (!_raid_split_image_conversion(lv))
+		return_0;
 
 	if ((lp->corelog || lp->mirrorlog) && *lp->type_str && strcmp(lp->type_str, SEG_TYPE_NAME_MIRROR)) {
 		log_error("--corelog and --mirrorlog are only compatible with mirror devices.");
@@ -1321,8 +1321,8 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
 	struct cmd_context *cmd = lv->vg->cmd;
 	struct lv_segment *seg = first_seg(lv);
 
-	if (_raid_split_image_conversion(lv))
-		return 0;
+	if (!_raid_split_image_conversion(lv))
+		return_0;
 
 	if (_linear_type_requested(lp->type_str)) {
 		if (arg_is_set(cmd, mirrors_ARG) && (arg_uint_value(cmd, mirrors_ARG, 0) != 0)) {
@@ -2725,8 +2725,8 @@ static int _lvconvert_to_thin_with_external(struct cmd_context *cmd,
 		.virtual_extents = lv->le_count,
 	};
 
-	if (_raid_split_image_conversion(lv))
-		return 0;
+	if (!_raid_split_image_conversion(lv))
+		return_0;
 
 	if (lv == thinpool_lv) {
 		log_error("Can't use same LV %s for thin pool and thin volume.",
@@ -3037,8 +3037,8 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
 	struct id lockd_meta_id;
 	const char *str_seg_type = to_cachepool ? SEG_TYPE_NAME_CACHE_POOL : SEG_TYPE_NAME_THIN_POOL;
 
-	if (_raid_split_image_conversion(lv))
-		return 0;
+	if (!_raid_split_image_conversion(lv))
+		return_0;
 
 	if (lv_is_thin_pool(lv) || lv_is_cache_pool(lv)) {
 		log_error(INTERNAL_ERROR "LV %s is already a pool.", display_lvname(lv));
@@ -4463,7 +4463,7 @@ int lvconvert_cachevol_attach_single(struct cmd_context *cmd,
 		log_verbose("Redirecting operation to data sub LV %s.", display_lvname(lv));
 	}
 
-	if (_raid_split_image_conversion(lv))
+	if (!_raid_split_image_conversion(lv))
 		goto_bad;
 
 	/* Attach the cache to the main LV. */
@@ -4580,7 +4580,7 @@ static int _lvconvert_cachepool_attach_single(struct cmd_context *cmd,
 		log_verbose("Redirecting operation to data sub LV %s.", display_lvname(lv));
 	}
 
-	if (_raid_split_image_conversion(lv))
+	if (!_raid_split_image_conversion(lv))
 		goto_out;
 
 	/* Attach the cache to the main LV. */



                 reply	other threads:[~2020-09-08 22:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200908220339.4D7CB386F038@sourceware.org \
    --to=zkabelac@sourceware.org \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.