engines:io_uring: update arguments to fetch nvme data
[fio.git] / engines / nvme.c
index b18ad4c28a054db6a4d6d93bc2904650fd3599b4..7e891eeda7e4d5ba134dfff5c4191b1e70e39fdd 100644 (file)
@@ -99,8 +99,7 @@ static int nvme_identify(int fd, __u32 nsid, enum nvme_identify_cns cns,
        return ioctl(fd, NVME_IOCTL_ADMIN_CMD, &cmd);
 }
 
-int fio_nvme_get_info(struct fio_file *f, __u32 *nsid, __u32 *lba_sz,
-                     __u32 *ms, __u64 *nlba)
+int fio_nvme_get_info(struct fio_file *f, __u64 *nlba, struct nvme_data *data)
 {
        struct nvme_id_ns ns;
        int namespace_id;
@@ -137,7 +136,7 @@ int fio_nvme_get_info(struct fio_file *f, __u32 *nsid, __u32 *lba_sz,
                return err;
        }
 
-       *nsid = namespace_id;
+       data->nsid = namespace_id;
 
        /*
         * 16 or 64 as maximum number of supported LBA formats.
@@ -149,21 +148,26 @@ int fio_nvme_get_info(struct fio_file *f, __u32 *nsid, __u32 *lba_sz,
        else
                format_idx = (ns.flbas & 0xf) + (((ns.flbas >> 5) & 0x3) << 4);
 
-       *lba_sz = 1 << ns.lbaf[format_idx].ds;
+       data->lba_size = 1 << ns.lbaf[format_idx].ds;
 
        /*
         * Only extended LBA can be supported.
         * Bit 4 for flbas indicates if metadata is transferred at the end of
         * logical block creating an extended LBA.
         */
-       *ms = le16_to_cpu(ns.lbaf[format_idx].ms);
-       if (*ms && !((ns.flbas >> 4) & 0x1)) {
+       data->ms = le16_to_cpu(ns.lbaf[format_idx].ms);
+       if (data->ms && !((ns.flbas >> 4) & 0x1)) {
                log_err("%s: only extended logical block can be supported\n",
                        f->file_name);
                err = -ENOTSUP;
                goto out;
        }
 
+       if (data->ms)
+               data->lba_ext = data->lba_size + data->ms;
+       else
+               data->lba_shift = ilog2(data->lba_size);
+
        /* Check for end to end data protection support */
        if (ns.dps & 0x3) {
                log_err("%s: end to end data protection not supported\n",