From: <wang.yi59@zte.com.cn>
To: <djwong@kernel.org>
Cc: <linux-xfs@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<xue.zhihong@zte.com.cn>, <wang.liang82@zte.com.cn>,
<cheng.lin130@zte.com.cn>
Subject: Re:[PATCH] xfs: getattr ignore blocks beyond eof
Date: Thu, 31 Mar 2022 11:28:59 +0800 (CST) [thread overview]
Message-ID: <202203311128598207170@zte.com.cn> (raw)
In-Reply-To: <20220331003826.GL27690@magnolia>
>> 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.
next prev parent reply other threads:[~2022-03-31 4:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-31 8:02 [PATCH] xfs: getattr ignore blocks beyond eof Yi Wang
2022-03-31 0:38 ` Darrick J. Wong
2022-03-31 3:28 ` wang.yi59 [this message]
2022-03-31 5:33 ` Dave Chinner
2022-03-31 5:48 ` Dave Chinner
2022-03-31 8:32 ` wang.yi59
2022-03-31 21:21 ` [PATCH] " Dave Chinner
2022-04-01 8:09 ` wang.yi59
2022-04-01 22:14 ` [PATCH] " Dave Chinner
2022-03-31 2:57 ` kernel test robot
2022-03-31 3:07 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202203311128598207170@zte.com.cn \
--to=wang.yi59@zte.com.cn \
--cc=cheng.lin130@zte.com.cn \
--cc=djwong@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=wang.liang82@zte.com.cn \
--cc=xue.zhihong@zte.com.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).