mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
devices: simpler bcache invalidation of PVs on LVs
When a PV is stacked on an LV, the PV needs to be dropped from bcache before the LV is processed. The LV can be found in dev-cache using its name rather than the devno.
This commit is contained in:
parent
b8869e2d4e
commit
200b05cec0
@ -1366,17 +1366,13 @@ int dev_cache_update_dm_uuids(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* _cache.dm_devs entries are referenced by radix trees */
|
||||
|
||||
/* TODO: if _cache.dm_devs list is small, then skip the
|
||||
overhead of radix trees and just do list searches on dm_devs */
|
||||
|
||||
if (!(_cache.dm_devnos = radix_tree_create(NULL, NULL)) ||
|
||||
!(_cache.dm_uuids = radix_tree_create(NULL, NULL))) {
|
||||
return_0; // FIXME
|
||||
}
|
||||
|
||||
/* Insert every active DM device into radix trees */
|
||||
/* _cache.dm_devs entries are referenced by radix trees */
|
||||
dm_list_iterate_items(dm_dev, _cache.dm_devs) {
|
||||
d = _shuffle_devno(dm_dev->devno);
|
||||
|
||||
|
@ -1642,19 +1642,10 @@ void label_scan_invalidate(struct device *dev)
|
||||
|
||||
void label_scan_invalidate_lv(struct cmd_context *cmd, struct logical_volume *lv)
|
||||
{
|
||||
struct lvinfo lvinfo;
|
||||
struct device *dev;
|
||||
dev_t devt;
|
||||
|
||||
/* FIXME: use dev_cache_get_existing() with the lv name,
|
||||
which allow us to skip the getting devno from lv_info. */
|
||||
|
||||
if (lv_info(cmd, lv, 0, &lvinfo, 0, 0) && lvinfo.exists) {
|
||||
/* FIXME: Still unclear what is it supposed to find */
|
||||
devt = MKDEV(lvinfo.major, lvinfo.minor);
|
||||
if ((dev = dev_cache_get_by_devt(cmd, devt)))
|
||||
if ((dev = dev_cache_get_existing(cmd, display_lvname(lv), NULL)))
|
||||
label_scan_invalidate(dev);
|
||||
}
|
||||
}
|
||||
|
||||
void label_scan_invalidate_lvs(struct cmd_context *cmd, struct dm_list *lvs)
|
||||
|
Loading…
Reference in New Issue
Block a user