[parted-devel] [PATCH] libparted: Fixed bug in initializing and re-reading partition table of FBA devices
Nageswara R Sastry
rnsastry at linux.vnet.ibm.com
Wed Oct 30 11:52:14 UTC 2013
On 10/30/2013 10:46 AM, Nageswara R Sastry wrote:
> On 10/29/2013 7:08 PM, Phillip Susi wrote:
>>> While trying to add partition 'disk.c: ped_disk_get_partition'
>>> called, it internally calls 'disk.c: ped_disk_next_partition', this
>>> function does not know about implicit partition so returns 'NULL'.
>>
>> Right, *that* is the real problem. Fix that and the blkpg code should
>> do the right thing.
>
> Sure, I am looking in to it.
Analyzed this problem, and there is no change required for
'ped_disk_next_partition', here is the explanation.
Some functions functionality mentioned here, which is required understanding
this case.
libparted/labels/dasd.c: dasd_alloc():
Allocates the dasd disk with required Data structures
libparted/labels/dasd.c: dasd_read():
Knows about FBA disk and adds implicit partition
libparted/disk.c: ped_disk_new() {
ped_disk_probe()
ped_disk_new_fresh() {
disk->ops->alloc #in this case it calls 'dasd_alloc'
}
disk->ops->read #in this case it calls 'dasd_read'
}
parted/parted.c: do_mklabel() {
ped_disk_new()
ped_disk_new_fresh()
ped_disk_commit()
}
After running 'mklabel' command for any kind of disk it removes the partitions,
the same is happening for FBA kind of disks.
# cat /proc/partitions | grep dasdd
94 12 209715200 dasdd
94 13 209715199 dasdd1
# parted/.libs/parted /dev/dasdd mklabel dasd
Warning: The existing disk label on /dev/dasdd will be destroyed and all data on
this disk will be lost. Do you want to continue?
Yes/No? yes
Information: You may need to update /etc/fstab.
# cat /proc/partitions | grep dasdd
94 12 209715200 dasdd
*** implicit partition is not visible to the kernel.
The latest thing happened was (do_mklabel->ped_disk_new_fresh->dasd_alloc), so the
disk is clean - with out any partitions. The same behavior is acceptable to other
disks but not for FBA.
So tried calling dasd_read from dasd_alloc for FBA disk,
dasd_alloc() {
...
if (FBA)
dasd_read()
}
This resulted acceptable behavior for FBA disk, i.e. showing implicit partition through
*BLKPG ioctl* after running 'mklabel'.
# cat /proc/partitions | grep dasdd
94 12 209715200 dasdd
# parted/.libs/parted /dev/dasdd mklabel dasd
Warning: The existing disk label on /dev/dasdd will be destroyed and all data on
this disk will be lost. Do you want to continue?
Yes/No? yes
Information: You may need to update /etc/fstab.
# cat /proc/partitions | grep dasdd
94 12 209715200 dasdd
94 13 209715199 dasdd1
So, need to validate calling 'dasd_read()' from 'dasd_alloc()' is the correct thing
or not.
Regards
R.Nageswara Sastry
More information about the parted-devel
mailing list