mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
lvinfo: allow to use lv_info with NULL info
When NULL info struct is passed in - function is usable as a quick query for lv_is_active_locally() - with a bonus we may query for layered device. So it could be seen as a more efficient lv_is_active_locally().
This commit is contained in:
parent
b29adbbc4d
commit
3b604e5c8e
@ -1,3 +1,7 @@
|
||||
Version 2.02.102
|
||||
======================================
|
||||
Extend lv_info() for more efficient lv_is_active_locally() check.
|
||||
|
||||
Version 2.02.101 - 20th September 2013
|
||||
======================================
|
||||
Fix 3-thread clvmd deadlock triggered by cleanup on EOF from client.
|
||||
|
@ -616,6 +616,7 @@ int target_present(struct cmd_context *cmd, const char *target_name,
|
||||
|
||||
/*
|
||||
* Returns 1 if info structure populated, else 0 on failure.
|
||||
* When lvinfo* is NULL, it returns 1 if the device is locally active, 0 otherwise.
|
||||
*/
|
||||
int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, int use_layer,
|
||||
struct lvinfo *info, int with_open_count, int with_read_ahead)
|
||||
@ -640,9 +641,12 @@ int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, int use_la
|
||||
if (!dev_manager_info(lv->vg->cmd->mem, lv,
|
||||
(use_layer) ? lv_layer(lv) : NULL,
|
||||
with_open_count, with_read_ahead,
|
||||
&dminfo, &info->read_ahead))
|
||||
&dminfo, (info) ? &info->read_ahead : NULL))
|
||||
return_0;
|
||||
|
||||
if (!info)
|
||||
return dminfo.exists;
|
||||
|
||||
info->exists = dminfo.exists;
|
||||
info->suspended = dminfo.suspended;
|
||||
info->open_count = dminfo.open_count;
|
||||
|
Loading…
Reference in New Issue
Block a user