linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] f2fs: fix wrong number of max_nid when init
@ 2014-04-17  6:27 Chao Yu
  2014-04-17  7:16 ` Jaegeuk Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Chao Yu @ 2014-04-17  6:27 UTC (permalink / raw)
  To: ???; +Cc: linux-f2fs-devel, linux-fsdevel, linux-kernel

Since max_nid value was minus three in previous commit:
'b63da15e8b475245026bdf2096853683f189706b', Our last three nids could not be
used ever, but 0/node nid/meta nid is still occupied.
And also our ra_meta_pages() could not readahead the last block of NAT.
Let's fix the wrong calculation of this value, and left the reserved nids there.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
---
 fs/f2fs/node.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 84f9b7b..3f0bb50 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1860,7 +1860,7 @@ static int init_node_manager(struct f2fs_sb_info *sbi)
 	nat_blocks = nat_segs << le32_to_cpu(sb_raw->log_blocks_per_seg);
 
 	/* not used nids: 0, node, meta, (and root counted as valid node) */
-	nm_i->max_nid = NAT_ENTRY_PER_BLOCK * nat_blocks - 3;
+	nm_i->max_nid = NAT_ENTRY_PER_BLOCK * nat_blocks;
 	nm_i->fcnt = 0;
 	nm_i->nat_cnt = 0;
 	nm_i->ram_thresh = DEF_RAM_THRESHOLD;
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: fix wrong number of max_nid when init
  2014-04-17  6:27 [f2fs-dev] [PATCH] f2fs: fix wrong number of max_nid when init Chao Yu
@ 2014-04-17  7:16 ` Jaegeuk Kim
  2014-04-17  8:01   ` Chao Yu
  0 siblings, 1 reply; 3+ messages in thread
From: Jaegeuk Kim @ 2014-04-17  7:16 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-f2fs-devel, linux-fsdevel, linux-kernel

Hi,

2014-04-17 (목), 14:27 +0800, Chao Yu:
> Since max_nid value was minus three in previous commit:
> 'b63da15e8b475245026bdf2096853683f189706b', Our last three nids could not be
> used ever, but 0/node nid/meta nid is still occupied.
> And also our ra_meta_pages() could not readahead the last block of NAT.

What is the root problem in there?
IIRC, the max_nid should not be turned back since that can cause an
infinite loop during build_free_nids() under a test using whole the
nids.

> Let's fix the wrong calculation of this value, and left the reserved nids there.
> 
> Signed-off-by: Chao Yu <chao2.yu@samsung.com>
> ---
>  fs/f2fs/node.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> index 84f9b7b..3f0bb50 100644
> --- a/fs/f2fs/node.c
> +++ b/fs/f2fs/node.c
> @@ -1860,7 +1860,7 @@ static int init_node_manager(struct f2fs_sb_info *sbi)
>  	nat_blocks = nat_segs << le32_to_cpu(sb_raw->log_blocks_per_seg);
>  
>  	/* not used nids: 0, node, meta, (and root counted as valid node) */
> -	nm_i->max_nid = NAT_ENTRY_PER_BLOCK * nat_blocks - 3;
> +	nm_i->max_nid = NAT_ENTRY_PER_BLOCK * nat_blocks;
>  	nm_i->fcnt = 0;
>  	nm_i->nat_cnt = 0;
>  	nm_i->ram_thresh = DEF_RAM_THRESHOLD;

-- 
Jaegeuk Kim
Samsung


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [f2fs-dev] [PATCH] f2fs: fix wrong number of max_nid when init
  2014-04-17  7:16 ` Jaegeuk Kim
@ 2014-04-17  8:01   ` Chao Yu
  0 siblings, 0 replies; 3+ messages in thread
From: Chao Yu @ 2014-04-17  8:01 UTC (permalink / raw)
  To: jaegeuk.kim; +Cc: linux-f2fs-devel, linux-fsdevel, linux-kernel

Hi,

> -----Original Message-----
> From: Jaegeuk Kim [mailto:jaegeuk.kim@samsung.com]
> Sent: Thursday, April 17, 2014 3:17 PM
> To: Chao Yu
> Cc: linux-f2fs-devel@lists.sourceforge.net; linux-fsdevel@vger.kernel.org;
> linux-kernel@vger.kernel.org
> Subject: Re: [f2fs-dev] [PATCH] f2fs: fix wrong number of max_nid when init
> 
> Hi,
> 
> 2014-04-17 (목), 14:27 +0800, Chao Yu:
> > Since max_nid value was minus three in previous commit:
> > 'b63da15e8b475245026bdf2096853683f189706b', Our last three nids could not be
> > used ever, but 0/node nid/meta nid is still occupied.
> > And also our ra_meta_pages() could not readahead the last block of NAT.
> 
> What is the root problem in there?

The last one is the root problem, I will submit another patch to fix it.

> IIRC, the max_nid should not be turned back since that can cause an
> infinite loop during build_free_nids() under a test using whole the
> nids.

Got it, thanks for your explanation.

Regards.

> 
> > Let's fix the wrong calculation of this value, and left the reserved nids there.
> >
> > Signed-off-by: Chao Yu <chao2.yu@samsung.com>
> > ---
> >  fs/f2fs/node.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> > index 84f9b7b..3f0bb50 100644
> > --- a/fs/f2fs/node.c
> > +++ b/fs/f2fs/node.c
> > @@ -1860,7 +1860,7 @@ static int init_node_manager(struct f2fs_sb_info *sbi)
> >  	nat_blocks = nat_segs << le32_to_cpu(sb_raw->log_blocks_per_seg);
> >
> >  	/* not used nids: 0, node, meta, (and root counted as valid node) */
> > -	nm_i->max_nid = NAT_ENTRY_PER_BLOCK * nat_blocks - 3;
> > +	nm_i->max_nid = NAT_ENTRY_PER_BLOCK * nat_blocks;
> >  	nm_i->fcnt = 0;
> >  	nm_i->nat_cnt = 0;
> >  	nm_i->ram_thresh = DEF_RAM_THRESHOLD;
> 
> --
> Jaegeuk Kim
> Samsung


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-04-17  8:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-17  6:27 [f2fs-dev] [PATCH] f2fs: fix wrong number of max_nid when init Chao Yu
2014-04-17  7:16 ` Jaegeuk Kim
2014-04-17  8:01   ` Chao Yu

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).