main - filters: better message for excluding LV
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e9d10f371199055e9ed0c2715b5353491cb759b0 Commit: e9d10f371199055e9ed0c2715b5353491cb759b0 Parent: d0b0c20077affbd9671f89c7eab685ee3315e8d8 Author: David Teigland <[email protected]> AuthorDate: Wed Mar 3 12:07:57 2021 -0600 Committer: David Teigland <[email protected]> CommitterDate: Wed Mar 3 12:07:57 2021 -0600
filters: better message for excluding LV
Make the generic "device is not usable" message from filter-usable more specific in case the device is not usable because it's an LV. (i.e. when scan_lvs=0)
--- lib/activate/activate.c | 2 +- lib/activate/activate.h | 2 +- lib/activate/dev_manager.c | 6 ++++-- lib/cache/lvmcache.c | 2 ++ lib/filters/filter-usable.c | 8 ++++++-- lib/filters/filter.h | 1 + 6 files changed, 15 insertions(+), 6 deletions(-)
lib/activate/activate.c +1 -1
@@ -392,7 +392,7 @@ int add_areas_line(struct dev_manager *dm, struct lv_segment *seg, {return 0 ; } -int device_is_usable (struct device *dev,struct dev_usable_check_params check) +int device_is_usable (struct device *dev,struct dev_usable_check_params check,int *is_lv) {return 0 ; }
lib/activate/activate.h +1 -1
@@ -253,7 +253,7 @@ struct dev_usable_check_params {* Returns 1 if mapped device is not suspended, blocked or * is using a reserved name. */ -int device_is_usable (struct device *dev,struct dev_usable_check_params check); +int device_is_usable (struct device *dev,struct dev_usable_check_params check,int *is_lv);/* * Declaration moved here from fs.h to keep header fs.h hidden
lib/activate/dev_manager.c +4 -2
@@ -405,7 +405,7 @@ static int _ignore_blocked_mirror_devices(struct device *dev, .check_blocked = 1, .check_suspended = ignore_suspended_devices(), .check_error_target = 1, - .check_reserved = 0 })) + .check_reserved = 0 }, NULL)) goto out;/* safe to use */ stack; }
@@ -620,7 +620,7 @@ static int _ignore_frozen_raid(struct device *dev, const char *params)* * Returns: 1 if usable, 0 otherwise */ -int device_is_usable (struct device *dev,struct dev_usable_check_params check) +int device_is_usable (struct device *dev,struct dev_usable_check_params check,int *is_lv) {struct dm_task *dmt;struct dm_info info;
@@ -675,6 +675,8 @@ int device_is_usable(struct device *dev, struct dev_usable_check_params check)if (check.check_lv && uuid && !strncmp (uuid,"LVM-" ,4 )) {/* Skip LVs */ +if (is_lv) + *is_lv =1 ; goto out; }
lib/cache/lvmcache.c +2 -0
@@ -2909,6 +2909,8 @@ const char *dev_filtered_reason(struct device *dev)return "device is not in devices file" ;if (dev->filtered_flags &DEV_FILTERED_DEVICES_LIST )return "device is not in devices list" ; +if (dev->filtered_flags &DEV_FILTERED_IS_LV ) +return "device is an LV" ;/* flag has not been added here */ if (dev->filtered_flags)
lib/filters/filter-usable.c +6 -2
@@ -111,6 +111,7 @@ static int _passes_usable_filter(struct cmd_context *cmd, struct dev_filter *f,filter_mode_t mode = data->mode;int skip_lvs = data->skip_lvs;struct dev_usable_check_params ucp = {0 }; +int is_lv =0 ;int r =1 ; dev->filtered_flags &= ~DEV_FILTERED_MINSIZE ;
@@ -145,8 +146,11 @@ static int _passes_usable_filter(struct cmd_context *cmd, struct dev_filter *f,break ; } -if (!(r =device_is_usable (dev, ucp))) { - dev->filtered_flags |=DEV_FILTERED_UNUSABLE ; +if (!(r =device_is_usable (dev, ucp, &is_lv))) { +if (is_lv) + dev->filtered_flags |=DEV_FILTERED_IS_LV ; +else + dev->filtered_flags |=DEV_FILTERED_UNUSABLE ;log_debug_devs ("%s: Skipping unusable device." ,dev_name (dev)); } }
lib/filters/filter.h +1 -0
@@ -66,5 +66,6 @@ struct dev_filter *usable_filter_create(struct cmd_context *cmd, struct dev_type#define DEV_FILTERED_UNUSABLE 0x00000400#define DEV_FILTERED_DEVICES_FILE 0x00000800#define DEV_FILTERED_DEVICES_LIST 0x00001000 +#define DEV_FILTERED_IS_LV 0x00002000#endif /* _LVM_FILTER_H */