]> www.infradead.org Git - users/hch/nvme-cli.git/commitdiff
flush: Use device NSID if issuing through block device
authorKeith Busch <keith.busch@intel.com>
Mon, 5 Feb 2018 20:19:40 +0000 (13:19 -0700)
committerKeith Busch <keith.busch@intel.com>
Mon, 5 Feb 2018 20:19:40 +0000 (13:19 -0700)
Signed-off-by: Keith Busch <keith.busch@intel.com>
nvme.c

diff --git a/nvme.c b/nvme.c
index aa2b8ec9629024d06f7aa02ae29f80b8bf0687d3..35581fb26dce1e3a89533927383523534d3335b1 100644 (file)
--- a/nvme.c
+++ b/nvme.c
@@ -2941,6 +2941,8 @@ static int flush(int argc, char **argv, struct command *cmd, struct plugin *plug
        if (fd < 0)
                return fd;
 
+       if (S_ISBLK(nvme_stat.st_mode))
+               cfg.namespace_id = get_nsid(fd);
        err = nvme_flush(fd, cfg.namespace_id);
        if (err < 0)
                perror("flush");