Re: [PATCH 02/13] scsi: alua: Create a core ALUA driver
From: John Garry
Date: Mon Mar 23 2026 - 09:00:31 EST
On 18/03/2026 07:47, Hannes Reinecke wrote:
On 3/17/26 13:06, John Garry wrote:
Add a dedicated ALUA driver which can be used for native SCSI multipathIs this really a 'driver'? It's more additional functionality for a SCSI
and also DH-based ALUA support.
device, and not really a driver.
At least I _think_ it is ...
Actually it's more of a library than anything :)
+
+static struct workqueue_struct *kalua_wq;
+
+int scsi_alua_sdev_init(struct scsi_device *sdev)
+{
+ int rel_port, ret, tpgs;
+
+ tpgs = scsi_device_tpgs(sdev);
+ if (!tpgs)
+ return 0;
+
+ sdev->alua = kzalloc(sizeof(*sdev->alua), GFP_KERNEL);
+ if (!sdev->alua)
+ return -ENOMEM;
+
Why do you allocate a separate structure?
Is this structure shared with something?
Wouldn't it be better to just add some field to the scsi_device?
I could embed the structure in scsi_device, but it's just convenient to ever check sdev->alua to see if alua is supported and also know that the members are initialized and hold valid values.
Thanks,
John