[Libguestfs] [PATCH 3/4] tests: xfs: remove lazy-counter disablement test

Laszlo Ersek lersek at redhat.com
Tue Sep 21 17:05:22 UTC 2021


On 09/20/21 07:23, Laszlo Ersek wrote:
> According to xfs_admin(8):
> 
>>        -c 0|1 Enable (1) or disable (0) lazy-counters in the  filesys‐
>>               tem.
>>
>>               Lazy-counters  may  not  be  disabled  on  Version 5 su‐
>>               perblock filesystems (i.e. those with metadata CRCs  en‐
>>               abled).
>>
>>               [...]
> 
> According to mkfs.xfs(1):
> 
>>        -m global_metadata_options
>>        Section Name: [metadata]
>>               These  options  specify metadata format options that ei‐
>>               ther apply to the entire  filesystem  or  aren't  easily
>>               characterised  by  a  specific  functionality group. The
>>               valid global_metadata_options are:
>>
>>                   [...]
>>
>>                    crc=value
>>                           This  is  used  to create a filesystem which
>>                           maintains and checks CRC information in  all
>>                           metadata  objects  on disk. The value is ei‐
>>                           ther 0 to disable the feature, or 1  to  en‐
>>                           able the use of CRCs.
>>
>>                           [...]
>>
>>                           By  default,  mkfs.xfs  will enable metadata
>>                           CRCs.
> 
> Consistently with the above, the first "xfs_admin" test case in
> "generator/actions_core.ml", which attempts to disable lazy counters,
> always fails:
> 
>> 534/550 test_xfs_admin_0
>> libguestfs: error: xfs_admin: /dev/sda1: Cannot disable lazy-counters on V5 fs
> 
> We can resolve this test failure in three ways:
> 
> (1) Extend do_mkfs() [daemon/mkfs.c], possibly even introduce
>     do_mkfs_xfs(), and permit the caller to specify "-m crc=0" for
>     mkfs.xfs. Then use this option when the temporary filesystem is
>     created in the XFS test that disables lazy counters.
> 
> (2) Extend the "guestfs_int_xfsinfo" structure in the libguestfs-common
>     project, with an "xfs_crc" field. Extend parse_xfs_info()
>     [daemon/xfs.c] to populate the field from "meta-data=...crc=[01]".
>     Modify the test case to check the following post-condition:
> 
>       xfs_crc || xfs_lazycount == 0
> 
>     instead of the current
> 
>       xfs_lazycount == 0
> 
>     effectively ignoring "xfs_lazycount" when "xfs_crc" is set.
> 
> (3) Remove the test altogether that attempts to disable lazy counters
>     after filesystem creation.
> 
> Given that new XFS filesystems are created with metadata CRCs enabled by
> default, and several XFS features depend on metadata CRCs being enabled,
> this patch implements option (3).
> 
> Signed-off-by: Laszlo Ersek <lersek at redhat.com>
> ---
>  generator/actions_core.ml | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/generator/actions_core.ml b/generator/actions_core.ml
> index bb602ee02dfc..5933282dcf90 100644
> --- a/generator/actions_core.ml
> +++ b/generator/actions_core.ml
> @@ -7644,12 +7644,6 @@ with zeroes)." };
>      style = RErr, [String (Device, "device")], [OBool "extunwritten"; OBool "imgfile"; OBool "v2log"; OBool "projid32bit"; OBool "lazycounter"; OString "label"; OString "uuid"];
>      optional = Some "xfs";
>      tests = [
> -        InitEmpty, Always, TestResult (
> -          [["part_disk"; "/dev/sda"; "mbr"];
> -           ["mkfs"; "xfs"; "/dev/sda1"; ""; "NOARG"; ""; ""; "NOARG"];
> -           ["xfs_admin"; "/dev/sda1"; ""; ""; ""; ""; "false"; "NOARG"; "NOARG"];
> -           ["mount"; "/dev/sda1"; "/"];
> -           ["xfs_info"; "/"]], "ret->xfs_lazycount == 0"), [];
>          InitEmpty, Always, TestResultString (
>            [["part_disk"; "/dev/sda"; "mbr"];
>             ["mkfs"; "xfs"; "/dev/sda1"; ""; "NOARG"; ""; ""; "NOARG"];
> 

Patch pushed as commit 627f808e4b0a.

Thanks
Laszlo




More information about the Libguestfs mailing list