Re: [PATCH v3 4/6] scsi: Retry unaligned zoned writes
From: Damien Le Moal <dlemoal@kernel.org>
Date: 2023-07-26 23:46:41
On 7/27/23 00:02, Bart Van Assche wrote:
On 7/26/23 01:47, Damien Le Moal wrote:quoted
On 7/26/23 09:57, Bart Van Assche wrote:quoted
+/* + * Returns a negative value if @_a has a lower LBA than @_b, zero if + * both have the same LBA and a positive value otherwise. + */ +static int scsi_cmp_lba(void *priv, const struct list_head *_a, + const struct list_head *_b)The argument priv is unused.I cannot remove the 'priv' argument. From include/linux/list_sort.h: typedef int __attribute__((nonnull(2,3))) (*list_cmp_func_t)(void *, const struct list_head *, const struct list_head *); __attribute__((nonnull(2,3))) void list_sort(void *priv, struct list_head *head, list_cmp_func_t cmp);
Yes. I missed that this is a callbalck. Sorry for the noise.
quoted
quoted
/** * scsi_unjam_host - Attempt to fix a host which has a cmd that failed. * @shost: Host to unjam.@@ -2258,6 +2289,12 @@ static void scsi_unjam_host(struct Scsi_Host *shost)SCSI_LOG_ERROR_RECOVERY(1, scsi_eh_prt_fail_stats(shost, &eh_work_q)); + /* + * Sort pending SCSI commands in LBA order. This is important if zone + * write locking is disabled for a zoned SCSI device. + */ + list_sort(NULL, &eh_work_q, scsi_cmp_lba);Should we do this only for zoned devices ?I'm not sure this is possible. Error handling happens per SCSI host. Some of the logical units associated with a host may be zoned while others may represent conventional storage or have no storage associated with them (WLUN). Thanks, Bart.
-- Damien Le Moal Western Digital Research