Skip to content

Commit 1592cd1

Browse files
ChaitanayaKulkarniaxboe
authored andcommitted
null_blk: don't allow discard for zoned mode
Zoned block device specification do not define the behavior of discard/trim command as this command is generally replaced by the reset write pointer (zone reset) command. Emulate this in null_blk by making zoned and discard options mutually exclusive. Suggested-by: Damien Le Moal <[email protected]> Signed-off-by: Chaitanya Kulkarni <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent e274832 commit 1592cd1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/block/null_blk_main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1535,6 +1535,13 @@ static void null_config_discard(struct nullb *nullb)
15351535
{
15361536
if (nullb->dev->discard == false)
15371537
return;
1538+
1539+
if (nullb->dev->zoned) {
1540+
nullb->dev->discard = false;
1541+
pr_info("discard option is ignored in zoned mode\n");
1542+
return;
1543+
}
1544+
15381545
nullb->q->limits.discard_granularity = nullb->dev->blocksize;
15391546
nullb->q->limits.discard_alignment = nullb->dev->blocksize;
15401547
blk_queue_max_discard_sectors(nullb->q, UINT_MAX >> 9);

0 commit comments

Comments
 (0)