Reiserfs development archive or lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: Jan Kara <jack@suse.cz>, Christoph Hellwig <hch@lst.de>
Cc: reiserfs-devel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Christian Brauner <brauner@kernel.org>
Subject: [PATCH 1/4] reiserfs: user superblock as holder for journal device
Date: Mon, 09 Oct 2023 14:33:38 +0200	[thread overview]
Message-ID: <20231009-vfs-fixes-reiserfs-v1-1-723a2f1132ce@kernel.org> (raw)
In-Reply-To: <20231009-vfs-fixes-reiserfs-v1-0-723a2f1132ce@kernel.org>

I see no reason to use the journal as the holder of the block device.
The superblock should be used. In the case were the journal and main
device are the same we can easily reclaim because the same holder is
used.

Signed-off-by: Christian Brauner <brauner@kernel.org>
---
 fs/reiserfs/journal.c | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index 015bfe4e4524..b9d9bf26d108 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -2591,12 +2591,7 @@ static void release_journal_dev(struct super_block *super,
 			       struct reiserfs_journal *journal)
 {
 	if (journal->j_dev_bd != NULL) {
-		void *holder = NULL;
-
-		if (journal->j_dev_bd->bd_dev != super->s_dev)
-			holder = journal;
-
-		blkdev_put(journal->j_dev_bd, holder);
+		blkdev_put(journal->j_dev_bd, super);
 		journal->j_dev_bd = NULL;
 	}
 }
@@ -2606,7 +2601,6 @@ static int journal_init_dev(struct super_block *super,
 			    const char *jdev_name)
 {
 	blk_mode_t blkdev_mode = BLK_OPEN_READ;
-	void *holder = journal;
 	int result;
 	dev_t jdev;
 
@@ -2621,10 +2615,8 @@ static int journal_init_dev(struct super_block *super,
 
 	/* there is no "jdev" option and journal is on separate device */
 	if ((!jdev_name || !jdev_name[0])) {
-		if (jdev == super->s_dev)
-			holder = NULL;
-		journal->j_dev_bd = blkdev_get_by_dev(jdev, blkdev_mode, holder,
-						      NULL);
+		journal->j_dev_bd = blkdev_get_by_dev(jdev, blkdev_mode, super,
+						      &fs_holder_ops);
 		if (IS_ERR(journal->j_dev_bd)) {
 			result = PTR_ERR(journal->j_dev_bd);
 			journal->j_dev_bd = NULL;
@@ -2638,8 +2630,8 @@ static int journal_init_dev(struct super_block *super,
 		return 0;
 	}
 
-	journal->j_dev_bd = blkdev_get_by_path(jdev_name, blkdev_mode, holder,
-					       NULL);
+	journal->j_dev_bd = blkdev_get_by_path(jdev_name, blkdev_mode, super,
+					       &fs_holder_ops);
 	if (IS_ERR(journal->j_dev_bd)) {
 		result = PTR_ERR(journal->j_dev_bd);
 		journal->j_dev_bd = NULL;

-- 
2.34.1


  reply	other threads:[~2023-10-09 12:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-09 12:33 [PATCH 0/4] reiserfs: fixes Christian Brauner
2023-10-09 12:33 ` Christian Brauner [this message]
2023-10-09 14:12   ` [PATCH 1/4] reiserfs: user superblock as holder for journal device Jan Kara
2023-10-09 12:33 ` [PATCH 2/4] reiserfs: centralize freeing of reiserfs info Christian Brauner
2023-10-09 14:15   ` Jan Kara
2023-10-09 12:33 ` [PATCH 3/4] reiserfs: centralize journal device closing Christian Brauner
2023-10-09 14:20   ` Jan Kara
2023-10-09 12:33 ` [PATCH 4/4] reiserfs: fix journal device opening Christian Brauner
2023-10-09 14:25   ` Jan Kara
2023-10-09 16:16   ` Christian Brauner
2023-10-09 16:33     ` Jan Kara
     [not found]       ` <CAHrFyr6sjz+MM4vAzwHKwasuQi=_dhGM+3JAJkp8A0Hu4gDtbg@mail.gmail.com>
2023-10-10 12:41         ` Jan Kara

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=20231009-vfs-fixes-reiserfs-v1-1-723a2f1132ce@kernel.org \
    --to=brauner@kernel.org \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=reiserfs-devel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).