summaryrefslogtreecommitdiff
path: root/lib/cache/lvmcache.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/cache/lvmcache.c')
-rw-r--r--lib/cache/lvmcache.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index 0934b2068..16152e24a 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -88,6 +88,46 @@ static int _vg_global_lock_held = 0; /* Global lock held when cache wiped? */
static int _found_duplicate_pvs = 0; /* If we never see a duplicate PV we can skip checking for them later. */
static int _suppress_lock_ordering = 0;
+static int _importing_clones = 0;
+static DM_LIST_INIT(_import_clone_devs);
+
+int lvmcache_add_import_clone_dev(struct cmd_context *cmd, struct device *dev)
+{
+ struct device_list *devl;
+
+ if (!(devl = dm_pool_alloc(cmd->mem, sizeof(*devl)))) {
+ log_error("device_list element allocation failed");
+ return 0;
+ }
+ devl->dev = dev;
+
+ dm_list_add(&_import_clone_devs, &devl->list);
+ _importing_clones = 1;
+ return 1;
+}
+
+int lvmcache_is_import_clone_dev(struct device *dev)
+{
+ struct device_list *devl;
+
+ dm_list_iterate_items(devl, &_import_clone_devs) {
+ if (devl->dev == dev)
+ return 1;
+ }
+ return 0;
+}
+
+void lvmcache_clear_import_clone_devs(void)
+{
+ dm_list_init(&_import_clone_devs);
+ _importing_clones = 0;
+}
+
+int lvmcache_importing_clones(void)
+{
+ return _importing_clones;
+}
+
int lvmcache_init(void)
{
/*