mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-28 12:53:14 +01:00
scsi: core: Add helper to return number of logical blocks in a request
Link: https://lore.kernel.org/r/[email protected] Cc: Bart Van Assche <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
This commit is contained in:
1 parent
2266a2def9
commit
6a20e21ae1
1 file changed
+7
@@ -237,6 +237,13 @@ static inline sector_t scsi_get_lba(struct scsi_cmnd *scmd)
|
||||
return blk_rq_pos(scsi_cmd_to_rq(scmd)) >> shift;
|
||||
}
|
||||
|
||||
static inline unsigned int scsi_logical_block_count(struct scsi_cmnd *scmd)
|
||||
{
|
||||
unsigned int shift = ilog2(scmd->device->sector_size) - SECTOR_SHIFT;
|
||||
|
||||
return blk_rq_bytes(scsi_cmd_to_rq(scmd)) >> shift;
|
||||
}
|
||||
|
||||
/*
|
||||
* The operations below are hints that tell the controller driver how
|
||||
* to handle I/Os with DIF or similar types of protection information.
|
||||
|
||||
Reference in new issue
Block a user