All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: "Christoph Böhmwalder" <christoph.boehmwalder@linbit.com>,
	"Md. Haris Iqbal" <haris.iqbal@ionos.com>,
	"Jack Wang" <jinpu.wang@ionos.com>, "Song Liu" <song@kernel.org>,
	"Theodore Ts'o" <tytso@mit.edu>,
	"Andreas Dilger" <adilger.kernel@dilger.ca>,
	"Jan Kara" <jack@suse.com>, "Mark Fasheh" <mark@fasheh.com>,
	"Joel Becker" <jlbec@evilplan.org>,
	"Joseph Qi" <joseph.qi@linux.alibaba.com>,
	linux-block@vger.kernel.org, drbd-dev@lists.linbit.com,
	linux-raid@vger.kernel.org, linux-ext4@vger.kernel.org,
	ocfs2-devel@oss.oracle.com
Subject: [PATCH 8/9] ext4: only initialize mmp_bdevname once
Date: Wed, 13 Jul 2022 07:53:16 +0200	[thread overview]
Message-ID: <20220713055317.1888500-9-hch@lst.de> (raw)
In-Reply-To: <20220713055317.1888500-1-hch@lst.de>

mmp_bdevname is currently both initialized nested inside the kthread_run
call in ext4_multi_mount_protect and in the kmmpd thread started by it.

Lift the initiaization out of the kthread_run call in
ext4_multi_mount_protect, move the BUILD_BUG_ON next to it and remove
the duplicate assignment inside of kmmpd.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/ext4/mmp.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/ext4/mmp.c b/fs/ext4/mmp.c
index 79d05e464c432..b7a850b0070b8 100644
--- a/fs/ext4/mmp.c
+++ b/fs/ext4/mmp.c
@@ -150,8 +150,6 @@ static int kmmpd(void *data)
 	mmp_check_interval = max(EXT4_MMP_CHECK_MULT * mmp_update_interval,
 				 EXT4_MMP_MIN_CHECK_INTERVAL);
 	mmp->mmp_check_interval = cpu_to_le16(mmp_check_interval);
-	BUILD_BUG_ON(sizeof(mmp->mmp_bdevname) < BDEVNAME_SIZE);
-	bdevname(bh->b_bdev, mmp->mmp_bdevname);
 
 	memcpy(mmp->mmp_nodename, init_utsname()->nodename,
 	       sizeof(mmp->mmp_nodename));
