Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp3513950ybh; Mon, 5 Aug 2019 20:25:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqw6mqN5IEksc7XSddgYRyQxiIFy05OYImFAyyeU/v09LQUBGKfupYTC7vmeyDDbZUjWyFSz X-Received: by 2002:a17:902:9307:: with SMTP id bc7mr913059plb.183.1565061917768; Mon, 05 Aug 2019 20:25:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565061917; cv=none; d=google.com; s=arc-20160816; b=rpKmAQ+tfCJI3+NSG/hS1/yUpXOHNbqsYtIVUFVVahBXyLQmx/5eGE1uQQxEn0/VWS D7nbLkq0nOK/FnZmOJvw75ZHdSc93cNm6Aqf5mqqrmzKTr09AxBL8QGxbqHccKrzv6Pr szxfJArCafrL+8xoUfrNvZpqrUUt2MRXmHjprkpeUgptErDd5/KHLebE6kUVlUlTvEbH TnsnTy5RfLiHsMTytbuS2DjMdhyB9P1WtdPVQbKrBucKYq6bdW9ZijRIVvwv4x9KhIlJ yv8OffQNl5uvgD7jWQgzKW6rxgEeavrp4gpbzEN7JKlKC6ydlEK93uiOb0yCqpkkZkbD 1ChA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=h+8etnBp1LUbCjqlawODSDBt8Vz5y69faT6b6fdsX+k=; b=dz1m0wIF6nffzTITc1WeRJym/SrTNqpVzXcDsSeLsKxje3RYwHZxE27+UJURPOlMiv h+7eHm7bhNfHhjRP2n9Ed3y3sRLnLWqAGXPNinoBYm9HmEoc9U02b7CxCRlexzq/eGVo eB8IyvFv/VSAYvpa6qRizxRD5oyS0vz0O509m9ekYM4DTr0Bw+3SA20q5npApbkiWiSe Y69sNDlWAcZBae4I2LHFEzlYjk7blwS2PWq8tvKOIMsGymDWJJ6DJ6uatDxiAH4TtfFX a7u/+wK3xxP9hEPmFdjOzXeXnz2DZWQ8L3g2Y5i2xAWvOhnvNT9myrmj1X9iMw+fbsp+ cinA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a65si19741917pgc.213.2019.08.05.20.25.01; Mon, 05 Aug 2019 20:25:17 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730900AbfHFDYO (ORCPT + 99 others); Mon, 5 Aug 2019 23:24:14 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:52942 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729383AbfHFDYO (ORCPT ); Mon, 5 Aug 2019 23:24:14 -0400 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 4475FF721CE4C434936; Tue, 6 Aug 2019 11:24:12 +0800 (CST) Received: from [10.134.22.195] (10.134.22.195) by smtp.huawei.com (10.3.19.212) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 6 Aug 2019 11:24:10 +0800 Subject: Re: [PATCH v2] f2fs: fix wrong available node count calculation To: CC: , , References: <20190805102725.27834-1-yuchao0@huawei.com> From: Chao Yu Message-ID: <7a47ec24-2352-7438-bed2-493a89d5c576@huawei.com> Date: Tue, 6 Aug 2019 11:24:22 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20190805102725.27834-1-yuchao0@huawei.com> Content-Type: text/plain; charset="windows-1252" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.134.22.195] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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); >