Skip to contentSkip to conversation

master - cleanup: use last_seg

PATCH Zdenek Kabelac 1 participant 1 message Jul 8, 2018

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6d1c983122bc2a17bbfbac234f9a73ee9c27f161
Commit:        6d1c983122bc2a17bbfbac234f9a73ee9c27f161
Parent:        a55d4b6051ed2edecf14549b8fef437023e1e272
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Sat Jul 7 21:35:07 2018 +0200
Committer:     Zdenek Kabelac <[email protected]>
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(-)
lib/metadata/lv_manip.c +2 -3
index b315a87..7674a3e 100644
@@ -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.
 	 */