Ritika, > + /* > + * At least SCSI device does not have a good way to return if > + * Write Same/Zero is actually supported. To detect this, first > + * try to issue one and if it fails clear the max sectors value. > + * If this occurs on the lower device, the right error code > + * needs to be propagated to upper layers. > + */ > + if (max_sectors == 0) > + return BLK_STS_NOTSUPP; Maybe we should make it more explicit in the comment that there is a window of error where this condition can occur? Something like: If a device rejects a non-read/write command (discard, write same, etc.) the low-level device driver will set the relevant queue limit to 0 to prevent blk-lib from issuing more of the offending operations. Commands queued prior to the queue limit being reset need to be completed with BLK_STS_NOTSUPP to avoid I/O errors being propagated to upper layers. Otherwise looks good. Reviewed-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx> -- Martin K. Petersen Oracle Linux Engineering