summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2012-05-11 18:59:01 +0000
committerAlasdair Kergon <agk@redhat.com>2012-05-11 18:59:01 +0000
commitd2a3be546fa9713a11769ea2ac26493ba690e040 (patch)
tree167eddc8e224cfcf03d1435a3e324e1eb75e7c84
parent70cacce52e3f0ad3af574af9807e86f14a8bb9af (diff)
downloadlvm2-d2a3be546fa9713a11769ea2ac26493ba690e040.tar.gz
Append _TO_LVSEG to names of internal A_CONTIGUOUS and A_CLING flags.
Remove some unnecesary prev_lvseg checks.
-rw-r--r--WHATS_NEW1
-rw-r--r--lib/metadata/lv_manip.c26
2 files changed, 15 insertions, 12 deletions
diff --git a/WHATS_NEW b/WHATS_NEW
index 0cf2418a7..6ee8eef4a 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.96 -
================================
+ Append _TO_LVSEG to names of internal A_CONTIGUOUS and A_CLING flags.
Add missing pkg init --with-systemdsystemunitdir in configure.in (2.02.92).
Fix division by zero if PV with zero PE count is used during vgcfgrestore.
Add initial support for thin pool lvconvert.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 83eab4965..adc5e896e 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -39,10 +39,12 @@ typedef enum {
#define RAID_METADATA_AREA_LEN 1
/* FIXME These ended up getting used differently from first intended. Refactor. */
-#define A_CONTIGUOUS 0x01
-#define A_CLING 0x02
-#define A_CLING_BY_TAGS 0x04
-#define A_CLING_TO_ALLOCED 0x08 /* Only for ALLOC_NORMAL */
+/* Only one of A_CONTIGUOUS_TO_LVSEG, A_CLING_TO_LVSEG, A_CLING_TO_ALLOCED may be set */
+#define A_CONTIGUOUS_TO_LVSEG 0x01 /* Must be contiguous to an existing segment */
+#define A_CLING_TO_LVSEG 0x02 /* Must use same disks as existing LV segment */
+#define A_CLING_TO_ALLOCED 0x04 /* Must use same disks as already-allocated segment */
+
+#define A_CLING_BY_TAGS 0x08 /* Must match tags against existing segment */
#define A_CAN_SPLIT 0x10
/*
@@ -907,11 +909,11 @@ static void _init_alloc_parms(struct alloc_handle *ah, struct alloc_parms *alloc
/* Are there any preceding segments we must follow on from? */
if (alloc_parms->prev_lvseg) {
if (alloc_parms->alloc == ALLOC_CONTIGUOUS)
- alloc_parms->flags |= A_CONTIGUOUS;
+ alloc_parms->flags |= A_CONTIGUOUS_TO_LVSEG;
else if (alloc_parms->alloc == ALLOC_CLING)
- alloc_parms->flags |= A_CLING;
+ alloc_parms->flags |= A_CLING_TO_LVSEG;
else if (alloc_parms->alloc == ALLOC_CLING_BY_TAGS) {
- alloc_parms->flags |= A_CLING;
+ alloc_parms->flags |= A_CLING_TO_LVSEG;
alloc_parms->flags |= A_CLING_BY_TAGS;
}
}
@@ -1494,14 +1496,14 @@ static area_use_t _check_pva(struct alloc_handle *ah, struct pv_area *pva, uint3
return NEXT_AREA;
/* If maximise_cling is set, perform several checks, otherwise perform exactly one. */
- if (!iteration_count && !log_iteration_count && alloc_parms->flags & (A_CONTIGUOUS | A_CLING | A_CLING_TO_ALLOCED)) {
+ if (!iteration_count && !log_iteration_count && alloc_parms->flags & (A_CONTIGUOUS_TO_LVSEG | A_CLING_TO_LVSEG | A_CLING_TO_ALLOCED)) {
/* Contiguous? */
- if (((alloc_parms->flags & A_CONTIGUOUS) || ah->maximise_cling) &&
- alloc_parms->prev_lvseg && _check_contiguous(ah->cmd, alloc_parms->prev_lvseg, pva, alloc_state))
+ if (((alloc_parms->flags & A_CONTIGUOUS_TO_LVSEG) || (ah->maximise_cling && alloc_parms->prev_lvseg)) &&
+ _check_contiguous(ah->cmd, alloc_parms->prev_lvseg, pva, alloc_state))
return PREFERRED;
/* Try next area on same PV if looking for contiguous space */
- if (alloc_parms->flags & A_CONTIGUOUS)
+ if (alloc_parms->flags & A_CONTIGUOUS_TO_LVSEG)
return NEXT_AREA;
/* Cling_to_alloced? */
@@ -1667,7 +1669,7 @@ static int _find_some_parallel_space(struct alloc_handle *ah, const struct alloc
uint32_t devices_needed = ah->area_count + ah->parity_count;
/* ix_offset holds the number of parallel allocations that must be contiguous/cling */
- if (alloc_parms->flags & (A_CONTIGUOUS | A_CLING) && alloc_parms->prev_lvseg)
+ if (alloc_parms->flags & (A_CONTIGUOUS_TO_LVSEG | A_CLING_TO_LVSEG))
ix_offset = _stripes_per_mimage(alloc_parms->prev_lvseg) * alloc_parms->prev_lvseg->area_count;
if (alloc_parms->flags & A_CLING_TO_ALLOCED)