Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2989767pxm; Mon, 28 Feb 2022 09:50:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJyolkUEE49yevuO7VoF0ktSx+/evGMeTAliTx/tNERcqGt07ThNJh7iInvcNLbz+l2d9Qvr X-Received: by 2002:a17:902:d888:b0:151:6fe8:6e68 with SMTP id b8-20020a170902d88800b001516fe86e68mr3264641plz.158.1646070652893; Mon, 28 Feb 2022 09:50:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646070652; cv=none; d=google.com; s=arc-20160816; b=WmeysT8tMmzIC5XRnw9Y9TeiJCcYP27yZ+vc3GycSp7H9wECNCnVnJkXKdmnx0vbUd LgTvhmCY0R4Gn4gyaGjHrrQtzD5YfRIwBDTQO/pmXV2tCcTjcB3mSX8G92MJ7Z9QdYia pP+E6nfMCjdNlw+ODnB73Ip0qLg6H7eg4kpqDV94AkNH6C/b0VUmlfaYgyYE3INRbbNz //TUhKfOU6B7tUn3AW9dj9eRb8CrwdGUMRMZbBkg30xkjQDz8wcYQA/Crks/DmdKpHOl l5aCS8c1GPEs6QC+niPNeq/VKFlih8rath+MoVAoiHvdPTC60h0Hm564U33EVshk9Apu a2bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zi/LDCEjDayuCiJNtlU9uiCyAHTO1zUGruj/KcmLdyU=; b=HtUEPT6gWQv+14q79LrInr5YceJc3eRzH80T4z0UHEswykEdIhv/IxiV3lCWotSsfB pVD5nCFka1jRiEEivg7EAoe7uF4NEsQg2iI+CeWjqnppXRAdPS8uG64or+limUU5MJe3 MfcYiTPSRRWrw1SpQ969HRUqlKIG8712Vxx356zjyamIubfCHC5KV36KY01JlEMa+hb5 jUuLbwQQkPeImhwDDrROhsclDjg6G48xJcG1SSDAAunAueA1v3rP28Mn6AIykTKGQn3X uWM0lYPTszzeBu2m35a5BuHBAXbmH+Yy1EPegLEvhTlWk0BGbKFpFA2qaisIMKuBlvDs YOsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=LVVWpRqv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y14-20020a1709029b8e00b00150251ce016si9222921plp.47.2022.02.28.09.50.37; Mon, 28 Feb 2022 09:50:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=LVVWpRqv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235782AbiB1LZ5 (ORCPT + 99 others); Mon, 28 Feb 2022 06:25:57 -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 X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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