[LTP] [PATCH 1/1] Use real FS block size in fallocate05
Martin Doucha
mdoucha@suse.cz
Wed Dec 4 11:38:18 CET 2019
On 11/29/19 5:17 PM, Jan Stancek wrote:
>> No. tst_brk() will terminate the whole test on the first usual test case
>> (Ext2) and skip all the other file systems that do support fallocate().
>
> It shouldn't. tst_brk() does call exit() for test process, but
> .all_filesystems spawns new process for each fs.
You're right, I'll use tst_brk(TCONF, ...) then.
>> I don't like to blindly rely on the assumption that block size is always
>> a power of 2 and smaller than some magic number. Getting the real block
>> size is trivial. The only real question is how many free blocks do we
>> allow on a "full" file system in our tests. 1MB is just 16 blocks on
>> PPC64 so the magic number isn't particularly big anyway.
>
> OK, let's assume 16 is enough. Can we use that value also for ENOSPC check?
> TEST(fallocate(fd, 0, bufsize, 2 * statbuf.st_blksize));
I think it might be better to change the test scenario a bit:
1. fallocate(FALLOCATE_BLOCKS * blocksize)
2. tst_fill_fs()
3. write(FALLOCATE_BLOCKS * blocksize)
4. repeat fallocate(blocksize) until we get ENOSPC
5. write() into all blocks allocated in step 4
6. check that another write() will get ENOSPC
7. test fallocate(PUNCH_HOLE | KEEP_SIZE)
This should get us around the issue with tst_fill_fs() and still
properly validate that fallocate() handles full FS gracefully.
The only remaining issue is whether it's correct for Btrfs to only
release blocks when you deallocate the whole file. I still haven't heard
back from our Btrfs dev.
--
Martin Doucha mdoucha@suse.cz
QA Engineer for Software Maintenance
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic
More information about the ltp
mailing list