All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: linux-ext4@vger.kernel.org
Subject: [PATCH 3/4] jbd2: remove journal_t argument from jbd2_chksum()
Date: Mon, 12 May 2025 22:38:08 -0700	[thread overview]
Message-ID: <20250513053809.699974-4-ebiggers@kernel.org> (raw)
In-Reply-To: <20250513053809.699974-1-ebiggers@kernel.org>

From: Eric Biggers <ebiggers@google.com>

Since jbd2_chksum() no longer uses its journal_t argument, remove it.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 fs/jbd2/commit.c     |  6 +++---
 fs/jbd2/journal.c    |  8 ++++----
 fs/jbd2/recovery.c   | 10 +++++-----
 include/linux/jbd2.h |  3 +--
 4 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
index 1c7c49356878..7203d2d2624d 100644
--- a/fs/jbd2/commit.c
+++ b/fs/jbd2/commit.c
@@ -97,11 +97,11 @@ static void jbd2_commit_block_csum_set(journal_t *j, struct buffer_head *bh)
 
 	h = (struct commit_header *)(bh->b_data);
 	h->h_chksum_type = 0;
 	h->h_chksum_size = 0;
 	h->h_chksum[0] = 0;
-	csum = jbd2_chksum(j, j->j_csum_seed, bh->b_data, j->j_blocksize);
+	csum = jbd2_chksum(j->j_csum_seed, bh->b_data, j->j_blocksize);
 	h->h_chksum[0] = cpu_to_be32(csum);
 }
 
 /*
  * Done it all: now submit the commit record.  We should have
@@ -328,12 +328,12 @@ static void jbd2_block_tag_csum_set(journal_t *j, journal_block_tag_t *tag,
 	if (!jbd2_journal_has_csum_v2or3(j))
 		return;
 
 	seq = cpu_to_be32(sequence);
 	addr = kmap_local_folio(bh->b_folio, bh_offset(bh));
-	csum32 = jbd2_chksum(j, j->j_csum_seed, (__u8 *)&seq, sizeof(seq));
-	csum32 = jbd2_chksum(j, csum32, addr, bh->b_size);
+	csum32 = jbd2_chksum(j->j_csum_seed, (__u8 *)&seq, sizeof(seq));
+	csum32 = jbd2_chksum(csum32, addr, bh->b_size);
 	kunmap_local(addr);
 
 	if (jbd2_has_feature_csum3(j))
 		tag3->t_checksum = cpu_to_be32(csum32);
 	else
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index a5ccba25ff47..255fa03031d8 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -120,11 +120,11 @@ static __be32 jbd2_superblock_csum(journal_t *j, journal_superblock_t *sb)
 	__u32 csum;
 	__be32 old_csum;
 
 	old_csum = sb->s_checksum;
 	sb->s_checksum = 0;
-	csum = jbd2_chksum(j, ~0, (char *)sb, sizeof(journal_superblock_t));
+	csum = jbd2_chksum(~0, (char *)sb, sizeof(journal_superblock_t));
 	sb->s_checksum = old_csum;
 
 	return cpu_to_be32(csum);
 }
 
@@ -1000,11 +1000,11 @@ void jbd2_descriptor_block_csum_set(journal_t *j, struct buffer_head *bh)
 		return;
 
 	tail = (struct jbd2_journal_block_tail *)(bh->b_data + j->j_blocksize -
 			sizeof(struct jbd2_journal_block_tail));
 	tail->t_checksum = 0;
-	csum = jbd2_chksum(j, j->j_csum_seed, bh->b_data, j->j_blocksize);
+	csum = jbd2_chksum(j->j_csum_seed, bh->b_data, j->j_blocksize);
 	tail->t_checksum = cpu_to_be32(csum);
 }
 
 /*
  * Return tid of the oldest transaction in the journal and block in the journal
@@ -1490,11 +1490,11 @@ static int journal_load_superblock(journal_t *journal)
 
 	if (be32_to_cpu(sb->s_maxlen) < journal->j_total_len)
 		journal->j_total_len = be32_to_cpu(sb->s_maxlen);
 	/* Precompute checksum seed for all metadata */
 	if (jbd2_journal_has_csum_v2or3(journal))
