[parted-devel] Re: Patch against SVN (1.8.0rc2): number two

David Cantrell dcantrell at redhat.com
Tue Oct 31 20:43:30 CET 2006


Debarshi 'Rishi' Ray wrote:
>> > 1. libparted/arch/linux.c -->> a. readFD does not need to allocate
>> > 16384 bytes (= 16KB) initially to read /proc/devices. It is merely an
>> > ASCII file, which lists the major device numbers of all the devices.
>> > It is highly imporabable (if not impossible) for it to be larger than
>> > 2KB. The extra memory requirement might lead to a 'memory allocation
>> > error/failure' in memory-starved systems. Hence I have shortenend it
>> > to 1024 bytes (=1KB).
>>
>> That function came from nash(8) in RH, which also reads
>> /proc/partitions.  That file can definitely get huge on big systems,
>> hence the 16KB buffer.  Here it's unnecessary, but doesn't really
>> matter.  I'll apply the diff.
> 
> Is it the /proc/partitions which can get huge? Or can /proc/devices be
> huge too? By the way is there an upper limit for the device major
> numbers? I am just curious.

Both can get large and 16KB sort of plays it safe.  You want to avoid 
multiple read passes across /proc in general, which is why 16KB was chosen.

The function gives up the memory quickly anyway and we are only talking 
about 4 pages.

>>  I'm going to push out an rc3 here shortly
> 
> I am unable to figure out how to use Parted to access LVM volume
> groups as a whole, just as the system-config-lvm does on Fedora
> systems. I saw that system-config-lvm uses "lvm vgscan --noheaders
> --nosuffixes..." to do it.

Correct.  The lvm userspace tools are currently the only ways to work 
with volume groups on Linux.  There's no library available.  There are 
numerous problems with the lvm utils currently and those need some major 
attention (outside of parted work).

Being able to access volume groups via parted doesn't seem necessary anyway.

>>  I'd also like
>> mention:  Be careful with your ioctl() calls.  If you are making changes
>> involving ioctl() calls, be sure to pass arguments if the particular
>> ioctl is expecting them.
> 
> Ok. Thanks for the advice. Although I have not tinkered with ioctls
> till now, I will make sure I am careful when I do so.

Always check kernel source for the definitive answer.

-- 
David Cantrell
Red Hat / Westford, MA



More information about the parted-devel mailing list