Re: [PATCH] Be a little bit smarter about allocating space to grow parts. (#491761)

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

 



On Tue, 2009-03-24 at 14:21 -1000, David Cantrell wrote:
> Looks ok to me.
> 
> Is this the patch you were talking about to get grow support working 
> better right now?  I would eventually like this functionality to live in 
> pyparted or libparted.

It is. We really want also to teach libparted to stop inserting the
cylinder-alignment constraint so we can also start using
maximizePartition again, as this is not a complete solution.

What this will do is correct our initial allocations so that
maximizePartition won't be as likely to grow the first partition it
seems to be huge, leaving the others as they are. This one will get us
perhaps 80% of the way to a reasonable use of the available space in
these weird scenarios.

I would love to see the majority of anaconda's partition allocation and
growing logic moved into pyparted.

Dave

> 
> On 03/24/2009 01:10 PM, David Lehman wrote:
> > parted.disk.Disk.maximizePartition leads to libparted applying
> > a cylinder-alignment constraint, which we would frikking ask for
> > if we wanted it. So, for now, we can use this to identify chunks
> > of free space that will initially be allocated to requests whose
> > max size will prevent them from making full use of their share
> > of the space.
> >
> > Cases where this comes into play are ones where an initially
> > larger request has a relatively low max size and an initially
> > smaller request has no max size at all. Since we base the
> > allocation of free space for growing on the requests' initial
> > size, we could previously end up with very large chunks of
> > unused free space.
> > ---
> >   storage/partitioning.py |   30 ++++++++++++++++++++++++++++++
> >   1 files changed, 30 insertions(+), 0 deletions(-)
> >
> > diff --git a/storage/partitioning.py b/storage/partitioning.py
> > index f716657..9f42a72 100644
> > --- a/storage/partitioning.py
> > +++ b/storage/partitioning.py
> > @@ -835,11 +835,41 @@ def growPartitions(disks, partitions):
> >                   log.debug("growable total is now %d sectors" % disk_total)
> >
> >           # now we loop through the partitions...
> > +        # this first loop is to identify obvious chunks of free space that
> > +        # will be left over due to max size
> > +        leftover = 0
> > +        limited = {}
> > +        unlimited_total = 0
> > +        for part in growable:
> > +            # calculate max number of sectors this request can grow
> > +            req_sectors = part.partedPartition.geometry.length
> > +            share = float(req_sectors) / float(disk_total)
> > +            max_grow = (share * disk_free)
> > +            max_sectors = req_sectors + max_grow
> > +            limited[part.name] = False
> > +
> > +            if part.req_max_size:
> > +                req_max_sect = (part.req_max_size * (1024 * 1024)) / sectorSize
> > +                if req_max_sect<  max_sectors:
> > +                    mb = ((max_sectors - req_max_sect) * sectorSize) / (1024*1024)
> > +
> > +                    log.debug("adding %dMB to leftovers from %s"
> > +                                % (mb, part.name))
> > +                    leftover += (max_sectors - req_max_sect)
> > +                    limited[part.name] = True
> > +
> > +            if not limited[part.name]:
> > +                unlimited_total += req_sectors
> > +
> > +        # now we loop through the partitions...
> >           for part in growable:
> >               # calculate max number of sectors this request can grow
> >               req_sectors = part.partedPartition.geometry.length
> >               share = float(req_sectors) / float(disk_total)
> >               max_grow = (share * disk_free)
> > +            if not limited[part.name]:
> > +                leftover_share = float(req_sectors) / float(unlimited_total)
> > +                max_grow += leftover_share * leftover
> >               max_sectors = req_sectors + max_grow
> >               max_mb = (max_sectors * sectorSize) / (1024 * 1024)
> >               log.debug("%s: base_size=%dMB, max_size=%sMB" % (part.name,
> 
> 

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux