Message ID | 20220630122241.1658-3-a.kovaleva@yadro.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Make target send correct io limits | expand |
On 6/30/22 7:22 AM, Anastasia Kovaleva wrote: > By default, hw_max_sectors stores its value in 512 blocks in iblock, > despite the fact that the block size can be 4096 bytes. Change > hw_max_sectors to store the number of sectors in hw_block_size blocks. > > Signed-off-by: Anastasia Kovaleva <a.kovaleva@yadro.com> > Reviewed-by: Konstantin Shelekhin <k.shelekhin@yadro.com> > Reviewed-by: Dmitriy Bogdanov <d.bogdanov@yadro.com> > --- > drivers/target/target_core_iblock.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c > index 378c80313a0f..532a30b31a7c 100644 > --- a/drivers/target/target_core_iblock.c > +++ b/drivers/target/target_core_iblock.c > @@ -116,7 +116,8 @@ static int iblock_configure_device(struct se_device *dev) > q = bdev_get_queue(bd); > > dev->dev_attrib.hw_block_size = bdev_logical_block_size(bd); > - dev->dev_attrib.hw_max_sectors = queue_max_hw_sectors(q); > + dev->dev_attrib.hw_max_sectors = mult_frac(queue_max_hw_sectors(q), > + SECTOR_SIZE, dev->dev_attrib.hw_block_size); Just another nit. I think it's more common in the target code to put the sector_size and hw_block_size on different lines. It would be nicest to tab them over to line with the opening "(" but I guess the hw_block_size line would be over 80, so something like this is ok: dev->dev_attrib.hw_max_sectors = mult_frac(queue_max_hw_sectors(q), SECTOR_SIZE, dev->dev_attrib.hw_block_size); > dev->dev_attrib.hw_queue_depth = q->nr_requests; > > if (target_configure_unmap_from_queue(&dev->dev_attrib, bd))
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index 378c80313a0f..532a30b31a7c 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c @@ -116,7 +116,8 @@ static int iblock_configure_device(struct se_device *dev) q = bdev_get_queue(bd); dev->dev_attrib.hw_block_size = bdev_logical_block_size(bd); - dev->dev_attrib.hw_max_sectors = queue_max_hw_sectors(q); + dev->dev_attrib.hw_max_sectors = mult_frac(queue_max_hw_sectors(q), + SECTOR_SIZE, dev->dev_attrib.hw_block_size); dev->dev_attrib.hw_queue_depth = q->nr_requests; if (target_configure_unmap_from_queue(&dev->dev_attrib, bd))