mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
vblk: Fixed the max size for discard
- Updated the max_discard_segments to 1 for discarding contiguous blocks. - Updated the max_discard_sectors to correct value considering the SECTOR_SIZE. Bug 5065629 Change-Id: I6737d77f63ff5d7330d467acdbf051b8df4097af Signed-off-by: Sanjith T D <std@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3313548 Reviewed-by: Sreenivas Velpula <svelpula@nvidia.com> Reviewed-by: svcacv <svcacv@nvidia.com> Reviewed-by: Vipin Kumar <vipink@nvidia.com>
This commit is contained in:
@@ -1297,10 +1297,13 @@ static void setup_device(struct vblk_dev *vblkdev)
|
||||
*/
|
||||
blk_queue_flag_set(QUEUE_FLAG_SECERASE, vblkdev->queue);
|
||||
#elif defined(NV_BLOCK_USE_QUEUE_LIMITS_SET)
|
||||
limits.max_secure_erase_sectors = vblkdev->config.blk_config.max_erase_blks_per_io;
|
||||
limits.max_secure_erase_sectors =
|
||||
(vblkdev->config.blk_config.max_erase_blks_per_io *
|
||||
vblkdev->config.blk_config.hardblk_size) / SECTOR_SIZE;
|
||||
#else
|
||||
blk_queue_max_secure_erase_sectors(vblkdev->queue,
|
||||
vblkdev->config.blk_config.max_erase_blks_per_io);
|
||||
((vblkdev->config.blk_config.max_erase_blks_per_io *
|
||||
vblkdev->config.blk_config.hardblk_size) / SECTOR_SIZE));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1315,11 +1318,28 @@ static void setup_device(struct vblk_dev *vblkdev)
|
||||
blk_queue_flag_set(QUEUE_FLAG_DISCARD, vblkdev->queue);
|
||||
#endif
|
||||
#if defined(NV_BLOCK_USE_QUEUE_LIMITS_SET)
|
||||
limits.max_discard_segments = vblkdev->config.blk_config.max_erase_blks_per_io;
|
||||
/* H/W supports single contiguous range of discard. So set max_discard_segments to 1.
|
||||
*
|
||||
* Ex:
|
||||
* For 4KB block size(vblkdev->config.blk_config.hardblk_size)
|
||||
* and 64MB(vblkdev->config.blk_config.max_erase_blks_per_io) max discard:
|
||||
* Block size = 4KB = 8 sectors
|
||||
* max_discard_sectors = 131072 sectors (64MB)
|
||||
* max_discard_segments = 1 (one contiguous range)
|
||||
*
|
||||
* Segment structure:
|
||||
* [Block 0] [Block 1] ... [Block 16383] = One segment
|
||||
* |--8 sectors--| ... up to 131072 sectors total
|
||||
*/
|
||||
limits.max_discard_segments = 1;
|
||||
limits.max_discard_sectors =
|
||||
((vblkdev->config.blk_config.max_erase_blks_per_io *
|
||||
vblkdev->config.blk_config.hardblk_size) / SECTOR_SIZE);
|
||||
limits.discard_granularity = vblkdev->config.blk_config.hardblk_size;
|
||||
#else
|
||||
blk_queue_max_discard_sectors(vblkdev->queue,
|
||||
vblkdev->config.blk_config.max_erase_blks_per_io);
|
||||
((vblkdev->config.blk_config.max_erase_blks_per_io *
|
||||
vblkdev->config.blk_config.hardblk_size) / SECTOR_SIZE));
|
||||
vblkdev->queue->limits.discard_granularity =
|
||||
vblkdev->config.blk_config.hardblk_size;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user