Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1547134ioo; Sun, 22 May 2022 18:37:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWW/NPBFsz+1xImAw1536joiByr0KBOfSxyD+y9bdOjlxD2IYAXz2dI6gtQJ0xIc9nzmp5 X-Received: by 2002:a05:6402:2554:b0:42b:703c:513e with SMTP id l20-20020a056402255400b0042b703c513emr1464530edb.58.1653269851935; Sun, 22 May 2022 18:37:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653269851; cv=none; d=google.com; s=arc-20160816; b=QbvftSFGP2lBa+wcT6a2Bbzgee9IgAEqEeH6hVEKNvREmiZA+CC8UJlu9osi3LYDRK bYo05FmCdRp9LQX4kpc8NL8gDdmgGly3FMmY1XHFylnCGyjBUyFv/mtlYK56iNmZ1hdh TVozNHrGXopXAWDtWMmsmYIMJ7jvQD5GnrklLLCZLdl+oeRSHyoR+8aDWL5fh4UEDOdo GMgXVTO0THXUyh9di0yNnXaiUhGQAw5+jXkmYmGZ93M6GeSjzifPegLpkr8vRzNT8NjL S6WV4fcnKy7JDugzryMvE0jk98LIa+VREphSFSIYltXISkCYsEtNDXR4X3CE1TW6rtKJ fAgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:cc:to:from:dkim-signature; bh=vTNpCK9VH4FT14otqpB35kroOHgecD5A4kscpWltdTo=; b=uAZhcpU3FBexFA19j4gwqOS4KmKvhMVZ1gtxpMPRROrkMoKadgU/q/7viUXO0bTumO /3sp9HWetFhnis1TUng+7Oo/UqyBfBtrfj4accYukAa/V3v8bFIRFO5K+3i0gARO2TbU mXm4ndWzupDVggsvkT3wQ28befDcB1l5KQfjpyBafyFzVs5EklP/IQoBrKPecRKcupG8 DBb+SZfgysySDXffoPWSsm9mnqJ/lsXj3aneUvYYU/iXN9tgagJ7+jZKlp6sAxCrZVcb YZWr63BPYIIseohhiuVPs6+FBiYogysomV0TPO8nzP/QV/ccYkI95c1np/sUk1IvJLll 4AOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=RmQ8WSWW; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deltatee.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dn20-20020a17090794d400b006feb0d45490si3814799ejc.403.2022.05.22.18.36.59; Sun, 22 May 2022 18:37:31 -0700 (PDT) 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=@deltatee.com header.s=20200525 header.b=RmQ8WSWW; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deltatee.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244490AbiESTOs (ORCPT + 99 others); Thu, 19 May 2022 15:14:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244380AbiESTNl (ORCPT ); Thu, 19 May 2022 15:13:41 -0400 Received: from ale.deltatee.com (ale.deltatee.com [204.191.154.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAB44AFAE6; Thu, 19 May 2022 12:13:23 -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=vTNpCK9VH4FT14otqpB35kroOHgecD5A4kscpWltdTo=; b=RmQ8WSWWwk0rvMUQNhaTIJXbEa xEboSGo6/lWHDEvcPXTgjCtC1JmNkQuqpr+kGoj5h46pECUmqh3THPqLnXSxmiyo3jP6a/gK/9F7g xyfYMyGRllspPu1U2If8vd/pKR5+u7rhlhwTZnIIHGoAm4walPF5ETeIh2zgdX/kysXuoxDjXap1Y mmWtG/nHLfilZJITegHzDJyU20UURl2pfaJ9vNSZ4FqTJf2f5arQGcUBaDOd4rg+bzs8cxAH3OUPB AZp5zvOhpZoOGroxkonAkT6iL3QdNES8ogUhdcfoZ4ENSuWJvPCSdVRK4ptzsflgIIqxmeAkFS+Fp hpb/B65w==; 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 1nrlaJ-002TqU-8B; Thu, 19 May 2022 13:13:20 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.94.2) (envelope-from ) id 1nrlaE-0004Td-O5; Thu, 19 May 2022 13:13:14 -0600 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, Song Liu Cc: Christoph Hellwig , Guoqing Jiang , Xiao Ni , Stephen Bates , Martin Oliveira , David Sloan , Logan Gunthorpe Date: Thu, 19 May 2022 13:13:05 -0600 Message-Id: <20220519191311.17119-10-logang@deltatee.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220519191311.17119-1-logang@deltatee.com> References: <20220519191311.17119-1-logang@deltatee.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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, guoqing.jiang@linux.dev, xni@redhat.com, sbates@raithlin.com, Martin.Oliveira@eideticom.com, David.Sloan@eideticom.com, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Subject: [PATCH v1 09/15] md/raid5-cache: Don't pass conf to r5c_calculate_new_cp() 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-kernel@vger.kernel.org r5c_calculate_new_cp() only uses conf to dereference the log which both callers already have a pointer to and no longer need to obtain a conf through a complicated dereference chain for this use. No functional changes intended. Signed-off-by: Logan Gunthorpe --- drivers/md/raid5-cache.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c index f7d013479a68..0ecff63202f8 100644 --- a/drivers/md/raid5-cache.c +++ b/drivers/md/raid5-cache.c @@ -1166,10 +1166,9 @@ static void r5l_run_no_space_stripes(struct r5l_log *log) * for write through mode, returns log->next_checkpoint * for write back, returns log_start of first sh in stripe_in_journal_list */ -static sector_t r5c_calculate_new_cp(struct r5conf *conf) +static sector_t r5c_calculate_new_cp(struct r5l_log *log) { struct stripe_head *sh; - struct r5l_log *log = conf->log; sector_t new_cp; unsigned long flags; @@ -1177,12 +1176,12 @@ static sector_t r5c_calculate_new_cp(struct r5conf *conf) return log->next_checkpoint; spin_lock_irqsave(&log->stripe_in_journal_lock, flags); - if (list_empty(&conf->log->stripe_in_journal_list)) { + if (list_empty(&log->stripe_in_journal_list)) { /* all stripes flushed */ spin_unlock_irqrestore(&log->stripe_in_journal_lock, flags); return log->next_checkpoint; } - sh = list_first_entry(&conf->log->stripe_in_journal_list, + sh = list_first_entry(&log->stripe_in_journal_list, struct stripe_head, r5c); new_cp = sh->log_start; spin_unlock_irqrestore(&log->stripe_in_journal_lock, flags); @@ -1191,10 +1190,8 @@ static sector_t r5c_calculate_new_cp(struct r5conf *conf) static sector_t r5l_reclaimable_space(struct r5l_log *log) { - struct r5conf *conf = log->rdev->mddev->private; - return r5l_ring_distance(log, log->last_checkpoint, - r5c_calculate_new_cp(conf)); + r5c_calculate_new_cp(log)); } static void r5l_run_no_mem_stripe(struct r5l_log *log) @@ -1515,7 +1512,6 @@ static void r5c_do_reclaim(struct r5conf *conf) static void r5l_do_reclaim(struct r5l_log *log) { - struct r5conf *conf = log->rdev->mddev->private; sector_t reclaim_target = xchg(&log->reclaim_target, 0); sector_t reclaimable; sector_t next_checkpoint; @@ -1544,7 +1540,7 @@ static void r5l_do_reclaim(struct r5l_log *log) log->io_list_lock); } - next_checkpoint = r5c_calculate_new_cp(conf); + next_checkpoint = r5c_calculate_new_cp(log); spin_unlock_irq(&log->io_list_lock); if (reclaimable == 0 || !write_super) -- 2.30.2