summaryrefslogtreecommitdiff
path: root/fs/ntfs3/super.c
diff options
context:
space:
mode:
authorKari Argillander <kari.argillander@gmail.com>2021-09-07 18:35:51 +0300
committerKonstantin Komarov <almaz.alexandrovich@paragon-software.com>2021-09-09 19:28:52 +0300
commit564c97bdfa39c7d1f331841fb24da6e714693037 (patch)
tree4a94612ee041a83288b2ea928cae7855baaaefcb /fs/ntfs3/super.c
parentc2c389fd6c6b0393549578997744b03822dd2b24 (diff)
downloadlwn-564c97bdfa39c7d1f331841fb24da6e714693037.tar.gz
lwn-564c97bdfa39c7d1f331841fb24da6e714693037.zip
fs/ntfs3: Convert mount options to pointer in sbi
Use pointer to mount options. We want to do this because we will use new mount api which will benefit that we have spi and mount options in different allocations. When we remount we do not have to make whole new spi it is enough that we will allocate just mount options. Please note that we can do example remount lot cleaner but things will change in next patch so this should be just functional. Signed-off-by: Kari Argillander <kari.argillander@gmail.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Diffstat (limited to 'fs/ntfs3/super.c')
-rw-r--r--fs/ntfs3/super.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
index 6cb689605089..0f3820342051 100644
--- a/fs/ntfs3/super.c
+++ b/fs/ntfs3/super.c
@@ -389,11 +389,11 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *data)
return -ENOMEM;
/* Store original options. */
- memcpy(&old_opts, &sbi->options, sizeof(old_opts));
- clear_mount_options(&sbi->options);
- memset(&sbi->options, 0, sizeof(sbi->options));
+ memcpy(&old_opts, sbi->options, sizeof(old_opts));
+ clear_mount_options(sbi->options);
+ memset(sbi->options, 0, sizeof(old_opts));
- err = ntfs_parse_options(sb, data, 0, &sbi->options);
+ err = ntfs_parse_options(sb, data, 0, sbi->options);
if (err)
goto restore_opts;
@@ -409,7 +409,7 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *data)
sync_filesystem(sb);
if (ro_rw && (sbi->volume.flags & VOLUME_FLAG_DIRTY) &&
- !sbi->options.force) {
+ !sbi->options->force) {
ntfs_warn(sb, "volume is dirty and \"force\" flag is not set!");
err = -EINVAL;
goto restore_opts;
@@ -422,8 +422,8 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *data)
goto out;
restore_opts:
- clear_mount_options(&sbi->options);
- memcpy(&sbi->options, &old_opts, sizeof(old_opts));
+ clear_mount_options(sbi->options);
+ memcpy(sbi->options, &old_opts, sizeof(old_opts));
out:
kfree(orig_data);
@@ -506,7 +506,8 @@ static noinline void put_ntfs(struct ntfs_sb_info *sbi)
xpress_free_decompressor(sbi->compress.xpress);
lzx_free_decompressor(sbi->compress.lzx);
#endif
- clear_mount_options(&sbi->options);
+ clear_mount_options(sbi->options);
+ kfree(sbi->options);
kfree(sbi);
}
@@ -545,7 +546,7 @@ static int ntfs_show_options(struct seq_file *m, struct dentry *root)
{
struct super_block *sb = root->d_sb;
struct ntfs_sb_info *sbi = sb->s_fs_info;
- struct ntfs_mount_options *opts = &sbi->options;
+ struct ntfs_mount_options *opts = sbi->options;
struct user_namespace *user_ns = seq_user_ns(m);
if (opts->uid)
@@ -930,6 +931,12 @@ static int ntfs_fill_super(struct super_block *sb, void *data, int silent)
if (!sbi)
return -ENOMEM;
+ sbi->options = kzalloc(sizeof(struct ntfs_mount_options), GFP_NOFS);
+ if (!sbi->options) {
+ kfree(sbi);
+ return -ENOMEM;
+ }
+
sb->s_fs_info = sbi;
sbi->sb = sb;
sb->s_flags |= SB_NODIRATIME;
@@ -942,7 +949,7 @@ static int ntfs_fill_super(struct super_block *sb, void *data, int silent)
ratelimit_state_init(&sbi->msg_ratelimit, DEFAULT_RATELIMIT_INTERVAL,
DEFAULT_RATELIMIT_BURST);
- err = ntfs_parse_options(sb, data, silent, &sbi->options);
+ err = ntfs_parse_options(sb, data, silent, sbi->options);
if (err)
goto out;
@@ -1074,7 +1081,7 @@ static int ntfs_fill_super(struct super_block *sb, void *data, int silent)
goto out;
}
} else if (sbi->volume.flags & VOLUME_FLAG_DIRTY) {
- if (!is_ro && !sbi->options.force) {
+ if (!is_ro && !sbi->options->force) {
ntfs_warn(
sb,
"volume is dirty and \"force\" flag is not set!");
@@ -1394,7 +1401,7 @@ int ntfs_discard(struct ntfs_sb_info *sbi, CLST lcn, CLST len)
if (sbi->flags & NTFS_FLAGS_NODISCARD)
return -EOPNOTSUPP;
- if (!sbi->options.discard)
+ if (!sbi->options->discard)
return -EOPNOTSUPP;
lbo = (u64)lcn << sbi->cluster_bits;