Make space to save default mount options in super block.
Parse saved default mount options first and then parse mount options given
when the file system is mounted.
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@xxxxxxxxxxxxxx>
---
fs/btrfs/ctree.h | 7 ++++++-
fs/btrfs/super.c | 16 ++++++++++++++--
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 0d195b5..eea6bd0 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -461,8 +461,11 @@ struct btrfs_super_block {
__le64 cache_generation;
+ /* default mount options */
+ __le64 default_mount_opt;
+
/* future expansion */
- __le64 reserved[31];
+ __le64 reserved[30];
u8 sys_chunk_array[BTRFS_SYSTEM_CHUNK_ARRAY_SIZE];
struct btrfs_root_backup super_roots[BTRFS_NUM_BACKUP_ROOTS];
} __attribute__ ((__packed__));
@@ -2581,6 +2584,8 @@ BTRFS_SETGET_STACK_FUNCS(super_csum_type, struct btrfs_super_block,
csum_type, 16);
BTRFS_SETGET_STACK_FUNCS(super_cache_generation, struct btrfs_super_block,
cache_generation, 64);
+BTRFS_SETGET_STACK_FUNCS(super_default_mount_opt, struct btrfs_super_block,
+ default_mount_opt, 64);
static inline int btrfs_super_csum_size(struct btrfs_super_block *s)
{
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index d51aaee..1cadf0e 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -567,13 +567,25 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
struct btrfs_fs_info *info = root->fs_info;
substring_t args[MAX_OPT_ARGS];
char *p, *orig = NULL;
- u64 cache_gen;
+ u64 cache_gen, default_opt;
int ret = 0;
- cache_gen = btrfs_super_cache_generation(root->fs_info->super_copy);
+ cache_gen = btrfs_super_cache_generation(info->super_copy);
if (cache_gen)
btrfs_set_opt(info->mount_opt, SPACE_CACHE);
+ default_opt = btrfs_super_default_mount_opt(info->super_copy);
+ if (default_opt) {
+ int token;
+ for (token = 0; token < Opt_err; token++) {
+ if (default_opt & (1ul << token)) {
+ ret = __btrfs_parse_options(info, token, args);
+ if (ret)
+ return ret;
+ }
+ }
+ }
+
if (!options)
goto out;
--
1.7.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html