]> www.infradead.org Git - users/hch/nvme-cli.git/commitdiff
zns: getting zdes logic using exist function, data_len should be in bytes
authorSteven Seungcheol Lee <sc108.lee@samsung.com>
Fri, 26 Jun 2020 10:11:37 +0000 (19:11 +0900)
committerKeith Busch <kbusch@kernel.org>
Fri, 26 Jun 2020 15:27:48 +0000 (09:27 -0600)
Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
plugins/zns/zns.c

index 73e37a8775253fd2b4bdfe2e8f7b79846810828e..407e7f90293153c4380aba0d3dd3f7ad0aabddbc 100644 (file)
@@ -368,8 +368,6 @@ static int set_zone_desc(int argc, char **argv, struct command *cmd, struct plug
        const char *data = "optional file for zone extention data (default stdin)";
 
        int fd, ffd = STDIN_FILENO, err;
-       struct nvme_zns_id_ns ns;
-       struct nvme_id_ns id_ns;
        void *buf = NULL;
        __u32 data_len;
        uint8_t lbaf;
@@ -402,20 +400,7 @@ static int set_zone_desc(int argc, char **argv, struct command *cmd, struct plug
                }
        }
 
-       err = nvme_identify_ns(fd, cfg.namespace_id, false, &id_ns);
-       if (err) {
-               nvme_show_status(err);
-               goto close_fd;
-       }
-
-       err = nvme_zns_identify_ns(fd, cfg.namespace_id, &ns);
-       if (err) {
-               nvme_show_status(err);
-               goto close_fd;
-       }
-
-       lbaf = id_ns.flbas & NVME_NS_FLBAS_LBA_MASK;
-       data_len = ns.lbafe[lbaf].zdes;
+       data_len = get_zdes_bytes(fd, cfg.namespace_id);
 
        if (!data_len) {
                fprintf(stderr,