Re: [LTP] [PATCH 1/4] libswap: add known swap supported fs check

Li Wang
2024-01-23T07:31:34Z

On Tue, Jan 23, 2024 at 1:55 PM Li Wang <liwang@redhat.com> wrote:

> Hi Petr,
>
> On Tue, Jan 23, 2024 at 4:23 AM Petr Vorel <pvorel@suse.cz> wrote:
>
>> Hi Li,
>>
>> > Great, and FYI.
>>
>> > I just pushed a new commit to resolve the FIBMAP (unsupported on BTRFS)
>> > problem on my ltp:libswap branch.
>>
>> >
>> https://github.com/wangli5665/ltp/commit/699711bfe8c8dbc3597c46587345fa1197c054c9
>>
>> > Hope you can try on your side and give some feedback :).
>>
>> Unfortunately regardless of kernel version it fails:
>>
>> # LTP_SINGLE_FS_TYPE=btrfs ./swapon01
>> ...
>> tst_test.c:1669: TINFO: === Testing on btrfs ===
>> tst_test.c:1117: TINFO: Formatting /dev/loop0 with btrfs opts='' extra
>> opts=''
>> tst_test.c:1131: TINFO: Mounting /dev/loop0 to
>> /tmp/LTP_swa497AKp/mntpoint fstyp=btrfs flags=0
>> tst_ioctl.c:21: TINFO: FIBMAP ioctl is NOT supported: EINVAL (22)
>> libswap.c:93: TINFO: File 'mntpoint/swapfile01' is not contiguous
>> libswap.c:34: TINFO: FS_NOCOW_FL attribute set on mntpoint/swapfile01
>> libswap.c:169: TFAIL: swapon() on btrfs failed: EINVAL (22)
>>
>
>
> Thanks for the quick feedback, very useful.
>
> After looking over the code, I think it's because the tst_fill_file didn't
> create a contiguous file at the beginning, so the solution is probably
> to define a new function just used by creating a contiguous file for btrfs
> in the libswap.c.
>
> After a tiny amend, it works on a fedora38.
>

V3 is here: https://github.com/wangli5665/ltp/commits/libswap-v3

It get passed on my fedora38(BTRFS), rhel9(XFS) platforms, I would
post out in ML, just n case people can review the latest version.

(it made quite a lot of changes vs the v1, so I don't want people to see
the
buggy version to fall into confusion :)

--
Regards,
Li Wang