Re: [PATCH] Sun/Solaris VTOC table corrections

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi David,

On Wed, 25 Jul 2007, David Miller wrote:

From: Mark Fortescue <mark@xxxxxxxxxxxxxxxxxx>
Date: Wed, 25 Jul 2007 22:46:07 +0100 (BST)

It looks like I will have to change the patch to use a kernal/module
parameter to enable VTOC checking. David, would this be suficient in your
view?

I still don't like it too much.  Please find a way to distinguish
the two situations, I truly believe there is some way to figure
this out.  For example, one thing you can depend upon is that the
faulty Linux tools will always zero out version and sanity along
with the num_partitions field in the VTOC.


Not easy. I will put a new disk on the Sparc and see what is actually
written to the VTOC location in the disk label (marked as padding in the
SunOS 4.1.x header file).

With regard to the id and flag values - the spare1 and spare2 values are
currently meant to be zero so using the 16bit filing system endian
conversion functions means that 8 partition disk label created on x86
systems should work correctly as well as those created on Sparc systems.
It would be posible to change the code to use bytes but the coding begins
to get very messy when we start accessing bytes swaped partition labels
as these use spare1/2 for id/flags.

Yes, I believe this part of the changes are fine.  If you look at the
fdisk sun label fixes I made in util-linux-ng the other week I did
basically the same thing.


Should I mask out the bottom 8 bits ?

The final part of the patch - increasing the number of x86 slices
(partitions) from 8 to 16 will correct the x86 Solaris disk label usually
used in x86 solaris systems but again may break Linux systems that have
been created using the incorrect value.

It is truly a shame that Sun decided to use a different number of
partitions value on x86.  BUT, for these cases it is easy to detect
dynamically because the num_partitions field will contain 16.

For broken linux tools and Solaris/Sparc, the field will contain
either 0 or 8.

So a lot of this should be dynamically detectable, even considering
tools that do not fill in version and sanity properly.


OK This one is easy as the VTOC structure is only used in fs/partions/msdos.c and the parts that get moved by changing the number of slices are not used yet (v2.6.22). I have attached a patch.

Please try hard to avoid a module parameter, I'm willing to help
with testing as I have all of the Linux and current generation
Solaris/Sparc disk label cases handy locally.
-
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html
From: Mark Fortescue <mark@xxxxxxxxxxxxxxxxxx>

Correct the Solaris x86 number of partitions (slices) is a way that is
backward compatible with the earlier size.
This works without a new VTOC structure definition as the timestamp
and v_asciilabel fields in the VTOC are not used by the kernel yet.

Signed-off-by: Mark Fortescue <mark@xxxxxxxxxxxxxxxxxx>
---
diff -ruNpd -x .git -x .gitignore -x .mailmap linux-2.6/fs/partitions/msdos.c linux-test/fs/partitions/msdos.c
--- linux-2.6/fs/partitions/msdos.c	2007-07-24 22:47:22.000000000 +0100
+++ linux-test/fs/partitions/msdos.c	2007-07-26 00:40:41.000000000 +0100
@@ -203,6 +203,7 @@ parse_solaris_x86(struct parsed_partitio
 	Sector sect;
 	struct solaris_x86_vtoc *v;
 	int i;
+	short max_nparts;
 
 	v = (struct solaris_x86_vtoc *)read_dev_sector(bdev, offset+1, &sect);
 	if (!v)
@@ -218,4 +219,6 @@ parse_solaris_x86(struct parsed_partitio
 		put_dev_sector(sect);
 		return;
 	}
-	for (i=0; i<SOLARIS_X86_NUMSLICE && state->next<state->limit; i++) {
+	/* Ensure we can handle previous case of VTOC with 8 entries gracefully */  
+	max_nparts = le16_to_cpu (v->v_nparts) > 8 ? SOLARIS_X86_NUMSLICE : 8;
+	for (i=0; i<max_nparts && state->next<state->limit; i++) {
		struct solaris_x86_slice *s = &v->v_slice[i];
 		if (s->s_size == 0)
 			continue;
diff -ruNpd -x .git -x .gitignore -x .mailmap linux-2.6/include/linux/genhd.h linux-test/include/linux/genhd.h
--- linux-2.6/include/linux/genhd.h	2007-07-24 22:47:26.000000000 +0100
+++ linux-test/include/linux/genhd.h	2007-07-26 00:38:30.000000000 +0100
@@ -264,7 +264,7 @@ static inline void set_capacity(struct g
 
 #ifdef CONFIG_SOLARIS_X86_PARTITION
 
-#define SOLARIS_X86_NUMSLICE	8
+#define SOLARIS_X86_NUMSLICE	16
 #define SOLARIS_X86_VTOC_SANE	(0x600DDEEEUL)
 
 struct solaris_x86_slice {

[Index of Archives]     [Kernel Development]     [DCCP]     [Linux ARM Development]     [Linux]     [Photo]     [Yosemite Help]     [Linux ARM Kernel]     [Linux SCSI]     [Linux x86_64]     [Linux Hams]

  Powered by Linux