All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Teigland <teigland@sourceware.org>
To: lvm-devel@redhat.com
Subject: main - lvreduce: simplify _lvseg_get_stripes integrity check
Date: Thu, 25 May 2023 17:11:36 +0000 (GMT)	[thread overview]
Message-ID: <20230525171136.C2F223858D32@sourceware.org> (raw)

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0591131a539fb668412fc38807686d2a89decd27
Commit:        0591131a539fb668412fc38807686d2a89decd27
Parent:        4cdb178968b44125c41dee6dd28997283c0afefa
Author:        David Teigland <teigland@redhat.com>
AuthorDate:    Thu May 25 12:09:41 2023 -0500
Committer:     David Teigland <teigland@redhat.com>
CommitterDate: Thu May 25 12:09:41 2023 -0500

lvreduce: simplify _lvseg_get_stripes integrity check

Simplify unnecessary loop to avoid coverity complaint.
---
 lib/metadata/lv_manip.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index fa3661739..a4593c969 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -5187,7 +5187,7 @@ int lv_extend_policy_calculate_percent(struct logical_volume *lv,
 
 static uint32_t _lvseg_get_stripes(struct lv_segment *seg, uint32_t *stripesize)
 {
-	uint32_t s, a;
+	uint32_t s;
 	struct lv_segment *seg_get, *seg_image, *seg_iorig;
 	struct logical_volume *lv_image, *lv_iorig;
 
@@ -5203,12 +5203,9 @@ static uint32_t _lvseg_get_stripes(struct lv_segment *seg, uint32_t *stripesize)
 
 			if (seg_is_integrity(seg_image)) {
 				/* Get stripe values from the iorig layer. */
-				for (a = 0; a < seg_image->area_count; a++) {
-					lv_iorig = seg_lv(seg_image, a);
-					seg_iorig = first_seg(lv_iorig);
-					seg_get = seg_iorig;
-					break;
-				}
+				lv_iorig = seg_lv(seg_image, 0);
+				seg_iorig = first_seg(lv_iorig);
+				seg_get = seg_iorig;
 			} else {
 				/* Get stripe values from the image layer. */
 				seg_get = seg_image;


                 reply	other threads:[~2023-05-25 17:11 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=20230525171136.C2F223858D32@sourceware.org \
    --to=teigland@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.