Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: nvme-fc: Add new routine nvme_fc_io_getuuid()

Add nvme_fc_io_getuuid() to the nvme-fc transport. The routine is invoked
by the FC LLDD on a per-I/O request basis. The routine translates from the
FC-specific request structure to the bio and the cgroup structure in order
to obtain the FC appid stored in the cgroup structure. If a value is not
set or a bio is not found, a NULL appid (aka uuid) will be returned to the
LLDD.

Link: https://lore.kernel.org/r/20220519123110.17361-2-jsmart2021@gmail.com
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Muneendra Kumar <muneendra.kumar@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Muneendra Kumar and committed by
Martin K. Petersen
827fc630 325d5c5f

+32
+18
drivers/nvme/host/fc.c
··· 1899 1899 nvme_fc_error_recovery(ctrl, "transport detected io error"); 1900 1900 } 1901 1901 1902 + /* 1903 + * nvme_fc_io_getuuid - Routine called to get the appid field 1904 + * associated with request by the lldd 1905 + * @req:IO request from nvme fc to driver 1906 + * Returns: UUID if there is an appid associated with VM or 1907 + * NULL if the user/libvirt has not set the appid to VM 1908 + */ 1909 + char *nvme_fc_io_getuuid(struct nvmefc_fcp_req *req) 1910 + { 1911 + struct nvme_fc_fcp_op *op = fcp_req_to_fcp_op(req); 1912 + struct request *rq = op->rq; 1913 + 1914 + if (!IS_ENABLED(CONFIG_BLK_CGROUP_FC_APPID) || !rq->bio) 1915 + return NULL; 1916 + return blkcg_get_fc_appid(rq->bio); 1917 + } 1918 + EXPORT_SYMBOL_GPL(nvme_fc_io_getuuid); 1919 + 1902 1920 static void 1903 1921 nvme_fc_fcpio_done(struct nvmefc_fcp_req *req) 1904 1922 {
+14
include/linux/nvme-fc-driver.h
··· 564 564 void *lsreqbuf, u32 lsreqbuf_len); 565 565 566 566 567 + /* 568 + * Routine called to get the appid field associated with request by the lldd 569 + * 570 + * If the return value is NULL : the user/libvirt has not set the appid to VM 571 + * If the return value is non-zero: Returns the appid associated with VM 572 + * 573 + * @req: IO request from nvme fc to driver 574 + */ 575 + char *nvme_fc_io_getuuid(struct nvmefc_fcp_req *req); 567 576 568 577 /* 569 578 * *************** LLDD FC-NVME Target/Subsystem API *************** ··· 1057 1048 1058 1049 void nvmet_fc_rcv_fcp_abort(struct nvmet_fc_target_port *tgtport, 1059 1050 struct nvmefc_tgt_fcp_req *fcpreq); 1051 + /* 1052 + * add a define, visible to the compiler, that indicates support 1053 + * for feature. Allows for conditional compilation in LLDDs. 1054 + */ 1055 + #define NVME_FC_FEAT_UUID 0x0001 1060 1056 1061 1057 #endif /* _NVME_FC_DRIVER_H */