From: NeilBrown <neilb@suse.de>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-raid@vger.kernel.org
Subject: [PATCH md 011 of 20] Expose md metadata format in sysfs.
Date: Mon, 12 Dec 2005 14:15:08 +1100 [thread overview]
Message-ID: <1051212031508.5095@suse.de> (raw)
In-Reply-To: 20051212135705.4561.patches@notabene
Allow it to be set to a particular version, or 'none'.
Signed-off-by: Neil Brown <neilb@suse.de>
### Diffstat output
./Documentation/md.txt | 6 ++++++
./drivers/md/md.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 55 insertions(+)
diff ./Documentation/md.txt~current~ ./Documentation/md.txt
--- ./Documentation/md.txt~current~ 2005-12-12 11:31:46.000000000 +1100
+++ ./Documentation/md.txt 2005-12-12 11:33:02.000000000 +1100
@@ -183,6 +183,12 @@ All md devices contain:
the array if the personality supports it (raid1, raid5, raid6),
and if the component drives are large enough.
+ metadata_version
+ This indicates the format that is being used to record metadata
+ about the array. It can be 0.90 (traditional format), 1.0, 1.1,
+ 1.2 (newer format in varying locations) or "none" indicating that
+ the kernel isn't managing metadata at all.
+
As component devices are added to an md array, they appear in the 'md'
directory as new directories named
dev-XXX
diff ./drivers/md/md.c~current~ ./drivers/md/md.c
--- ./drivers/md/md.c~current~ 2005-12-12 11:32:28.000000000 +1100
+++ ./drivers/md/md.c 2005-12-12 11:33:24.000000000 +1100
@@ -1857,6 +1857,54 @@ size_store(mddev_t *mddev, const char *b
static struct md_sysfs_entry md_size =
__ATTR(component_size, 0644, size_show, size_store);
+
+/* Metdata version.
+ * This is either 'none' for arrays with externally managed metadata,
+ * or N.M for internally known formats
+ */
+static ssize_t
+metadata_show(mddev_t *mddev, char *page)
+{
+ if (mddev->persistent)
+ return sprintf(page, "%d.%d\n",
+ mddev->major_version, mddev->minor_version);
+ else
+ return sprintf(page, "none\n");
+}
+
+static ssize_t
+metadata_store(mddev_t *mddev, const char *buf, size_t len)
+{
+ int major, minor;
+ char *e;
+ if (!list_empty(&mddev->disks))
+ return -EBUSY;
+
+ if (cmd_match(buf, "none")) {
+ mddev->persistent = 0;
+ mddev->major_version = 0;
+ mddev->minor_version = 90;
+ return len;
+ }
+ major = simple_strtoul(buf, &e, 10);
+ if (e==buf || *e != '.')
+ return -EINVAL;
+ buf = e+1;
+ minor = simple_strtoul(buf, &e, 10);
+ if (e==buf || *e != '\n')
+ return -EINVAL;
+ if (major >= sizeof(super_types)/sizeof(super_types[0]) ||
+ super_types[major].name == NULL)
+ return -ENOENT;
+ mddev->major_version = major;
+ mddev->minor_version = minor;
+ mddev->persistent = 1;
+ return len;
+}
+
+static struct md_sysfs_entry md_metadata =
+__ATTR(metadata_version, 0644, metadata_show, metadata_store);
+
static ssize_t
action_show(mddev_t *mddev, char *page)
{
@@ -1926,6 +1974,7 @@ static struct attribute *md_default_attr
&md_raid_disks.attr,
&md_chunk_size.attr,
&md_size.attr,
+ &md_metadata.attr,
NULL,
};
next prev parent reply other threads:[~2005-12-12 3:15 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-12 3:10 [PATCH md 000 of 20] Introduction NeilBrown
2005-12-12 3:10 ` [PATCH md 001 of 20] Fix a use-after-free bug in raid1 NeilBrown
2005-12-12 3:10 ` [PATCH md 002 of 20] Use correct size of raid5 stripe cache when measuring how full it is NeilBrown
2005-12-12 3:10 ` [PATCH md 003 of 20] Define and use safe_put_page for md NeilBrown
2005-12-12 3:13 ` [PATCH md 004 of 20] Helper function to match commands written to sysfs files NeilBrown
2005-12-12 3:14 ` [PATCH md 005 of 20] Fix typo in comment NeilBrown
2005-12-12 3:14 ` [PATCH md 006 of 20] Make a couple of names in md.c static NeilBrown
2005-12-12 3:14 ` [PATCH md 007 of 20] Make sure bitmap updates are visible through filesystem NeilBrown
2005-12-12 3:14 ` [PATCH md 008 of 20] Fix rdev->pending counts in raid1 NeilBrown
2005-12-12 3:14 ` [PATCH md 009 of 20] Allow chunk_size to be settable through sysfs NeilBrown
2005-12-12 3:15 ` [PATCH md 010 of 20] Allow md array component size to be accessed and set via sysfs NeilBrown
2005-12-12 3:15 ` NeilBrown [this message]
2005-12-12 3:15 ` [PATCH md 012 of 20] Allow array level to be set textually " NeilBrown
2005-12-12 3:15 ` [PATCH md 013 of 20] Count corrected read errors per drive NeilBrown
2005-12-12 10:07 ` Andrew Morton
2005-12-12 3:15 ` [PATCH md 014 of 20] Allow md/raid_disks to be settable NeilBrown
2005-12-12 3:15 ` [PATCH md 015 of 20] Keep better track of dev/array size when assembling md arrays NeilBrown
2005-12-12 3:15 ` [PATCH md 016 of 20] Expose device slot information via sysfs NeilBrown
2005-12-12 3:15 ` [PATCH md 017 of 20] Export rdev->data_offset " NeilBrown
2005-12-12 3:15 ` [PATCH md 018 of 20] Allow available size of component devices to be set " NeilBrown
2005-12-12 3:15 ` [PATCH md 019 of 20] Support adding new devices to md arrays " NeilBrown
2005-12-12 3:15 ` [PATCH md 020 of 20] Allow sync-speed to be controlled per-device NeilBrown
2005-12-12 11:30 ` Jeff Breidenbach
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=1051212031508.5095@suse.de \
--to=neilb@suse.de \
--cc=akpm@osdl.org \
--cc=linux-raid@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.