[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220519191311.17119-4-logang@deltatee.com>
Date: Thu, 19 May 2022 13:12:59 -0600
From: Logan Gunthorpe <logang@...tatee.com>
To: linux-kernel@...r.kernel.org, linux-raid@...r.kernel.org,
Song Liu <song@...nel.org>
Cc: Christoph Hellwig <hch@...radead.org>,
Guoqing Jiang <guoqing.jiang@...ux.dev>,
Xiao Ni <xni@...hat.com>, Stephen Bates <sbates@...thlin.com>,
Martin Oliveira <Martin.Oliveira@...eticom.com>,
David Sloan <David.Sloan@...eticom.com>,
Logan Gunthorpe <logang@...tatee.com>
Subject: [PATCH v1 03/15] md/raid5-cache: Refactor r5l_start() to take a struct r5conf
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 <logang@...tatee.com>
---
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 241c271e836d..0049c4f45e9c 100644
--- a/drivers/md/raid5-cache.c
+++ b/drivers/md/raid5-cache.c
@@ -3032,20 +3032,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 8a98b5e8c04b..c6f877df4f3e 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 bbc0e1101d0f..355760f34cb6 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
Powered by blists - more mailing lists