Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp19661448ybl; Sat, 4 Jan 2020 06:22:37 -0800 (PST) X-Google-Smtp-Source: APXvYqxJAaQ+44MamU+wvwRUxTGdDLgzQHuk+u3F4YF+8aNIP7y588q6mUR5Lk5dRdxejEgQXLVW X-Received: by 2002:a05:6830:174e:: with SMTP id 14mr78174304otz.142.1578147757573; Sat, 04 Jan 2020 06:22:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1578147757; cv=pass; d=google.com; s=arc-20160816; b=ZXK08WxNo+DAmWL9LXGs1LP+FSwMido9RTcloKV5BlP3/IQAe9cKTTkirM4cxdq/Z/ LcZVBiOoRyhSpy6HbxkLbwrL1eWLni7ItcqqAItXN1IUbTKrPkP92C/Qe432ywTW1OCW Id3cQ0WI23St5ycgI5wUNs0XHY87VAWP7KyCwEa+qQAVj9dRjFvdjtraiBLGBwGbBgFK lv17VU/WaMxgv6YTGX7CS0gneRlLksOVbnpgcyE+9uoysrvdFYYdciPr2T4Rjyd2/5kA W3yVKiDfmcnhJbrPq83pc9zfbQ6uwRuwn577LaV2ds8IafNTZ2bzQwEfNPzNSeDV0tYg n9Sg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :date:subject:message-id:cc:to:from:dkim-signature; bh=6RgICWXwhvwNHztqQtPT2dhQ/f21R4V1Nli9Z29zuMM=; b=QlRrAH7zcF4v8pL3lE6/FCXSJ7Lz8CZyj4x6mO7HIf9NrD77mYjUvFo4XkW3gTKvy8 IwNu86eGaLF/ulopZQ+WTd/BMhRnU6tRLbFAB+KWi2yH9srh1lsOvjObVdzLFk5ZHB+K K3xCLUNSSv0kK3ZQXwCzX7lUdoS3sCWtjb7R9UxCfP2QcZhFasYBo95/mOLdMSrT+qju ZtjWEjQR1dlPgnEqoglzI4UJMFulyBUcw4SMIChlqOM3iZT4DV8c80+v9sU4AZ0YQsBB dUXkEc5fLkTISqvkfW72XVoqAcUS9ljuMv8tuwqNynJWrTLDymSnKFZvHf0HQAPNx7ss x5aw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mykernel.net header.s=zohomail header.b=e8i109+Q; arc=pass (i=1 spf=pass spfdomain=mykernel.net dkim=pass dkdomain=mykernel.net dmarc=pass fromdomain=mykernel.net>); 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 s3si28500406otr.57.2020.01.04.06.22.26; Sat, 04 Jan 2020 06:22:37 -0800 (PST) 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=@mykernel.net header.s=zohomail header.b=e8i109+Q; arc=pass (i=1 spf=pass spfdomain=mykernel.net dkim=pass dkdomain=mykernel.net dmarc=pass fromdomain=mykernel.net>); 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 S1726292AbgADOVY (ORCPT + 99 others); Sat, 4 Jan 2020 09:21:24 -0500 Received: from sender2-of-o52.zoho.com.cn ([163.53.93.247]:21135 "EHLO sender2-of-o52.zoho.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726005AbgADOVR (ORCPT ); Sat, 4 Jan 2020 09:21:17 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1578147625; cv=none; d=zoho.com.cn; s=zohoarc; b=bgbpHZyY+MRw8YTJOM1WEOc7yXFt1MCmQ61SZGH2rCLHeEBVB4FX376zfIqrFHr+4TW1CmxdlgFkm71q6+heq6ihQRzsneaLjpR1TqfbZI4hxtQgahVRkRpZ/HgFO844kR/9YK4Nl6kpPECRmtWRxr345LyPkP7idrq2qrvV+eE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com.cn; s=zohoarc; t=1578147625; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Subject:To; bh=6RgICWXwhvwNHztqQtPT2dhQ/f21R4V1Nli9Z29zuMM=; b=B8LMXxqN+WYi2cB+C1WgsNs4MSabWqQN3AnbeGsdg0da3fF8Z2qJkwLk51zoErV3I1R5+bIPR69V7eR1j1vrvhNabBeQobn5ljVEYWfjYM/ETcU7veEbtogT8JhGfCoEU0lCOArv8hKlSxFb8Gx0UDz3PmSWL2H8DlLMob3UJm8= ARC-Authentication-Results: i=1; mx.zoho.com.cn; dkim=pass header.i=mykernel.net; spf=pass smtp.mailfrom=cgxu519@mykernel.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1578147625; s=zohomail; d=mykernel.net; i=cgxu519@mykernel.net; h=From:To:Cc:Message-ID:Subject:Date:MIME-Version:Content-Transfer-Encoding:Content-Type; bh=6RgICWXwhvwNHztqQtPT2dhQ/f21R4V1Nli9Z29zuMM=; b=e8i109+QZvsd4wrqLK+Ybcy0JonbcvaCzWUFIG4Iwxz4G4U8UYlj1I/qUOqH64cF qGOUrEQYCiykqYIU6t+eIUqA/roamSoT7ILbISdwEw6MSZvg6qeMelcXj5bANQIc7Oo zJUYuSqTJ4leSILovkpfDaLNU+0aPpMCV9KLhQSk= Received: from localhost.localdomain.localdomain (113.116.49.111 [113.116.49.111]) by mx.zoho.com.cn with SMTPS id 15781476236011.4213776319637645; Sat, 4 Jan 2020 22:20:23 +0800 (CST) From: Chengguang Xu To: jaegeuk@kernel.org, chao@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Chengguang Xu Message-ID: <20200104142004.12883-1-cgxu519@mykernel.net> Subject: [f2fs-dev][PATCH 1/2] f2fs: fix miscounted block limit in f2fs_statfs_project() Date: Sat, 4 Jan 2020 22:20:03 +0800 X-Mailer: git-send-email 2.21.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoCNMailClient: External Content-Type: text/plain; charset=utf8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org statfs calculates Total/Used/Avail disk space in block unit, so we should translate soft/hard prjquota limit to block unit as well. Below testing result shows the block/inode numbers of Total/Used/Avail from df command are all correct afer applying this patch. [root@localhost quota-tools]\# ./repquota -P /dev/sdb1 *** Report for project quotas on device /dev/sdb1 Block grace time: 7days; Inode grace time: 7days Block limits File limits Project used soft hard grace used soft hard grace ----------------------------------------------------------- \#0 -- 4 0 0 1 0 0 \#101 -- 0 0 0 2 0 0 \#102 -- 0 10240 0 2 10 0 \#103 -- 0 0 20480 2 0 20 \#104 -- 0 10240 20480 2 10 20 \#105 -- 0 20480 10240 2 20 10 [root@localhost sdb1]\# lsattr -p t{1,2,3,4,5} 101 ----------------N-- t1/a1 102 ----------------N-- t2/a2 103 ----------------N-- t3/a3 104 ----------------N-- t4/a4 105 ----------------N-- t5/a5 [root@localhost sdb1]\# df -hi t{1,2,3,4,5} Filesystem Inodes IUsed IFree IUse% Mounted on /dev/sdb1 2.4M 21 2.4M 1% /mnt/sdb1 /dev/sdb1 10 2 8 20% /mnt/sdb1 /dev/sdb1 20 2 18 10% /mnt/sdb1 /dev/sdb1 10 2 8 20% /mnt/sdb1 /dev/sdb1 10 2 8 20% /mnt/sdb1 [root@localhost sdb1]\# df -h t{1,2,3,4,5} Filesystem Size Used Avail Use% Mounted on /dev/sdb1 10G 489M 9.6G 5% /mnt/sdb1 /dev/sdb1 10M 0 10M 0% /mnt/sdb1 /dev/sdb1 20M 0 20M 0% /mnt/sdb1 /dev/sdb1 10M 0 10M 0% /mnt/sdb1 /dev/sdb1 10M 0 10M 0% /mnt/sdb1 Fixes: 909110c060f2 ("f2fs: choose hardlimit when softlimit is larger than = hardlimit in f2fs_statfs_project()") Signed-off-by: Chengguang Xu --- fs/f2fs/super.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 5111e1ffe58a..78efd0e76174 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1219,6 +1219,8 @@ static int f2fs_statfs_project(struct super_block *sb= , =09if (dquot->dq_dqb.dqb_bhardlimit && =09=09=09(!limit || dquot->dq_dqb.dqb_bhardlimit < limit)) =09=09limit =3D dquot->dq_dqb.dqb_bhardlimit; +=09if (limit) +=09=09limit >>=3D sb->s_blocksize_bits; =20 =09if (limit && buf->f_blocks > limit) { =09=09curblock =3D dquot->dq_dqb.dqb_curspace >> sb->s_blocksize_bits; --=20 2.21.1