2020-04-08 22:00:30

by harshad shirwadkar

[permalink] [raw]
Subject: [PATCH v6 02/20] ext4: add handling for extended mount options

From: Harshad Shirwadkar <[email protected]>

We are running out of mount option bits. Add handling for using
s_mount_opt2. Add ability to turn on / off the fast commit
feature and to turn on / off fast commit soft consistency option.

Signed-off-by: Harshad Shirwadkar <[email protected]>
---
fs/ext4/ext4.h | 7 +++++++
fs/ext4/super.c | 23 +++++++++++++++++++----
2 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 91eb4381cae5..7c3d89007eca 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1172,6 +1172,13 @@ struct ext4_inode_info {
#define EXT4_MOUNT2_EXPLICIT_JOURNAL_CHECKSUM 0x00000008 /* User explicitly
specified journal checksum */

+#define EXT4_MOUNT2_JOURNAL_FAST_COMMIT 0x00000010 /* Journal fast commit */
+
+#define EXT4_MOUNT2_JOURNAL_FC_SOFT_CONSISTENCY 0x00000020 /* Soft consistency
+ * mode for fast
+ * commits
+ */
+
#define clear_opt(sb, opt) EXT4_SB(sb)->s_mount_opt &= \
~EXT4_MOUNT_##opt
#define set_opt(sb, opt) EXT4_SB(sb)->s_mount_opt |= \
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 9728e7b0e84f..70aaea283a63 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1523,6 +1523,7 @@ enum {
Opt_dioread_nolock, Opt_dioread_lock,
Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable,
Opt_max_dir_size_kb, Opt_nojournal_checksum, Opt_nombcache,
+ Opt_no_fc, Opt_fc_soft_consistency
};

static const match_table_t tokens = {
@@ -1606,6 +1607,8 @@ static const match_table_t tokens = {
{Opt_init_itable, "init_itable=%u"},
{Opt_init_itable, "init_itable"},
{Opt_noinit_itable, "noinit_itable"},
+ {Opt_no_fc, "no_fc"},
+ {Opt_fc_soft_consistency, "fc_soft_consistency"},
{Opt_max_dir_size_kb, "max_dir_size_kb=%u"},
{Opt_test_dummy_encryption, "test_dummy_encryption"},
{Opt_nombcache, "nombcache"},
@@ -1728,6 +1731,7 @@ static int clear_qf_name(struct super_block *sb, int qtype)
#define MOPT_NO_EXT3 0x0200
#define MOPT_EXT4_ONLY (MOPT_NO_EXT2 | MOPT_NO_EXT3)
#define MOPT_STRING 0x0400
+#define MOPT_2 0x0800

static const struct mount_opts {
int token;
@@ -1820,6 +1824,10 @@ static const struct mount_opts {
{Opt_max_dir_size_kb, 0, MOPT_GTE0},
{Opt_test_dummy_encryption, 0, MOPT_GTE0},
{Opt_nombcache, EXT4_MOUNT_NO_MBCACHE, MOPT_SET},
+ {Opt_no_fc, EXT4_MOUNT2_JOURNAL_FAST_COMMIT,
+ MOPT_CLEAR | MOPT_2 | MOPT_EXT4_ONLY},
+ {Opt_fc_soft_consistency, EXT4_MOUNT2_JOURNAL_FC_SOFT_CONSISTENCY,
+ MOPT_SET | MOPT_2 | MOPT_EXT4_ONLY},
{Opt_err, 0, 0}
};

@@ -2110,10 +2118,17 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
WARN_ON(1);
return -1;
}
- if (arg != 0)
- sbi->s_mount_opt |= m->mount_opt;
- else
- sbi->s_mount_opt &= ~m->mount_opt;
+ if (m->flags & MOPT_2) {
+ if (arg != 0)
+ sbi->s_mount_opt2 |= m->mount_opt;
+ else
+ sbi->s_mount_opt2 &= ~m->mount_opt;
+ } else {
+ if (arg != 0)
+ sbi->s_mount_opt |= m->mount_opt;
+ else
+ sbi->s_mount_opt &= ~m->mount_opt;
+ }
}
return 1;
}
--
2.26.0.110.g2183baf09c-goog


2020-04-09 19:48:19

by Andreas Dilger

[permalink] [raw]
Subject: Re: [PATCH v6 02/20] ext4: add handling for extended mount options


> On Apr 8, 2020, at 3:55 PM, Harshad Shirwadkar <[email protected]> wrote:
>
> From: Harshad Shirwadkar <[email protected]>
>
> We are running out of mount option bits. Add handling for using
> s_mount_opt2. Add ability to turn on / off the fast commit
> feature and to turn on / off fast commit soft consistency option.
>
> Signed-off-by: Harshad Shirwadkar <[email protected]>

Reviewed-by: Andreas Dilger <[email protected]>

> ---
> fs/ext4/ext4.h | 7 +++++++
> fs/ext4/super.c | 23 +++++++++++++++++++----
> 2 files changed, 26 insertions(+), 4 deletions(-)
>
> diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
> index 91eb4381cae5..7c3d89007eca 100644
> --- a/fs/ext4/ext4.h
> +++ b/fs/ext4/ext4.h
> @@ -1172,6 +1172,13 @@ struct ext4_inode_info {
> #define EXT4_MOUNT2_EXPLICIT_JOURNAL_CHECKSUM 0x00000008 /* User explicitly
> specified journal checksum */
>
> +#define EXT4_MOUNT2_JOURNAL_FAST_COMMIT 0x00000010 /* Journal fast commit */
> +
> +#define EXT4_MOUNT2_JOURNAL_FC_SOFT_CONSISTENCY 0x00000020 /* Soft consistency
> + * mode for fast
> + * commits
> + */
> +
> #define clear_opt(sb, opt) EXT4_SB(sb)->s_mount_opt &= \
> ~EXT4_MOUNT_##opt
> #define set_opt(sb, opt) EXT4_SB(sb)->s_mount_opt |= \
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 9728e7b0e84f..70aaea283a63 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -1523,6 +1523,7 @@ enum {
> Opt_dioread_nolock, Opt_dioread_lock,
> Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable,
> Opt_max_dir_size_kb, Opt_nojournal_checksum, Opt_nombcache,
> + Opt_no_fc, Opt_fc_soft_consistency
> };
>
> static const match_table_t tokens = {
> @@ -1606,6 +1607,8 @@ static const match_table_t tokens = {
> {Opt_init_itable, "init_itable=%u"},
> {Opt_init_itable, "init_itable"},
> {Opt_noinit_itable, "noinit_itable"},
> + {Opt_no_fc, "no_fc"},
> + {Opt_fc_soft_consistency, "fc_soft_consistency"},
> {Opt_max_dir_size_kb, "max_dir_size_kb=%u"},
> {Opt_test_dummy_encryption, "test_dummy_encryption"},
> {Opt_nombcache, "nombcache"},
> @@ -1728,6 +1731,7 @@ static int clear_qf_name(struct super_block *sb, int qtype)
> #define MOPT_NO_EXT3 0x0200
> #define MOPT_EXT4_ONLY (MOPT_NO_EXT2 | MOPT_NO_EXT3)
> #define MOPT_STRING 0x0400
> +#define MOPT_2 0x0800
>
> static const struct mount_opts {
> int token;
> @@ -1820,6 +1824,10 @@ static const struct mount_opts {
> {Opt_max_dir_size_kb, 0, MOPT_GTE0},
> {Opt_test_dummy_encryption, 0, MOPT_GTE0},
> {Opt_nombcache, EXT4_MOUNT_NO_MBCACHE, MOPT_SET},
> + {Opt_no_fc, EXT4_MOUNT2_JOURNAL_FAST_COMMIT,
> + MOPT_CLEAR | MOPT_2 | MOPT_EXT4_ONLY},
> + {Opt_fc_soft_consistency, EXT4_MOUNT2_JOURNAL_FC_SOFT_CONSISTENCY,
> + MOPT_SET | MOPT_2 | MOPT_EXT4_ONLY},
> {Opt_err, 0, 0}
> };
>
> @@ -2110,10 +2118,17 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
> WARN_ON(1);
> return -1;
> }
> - if (arg != 0)
> - sbi->s_mount_opt |= m->mount_opt;
> - else
> - sbi->s_mount_opt &= ~m->mount_opt;
> + if (m->flags & MOPT_2) {
> + if (arg != 0)
> + sbi->s_mount_opt2 |= m->mount_opt;
> + else
> + sbi->s_mount_opt2 &= ~m->mount_opt;
> + } else {
> + if (arg != 0)
> + sbi->s_mount_opt |= m->mount_opt;
> + else
> + sbi->s_mount_opt &= ~m->mount_opt;
> + }
> }
> return 1;
> }
> --
> 2.26.0.110.g2183baf09c-goog
>


Cheers, Andreas






Attachments:
signature.asc (890.00 B)
Message signed with OpenPGP