From: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH v2 4/4] btrfs: support default mount options
Date: Fri, 12 Oct 2012 12:25:12 +0900 [thread overview]
Message-ID: <50778D98.50804@jp.fujitsu.com> (raw)
In-Reply-To: <50778C1D.4060807@jp.fujitsu.com>
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@jp.fujitsu.com>
---
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
prev parent reply other threads:[~2012-10-12 3:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-12 3:18 [PATCH v2 0/4] Btrfs: set mount options permanently Hidetoshi Seto
2012-10-12 3:24 ` [PATCH v2 1/4] Btrfs-progs: add mount-option command Hidetoshi Seto
2012-10-12 5:35 ` Tsutomu Itoh
2012-10-12 8:21 ` Tsutomu Itoh
2012-10-12 3:24 ` [PATCH v2 2/4] Btrfs-progs: add mount-option command man page Hidetoshi Seto
2012-10-14 9:04 ` Goffredo Baroncelli
2012-10-12 3:24 ` [PATCH v2 3/4] btrfs: make subroutine __btrfs_parse_options Hidetoshi Seto
2012-10-12 3:25 ` Hidetoshi Seto [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50778D98.50804@jp.fujitsu.com \
--to=seto.hidetoshi@jp.fujitsu.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.