[Top][All Lists]

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

Re: [RFC/PATCH 0/2] support for CMS-formatted disks on the s/390 archite

From: Stephen Powell
Subject: Re: [RFC/PATCH 0/2] support for CMS-formatted disks on the s/390 architecture
Date: Mon, 19 Apr 2010 17:33:42 -0400 (EDT)

On Sat, 17 Apr 2010 16:42:44 -0400 (EDT), Jim Meyering wrote:
> Stephen Powell wrote:
>> On Sat, 17 Apr 2010 11:10:04 -0400 (EDT), Jim Meyering wrote:
>>> Thanks for preparing those.
>>> Can either of you outline a test for each that would fail before
>>> application of a patch and succeed after it?
>> For the first problem, the invalid starting block for an LDL disk,
>> the failure would involve reporting an incorrect starting position,
>> an incorrect partition size, and not
>> recognizing any file system which might be on it, since it is
>> not pointing to the superblock.  This occurs only on LDL disks
>> with a block size other than 4096.
> Thanks.  Good overview of what's needed.
> Can you give more detail?  For example, how would you create
> an LDL disk with block size != 4096?

As an example:

   dasdfmt -b 512 -l TMP400 -d ldl /dev/dasde

will format device /dev/dasde with a block size of 512, disk label
TMP400, and the Linux Disk Layout.  dasdfmt is part of the s390-tools

>> With the patch, the partition size
>> will be correct, the starting position will be correct,
> and it will recognize the file system built on the
>> partition, if there is one.  The command would be something like
>>    parted /dev/dasda print
>> For the second problem, lack of recognition of CMS minidisks, the
>> above command will report ...
> Can you provide or tell how to construct a minimal example image?
> My goal is to write a portable shell script that triggers
> the flaw, and use that to show your fix solves the problem.

I'm working on that, and I will have something for you shortly,
but in the mean time I've been doing some regression testing, and
I have discovered a problem.  It seems my fix is not quite
complete.  But I'm not sure what to do about it.  I need the
assistance of a real C programmer again.  (Believe it or not, I
am an experienced programmer.  I know s390 assembler language,
PL/I, and FORTRAN well.  I just don't know C.  Arrg!)  Anyway,
here's the problem.  I get an error message about overlapping
partitions for non-reserved CMS disks or LDL disks with a
block size less than 4096.  Here's some example output:


debian3:~# parted /dev/dasde print
Error: can't have overlapping partitions.  <--------------.
Model: IBM S390 DASD drive (dasd)                         |
Disk /dev/dasde: 645kB                                    |
Sector size (logical/physical): 512B/2048B                |
Partition Table: dasd                                     |
Number  Start  End    Size   File system  Flags           |
 1      6144B  645kB  639kB  ext2                         |
debian3:~#                                                |
----------                                                |
Notice the first line of output.  ------------------------'
This example is for an ldl format disk with a block size of 2048.
The problem seems to be that the pseudo-vtoc overlaps with
the implicit partition.  In libparted/labels/dasd.c,
in subroutine dasd_alloc_metadata, we have the statement

   if (disk_specific->format_type == 1)
           vtoc_end = 23;

Originally, the "start" variable was hard coded as 24; so
setting vtoc_end equal to 23 is another place where the
implicit assumption is being made that start is equal to 24.
(This works for a block size of 4096 for LDL disks or non-
reserved CMS disks because 4096/512*3 = 24.)
vtoc_end should be set to start - 1.  However, this routine
does not have access to the start variable due to scope of
names rules.  I tried setting it to start - 1 and got a
compile-time error.  I don't even know enough about C to tell
for sure if the start variable has been calculated by then.
I think it has been, since it is testing the value of
disk_specific->format_type, which is set inside the dasd_read
subroutine, which is where the start variable is also calculated.
But I don't know enough about C to fix this.  Help!

By the way, I've discovered by trial and error that it seems
to be necessary to take the device offline and bring it back
online again if the block size changes.  If you don't do that,
parted does not recognize the file system on the partition.
For example, if the block size is currently 512 and you want
to change it to 1024, something like the following sequence
seems to be necessary.  (When dasdfmt is run, the disk must be
online, but the partition must not be mounted.)

dasdfmt -b 1024 -l TMP400 -d ldl /dev/dasde
mke2fs -L TMP400 -t ext2 /dev/dasde1
echo 0 >/sys/bus/ccw/devices/0.0.0400/online
echo 1 >/sys/bus/ccw/devices/0.0.0400/online
parted /dev/dasde print

The above assumes that s390 device number 0400 corresponds to
Linux device name /dev/dasde.  (You can find out the correspondence
by issuing "cat /proc/dasd/devices".)  If you don't put those two
echo commands in there, parted reports the correct start,
end, and size values, but it doesn't recognize the file system
for some reason.  If you do put those two echo commands in there,
then parted can see an ext2 file system and will report it.

  .''`.     Stephen Powell    
 : :'  :
 `. `'`

reply via email to

[Prev in Thread] Current Thread [Next in Thread]