Skip to content

Commit 1e2ab2e

Browse files
Christoph Hellwigaxboe
authored andcommitted
nbd: use the default discard granularity
The discard granularity now defaults to a single sector, so don't set that value explicitly. Also don't bother clearing it as a discard granularity without discard_sectors doesn't mean anything. Signed-off-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 599d9d4 commit 1e2ab2e

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

drivers/block/nbd.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -334,10 +334,8 @@ static int nbd_set_size(struct nbd_device *nbd, loff_t bytesize,
334334
if (!nbd->pid)
335335
return 0;
336336

337-
if (nbd->config->flags & NBD_FLAG_SEND_TRIM) {
338-
nbd->disk->queue->limits.discard_granularity = blksize;
337+
if (nbd->config->flags & NBD_FLAG_SEND_TRIM)
339338
blk_queue_max_discard_sectors(nbd->disk->queue, UINT_MAX);
340-
}
341339
blk_queue_logical_block_size(nbd->disk->queue, blksize);
342340
blk_queue_physical_block_size(nbd->disk->queue, blksize);
343341

@@ -1357,7 +1355,6 @@ static void nbd_config_put(struct nbd_device *nbd)
13571355
nbd->config = NULL;
13581356

13591357
nbd->tag_set.timeout = 0;
1360-
nbd->disk->queue->limits.discard_granularity = 0;
13611358
blk_queue_max_discard_sectors(nbd->disk->queue, 0);
13621359

13631360
mutex_unlock(&nbd->config_lock);
@@ -1850,7 +1847,6 @@ static struct nbd_device *nbd_dev_add(int index, unsigned int refs)
18501847
* Tell the block layer that we are not a rotational device
18511848
*/
18521849
blk_queue_flag_set(QUEUE_FLAG_NONROT, disk->queue);
1853-
disk->queue->limits.discard_granularity = 0;
18541850
blk_queue_max_discard_sectors(disk->queue, 0);
18551851
blk_queue_max_segment_size(disk->queue, UINT_MAX);
18561852
blk_queue_max_segments(disk->queue, USHRT_MAX);

0 commit comments

Comments
 (0)