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 0AA91C433FE for ; Mon, 28 Feb 2022 11:25:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235785AbiB1LZ6 (ORCPT ); Mon, 28 Feb 2022 06:25:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235764AbiB1LZy (ORCPT ); Mon, 28 Feb 2022 06:25:54 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54A0F70935; Mon, 28 Feb 2022 03:25:14 -0800 (PST) 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=zi/LDCEjDayuCiJNtlU9uiCyAHTO1zUGruj/KcmLdyU=; b=LVVWpRqvQe80JWh8JrQLd1Uni2 NXAGP8CjBH69SPnK9w16GUgm5NAW9FofOHif77tG0HBTlv9qUpQxwwrMZWrPoLnauwI4nNAuDmZf/ WHzOB0BFwvGL6OP0xRneSf/JiZoyrX3D+QtGsJBmbHuh90g5Rc7gnlAT4QIR6YCcACzTdd/3jItlc qnm6O72bzGShPQAy4iiISLLvI3UY9MSeXnjYP1ArWagBT04Gioh6QP7A3oNMl/pN9RkyvmZrBW2it JaQsIpwFIyM/a+WEB6x6QZWdrteAO9AT9OxBDODH0LPoQfVEq8JyXxoeJHSGodH2ViSw7YDVcNN35 WTPI4cvg==; Received: from [2.53.163.181] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOe9R-00BqTr-1k; Mon, 28 Feb 2022 11:25:13 +0000 From: Christoph Hellwig To: Song Liu Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] raid5-cache: fully initialize flush_bio when needed Date: Mon, 28 Feb 2022 13:25:01 +0200 Message-Id: <20220228112503.841449-3-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220228112503.841449-1-hch@lst.de> References: <20220228112503.841449-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-kernel@vger.kernel.org Stop using bio_reset and just initialize the bio fully when needed. Signed-off-by: Christoph Hellwig --- drivers/md/raid5-cache.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c index 86e2bb89d9c7b..8907d18c225a9 100644 --- a/drivers/md/raid5-cache.c +++ b/drivers/md/raid5-cache.c @@ -1266,6 +1266,8 @@ static void r5l_log_flush_endio(struct bio *bio) r5l_io_run_stripes(io); list_splice_tail_init(&log->flushing_ios, &log->finished_ios); spin_unlock_irqrestore(&log->io_list_lock, flags); + + bio_uninit(bio); } /* @@ -1301,7 +1303,7 @@ void r5l_flush_stripe_to_raid(struct r5l_log *log) if (!do_flush) return; - bio_reset(&log->flush_bio, log->rdev->bdev, + bio_init(&log->flush_bio, log->rdev->bdev, NULL, 0, REQ_OP_WRITE | REQ_PREFLUSH); log->flush_bio.bi_end_io = r5l_log_flush_endio; submit_bio(&log->flush_bio); @@ -3105,7 +3107,6 @@ int r5l_init_log(struct r5conf *conf, struct md_rdev *rdev) INIT_LIST_HEAD(&log->io_end_ios); INIT_LIST_HEAD(&log->flushing_ios); INIT_LIST_HEAD(&log->finished_ios); - bio_init(&log->flush_bio, NULL, NULL, 0, 0); log->io_kc = KMEM_CACHE(r5l_io_unit, 0); if (!log->io_kc) -- 2.30.2