diff options
author | Christoph Hellwig <hch@lst.de> | 2008-06-10 10:40:46 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:04:03 -0400 |
commit | 43e570b08a6c6b1d75f218566a6240542a386fd9 (patch) | |
tree | 3eab1d2b29d348b37788cc03cce84a92850fd35f /fs/btrfs | |
parent | edf24abe51493ccda384644d487fe2f796ac21c8 (diff) |
btrfs: allow scanning multiple devices during mount
Allows to specify one or multiple device=/dev/foo options during mount
so that ioctls on the control device can be avoided. Especially useful
when trying to mount a multi-device setup as root.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/super.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 288300fa5848..346932e546ba 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -65,7 +65,7 @@ static void btrfs_put_super (struct super_block * sb) | |||
65 | } | 65 | } |
66 | 66 | ||
67 | enum { | 67 | enum { |
68 | Opt_degraded, Opt_subvol, Opt_nodatasum, Opt_nodatacow, | 68 | Opt_degraded, Opt_subvol, Opt_device, Opt_nodatasum, Opt_nodatacow, |
69 | Opt_max_extent, Opt_max_inline, Opt_alloc_start, Opt_nobarrier, | 69 | Opt_max_extent, Opt_max_inline, Opt_alloc_start, Opt_nobarrier, |
70 | Opt_ssd, Opt_err, | 70 | Opt_ssd, Opt_err, |
71 | }; | 71 | }; |
@@ -73,6 +73,7 @@ enum { | |||
73 | static match_table_t tokens = { | 73 | static match_table_t tokens = { |
74 | {Opt_degraded, "degraded"}, | 74 | {Opt_degraded, "degraded"}, |
75 | {Opt_subvol, "subvol=%s"}, | 75 | {Opt_subvol, "subvol=%s"}, |
76 | {Opt_device, "device=%s"}, | ||
76 | {Opt_nodatasum, "nodatasum"}, | 77 | {Opt_nodatasum, "nodatasum"}, |
77 | {Opt_nodatacow, "nodatacow"}, | 78 | {Opt_nodatacow, "nodatacow"}, |
78 | {Opt_nobarrier, "nobarrier"}, | 79 | {Opt_nobarrier, "nobarrier"}, |
@@ -142,8 +143,9 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
142 | btrfs_set_opt(info->mount_opt, DEGRADED); | 143 | btrfs_set_opt(info->mount_opt, DEGRADED); |
143 | break; | 144 | break; |
144 | case Opt_subvol: | 145 | case Opt_subvol: |
146 | case Opt_device: | ||
145 | /* | 147 | /* |
146 | * This one is parsed by btrfs_parse_early_options | 148 | * These are parsed by btrfs_parse_early_options |
147 | * and can be happily ignored here. | 149 | * and can be happily ignored here. |
148 | */ | 150 | */ |
149 | break; | 151 | break; |
@@ -212,8 +214,9 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
212 | * All other options will be parsed on much later in the mount process and | 214 | * All other options will be parsed on much later in the mount process and |
213 | * only when we need to allocate a new super block. | 215 | * only when we need to allocate a new super block. |
214 | */ | 216 | */ |
215 | static int btrfs_parse_early_options(const char *options, | 217 | static int btrfs_parse_early_options(const char *options, int flags, |
216 | char **subvol_name) | 218 | void *holder, char **subvol_name, |
219 | struct btrfs_fs_devices **fs_devices) | ||
217 | { | 220 | { |
218 | substring_t args[MAX_OPT_ARGS]; | 221 | substring_t args[MAX_OPT_ARGS]; |
219 | char *opts, *p; | 222 | char *opts, *p; |
@@ -240,11 +243,18 @@ static int btrfs_parse_early_options(const char *options, | |||
240 | case Opt_subvol: | 243 | case Opt_subvol: |
241 | *subvol_name = match_strdup(&args[0]); | 244 | *subvol_name = match_strdup(&args[0]); |
242 | break; | 245 | break; |
246 | case Opt_device: | ||
247 | error = btrfs_scan_one_device(match_strdup(&args[0]), | ||
248 | flags, holder, fs_devices); | ||
249 | if (error) | ||
250 | goto out_free_opts; | ||
251 | break; | ||
243 | default: | 252 | default: |
244 | break; | 253 | break; |
245 | } | 254 | } |
246 | } | 255 | } |
247 | 256 | ||
257 | out_free_opts: | ||
248 | kfree(opts); | 258 | kfree(opts); |
249 | out: | 259 | out: |
250 | /* | 260 | /* |
@@ -380,7 +390,8 @@ static int btrfs_get_sb(struct file_system_type *fs_type, int flags, | |||
380 | struct btrfs_fs_devices *fs_devices = NULL; | 390 | struct btrfs_fs_devices *fs_devices = NULL; |
381 | int error = 0; | 391 | int error = 0; |
382 | 392 | ||
383 | error = btrfs_parse_early_options(data, &subvol_name); | 393 | error = btrfs_parse_early_options(data, flags, fs_type, |
394 | &subvol_name, &fs_devices); | ||
384 | if (error) | 395 | if (error) |
385 | goto error; | 396 | goto error; |
386 | 397 | ||