[PATCH 04/11] Use BlockDev's MD plugin instead of devicelibs/mdraid.py
Vratislav Podzimek
vpodzime at redhat.com
Thu Feb 5 08:25:42 UTC 2015
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.
--
Vratislav Podzimek
Anaconda Rider | RHCE | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list