]> sourceware.org Git - lvm2.git/commitdiff
devices: update dm uuid cache naming
authorDavid Teigland <teigland@redhat.com>
Mon, 1 Jul 2024 15:50:53 +0000 (10:50 -0500)
committerDavid Teigland <teigland@redhat.com>
Mon, 1 Jul 2024 15:59:16 +0000 (10:59 -0500)
replace "dm uuid" with "dm devs" in case it begins
caching more than dm uuids.

lib/activate/dev_manager.c
lib/device/dev-cache.c
lib/device/dev-cache.h
lib/label/label.c
lib/locking/locking.c

index 6651827e4b58e3b35a155900721f7161f57974c8..2fa4ce3163f2f0ba63551471328b96cb8d15ceeb 100644 (file)
@@ -766,7 +766,7 @@ int dm_device_is_usable(struct cmd_context *cmd, struct device *dev, struct dev_
        int only_error_or_zero_target = 1;
        int r = 0;
 
-       if (dev_cache_use_dm_uuid_cache() &&
+       if (dev_cache_use_dm_devs_cache() &&
            /* With cache we can avoid status calls for unusable UUIDs */
            (dm_dev = dev_cache_get_dm_dev_by_devno(cmd, dev->dev)) &&
            !_is_usable_uuid(dev, dm_dev->name, dm_dev->uuid, check.check_reserved, check.check_lv, is_lv))
@@ -897,7 +897,7 @@ int devno_dm_uuid(struct cmd_context *cmd, int major, int minor,
        const char *uuid;
        int r = 0;
 
-       if (dev_cache_use_dm_uuid_cache()) {
+       if (dev_cache_use_dm_devs_cache()) {
                if ((dm_dev = dev_cache_get_dm_dev_by_devno(cmd, MKDEV(major, minor)))) {
                        dm_strncpy(uuid_buf, dm_dev->uuid, uuid_buf_size);
                        return 1;
@@ -1085,7 +1085,7 @@ int dev_manager_info(struct cmd_context *cmd,
 
        dm_strncpy(old_style_dlid, dlid, sizeof(old_style_dlid));
 
-       if (dev_cache_use_dm_uuid_cache() &&
+       if (dev_cache_use_dm_devs_cache() &&
            !dev_cache_get_dm_dev_by_uuid(cmd, dlid) &&
            !dev_cache_get_dm_dev_by_uuid(cmd, old_style_dlid)) {
                log_debug("Cached as inactive %s.", name);
@@ -2459,7 +2459,7 @@ static int _add_dev_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
        if (!(dlid = build_dm_uuid(dm->track_pending_delete ? dm->cmd->pending_delete_mem : dm->mem, lv, layer)))
                return_0;
 
-       if (dev_cache_use_dm_uuid_cache()) {
+       if (dev_cache_use_dm_devs_cache()) {
                if (!(dm_dev = dev_cache_get_dm_dev_by_uuid(dm->cmd, dlid))) {
                        log_debug("Cached as not present %s.", name);
                        return 1;
@@ -2614,7 +2614,7 @@ static int _pool_callback(struct dm_tree_node *node,
                }
        }
 
-       dev_cache_destroy_dm_uuids();
+       dev_cache_destroy_dm_devs();
 
        log_debug("Running check command on %s", mpath);
 
@@ -3998,7 +3998,7 @@ static int _tree_action(struct dev_manager *dm, const struct logical_volume *lv,
 
        /* Drop any cache before DM table manipulation within locked section
         * TODO: check if it makes sense to manage cache within lock */
-       dev_cache_destroy_dm_uuids();
+       dev_cache_destroy_dm_devs();
 
        dtree = _create_partial_dtree(dm, lv, laopts->origin_only);
 
index 8dc27697bedab5bb02d34176ed4fe8ece437e623..c89280e1f86277734781802688b86d7160f315cf 100644 (file)
@@ -59,7 +59,7 @@ static struct {
        struct radix_tree *devices;
        struct dm_regex *preferred_names_matcher;
        const char *dev_dir;
-       int use_dm_uuid_cache;
+       int use_dm_devs_cache;
 
        size_t dev_dir_len;
        int has_scanned;
@@ -1327,14 +1327,14 @@ out:
        return r;
 }
 
-int dev_cache_use_dm_uuid_cache(void)
+int dev_cache_use_dm_devs_cache(void)
 {
-       return _cache.use_dm_uuid_cache;
+       return _cache.use_dm_devs_cache;
 }
 
-void dev_cache_destroy_dm_uuids(void)
+void dev_cache_destroy_dm_devs(void)
 {
-       _cache.use_dm_uuid_cache = 0;
+       _cache.use_dm_devs_cache = 0;
 
        if (_cache.dm_devnos) {
                radix_tree_destroy(_cache.dm_devnos);
@@ -1349,13 +1349,13 @@ void dev_cache_destroy_dm_uuids(void)
        dm_device_list_destroy(&_cache.dm_devs);
 }
 
-int dev_cache_update_dm_uuids(void)
+int dev_cache_update_dm_devs(void)
 {
        struct dm_active_device *dm_dev;
        unsigned devs_features;
        uint32_t d;
 
-       dev_cache_destroy_dm_uuids();
+       dev_cache_destroy_dm_devs();
 
        if (!get_dm_active_devices(NULL, &_cache.dm_devs, &devs_features))
                return 1;
@@ -1391,7 +1391,7 @@ int dev_cache_update_dm_uuids(void)
        //radix_tree_dump(_cache.dm_devnos, stdout);
        //radix_tree_dump(_cache.dm_uuids, stdout);
 
-       _cache.use_dm_uuid_cache = 1;
+       _cache.use_dm_devs_cache = 1;
        return 1;
 }
 
@@ -1523,7 +1523,7 @@ int dev_cache_exit(void)
                                  vt.num_open);
        }
 
-       dev_cache_destroy_dm_uuids();
+       dev_cache_destroy_dm_devs();
 
        if (_cache.mem)
                dm_pool_destroy(_cache.mem);
index 0f56ba702ee7a074bd8ac02b689a1a287dd692a5..a68ba757ef4edacb0afc020af608731cb17fe0f5 100644 (file)
@@ -37,9 +37,9 @@ struct dev_filter {
 struct dm_list *dev_cache_get_dev_list_for_vgid(const char *vgid);
 struct dm_list *dev_cache_get_dev_list_for_lvid(const char *lvid);
 
-int dev_cache_use_dm_uuid_cache(void);
-int dev_cache_update_dm_uuids(void);
-void dev_cache_destroy_dm_uuids(void);
+int dev_cache_use_dm_devs_cache(void);
+int dev_cache_update_dm_devs(void);
+void dev_cache_destroy_dm_devs(void);
 const struct dm_active_device *
 dev_cache_get_dm_dev_by_devno(struct cmd_context *cmd, dev_t devno);
 const struct dm_active_device *
index 6fda88dc7b8d208421c62e5e25a05978e33867cb..5e09eeff23cf84fb8b74ad5cf16de900435b0aec 100644 (file)
@@ -1263,7 +1263,7 @@ int label_scan(struct cmd_context *cmd)
         * here, before processing the hints file, so that the dm uuid checks
         * in hint processing can benefit from the dm uuid cache.)
         */
-       if (!dev_cache_update_dm_uuids())
+       if (!dev_cache_update_dm_devs())
                return_0;
 
        /*
index 3a38c4109ae9bcae8cb5add2e8d902f1a21ee00e..1b4f579b9cdcb99ee8e006a04d1b87c3eb7614a7 100644 (file)
@@ -330,7 +330,7 @@ int vg_write_lock_held(void)
 
 int sync_local_dev_names(struct cmd_context* cmd)
 {
-       dev_cache_destroy_dm_uuids();
+       dev_cache_destroy_dm_devs();
        memlock_unlock(cmd);
        fs_unlock();
        return 1;
This page took 0.04811 seconds and 5 git commands to generate.