>>> Was referring to this: >>> -- >>> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c >>> index 3345f866178e..dbc402587431 100644 >>> --- a/drivers/nvme/host/core.c >>> +++ b/drivers/nvme/host/core.c >>> @@ -781,6 +781,7 @@ static blk_status_t nvme_setup_discard(struct >>> nvme_ns >>> *ns, struct request *req, >>> range = page_address(ns->ctrl->discard_page); >>> } >>> >>> + segments = min(segments, queue_max_discard_segments(req->q)); >> >> That can't work. >> >> In case of queue_max_discard_segments(req->q) == 1, the request still >> can have more than one bios since the normal merge is taken for discard >> IOs. > > Ah, I see, the bios are contiguous though right? > We could add a contiguity check in the loop and conditionally > increment n, but maybe that would probably be more complicated... It will be great if we can avoid above mentioned complicated pattern... -ck