linux-f2fs-devel Mailing List for linux-f2fs
Brought to you by:
kjgkr
You can subscribe to this list here.
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(10) |
Dec
(98) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2013 |
Jan
(100) |
Feb
(72) |
Mar
(79) |
Apr
(122) |
May
(93) |
Jun
(97) |
Jul
(72) |
Aug
(72) |
Sep
(73) |
Oct
(121) |
Nov
(161) |
Dec
(206) |
| 2014 |
Jan
(75) |
Feb
(54) |
Mar
(82) |
Apr
(98) |
May
(67) |
Jun
(89) |
Jul
(136) |
Aug
(122) |
Sep
(136) |
Oct
(58) |
Nov
(87) |
Dec
(114) |
| 2015 |
Jan
(140) |
Feb
(129) |
Mar
(141) |
Apr
(71) |
May
(192) |
Jun
(52) |
Jul
(120) |
Aug
(125) |
Sep
(157) |
Oct
(100) |
Nov
(54) |
Dec
(248) |
| 2016 |
Jan
(301) |
Feb
(180) |
Mar
(138) |
Apr
(137) |
May
(145) |
Jun
(123) |
Jul
(98) |
Aug
(143) |
Sep
(196) |
Oct
(166) |
Nov
(205) |
Dec
(141) |
| 2017 |
Jan
(167) |
Feb
(275) |
Mar
(273) |
Apr
(239) |
May
(193) |
Jun
(171) |
Jul
(226) |
Aug
(153) |
Sep
(212) |
Oct
(311) |
Nov
(257) |
Dec
(418) |
| 2018 |
Jan
(474) |
Feb
(188) |
Mar
(252) |
Apr
(500) |
May
(176) |
Jun
(291) |
Jul
(361) |
Aug
(331) |
Sep
(355) |
Oct
(154) |
Nov
(209) |
Dec
(185) |
| 2019 |
Jan
(172) |
Feb
(214) |
Mar
(247) |
Apr
(425) |
May
(273) |
Jun
(360) |
Jul
(400) |
Aug
(409) |
Sep
(149) |
Oct
(218) |
Nov
(319) |
Dec
(225) |
| 2020 |
Jan
(231) |
Feb
(487) |
Mar
(411) |
Apr
(258) |
May
(292) |
Jun
(369) |
Jul
(407) |
Aug
(173) |
Sep
(266) |
Oct
(317) |
Nov
(273) |
Dec
(391) |
| 2021 |
Jan
(285) |
Feb
(130) |
Mar
(232) |
Apr
(156) |
May
(311) |
Jun
(252) |
Jul
(336) |
Aug
(326) |
Sep
(151) |
Oct
(86) |
Nov
(114) |
Dec
(125) |
| 2022 |
Jan
(132) |
Feb
(167) |
Mar
(230) |
Apr
(460) |
May
(334) |
Jun
(324) |
Jul
(147) |
Aug
(188) |
Sep
(262) |
Oct
(346) |
Nov
(314) |
Dec
(245) |
| 2023 |
Jan
(306) |
Feb
(190) |
Mar
(199) |
Apr
(444) |
May
(378) |
Jun
(441) |
Jul
(403) |
Aug
(464) |
Sep
(144) |
Oct
(98) |
Nov
(152) |
Dec
(212) |
| 2024 |
Jan
(288) |
Feb
(365) |
Mar
(218) |
Apr
(275) |
May
(200) |
Jun
(228) |
Jul
(255) |
Aug
(228) |
Sep
(280) |
Oct
(319) |
Nov
(241) |
Dec
(174) |
| 2025 |
Jan
(166) |
Feb
(171) |
Mar
(469) |
Apr
(235) |
May
(257) |
Jun
(342) |
Jul
(391) |
Aug
(328) |
Sep
(208) |
Oct
(254) |
Nov
(292) |
Dec
(123) |
|
From: Joanne C. <joa...@go...> - 2025-12-19 08:53:34
|
On Fri, Dec 19, 2025 at 1:30 PM Christoph Hellwig <hc...@in...> wrote: > On Thu, Dec 18, 2025 at 08:02:48PM +0800, Joanne Chang wrote: > > Thank you for the feedback. I will implement a > > _require_blocks_in_file helper in the next version. As far as I > > know, there isn't a generic way to query the block number limit > > across filesystems, so I plan to hardcode the known limit for > > F2FS within the helper for now. > > Oh, the limits is not the file size per se, so the number of blocks? > I.e. you can have a 64-bit i_size, but if the file isn't spare it > eventually can't fill holes? That really does seem like behavior > applications would not not expect, aka a bug. Thanks for the reply. To clarify, I meant testing the architectural limit of blocks per file, not the current free blocks. Sorry for any confusion in my previous reply. The limit is indeed the maximum file size. However, since both the F2FS file size limit and the test's requirements are calculated as (block_number * block_size), I believe it is simpler to just test the block number. Best regards, Joanne |
|
From: Christoph H. <hc...@in...> - 2025-12-19 05:30:20
|
On Thu, Dec 18, 2025 at 08:02:48PM +0800, Joanne Chang wrote: > Thank you for the feedback. I will implement a > _require_blocks_in_file helper in the next version. As far as I > know, there isn't a generic way to query the block number limit > across filesystems, so I plan to hardcode the known limit for > F2FS within the helper for now. Oh, the limits is not the file size per se, so the number of blocks? I.e. you can have a 64-bit i_size, but if the file isn't spare it eventually can't fill holes? That really does seem like behavior applications would not not expect, aka a bug. |
|
From: Zhiguo N. <zhi...@un...> - 2025-12-19 04:05:02
|
It missed the stat count in f2fs_gc_range.
Cc: st...@ke...
Fixes: 2f0209f579d1 ("f2fs: separate f2fs_gc_range() to use GC for a range")
Signed-off-by: Zhiguo Niu <zhi...@un...>
---
V2: add Cc and Fixes tags
---
fs/f2fs/gc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index 6afd57f..58b291d 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -2096,6 +2096,7 @@ int f2fs_gc_range(struct f2fs_sb_info *sbi,
if (unlikely(f2fs_cp_error(sbi)))
return -EIO;
+ stat_inc_gc_call_count(sbi, FOREGROUND);
for (segno = start_seg; segno <= end_seg; segno += SEGS_PER_SEC(sbi)) {
struct gc_inode_list gc_list = {
.ilist = LIST_HEAD_INIT(gc_list.ilist),
--
1.9.1
|
|
From: Chao Yu <ch...@ke...> - 2025-12-19 03:05:57
|
On 12/17/2025 8:42 AM, Jaegeuk Kim wrote: > Signed-off-by: Jaegeuk Kim <ja...@ke...> Reviewed-by: Chao Yu <ch...@ke...> Thanks, |
|
From: Zhiguo N. <niu...@gm...> - 2025-12-19 03:05:25
|
Chao Yu via Linux-f2fs-devel <lin...@li...>
于2025年12月19日周五 10:56写道:
>
> As Zhiguo reported, nat entry of quota inode could be corrupted:
>
> "ino/block_addr=NULL_ADDR in nid=4 entry"
>
> We'd better to do sanity check on quota inode to detect and record
> nat.blk_addr inconsistency, so that we can have a chance to repair
> it w/ later fsck.
>
> Reported-by: Zhiguo Niu <zhi...@un...>
> Signed-off-by: Chao Yu <ch...@ke...>
Reviewed-by: Zhiguo Niu <zhi...@un...>
Thanks!
> ---
> fs/f2fs/f2fs.h | 6 +++---
> fs/f2fs/inode.c | 2 +-
> fs/f2fs/node.c | 11 +++++++++++
> 3 files changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index 65ca1a5eaa88..c458df92bb0d 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -4928,16 +4928,16 @@ static inline bool is_journalled_quota(struct f2fs_sb_info *sbi)
> return false;
> }
>
> -static inline bool f2fs_quota_file(struct inode *inode)
> +static inline bool f2fs_quota_file(struct f2fs_sb_info *sbi, nid_t ino)
> {
> #ifdef CONFIG_QUOTA
> int i;
>
> - if (!f2fs_sb_has_quota_ino(F2FS_I_SB(inode)))
> + if (!f2fs_sb_has_quota_ino(sbi))
> return false;
>
> for (i = 0; i < MAXQUOTAS; i++) {
> - if (f2fs_qf_ino(F2FS_I_SB(inode)->sb, i) == inode->i_ino)
> + if (f2fs_qf_ino(sbi->sb, i) == ino)
> return true;
> }
> #endif
> diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
> index 921fb02c0f49..d1270b25ad7d 100644
> --- a/fs/f2fs/inode.c
> +++ b/fs/f2fs/inode.c
> @@ -621,7 +621,7 @@ struct inode *f2fs_iget(struct super_block *sb, unsigned long ino)
> inode->i_fop = &f2fs_file_operations;
> inode->i_mapping->a_ops = &f2fs_dblock_aops;
> if (IS_IMMUTABLE(inode) && !f2fs_compressed_file(inode) &&
> - !f2fs_quota_file(inode))
> + !f2fs_quota_file(sbi, inode->i_ino))
> mapping_set_folio_min_order(inode->i_mapping, 0);
> } else if (S_ISDIR(inode->i_mode)) {
> inode->i_op = &f2fs_dir_inode_operations;
> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> index 7feead595ba5..f1e6fa2dccc9 100644
> --- a/fs/f2fs/node.c
> +++ b/fs/f2fs/node.c
> @@ -643,6 +643,17 @@ int f2fs_get_node_info(struct f2fs_sb_info *sbi, nid_t nid,
> return -EFSCORRUPTED;
> }
>
> + if (unlikely(f2fs_quota_file(sbi, ni->nid) &&
> + !__is_valid_data_blkaddr(ni->blk_addr))) {
> + set_sbi_flag(sbi, SBI_NEED_FSCK);
> + f2fs_err_ratelimited(sbi,
> + "f2fs_get_node_info of %pS: inconsistent nat entry from qf_ino, "
> + "ino:%u, nid:%u, blkaddr:%u, ver:%u, flag:%u",
> + __builtin_return_address(0),
> + ni->ino, ni->nid, ni->blk_addr, ni->version, ni->flag);
> + f2fs_handle_error(sbi, ERROR_INCONSISTENT_NAT);
> + }
> +
> /* cache nat entry */
> if (need_cache)
> cache_nat_entry(sbi, nid, &ne);
> --
> 2.40.1
>
>
>
> _______________________________________________
> Linux-f2fs-devel mailing list
> Lin...@li...
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
|
|
From: Chao Yu <ch...@ke...> - 2025-12-19 03:05:12
|
On 12/17/2025 3:46 PM, Zhiguo Niu wrote:
> It missed the stat count in f2fs_gc_range.
>
Cc: st...@ke...
And add Fixes line?
Thanks,
> Signed-off-by: Zhiguo Niu <zhi...@un...>
> ---
> fs/f2fs/gc.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
> index 6afd57f..58b291d 100644
> --- a/fs/f2fs/gc.c
> +++ b/fs/f2fs/gc.c
> @@ -2096,6 +2096,7 @@ int f2fs_gc_range(struct f2fs_sb_info *sbi,
> if (unlikely(f2fs_cp_error(sbi)))
> return -EIO;
>
> + stat_inc_gc_call_count(sbi, FOREGROUND);
> for (segno = start_seg; segno <= end_seg; segno += SEGS_PER_SEC(sbi)) {
> struct gc_inode_list gc_list = {
> .ilist = LIST_HEAD_INIT(gc_list.ilist),
|
|
From: Chao Yu <ch...@ke...> - 2025-12-19 03:02:05
|
On 12/17/2025 3:45 PM, Zhiguo Niu wrote: > 1. qf_inum has been got and checked in its caller f2fs_enable_quotas > 2. f2fs_sb_has_quota_ino has bee checked in its all callers > 3. use sbi cleanup F2FS_SB(sb) > > Signed-off-by: Zhiguo Niu <zhi...@un...> Reviewed-by: Chao Yu <ch...@ke...> Thanks, |
|
From: Chao Yu <ch...@ke...> - 2025-12-19 02:52:53
|
On 12/18/2025 9:30 AM, Zhiguo Niu wrote:
> Chao Yu <ch...@ke...> 于2025年12月17日周三 16:03写道:
>>
>> On 12/17/25 09:46, Zhiguo Niu wrote:
>>> Chao Yu <ch...@ke...> 于2025年12月16日周二 16:49写道:
>>>>
>>>> On 12/16/25 09:36, Zhiguo Niu wrote:
>>>>> Chao Yu via Linux-f2fs-devel <lin...@li...>
>>>>> 于2025年12月15日周一 20:34写道:
>>>>>>
>>>>>> In order to avoid loading corrupted nat entry from disk.
>>>>>>
>>>>>> Cc: st...@ke...
>>>>>> Signed-off-by: Chao Yu <ch...@ke...>
>>>>>> ---
>>>>>> fs/f2fs/node.c | 9 +++++----
>>>>>> 1 file changed, 5 insertions(+), 4 deletions(-)
>>>>>>
>>>>>> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
>>>>>> index ce471e033774..13c88dfd790d 100644
>>>>>> --- a/fs/f2fs/node.c
>>>>>> +++ b/fs/f2fs/node.c
>>>>>> @@ -630,14 +630,15 @@ int f2fs_get_node_info(struct f2fs_sb_info *sbi, nid_t nid,
>>>>>> node_info_from_raw_nat(ni, &ne);
>>>>>> f2fs_folio_put(folio, true);
>>>>>> sanity_check:
>>>>>> - if (__is_valid_data_blkaddr(ni->blk_addr) &&
>>>>>> + if (unlikely(ni->nid != nid ||
>>>>> Hi Chao,
>>>>> (ni->nid==nid) should be always true? because the code:
>>>>>
>>>>> ni->flag = 0;
>>>>> ni->nid = nid;
>>>>> retry:
>>>>> or am I missing something?
>>>>
>>>> Zhiguo,
>>>>
>>>> Oh, I may missed something, let's ignore this patch.
>>>>
>>>>>
>>>>>> + (__is_valid_data_blkaddr(ni->blk_addr) &&
>>>>> btw, Is it possible to detect that some valid Nid entries contain
>>>>> incorrect content?
>>>>> such as ino/block_addr=NULL_ADDR in nid=4 entry?
>>>>
>>>> Something like this?
>>>>
>>>> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
>>>> index 65ca1a5eaa88..c458df92bb0d 100644
>>>> --- a/fs/f2fs/f2fs.h
>>>> +++ b/fs/f2fs/f2fs.h
>>>> @@ -4928,16 +4928,16 @@ static inline bool is_journalled_quota(struct f2fs_sb_info *sbi)
>>>> return false;
>>>> }
>>>>
>>>> -static inline bool f2fs_quota_file(struct inode *inode)
>>>> +static inline bool f2fs_quota_file(struct f2fs_sb_info *sbi, nid_t ino)
>>>> {
>>>> #ifdef CONFIG_QUOTA
>>>> int i;
>>>>
>>>> - if (!f2fs_sb_has_quota_ino(F2FS_I_SB(inode)))
>>>> + if (!f2fs_sb_has_quota_ino(sbi))
>>>> return false;
>>>>
>>>> for (i = 0; i < MAXQUOTAS; i++) {
>>>> - if (f2fs_qf_ino(F2FS_I_SB(inode)->sb, i) == inode->i_ino)
>>>> + if (f2fs_qf_ino(sbi->sb, i) == ino)
>>>> return true;
>>>> }
>>>> #endif
>>>> diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
>>>> index 921fb02c0f49..d1270b25ad7d 100644
>>>> --- a/fs/f2fs/inode.c
>>>> +++ b/fs/f2fs/inode.c
>>>> @@ -621,7 +621,7 @@ make_now:
>>>> inode->i_fop = &f2fs_file_operations;
>>>> inode->i_mapping->a_ops = &f2fs_dblock_aops;
>>>> if (IS_IMMUTABLE(inode) && !f2fs_compressed_file(inode) &&
>>>> - !f2fs_quota_file(inode))
>>>> + !f2fs_quota_file(sbi, inode->i_ino))
>>>> mapping_set_folio_min_order(inode->i_mapping, 0);
>>>> } else if (S_ISDIR(inode->i_mode)) {
>>>> inode->i_op = &f2fs_dir_inode_operations;
>>>> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
>>>> index 7feead595ba5..10448e115ea0 100644
>>>> --- a/fs/f2fs/node.c
>>>> +++ b/fs/f2fs/node.c
>>>> @@ -643,6 +643,17 @@ sanity_check:
>>>> return -EFSCORRUPTED;
>>>> }
>>>>
>>> Hi Chao
>>>> + if (unlikely(f2fs_quota_file(sbi, ni->nid) &&
>>>> + __is_valid_data_blkaddr(ni->blk_addr))) {
>>> __is_valid_data_blkaddr(ni->blk_addr) --> !
>>> __is_valid_data_blkaddr(ni->blk_addr)??
>>
>> Zhiguo,
>>
>> Oh, yes.
>>
>>>> + set_sbi_flag(sbi, SBI_NEED_FSCK);
>>>> + f2fs_err_ratelimited(sbi,
>>>> + "f2fs_get_node_info of %pS: inconsistent nat entry from qf_ino, "
>>>> + "ino:%u, nid:%u, blkaddr:%u, ver:%u, flag:%u",
>>>> + __builtin_return_address(0),
>>>> + ni->ino, ni->nid, ni->blk_addr, ni->version, ni->flag);
>>>> + f2fs_handle_error(sbi, ERROR_INCONSISTENT_NAT);
>>>> + }
>>>> +
>>> I think this is ok for quota file,
>>> and This is not easy to apply to all common cases( nid entry not only
>>> for quota), right? ^^
>>
>> Yes, I guess partial of them may be common case, which may happen in race
>> condition, e.g. truncate vs read.
> Hi Chao,
> Thanks for this explaination, so
> Could you resend this official patch?
Done. :)
Thanks,
> Thanks!
>> Thanks,
>>
>>> Thanks!
>>>> /* cache nat entry */
>>>> if (need_cache)
>>>> cache_nat_entry(sbi, nid, &ne);
>>>>
>>>> Thanks,
>>>>
>>>>> Thanks
>>>>>> !f2fs_is_valid_blkaddr(sbi, ni->blk_addr,
>>>>>> - DATA_GENERIC_ENHANCE)) {
>>>>>> + DATA_GENERIC_ENHANCE)))) {
>>>>>> set_sbi_flag(sbi, SBI_NEED_FSCK);
>>>>>> f2fs_err_ratelimited(sbi,
>>>>>> - "f2fs_get_node_info of %pS: inconsistent nat entry, "
>>>>>> + "f2fs_get_node_info of %pS: nid:%u, inconsistent nat entry, "
>>>>>> "ino:%u, nid:%u, blkaddr:%u, ver:%u, flag:%u",
>>>>>> - __builtin_return_address(0),
>>>>>> + __builtin_return_address(0), nid,
>>>>>> ni->ino, ni->nid, ni->blk_addr, ni->version, ni->flag);
>>>>>> f2fs_handle_error(sbi, ERROR_INCONSISTENT_NAT);
>>>>>> return -EFSCORRUPTED;
>>>>>> --
>>>>>> 2.49.0
>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Linux-f2fs-devel mailing list
>>>>>> Lin...@li...
>>>>>> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
>>>>
>>
|
|
From: Chao Yu <ch...@ke...> - 2025-12-19 02:51:24
|
As Zhiguo reported, nat entry of quota inode could be corrupted:
"ino/block_addr=NULL_ADDR in nid=4 entry"
We'd better to do sanity check on quota inode to detect and record
nat.blk_addr inconsistency, so that we can have a chance to repair
it w/ later fsck.
Reported-by: Zhiguo Niu <zhi...@un...>
Signed-off-by: Chao Yu <ch...@ke...>
---
fs/f2fs/f2fs.h | 6 +++---
fs/f2fs/inode.c | 2 +-
fs/f2fs/node.c | 11 +++++++++++
3 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 65ca1a5eaa88..c458df92bb0d 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -4928,16 +4928,16 @@ static inline bool is_journalled_quota(struct f2fs_sb_info *sbi)
return false;
}
-static inline bool f2fs_quota_file(struct inode *inode)
+static inline bool f2fs_quota_file(struct f2fs_sb_info *sbi, nid_t ino)
{
#ifdef CONFIG_QUOTA
int i;
- if (!f2fs_sb_has_quota_ino(F2FS_I_SB(inode)))
+ if (!f2fs_sb_has_quota_ino(sbi))
return false;
for (i = 0; i < MAXQUOTAS; i++) {
- if (f2fs_qf_ino(F2FS_I_SB(inode)->sb, i) == inode->i_ino)
+ if (f2fs_qf_ino(sbi->sb, i) == ino)
return true;
}
#endif
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
index 921fb02c0f49..d1270b25ad7d 100644
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -621,7 +621,7 @@ struct inode *f2fs_iget(struct super_block *sb, unsigned long ino)
inode->i_fop = &f2fs_file_operations;
inode->i_mapping->a_ops = &f2fs_dblock_aops;
if (IS_IMMUTABLE(inode) && !f2fs_compressed_file(inode) &&
- !f2fs_quota_file(inode))
+ !f2fs_quota_file(sbi, inode->i_ino))
mapping_set_folio_min_order(inode->i_mapping, 0);
} else if (S_ISDIR(inode->i_mode)) {
inode->i_op = &f2fs_dir_inode_operations;
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 7feead595ba5..f1e6fa2dccc9 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -643,6 +643,17 @@ int f2fs_get_node_info(struct f2fs_sb_info *sbi, nid_t nid,
return -EFSCORRUPTED;
}
+ if (unlikely(f2fs_quota_file(sbi, ni->nid) &&
+ !__is_valid_data_blkaddr(ni->blk_addr))) {
+ set_sbi_flag(sbi, SBI_NEED_FSCK);
+ f2fs_err_ratelimited(sbi,
+ "f2fs_get_node_info of %pS: inconsistent nat entry from qf_ino, "
+ "ino:%u, nid:%u, blkaddr:%u, ver:%u, flag:%u",
+ __builtin_return_address(0),
+ ni->ino, ni->nid, ni->blk_addr, ni->version, ni->flag);
+ f2fs_handle_error(sbi, ERROR_INCONSISTENT_NAT);
+ }
+
/* cache nat entry */
if (need_cache)
cache_nat_entry(sbi, nid, &ne);
--
2.40.1
|
|
From: Joanne C. <joa...@go...> - 2025-12-18 12:30:43
|
On Thu, Dec 18, 2025 at 3:33 PM Christoph Hellwig <hc...@in...> wrote: > On Thu, Dec 18, 2025 at 07:17:17AM +0000, Joanne Chang wrote: > > generic/735 attempts to create a file with nearly 2^32 blocks. However, > > the maximum block count per file in F2FS is limited by the capacity of > > the inode. This limit is roughly 2^30 blocks, which is significantly > > lower than the test's requirement. > > > > Signed-off-by: Joanne Chang <joa...@go...> > > --- > > tests/generic/735 | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/tests/generic/735 b/tests/generic/735 > > index 9bbdf3a1..d5ba5673 100755 > > --- a/tests/generic/735 > > +++ b/tests/generic/735 > > @@ -19,6 +19,9 @@ if [[ "$FSTYP" =~ ext[0-9]+ ]]; then > > _fixed_by_kernel_commit 2dcf5fde6dff "ext4: prevent the normalized size from exceeding EXT_MAX_BLOCKS" > > fi > > > > +# Block number 0xffffffff is too big for a file in f2fs. > > +_exclude_fs f2fs > > Please don't add random file system excludes. This should be > abstracted into a _require_max_file_size helper or similar. Thank you for the feedback. I will implement a _require_blocks_in_file helper in the next version. As far as I know, there isn't a generic way to query the block number limit across filesystems, so I plan to hardcode the known limit for F2FS within the helper for now. Please let me know if you have any further suggestions. Best regards, Joanne |
|
From: Christoph H. <hc...@in...> - 2025-12-18 07:33:17
|
On Thu, Dec 18, 2025 at 07:17:17AM +0000, Joanne Chang wrote: > generic/735 attempts to create a file with nearly 2^32 blocks. However, > the maximum block count per file in F2FS is limited by the capacity of > the inode. This limit is roughly 2^30 blocks, which is significantly > lower than the test's requirement. > > Signed-off-by: Joanne Chang <joa...@go...> > --- > tests/generic/735 | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/tests/generic/735 b/tests/generic/735 > index 9bbdf3a1..d5ba5673 100755 > --- a/tests/generic/735 > +++ b/tests/generic/735 > @@ -19,6 +19,9 @@ if [[ "$FSTYP" =~ ext[0-9]+ ]]; then > _fixed_by_kernel_commit 2dcf5fde6dff "ext4: prevent the normalized size from exceeding EXT_MAX_BLOCKS" > fi > > +# Block number 0xffffffff is too big for a file in f2fs. > +_exclude_fs f2fs Please don't add random file system excludes. This should be abstracted into a _require_max_file_size helper or similar. |
|
From: Joanne C. <joa...@go...> - 2025-12-18 07:17:35
|
generic/735 attempts to create a file with nearly 2^32 blocks. However, the maximum block count per file in F2FS is limited by the capacity of the inode. This limit is roughly 2^30 blocks, which is significantly lower than the test's requirement. Signed-off-by: Joanne Chang <joa...@go...> --- tests/generic/735 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/generic/735 b/tests/generic/735 index 9bbdf3a1..d5ba5673 100755 --- a/tests/generic/735 +++ b/tests/generic/735 @@ -19,6 +19,9 @@ if [[ "$FSTYP" =~ ext[0-9]+ ]]; then _fixed_by_kernel_commit 2dcf5fde6dff "ext4: prevent the normalized size from exceeding EXT_MAX_BLOCKS" fi +# Block number 0xffffffff is too big for a file in f2fs. +_exclude_fs f2fs + _require_odirect _require_xfs_io_command "falloc" _require_xfs_io_command "finsert" -- 2.52.0.313.g674ac2bdf7-goog |
|
From: Zhiguo N. <niu...@gm...> - 2025-12-18 01:30:49
|
Chao Yu <ch...@ke...> 于2025年12月17日周三 16:03写道:
>
> On 12/17/25 09:46, Zhiguo Niu wrote:
> > Chao Yu <ch...@ke...> 于2025年12月16日周二 16:49写道:
> >>
> >> On 12/16/25 09:36, Zhiguo Niu wrote:
> >>> Chao Yu via Linux-f2fs-devel <lin...@li...>
> >>> 于2025年12月15日周一 20:34写道:
> >>>>
> >>>> In order to avoid loading corrupted nat entry from disk.
> >>>>
> >>>> Cc: st...@ke...
> >>>> Signed-off-by: Chao Yu <ch...@ke...>
> >>>> ---
> >>>> fs/f2fs/node.c | 9 +++++----
> >>>> 1 file changed, 5 insertions(+), 4 deletions(-)
> >>>>
> >>>> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> >>>> index ce471e033774..13c88dfd790d 100644
> >>>> --- a/fs/f2fs/node.c
> >>>> +++ b/fs/f2fs/node.c
> >>>> @@ -630,14 +630,15 @@ int f2fs_get_node_info(struct f2fs_sb_info *sbi, nid_t nid,
> >>>> node_info_from_raw_nat(ni, &ne);
> >>>> f2fs_folio_put(folio, true);
> >>>> sanity_check:
> >>>> - if (__is_valid_data_blkaddr(ni->blk_addr) &&
> >>>> + if (unlikely(ni->nid != nid ||
> >>> Hi Chao,
> >>> (ni->nid==nid) should be always true? because the code:
> >>>
> >>> ni->flag = 0;
> >>> ni->nid = nid;
> >>> retry:
> >>> or am I missing something?
> >>
> >> Zhiguo,
> >>
> >> Oh, I may missed something, let's ignore this patch.
> >>
> >>>
> >>>> + (__is_valid_data_blkaddr(ni->blk_addr) &&
> >>> btw, Is it possible to detect that some valid Nid entries contain
> >>> incorrect content?
> >>> such as ino/block_addr=NULL_ADDR in nid=4 entry?
> >>
> >> Something like this?
> >>
> >> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> >> index 65ca1a5eaa88..c458df92bb0d 100644
> >> --- a/fs/f2fs/f2fs.h
> >> +++ b/fs/f2fs/f2fs.h
> >> @@ -4928,16 +4928,16 @@ static inline bool is_journalled_quota(struct f2fs_sb_info *sbi)
> >> return false;
> >> }
> >>
> >> -static inline bool f2fs_quota_file(struct inode *inode)
> >> +static inline bool f2fs_quota_file(struct f2fs_sb_info *sbi, nid_t ino)
> >> {
> >> #ifdef CONFIG_QUOTA
> >> int i;
> >>
> >> - if (!f2fs_sb_has_quota_ino(F2FS_I_SB(inode)))
> >> + if (!f2fs_sb_has_quota_ino(sbi))
> >> return false;
> >>
> >> for (i = 0; i < MAXQUOTAS; i++) {
> >> - if (f2fs_qf_ino(F2FS_I_SB(inode)->sb, i) == inode->i_ino)
> >> + if (f2fs_qf_ino(sbi->sb, i) == ino)
> >> return true;
> >> }
> >> #endif
> >> diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
> >> index 921fb02c0f49..d1270b25ad7d 100644
> >> --- a/fs/f2fs/inode.c
> >> +++ b/fs/f2fs/inode.c
> >> @@ -621,7 +621,7 @@ make_now:
> >> inode->i_fop = &f2fs_file_operations;
> >> inode->i_mapping->a_ops = &f2fs_dblock_aops;
> >> if (IS_IMMUTABLE(inode) && !f2fs_compressed_file(inode) &&
> >> - !f2fs_quota_file(inode))
> >> + !f2fs_quota_file(sbi, inode->i_ino))
> >> mapping_set_folio_min_order(inode->i_mapping, 0);
> >> } else if (S_ISDIR(inode->i_mode)) {
> >> inode->i_op = &f2fs_dir_inode_operations;
> >> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> >> index 7feead595ba5..10448e115ea0 100644
> >> --- a/fs/f2fs/node.c
> >> +++ b/fs/f2fs/node.c
> >> @@ -643,6 +643,17 @@ sanity_check:
> >> return -EFSCORRUPTED;
> >> }
> >>
> > Hi Chao
> >> + if (unlikely(f2fs_quota_file(sbi, ni->nid) &&
> >> + __is_valid_data_blkaddr(ni->blk_addr))) {
> > __is_valid_data_blkaddr(ni->blk_addr) --> !
> > __is_valid_data_blkaddr(ni->blk_addr)??
>
> Zhiguo,
>
> Oh, yes.
>
> >> + set_sbi_flag(sbi, SBI_NEED_FSCK);
> >> + f2fs_err_ratelimited(sbi,
> >> + "f2fs_get_node_info of %pS: inconsistent nat entry from qf_ino, "
> >> + "ino:%u, nid:%u, blkaddr:%u, ver:%u, flag:%u",
> >> + __builtin_return_address(0),
> >> + ni->ino, ni->nid, ni->blk_addr, ni->version, ni->flag);
> >> + f2fs_handle_error(sbi, ERROR_INCONSISTENT_NAT);
> >> + }
> >> +
> > I think this is ok for quota file,
> > and This is not easy to apply to all common cases( nid entry not only
> > for quota), right? ^^
>
> Yes, I guess partial of them may be common case, which may happen in race
> condition, e.g. truncate vs read.
Hi Chao,
Thanks for this explaination, so
Could you resend this official patch?
Thanks!
> Thanks,
>
> > Thanks!
> >> /* cache nat entry */
> >> if (need_cache)
> >> cache_nat_entry(sbi, nid, &ne);
> >>
> >> Thanks,
> >>
> >>> Thanks
> >>>> !f2fs_is_valid_blkaddr(sbi, ni->blk_addr,
> >>>> - DATA_GENERIC_ENHANCE)) {
> >>>> + DATA_GENERIC_ENHANCE)))) {
> >>>> set_sbi_flag(sbi, SBI_NEED_FSCK);
> >>>> f2fs_err_ratelimited(sbi,
> >>>> - "f2fs_get_node_info of %pS: inconsistent nat entry, "
> >>>> + "f2fs_get_node_info of %pS: nid:%u, inconsistent nat entry, "
> >>>> "ino:%u, nid:%u, blkaddr:%u, ver:%u, flag:%u",
> >>>> - __builtin_return_address(0),
> >>>> + __builtin_return_address(0), nid,
> >>>> ni->ino, ni->nid, ni->blk_addr, ni->version, ni->flag);
> >>>> f2fs_handle_error(sbi, ERROR_INCONSISTENT_NAT);
> >>>> return -EFSCORRUPTED;
> >>>> --
> >>>> 2.49.0
> >>>>
> >>>>
> >>>>
> >>>> _______________________________________________
> >>>> Linux-f2fs-devel mailing list
> >>>> Lin...@li...
> >>>> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
> >>
>
|
|
From: Żaneta K. <zan...@fo...> - 2025-12-17 09:12:43
|
Dzień dobry, jako lider w usługach kurierskich w Polsce przygotowaliśmy elastyczne rozwiązanie dla przedsiębiorców. Stworzyliśmy abonament łączący dostawy do Paczkomat 24/7 oraz obsługę kurierską - jeden dostawca, jedna faktura i przewidywalne, stałe koszty. Czy mogę przedstawić, co możemy zaproponować względem Państwa potrzeb? Pozdrawiam Żaneta Kędzierska |
|
From: Chao Yu <ch...@ke...> - 2025-12-17 08:03:43
|
On 12/17/25 09:46, Zhiguo Niu wrote:
> Chao Yu <ch...@ke...> 于2025年12月16日周二 16:49写道:
>>
>> On 12/16/25 09:36, Zhiguo Niu wrote:
>>> Chao Yu via Linux-f2fs-devel <lin...@li...>
>>> 于2025年12月15日周一 20:34写道:
>>>>
>>>> In order to avoid loading corrupted nat entry from disk.
>>>>
>>>> Cc: st...@ke...
>>>> Signed-off-by: Chao Yu <ch...@ke...>
>>>> ---
>>>> fs/f2fs/node.c | 9 +++++----
>>>> 1 file changed, 5 insertions(+), 4 deletions(-)
>>>>
>>>> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
>>>> index ce471e033774..13c88dfd790d 100644
>>>> --- a/fs/f2fs/node.c
>>>> +++ b/fs/f2fs/node.c
>>>> @@ -630,14 +630,15 @@ int f2fs_get_node_info(struct f2fs_sb_info *sbi, nid_t nid,
>>>> node_info_from_raw_nat(ni, &ne);
>>>> f2fs_folio_put(folio, true);
>>>> sanity_check:
>>>> - if (__is_valid_data_blkaddr(ni->blk_addr) &&
>>>> + if (unlikely(ni->nid != nid ||
>>> Hi Chao,
>>> (ni->nid==nid) should be always true? because the code:
>>>
>>> ni->flag = 0;
>>> ni->nid = nid;
>>> retry:
>>> or am I missing something?
>>
>> Zhiguo,
>>
>> Oh, I may missed something, let's ignore this patch.
>>
>>>
>>>> + (__is_valid_data_blkaddr(ni->blk_addr) &&
>>> btw, Is it possible to detect that some valid Nid entries contain
>>> incorrect content?
>>> such as ino/block_addr=NULL_ADDR in nid=4 entry?
>>
>> Something like this?
>>
>> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
>> index 65ca1a5eaa88..c458df92bb0d 100644
>> --- a/fs/f2fs/f2fs.h
>> +++ b/fs/f2fs/f2fs.h
>> @@ -4928,16 +4928,16 @@ static inline bool is_journalled_quota(struct f2fs_sb_info *sbi)
>> return false;
>> }
>>
>> -static inline bool f2fs_quota_file(struct inode *inode)
>> +static inline bool f2fs_quota_file(struct f2fs_sb_info *sbi, nid_t ino)
>> {
>> #ifdef CONFIG_QUOTA
>> int i;
>>
>> - if (!f2fs_sb_has_quota_ino(F2FS_I_SB(inode)))
>> + if (!f2fs_sb_has_quota_ino(sbi))
>> return false;
>>
>> for (i = 0; i < MAXQUOTAS; i++) {
>> - if (f2fs_qf_ino(F2FS_I_SB(inode)->sb, i) == inode->i_ino)
>> + if (f2fs_qf_ino(sbi->sb, i) == ino)
>> return true;
>> }
>> #endif
>> diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
>> index 921fb02c0f49..d1270b25ad7d 100644
>> --- a/fs/f2fs/inode.c
>> +++ b/fs/f2fs/inode.c
>> @@ -621,7 +621,7 @@ make_now:
>> inode->i_fop = &f2fs_file_operations;
>> inode->i_mapping->a_ops = &f2fs_dblock_aops;
>> if (IS_IMMUTABLE(inode) && !f2fs_compressed_file(inode) &&
>> - !f2fs_quota_file(inode))
>> + !f2fs_quota_file(sbi, inode->i_ino))
>> mapping_set_folio_min_order(inode->i_mapping, 0);
>> } else if (S_ISDIR(inode->i_mode)) {
>> inode->i_op = &f2fs_dir_inode_operations;
>> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
>> index 7feead595ba5..10448e115ea0 100644
>> --- a/fs/f2fs/node.c
>> +++ b/fs/f2fs/node.c
>> @@ -643,6 +643,17 @@ sanity_check:
>> return -EFSCORRUPTED;
>> }
>>
> Hi Chao
>> + if (unlikely(f2fs_quota_file(sbi, ni->nid) &&
>> + __is_valid_data_blkaddr(ni->blk_addr))) {
> __is_valid_data_blkaddr(ni->blk_addr) --> !
> __is_valid_data_blkaddr(ni->blk_addr)??
Zhiguo,
Oh, yes.
>> + set_sbi_flag(sbi, SBI_NEED_FSCK);
>> + f2fs_err_ratelimited(sbi,
>> + "f2fs_get_node_info of %pS: inconsistent nat entry from qf_ino, "
>> + "ino:%u, nid:%u, blkaddr:%u, ver:%u, flag:%u",
>> + __builtin_return_address(0),
>> + ni->ino, ni->nid, ni->blk_addr, ni->version, ni->flag);
>> + f2fs_handle_error(sbi, ERROR_INCONSISTENT_NAT);
>> + }
>> +
> I think this is ok for quota file,
> and This is not easy to apply to all common cases( nid entry not only
> for quota), right? ^^
Yes, I guess partial of them may be common case, which may happen in race
condition, e.g. truncate vs read.
Thanks,
> Thanks!
>> /* cache nat entry */
>> if (need_cache)
>> cache_nat_entry(sbi, nid, &ne);
>>
>> Thanks,
>>
>>> Thanks
>>>> !f2fs_is_valid_blkaddr(sbi, ni->blk_addr,
>>>> - DATA_GENERIC_ENHANCE)) {
>>>> + DATA_GENERIC_ENHANCE)))) {
>>>> set_sbi_flag(sbi, SBI_NEED_FSCK);
>>>> f2fs_err_ratelimited(sbi,
>>>> - "f2fs_get_node_info of %pS: inconsistent nat entry, "
>>>> + "f2fs_get_node_info of %pS: nid:%u, inconsistent nat entry, "
>>>> "ino:%u, nid:%u, blkaddr:%u, ver:%u, flag:%u",
>>>> - __builtin_return_address(0),
>>>> + __builtin_return_address(0), nid,
>>>> ni->ino, ni->nid, ni->blk_addr, ni->version, ni->flag);
>>>> f2fs_handle_error(sbi, ERROR_INCONSISTENT_NAT);
>>>> return -EFSCORRUPTED;
>>>> --
>>>> 2.49.0
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Linux-f2fs-devel mailing list
>>>> Lin...@li...
>>>> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
>>
|
|
From: Zhiguo N. <zhi...@un...> - 2025-12-17 07:47:16
|
It missed the stat count in f2fs_gc_range.
Signed-off-by: Zhiguo Niu <zhi...@un...>
---
fs/f2fs/gc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index 6afd57f..58b291d 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -2096,6 +2096,7 @@ int f2fs_gc_range(struct f2fs_sb_info *sbi,
if (unlikely(f2fs_cp_error(sbi)))
return -EIO;
+ stat_inc_gc_call_count(sbi, FOREGROUND);
for (segno = start_seg; segno <= end_seg; segno += SEGS_PER_SEC(sbi)) {
struct gc_inode_list gc_list = {
.ilist = LIST_HEAD_INIT(gc_list.ilist),
--
1.9.1
|
|
From: Zhiguo N. <zhi...@un...> - 2025-12-17 07:46:45
|
1. qf_inum has been got and checked in its caller f2fs_enable_quotas
2. f2fs_sb_has_quota_ino has bee checked in its all callers
3. use sbi cleanup F2FS_SB(sb)
Signed-off-by: Zhiguo Niu <zhi...@un...>
---
fs/f2fs/super.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index c4c225e..036ba9c 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -3222,19 +3222,12 @@ int f2fs_enable_quota_files(struct f2fs_sb_info *sbi, bool rdonly)
}
static int f2fs_quota_enable(struct super_block *sb, int type, int format_id,
- unsigned int flags)
+ unsigned int flags, unsigned long qf_inum)
{
struct inode *qf_inode;
- unsigned long qf_inum;
unsigned long qf_flag = F2FS_QUOTA_DEFAULT_FL;
int err;
- BUG_ON(!f2fs_sb_has_quota_ino(F2FS_SB(sb)));
-
- qf_inum = f2fs_qf_ino(sb, type);
- if (!qf_inum)
- return -EPERM;
-
qf_inode = f2fs_iget(sb, qf_inum);
if (IS_ERR(qf_inode)) {
f2fs_err(F2FS_SB(sb), "Bad quota inode %u:%lu", type, qf_inum);
@@ -3267,7 +3260,7 @@ static int f2fs_enable_quotas(struct super_block *sb)
test_opt(sbi, PRJQUOTA),
};
- if (is_set_ckpt_flags(F2FS_SB(sb), CP_QUOTA_NEED_FSCK_FLAG)) {
+ if (is_set_ckpt_flags(sbi, CP_QUOTA_NEED_FSCK_FLAG)) {
f2fs_err(sbi, "quota file may be corrupted, skip loading it");
return 0;
}
@@ -3279,14 +3272,13 @@ static int f2fs_enable_quotas(struct super_block *sb)
if (qf_inum) {
err = f2fs_quota_enable(sb, type, QFMT_VFS_V1,
DQUOT_USAGE_ENABLED |
- (quota_mopt[type] ? DQUOT_LIMITS_ENABLED : 0));
+ (quota_mopt[type] ? DQUOT_LIMITS_ENABLED : 0), qf_inum);
if (err) {
f2fs_err(sbi, "Failed to enable quota tracking (type=%d, err=%d). Please run fsck to fix.",
type, err);
for (type--; type >= 0; type--)
dquot_quota_off(sb, type);
- set_sbi_flag(F2FS_SB(sb),
- SBI_QUOTA_NEED_REPAIR);
+ set_sbi_flag(sbi, SBI_QUOTA_NEED_REPAIR);
return err;
}
}
--
1.9.1
|
|
From: Zhiguo N. <niu...@gm...> - 2025-12-17 01:47:03
|
Chao Yu <ch...@ke...> 于2025年12月16日周二 16:49写道:
>
> On 12/16/25 09:36, Zhiguo Niu wrote:
> > Chao Yu via Linux-f2fs-devel <lin...@li...>
> > 于2025年12月15日周一 20:34写道:
> >>
> >> In order to avoid loading corrupted nat entry from disk.
> >>
> >> Cc: st...@ke...
> >> Signed-off-by: Chao Yu <ch...@ke...>
> >> ---
> >> fs/f2fs/node.c | 9 +++++----
> >> 1 file changed, 5 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> >> index ce471e033774..13c88dfd790d 100644
> >> --- a/fs/f2fs/node.c
> >> +++ b/fs/f2fs/node.c
> >> @@ -630,14 +630,15 @@ int f2fs_get_node_info(struct f2fs_sb_info *sbi, nid_t nid,
> >> node_info_from_raw_nat(ni, &ne);
> >> f2fs_folio_put(folio, true);
> >> sanity_check:
> >> - if (__is_valid_data_blkaddr(ni->blk_addr) &&
> >> + if (unlikely(ni->nid != nid ||
> > Hi Chao,
> > (ni->nid==nid) should be always true? because the code:
> >
> > ni->flag = 0;
> > ni->nid = nid;
> > retry:
> > or am I missing something?
>
> Zhiguo,
>
> Oh, I may missed something, let's ignore this patch.
>
> >
> >> + (__is_valid_data_blkaddr(ni->blk_addr) &&
> > btw, Is it possible to detect that some valid Nid entries contain
> > incorrect content?
> > such as ino/block_addr=NULL_ADDR in nid=4 entry?
>
> Something like this?
>
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index 65ca1a5eaa88..c458df92bb0d 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -4928,16 +4928,16 @@ static inline bool is_journalled_quota(struct f2fs_sb_info *sbi)
> return false;
> }
>
> -static inline bool f2fs_quota_file(struct inode *inode)
> +static inline bool f2fs_quota_file(struct f2fs_sb_info *sbi, nid_t ino)
> {
> #ifdef CONFIG_QUOTA
> int i;
>
> - if (!f2fs_sb_has_quota_ino(F2FS_I_SB(inode)))
> + if (!f2fs_sb_has_quota_ino(sbi))
> return false;
>
> for (i = 0; i < MAXQUOTAS; i++) {
> - if (f2fs_qf_ino(F2FS_I_SB(inode)->sb, i) == inode->i_ino)
> + if (f2fs_qf_ino(sbi->sb, i) == ino)
> return true;
> }
> #endif
> diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
> index 921fb02c0f49..d1270b25ad7d 100644
> --- a/fs/f2fs/inode.c
> +++ b/fs/f2fs/inode.c
> @@ -621,7 +621,7 @@ make_now:
> inode->i_fop = &f2fs_file_operations;
> inode->i_mapping->a_ops = &f2fs_dblock_aops;
> if (IS_IMMUTABLE(inode) && !f2fs_compressed_file(inode) &&
> - !f2fs_quota_file(inode))
> + !f2fs_quota_file(sbi, inode->i_ino))
> mapping_set_folio_min_order(inode->i_mapping, 0);
> } else if (S_ISDIR(inode->i_mode)) {
> inode->i_op = &f2fs_dir_inode_operations;
> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> index 7feead595ba5..10448e115ea0 100644
> --- a/fs/f2fs/node.c
> +++ b/fs/f2fs/node.c
> @@ -643,6 +643,17 @@ sanity_check:
> return -EFSCORRUPTED;
> }
>
Hi Chao
> + if (unlikely(f2fs_quota_file(sbi, ni->nid) &&
> + __is_valid_data_blkaddr(ni->blk_addr))) {
__is_valid_data_blkaddr(ni->blk_addr) --> !
__is_valid_data_blkaddr(ni->blk_addr)??
> + set_sbi_flag(sbi, SBI_NEED_FSCK);
> + f2fs_err_ratelimited(sbi,
> + "f2fs_get_node_info of %pS: inconsistent nat entry from qf_ino, "
> + "ino:%u, nid:%u, blkaddr:%u, ver:%u, flag:%u",
> + __builtin_return_address(0),
> + ni->ino, ni->nid, ni->blk_addr, ni->version, ni->flag);
> + f2fs_handle_error(sbi, ERROR_INCONSISTENT_NAT);
> + }
> +
I think this is ok for quota file,
and This is not easy to apply to all common cases( nid entry not only
for quota), right? ^^
Thanks!
> /* cache nat entry */
> if (need_cache)
> cache_nat_entry(sbi, nid, &ne);
>
> Thanks,
>
> > Thanks
> >> !f2fs_is_valid_blkaddr(sbi, ni->blk_addr,
> >> - DATA_GENERIC_ENHANCE)) {
> >> + DATA_GENERIC_ENHANCE)))) {
> >> set_sbi_flag(sbi, SBI_NEED_FSCK);
> >> f2fs_err_ratelimited(sbi,
> >> - "f2fs_get_node_info of %pS: inconsistent nat entry, "
> >> + "f2fs_get_node_info of %pS: nid:%u, inconsistent nat entry, "
> >> "ino:%u, nid:%u, blkaddr:%u, ver:%u, flag:%u",
> >> - __builtin_return_address(0),
> >> + __builtin_return_address(0), nid,
> >> ni->ino, ni->nid, ni->blk_addr, ni->version, ni->flag);
> >> f2fs_handle_error(sbi, ERROR_INCONSISTENT_NAT);
> >> return -EFSCORRUPTED;
> >> --
> >> 2.49.0
> >>
> >>
> >>
> >> _______________________________________________
> >> Linux-f2fs-devel mailing list
> >> Lin...@li...
> >> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
>
|
|
From: Jaegeuk K. <ja...@ke...> - 2025-12-17 00:42:42
|
Signed-off-by: Jaegeuk Kim <ja...@ke...>
---
Change log from v1:
- give mlock/io time together
tools/f2fs_io/f2fs_io.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/tools/f2fs_io/f2fs_io.c b/tools/f2fs_io/f2fs_io.c
index 4429e0b0459c..1b290bc669f8 100644
--- a/tools/f2fs_io/f2fs_io.c
+++ b/tools/f2fs_io/f2fs_io.c
@@ -938,6 +938,7 @@ static void do_write_advice(int argc, char **argv, const struct cmd_desc *cmd)
" dontcache: buffered IO + dontcache\n" \
" dio : direct IO\n" \
" mmap : mmap IO\n" \
+" mlock : mmap + mlock\n" \
" madvise : mmap + mlock2 + madvise\n" \
" fadvise : mmap + fadvise + mlock\n" \
"advice can be\n" \
@@ -956,6 +957,7 @@ static void do_read(int argc, char **argv, const struct cmd_desc *cmd)
u64 mlock_time_start = 0, mlock_time_end = 0;
int flags = 0;
int do_mmap = 0;
+ int do_mlock = 0;
int do_fadvise = 0;
int do_madvise = 0;
int do_dontcache = 0;
@@ -981,6 +983,8 @@ static void do_read(int argc, char **argv, const struct cmd_desc *cmd)
flags |= O_DIRECT;
else if (!strcmp(argv[4], "mmap"))
do_mmap = 1;
+ else if (!strcmp(argv[4], "mlock"))
+ do_mlock = 1;
else if (!strcmp(argv[4], "madvise"))
do_madvise = 1;
else if (!strcmp(argv[4], "fadvise"))
@@ -1027,6 +1031,18 @@ static void do_read(int argc, char **argv, const struct cmd_desc *cmd)
mlock_time_end = get_current_us();
read_cnt = count * buf_size;
memcpy(print_buf, data, print_bytes);
+ } else if (do_mlock) {
+ data = mmap(NULL, count * buf_size, PROT_READ,
+ MAP_SHARED, fd, offset);
+ if (data == MAP_FAILED)
+ die("Mmap failed");
+
+ io_time_start = mlock_time_start = get_current_us();
+ if (mlock(data, count * buf_size))
+ die_errno("mlock failed");
+ io_time_end = mlock_time_end = get_current_us();
+ read_cnt = count * buf_size;
+ memcpy(print_buf, data, print_bytes);
} else if (do_madvise) {
data = mmap(NULL, count * buf_size, PROT_READ,
MAP_SHARED, fd, offset);
--
2.52.0.305.g3fc767764a-goog
|
|
From: <pat...@ke...> - 2025-12-16 19:23:27
|
Hello:
This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <ja...@ke...>:
On Fri, 12 Dec 2025 08:40:34 +0000 you wrote:
> The check for enough sections in segment.h has the following issues:
>
> 1. has_not_enough_free_secs() should return "enough secs" when "free_secs
> >= upper_secs", not just structly greater. Conversely, it should only
> return "not enough secs" when "free_secs < lower_secs", not when they are
> equal. This accounts for the possibility that blocks can fit within
> curseg without requiring an additional free section.
>
> [...]
Here is the summary with links:
- [f2fs-dev,v1] f2fs: improve check for enough free sections
https://git.kernel.org/jaegeuk/f2fs/c/4a210a5be279
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
|
|
From: <pat...@ke...> - 2025-12-16 19:23:25
|
Hello: The following patches were marked "accepted", because they were applied to jaegeuk/f2fs.git (dev): Series: [f2fs-dev,1/2] f2fs: support large folio for immutable non-compressed case Submitter: Jaegeuk Kim <ja...@ke...> Patchwork: https://patchwork.kernel.org/project/f2fs/list/?series=1026070 Lore link: https://lore.kernel.org/r/202...@ke... Patches: [f2fs-dev,1/2] f2fs: support large folio for immutable non-compressed case [f2fs-dev,2/2] f2fs: add a tracepoint to see large folio read submission Patch: [f2fs-dev,v1] f2fs: improve check for enough free sections Submitter: Joanne Chang <joa...@go...> Committer: Jaegeuk Kim <ja...@ke...> Patchwork: https://patchwork.kernel.org/project/f2fs/list/?series=1032585 Lore link: https://lore.kernel.org/r/202...@go... Total patches: 3 -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html |
|
From: <pat...@ke...> - 2025-12-16 19:23:21
|
Hello:
This series was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <ja...@ke...>:
On Thu, 20 Nov 2025 23:54:45 +0000 you wrote:
> This patch enables large folio for limited case where we can get the high-order
> memory allocation. It supports the encrypted and fsverity files, which are
> essential for Android environment.
>
> How to test:
> - dd if=/dev/zero of=/mnt/test/test bs=1G count=4
> - f2fs_io setflags immutable /mnt/test/test
> - echo 3 > /proc/sys/vm/drop_caches
> : to reload inode with large folio
> - f2fs_io read 32 0 1024 mmap 0 0 /mnt/test/test
>
> [...]
Here is the summary with links:
- [f2fs-dev,1/2] f2fs: support large folio for immutable non-compressed case
(no matching commit)
- [f2fs-dev,2/2] f2fs: add a tracepoint to see large folio read submission
https://git.kernel.org/jaegeuk/f2fs/c/903c6e95bc9a
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
|
|
From: Jaegeuk K. <ja...@ke...> - 2025-12-16 19:13:13
|
On 12/16, Chao Yu wrote:
> On 12/16/25 08:50, Jaegeuk Kim wrote:
> > On 12/15, Chao Yu wrote:
> >> On 12/12/25 08:55, Jaegeuk Kim via Linux-f2fs-devel wrote:
> >>> Signed-off-by: Jaegeuk Kim <ja...@ke...>
> >>> ---
> >>> tools/f2fs_io/f2fs_io.c | 16 ++++++++++++++++
> >>> 1 file changed, 16 insertions(+)
> >>>
> >>> diff --git a/tools/f2fs_io/f2fs_io.c b/tools/f2fs_io/f2fs_io.c
> >>> index 4429e0b0459c..08f3c9b79cdf 100644
> >>> --- a/tools/f2fs_io/f2fs_io.c
> >>> +++ b/tools/f2fs_io/f2fs_io.c
> >>> @@ -938,6 +938,7 @@ static void do_write_advice(int argc, char **argv, const struct cmd_desc *cmd)
> >>> " dontcache: buffered IO + dontcache\n" \
> >>> " dio : direct IO\n" \
> >>> " mmap : mmap IO\n" \
> >>> +" mlock : mmap + mlock\n" \
> >>> " madvise : mmap + mlock2 + madvise\n" \
> >>> " fadvise : mmap + fadvise + mlock\n" \
> >>> "advice can be\n" \
> >>> @@ -956,6 +957,7 @@ static void do_read(int argc, char **argv, const struct cmd_desc *cmd)
> >>> u64 mlock_time_start = 0, mlock_time_end = 0;
> >>> int flags = 0;
> >>> int do_mmap = 0;
> >>> + int do_mlock = 0;
> >>> int do_fadvise = 0;
> >>> int do_madvise = 0;
> >>> int do_dontcache = 0;
> >>> @@ -981,6 +983,8 @@ static void do_read(int argc, char **argv, const struct cmd_desc *cmd)
> >>> flags |= O_DIRECT;
> >>> else if (!strcmp(argv[4], "mmap"))
> >>> do_mmap = 1;
> >>> + else if (!strcmp(argv[4], "mlock"))
> >>> + do_mlock = 1;
> >>> else if (!strcmp(argv[4], "madvise"))
> >>> do_madvise = 1;
> >>> else if (!strcmp(argv[4], "fadvise"))
> >>> @@ -1027,6 +1031,18 @@ static void do_read(int argc, char **argv, const struct cmd_desc *cmd)
> >>> mlock_time_end = get_current_us();
> >>> read_cnt = count * buf_size;
> >>> memcpy(print_buf, data, print_bytes);
> >>> + } else if (do_mlock) {
> >>> + data = mmap(NULL, count * buf_size, PROT_READ,
> >>> + MAP_SHARED, fd, offset);
> >>> + if (data == MAP_FAILED)
> >>> + die("Mmap failed");
> >>> +
> >>> + io_time_start = get_current_us();
> >>
> >> mlock_time_start = get_current_us();
> >
> > This is when IO happens, so IO.
>
> Okay, but it seems later we will print "mlock time = 0" which doesn't match the code?
It may be okay to show the same time on IO and mlock?
>
> Thanks,
>
> >
> >>
> >>> + if (mlock(data, count * buf_size))
> >>> + die_errno("mlock failed");
> >>> + io_time_end = get_current_us();
> >>
> >> mlock_time_end = get_current_us();
> >>
> >> Thanks,
> >>
> >>> + read_cnt = count * buf_size;
> >>> + memcpy(print_buf, data, print_bytes);
> >>> } else if (do_madvise) {
> >>> data = mmap(NULL, count * buf_size, PROT_READ,
> >>> MAP_SHARED, fd, offset);
|
|
From: Yongpeng Y. <yan...@ou...> - 2025-12-16 13:02:35
|
On 12/15/25 09:55, Chao Yu via Linux-f2fs-devel wrote:
> On 12/12/25 21:52, Yongpeng Yang wrote:
>> From: Yongpeng Yang <yan...@xi...>
>>
>> For readahead, if the current readahead window is smaller than the extent
>> size, expand the window so that larger bios can be issued and improve
>> overall read performance.
>
> Yongpeng,
>
> Do you have any numbers to reveal how this patch improves the sequential
> read performance?
Yes, the goal is to improve sequential read performance when the
readahead window is not aligned with the device optimal I/O size.
>
> In addition, will we suffer regression for random read case?
>
*Background*
On Android systems, some SoC vendors reduce the readahead window in
order to avoid excessive useless readahead. As a result, the readahead
window can be smaller than the device optimal I/O size (q->limits.io_opt).
When reading large files with dd, the number of read I/Os issued by
f2fs_readahead is limited by the readahead window, preventing the device
from fully utilizing its performance.
*Test setup*
1. Test environment: UFS 4.1 device, q->limits.io_opt is 1 MB
2. Test conditions: a 2 GB file with all extents sized at 2 MB
3. Test variables: the readahead window (read_ahead_kb) and the
effective readahead size after adjustment by readahead_expand in
f2fs_readahead
4. Test case: dd if=file_2m.dat of=/dev/null bs=512K count=4096, The
file page cache is dropped between runs, and the test is repeated 3 times.
*Test results*
| read_ahead_kb | effective f2fs_readahead window | bandwidth (GB/s)|
|---------------|---------------------------------|-----------------|
| 512 KB | 512 KB | 2.2 |
| 512 KB | 1024KB | 2.6 |
| 1024KB | 1024KB | 2.6 |
| 1024KB | 2048KB | 3.0 |
*Analysis*
1. The first row reflects the commonly used configuration and serves as
the baseline.
2. When the readahead window is aligned with the device optimal I/O
size, the bandwidth improves by about 18%.
3。 Increasing the effective f2fs_readahead window to 2 MB improves
bandwidth by about 36%.
*Disscusion*
The goal of this patch is to improve sequential read bandwidth when the
readahead window is smaller than the device optimal I/O size. Would it
make sense to record the end offset of the previous file access in
f2fs_read_ahead to determine whether the current read is sequential, and
based on that, decide whether to increase the readahead size?
Thanks
Yongpeng,
> Thanks,
>
>>
>> Signed-off-by: Yongpeng Yang <yan...@xi...>
>> ---
>> fs/f2fs/data.c | 11 +++++++++++
>> 1 file changed, 11 insertions(+)
>>
>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
>> index c30e69392a62..2e5cbdb7729c 100644
>> --- a/fs/f2fs/data.c
>> +++ b/fs/f2fs/data.c
>> @@ -2377,6 +2377,17 @@ static int f2fs_mpage_readpages(struct inode *inode,
>> map.m_seg_type = NO_CHECK_TYPE;
>> map.m_may_create = false;
>>
>> + if (rac) {
>> + loff_t block_in_file;
>> +
>> + block_in_file = rac->_index;
>> + map.m_lblk = block_in_file;
>> + map.m_len = max(nr_pages, inode_to_bdi(inode)->ra_pages);
>> + if (!f2fs_map_blocks(inode, &map, F2FS_GET_BLOCK_DEFAULT) && map.m_len > nr_pages) {
>> + readahead_expand(rac, block_in_file << F2FS_BLKSIZE_BITS, map.m_len << F2FS_BLKSIZE_BITS);
>> + nr_pages = readahead_count(rac);
>> + }
>> + }
>> for (; nr_pages; nr_pages--) {
>> if (rac) {
>> folio = readahead_folio(rac);
>
>
>
> _______________________________________________
> Linux-f2fs-devel mailing list
> Lin...@li...
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
|
|
From: Chao Yu <ch...@ke...> - 2025-12-16 08:49:25
|
On 12/16/25 09:36, Zhiguo Niu wrote:
> Chao Yu via Linux-f2fs-devel <lin...@li...>
> 于2025年12月15日周一 20:34写道:
>>
>> In order to avoid loading corrupted nat entry from disk.
>>
>> Cc: st...@ke...
>> Signed-off-by: Chao Yu <ch...@ke...>
>> ---
>> fs/f2fs/node.c | 9 +++++----
>> 1 file changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
>> index ce471e033774..13c88dfd790d 100644
>> --- a/fs/f2fs/node.c
>> +++ b/fs/f2fs/node.c
>> @@ -630,14 +630,15 @@ int f2fs_get_node_info(struct f2fs_sb_info *sbi, nid_t nid,
>> node_info_from_raw_nat(ni, &ne);
>> f2fs_folio_put(folio, true);
>> sanity_check:
>> - if (__is_valid_data_blkaddr(ni->blk_addr) &&
>> + if (unlikely(ni->nid != nid ||
> Hi Chao,
> (ni->nid==nid) should be always true? because the code:
>
> ni->flag = 0;
> ni->nid = nid;
> retry:
> or am I missing something?
Zhiguo,
Oh, I may missed something, let's ignore this patch.
>
>> + (__is_valid_data_blkaddr(ni->blk_addr) &&
> btw, Is it possible to detect that some valid Nid entries contain
> incorrect content?
> such as ino/block_addr=NULL_ADDR in nid=4 entry?
Something like this?
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 65ca1a5eaa88..c458df92bb0d 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -4928,16 +4928,16 @@ static inline bool is_journalled_quota(struct f2fs_sb_info *sbi)
return false;
}
-static inline bool f2fs_quota_file(struct inode *inode)
+static inline bool f2fs_quota_file(struct f2fs_sb_info *sbi, nid_t ino)
{
#ifdef CONFIG_QUOTA
int i;
- if (!f2fs_sb_has_quota_ino(F2FS_I_SB(inode)))
+ if (!f2fs_sb_has_quota_ino(sbi))
return false;
for (i = 0; i < MAXQUOTAS; i++) {
- if (f2fs_qf_ino(F2FS_I_SB(inode)->sb, i) == inode->i_ino)
+ if (f2fs_qf_ino(sbi->sb, i) == ino)
return true;
}
#endif
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
index 921fb02c0f49..d1270b25ad7d 100644
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -621,7 +621,7 @@ make_now:
inode->i_fop = &f2fs_file_operations;
inode->i_mapping->a_ops = &f2fs_dblock_aops;
if (IS_IMMUTABLE(inode) && !f2fs_compressed_file(inode) &&
- !f2fs_quota_file(inode))
+ !f2fs_quota_file(sbi, inode->i_ino))
mapping_set_folio_min_order(inode->i_mapping, 0);
} else if (S_ISDIR(inode->i_mode)) {
inode->i_op = &f2fs_dir_inode_operations;
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 7feead595ba5..10448e115ea0 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -643,6 +643,17 @@ sanity_check:
return -EFSCORRUPTED;
}
+ if (unlikely(f2fs_quota_file(sbi, ni->nid) &&
+ __is_valid_data_blkaddr(ni->blk_addr))) {
+ set_sbi_flag(sbi, SBI_NEED_FSCK);
+ f2fs_err_ratelimited(sbi,
+ "f2fs_get_node_info of %pS: inconsistent nat entry from qf_ino, "
+ "ino:%u, nid:%u, blkaddr:%u, ver:%u, flag:%u",
+ __builtin_return_address(0),
+ ni->ino, ni->nid, ni->blk_addr, ni->version, ni->flag);
+ f2fs_handle_error(sbi, ERROR_INCONSISTENT_NAT);
+ }
+
/* cache nat entry */
if (need_cache)
cache_nat_entry(sbi, nid, &ne);
Thanks,
> Thanks
>> !f2fs_is_valid_blkaddr(sbi, ni->blk_addr,
>> - DATA_GENERIC_ENHANCE)) {
>> + DATA_GENERIC_ENHANCE)))) {
>> set_sbi_flag(sbi, SBI_NEED_FSCK);
>> f2fs_err_ratelimited(sbi,
>> - "f2fs_get_node_info of %pS: inconsistent nat entry, "
>> + "f2fs_get_node_info of %pS: nid:%u, inconsistent nat entry, "
>> "ino:%u, nid:%u, blkaddr:%u, ver:%u, flag:%u",
>> - __builtin_return_address(0),
>> + __builtin_return_address(0), nid,
>> ni->ino, ni->nid, ni->blk_addr, ni->version, ni->flag);
>> f2fs_handle_error(sbi, ERROR_INCONSISTENT_NAT);
>> return -EFSCORRUPTED;
>> --
>> 2.49.0
>>
>>
>>
>> _______________________________________________
>> Linux-f2fs-devel mailing list
>> Lin...@li...
>> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
|