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

Conversation

bjohnsto
Copy link
Member

This series of commits moves the functionality of vdoformat into the kernel. It includes three main code changes that will go upstream.

  1. Adding three new optional parameters to the vdo table line (slab bits, index memory size, and index sparse) from the vdoformat parameter list, along with validation code and default values for each one.

  2. Adding a check at dmsetup create time to check the geometry block to see if it is all zeroes. This will inform the formatting code whether it should run or not. Basically if the geometry block is all zeroes, we format the device.

  3. The actual formatting code. This is the most detailed of the three main code commits. It will initialize structures with appropriate values so that both the geometry block and geoemtry block can be written out with the correct format. The formatting code will also zero out several areas of the device (uds super block, component areas of the device) so no old info is picked up when it shouldn't. The zero'ing code uses a kernel function called blkdev_issue_zeroout.

Along with the three upstream changes are additional commits to add testing and user mode support. Those commits come directly after the code changes they relate to. The additional user mode support change is for getting blkdev_issue_zeroout to run in user mode.

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]>
[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]>
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]>
[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]>
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]>
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]>
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]>
Copy link

Unit Test Results

    3 files  86 suites   26m 6s ⏱️
264 tests 42 ✔️ 0 💤 222
265 runs  43 ✔️ 0 💤 222

For more details on these failures, see this check.

Results for commit a1ec8fc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants