1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

lvmdiskscan: Remove unnecessary read.

dev_get_size will open the device itself.
This commit is contained in:
Alasdair G Kergon 2017-11-16 19:13:03 +00:00
parent 93c02e2532
commit efb0e7ac6f
2 changed files with 2 additions and 14 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.177 -
====================================
Remove unnecessary single read from lvmdiskscan.
Avoid using precommitted metadata for suspending pvmove tree.
Ehnance pvmove locking.
Deactivate activated LVs on error path when pvmove activation fails.

View File

@ -69,28 +69,15 @@ static void _print(struct cmd_context *cmd, const struct device *dev,
static int _check_device(struct cmd_context *cmd, struct device *dev)
{
char buffer;
uint64_t size;
if (!dev_open_readonly(dev))
return_0;
if (!dev_read(dev, UINT64_C(0), (size_t) 1, &buffer)) {
stack;
if (!dev_close(dev))
stack;
return 0;
}
if (!dev_get_size(dev, &size)) {
log_error("Couldn't get size of \"%s\"", dev_name(dev));
size = 0;
}
_print(cmd, dev, size, NULL);
_count(dev, &disks_found, &parts_found);
if (!dev_close(dev)) {
log_error("dev_close on \"%s\" failed", dev_name(dev));
return 0;
}
return 1;
}