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

Petr Vorel
2024-01-22T20:23:48Z

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)

Also, tst_brk() in is_swap_supported() causes test to fail quickly.
Given similar Martin's fix to shell API I merged today, which use tst_res +
return instead of tst_brk [1] I suggest to use tst_res + change return function
from void to int and handle another return in the test. That will allow to test
other filesystems (which is useful to see, if particular filesystem code is
broken or or VFS or some common code reused by all filesystems). This is the
reason why I don't think "quit as early as possible" is a good approach when
testing on all filesystems.

Kind regards,
Petr

[1] https://github.com/linux-test-project/ltp/commit/5c73ad84f3e6db9a965df3ed4a846352136ed990

> > > https://github.com/wangli5665/ltp/tree/libswap

> > > And, I prefer to wait for Cryil's feedback before posting them in ML:)

> > +1

> > Kind regards,
> > Petr