#include "lib/misc/lib.h"
#include "lib/device/dev-type.h"
#include "lib/device/device_id.h"
+#include "lib/label/label.h"
#include "lib/config/config.h"
#include "lib/commands/toolcontext.h"
#include "device_mapper/misc/dm-ioctl.h"
return 1;
}
+void dev_cache_dm_devs_label_invalidate(struct cmd_context *cmd)
+{
+ struct dm_active_device *dm_dev;
+ struct device *dev;
+
+ dm_list_iterate_items(dm_dev, _cache.dm_devs) {
+ if (dm_dev->uuid &&
+ strncmp(dm_dev->uuid, UUID_PREFIX, sizeof(UUID_PREFIX) - 1) == 0) {
+ if ((dev = dev_cache_get_by_devt(cmd, dm_dev->devno)))
+ label_scan_invalidate(dev);
+ }
+ }
+}
+
/* Find active DM device in devs array for given major:minor */
const struct dm_active_device *
dev_cache_get_dm_dev_by_devno(struct cmd_context *cmd, dev_t devno)
int dev_cache_use_dm_devs_cache(void);
int dev_cache_update_dm_devs(void);
void dev_cache_destroy_dm_devs(void);
+void dev_cache_dm_devs_label_invalidate(struct cmd_context *cmd);
const struct dm_active_device *
dev_cache_get_dm_dev_by_devno(struct cmd_context *cmd, dev_t devno);
const struct dm_active_device *
log_debug("Invalidating devs for any PVs on LVs.");
- dm_list_iterate_items(lvl, lvs)
- label_scan_invalidate_lv(cmd, lvl->lv);
+ if (dev_cache_use_dm_devs_cache())
+ dev_cache_dm_devs_label_invalidate(cmd);
+ else {
+ dm_list_iterate_items(lvl, lvs)
+ label_scan_invalidate_lv(cmd, lvl->lv);
+ }
}
/*