On 2/26/24 04:20, Johannes Thumshirn wrote: > On 26.02.24 08:15, Chaitanya Kulkarni wrote: >> @@ -1684,8 +1689,13 @@ static void null_del_dev(struct nullb *nullb) >> dev->nullb = NULL; >> } >> >> -static void null_config_discard(struct nullb *nullb, struct queue_limits *lim) >> +static void null_config_discard_write_zeroes(struct nullb *nullb, >> + struct queue_limits *lim) >> { >> + /* REQ_OP_WRITE_ZEROES only supported in non memory backed mode */ >> + if (!nullb->dev->memory_backed && nullb->dev->write_zeroes) >> + lim->max_write_zeroes_sectors = UINT_MAX >> 9; >> + >> if (nullb->dev->discard == false) >> return; > Please use SECTOR_SHIFT instead of the magic '9'. In past I've been told explicitly to not use SECTOR_SHIFT. That also follows existing code in the function where SECTOR_SHIFT is not used [1]. Now I'm really confused :(. -ck [1] static void null_config_discard(struct nullb *nullb, struct queue_limits *lim) { if (nullb->dev->discard == false) return; if (!nullb->dev->memory_backed) { nullb->dev->discard = false; pr_info("discard option is ignored without memory backing\n"); return; } if (nullb->dev->zoned) { nullb->dev->discard = false; pr_info("discard option is ignored in zoned mode\n"); return; } lim->max_hw_discard_sectors = UINT_MAX >> 9; }