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

Petr Vorel
2024-01-22T09:41:51Z

Hi Li, Cyril,

> Hi Li, Cyril,
...
> > void is_swap_supported(const char *filename)
> > {
> > + int i, sw_support = 0;
> > int fibmap = tst_fibmap(filename);
> Just a note unrelated to this patchset. When testing on SLES kernel based on
> 5.3.18 we still get TCONF due missing FIBMAP ioctl support:

> tst_test.c:1669: TINFO: === Testing on btrfs ===
> tst_test.c:1118: TINFO: Formatting /dev/loop0 with btrfs opts='' extra opts=''
> tst_test.c:1132: TINFO: Mounting /dev/loop0 to /tmp/LTP_swazaqF1L/mntpoint fstyp=btrfs flags=0
> tst_ioctl.c:21: TINFO: FIBMAP ioctl is NOT supported: EINVAL (22)
> libswap.c:45: TINFO: FS_NOCOW_FL attribute set on mntpoint/swapfile01

> libswap.c:114: TCONF: Swapfile on btrfs not implemented

Hm, what makes me wonder is that btrfs does not support FIBMAP even on current
openSUSE Tumbleweed with 6.7.0 kernel:

# TMPDIR=/var/tmp/ 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 /var/tmp/LTP_swaMBctpq/mntpoint fstyp=btrfs flags=0
tst_ioctl.c:21: TINFO: FIBMAP ioctl is NOT supported: EINVAL (22)
libswap.c:45: TINFO: FS_NOCOW_FL attribute set on mntpoint/swapfile01

libswap.c:114: TCONF: Swapfile on btrfs not implemented

$ df -hT /var/tmp
Filesystem Type Size Used Avail Use% Mounted on
/dev/vda2 btrfs 28G 19G 3.3G 86% /var

$ uname -r
6.7.0-9.gaedda80-default

I thought the problem is that underlying fs is btrfs, but testing on Debian
on 6.6.x with TMPDIR on ext4 does not bring FIBMAP support:

# TMPDIR=/var/tmp LTP_SINGLE_FS_TYPE=btrfs /opt/ltp/testcases/bin/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 /var/tmp/LTP_swaZf8FN6/mntpoint fstyp=btrfs flags=0
tst_ioctl.c:21: TINFO: FIBMAP ioctl is NOT supported: EINVAL (22)
libswap.c:45: TINFO: FS_NOCOW_FL attribute set on mntpoint/swapfile01

libswap.c:114: TCONF: Swapfile on btrfs not implemented

...

Kind regards,
Petr