Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2362987ioo; Sat, 28 May 2022 11:18:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwREfSRukL3RW9RmiRYMFG+vyOW/++FxbHHTTrHODg9FrTwmk1UDQZtK4wyG/k325TIxZcm X-Received: by 2002:a17:902:d4ce:b0:162:42bd:72e with SMTP id o14-20020a170902d4ce00b0016242bd072emr24663933plg.129.1653761922218; Sat, 28 May 2022 11:18:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653761922; cv=none; d=google.com; s=arc-20160816; b=l5+rS0Tsp2QIGmVGnF+VHo4ETefmb4D8cpEFzRnQxdDnzqwY9HIHZi8/rqpPaP3mK0 /AMt6NrM7+np/gl7VNtAG9JwgXiX7JVODn6xFG91j9bI7qKEgUkGs2l4AsgVMLE7AzDD pOSRqWHXeqQC/oMwxPaMzb6fVq/n1rryS839kwZtV584YvRFk4tHFLV1Dcug/X5qxzIq uwrJqTA4pPg0QJtV0Vd4k+3sjJOsJrCsMNI9xThztkA/txuf8NkCEPxKUYN3rcv07EO7 w6/pOL7fobQw45vHWCXCbs5Gi1Ra1Mh9Ag5+iJmvNxOYOL/Sqk8uhtZe2R6ZMiiFhPHt U14A== 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=jqXxJ/n39vbHiCMTJ9YpoTIdD2FJ0weE01mlKeUY3bo=; b=ewj7EXf3JawkyTngjnIpF0mRODGnW3/cZyJ1wHjvUtPUe7NQrREz/6W8CTbQGF6akl NX6kinfsdI/9VPsaf7ogC042BXGte8HEaojwxhxD1RWBaq7fC2sQ21TF/96PD1rtM58S Qn0zw/R9pTd9xn1BfAkcFmdx/XFAvOYoHG7sI3XtLsDMgNdsd9AmqzV8S2+Cm/QsY5DS C1ftxnkwPijfCodghBVyAiCQVFB/rwmAaYGc1aK4SMYHSi5ZiooDDxksPZyvXbUzj4Or E8VrPLlt+gQe6jPAfC6BmLZxZ1QLIwtM1ZcFIk12o3B2uILHh/9q8a8WX4taQKGplhQ6 R73g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=VwMBpSUH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id na3-20020a17090b4c0300b001dfe9742692si7855924pjb.91.2022.05.28.11.18.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 11:18:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=VwMBpSUH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deltatee.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BCA6814021; Sat, 28 May 2022 11:18:40 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348172AbiEZQga (ORCPT + 99 others); Thu, 26 May 2022 12:36:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344564AbiEZQgX (ORCPT ); Thu, 26 May 2022 12:36:23 -0400 Received: from ale.deltatee.com (ale.deltatee.com [204.191.154.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 585AD3DA53; Thu, 26 May 2022 09:36:21 -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=jqXxJ/n39vbHiCMTJ9YpoTIdD2FJ0weE01mlKeUY3bo=; b=VwMBpSUHA60HDH4RqVNZKCreBb mGJ6qJy9649E97/4Zd+G62ZzVQ1plgOMmls7c4zbh4Z7KWxyKs3L3t4p/D8yfy1MPvOs70SYAa5eZ RpG9x/DpqmdkrA/+b6rNarVo7k92BHXV/MeDwaaFuLrzVS0zDPISHEgtCo1cv7XRFoC1Wbxwg5mA7 vmNw+x11e5sVK6/NBChsECx+KrHqMYdzixby28oY4QezPeg1buqoKUJe7A539uU14B5tj6AxR91VN kf996VZ4mQ5PYh+qJGuvpLWHo6v/eZDcfTuHyvwrE8Apvmovvz6JCPQWrnaWUBQgSccd1MK7UzhYN vJsTk1Jw==; 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 1nuGTD-008A7V-8b; Thu, 26 May 2022 10:36:20 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.94.2) (envelope-from ) id 1nuGT8-0008XC-9G; Thu, 26 May 2022 10:36:14 -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:50 -0600 Message-Id: <20220526163604.32736-4-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 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, 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 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 Subject: [PATCH v2 03/17] md/raid5-cache: Refactor r5l_start() to take a struct r5conf 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 All calls to r5l_start() have to dereference conf to get the log. The log pointer should be protected by RCU, but isn't. Push the dereference of conf->log into r5l_start() to reduce the number of sites that dereference conf->log so this can be improved. No functional changes intended. Signed-off-by: Logan Gunthorpe Reviewed-by: Christoph Hellwig --- drivers/md/raid5-cache.c | 9 +++------ drivers/md/raid5-log.h | 2 +- drivers/md/raid5.c | 4 ++-- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c index 96f51ce9b6c1..7c5dc45b1ea8 100644 --- a/drivers/md/raid5-cache.c +++ b/drivers/md/raid5-cache.c @@ -3034,20 +3034,17 @@ static int r5l_load_log(struct r5l_log *log) return ret; } -int r5l_start(struct r5l_log *log) +int r5l_start(struct r5conf *conf) { + struct r5l_log *log = conf->log; int ret; if (!log) return 0; ret = r5l_load_log(log); - if (ret) { - struct mddev *mddev = log->rdev->mddev; - struct r5conf *conf = mddev->private; - + if (ret) r5l_exit_log(conf); - } return ret; } diff --git a/drivers/md/raid5-log.h b/drivers/md/raid5-log.h index 720e164e4d4d..db4c1262b380 100644 --- a/drivers/md/raid5-log.h +++ b/drivers/md/raid5-log.h @@ -29,7 +29,7 @@ void r5c_check_cached_full_stripe(struct r5conf *conf); extern struct md_sysfs_entry r5c_journal_mode; void r5c_update_on_rdev_error(struct mddev *mddev, struct md_rdev *rdev); bool r5c_big_stripe_cached(struct r5conf *conf, sector_t sect); -int r5l_start(struct r5l_log *log); +int r5l_start(struct r5conf *conf); struct dma_async_tx_descriptor * ops_run_partial_parity(struct stripe_head *sh, struct raid5_percpu *percpu, diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 458d88faf2e9..83911affcd88 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -8040,7 +8040,7 @@ static int raid5_add_disk(struct mddev *mddev, struct md_rdev *rdev) if (ret) return ret; - ret = r5l_start(conf->log); + ret = r5l_start(conf); if (ret) return ret; @@ -8743,7 +8743,7 @@ static int raid5_start(struct mddev *mddev) { struct r5conf *conf = mddev->private; - return r5l_start(conf->log); + return r5l_start(conf); } static struct md_personality raid6_personality = -- 2.30.2