Skip to content

Commit 5e7169e

Browse files
Christoph Hellwigaxboe
authored andcommitted
bcache: discard_granularity should not be smaller than a sector
Just like all block I/O, discards are in units of sectors. Thus setting a smaller than sector size discard limit in case of > 512 byte sectors in bcache doesn't make sense. Always set the discard granularity to 512 bytes instead. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20231228075545.362768-3-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 928a5dd commit 5e7169e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/md/bcache/super.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,7 @@ static int bcache_device_init(struct bcache_device *d, unsigned int block_size,
954954
q->limits.max_segment_size = UINT_MAX;
955955
q->limits.max_segments = BIO_MAX_VECS;
956956
blk_queue_max_discard_sectors(q, UINT_MAX);
957-
q->limits.discard_granularity = 512;
957+
q->limits.discard_granularity = block_size;
958958
q->limits.io_min = block_size;
959959
q->limits.logical_block_size = block_size;
960960
q->limits.physical_block_size = block_size;

0 commit comments

Comments
 (0)