From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7050DC77B6C for ; Thu, 13 Apr 2023 06:41:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229705AbjDMGlm (ORCPT ); Thu, 13 Apr 2023 02:41:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229815AbjDMGli (ORCPT ); Thu, 13 Apr 2023 02:41:38 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A922868B for ; Wed, 12 Apr 2023 23:41:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=6k5ijmIEMS7OjWIiy0yFSij8ktyfCdBjOQaK9pTUxEw=; b=uj0cXm0VJe+hKYmTYwg3USUlma DjlhBpVgH7VmOA8lERrP6TspqafjytbC8VRlmgz0Gl8rRO7lzJXGXqVLMo+WEqrzz1JDBc3986keo KE7kTpz+c+8W3lorQzBHMsBpLFVyy2eu4P1sKJtDGgsTGk4E3lTY4M0BsEHCtPyLUBn2XWXvyDWRr qUiUXxFV64kHdMcAjZLh9MoJEX8w91V34CEH9J2sAhHFiVJ029hlU51q0rgWB3GbnA0DQzzG9K2Lm 3G+wqCc2s+oUvQ37hK9L+0Vy/MA4z1Dul9KgNfD/n6HDmKQwBd9d06ujMpJVB+59wT/pjn7rC4EMI H19Y+7mw==; Received: from [2001:4bb8:192:2d6c:85e:8df8:d35f:4448] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1pmqe7-005BVI-1s; Thu, 13 Apr 2023 06:41:28 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Bart Van Assche , Damien Le Moal , linux-block@vger.kernel.org Subject: [PATCH 11/20] blk-mq: refactor the DONTPREP/SOFTBARRIER andling in blk_mq_requeue_work Date: Thu, 13 Apr 2023 08:40:48 +0200 Message-Id: <20230413064057.707578-12-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230413064057.707578-1-hch@lst.de> References: <20230413064057.707578-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Split the RQF_DONTPREP and RQF_SOFTBARRIER in separate branches to make the code more readable. Signed-off-by: Christoph Hellwig Reviewed-by: Bart Van Assche Reviewed-by: Damien Le Moal --- block/blk-mq.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index c3de03217f4f1a..d17871c237f7df 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1427,20 +1427,21 @@ static void blk_mq_requeue_work(struct work_struct *work) spin_unlock_irq(&q->requeue_lock); list_for_each_entry_safe(rq, next, &rq_list, queuelist) { - if (!(rq->rq_flags & (RQF_SOFTBARRIER | RQF_DONTPREP))) - continue; - - rq->rq_flags &= ~RQF_SOFTBARRIER; - list_del_init(&rq->queuelist); /* - * If RQF_DONTPREP, rq has contained some driver specific - * data, so insert it to hctx dispatch list to avoid any - * merge. + * If RQF_DONTPREP ist set, the request has been started by the + * driver already and might have driver-specific data allocated + * already. Insert it into the hctx dispatch list to avoid + * block layer merges for the request. */ - if (rq->rq_flags & RQF_DONTPREP) + if (rq->rq_flags & RQF_DONTPREP) { + rq->rq_flags &= ~RQF_SOFTBARRIER; + list_del_init(&rq->queuelist); blk_mq_request_bypass_insert(rq, false, false); - else + } else if (rq->rq_flags & RQF_SOFTBARRIER) { + rq->rq_flags &= ~RQF_SOFTBARRIER; + list_del_init(&rq->queuelist); blk_mq_insert_request(rq, true, false, false); + } } while (!list_empty(&rq_list)) { -- 2.39.2