Re: [PATCH 08/37] smartpqi: add suspend and resume support

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

 



On Tue, 2017-04-25 at 14:46 -0500, Don Brace wrote:
> +static int pqi_device_wait_for_pending_io(struct pqi_ctrl_info *ctrl_info,
> +       struct pqi_scsi_dev *device)
> +{
> +       while (atomic_read(&device->scsi_cmds_outstanding)) {
> +               pqi_check_ctrl_health(ctrl_info);
> +               if (pqi_ctrl_offline(ctrl_info))
> +                       return -ENXIO;
> +               usleep_range(1000, 2000);
> +       }
> +
> +       return 0;
> +}
> +
> +static int pqi_ctrl_wait_for_pending_io(struct pqi_ctrl_info *ctrl_info)
> +{
> +       bool io_pending;
> +       unsigned long flags;
> +       struct pqi_scsi_dev *device;
> +
> +       while (1) {
> +               io_pending = false;
> +
> +               spin_lock_irqsave(&ctrl_info->scsi_device_list_lock, flags);
> +               list_for_each_entry(device, &ctrl_info->scsi_device_list,
> +                       scsi_device_list_entry) {
> +                       if (atomic_read(&device->scsi_cmds_outstanding)) {
> +                               io_pending = true;
> +                               break;
> +                       }
> +               }
> +               spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock,
> +                                       flags);
> +
> +               if (!io_pending)
> +                       break;
> +
> +               pqi_check_ctrl_health(ctrl_info);
> +               if (pqi_ctrl_offline(ctrl_info))
> +                       return -ENXIO;
> +
> +               usleep_range(1000, 2000);
> +       }
> +
> +       return 0;
> +}

The same comment applies here that applies to the previous patch: please use
scsi_target_block() / scsi_target_unblock() instead of reimplementing these
functions.

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