-		journal->j_csum_seed = jbd2_chksum(journal, ~0, sb->s_uuid,
+		journal->j_csum_seed = jbd2_chksum(~0, sb->s_uuid,
 						   sizeof(sb->s_uuid));
 	/* After journal features are set, we can compute transaction limits */
 	jbd2_journal_init_transaction_limits(journal);
 
 	if (jbd2_has_feature_fast_commit(journal)) {
@@ -2336,11 +2336,11 @@ int jbd2_journal_set_features(journal_t *journal, unsigned long compat,
 	/* If enabling v3 checksums, update superblock and precompute seed */
 	if (INCOMPAT_FEATURE_ON(JBD2_FEATURE_INCOMPAT_CSUM_V3)) {
 		sb->s_checksum_type = JBD2_CRC32C_CHKSUM;
 		sb->s_feature_compat &=
 			~cpu_to_be32(JBD2_FEATURE_COMPAT_CHECKSUM);
-		journal->j_csum_seed = jbd2_chksum(journal, ~0, sb->s_uuid,
+		journal->j_csum_seed = jbd2_chksum(~0, sb->s_uuid,
 						   sizeof(sb->s_uuid));
 	}
 
 	/* If enabling v1 checksums, downgrade superblock */
 	if (COMPAT_FEATURE_ON(JBD2_FEATURE_COMPAT_CHECKSUM))
diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c
index c271a050b7e6..cac8c2cd4a92 100644
--- a/fs/jbd2/recovery.c
+++ b/fs/jbd2/recovery.c
@@ -183,11 +183,11 @@ static int jbd2_descriptor_block_csum_verify(journal_t *j, void *buf)
 
 	tail = (struct jbd2_journal_block_tail *)((char *)buf +
 		j->j_blocksize - sizeof(struct jbd2_journal_block_tail));
 	provided = tail->t_checksum;
 	tail->t_checksum = 0;
-	calculated = jbd2_chksum(j, j->j_csum_seed, buf, j->j_blocksize);
+	calculated = jbd2_chksum(j->j_csum_seed, buf, j->j_blocksize);
 	tail->t_checksum = provided;
 
 	return provided == cpu_to_be32(calculated);
 }
 
@@ -438,11 +438,11 @@ static int jbd2_commit_block_csum_verify(journal_t *j, void *buf)
 		return 1;
 
 	h = buf;
 	provided = h->h_chksum[0];
 	h->h_chksum[0] = 0;
-	calculated = jbd2_chksum(j, j->j_csum_seed, buf, j->j_blocksize);
+	calculated = jbd2_chksum(j->j_csum_seed, buf, j->j_blocksize);
 	h->h_chksum[0] = provided;
 
 	return provided == cpu_to_be32(calculated);
 }
 
@@ -459,11 +459,11 @@ static bool jbd2_commit_block_csum_verify_partial(journal_t *j, void *buf)
 
 	memcpy(tmpbuf, buf, sizeof(struct commit_header));
 	h = tmpbuf;
 	provided = h->h_chksum[0];
 	h->h_chksum[0] = 0;
-	calculated = jbd2_chksum(j, j->j_csum_seed, tmpbuf, j->j_blocksize);
+	calculated = jbd2_chksum(j->j_csum_seed, tmpbuf, j->j_blocksize);
 	kfree(tmpbuf);
 
 	return provided == cpu_to_be32(calculated);
 }
 
@@ -476,12 +476,12 @@ static int jbd2_block_tag_csum_verify(journal_t *j, journal_block_tag_t *tag,
 
 	if (!jbd2_journal_has_csum_v2or3(j))
 		return 1;
 
 	seq = cpu_to_be32(sequence);
-	csum32 = jbd2_chksum(j, j->j_csum_seed, (__u8 *)&seq, sizeof(seq));
-	csum32 = jbd2_chksum(j, csum32, buf, j->j_blocksize);
+	csum32 = jbd2_chksum(j->j_csum_seed, (__u8 *)&seq, sizeof(seq));
+	csum32 = jbd2_chksum(csum32, buf, j->j_blocksize);
 
 	if (jbd2_has_feature_csum3(j))
 		return tag3->t_checksum == cpu_to_be32(csum32);
 	else
 		return tag->t_checksum == cpu_to_be16(csum32);
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 023e8abdb99a..b04d554e0992 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -1764,12 +1764,11 @@ static inline unsigned long jbd2_log_space_left(journal_t *journal)
 #define BJ_Forget	2	/* Buffer superseded by this transaction */
 #define BJ_Shadow	3	/* Buffer contents being shadowed to the log */
 #define BJ_Reserved	4	/* Buffer is reserved for access by journal */
 #define BJ_Types	5
 
-static inline u32 jbd2_chksum(journal_t *journal, u32 crc,
-			      const void *address, unsigned int length)
+static inline u32 jbd2_chksum(u32 crc, const void *address, unsigned int length)
 {
 	return crc32c(crc, address, length);
 }
 
 /* Return most recent uncommitted transaction */
-- 
2.49.0


  parent reply	other threads:[~2025-05-13  5:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-13  5:38 [PATCH 0/4] ext4,jbd2: clean up unused arguments to checksum functions Eric Biggers
2025-05-13  5:38 ` [PATCH 1/4] ext4: remove sbi argument from ext4_chksum() Eric Biggers
2025-05-13  6:13   ` Baokun Li
2025-05-13  5:38 ` [PATCH 2/4] ext4: remove sb argument from ext4_superblock_csum() Eric Biggers
2025-05-13  6:17   ` Baokun Li
2025-05-13  5:38 ` Eric Biggers [this message]
2025-05-13  6:19   ` [PATCH 3/4] jbd2: remove journal_t argument from jbd2_chksum() Baokun Li
2025-05-13  5:38 ` [PATCH 4/4] jbd2: remove journal_t argument from jbd2_superblock_csum() Eric Biggers
2025-05-13  6:21   ` Baokun Li
2025-05-20 14:40 ` [PATCH 0/4] ext4,jbd2: clean up unused arguments to checksum functions Theodore Ts'o

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=20250513053809.699974-4-ebiggers@kernel.org \
    --to=ebiggers@kernel.org \
    --cc=linux-ext4@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 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.