From patchwork Thu May 26 16:35:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 12862530 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 80CC7C433EF for ; Thu, 26 May 2022 16:36:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348207AbiEZQgo (ORCPT ); Thu, 26 May 2022 12:36:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346042AbiEZQge (ORCPT ); Thu, 26 May 2022 12:36:34 -0400 Received: from ale.deltatee.com (ale.deltatee.com [204.191.154.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0C884EDDF; Thu, 26 May 2022 09:36:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:MIME-Version:References:In-Reply-To: Message-Id:Date:Cc:To:From:content-disposition; bh=EJp+9sZ34Y9fqOBjq+Gi6IuCQ2335JDwkpGO6bYI9Ak=; b=mn47hcEhuA7bfg8fQQdfCen6LP 2RY8KUU6xyftTpn8x/YD+1VI832dC8ieoNAOk4oOqYF50OwBaGMBxQDvBpcJxzpVzSuulK1wQWLuo 0I6K8zQtl6I2SzfGlPK090pwUO4ZoK8ky3WD93/sLM2/DzEKPBJfJNi7T0XyaFwU7ZbX3O+QsxQ7H JZJYYsD9OXB/kmejfwat+D0sH0KqojULRWSdwL/LAHBAvCprw8GFhVHYZquXZPJ3chXgRwdVJe2mc oMxeYQzePKmXHfk7U309Ujw9cwatN0Hemv0aUbLl0cxdC5LTYDiGi2PvCFaGPQyIltfXtjddlxfpl lVDEgkDQ==; Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nuGTG-008A7R-NR; Thu, 26 May 2022 10:36:23 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.94.2) (envelope-from ) id 1nuGT9-0008XS-4f; Thu, 26 May 2022 10:36:15 -0600 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, Song Liu Cc: Christoph Hellwig , Donald Buczek , Guoqing Jiang , Xiao Ni , Stephen Bates , Martin Oliveira , David Sloan , Logan Gunthorpe , Christoph Hellwig Date: Thu, 26 May 2022 10:35:55 -0600 Message-Id: <20220526163604.32736-9-logang@deltatee.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220526163604.32736-1-logang@deltatee.com> References: <20220526163604.32736-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, song@kernel.org, hch@infradead.org, buczek@molgen.mpg.de, guoqing.jiang@linux.dev, xni@redhat.com, sbates@raithlin.com, Martin.Oliveira@eideticom.com, David.Sloan@eideticom.com, logang@deltatee.com, hch@lst.de X-SA-Exim-Mail-From: gunthorp@deltatee.com Subject: [PATCH v2 08/17] md/raid5-cache: Pass the log through to r5c_finish_cache_stripe() X-SA-Exim-Version: 4.2.1 (built Sat, 13 Feb 2021 17:57:42 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Precedence: bulk List-ID: X-Mailing-List: linux-raid@vger.kernel.org r5c_finish_cache_stripe() dereferences conf->log, which will need an rcu_read_lock(). But that is not necessary here as the log is already available in the call sites through other means. No functional changes intended. Signed-off-by: Logan Gunthorpe Reviewed-by: Christoph Hellwig --- drivers/md/raid5-cache.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c index 24110b687055..8284ce3e5cf6 100644 --- a/drivers/md/raid5-cache.c +++ b/drivers/md/raid5-cache.c @@ -507,10 +507,9 @@ static void r5c_handle_parity_cached(struct stripe_head *sh) * Setting proper flags after writing (or flushing) data and/or parity to the * log device. This is called from r5l_log_endio() or r5l_log_flush_endio(). */ -static void r5c_finish_cache_stripe(struct stripe_head *sh) +static void r5c_finish_cache_stripe(struct r5l_log *log, + struct stripe_head *sh) { - struct r5l_log *log = sh->raid_conf->log; - if (log->r5c_journal_mode == R5C_JOURNAL_MODE_WRITE_THROUGH) { BUG_ON(test_bit(STRIPE_R5C_CACHING, &sh->state)); /* @@ -528,14 +527,14 @@ static void r5c_finish_cache_stripe(struct stripe_head *sh) } } -static void r5l_io_run_stripes(struct r5l_io_unit *io) +static void r5l_io_run_stripes(struct r5l_log *log, struct r5l_io_unit *io) { struct stripe_head *sh, *next; list_for_each_entry_safe(sh, next, &io->stripe_list, log_list) { list_del_init(&sh->log_list); - r5c_finish_cache_stripe(sh); + r5c_finish_cache_stripe(log, sh); set_bit(STRIPE_HANDLE, &sh->state); raid5_release_stripe(sh); @@ -554,7 +553,7 @@ static void r5l_log_run_stripes(struct r5l_log *log) break; list_move_tail(&io->log_sibling, &log->finished_ios); - r5l_io_run_stripes(io); + r5l_io_run_stripes(log, io); } } @@ -1284,7 +1283,7 @@ static void r5l_log_flush_endio(struct bio *bio) spin_lock_irqsave(&log->io_list_lock, flags); list_for_each_entry(io, &log->flushing_ios, log_sibling) - r5l_io_run_stripes(io); + r5l_io_run_stripes(log, io); list_splice_tail_init(&log->flushing_ios, &log->finished_ios); spin_unlock_irqrestore(&log->io_list_lock, flags);