@@ -372,13 +370,15 @@ int ext4_multi_mount_protect(struct super_block *sb,
 
 	EXT4_SB(sb)->s_mmp_bh = bh;
 
+	BUILD_BUG_ON(sizeof(mmp->mmp_bdevname) < BDEVNAME_SIZE);
+	bdevname(bh->b_bdev, mmp->mmp_bdevname);
+
 	/*
 	 * Start a kernel thread to update the MMP block periodically.
 	 */
 	EXT4_SB(sb)->s_mmp_tsk = kthread_run(kmmpd, sb, "kmmpd-%.*s",
 					     (int)sizeof(mmp->mmp_bdevname),
-					     bdevname(bh->b_bdev,
-						      mmp->mmp_bdevname));
+					     mmp->mmp_bdevname);
 	if (IS_ERR(EXT4_SB(sb)->s_mmp_tsk)) {
 		EXT4_SB(sb)->s_mmp_tsk = NULL;
 		ext4_warning(sb, "Unable to create kmmpd thread for %s.",
-- 
2.30.2


WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig via Ocfs2-devel <ocfs2-devel@oss.oracle.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, "Theodore Ts'o" <tytso@mit.edu>,
	"Song Liu" <song@kernel.org>,
	linux-raid@vger.kernel.org,
	"Christoph Böhmwalder" <christoph.boehmwalder@linbit.com>,
	"Andreas Dilger" <adilger.kernel@dilger.ca>,
	"Jan Kara" <jack@suse.com>,
	"Md. Haris Iqbal" <haris.iqbal@ionos.com>,
	linux-ext4@vger.kernel.org, "Jack Wang" <jinpu.wang@ionos.com>,
	ocfs2-devel@oss.oracle.com, drbd-dev@lists.linbit.com
Subject: [Ocfs2-devel] [PATCH 8/9] ext4: only initialize mmp_bdevname once
Date: Wed, 13 Jul 2022 07:53:16 +0200	[thread overview]
Message-ID: <20220713055317.1888500-9-hch@lst.de> (raw)
In-Reply-To: <20220713055317.1888500-1-hch@lst.de>

mmp_bdevname is currently both initialized nested inside the kthread_run
call in ext4_multi_mount_protect and in the kmmpd thread started by it.

Lift the initiaization out of the kthread_run call in
ext4_multi_mount_protect, move the BUILD_BUG_ON next to it and remove
the duplicate assignment inside of kmmpd.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/ext4/mmp.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/ext4/mmp.c b/fs/ext4/mmp.c
index 79d05e464c432..b7a850b0070b8 100644
--- a/fs/ext4/mmp.c
+++ b/fs/ext4/mmp.c
@@ -150,8 +150,6 @@ static int kmmpd(void *data)
 	mmp_check_interval = max(EXT4_MMP_CHECK_MULT * mmp_update_interval,
 				 EXT4_MMP_MIN_CHECK_INTERVAL);
 	mmp->mmp_check_interval = cpu_to_le16(mmp_check_interval);
-	BUILD_BUG_ON(sizeof(mmp->mmp_bdevname) < BDEVNAME_SIZE);
-	bdevname(bh->b_bdev, mmp->mmp_bdevname);
 
 	memcpy(mmp->mmp_nodename, init_utsname()->nodename,
 	       sizeof(mmp->mmp_nodename));
@@ -372,13 +370,15 @@ int ext4_multi_mount_protect(struct super_block *sb,
 
 	EXT4_SB(sb)->s_mmp_bh = bh;
 
+	BUILD_BUG_ON(sizeof(mmp->mmp_bdevname) < BDEVNAME_SIZE);
+	bdevname(bh->b_bdev, mmp->mmp_bdevname);
+
 	/*
 	 * Start a kernel thread to update the MMP block periodically.
 	 */
 	EXT4_SB(sb)->s_mmp_tsk = kthread_run(kmmpd, sb, "kmmpd-%.*s",
 					     (int)sizeof(mmp->mmp_bdevname),
-					     bdevname(bh->b_bdev,
-						      mmp->mmp_bdevname));
+					     mmp->mmp_bdevname);
 	if (IS_ERR(EXT4_SB(sb)->s_mmp_tsk)) {
 		EXT4_SB(sb)->s_mmp_tsk = NULL;
 		ext4_warning(sb, "Unable to create kmmpd thread for %s.",
-- 
2.30.2


_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel@oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel

  parent reply	other threads:[~2022-07-13  5:54 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-13  5:53 remove bdevname Christoph Hellwig
2022-07-13  5:53 ` [Ocfs2-devel] " Christoph Hellwig via Ocfs2-devel
2022-07-13  5:53 ` [PATCH 1/9] block: stop using bdevname in bdev_write_inode Christoph Hellwig
2022-07-13  5:53   ` [Ocfs2-devel] " Christoph Hellwig via Ocfs2-devel
2022-07-13  5:53 ` [PATCH 2/9] block: stop using bdevname in __blkdev_issue_discard Christoph Hellwig
2022-07-13  5:53 ` [PATCH 3/9] drbd: stop using bdevname in drbd_report_io_error Christoph Hellwig
2022-07-13  5:53   ` [Ocfs2-devel] " Christoph Hellwig via Ocfs2-devel
2022-07-13 12:25   ` Christoph Böhmwalder
2022-07-13  5:53 ` [PATCH 4/9] pktcdvd: stop using bdevname in pkt_seq_show Christoph Hellwig
2022-07-13  5:53 ` [PATCH 5/9] pktcdvd: stop using bdevname in pkt_new_dev Christoph Hellwig
2022-07-13  5:53   ` [Ocfs2-devel] " Christoph Hellwig via Ocfs2-devel
2022-07-13  5:53 ` [PATCH 6/9] rnbd-srv: remove the name field from struct rnbd_dev Christoph Hellwig
2022-07-13  7:03   ` Jinpu Wang
2022-07-13  5:53 ` [PATCH 7/9] ocfs2/cluster: remove the hr_dev_name field from struct o2hb_region Christoph Hellwig
2022-07-13  5:53   ` [Ocfs2-devel] " Christoph Hellwig via Ocfs2-devel
2022-07-13 22:45   ` Joel Becker
2022-07-13  5:53 ` Christoph Hellwig [this message]
2022-07-13  5:53   ` [Ocfs2-devel] [PATCH 8/9] ext4: only initialize mmp_bdevname once Christoph Hellwig via Ocfs2-devel
2022-07-14 14:54   ` Theodore Ts'o
2022-07-14 14:54     ` [Ocfs2-devel] " Theodore Ts'o via Ocfs2-devel
2022-07-13  5:53 ` [PATCH 9/9] block: remove bdevname Christoph Hellwig
2022-07-13  7:27 ` Johannes Thumshirn
2022-07-13  7:27   ` [Ocfs2-devel] " Johannes Thumshirn via Ocfs2-devel
2022-07-13  9:30 ` Chaitanya Kulkarni
2022-07-13 15:05 ` Jan Kara
2022-07-13 15:05   ` [Ocfs2-devel] " Jan Kara via Ocfs2-devel
2022-07-14 16:28 ` Jens Axboe
2022-07-14 16:28   ` [Ocfs2-devel] " Jens Axboe via Ocfs2-devel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220713055317.1888500-9-hch@lst.de \
    --to=hch@lst.de \
    --cc=adilger.kernel@dilger.ca \
    --cc=axboe@kernel.dk \
    --cc=christoph.boehmwalder@linbit.com \
    --cc=drbd-dev@lists.linbit.com \
    --cc=haris.iqbal@ionos.com \
    --cc=jack@suse.com \
    --cc=jinpu.wang@ionos.com \
    --cc=jlbec@evilplan.org \
    --cc=joseph.qi@linux.alibaba.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=mark@fasheh.com \
    --cc=ocfs2-devel@oss.oracle.com \
    --cc=song@kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.