diff mbox series

[RFC,01/11] nvmet: Remove duplicate uuid_copy

Message ID 20250313052222.178524-2-michael.christie@oracle.com (mailing list archive)
State New
Headers show
Series nvmet: Add NVMe target mdev/vfio driver | expand

Commit Message

Mike Christie March 13, 2025, 5:18 a.m. UTC
We do uuid_copy twice in nvmet_alloc_ctrl so this patch deletes one
of the calls.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
---
 drivers/nvme/target/core.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Christoph Hellwig March 13, 2025, 6:36 a.m. UTC | #1
On Thu, Mar 13, 2025 at 12:18:02AM -0500, Mike Christie wrote:
> We do uuid_copy twice in nvmet_alloc_ctrl so this patch deletes one
> of the calls.

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

Can you send this separately for inclusion?
Damien Le Moal March 13, 2025, 8:59 a.m. UTC | #2
On 3/13/25 14:18, Mike Christie wrote:
> We do uuid_copy twice in nvmet_alloc_ctrl so this patch deletes one
> of the calls.
> 
> Signed-off-by: Mike Christie <michael.christie@oracle.com>
> ---
>  drivers/nvme/target/core.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
> index 2e741696f371..f896d1fd3326 100644
> --- a/drivers/nvme/target/core.c
> +++ b/drivers/nvme/target/core.c
> @@ -1618,8 +1618,6 @@ struct nvmet_ctrl *nvmet_alloc_ctrl(struct nvmet_alloc_ctrl_args *args)
>  	}
>  	ctrl->cntlid = ret;
>  
> -	uuid_copy(&ctrl->hostid, args->hostid);

Good catch. But it is the other call that should be removed as that will also
remove the if (args->hostid) as that is not needed (the 2 call sites of
nvmet_alloc_ctrl() both set a hostid).

And maybe sned this patch as a real patch as I think it can go upstream now.

> -
>  	/*
>  	 * Discovery controllers may use some arbitrary high value
>  	 * in order to cleanup stale discovery sessions
Keith Busch March 13, 2025, 5:20 p.m. UTC | #3
On Thu, Mar 13, 2025 at 12:18:02AM -0500, Mike Christie wrote:
> We do uuid_copy twice in nvmet_alloc_ctrl so this patch deletes one
> of the calls.

Thanks, applied patch 1 to nvme-6.15.
diff mbox series

Patch

diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index 2e741696f371..f896d1fd3326 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -1618,8 +1618,6 @@  struct nvmet_ctrl *nvmet_alloc_ctrl(struct nvmet_alloc_ctrl_args *args)
 	}
 	ctrl->cntlid = ret;
 
-	uuid_copy(&ctrl->hostid, args->hostid);
-
 	/*
 	 * Discovery controllers may use some arbitrary high value
 	 * in order to cleanup stale discovery sessions