Skip to contentSkip to conversation

master - filters: add "usable device" filter

PATCH Peter Rajnoha 1 participant 1 message Sep 30, 2014 Library code

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8a843d0d97c66aae1872c05b0f6cf4bda176aae2
Commit:        8a843d0d97c66aae1872c05b0f6cf4bda176aae2
Parent:        00d8ab84923af87191110b1cb77b13a483659ef1
Author:        Peter Rajnoha <[email protected]>
AuthorDate:    Tue Sep 23 12:49:01 2014 +0200
Committer:     Peter Rajnoha <[email protected]>
CommitterDate: Tue Sep 30 13:11:58 2014 +0200

filters: add "usable device" filter

Usable device filter is responsible for filtering out unusable DM devices. The filter has 3 modes of operation:

- FILTER_MODE_NO_LVMETAD:
When this mode is used, we check DM device usability by looking:
- whether device is empty
- whether device is blocked
- whether device is suspended (only on devices/ignore_suspended_devices=1)
- whether device uses an error target
- whether device name/uuid is reserved

- FILTER_MODE_PRE_LVMETAD:
When this mode is used, we check DM device usability by looking:
- whether device is empty
- whether device is suspended (only on devices/ignore_suspended_devices=1)
- whether device uses an error target
- whether device name/uuid is reserved

- FILTER_MODE_POST_LVMETAD:
When this mode is used, we check DM device usability by looking:
- whether device is blocked
- whether device is suspended (only on devices/ignore_suspended_devices=1)

These modes will be used by subsequent patch to create different instances of this filter, depending on lvmetad use.

---
 lib/Makefile.in             |    1 +
 lib/filters/filter-usable.c |   89 +++++++++++++++++++++++++++++++++++++++++++
 lib/filters/filter.h        |    7 +++
 3 files changed, 97 insertions(+), 0 deletions(-)
lib/Makefile.in +1 -0
index 9f101f3..bad5d8c 100644
@@ -72,6 +72,7 @@ SOURCES =\
 	filters/filter-mpath.c \
 	filters/filter-partitioned.c \
 	filters/filter-type.c \
+	filters/filter-usable.c \
 	format_text/archive.c \
 	format_text/archiver.c \
 	format_text/export.c \
lib/filters/filter-usable.c new file +89 -0

89 lines not on this page · raw message

lib/filters/filter.h +7 -0
index 219d3f7..0519439 100644
@@ -40,6 +40,13 @@ struct dev_filter *sysfs_filter_create(void);
 
 struct dev_filter *regex_filter_create(const struct dm_config_value *patterns);
 
+typedef enum {
+	FILTER_MODE_NO_LVMETAD,
+	FILTER_MODE_PRE_LVMETAD,
+	FILTER_MODE_POST_LVMETAD
+} filter_mode_t;
+struct dev_filter *usable_filter_create(struct dev_types *dt, filter_mode_t mode);
+
 int persistent_filter_load(struct dev_filter *f, struct dm_config_tree **cft_out);
 
 #endif 	/* _LVM_FILTER_H */