main - lvreduce: simplify _lvseg_get_stripes integrity check

David Teigland <[email protected]>
Newsgroups gmane.linux.lvm.devel
Message-ID <[email protected]>
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0591131a539fb668412fc38807686d2a89decd27
Commit:        0591131a539fb668412fc38807686d2a89decd27
Parent:        4cdb178968b44125c41dee6dd28997283c0afefa
Author:        David Teigland <[email protected]>
AuthorDate:    Thu May 25 12:09:41 2023 -0500
Committer:     David Teigland <[email protected]>
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;

--
lvm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/lvm-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.