mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
lvmdiskscan: Remove unnecessary read.
dev_get_size will open the device itself.
This commit is contained in:
parent
93c02e2532
commit
efb0e7ac6f
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.177 -
|
Version 2.02.177 -
|
||||||
====================================
|
====================================
|
||||||
|
Remove unnecessary single read from lvmdiskscan.
|
||||||
Avoid using precommitted metadata for suspending pvmove tree.
|
Avoid using precommitted metadata for suspending pvmove tree.
|
||||||
Ehnance pvmove locking.
|
Ehnance pvmove locking.
|
||||||
Deactivate activated LVs on error path when pvmove activation fails.
|
Deactivate activated LVs on error path when pvmove activation fails.
|
||||||
|
@ -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)
|
static int _check_device(struct cmd_context *cmd, struct device *dev)
|
||||||
{
|
{
|
||||||
char buffer;
|
|
||||||
uint64_t size;
|
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)) {
|
if (!dev_get_size(dev, &size)) {
|
||||||
log_error("Couldn't get size of \"%s\"", dev_name(dev));
|
log_error("Couldn't get size of \"%s\"", dev_name(dev));
|
||||||
size = 0;
|
size = 0;
|
||||||
}
|
}
|
||||||
_print(cmd, dev, size, NULL);
|
_print(cmd, dev, size, NULL);
|
||||||
_count(dev, &disks_found, &parts_found);
|
_count(dev, &disks_found, &parts_found);
|
||||||
if (!dev_close(dev)) {
|
|
||||||
log_error("dev_close on \"%s\" failed", dev_name(dev));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user