Re: [PATCH 08/29] scsi: aacraid: Move code to wait for IO completion to shutdown func

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2017-12-21 at 09:33 -0800, Raghava Aditya Renukunta wrote:
> +static void aac_wait_for_io_completion(struct aac_dev *aac)
> +{
> +	unsigned long flagv = 0;
> +	int i = 0;
> +
> +	for (i = 60; i; --i) {
> +		struct scsi_device *dev;
> +		struct scsi_cmnd *command;
> +		int active = 0;
> +
> +		__shost_for_each_device(dev, aac->scsi_host_ptr) {
> +			spin_lock_irqsave(&dev->list_lock, flagv);
> +			list_for_each_entry(command, &dev->cmd_list, list) {
> +				if (command->SCp.phase == AAC_OWNER_FIRMWARE) {
> +					active++;
> +					break;
> +				}
> +			}
> +			spin_unlock_irqrestore(&dev->list_lock, flagv);
> +			if (active)
> +				break;
> +
> +		}
> +		/*
> +		 * We can exit If all the commands are complete
> +		 */
> +		if (active == 0)
> +			break;
> +		ssleep(1);
> +	}
> +}

Have you considered to call scsi_target_block() and scsi_target_unblock() instead
of implementing functionality like the above in a SCSI LLD?

Thanks,

Bart.




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux