diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-12-14 15:30:32 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:03:58 -0400 |
commit | b6cda9bcb4df7544c67fc3548a53bc1607d59f46 (patch) | |
tree | 2bae71b1c9eca52bf1e37ca1b3bdd4525e0a43fd /fs/btrfs/super.c | |
parent | e9906a98497c26a3c1a7532b51b81cc1fbdf9e1d (diff) |
Btrfs: Add mount -o nodatasum to turn of file data checksumming
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r-- | fs/btrfs/super.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index ffa02872c4d6..ad4f280ec777 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -61,11 +61,12 @@ static void btrfs_put_super (struct super_block * sb) | |||
61 | } | 61 | } |
62 | 62 | ||
63 | enum { | 63 | enum { |
64 | Opt_subvol, Opt_err, | 64 | Opt_subvol, Opt_nodatasum, Opt_err, |
65 | }; | 65 | }; |
66 | 66 | ||
67 | static match_table_t tokens = { | 67 | static match_table_t tokens = { |
68 | {Opt_subvol, "subvol=%s"}, | 68 | {Opt_subvol, "subvol=%s"}, |
69 | {Opt_nodatasum, "nodatasum"}, | ||
69 | {Opt_err, NULL} | 70 | {Opt_err, NULL} |
70 | }; | 71 | }; |
71 | 72 | ||
@@ -74,7 +75,12 @@ static int parse_options (char * options, | |||
74 | char **subvol_name) | 75 | char **subvol_name) |
75 | { | 76 | { |
76 | char * p; | 77 | char * p; |
78 | struct btrfs_fs_info *info = NULL; | ||
77 | substring_t args[MAX_OPT_ARGS]; | 79 | substring_t args[MAX_OPT_ARGS]; |
80 | |||
81 | if (root) | ||
82 | info = root->fs_info; | ||
83 | |||
78 | if (!options) | 84 | if (!options) |
79 | return 1; | 85 | return 1; |
80 | 86 | ||
@@ -86,7 +92,12 @@ static int parse_options (char * options, | |||
86 | token = match_token(p, tokens, args); | 92 | token = match_token(p, tokens, args); |
87 | switch (token) { | 93 | switch (token) { |
88 | case Opt_subvol: | 94 | case Opt_subvol: |
89 | *subvol_name = match_strdup(&args[0]); | 95 | if (subvol_name) |
96 | *subvol_name = match_strdup(&args[0]); | ||
97 | break; | ||
98 | case Opt_nodatasum: | ||
99 | if (root) | ||
100 | btrfs_set_opt(info->mount_opt, NODATASUM); | ||
90 | break; | 101 | break; |
91 | default: | 102 | default: |
92 | return 0; | 103 | return 0; |
@@ -143,6 +154,8 @@ static int btrfs_fill_super(struct super_block * sb, void * data, int silent) | |||
143 | goto fail_close; | 154 | goto fail_close; |
144 | } | 155 | } |
145 | 156 | ||
157 | parse_options((char *)data, tree_root, NULL); | ||
158 | |||
146 | /* this does the super kobj at the same time */ | 159 | /* this does the super kobj at the same time */ |
147 | err = btrfs_sysfs_add_super(tree_root->fs_info); | 160 | err = btrfs_sysfs_add_super(tree_root->fs_info); |
148 | if (err) | 161 | if (err) |