mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
nvme: implement ->get_unique_id
Implement the get_unique_id method to allow pNFS SCSI layout access to NVMe namespaces. This is the server side implementation of RFC 9561 "Using the Parallel NFS (pNFS) SCSI Layout to Access Non-Volatile Memory Express (NVMe) Storage Devices". Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Chuck Lever <chuck.lever@oracle.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Keith Busch <kbusch@kernel.org>
This commit is contained in:
committed by
Keith Busch
parent
f227345f0a
commit
18f03a063d
@@ -488,6 +488,21 @@ static void nvme_ns_head_release(struct gendisk *disk)
|
||||
nvme_put_ns_head(disk->private_data);
|
||||
}
|
||||
|
||||
static int nvme_ns_head_get_unique_id(struct gendisk *disk, u8 id[16],
|
||||
enum blk_unique_id type)
|
||||
{
|
||||
struct nvme_ns_head *head = disk->private_data;
|
||||
struct nvme_ns *ns;
|
||||
int srcu_idx, ret = -EWOULDBLOCK;
|
||||
|
||||
srcu_idx = srcu_read_lock(&head->srcu);
|
||||
ns = nvme_find_path(head);
|
||||
if (ns)
|
||||
ret = nvme_ns_get_unique_id(ns, id, type);
|
||||
srcu_read_unlock(&head->srcu, srcu_idx);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BLK_DEV_ZONED
|
||||
static int nvme_ns_head_report_zones(struct gendisk *disk, sector_t sector,
|
||||
unsigned int nr_zones, report_zones_cb cb, void *data)
|
||||
@@ -515,6 +530,7 @@ const struct block_device_operations nvme_ns_head_ops = {
|
||||
.ioctl = nvme_ns_head_ioctl,
|
||||
.compat_ioctl = blkdev_compat_ptr_ioctl,
|
||||
.getgeo = nvme_getgeo,
|
||||
.get_unique_id = nvme_ns_head_get_unique_id,
|
||||
.report_zones = nvme_ns_head_report_zones,
|
||||
.pr_ops = &nvme_pr_ops,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user