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

heming.zhao at suse.com heming.zhao at suse.com
Sat Sep 5 09:17:11 UTC 2020



On 9/5/20 5:06 PM, Zhao Heming wrote:
> report LV is usable for upper layer.
> 
> Signed-off-by: Zhao Heming <heming.zhao at suse.com>
> ---
>   lib/activate/activate.h          |   2 +
>   lib/activate/dev_manager.c       |  67 ++++++++++++++++
>   lib/metadata/metadata-exported.h |   1 +
>   lib/metadata/metadata.c          | 130 +++++++++++++++++++++++++++++++
>   lib/report/columns.h             |   1 +
>   lib/report/properties.c          |   2 +
>   lib/report/report.c              |  13 ++++
>   lib/report/values.h              |   1 +
>   8 files changed, 217 insertions(+)
> 

There are some places need to improve.

1. in lib/activate/dev_manager.c, function lv_mapping_table() & dm_has_lvdev() almost same.
   it may merge into one function.

2. LV device-mapper name need to improve, 

  in lib/metadata/metadata.c  _lv_is_usable()
  I use below ugly code to construct dm name

  ```
  /* format is right: "vgname" + '-' + "lvname" ?? */
  snprintf(lvname, 50, "%s-%s", lv->vg->name, seg_lv(seg, s)->name);
  ... ...
  /* format is right: "vgname" + '-' + "lvname" ?? */
  snprintf(lvname, 50, "%s-%s", lv->vg->name, lv->name);
  ```


Thanks




More information about the linux-lvm mailing list