All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH, RFC] btrfs: allow scanning multiple devices during mount
Date: Tue, 10 Jun 2008 15:23:52 +0200	[thread overview]
Message-ID: <20080610132352.GA1852@lst.de> (raw)

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>

Index: btrfs-unstable/super.c
===================================================================
--- btrfs-unstable.orig/super.c	2008-06-10 10:40:18.000000000 +0200
+++ btrfs-unstable/super.c	2008-06-10 10:47:47.000000000 +0200
@@ -65,7 +65,7 @@ static void btrfs_put_super (struct supe
 }
 
 enum {
-	Opt_degraded, Opt_subvol, Opt_nodatasum, Opt_nodatacow,
+	Opt_degraded, Opt_subvol, Opt_device, Opt_nodatasum, Opt_nodatacow,
 	Opt_max_extent, Opt_max_inline, Opt_alloc_start, Opt_nobarrier,
 	Opt_ssd, Opt_err,
 };
@@ -73,6 +73,7 @@ enum {
 static match_table_t tokens = {
 	{Opt_degraded, "degraded"},
 	{Opt_subvol, "subvol=%s"},
+	{Opt_device, "device=%s"},
 	{Opt_nodatasum, "nodatasum"},
 	{Opt_nodatacow, "nodatacow"},
 	{Opt_nobarrier, "nobarrier"},
@@ -142,8 +143,9 @@ int btrfs_parse_options(struct btrfs_roo
 			btrfs_set_opt(info->mount_opt, DEGRADED);
 			break;
 		case Opt_subvol:
+		case Opt_device:
 			/*
-			 * This one is parsed by btrfs_parse_early_options
+			 * These are parsed by btrfs_parse_early_options
 			 * and can be happily ignored here.
 			 */
 			break;
@@ -212,8 +214,9 @@ int btrfs_parse_options(struct btrfs_roo
  * All other options will be parsed on much later in the mount process and
  * only when we need to allocate a new super block.
  */
-static int btrfs_parse_early_options(const char *options,
-			char **subvol_name)
+static int btrfs_parse_early_options(const char *options, int flags,
+		void *holder, char **subvol_name,
+		struct btrfs_fs_devices **fs_devices)
 {
 	substring_t args[MAX_OPT_ARGS];
 	char *opts, *p;
@@ -240,11 +243,18 @@ static int btrfs_parse_early_options(con
 		case Opt_subvol:
 			*subvol_name = match_strdup(&args[0]);
 			break;
+		case Opt_device:
+			error = btrfs_scan_one_device(match_strdup(&args[0]),
+					flags, holder, fs_devices);
+			if (error)
+				goto out_free_opts;
+			break;
 		default:
 			break;
 		}
 	}
 
+ out_free_opts:
 	kfree(opts);
  out:
 	/*
@@ -380,7 +390,8 @@ static int btrfs_get_sb(struct file_syst
 	struct btrfs_fs_devices *fs_devices = NULL;
 	int error = 0;
 
-	error = btrfs_parse_early_options(data, &subvol_name);
+	error = btrfs_parse_early_options(data, flags, fs_type,
+					  &subvol_name, &fs_devices);
 	if (error)
 		goto error;
 

             reply	other threads:[~2008-06-10 13:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-10 13:23 Christoph Hellwig [this message]
2008-06-10 14:47 ` [PATCH, RFC] btrfs: allow scanning multiple devices during mount Chris Mason

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=20080610132352.GA1852@lst.de \
    --to=hch@lst.de \
    --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.