libblockdev/create_cache_pool_first.patch
Vratislav Podzimek 40b9ebd08c New version
- Create the cache pool before the to-be-cached LV (vpodzime)
2015-11-25 09:23:22 +01:00

47 lines
1.6 KiB
Diff

From 546d495b13553f9d20be0b421e1cc4a9087b4b08 Mon Sep 17 00:00:00 2001
From: Vratislav Podzimek <vpodzime@redhat.com>
Date: Tue, 24 Nov 2015 13:03:43 +0100
Subject: [PATCH] Create the cache pool before the to-be-cached LV
Cache pool typically has harder restrictions for PV space (where it should be
allocated) than the LV.
Signed-off-by: Vratislav Podzimek <vpodzime@redhat.com>
---
src/plugins/lvm.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/plugins/lvm.c b/src/plugins/lvm.c
index 30818c6..ead0d68 100644
--- a/src/plugins/lvm.c
+++ b/src/plugins/lvm.c
@@ -1736,12 +1736,6 @@ gboolean bd_lvm_cache_create_cached_lv (gchar *vg_name, gchar *lv_name, guint64
gboolean success = FALSE;
gchar *name = NULL;
- success = bd_lvm_lvcreate (vg_name, lv_name, data_size, NULL, slow_pvs, error);
- if (!success) {
- g_prefix_error (error, "Failed to create the data LV: ");
- return FALSE;
- }
-
name = g_strdup_printf ("%s_cache", lv_name);
success = bd_lvm_cache_create_pool (vg_name, name, cache_size, md_size, mode, flags, fast_pvs, error);
if (!success) {
@@ -1750,6 +1744,12 @@ gboolean bd_lvm_cache_create_cached_lv (gchar *vg_name, gchar *lv_name, guint64
return FALSE;
}
+ success = bd_lvm_lvcreate (vg_name, lv_name, data_size, NULL, slow_pvs, error);
+ if (!success) {
+ g_prefix_error (error, "Failed to create the data LV: ");
+ return FALSE;
+ }
+
success = bd_lvm_cache_attach (vg_name, lv_name, name, error);
if (!success) {
g_prefix_error (error, "Failed to attach the cache pool '%s' to the data LV: ", name);
--
2.5.0