[LTP] [PATCH] syscalls/statx01: loosen the stx_blocks check

Steve Muckle smuckle@google.com
Tue Jul 23 19:32:45 CEST 2019


On 7/23/19 4:03 AM, Cyril Hrubis wrote:
> Hi!
>> A filesystem may preallocate blocks (ext4 does this), so even though the
>> contents of the file may fit into a single block, statx may report more
>> than one block. Loosen the test to accommodate this.
>>
>> Signed-off-by: Steve Muckle <smuckle@google.com>
>> ---
>>   testcases/kernel/syscalls/statx/statx01.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/testcases/kernel/syscalls/statx/statx01.c b/testcases/kernel/syscalls/statx/statx01.c
>> index 23ea99b4a..5e705dc7d 100644
>> --- a/testcases/kernel/syscalls/statx/statx01.c
>> +++ b/testcases/kernel/syscalls/statx/statx01.c
>> @@ -92,7 +92,7 @@ static void test_normal_file(void)
>>   			buff.stx_mode, MODE);
>>   
>>   
>> -	if (buff.stx_blocks <= buff.stx_blksize/512)
>> +	if (buff.stx_blocks <= 128)
> 
> Why 128?

Was just restoring it to what it was previously.

> Can't we rather multiply the buff.stx_blksize/512 by 16?

That would work for ext4, but should this be loosened further to give 
some headroom in case some FS preallocates more? Or is it preferable to 
keep the test as strict as possible and loosen it when/if failures happen?


More information about the ltp mailing list