Re: [RFC PATCH v2 2/2] init: boot to device-mapper targets withoutan initr*

From: Randy Dunlap
Date: Mon May 17 2010 - 14:22:29 EST


On Mon, 17 May 2010 13:13:48 -0500 Will Drewry wrote:

> On Mon, May 17, 2010 at 11:47 AM, Randy Dunlap <randy.dunlap@xxxxxxxxxx> wrote:
> > On Fri, 14 May 2010 20:41:41 -0500 Will Drewry wrote:
> >
> >> Add a dm= kernel parameter modeled after the md= parameter from
> >> do_mounts_md.  It allows for device-mapper targets to be configured at
> >> boot time for use early in the boot process (as the root device or
> >> otherwise).
> >
> > dm=<blah>
> > documentation needs to be added to Documentation/kernel-parameters.txt and/or
> > Documentation/md.txt.
>
> Absolutely -- I've appended a proposed version below which I'll include in the
> next round. I'm not a lkml veteran, so if it makes sense to resend
> the full patchset
> again with it, I can. Otherwise, I'll wait for comments on the code too.

OK, thanks for the doc update. One typo noted below.


> >> The format is dm="name uuid ro,table line 1,table line 2,...".  The
> >> parser expects the comma to be safe to use as a newline substitute but,
> >> otherwise, uses the normal separator of space.  Some attempt has been
> >> made to make it forgiving of additional spaces (using skip_spaces()).
> >
> > This "space in the arg string" has been tested, right?
>
> Works for me so far. I've tested this on a user mode linux instance and
> a real x86 machine with the dm-linear target and a custom dm target
> (which I'll be
> mailing to dm-devel@ for feedback later this week).
>
> > It seems a bit odd to me.  Most kernel parameter strings that I am familiar with
> > use punctuation for separating parameter parts.
>
> Yup - I agree. My first cut I used commas with an empty ,, delimiter as a new
> line. Then I ran across this in the source:
>
> kernel/params.c
> 76 /* You can use " around spaces, but can't escape ". */
> 77 /* Hyphens and underscores equivalent in parameter names. */
> 78 static char *next_arg(char *args, char **param, char **val)
>
> I will need to cross-check all the known dm targets to make sure that
> they don't expect quoted internal strings. In my first look, I didn't see any.
>
> However, I'm perfectly content with either approach so if there's a preference,
> I'll rework it to make it happen. This approach just maps more cleanly to the
> existing experience of configuring a mapped device.
>
> thanks!
> will
>
>
> documentation: dm= parameter documentation
>
> Add documentation for early mapped device creation without an initial rd.
>
> Signed-off-by: Will Drewry <wad@xxxxxxxxxxxx>
> ---
> Documentation/device-mapper/boot.txt | 36 ++++++++++++++++++++++++++++++++++
> Documentation/kernel-parameters.txt | 4 +++
> 2 files changed, 40 insertions(+), 0 deletions(-)
> create mode 100644 Documentation/device-mapper/boot.txt
>
> diff --git a/Documentation/device-mapper/boot.txt
> b/Documentation/device-mapper/boot.txt
> new file mode 100644
> index 0000000..00fb557
> --- /dev/null
> +++ b/Documentation/device-mapper/boot.txt
> @@ -0,0 +1,36 @@
> +Boot time creation of mapped devices
> +===================================
> +
> +You can boot directly to a dm device using the following kernel command
> +line:
> +
> +dm="<name> <uuid> <ro>,table line 1,...,table line n"
> +
> +name = the name to associated with the device

associate

> + after boot, udev, if used, will use that name to label
> + the device node.
> +uuid = may be 'none' or the UUID desired for the device.
> +ro = may be 0 or 1. If non-zero, the device and device table will be
> + marked read-only.
> +
> +Each table line may be as normal when using the dmsetup tool except for
> +two variations:
> +1. Any use of commas will be interpreted as a newline
> +2. Quotation marks cannot be escaped and cannot be used without
> + terminating the dm= argument.
> +
> +Unless renamed by udev, the device node created will be dm-0 as the
> +first minor number for the device-mapper is used during early creation.
> +
> +Example
> +=======
> +
> +- Booting to a linear array made up of user-mode linux block devices:
> +
> + dm="lroot none 0, 0 4096 linear 98:16 0, 4096 4096 linear 98:32 0" \
> + root=/dev/dm-0
> +
> +Will boot to a rw dm-linear target of 8192 sectors split across two
> +block devices identified by their major:minor numbers. After boot, udev
> +will rename this target to /dev/mapper/lroot (depending on the rules).
> +No uuid was assigned.


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/