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;
return err;
}
- *nsid = namespace_id;
+ data->nsid = namespace_id;
/*
* 16 or 64 as maximum number of supported LBA formats.
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",