summaryrefslogtreecommitdiffstats
path: root/sys/geom
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2011-06-03 17:09:15 +0000
committerattilio <attilio@FreeBSD.org>2011-06-03 17:09:15 +0000
commit91525e4ff96713dd3149a3477069cc7213d0abae (patch)
treee57c9894493b064186bad81144f2f35caf5f8b21 /sys/geom
parent3c36d056695bef4a3aa0002c977fc1999621600e (diff)
parent9c392f3f9121f469140929d45260ed31420f7126 (diff)
downloadFreeBSD-src-91525e4ff96713dd3149a3477069cc7213d0abae.zip
FreeBSD-src-91525e4ff96713dd3149a3477069cc7213d0abae.tar.gz
MFC
Diffstat (limited to 'sys/geom')
-rw-r--r--sys/geom/geom_disk.c6
-rw-r--r--sys/geom/part/g_part.c17
2 files changed, 22 insertions, 1 deletions
diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c
index a051772..e663e3d 100644
--- a/sys/geom/geom_disk.c
+++ b/sys/geom/geom_disk.c
@@ -154,6 +154,12 @@ g_disk_access(struct g_provider *pp, int r, int w, int e)
}
pp->mediasize = dp->d_mediasize;
pp->sectorsize = dp->d_sectorsize;
+ if (dp->d_flags & DISKFLAG_CANDELETE)
+ pp->flags |= G_PF_CANDELETE;
+ else
+ pp->flags &= ~G_PF_CANDELETE;
+ pp->stripeoffset = dp->d_stripeoffset;
+ pp->stripesize = dp->d_stripesize;
dp->d_flags |= DISKFLAG_OPEN;
if (dp->d_maxsize == 0) {
printf("WARNING: Disk drive %s%d has no d_maxsize\n",
diff --git a/sys/geom/part/g_part.c b/sys/geom/part/g_part.c
index a3f8575..f24e7b5 100644
--- a/sys/geom/part/g_part.c
+++ b/sys/geom/part/g_part.c
@@ -248,6 +248,7 @@ g_part_check_integrity(struct g_part_table *table, struct g_consumer *cp)
{
struct g_part_entry *e1, *e2;
struct g_provider *pp;
+ off_t offset;
int failed;
failed = 0;
@@ -294,6 +295,16 @@ g_part_check_integrity(struct g_part_table *table, struct g_consumer *cp)
(intmax_t)table->gpt_last);
failed++;
}
+ if (pp->stripesize > 0) {
+ offset = e1->gpe_start * pp->sectorsize;
+ if (e1->gpe_offset > offset)
+ offset = e1->gpe_offset;
+ if ((offset + pp->stripeoffset) % pp->stripesize) {
+ DPRINTF("partition %d is not aligned on %u "
+ "bytes\n", e1->gpe_index, pp->stripesize);
+ /* Don't treat this as a critical failure */
+ }
+ }
e2 = e1;
while ((e2 = LIST_NEXT(e2, gpe_entry)) != NULL) {
if (e2->gpe_deleted || e2->gpe_internal)
@@ -723,7 +734,11 @@ g_part_ctl_add(struct gctl_req *req, struct g_part_parms *gpp)
if (gpp->gpp_parms & G_PART_PARM_OUTPUT) {
sb = sbuf_new_auto();
G_PART_FULLNAME(table, entry, sb, gp->name);
- sbuf_cat(sb, " added\n");
+ if (pp->stripesize > 0 && entry->gpe_pp->stripeoffset != 0)
+ sbuf_printf(sb, " added, but partition is not "
+ "aligned on %u bytes\n", pp->stripesize);
+ else
+ sbuf_cat(sb, " added\n");
sbuf_finish(sb);
gctl_set_param(req, "output", sbuf_data(sb), sbuf_len(sb) + 1);
sbuf_delete(sb);
OpenPOWER on IntegriCloud