Skip to content

Commit f915f58

Browse files
Christoph Hellwigmartinkpetersen
authored andcommitted
scsi: target: iblock: Fold iblock_emulate_read_cap_with_block_size() into iblock_get_blocks()
Fold iblock_emulate_read_cap_with_block_size() into its only caller. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Mike Christie <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 3ddeabd commit f915f58

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

drivers/target/target_core_iblock.c

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,12 @@ static void iblock_unplug_device(struct se_dev_plug *se_plug)
230230
clear_bit(IBD_PLUGF_PLUGGED, &ib_dev_plug->flags);
231231
}
232232

233-
static unsigned long long iblock_emulate_read_cap_with_block_size(
234-
struct se_device *dev,
235-
struct block_device *bd,
236-
struct request_queue *q)
233+
static sector_t iblock_get_blocks(struct se_device *dev)
237234
{
238-
u32 block_size = bdev_logical_block_size(bd);
235+
struct iblock_dev *ib_dev = IBLOCK_DEV(dev);
236+
u32 block_size = bdev_logical_block_size(ib_dev->ibd_bd);
239237
unsigned long long blocks_long =
240-
div_u64(bdev_nr_bytes(bd), block_size) - 1;
238+
div_u64(bdev_nr_bytes(ib_dev->ibd_bd), block_size) - 1;
241239

242240
if (block_size == dev->dev_attrib.block_size)
243241
return blocks_long;
@@ -829,15 +827,6 @@ iblock_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
829827
return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
830828
}
831829

832-
static sector_t iblock_get_blocks(struct se_device *dev)
833-
{
834-
struct iblock_dev *ib_dev = IBLOCK_DEV(dev);
835-
struct block_device *bd = ib_dev->ibd_bd;
836-
struct request_queue *q = bdev_get_queue(bd);
837-
838-
return iblock_emulate_read_cap_with_block_size(dev, bd, q);
839-
}
840-
841830
static sector_t iblock_get_alignment_offset_lbas(struct se_device *dev)
842831
{
843832
struct iblock_dev *ib_dev = IBLOCK_DEV(dev);

0 commit comments

Comments
 (0)