summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sd.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/sd.h')
-rw-r--r--drivers/scsi/sd.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h
index 0cf9680cb469..e6241c445878 100644
--- a/drivers/scsi/sd.h
+++ b/drivers/scsi/sd.h
@@ -169,6 +169,11 @@ static inline unsigned int logical_to_bytes(struct scsi_device *sdev, sector_t b
return blocks * sdev->sector_size;
}
+static inline sector_t bytes_to_logical(struct scsi_device *sdev, unsigned int bytes)
+{
+ return bytes >> ilog2(sdev->sector_size);
+}
+
static inline sector_t sectors_to_logical(struct scsi_device *sdev, sector_t sector)
{
return sector >> (ilog2(sdev->sector_size) - 9);