nvme: add cuse support for BLKSSZGET IOCTL

Nvme-cli uses BLKSSZGET so support needs to be added for
nvme cuse devices.

Signed-off-by: Curt Bruns <curt.e.bruns@gmail.com>
Change-Id: Ic8316713b2d017c8ff32a225efff6bcb95842799
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7708
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Curt Bruns 2021-04-30 14:00:59 -04:00 committed by Tomasz Zawadzki
parent 0ba168fe39
commit 4c19332b0c

View File

@ -535,6 +535,22 @@ cuse_blkgetsize(fuse_req_t req, int cmd, void *arg,
fuse_reply_ioctl(req, 0, &size, sizeof(size));
}
static void
cuse_blkgetsectorsize(fuse_req_t req, int cmd, void *arg,
struct fuse_file_info *fi, unsigned flags,
const void *in_buf, size_t in_bufsz, size_t out_bufsz)
{
int ssize;
struct spdk_nvme_ns *ns;
struct cuse_device *cuse_device = fuse_req_userdata(req);
FUSE_REPLY_CHECK_BUFFER(req, arg, out_bufsz, ssize);
ns = spdk_nvme_ctrlr_get_ns(cuse_device->ctrlr, cuse_device->nsid);
ssize = spdk_nvme_ns_get_sector_size(ns);
fuse_reply_ioctl(req, 0, &ssize, sizeof(ssize));
}
static void
cuse_getid(fuse_req_t req, int cmd, void *arg,
struct fuse_file_info *fi, unsigned flags,
@ -603,6 +619,11 @@ cuse_ns_ioctl(fuse_req_t req, int cmd, void *arg,
cuse_blkpbszget(req, cmd, arg, fi, flags, in_buf, in_bufsz, out_bufsz);
break;
case BLKSSZGET:
SPDK_DEBUGLOG(nvme_cuse, "BLKSSZGET\n");
cuse_blkgetsectorsize(req, cmd, arg, fi, flags, in_buf, in_bufsz, out_bufsz);
break;
case BLKGETSIZE:
SPDK_DEBUGLOG(nvme_cuse, "BLKGETSIZE\n");
/* Returns the device size as a number of 512-byte blocks (returns pointer to long) */