Skip to contentSkip to conversation

master - thin: check for overprovisioning

PATCH Zdenek Kabelac 1 participant 1 message Jul 3, 2015

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=622064f00fe41a02ab857ce02920a9e8818e610b
Commit:        622064f00fe41a02ab857ce02920a9e8818e610b
Parent:        9cee94372a7e45b6a40478ec17de1c142ed268d4
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Fri Jul 3 15:31:31 2015 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Fri Jul 3 16:13:14 2015 +0200

thin: check for overprovisioning

---
 WHATS_NEW                           |    1 +
 lib/metadata/lv_manip.c             |    5 ++
 lib/metadata/metadata.h             |    1 +
 lib/metadata/thin_manip.c           |   88 +++++++++++++++++++++++++++++++++++
 test/shell/thin-overprovisioning.sh |   71 ++++++++++++++++++++++++++++
 5 files changed, 166 insertions(+), 0 deletions(-)
WHATS_NEW +1 -0
index 6a33e6d..22fc42a 100644
@@ -1,5 +1,6 @@
 Version 2.02.124 -
 =================================
+  Report warning when pool is overprovisioned and not auto resized.
   Recognize free-form date/time values for lv_time field in selection criteria.
   Fix regression in select to match string fields if using synonyms (2.02.123).
   Fix regression when printing more lv names via display_lvname (2.02.122).
lib/metadata/lv_manip.c +5 -0
index 87888a7..d23dd62 100644
@@ -5167,6 +5167,8 @@ static struct logical_volume *_lvresize_volume(struct cmd_context *cmd,
 			      lp->extents - lv->le_count,
 			      pvh, alloc, lp->approx_alloc))
 		return_NULL;
+	else if (!pool_check_overprovisioning(lv))
+		return_NULL;
 
 	if (old_extents == lv->le_count)
 		log_print_unless_silent("Size of logical volume %s unchanged from %s (%" PRIu32 " extents).",
@@ -7293,6 +7295,9 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
 			return_NULL;
 	}
 
+	if (!pool_check_overprovisioning(lv))
+		return_NULL;
+
 	/* FIXME Log allocation and attachment should have happened inside lv_extend. */
 	if (lp->log_count &&
 	    !seg_is_raid(first_seg(lv)) && seg_is_mirrored(first_seg(lv))) {
lib/metadata/metadata.h +1 -0
index abf6072..1a5306b 100644
@@ -485,6 +485,7 @@ int lv_is_merging_thin_snapshot(const struct logical_volume *lv);
 int pool_has_message(const struct lv_segment *seg,
 		     const struct logical_volume *lv, uint32_t device_id);
 int pool_below_threshold(const struct lv_segment *pool_seg);
+int pool_check_overprovisioning(const struct logical_volume *lv);
 int create_pool(struct logical_volume *lv, const struct segment_type *segtype,
 		struct alloc_handle *ah, uint32_t stripes, uint32_t stripe_size);
 
lib/metadata/thin_manip.c +88 -0

94 lines not on this page · raw message

test/shell/thin-overprovisioning.sh new file +71 -0

71 lines not on this page · raw message