[PATCH 04/11] Use BlockDev's MD plugin instead of devicelibs/mdraid.py

Brian C. Lane bcl at redhat.com
Thu Feb 5 17:18:51 UTC 2015


On Thu, Feb 05, 2015 at 09:25:42AM +0100, Vratislav Podzimek wrote:
> On Tue, 2015-02-03 at 17:21 -0800, Brian C. Lane wrote:
> > On Sun, Feb 01, 2015 at 07:15:54PM +0100, Vratislav Podzimek wrote:
> > > -    :param size: size of the array
> > > -    :type size: :class:`~.size.Size`
> > > -    :param version: metadata version
> > > -    :type version: str
> > > -
> > > -    0.9 use 2.0 MiB
> > > -    1.0 use 2.0 MiB
> > > -    1.1 or 1.2 use the formula lifted from mdadm/super1.c to calculate it
> > > -    based on the array size.
> > > -    """
> > > -    # mdadm 3.2.4 made a major change in the amount of space used for 1.1 and 1.2
> > > -    # in order to reserve space for reshaping. See commit 508a7f16 in the
> > > -    # upstream mdadm repository.
> > > -    headroom = MD_SUPERBLOCK_SIZE
> > > -    if version is None or version in ["default", "1.1", "1.2"]:
> > > -        # MDADM: We try to leave 0.1% at the start for reshape
> > > -        # MDADM: operations, but limit this to 128Meg (0.1% of 10Gig)
> > > -        # MDADM: which is plenty for efficient reshapes
> > > -        # NOTE: In the mdadm code this is in 512b sectors. Converted to use MiB
> > > -        MIN_HEADROOM = Size("1 MiB")
> > > -        headroom = int(Size("128 MiB"))
> > > -        while Size(headroom << 10) > size and Size(headroom) > MIN_HEADROOM:
> > > -            headroom >>= 1
> > > -
> > > -        headroom = Size(headroom)
> > > -
> > > -    log.info("Using %s superBlockSize", headroom)
> > > -    return headroom
> > 
> > Has this knowledge been preserved someplace in libblockdev? It was a
> > royal PITA to track that one down :)
> I believe it is:
> https://github.com/rhinstaller/libblockdev/blob/master/src/plugins/mdraid.c#L274
> 
> Generally, I wrote all the functions as C "translations" of code from
> devicelibs' functions.

Looks good, thanks!

-- 
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)


More information about the anaconda-patches mailing list