[LTP] [PATCH V3 4/5] libswap: add function to prealloc contiguous file
Petr Vorel
pvorel@suse.cz
Tue Jan 23 16:47:35 CET 2024
> Hi Petr,
> On Tue, Jan 23, 2024 at 8:37 PM Petr Vorel <pvorel@suse.cz> wrote:
> > Hi Li,
> > > Hi Li,
> > > swapoff01 fails on TMPDIR on btrfs (regardless kernel version):
> > FYI it works on Tumbleweed with 6.7 kernel. It's broken on some older SLES
> > with 5.14 and all older kernels. I suppose with nocow (fixes I suggested
> > previously) would work as expected (TPASS, or TCONF on kernel < 5.0).
> You're right.
> We have to guarantee the swapfile is a contiguous file whatever the FS type
> is.
> So here making use of make_swapfile() is a hard requirement.
> And, I don't think the file first with 65536 blocks (in swapoff01) is not
> necessary.
Maybe not, but now we test on single swap size. Testing small swap and big swap
was IMHO more testing coverage (various filesystems behave differently on
different size), but given this would be more important for whole
.all_filesystems = 1 testing I'm ok with the change.
Kind regards,
Petr
> > Kind regards,
> > Petr
> > > # ./swapoff01
> > > rm -f -f -r swapoff01 swapoff02 *.o *.pyc .cache.mk *.dwo .*.dwo
> > > BUILD libltpswap.a
> > > make[1]: Nothing to be done for 'all'.
> > > CC testcases/kernel/syscalls/swapoff/swapoff01
> > > CC testcases/kernel/syscalls/swapoff/swapoff02
> > > tst_test.c:1709: TINFO: LTP version: 20230929-295-gc20ab499a
> > > tst_test.c:1595: TINFO: Timeout per run is 0h 00m 30s
> > > tst_ioctl.c:21: TINFO: FIBMAP ioctl is NOT supported: EINVAL (22)
> > > libswap.c:33: TINFO: FS_NOCOW_FL attribute set on ./tstswap
> > > swapoff01.c:24: TFAIL: Failed to turn on the swap file, skipping test
> > iteration: EINVAL (22)
> > > => I guess we would need to replace tst_fill_file() with
> > > prealloc_contiguous_file() (which is not public), or use make_swapfile()
> > > directly. But here we create file first with 65536 blocks and
> > make_swapfile()
> > > creates 10 block file (with prealloc_contiguous_file() or previously
> > also with
> > > tst_fill_file()).
> > > Kind regards,
> > > Petr
> > > --- testcases/kernel/syscalls/swapoff/swapoff01.c
> > > +++ testcases/kernel/syscalls/swapoff/swapoff01.c
> > > @@ -44,11 +44,8 @@ static void setup(void)
> > > tst_brk(TBROK,
> > > "Insufficient disk space to create swap file");
> > > - if (tst_fill_file("swapfile01", 0x00, 1024, 65536))
> > > + if (make_swapfile("swapfile01", 1))
> > > tst_brk(TBROK, "Failed to create file for swap");
> > > -
> > > - if (system("mkswap swapfile01 > tmpfile 2>&1") != 0)
> > > - tst_brk(TBROK, "Failed to make swapfile");
> > > }
More information about the ltp
mailing list