[linux-lvm] [PATCH] lvs: add -o lv_usable

David Teigland teigland at redhat.com
Tue Sep 8 17:47:44 UTC 2020


On Tue, Sep 08, 2020 at 02:40:43PM +0800, heming.zhao wrote:
> Does it acceptable to add new status bit in lv->status?
> I ever sent it in previoud patch "[PATCH v2] lib/metadata: add new api lv_is_available()"
> The define as below (the 'NOT_AVAIL_LV' will change to 'NOT_USABLE_LV'):
> ```
> +#define NOT_AVAIL_LV	UINT64_C(0x0000000080000000)	/* LV - derived flag, not
> +							   written out in metadata*/
> 
> +#define lv_is_available(lv)	(((lv)->status & NOT_AVAIL_LV) ? 0 : 1)
> ```
> 
> some description about the new patch:
> - it will combine with two patches:
>   - [PATCH v2] lib/metadata: add new api lv_is_available()
>   - [PATCH] lvs: add -o lv_usable
> - the new patch will add new status bit NOT_USABLE_LV, and this bit will be
>   set in _lv_mark_if_partial_single().
> - The only output which related with new status bit: lvs -o lv_usable
> 
> if above is acceptable, I will send the v2 patch. if not, I will give up this 'lv_usable' patch.

That sounds better, the old patch was closer to what we need.  It can look
at the PVs listed for the LV in the metadata, and check if those PVs have
a device on the system (pv->dev is set) and are not flagged missing.
device mapper state would not be needed for that (lv_mapping_table
dm_has_lvdev functions are not needed.)

To report info about the active state of LVs is more complex and requires
different sort of code as Zdenek mentioned.

Dave




More information about the linux-lvm mailing list