Add ndctl check-namespace
Subsystems (3)
Vishal Verma
maintainerv4 cover Add ndctl check-namespace
Changes in v4:
- Change the bitmap code to the kernel's GPLv2 Routines instead of the LGPL ccan/bitmap.
- Upgrade a few messages from 'info' to 'err'
Changes in v3:
- Move the addition of ccan/bitmap to its own patch(es) (Dan)
- Drop the changelog update from the spec (Dan)
- Fix the [verse] section in the documentation text for check-namespace (Dan)
- Unify all namespace_disable paths to perform checking for a mounted filesystem (Dan)
- Change the logging to use util/log.h (Dan)
- Use BTT_START_OFFSET for the initial offset, and store it in bttc (Jeff, Dan)
- Fix a number of line > 80 chars (everything but strings) (Jeff)
- Fix short write error handling, add fsync (Jeff)
- Save system page size in bttc to avoid calling sysconf repeatedly (Jeff)
- In check_log_map(), loop through the entire log even in case of an error, and if there was a saved error, fail. (Jeff)
- btt-check.sh: in the post repair test, validate that the data read back is the same as what was written (Jeff)
- Stop playing games with pre-adding/subtracting the initial 4K offset (Jeff)
- btt_read_info doesn't need to use 'rc', return directly.
Changes in v2:
- Move checking functionality to a separate file (Dan, Jeff)
- Rename btt-structs.h to check.h (Dan)
- Don't provide a configure option for building the checker, always build it in. (Dan, Jeff)
- Fix the Documentation example to also include disable-namespace (Linda)
- Update the description text to note the namespace needs to be disabled before checking (Linda)
- Use util/size.h for sizes (Dan)
- Use --repair to do repairs instead of --dry-run to disable repairs (Dan)
- Fix btt_read_info short read error handling (Jeff)
- Simplify the map lookup/write routines (Jeff)
- Differentiate the use off BTT_PG_SIZE, sysconf(_SC_PAGESIZE), and SZ_4K (for the fixed start offset) in the different places they're used (Jeff)
- Add the missing msync when copying over info2 (Jeff)
- Add unit tests to test the checker (Jeff)
- Add a missing error case check in do_xaction_namespace for check
- Add a --force option that allows running on an active namespace (Jeff)
- Add a bitmap test for checking all internal blocks are referenced exactly once between the map and flog (Jeff)
- Remove unused #defines in check.h
- Add comments to explain what we do with raw_mode (Jeff)
- Add some sanity checking when parsing an arena's metadata (Jeff)
- Refactor some read-verify sequences into a helper that combines the two (Jeff)
- Additional bounds checking on the 'offset' in recover_first_sb attempt 3 (Jeff)
- Add a missing ACTION_DESTROY string in parse_namespace_options (Dan)
- Use uXX, and cpu_to_XX from ccan/endian (Dan)
- Move the fletcher64 Routing to util/ as it is shared by builtin-dimm.c (Dan)
- Open the raw block device only once with O_EXCL instead of every time on read/write/mmap (Dan)
- Add a new 'inform' routing in util/usage.c, and use it for some non-critical messages (Dan)
- Remove namespace_is_offline() from builtin-check.c. Instead, use util_namespace_active() from util/json.c
- Add a missing return value check after info block restoration in discover_arenas
Vishal Verma (6):
libndctl: add a ndctl_namespace_is_active helper
libndctl: add a ndctl_namespace_disable_safe() API
ndctl: move the fletcher64 routine to util/
util: add util/bitmap in preparation for the BTT checker
ndctl: add a BTT check utility
ndctl, test: Add a unit test for the BTT checker
Documentation/Makefile.am | 1 + Documentation/ndctl-check-namespace.txt | 64 +++ Documentation/ndctl.txt | 1 + Makefile.am | 4 +- builtin.h | 1 + contrib/ndctl | 3 + ndctl/Makefile.am | 1 + ndctl/builtin-check.c | 988 ++++++++++++++++++++++++++++++++ ndctl/builtin-dimm.c | 18 +- ndctl/builtin-list.c | 2 +- ndctl/builtin-xaction-namespace.c | 112 ++-- ndctl/check.h | 127 ++++ ndctl/lib/libndctl.c | 59 ++ ndctl/lib/libndctl.sym | 2 + ndctl/libndctl.h.in | 3 + ndctl/ndctl.c | 1 + test/Makefile.am | 5 +- test/btt-check.sh | 172 ++++++ util/bitmap.c | 115 ++++ util/bitmap.h | 32 ++ util/fletcher.c | 23 + util/fletcher.h | 8 + util/json.c | 17 +- util/json.h | 1 - util/util.h | 12 + 25 files changed, 1696 insertions(+), 76 deletions(-) create mode 100644 Documentation/ndctl-check-namespace.txt create mode 100644 ndctl/builtin-check.c create mode 100644 ndctl/check.h create mode 100755 test/btt-check.sh create mode 100644 util/bitmap.c create mode 100644 util/bitmap.h create mode 100644 util/fletcher.c create mode 100644 util/fletcher.h
Signature · 6 lines
2.9.3 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Vishal Verma
maintainerPATCH v4 1/6 libndctl: add a ndctl_namespace_is_active helper
The pattern of checking if a namespace is currently active was repeated in many places. Convert the scattered usage into a libndctl API. This gets rid of util_namespace_active from util/json.c which was an awkward place for this anyway.
--- ndctl/builtin-list.c | 2 +- ndctl/lib/libndctl.c | 15 +++++++++++++++ ndctl/lib/libndctl.sym | 1 + ndctl/libndctl.h.in | 2 ++ util/json.c | 17 +---------------- util/json.h | 1 - 6 files changed, 20 insertions(+), 18 deletions(-)
ndctl/builtin-list.c +1 -1
@@ -84,7 +84,7 @@ static struct json_object *list_namespaces(struct ndctl_region *region,if (param.mode &&mode_to_type (param.mode) != mode)continue ; -if (!list.idle && !util_namespace_active (ndns)) +if (!list.idle && !ndctl_namespace_is_active (ndns))continue ;if (!jnamespaces) {
ndctl/lib/libndctl.c +15 -0
@@ -3234,6 +3234,21 @@ static void region_refresh_children(struct ndctl_region *region)daxs_init (region); } +NDCTL_EXPORT bool ndctl_namespace_is_active(struct ndctl_namespace *ndns) +{ +struct ndctl_btt *btt =ndctl_namespace_get_btt (ndns); +struct ndctl_pfn *pfn =ndctl_namespace_get_pfn (ndns); +struct ndctl_dax *dax =ndctl_namespace_get_dax (ndns); + +if ((btt &&ndctl_btt_is_enabled (btt)) + || (pfn &&ndctl_pfn_is_enabled (pfn)) + || (dax &&ndctl_dax_is_enabled (dax)) + || (!btt && !pfn && !dax + &&ndctl_namespace_is_enabled (ndns))) +return true; +return false; +} +/* * Return 0 if enabled, < 0 if failed to enable, and > 0 if claimed by * another device and that device is enabled. In the > 0 case a
ndctl/lib/libndctl.sym +1 -0
@@ -172,6 +172,7 @@ global: ndctl_namespace_enable; ndctl_namespace_disable; ndctl_namespace_disable_invalidate; + ndctl_namespace_is_active; ndctl_namespace_is_valid; ndctl_namespace_is_configured; ndctl_namespace_delete;
ndctl/libndctl.h.in +2 -0
@@ -13,6 +13,7 @@ #ifndef _LIBNDCTL_H_ #define _LIBNDCTL_H_ +#include <stdbool.h> #include <stdarg.h> #include <unistd.h>
@@ -484,6 +485,7 @@ int ndctl_namespace_is_enabled(struct ndctl_namespace *ndns); int ndctl_namespace_enable(struct ndctl_namespace *ndns); int ndctl_namespace_disable(struct ndctl_namespace *ndns); int ndctl_namespace_disable_invalidate(struct ndctl_namespace *ndns); +bool ndctl_namespace_is_active(struct ndctl_namespace *ndns); int ndctl_namespace_is_valid(struct ndctl_namespace *ndns); int ndctl_namespace_is_configured(struct ndctl_namespace *ndns); int ndctl_namespace_delete(struct ndctl_namespace *ndns);
util/json.c +1 -16
@@ -86,21 +86,6 @@ struct json_object *util_dimm_to_json(struct ndctl_dimm *dimm)return NULL ; } -bool util_namespace_active (struct ndctl_namespace *ndns) -{ -struct ndctl_btt *btt =ndctl_namespace_get_btt (ndns); -struct ndctl_pfn *pfn =ndctl_namespace_get_pfn (ndns); -struct ndctl_dax *dax =ndctl_namespace_get_dax (ndns); - -if ((btt &&ndctl_btt_is_enabled (btt)) - || (pfn &&ndctl_pfn_is_enabled (pfn)) - || (dax &&ndctl_dax_is_enabled (dax)) - || (!btt && !pfn && !dax - &&ndctl_namespace_is_enabled (ndns))) -return true; -return false; -} -struct json_object *util_daxctl_dev_to_json (struct daxctl_dev *dev) {const char *devname =daxctl_dev_get_devname (dev);
@@ -334,7 +319,7 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,json_object_object_add (jndns,"blockdev" , jobj); } -if (!util_namespace_active (ndns)) { +if (!ndctl_namespace_is_active (ndns)) { jobj =json_object_new_string ("disabled" );if (!jobj) goto err;
util/json.h +0 -1
@@ -6,7 +6,6 @@struct json_object ;void util_display_json_array (FILE *f_out,struct json_object *jarray,int jflag); -bool util_namespace_active (struct ndctl_namespace *ndns);struct json_object *util_bus_to_json (struct ndctl_bus *bus);struct json_object *util_dimm_to_json (struct ndctl_dimm *dimm);struct json_object *util_mapping_to_json (struct ndctl_mapping *mapping);
Signature · 6 lines
2.9.3 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Vishal Verma
maintainerPATCH v4 2/6 libndctl: add a ndctl_namespace_disable_safe() API
In reply to Vishal VermaDisabling a namespace which has a filesystem mounted on it is unsafe as filesystems are not prepared for a block device to be yanked from under them. The destroy_namespace routine checked for an active mount by performing an O_EXCL open of the backing block device, but many other callers of ndctl_namespace_disable* could benefit from this checking.
Codify the mounted filesystem check in a new libndctl API - ndctl_namespace_disable_safe(), and use it for the destroy/disable namespace ndctl commands as well as the upcoming check-namespace command.
--- ndctl/builtin-xaction-namespace.c | 46 +++++++-------------------------------- ndctl/lib/libndctl.c | 44 +++++++++++++++++++++++++++++++++++++ ndctl/lib/libndctl.sym | 1 + ndctl/libndctl.h.in | 1 + 4 files changed, 54 insertions(+), 38 deletions(-)
ndctl/builtin-xaction-namespace.c +8 -38
@@ -731,10 +731,7 @@ static int namespace_destroy(struct ndctl_region *region,struct ndctl_pfn *pfn =ndctl_namespace_get_pfn (ndns);struct ndctl_dax *dax =ndctl_namespace_get_dax (ndns);struct ndctl_btt *btt =ndctl_namespace_get_btt (ndns); -const char *bdev =NULL ; -bool dax_active = false; -char path[50 ]; -int fd, rc; +int rc;if (ndctl_region_get_ro (region)) { error("%s: read-only, re-configuration disabled\n",
@@ -742,42 +739,15 @@ static int namespace_destroy(struct ndctl_region *region,return -ENXIO ; } -if (pfn &&ndctl_pfn_is_enabled (pfn)) - bdev =ndctl_pfn_get_block_device (pfn); -else if (dax &&ndctl_dax_is_enabled (dax)) - dax_active = true; -else if (btt &&ndctl_btt_is_enabled (btt)) - bdev =ndctl_btt_get_block_device (btt); -else if (ndctl_namespace_is_enabled (ndns)) - bdev =ndctl_namespace_get_block_device (ndns); - -if ((bdev || dax_active) && !force) { +if (ndctl_namespace_is_active (ndns) && !force) {error ("%s is active, specify --force for re-configuration\n" , devname);return -EBUSY ; - }else if (bdev) { -sprintf (path,"/dev/%s" , bdev); - fd =open (path,O_RDWR |O_EXCL ); -if (fd >=0 ) { -/* -* Got it, now block new mounts while we have it -* pinned. -*/ -ndctl_namespace_disable_invalidate (ndns); -close (fd); - }else { -/* -* Yes, TOCTOU hole, but if you're racing namespace -* creation you have other problems, and there's nothing -* stopping the !bdev case from racing to mount an fs or -* re-enabling the namepace. -*/ -error ("%s: %s failed exlusive open: %s\n" , - devname, bdev,strerror (errno)); -return -errno; - } - }else if (dax_active) -ndctl_namespace_disable_invalidate (ndns); + }else { + rc =ndctl_namespace_disable_safe (ndns); +if (rc) +return rc; + }if (pfn || btt || dax) { rc =zero_info_block (ndns);
@@ -869,7 +839,7 @@ static int do_xaction_namespace(const char *namespace,continue ;switch (action) {case ACTION_DISABLE : - rc =ndctl_namespace_disable_invalidate (ndns); + rc =ndctl_namespace_disable_safe (ndns);break ;case ACTION_ENABLE : rc =ndctl_namespace_enable (ndns);
ndctl/lib/libndctl.c +44 -0
50 lines not on this page · raw message
ndctl/lib/libndctl.sym +1 -0
@@ -172,6 +172,7 @@ global: ndctl_namespace_enable; ndctl_namespace_disable; ndctl_namespace_disable_invalidate; + ndctl_namespace_disable_safe; ndctl_namespace_is_active; ndctl_namespace_is_valid; ndctl_namespace_is_configured;
ndctl/libndctl.h.in +1 -0
@@ -485,6 +485,7 @@ int ndctl_namespace_is_enabled(struct ndctl_namespace *ndns); int ndctl_namespace_enable(struct ndctl_namespace *ndns); int ndctl_namespace_disable(struct ndctl_namespace *ndns); int ndctl_namespace_disable_invalidate(struct ndctl_namespace *ndns); +int ndctl_namespace_disable_safe(struct ndctl_namespace *ndns); bool ndctl_namespace_is_active(struct ndctl_namespace *ndns); int ndctl_namespace_is_valid(struct ndctl_namespace *ndns); int ndctl_namespace_is_configured(struct ndctl_namespace *ndns);
Signature · 6 lines
2.9.3 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Vishal Verma
maintainerPATCH v4 3/6 ndctl: move the fletcher64 routine to util/
In reply to Vishal VermaIn preparation for check-namespace, since it will also use the fletcher64 routine, move it to util/ so that it can be shared by both builtin-check.c and builtin-dimm.c
--- Makefile.am | 3 ++- ndctl/builtin-dimm.c | 18 ++---------------- util/fletcher.c | 23 +++++++++++++++++++++++ util/fletcher.h | 8 ++++++++ 4 files changed, 35 insertions(+), 17 deletions(-) create mode 100644 util/fletcher.c create mode 100644 util/fletcher.h
Makefile.am +2 -1
@@ -68,6 +68,7 @@ libutil_a_SOURCES = \ util/help.c \ util/strbuf.c \ util/wrapper.c \ - util/filter.c + util/filter.c \ + util/fletcher.c nobase_include_HEADERS = daxctl/libdaxctl.h
ndctl/builtin-dimm.c +2 -16
@@ -22,6 +22,7 @@#include <util/json.h> #include <util/filter.h> #include <json-c/json.h> +#include <util/fletcher.h> #include <ndctl/libndctl.h> #include <util/parse-options.h> #include <ccan/minmax/minmax.h>
@@ -358,7 +359,7 @@ struct nvdimm_data { };/* -* Note, best_seq(), inc_seq(), fletcher64(), sizeof_namespace_index() +* Note, best_seq(), inc_seq(), sizeof_namespace_index() * nvdimm_num_label_slots(), label_validate(), and label_write_index() * are copied from drivers/nvdimm/label.c in the Linux kernel with the * following modifications:
@@ -371,21 +372,6 @@ struct nvdimm_data {* 7/ dropped clear_bit_le() usage in label_write_index */ -static u64 fletcher64 (void *addr,size_t len,bool le) -{ -u32 *buf = addr; -u32 lo32 =0 ; -u64 hi32 =0 ; -size_t i; - -for (i =0 ; i < len /sizeof (u32); i++) { - lo32 += le ?le32_to_cpu ((le32 ) buf[i]) : buf[i]; - hi32 += lo32; - } - -return hi32 <<32 | lo32; -} -static unsigned inc_seq (unsigned seq) {static const unsigned next[] = {0 ,2 ,3 ,1 };
util/fletcher.c new file +23 -0
@@ -0,0 +1,23 @@ +#include <stdlib.h> +#include <stdbool.h> +#include <util/fletcher.h> +#include <ccan/endian/endian.h> +#include <ccan/short_types/short_types.h> + +/* +* Note, fletcher64() is copied from drivers/nvdimm/label.c in the Linux kernel +*/ +u64 fletcher64 (void *addr,size_t len,bool le) +{ +u32 *buf = addr; +u32 lo32 =0 ; +u64 hi32 =0 ; +size_t i; + +for (i =0 ; i < len /sizeof (u32); i++) { + lo32 += le ?le32_to_cpu ((le32 ) buf[i]) : buf[i]; + hi32 += lo32; + } + +return hi32 <<32 | lo32; +}
util/fletcher.h new file +8 -0
@@ -0,0 +1,8 @@ +#ifndef _NDCTL_FLETCHER_H_ +#define _NDCTL_FLETCHER_H_ + +#include <ccan/short_types/short_types.h> + +u64 fletcher64 (void *addr,size_t len,bool le); + +#endif /* _NDCTL_FLETCHER_H_ */
Signature · 6 lines
2.9.3 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Vishal Verma
maintainerPATCH v4 4/6 util: add util/bitmap in preparation for the BTT checker
In reply to Vishal VermaThe BTT checker will include a bitmap test where we mark a bit for each post-map and free block, and check if the bitmap is full. Add util/bitmap based on the kernels bitmap code to facilitate this.
--- Makefile.am | 3 +- util/bitmap.c | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ util/bitmap.h | 32 ++++++++++++++++ util/util.h | 11 ++++++ 4 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 util/bitmap.c create mode 100644 util/bitmap.h
Makefile.am +2 -1
@@ -69,6 +69,7 @@ libutil_a_SOURCES = \ util/strbuf.c \ util/wrapper.c \ util/filter.c \ - util/fletcher.c + util/fletcher.c\ + util/bitmap.c nobase_include_HEADERS = daxctl/libdaxctl.h
util/bitmap.c new file +115 -0
115 lines not on this page · raw message
util/bitmap.h new file +32 -0
@@ -0,0 +1,32 @@ +#ifndef _NDCTL_BITMAP_H_ +#define _NDCTL_BITMAP_H_ + +#include <util/size.h> +#include <ccan/short_types/short_types.h> + +#define DIV_ROUND_UP (n, d) (((n) + (d) - 1) / (d)) + +#define BIT (nr) (1UL << (nr)) +#define BIT_MASK (nr) (1UL << ((nr) % BITS_PER_LONG)) +#define BIT_WORD (nr) ((nr) / BITS_PER_LONG) +#define BITS_PER_BYTE 8 +#define BITS_TO_LONGS (nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) + +#define BITMAP_FIRST_WORD_MASK (start) (~0UL << ((start) & (BITS_PER_LONG - 1))) +#define BITMAP_LAST_WORD_MASK (nbits) (~0UL >> (-(nbits) & (BITS_PER_LONG - 1))) + +#define small_const_nbits (nbits) \ + (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG) + +unsigned long *bitmap_alloc (unsigned long nbits); +void bitmap_set (unsigned long *map,unsigned int start,int len); +void bitmap_clear (unsigned long *map,unsigned int start,int len); +int test_bit (unsigned int nr,const volatile unsigned long *addr); +unsigned long find_next_bit (const unsigned long *addr,unsigned long size, +unsigned long offset); +unsigned long find_next_zero_bit (const unsigned long *addr,unsigned long size, +unsigned long offset); +int bitmap_full (const unsigned long *src,unsigned int nbits); + + +#endif /* _NDCTL_BITMAP_H_ */
util/util.h +11 -0
@@ -23,6 +23,17 @@#define alloc_nr (x) (((x)+16)*3/2) +#define __round_mask (x, y) ((__typeof__(x))((y)-1)) +#define round_up (x, y) ((((x)-1) | __round_mask(x, y))+1) +#define round_down (x, y) ((x) & ~__round_mask(x, y)) + +#define rounddown (x, y) ( \ +{ \ + typeof(x) __x = (x); \ + __x - (__x % (y)); \ +} \ +) +/* * Realloc the buffer pointed at by variable 'x' so that it can hold * at least 'nr' entries; the number of entries currently allocated
Signature · 6 lines
2.9.3 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Vishal Verma
maintainerPATCH v4 5/6 ndctl: add a BTT check utility
In reply to Vishal VermaAdd the check-namespace command to ndctl. This will check the BTT metadata layout for the given namespace, and if requested, correct any errors found. Not all metadata corruption is detectable or fixable.
--- Documentation/Makefile.am | 1 + Documentation/ndctl-check-namespace.txt | 64 +++ Documentation/ndctl.txt | 1 + builtin.h | 1 + contrib/ndctl | 3 + ndctl/Makefile.am | 1 + ndctl/builtin-check.c | 988 ++++++++++++++++++++++++++++++++ ndctl/builtin-xaction-namespace.c | 66 ++- ndctl/check.h | 127 ++++ ndctl/ndctl.c | 1 + test/Makefile.am | 2 + util/util.h | 1 + 12 files changed, 1254 insertions(+), 2 deletions(-) create mode 100644 Documentation/ndctl-check-namespace.txt create mode 100644 ndctl/builtin-check.c create mode 100644 ndctl/check.h
Documentation/Makefile.am +1 -0
@@ -12,6 +12,7 @@ man1_MANS = \ ndctl-disable-namespace.1 \ ndctl-create-namespace.1 \ ndctl-destroy-namespace.1 \ + ndctl-check-namespace.1 \ ndctl-list.1 \ daxctl-list.1
Documentation/ndctl-check-namespace.txt new file +64 -0
64 lines not on this page · raw message
Documentation/ndctl.txt +1 -0
@@ -34,6 +34,7 @@ SEE ALSO -------- linkndctl:ndctl-create-namespace[1], linkndctl:ndctl-destroy-namespace[1], +linkndctl:ndctl-check-namespace[1], linkndctl:ndctl-enable-region[1], linkndctl:ndctl-disable-region[1], linkndctl:ndctl-enable-dimm[1],
builtin.h +1 -0
@@ -13,6 +13,7 @@ int cmd_enable_namespace(int argc, const char **argv, void *ctx);int cmd_create_namespace (int argc,const char **argv,void *ctx);int cmd_destroy_namespace (int argc,const char **argv,void *ctx);int cmd_disable_namespace (int argc,const char **argv,void *ctx); +int cmd_check_namespace (int argc,const char **argv,void *ctx);int cmd_enable_region (int argc,const char **argv,void *ctx);int cmd_disable_region (int argc,const char **argv,void *ctx);int cmd_enable_dimm (int argc,const char **argv,void *ctx);
contrib/ndctl +3 -0
@@ -194,6 +194,9 @@ __ndctl_comp_non_option_args() destroy-namespace) opts="$(__ndctl_get_ns) all" ;; + check-namespace) + opts="$(__ndctl_get_ns -i) all" + ;; enable-region) opts="$(__ndctl_get_regions -i) all" ;;
ndctl/Makefile.am +1 -0
@@ -5,6 +5,7 @@ bin_PROGRAMS = ndctl ndctl_SOURCES = ndctl.c \ builtin-create-nfit.c \ builtin-xaction-namespace.c \ + builtin-check.c \ builtin-xable-region.c \ builtin-dimm.c \ ../util/log.c \
ndctl/builtin-check.c new file +988 -0
988 lines not on this page · raw message
ndctl/builtin-xaction-namespace.c +64 -2
116 lines not on this page · raw message
ndctl/check.h new file +127 -0
127 lines not on this page · raw message
ndctl/ndctl.c +1 -0
@@ -57,6 +57,7 @@ static struct cmd_struct commands[] = { { "disable-namespace", cmd_disable_namespace }, { "create-namespace", cmd_create_namespace }, { "destroy-namespace", cmd_destroy_namespace }, + { "check-namespace", cmd_check_namespace }, { "enable-region", cmd_enable_region }, { "disable-region", cmd_disable_region }, { "enable-dimm", cmd_enable_dimm },
test/Makefile.am +2 -0
@@ -84,6 +84,7 @@ device_dax_SOURCES = \ dax-pmd.c \ $(testcore) \ ../ndctl/builtin-xaction-namespace.c \ + ../ndctl/builtin-check.c \ ../util/json.c device_dax_LDADD = \ $(LIBNDCTL_LIB) \
@@ -95,6 +96,7 @@ multi_pmem_SOURCES = \ multi-pmem.c \ $(testcore) \ ../ndctl/builtin-xaction-namespace.c \ + ../ndctl/builtin-check.c \ ../util/json.c multi_pmem_LDADD = \ $(LIBNDCTL_LIB) \
util/util.h +1 -0
@@ -55,6 +55,7 @@#define zfree (ptr) ({ free(*ptr); *ptr = NULL; })#define BUILD_BUG_ON_ZERO (e) (sizeof(struct { int:-!!(e); })) +#define BUILD_BUG_ON (condition) ((void)sizeof(char[1 - 2*!!(condition)]))static inline const char *skip_prefix (const char *str,const char *prefix) {
Signature · 6 lines
2.9.3 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Vishal Verma
maintainerPATCH v4 6/6 ndctl, test: Add a unit test for the BTT checker
In reply to Vishal VermaAdd a new unit test that will set up BTTs, corrupt them in known ways, and test that the checker is able to detect or repair the corruption in the expected way.
--- test/Makefile.am | 3 +- test/btt-check.sh | 172 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 174 insertions(+), 1 deletion(-) create mode 100755 test/btt-check.sh
test/Makefile.am +2 -1
@@ -9,7 +9,8 @@ TESTS =\ create.sh \ clear.sh \ dax-errors.sh \ - daxdev-errors.sh + daxdev-errors.sh \ + btt-check.sh check_PROGRAMS =\ libndctl \
test/btt-check.sh new file +172 -0
172 lines not on this page · raw message
Signature · 6 lines
2.9.3 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Quoted 4 lines · Vishal Verma
Changes in v4:
- Change the bitmap code to the kernel's GPLv2 Routines instead of the LGPL ccan/bitmap.
- Upgrade a few messages from 'info' to 'err'
Thanks Vishal! Applied and pushed out to 'pending'.
https://github.com/pmem/ndctl/tree/pending
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm