Skip to content

Commit 4a718d7

Browse files
Christoph Hellwigaxboe
authored andcommitted
xen-blkfront: set max_discard/secure erase limits to UINT_MAX
Currently xen-blkfront set the max discard limit to the capacity of the device, which is suboptimal when the capacity changes. Just set it to UINT_MAX, which has the same effect and is simpler. Signed-off-by: Christoph Hellwig <[email protected]> Acked-by: Roger Pau Monné <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 82c6515 commit 4a718d7

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/block/xen-blkfront.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -944,20 +944,18 @@ static const struct blk_mq_ops blkfront_mq_ops = {
944944
static void blkif_set_queue_limits(struct blkfront_info *info)
945945
{
946946
struct request_queue *rq = info->rq;
947-
struct gendisk *gd = info->gd;
948947
unsigned int segments = info->max_indirect_segments ? :
949948
BLKIF_MAX_SEGMENTS_PER_REQUEST;
950949

951950
blk_queue_flag_set(QUEUE_FLAG_VIRT, rq);
952951

953952
if (info->feature_discard) {
954-
blk_queue_max_discard_sectors(rq, get_capacity(gd));
953+
blk_queue_max_discard_sectors(rq, UINT_MAX);
955954
rq->limits.discard_granularity = info->discard_granularity ?:
956955
info->physical_sector_size;
957956
rq->limits.discard_alignment = info->discard_alignment;
958957
if (info->feature_secdiscard)
959-
blk_queue_max_secure_erase_sectors(rq,
960-
get_capacity(gd));
958+
blk_queue_max_secure_erase_sectors(rq, UINT_MAX);
961959
}
962960

963961
/* Hard sector size and max sectors impersonate the equiv. hardware. */

0 commit comments

Comments
 (0)