On 11/4/21 3:17 AM, Christoph Hellwig wrote: > On Wed, Nov 03, 2021 at 12:32:22PM -0600, Jens Axboe wrote: >> + if (plug && !rq_list_empty(plug->cached_rq)) { >> + rq = rq_list_peek(&plug->cached_rq); > > No need for the empty check plus peek. This could be simplified > down to: > > if (!plug) > return NULL; > rq = rq_list_peek(&plug->cached_rq); > if (!rq || rq->q != q) > return NULL; > > rq_qos_throttle(q, bio); > plug->cached_rq = rq_list_next(rq); > INIT_LIST_HEAD(&rq->queuelist); > return rq; I tend to prefer having logic flow from the expected conditions. And since we need to check if the plug is valid anyway, I prefer the current logic. -- Jens Axboe