diff mbox

[v2,22/30] scsi: aacraid: Merge adapter setup with resolve luns

Message ID 20171227043451.27813-23-RaghavaAditya.Renukunta@microsemi.com (mailing list archive)
State Accepted
Headers show

Commit Message

Raghava Aditya Renukunta Dec. 27, 2017, 4:34 a.m. UTC
The device hotplug events are processed only after retrieving the updated
lun information from the fw. Does not make sense to keep them separate.

Merge both the hotplug handling and safw adapter setup code into single
function.

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>

---
Changes in V2:
None

 drivers/scsi/aacraid/commsup.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

Comments

Nikola Pajkovsky Jan. 3, 2018, 10:02 a.m. UTC | #1
Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com> writes:

> The device hotplug events are processed only after retrieving the updated
> lun information from the fw. Does not make sense to keep them separate.
>
> Merge both the hotplug handling and safw adapter setup code into single
> function.
>
> Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>

According to subsequent commit

  [PATCH v2 23/30] scsi: aacraid: Block concurrent hotplug event handling

this commit is racy, because 23/30 adds ->scan_mutex. Shouldn't be these
commits squashed?

--
Nikola
Raghava Aditya Renukunta Jan. 3, 2018, 5 p.m. UTC | #2
Hi Nikola,

> -----Original Message-----
> From: Nikola Pajkovsky [mailto:npajkovsky@suse.cz]
> Sent: Wednesday, January 3, 2018 2:02 AM
> To: Raghava Aditya Renukunta
> <RaghavaAditya.Renukunta@microsemi.com>
> Cc: jejb@linux.vnet.ibm.com; martin.petersen@oracle.com; linux-
> scsi@vger.kernel.org; Scott Benesh <scott.benesh@microsemi.com>; Tom
> White <tom.white@microsemi.com>; dl-esc-Aacraid Linux Driver
> <aacraid@microsemi.com>; Guilherme G . Piccoli
> <gpiccoli@linux.vnet.ibm.com>; Bart Van Assche
> <Bart.VanAssche@wdc.com>
> Subject: Re: [PATCH v2 22/30] scsi: aacraid: Merge adapter setup with resolve
> luns
> 
> EXTERNAL EMAIL
> 
> 
> Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
> writes:
> 
> > The device hotplug events are processed only after retrieving the updated
> > lun information from the fw. Does not make sense to keep them separate.
> >
> > Merge both the hotplug handling and safw adapter setup code into single
> > function.
> >
> > Signed-off-by: Raghava Aditya Renukunta
> <RaghavaAditya.Renukunta@microsemi.com>
> 
> According to subsequent commit
> 
>   [PATCH v2 23/30] scsi: aacraid: Block concurrent hotplug event handling
> 
> this commit is racy, because 23/30 adds ->scan_mutex. Shouldn't be these
> commits squashed?

I tried to make the patches as logically distinct as possible, maybe I got a bit too ambitious and I expected the patches to go thru as a set so I don’t think it would make any difference. What do you think? 

Thanks
Raghava Aditya

> --
> Nikola
Nikola Pajkovsky Jan. 4, 2018, 12:36 p.m. UTC | #3
Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com> writes:

> Hi Nikola,
>
>> -----Original Message-----
>> From: Nikola Pajkovsky [mailto:npajkovsky@suse.cz]
>> Sent: Wednesday, January 3, 2018 2:02 AM
>> To: Raghava Aditya Renukunta
>> <RaghavaAditya.Renukunta@microsemi.com>
>> Cc: jejb@linux.vnet.ibm.com; martin.petersen@oracle.com; linux-
>> scsi@vger.kernel.org; Scott Benesh <scott.benesh@microsemi.com>; Tom
>> White <tom.white@microsemi.com>; dl-esc-Aacraid Linux Driver
>> <aacraid@microsemi.com>; Guilherme G . Piccoli
>> <gpiccoli@linux.vnet.ibm.com>; Bart Van Assche
>> <Bart.VanAssche@wdc.com>
>> Subject: Re: [PATCH v2 22/30] scsi: aacraid: Merge adapter setup with resolve
>> luns
>> 
>> EXTERNAL EMAIL
>> 
>> 
>> Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
>> writes:
>> 
>> > The device hotplug events are processed only after retrieving the updated
>> > lun information from the fw. Does not make sense to keep them separate.
>> >
>> > Merge both the hotplug handling and safw adapter setup code into single
>> > function.
>> >
>> > Signed-off-by: Raghava Aditya Renukunta
>> <RaghavaAditya.Renukunta@microsemi.com>
>> 
>> According to subsequent commit
>> 
>>   [PATCH v2 23/30] scsi: aacraid: Block concurrent hotplug event handling
>> 
>> this commit is racy, because 23/30 adds ->scan_mutex. Shouldn't be these
>> commits squashed?
>
> I tried to make the patches as logically distinct as possible, maybe I
> got a bit too ambitious and I expected the patches to go thru as a set so
> I don’t think it would make any difference. What do you think?

It does make difference, when you start cherry-picking patches to
downstream kernel. However, I don't have strong opinion here, so it can
stay as is.
diff mbox

Patch

diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 5b7a4f5..34155b1 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -1934,11 +1934,18 @@  static int aac_is_safw_device_exposed(struct aac_dev *dev, int bus, int target)
 	return is_exposed;
 }
 
-static void aac_resolve_luns(struct aac_dev *dev)
+static int aac_update_safw_host_devices(struct aac_dev *dev, int rescan)
 {
 	int i;
-	int bus, target;
+	int bus;
+	int target;
 	int is_exposed = 0;
+	int rcode = 0;
+
+	rcode = aac_setup_safw_adapter(dev, rescan);
+	if (unlikely(rcode < 0)) {
+		goto out;
+	}
 
 	for (i = 0; i < AAC_BUS_TARGET_LOOP; i++) {
 
@@ -1953,6 +1960,8 @@  static void aac_resolve_luns(struct aac_dev *dev)
 								is_exposed)
 			aac_remove_safw_device(dev, bus, target);
 	}
+out:
+	return rcode;
 }
 
 /**
@@ -1988,9 +1997,7 @@  static void aac_handle_sa_aif(struct aac_dev *dev, struct fib *fibptr)
 	case SA_AIF_LDEV_CHANGE:
 	case SA_AIF_BPCFG_CHANGE:
 
-		aac_setup_safw_adapter(dev, AAC_RESCAN);
-
-		aac_resolve_luns(dev);
+		aac_update_safw_host_devices(dev, AAC_RESCAN);
 		break;
 
 	case SA_AIF_BPSTAT_CHANGE: