Linux-f2fs-devel Archive on lore.kernel.org
 help / color / Atom feed
* [f2fs-dev] [PATCH v2] f2fs: fix wrong available node count calculation
@ 2019-08-05 10:27 Chao Yu
  2019-08-06  3:24 ` Chao Yu
  0 siblings, 1 reply; 3+ messages in thread
From: Chao Yu @ 2019-08-05 10:27 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-kernel, linux-f2fs-devel

In mkfs, we have counted quota file's node number in cp.valid_node_count,
so we have to avoid wrong substraction of quota node number in
.available_nid/.avail_node_count calculation.

f2fs_write_check_point_pack()
{
..
	set_cp(valid_node_count, 1 + c.quota_inum + c.lpf_inum);

Fixes: 292c196a3695 ("reserve nid resource for quota sysfile")
Fixes: 7b63f72f73af ("f2fs: fix to do sanity check on valid node/block count")
Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
 fs/f2fs/node.c  | 2 +-
 fs/f2fs/super.c | 6 ++----
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index a18b2a895771..d9ba1db2d01e 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -2964,7 +2964,7 @@ static int init_node_manager(struct f2fs_sb_info *sbi)
 
 	/* not used nids: 0, node, meta, (and root counted as valid node) */
 	nm_i->available_nids = nm_i->max_nid - sbi->total_valid_node_count -
-				sbi->nquota_files - F2FS_RESERVED_NODE_NUM;
+						F2FS_RESERVED_NODE_NUM;
 	nm_i->nid_cnt[FREE_NID] = 0;
 	nm_i->nid_cnt[PREALLOC_NID] = 0;
 	nm_i->nat_cnt = 0;
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 6a7f1166d068..118a31f90a37 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1297,8 +1297,7 @@ static int f2fs_statfs(struct dentry *dentry, struct kstatfs *buf)
 	else
 		buf->f_bavail = 0;
 
-	avail_node_count = sbi->total_node_count - sbi->nquota_files -
-						F2FS_RESERVED_NODE_NUM;
+	avail_node_count = sbi->total_node_count - F2FS_RESERVED_NODE_NUM;
 
 	if (avail_node_count > user_block_count) {
 		buf->f_files = user_block_count;
@@ -2750,8 +2749,7 @@ int f2fs_sanity_check_ckpt(struct f2fs_sb_info *sbi)
 	}
 
 	valid_node_count = le32_to_cpu(ckpt->valid_node_count);
-	avail_node_count = sbi->total_node_count - sbi->nquota_files -
-						F2FS_RESERVED_NODE_NUM;
+	avail_node_count = sbi->total_node_count - F2FS_RESERVED_NODE_NUM;
 	if (valid_node_count > avail_node_count) {
 		f2fs_err(sbi, "Wrong valid_node_count: %u, avail_node_count: %u",
 			 valid_node_count, avail_node_count);
-- 
2.18.0.rc1



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH v2] f2fs: fix wrong available node count calculation
  2019-08-05 10:27 [f2fs-dev] [PATCH v2] f2fs: fix wrong available node count calculation Chao Yu
@ 2019-08-06  3:24 ` Chao Yu
  2019-08-09 15:19   ` Jaegeuk Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Chao Yu @ 2019-08-06  3:24 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-kernel, linux-f2fs-devel

On 2019/8/5 18:27, Chao Yu wrote:
> In mkfs, we have counted quota file's node number in cp.valid_node_count,
> so we have to avoid wrong substraction of quota node number in
> .available_nid/.avail_node_count calculation.
> 
> f2fs_write_check_point_pack()
> {
> ..
> 	set_cp(valid_node_count, 1 + c.quota_inum + c.lpf_inum);
> 
> Fixes: 292c196a3695 ("reserve nid resource for quota sysfile")

Jaegeuk,

Could you help to add prefix "f2fs: " into commit tile in your branch, I missed
to add it. :P

Thanks,

> Fixes: 7b63f72f73af ("f2fs: fix to do sanity check on valid node/block count")
> Signed-off-by: Chao Yu <yuchao0@huawei.com>
> ---
>  fs/f2fs/node.c  | 2 +-
>  fs/f2fs/super.c | 6 ++----
>  2 files changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> index a18b2a895771..d9ba1db2d01e 100644
> --- a/fs/f2fs/node.c
> +++ b/fs/f2fs/node.c
> @@ -2964,7 +2964,7 @@ static int init_node_manager(struct f2fs_sb_info *sbi)
>  
>  	/* not used nids: 0, node, meta, (and root counted as valid node) */
>  	nm_i->available_nids = nm_i->max_nid - sbi->total_valid_node_count -
> -				sbi->nquota_files - F2FS_RESERVED_NODE_NUM;
> +						F2FS_RESERVED_NODE_NUM;
>  	nm_i->nid_cnt[FREE_NID] = 0;
>  	nm_i->nid_cnt[PREALLOC_NID] = 0;
>  	nm_i->nat_cnt = 0;
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index 6a7f1166d068..118a31f90a37 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -1297,8 +1297,7 @@ static int f2fs_statfs(struct dentry *dentry, struct kstatfs *buf)
>  	else
>  		buf->f_bavail = 0;
>  
> -	avail_node_count = sbi->total_node_count - sbi->nquota_files -
> -						F2FS_RESERVED_NODE_NUM;
> +	avail_node_count = sbi->total_node_count - F2FS_RESERVED_NODE_NUM;
>  
>  	if (avail_node_count > user_block_count) {
>  		buf->f_files = user_block_count;
> @@ -2750,8 +2749,7 @@ int f2fs_sanity_check_ckpt(struct f2fs_sb_info *sbi)
>  	}
>  
>  	valid_node_count = le32_to_cpu(ckpt->valid_node_count);
> -	avail_node_count = sbi->total_node_count - sbi->nquota_files -
> -						F2FS_RESERVED_NODE_NUM;
> +	avail_node_count = sbi->total_node_count - F2FS_RESERVED_NODE_NUM;
>  	if (valid_node_count > avail_node_count) {
>  		f2fs_err(sbi, "Wrong valid_node_count: %u, avail_node_count: %u",
>  			 valid_node_count, avail_node_count);
> 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH v2] f2fs: fix wrong available node count calculation
  2019-08-06  3:24 ` Chao Yu
@ 2019-08-09 15:19   ` Jaegeuk Kim
  0 siblings, 0 replies; 3+ messages in thread
From: Jaegeuk Kim @ 2019-08-09 15:19 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-kernel, linux-f2fs-devel

On 08/06, Chao Yu wrote:
> On 2019/8/5 18:27, Chao Yu wrote:
> > In mkfs, we have counted quota file's node number in cp.valid_node_count,
> > so we have to avoid wrong substraction of quota node number in
> > .available_nid/.avail_node_count calculation.
> > 
> > f2fs_write_check_point_pack()
> > {
> > ..
> > 	set_cp(valid_node_count, 1 + c.quota_inum + c.lpf_inum);
> > 
> > Fixes: 292c196a3695 ("reserve nid resource for quota sysfile")
> 
> Jaegeuk,
> 
> Could you help to add prefix "f2fs: " into commit tile in your branch, I missed
> to add it. :P

Done. :)

> 
> Thanks,
> 
> > Fixes: 7b63f72f73af ("f2fs: fix to do sanity check on valid node/block count")
> > Signed-off-by: Chao Yu <yuchao0@huawei.com>
> > ---
> >  fs/f2fs/node.c  | 2 +-
> >  fs/f2fs/super.c | 6 ++----
> >  2 files changed, 3 insertions(+), 5 deletions(-)
> > 
> > diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> > index a18b2a895771..d9ba1db2d01e 100644
> > --- a/fs/f2fs/node.c
> > +++ b/fs/f2fs/node.c
> > @@ -2964,7 +2964,7 @@ static int init_node_manager(struct f2fs_sb_info *sbi)
> >  
> >  	/* not used nids: 0, node, meta, (and root counted as valid node) */
> >  	nm_i->available_nids = nm_i->max_nid - sbi->total_valid_node_count -
> > -				sbi->nquota_files - F2FS_RESERVED_NODE_NUM;
> > +						F2FS_RESERVED_NODE_NUM;
> >  	nm_i->nid_cnt[FREE_NID] = 0;
> >  	nm_i->nid_cnt[PREALLOC_NID] = 0;
> >  	nm_i->nat_cnt = 0;
> > diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> > index 6a7f1166d068..118a31f90a37 100644
> > --- a/fs/f2fs/super.c
> > +++ b/fs/f2fs/super.c
> > @@ -1297,8 +1297,7 @@ static int f2fs_statfs(struct dentry *dentry, struct kstatfs *buf)
> >  	else
> >  		buf->f_bavail = 0;
> >  
> > -	avail_node_count = sbi->total_node_count - sbi->nquota_files -
> > -						F2FS_RESERVED_NODE_NUM;
> > +	avail_node_count = sbi->total_node_count - F2FS_RESERVED_NODE_NUM;
> >  
> >  	if (avail_node_count > user_block_count) {
> >  		buf->f_files = user_block_count;
> > @@ -2750,8 +2749,7 @@ int f2fs_sanity_check_ckpt(struct f2fs_sb_info *sbi)
> >  	}
> >  
> >  	valid_node_count = le32_to_cpu(ckpt->valid_node_count);
> > -	avail_node_count = sbi->total_node_count - sbi->nquota_files -
> > -						F2FS_RESERVED_NODE_NUM;
> > +	avail_node_count = sbi->total_node_count - F2FS_RESERVED_NODE_NUM;
> >  	if (valid_node_count > avail_node_count) {
> >  		f2fs_err(sbi, "Wrong valid_node_count: %u, avail_node_count: %u",
> >  			 valid_node_count, avail_node_count);
> > 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-05 10:27 [f2fs-dev] [PATCH v2] f2fs: fix wrong available node count calculation Chao Yu
2019-08-06  3:24 ` Chao Yu
2019-08-09 15:19   ` Jaegeuk Kim

Linux-f2fs-devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-f2fs-devel/0 linux-f2fs-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-f2fs-devel linux-f2fs-devel/ https://lore.kernel.org/linux-f2fs-devel \
		linux-f2fs-devel@lists.sourceforge.net linux-f2fs-devel@archiver.kernel.org
	public-inbox-index linux-f2fs-devel


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/net.sourceforge.lists.linux-f2fs-devel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox