lkml.org 
[lkml]   [2022]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe:[PATCH] xfs: getattr ignore blocks beyond eof
>> From: Cheng Lin <cheng.lin130@zte.com.cn>
>>
>> Blocks beyond EOF, which preallocated, will be reclaimed at some time.
>> These blocks can be ignored when getattr.
>>
>> This patch will optimize query accuracy for getattr blocks.
>Huh? This subtracts posteof blocks from the query results, which makes
>the results *less accurate*. Those blocks are mapped to the file, hence
>they are supposed to be counted in nblocks.
>--D
Yes, those blocks are mapped to the file. And the results including them are
absolutely real for xfs, at the moment of query.

But, those blocks are like the credit without consumption, are unstalbe, and
will be reclaimed at some time. This may cause trouble for the application.
e.g. in a case,
1. Firstly, write 100k data to file;
2. query the result;
3. close the file;
4. query the result.

fd stat wrt[96 @ 393216]: blks[896], size[397312].
fd stat wrt[97 @ 397312]: blks[896], size[401408].
fd stat wrt[98 @ 401408]: blks[896], size[405504].
fd stat wrt[99 @ 405504]: blks[896], size[409600].
lstat open: blks[896], size[409600].
lstat close: blks[800], size[409600].

Here two problems:
1. why the result different before between after file close?
2. why the result not change after writing data, or a big change?

The above problems can be explained by fs preallocation.
If the impact of preallocation are closed in fs, not visible to the outside, the result is stable and real for the application.

That is the reason for this patch.
Thanks very much.

\
 
 \ /
  Last update: 2022-03-31 06:14    [W:0.049 / U:0.516 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site