[lvm-devel] master - cleanup: use last_seg

Zdenek Kabelac zkabelac at sourceware.org
Sun Jul 8 22:26:18 UTC 2018


Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6d1c983122bc2a17bbfbac234f9a73ee9c27f161
Commit:        6d1c983122bc2a17bbfbac234f9a73ee9c27f161
Parent:        a55d4b6051ed2edecf14549b8fef437023e1e272
Author:        Zdenek Kabelac <zkabelac at redhat.com>
AuthorDate:    Sat Jul 7 21:35:07 2018 +0200
Committer:     Zdenek Kabelac <zkabelac at redhat.com>
CommitterDate: Mon Jul 9 00:23:35 2018 +0200

cleanup: use last_seg

More readable code.
---
 lib/metadata/lv_manip.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index b315a87..7674a3e 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -3149,9 +3149,8 @@ static int _allocate(struct alloc_handle *ah,
 	if (ah->alloc == ALLOC_CONTIGUOUS)
 		can_split = 0;
 
-	if (lv && !dm_list_empty(&lv->segments))
-		prev_lvseg = dm_list_item(dm_list_last(&lv->segments),
-				       struct lv_segment);
+	if (lv)
+		prev_lvseg = last_seg(lv);
 	/*
 	 * Build the sets of available areas on the pv's.
 	 */




More information about the lvm-devel mailing list