Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VDO-5752] Add vdoformat functionality into the kernel #208

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Commits on Oct 31, 2024

  1. dm vdo: Add formatting parameters to the kernel table line

    This commit adds the parameters that are currently part of
    vdoformat to the vdo table line. There are three parameters;
    slab bits, index memory size, and whether the index is sparse
    or not. The three parameters will be optional and use defaults
    if not passed in. Additional code has been added to do value
    checking of these new parameter so we can return errors when
    values are incorrect.
    
    The target_type version number has been updated so that clients
    of VDO (LVM, Stratis, etc) will know what versions of VDO support
    these new parameters and the new formatting code.
    
    Signed-off-by: Bruce Johnston <[email protected]>
    bjohnsto committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    9478d83 View commit details
    Browse the repository at this point in the history
  2. dm vdo user: Add tests for formatting parameters

    [VDOSTORY-292] This commit provides tests for the new
    table line parameters that will support formatting in
    the kernel. It also fixes an issue with the old
    VDOFormat.pm test which was succeeding even when it
    shouldn't have been.
    
    The first change is to add a flag for deciding what
    type of formatting we want to do; the old way calling
    vdoformat and the new way formatting directly from the
    kernel. Then we create a new function in Unmanaged.pm
    to do the formatting in the kernel by wiping the first
    block of the storage and then creating a new VDO volume
    if parameters were passed into the function. We only
    do it for testing. If nothing is passed in for testing,
    the normal dmsetup create done in activate will be
    used.
    
    Then we add a new test; VDOFormatInKernel.pm to test
    the parameters and validation code. This test is
    nearly identical to VDOFormat.pm, but has different code
    for checking error codes and things since they get
    returned from dmsetup and the specific error messages
    are written to the kernel log.
    
    Finally, some changes are made to VDOFormat.pm. During
    testing, it was noticed that any error message was
    accepted because assertExecuteCommand adds the stack
    trace to the error message and part of the stack trace
    is the call to tryIllegal with the error message match
    string. So we changed the search string to be more
    explicity by adding vdoformat to the prefix. This makes
    the tests only look at the output of vdoformat.
    
    Signed-off-by: Bruce Johnston <[email protected]>
    bjohnsto committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    d8512e8 View commit details
    Browse the repository at this point in the history
  3. dm vdo: Add check for formatting to the kernel

    This commit adds a check for an empty geometry block. An
    empty geometry block tells the code that the vdo device
    needs to be formatted. This follows similar code in
    other dm devices like dm-thin.
    
    To do this, we split the current read_geometry_block()
    function into two functions. The first is still called
    read_geometry_block() but only does the read of the block
    from disk and does not validate the data. The second is
    called load_geometry_block and does both the read and
    validation, like the old read_geometry_block did.
    
    The new read_geoemtry_block is now used to read the
    geometry block and check to see if it is empty. If
    it is all zeroes, we write a log message out to
    indicate the vdo needs to be formatted. The actual
    formatting code will be done in a future commit.
    
    Signed-off-by: Bruce Johnston <[email protected]>
    bjohnsto committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    17d0fbf View commit details
    Browse the repository at this point in the history
  4. dm vdo user: Add tests for formatting check

    [VDOSTORY-292] This commit adds testing support for the
    previous commit by looking for the log message that is
    being written when the code determines that formatting
    is required.
    
    Signed-off-by: Bruce Johnston <[email protected]>
    bjohnsto committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    1f26759 View commit details
    Browse the repository at this point in the history
  5. dm vdo: Add formatting code into kernel.

    This is the actual formatting code. It has been moved from
    vdoformat into various locations in the kernel code where
    it makes sense. The heart of the code resides in vdo.c,
    where we check the result of the previous commit that
    added a check for empty geometry block. If the block is all
    zeroes, there is now a call to vdo_format() which will
    write out the formatting layout for the geometry and super
    blocks of VDO.
    
    Signed-off-by: Bruce Johnston <[email protected]>
    bjohnsto committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    161e276 View commit details
    Browse the repository at this point in the history
  6. dm vdo user: Add user mode code to support formatting in kernel.

    This commit adds a user mode version of blkdev_issue_zeroout, which
    is used in the kernel formatting code to zero out blocks of storage.
    
    Signed-off-by: Bruce Johnston <[email protected]>
    bjohnsto committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    3253d91 View commit details
    Browse the repository at this point in the history
  7. dm vdo user: Add tests for formatting code.

    This commit updates the tests after the formatting code has
    been added. Changes included disabling certain checks that
    don't work due to machine restrictions and other things. It
    also changes how we remove the device after creation by
    waiting for the index to start before calling dmsetup
    remove.
    
    Signed-off-by: Bruce Johnston <[email protected]>
    bjohnsto committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    a1ec8fc View commit details
    Browse the repository at this point in the history