mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:41:42 +00:00
ext4: make 'abort' mount option handling standard
'abort' mount option is the only mount option that has special handling and sets a bit in sbi->s_mount_flags. There is not strong reason for that so just simplify the code and make 'abort' set a bit in sbi->s_mount_opt2 as any other mount option. This simplifies the code and will allow us to drop EXT4_MF_FS_ABORTED completely in the following patch. Signed-off-by: Jan Kara <jack@suse.cz> Link: https://lore.kernel.org/r/20230616165109.21695-4-jack@suse.cz Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
parent
eb8ab4443a
commit
22b8d707b0
@ -1235,6 +1235,7 @@ struct ext4_inode_info {
|
||||
#define EXT4_MOUNT2_MB_OPTIMIZE_SCAN 0x00000080 /* Optimize group
|
||||
* scanning in mballoc
|
||||
*/
|
||||
#define EXT4_MOUNT2_ABORT 0x00000100 /* Abort filesystem */
|
||||
|
||||
#define clear_opt(sb, opt) EXT4_SB(sb)->s_mount_opt &= \
|
||||
~EXT4_MOUNT_##opt
|
||||
|
@ -1897,6 +1897,7 @@ static const struct mount_opts {
|
||||
{Opt_fc_debug_force, EXT4_MOUNT2_JOURNAL_FAST_COMMIT,
|
||||
MOPT_SET | MOPT_2 | MOPT_EXT4_ONLY},
|
||||
#endif
|
||||
{Opt_abort, EXT4_MOUNT2_ABORT, MOPT_SET | MOPT_2},
|
||||
{Opt_err, 0, 0}
|
||||
};
|
||||
|
||||
@ -1965,8 +1966,6 @@ struct ext4_fs_context {
|
||||
unsigned int mask_s_mount_opt;
|
||||
unsigned int vals_s_mount_opt2;
|
||||
unsigned int mask_s_mount_opt2;
|
||||
unsigned long vals_s_mount_flags;
|
||||
unsigned long mask_s_mount_flags;
|
||||
unsigned int opt_flags; /* MOPT flags */
|
||||
unsigned int spec;
|
||||
u32 s_max_batch_time;
|
||||
@ -2117,12 +2116,6 @@ EXT4_SET_CTX(mount_opt2);
|
||||
EXT4_CLEAR_CTX(mount_opt2);
|
||||
EXT4_TEST_CTX(mount_opt2);
|
||||
|
||||
static inline void ctx_set_mount_flag(struct ext4_fs_context *ctx, int bit)
|
||||
{
|
||||
set_bit(bit, &ctx->mask_s_mount_flags);
|
||||
set_bit(bit, &ctx->vals_s_mount_flags);
|
||||
}
|
||||
|
||||
static int ext4_parse_param(struct fs_context *fc, struct fs_parameter *param)
|
||||
{
|
||||
struct ext4_fs_context *ctx = fc->fs_private;
|
||||
@ -2186,9 +2179,6 @@ static int ext4_parse_param(struct fs_context *fc, struct fs_parameter *param)
|
||||
ext4_msg(NULL, KERN_WARNING, "Ignoring removed %s option",
|
||||
param->key);
|
||||
return 0;
|
||||
case Opt_abort:
|
||||
ctx_set_mount_flag(ctx, EXT4_MF_FS_ABORTED);
|
||||
return 0;
|
||||
case Opt_inlinecrypt:
|
||||
#ifdef CONFIG_FS_ENCRYPTION_INLINE_CRYPT
|
||||
ctx_set_flags(ctx, SB_INLINECRYPT);
|
||||
@ -2842,8 +2832,6 @@ static void ext4_apply_options(struct fs_context *fc, struct super_block *sb)
|
||||
sbi->s_mount_opt |= ctx->vals_s_mount_opt;
|
||||
sbi->s_mount_opt2 &= ~ctx->mask_s_mount_opt2;
|
||||
sbi->s_mount_opt2 |= ctx->vals_s_mount_opt2;
|
||||
sbi->s_mount_flags &= ~ctx->mask_s_mount_flags;
|
||||
sbi->s_mount_flags |= ctx->vals_s_mount_flags;
|
||||
sb->s_flags &= ~ctx->mask_s_flags;
|
||||
sb->s_flags |= ctx->vals_s_flags;
|
||||
|
||||
@ -6497,7 +6485,7 @@ static int __ext4_remount(struct fs_context *fc, struct super_block *sb)
|
||||
goto restore_opts;
|
||||
}
|
||||
|
||||
if (ext4_test_mount_flag(sb, EXT4_MF_FS_ABORTED))
|
||||
if (test_opt2(sb, ABORT))
|
||||
ext4_abort(sb, ESHUTDOWN, "Abort forced by user");
|
||||
|
||||
sb->s_flags = (sb->s_flags & ~SB_POSIXACL) |
|
||||
|
Loading…
Reference in New Issue
Block a user