linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ext4: enable journal checksum if metadata checksum feature enabled
@ 2014-10-21  1:05 Darrick J. Wong
  2014-10-21  1:05 ` [PATCH 2/2] ext4: create nojournal_checksum mount option Darrick J. Wong
  0 siblings, 1 reply; 3+ messages in thread
From: Darrick J. Wong @ 2014-10-21  1:05 UTC (permalink / raw)
  To: tytso, darrick.wong; +Cc: linux-ext4

If metadata checksumming is turned on for the FS, we might as well
enable it for the journal too.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/ext4/super.c |    4 ++++
 1 file changed, 4 insertions(+)


diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index de38a96..5d51dbf 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3506,6 +3506,10 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 #ifdef CONFIG_EXT4_FS_POSIX_ACL
 	set_opt(sb, POSIX_ACL);
 #endif
+	/* if metadata_csum, journal_csum is now defaulted on */
+	if (ext4_has_metadata_csum(sb))
+		set_opt(sb, JOURNAL_CHECKSUM);
+
 	if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_DATA)
 		set_opt(sb, JOURNAL_DATA);
 	else if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_ORDERED)


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] ext4: create nojournal_checksum mount option
  2014-10-21  1:05 [PATCH 1/2] ext4: enable journal checksum if metadata checksum feature enabled Darrick J. Wong
@ 2014-10-21  1:05 ` Darrick J. Wong
  2014-11-25 21:21   ` Theodore Ts'o
  0 siblings, 1 reply; 3+ messages in thread
From: Darrick J. Wong @ 2014-10-21  1:05 UTC (permalink / raw)
  To: tytso, darrick.wong; +Cc: linux-ext4

Create a mount option to disable journal checksumming (because the
metadata_csum feature turns it on by default now), and fix remount not
to allow changing the journal checksumming option, since changing the
mount options has no effect on the journal.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/ext4/super.c |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)


diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 5d51dbf..bf46927 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1166,7 +1166,7 @@ enum {
 	Opt_inode_readahead_blks, Opt_journal_ioprio,
 	Opt_dioread_nolock, Opt_dioread_lock,
 	Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable,
-	Opt_max_dir_size_kb,
+	Opt_max_dir_size_kb, Opt_nojournal_checksum,
 };
 
 static const match_table_t tokens = {
@@ -1200,6 +1200,7 @@ static const match_table_t tokens = {
 	{Opt_journal_dev, "journal_dev=%u"},
 	{Opt_journal_path, "journal_path=%s"},
 	{Opt_journal_checksum, "journal_checksum"},
+	{Opt_nojournal_checksum, "nojournal_checksum"},
 	{Opt_journal_async_commit, "journal_async_commit"},
 	{Opt_abort, "abort"},
 	{Opt_data_journal, "data=journal"},
@@ -1381,6 +1382,8 @@ static const struct mount_opts {
 	 MOPT_EXT4_ONLY | MOPT_SET | MOPT_EXPLICIT},
 	{Opt_nodelalloc, EXT4_MOUNT_DELALLOC,
 	 MOPT_EXT4_ONLY | MOPT_CLEAR},
+	{Opt_nojournal_checksum, EXT4_MOUNT_JOURNAL_CHECKSUM,
+	 MOPT_EXT4_ONLY | MOPT_CLEAR},
 	{Opt_journal_checksum, EXT4_MOUNT_JOURNAL_CHECKSUM,
 	 MOPT_EXT4_ONLY | MOPT_SET},
 	{Opt_journal_async_commit, (EXT4_MOUNT_JOURNAL_ASYNC_COMMIT |
@@ -4837,6 +4840,14 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
 		goto restore_opts;
 	}
 
+	if ((old_opts.s_mount_opt & EXT4_MOUNT_JOURNAL_CHECKSUM) ^
+	    test_opt(sb, JOURNAL_CHECKSUM)) {
+		ext4_msg(sb, KERN_ERR, "changing journal_checksum "
+			 "during remount not supported");
+		err = -EINVAL;
+		goto restore_opts;
+	}
+
 	if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) {
 		if (test_opt2(sb, EXPLICIT_DELALLOC)) {
 			ext4_msg(sb, KERN_ERR, "can't mount with "


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] ext4: create nojournal_checksum mount option
  2014-10-21  1:05 ` [PATCH 2/2] ext4: create nojournal_checksum mount option Darrick J. Wong
@ 2014-11-25 21:21   ` Theodore Ts'o
  0 siblings, 0 replies; 3+ messages in thread
From: Theodore Ts'o @ 2014-11-25 21:21 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-ext4

On Mon, Oct 20, 2014 at 06:05:07PM -0700, Darrick J. Wong wrote:
> Create a mount option to disable journal checksumming (because the
> metadata_csum feature turns it on by default now), and fix remount not
> to allow changing the journal checksumming option, since changing the
> mount options has no effect on the journal.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Applied, thanks.

					- Ted

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-11-25 21:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-21  1:05 [PATCH 1/2] ext4: enable journal checksum if metadata checksum feature enabled Darrick J. Wong
2014-10-21  1:05 ` [PATCH 2/2] ext4: create nojournal_checksum mount option Darrick J. Wong
2014-11-25 21:21   ` Theodore Ts'o

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 NNTP newsgroup(s).