ENTRY("sanitize-log", "Retrive sanitize log, show it", sanitize_log)
ENTRY("reset", "Resets the controller", reset)
ENTRY("subsystem-reset", "Resets the controller", subsystem_reset)
+ ENTRY("ns-rescan", "Rescans the NVME namespaces", ns_rescan)
ENTRY("show-regs", "Shows the controller registers. Requires admin character device", show_registers)
ENTRY("discover", "Discover NVMeoF subsystems", discover_cmd)
ENTRY("connect-all", "Discover and Connect to NVMeoF subsystems", connect_all_cmd)
return ioctl(fd, NVME_IOCTL_RESET);
}
+int nvme_ns_rescan(int fd)
+{
+ int ret;
+
+ ret = nvme_verify_chr(fd);
+ if (ret)
+ return ret;
+ return ioctl(fd, NVME_IOCTL_RESCAN);
+}
+
int nvme_get_nsid(int fd)
{
static struct stat nvme_stat;
int nvme_subsystem_reset(int fd);
int nvme_reset_controller(int fd);
+int nvme_ns_rescan(int fd);
int nvme_dir_send(int fd, __u32 nsid, __u16 dspec, __u8 dtype, __u8 doper,
__u32 data_len, __u32 dw12, void *data, __u32 *result);
return err;
}
+static int ns_rescan(int argc, char **argv, struct command *cmd, struct plugin *plugin)
+{
+ const char *desc = "Rescans the NVMe namespaces\n";
+ int err, fd;
+
+ const struct argconfig_commandline_options command_line_options[] = {
+ {NULL}
+ };
+
+ fd = parse_and_open(argc, argv, desc, command_line_options, NULL, 0);
+ if (fd < 0)
+ return fd;
+
+ err = nvme_ns_rescan(fd);
+ if (err < 0) {
+ perror("Namespace Rescan");
+ return errno;
+ }
+ return err;
+}
+
static int sanitize(int argc, char **argv, struct command *cmd, struct plugin *plugin)
{
char *desc = "Send a sanitize command.";