summaryrefslogtreecommitdiffstats
path: root/sys/geom/stripe
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2004-08-09 11:29:42 +0000
committerpjd <pjd@FreeBSD.org>2004-08-09 11:29:42 +0000
commita98f2557009185f782b7d19053597e414ef9fb3a (patch)
tree46ee8e035f9336efb5b00d5af5c35f6afc1a3c96 /sys/geom/stripe
parent62b3492f0e226a7641b06a30d62538c7d1f6fb17 (diff)
downloadFreeBSD-src-a98f2557009185f782b7d19053597e414ef9fb3a.zip
FreeBSD-src-a98f2557009185f782b7d19053597e414ef9fb3a.tar.gz
- Introduce option for hardcoding providers' names into metadata.
It allows to fix problems when last provider's sector is shared between few providers. - Bump version number for CONCAT and STRIPE and add code for backward compatibility. - Do not bump version number of MIRROR, as it wasn't officially introduced yet. Even if someone started to play with it, there is no big deal, because wrong MD5 sum of metadata will deny those providers. - Update manual pages. - Add version history to g_(stripe|concat).h files.
Diffstat (limited to 'sys/geom/stripe')
-rw-r--r--sys/geom/stripe/g_stripe.c10
-rw-r--r--sys/geom/stripe/g_stripe.h11
2 files changed, 20 insertions, 1 deletions
diff --git a/sys/geom/stripe/g_stripe.c b/sys/geom/stripe/g_stripe.c
index 017cf3c..a661704 100644
--- a/sys/geom/stripe/g_stripe.c
+++ b/sys/geom/stripe/g_stripe.c
@@ -898,6 +898,15 @@ g_stripe_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
pp->name);
return (NULL);
}
+ /*
+ * Backward compatibility:
+ * There was no md_provider field in earlier versions of metadata.
+ */
+ if (md.md_version < 2)
+ bzero(md.md_provider, sizeof(md.md_provider));
+
+ if (md.md_provider[0] != '\0' && strcmp(md.md_provider, pp->name) != 0)
+ return (NULL);
/*
* Let's check if device already exists.
@@ -988,6 +997,7 @@ g_stripe_ctl_create(struct gctl_req *req, struct g_class *mp)
return;
}
md.md_stripesize = *stripesize;
+ bzero(md.md_provider, sizeof(md.md_provider));
/* Check all providers are valid */
for (no = 1; no < *nargs; no++) {
diff --git a/sys/geom/stripe/g_stripe.h b/sys/geom/stripe/g_stripe.h
index 5f4edc9..5a7825b 100644
--- a/sys/geom/stripe/g_stripe.h
+++ b/sys/geom/stripe/g_stripe.h
@@ -34,7 +34,13 @@
#define G_STRIPE_CLASS_NAME "STRIPE"
#define G_STRIPE_MAGIC "GEOM::STRIPE"
-#define G_STRIPE_VERSION 1
+/*
+ * Version history:
+ * 0 - Initial version number.
+ * 1 - Added 'stop' command for gstripe(8).
+ * 2 - Added md_provider field to metadata and '-h' option for gstripe(8).
+ */
+#define G_STRIPE_VERSION 2
#ifdef _KERNEL
#define G_STRIPE_TYPE_MANUAL 0
@@ -81,6 +87,7 @@ struct g_stripe_metadata {
uint16_t md_no; /* Disk number. */
uint16_t md_all; /* Number of all disks. */
uint32_t md_stripesize; /* Stripe size. */
+ char md_provider[16]; /* Hardcoded provider. */
};
static __inline void
stripe_metadata_encode(const struct g_stripe_metadata *md, u_char *data)
@@ -93,6 +100,7 @@ stripe_metadata_encode(const struct g_stripe_metadata *md, u_char *data)
le16enc(data + 40, md->md_no);
le16enc(data + 42, md->md_all);
le32enc(data + 44, md->md_stripesize);
+ bcopy(md->md_provider, data + 48, sizeof(md->md_provider));
}
static __inline void
stripe_metadata_decode(const u_char *data, struct g_stripe_metadata *md)
@@ -105,6 +113,7 @@ stripe_metadata_decode(const u_char *data, struct g_stripe_metadata *md)
md->md_no = le16dec(data + 40);
md->md_all = le16dec(data + 42);
md->md_stripesize = le32dec(data + 44);
+ bcopy(data + 48, md->md_provider, sizeof(md->md_provider));
}
#ifndef BITCOUNT
OpenPOWER on IntegriCloud