Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp445526ybl; Fri, 9 Aug 2019 08:20:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqwqlcWYkuHkfk/EazV2joDrOuDYFJqz0cY2L3jBvT4Z57t2kNdOEFQ/tqtOi36iedJkHFKM X-Received: by 2002:a17:90a:fa07:: with SMTP id cm7mr9654261pjb.138.1565364035391; Fri, 09 Aug 2019 08:20:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565364035; cv=none; d=google.com; s=arc-20160816; b=cCT8yhj4YR5Sp0SByxuAw5K7CFW50luoNb1LM+j1xgrevxI3o0zW1fXgQTY2nUqhEV QgHN1w2/uDTFoyI+1JebGbYwZN1o6FcLC3j0F8kX1CMfMqhc6h5aUDPmSSt6yqT0jvhj BNso5CBxcvYW8NRT1wTHpyrE66Cd7tF3hN8YJNRxw6ZhOOYfal8e5qCY+XR5rJR70xZy gxa0o5vyI/PCGUhpvUHtDbd2bRuPsLn9Jv5KpznsMAcNsui6guqbws9SihrKlbIcVptE pKiL7vfQik57Z2HYgBNkPRTgGtdK1teUIFGz0J7sJU/XztlroWiSI9yua+raNTWKi6Bl 1w0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=KLf6GTR8DeNhSBT+e5SPuRwr5AvV1mIjd/4jDBNIXh4=; b=Hu9UqwPualRKDo2LEGTyyyjkUHlMgCW1B7oeHxlbMSklUhw75pK7X3/qo0WsGtJJ6S f6ya5v8Mo/s6R5ZTgbxp8U8VeAYgG5yYPN5NNIvhoJZlKPudCFpBCR3mKsd2HXQzFFnq UUQLwc42onaE0/SYAlSH5bXaEJEQwvSc4movRdfScJrWr7y9GBjlx6SIFffKP+8tzDKJ k9BmIV7llP8ftcKS8LX+6i1ZyvxZrw3KkSxV+30CbVk4qogHLYMd0D7MVD0UVPHHSwF8 yB6LWBTL8sRSaiQvgBJlRtt5voJEWawqdJsCnAKEX0WBqXwTGM4+S1C8tKHKJfJmY87g 11Jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eQkgtVaZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c1si53446642pgw.444.2019.08.09.08.20.18; Fri, 09 Aug 2019 08:20:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eQkgtVaZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407318AbfHIPTX (ORCPT + 99 others); Fri, 9 Aug 2019 11:19:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:49768 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726255AbfHIPTX (ORCPT ); Fri, 9 Aug 2019 11:19:23 -0400 Received: from localhost (unknown [104.132.0.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 23E6B20C01; Fri, 9 Aug 2019 15:19:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565363962; bh=ojsCh6zH5M2twmcxcR8KTE+bmE0FgFJylCM5lNvG9y4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=eQkgtVaZd8kGl3wiyRnz1ZiLloMvEYAzgu/B/nRewB2f5nWbt0KLJ8ux3Ug+RgcQ0 dtj4jZB8RGA+nI7u8ofS3Vz/whXXMCXRmwaVeMXUd09or9svX6ZQrd/DkmN+suCfwk f9GUannEYdq2cwHGtoaG6CRjiXO7pgSfmhyufL74= Date: Fri, 9 Aug 2019 08:19:21 -0700 From: Jaegeuk Kim To: Chao Yu Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, chao@kernel.org Subject: Re: [PATCH v2] f2fs: fix wrong available node count calculation Message-ID: <20190809151921.GB93481@jaegeuk-macbookpro.roam.corp.google.com> References: <20190805102725.27834-1-yuchao0@huawei.com> <7a47ec24-2352-7438-bed2-493a89d5c576@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7a47ec24-2352-7438-bed2-493a89d5c576@huawei.com> User-Agent: Mutt/1.8.2 (2017-04-18) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > --- > > 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); > >