scsi: sd: Simplify misaligned I/O check
authorMartin K. Petersen <martin.petersen@oracle.com>
Wed, 16 Jan 2019 00:49:59 +0000 (16:49 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 23 Jan 2019 02:18:27 +0000 (21:18 -0500)
commitec029758a10095c66fd24398f742c695c2e6ec2c
tree4eb233e879a02f4b8b1ebf38d9a837491938d3a4
parentc6c93fdd3451cc0de393dad891d6b0be71e50888
scsi: sd: Simplify misaligned I/O check

Avoid open coding the checks for the supported logical block sizes and use
a mask to check for misaligned I/O. Use our helper functions to scale lba
and block count.

Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ bvanassche: ported this patch from kernel v4.11 to kernel v5.0 ]
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/sd.c