]> git.karo-electronics.de Git - karo-tx-linux.git/commit
scsi: sd: Improve sd_completed_bytes
authorDamien Le Moal <damien.lemoal@wdc.com>
Mon, 24 Apr 2017 07:51:10 +0000 (16:51 +0900)
committerMartin K. Petersen <martin.petersen@oracle.com>
Mon, 24 Apr 2017 23:00:29 +0000 (19:00 -0400)
commit6eadc61224666dcc79763dc21749b5f809d82140
treeb14107bc46373d10b1727c2b0f348de0b5ad7e50
parent7529fbb0080d67bc45a3cdad91574cdd0f8a31cf
scsi: sd: Improve sd_completed_bytes

Re-shuffle the code to be more efficient by not initializing variables
upfront (i.e. do it only when necessary).  Also replace the do_div calls
with calls to sectors_to_logical().

No functional change is introduced by this patch.

[mkp: bytes_to_logical()]

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/sd.c
drivers/scsi/sd.h