mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-04 09:18:36 +03:00
label: code deduplication
This commit is contained in:
parent
6d344b4ac0
commit
7b08133844
@ -1060,10 +1060,7 @@ int label_scan(struct cmd_context *cmd)
|
|||||||
* label_scan should not generally be called a second time,
|
* label_scan should not generally be called a second time,
|
||||||
* so this will usually not be true.
|
* so this will usually not be true.
|
||||||
*/
|
*/
|
||||||
if (_in_bcache(dev)) {
|
label_scan_invalidate(dev);
|
||||||
_invalidate_fd(scan_bcache, dev->bcache_fd);
|
|
||||||
_scan_dev_close(dev);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
dev_iter_destroy(iter);
|
dev_iter_destroy(iter);
|
||||||
|
|
||||||
@ -1232,12 +1229,8 @@ int label_scan_devs(struct cmd_context *cmd, struct dev_filter *f, struct dm_lis
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
dm_list_iterate_items(devl, devs) {
|
dm_list_iterate_items(devl, devs)
|
||||||
if (_in_bcache(devl->dev)) {
|
label_scan_invalidate(devl->dev);
|
||||||
_invalidate_fd(scan_bcache, devl->dev->bcache_fd);
|
|
||||||
_scan_dev_close(devl->dev);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_scan_list(cmd, f, devs, NULL);
|
_scan_list(cmd, f, devs, NULL);
|
||||||
|
|
||||||
@ -1260,10 +1253,7 @@ int label_scan_devs_rw(struct cmd_context *cmd, struct dev_filter *f, struct dm_
|
|||||||
}
|
}
|
||||||
|
|
||||||
dm_list_iterate_items(devl, devs) {
|
dm_list_iterate_items(devl, devs) {
|
||||||
if (_in_bcache(devl->dev)) {
|
label_scan_invalidate(devl->dev);
|
||||||
_invalidate_fd(scan_bcache, devl->dev->bcache_fd);
|
|
||||||
_scan_dev_close(devl->dev);
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* With this flag set, _scan_dev_open() done by
|
* With this flag set, _scan_dev_open() done by
|
||||||
* _scan_list() will do open RW
|
* _scan_list() will do open RW
|
||||||
@ -1282,10 +1272,7 @@ int label_scan_devs_excl(struct dm_list *devs)
|
|||||||
int failed = 0;
|
int failed = 0;
|
||||||
|
|
||||||
dm_list_iterate_items(devl, devs) {
|
dm_list_iterate_items(devl, devs) {
|
||||||
if (_in_bcache(devl->dev)) {
|
label_scan_invalidate(devl->dev);
|
||||||
_invalidate_fd(scan_bcache, devl->dev->bcache_fd);
|
|
||||||
_scan_dev_close(devl->dev);
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* With this flag set, _scan_dev_open() done by
|
* With this flag set, _scan_dev_open() done by
|
||||||
* _scan_list() will do open EXCL
|
* _scan_list() will do open EXCL
|
||||||
@ -1384,10 +1371,7 @@ int label_read(struct device *dev)
|
|||||||
dm_list_init(&one_dev);
|
dm_list_init(&one_dev);
|
||||||
dm_list_add(&one_dev, &devl->list);
|
dm_list_add(&one_dev, &devl->list);
|
||||||
|
|
||||||
if (_in_bcache(dev)) {
|
label_scan_invalidate(dev);
|
||||||
_invalidate_fd(scan_bcache, dev->bcache_fd);
|
|
||||||
_scan_dev_close(dev);
|
|
||||||
}
|
|
||||||
|
|
||||||
_scan_list(NULL, NULL, &one_dev, &failed);
|
_scan_list(NULL, NULL, &one_dev, &failed);
|
||||||
|
|
||||||
@ -1665,4 +1649,3 @@ void dev_unset_last_byte(struct device *dev)
|
|||||||
{
|
{
|
||||||
bcache_unset_last_byte(scan_bcache, dev->bcache_fd);
|
bcache_unset_last_byte(scan_bcache, dev->bcache_fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user