mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
devices: update dm uuid cache naming
replace "dm uuid" with "dm devs" in case it begins caching more than dm uuids.
This commit is contained in:
parent
5f26c05bf2
commit
5551e4a1e9
@ -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 only_error_or_zero_target = 1;
|
||||||
int r = 0;
|
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 */
|
/* With cache we can avoid status calls for unusable UUIDs */
|
||||||
(dm_dev = dev_cache_get_dm_dev_by_devno(cmd, dev->dev)) &&
|
(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))
|
!_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;
|
const char *uuid;
|
||||||
int r = 0;
|
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)))) {
|
if ((dm_dev = dev_cache_get_dm_dev_by_devno(cmd, MKDEV(major, minor)))) {
|
||||||
dm_strncpy(uuid_buf, dm_dev->uuid, uuid_buf_size);
|
dm_strncpy(uuid_buf, dm_dev->uuid, uuid_buf_size);
|
||||||
return 1;
|
return 1;
|
||||||
@ -1085,7 +1085,7 @@ int dev_manager_info(struct cmd_context *cmd,
|
|||||||
|
|
||||||
dm_strncpy(old_style_dlid, dlid, sizeof(old_style_dlid));
|
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, dlid) &&
|
||||||
!dev_cache_get_dm_dev_by_uuid(cmd, old_style_dlid)) {
|
!dev_cache_get_dm_dev_by_uuid(cmd, old_style_dlid)) {
|
||||||
log_debug("Cached as inactive %s.", name);
|
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)))
|
if (!(dlid = build_dm_uuid(dm->track_pending_delete ? dm->cmd->pending_delete_mem : dm->mem, lv, layer)))
|
||||||
return_0;
|
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))) {
|
if (!(dm_dev = dev_cache_get_dm_dev_by_uuid(dm->cmd, dlid))) {
|
||||||
log_debug("Cached as not present %s.", name);
|
log_debug("Cached as not present %s.", name);
|
||||||
return 1;
|
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);
|
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
|
/* Drop any cache before DM table manipulation within locked section
|
||||||
* TODO: check if it makes sense to manage cache within lock */
|
* 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);
|
dtree = _create_partial_dtree(dm, lv, laopts->origin_only);
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ static struct {
|
|||||||
struct radix_tree *devices;
|
struct radix_tree *devices;
|
||||||
struct dm_regex *preferred_names_matcher;
|
struct dm_regex *preferred_names_matcher;
|
||||||
const char *dev_dir;
|
const char *dev_dir;
|
||||||
int use_dm_uuid_cache;
|
int use_dm_devs_cache;
|
||||||
|
|
||||||
size_t dev_dir_len;
|
size_t dev_dir_len;
|
||||||
int has_scanned;
|
int has_scanned;
|
||||||
@ -1327,14 +1327,14 @@ out:
|
|||||||
return r;
|
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) {
|
if (_cache.dm_devnos) {
|
||||||
radix_tree_destroy(_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);
|
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;
|
struct dm_active_device *dm_dev;
|
||||||
unsigned devs_features;
|
unsigned devs_features;
|
||||||
uint32_t d;
|
uint32_t d;
|
||||||
|
|
||||||
dev_cache_destroy_dm_uuids();
|
dev_cache_destroy_dm_devs();
|
||||||
|
|
||||||
if (!get_dm_active_devices(NULL, &_cache.dm_devs, &devs_features))
|
if (!get_dm_active_devices(NULL, &_cache.dm_devs, &devs_features))
|
||||||
return 1;
|
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_devnos, stdout);
|
||||||
//radix_tree_dump(_cache.dm_uuids, stdout);
|
//radix_tree_dump(_cache.dm_uuids, stdout);
|
||||||
|
|
||||||
_cache.use_dm_uuid_cache = 1;
|
_cache.use_dm_devs_cache = 1;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1523,7 +1523,7 @@ int dev_cache_exit(void)
|
|||||||
vt.num_open);
|
vt.num_open);
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_cache_destroy_dm_uuids();
|
dev_cache_destroy_dm_devs();
|
||||||
|
|
||||||
if (_cache.mem)
|
if (_cache.mem)
|
||||||
dm_pool_destroy(_cache.mem);
|
dm_pool_destroy(_cache.mem);
|
||||||
|
@ -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_vgid(const char *vgid);
|
||||||
struct dm_list *dev_cache_get_dev_list_for_lvid(const char *lvid);
|
struct dm_list *dev_cache_get_dev_list_for_lvid(const char *lvid);
|
||||||
|
|
||||||
int dev_cache_use_dm_uuid_cache(void);
|
int dev_cache_use_dm_devs_cache(void);
|
||||||
int dev_cache_update_dm_uuids(void);
|
int dev_cache_update_dm_devs(void);
|
||||||
void dev_cache_destroy_dm_uuids(void);
|
void dev_cache_destroy_dm_devs(void);
|
||||||
const struct dm_active_device *
|
const struct dm_active_device *
|
||||||
dev_cache_get_dm_dev_by_devno(struct cmd_context *cmd, dev_t devno);
|
dev_cache_get_dm_dev_by_devno(struct cmd_context *cmd, dev_t devno);
|
||||||
const struct dm_active_device *
|
const struct dm_active_device *
|
||||||
|
@ -1263,7 +1263,7 @@ int label_scan(struct cmd_context *cmd)
|
|||||||
* here, before processing the hints file, so that the dm uuid checks
|
* here, before processing the hints file, so that the dm uuid checks
|
||||||
* in hint processing can benefit from the dm uuid cache.)
|
* in hint processing can benefit from the dm uuid cache.)
|
||||||
*/
|
*/
|
||||||
if (!dev_cache_update_dm_uuids())
|
if (!dev_cache_update_dm_devs())
|
||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -330,7 +330,7 @@ int vg_write_lock_held(void)
|
|||||||
|
|
||||||
int sync_local_dev_names(struct cmd_context* cmd)
|
int sync_local_dev_names(struct cmd_context* cmd)
|
||||||
{
|
{
|
||||||
dev_cache_destroy_dm_uuids();
|
dev_cache_destroy_dm_devs();
|
||||||
memlock_unlock(cmd);
|
memlock_unlock(cmd);
|
||||||
fs_unlock();
|
fs_unlock();
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user