Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2409992ybc; Sun, 17 Nov 2019 21:11:45 -0800 (PST) X-Google-Smtp-Source: APXvYqytMfE9LZ71Xg9UsDSKe/QL1vPrUxF5dbtziVsUfbnieUsZatLziLHHvmcK32fnYBQETdHE X-Received: by 2002:a17:906:e0c8:: with SMTP id gl8mr8715849ejb.49.1574053905298; Sun, 17 Nov 2019 21:11:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1574053905; cv=pass; d=google.com; s=arc-20160816; b=WsdgQcBFEs4/tUAtcKxrJ4/tKBOVb63Q6o0FDw38rH5g35TE0zStrfG9/tmTMsib8+ lDdbnEKH4/0HjwsX5gchIhoOBbnnib5OaGN0gy7B1rakIshnuYzTFabDvPMBXWhTVRI6 blNhGGOlIG6/WwDVJXgq5J8ZoQfMAaFjAtIyNp68fl94jAqJ8Q8SknwpITloVbJqxb3+ tqjy82I8ZXg3Y7Uy5TRAR+JCY4SPw9fUqISp0qxRjIOATBWMzZOVeg8mv+vSg0IPNr0a nk/+AsoSJmuBhTqziS60wEsb8PHppACVtXAyzJ7yDJxHvSr3kvgW+DSE3pQwZCcxrPmm qRgQ== 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 :references:in-reply-to:date:subject:message-id:cc:to:from :dkim-signature; bh=W+4d37NiUZrTVp/T//URhJAtULIpMWsOCTG3JUgcQbA=; b=cF6cfPLdbamqmtna2BnN3qbP9vBium8ZxdPLV5psFFMXKRAUJiipDVQbi4yWlw8kqN rrS6JAj0HaBckMM6Z5Qu8S7WhVzN63TaIA22nj3Vt8MYGnYD+nl//u76blBJ3c5i+Wj8 R9b9Y2eohSGLTl/1ZE242rbyiuK9d38Wt/2kZ8FJ+o6uPQWAPfc7KPjAe/YS6SdeB0cw ke3AiL3fC5LF+9CwV+Ry9tDH9D0gV9+lmmcX2tkjq9Tz6L3LYLUIl/xlFn/IOweuRhLn SmgqqKEZdu5j+Vsm3XdyzEGSlwo52gOynLRCh1kdIVzKh506AESWBY5LYQFKOqeUXeOB URhw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mykernel.net header.s=zohomail header.b=Jz7cAV9v; 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-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-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 q30si13177185edb.372.2019.11.17.21.11.11; Sun, 17 Nov 2019 21:11:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-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=Jz7cAV9v; 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-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726140AbfKRFLK (ORCPT + 99 others); Mon, 18 Nov 2019 00:11:10 -0500 Received: from sender3-of-o52.zoho.com.cn ([124.251.121.247]:21960 "EHLO sender2.zoho.com.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725208AbfKRFLK (ORCPT ); Mon, 18 Nov 2019 00:11:10 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1574053818; cv=none; d=zoho.com.cn; s=zohoarc; b=CFiTydxXmqD9bMG7v780o3N8ddqWN6K3FCgyTdlTsez+ICLl9SEtemLlO1rFmwdlnFVn0KaMzc1ve2S2pA//ZQDSMywCMchSASZ55qhlGgITwNozY47/lo2c/INkLP4RSjDGEAEdUnzyuSWpR2MhhKkB3r8PeWHkAF6uLKrdeQw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com.cn; s=zohoarc; t=1574053818; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=W+4d37NiUZrTVp/T//URhJAtULIpMWsOCTG3JUgcQbA=; b=SfZrHruFtbvLbpQPjNc72IC+JSlnZfJ+XGA4IFDCxatxJXqhBCbg8JNLUagIec/KDcUIuQTVBtngdQoSW3hkUMbcgLGEpH8Fm+eXwz7ARt58nKunz86ZgaxuRX//6Mv41ix92didw44LkKsvKlQgBBZdKpmg9s6dWyjCHjCQdl8= 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=1574053818; s=zohomail; d=mykernel.net; i=cgxu519@mykernel.net; h=From:To:Cc:Message-ID:Subject:Date:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding; l=1801; bh=W+4d37NiUZrTVp/T//URhJAtULIpMWsOCTG3JUgcQbA=; b=Jz7cAV9vUe3W4KyujDLRcYQXLcQV6tl7gVqHx1v+Ljon9oHqojtRod0Rc50n5YC5 ZkEOZtA8Vu7ezLL5/F5sGKbob4KLpIxLDCTIwMJBQFp3pj5hakvhUeJmc/iSvEmO7Gl mbdedSI3usWavsqw8+/jaZGYDbtDrn2dLYPcKTdA= Received: from localhost.localdomain (218.18.229.179 [218.18.229.179]) by mx.zoho.com.cn with SMTPS id 157405381681740.021350625482796; Mon, 18 Nov 2019 13:10:16 +0800 (CST) From: Chengguang Xu To: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org Cc: darrick.wong@oracle.com, jaegeuk@kernel.org, chao@kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca, Chengguang Xu Message-ID: <20191118050949.15629-2-cgxu519@mykernel.net> Subject: [RFC PATCH 2/3] f2fs: show prjquota info on statfs for a file Date: Mon, 18 Nov 2019 13:09:48 +0800 X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191118050949.15629-1-cgxu519@mykernel.net> References: <20191118050949.15629-1-cgxu519@mykernel.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-ZohoCNMailClient: External Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Currently we replace filesystem statistics using prjquota info on statfs when specified directory has project id inherit flag. However, statfs on a file(accurately non-dir) which is under the project quota dir(with inherit flag) still shows whole filesystem statistics. In container use case, it will give container user inconsistent experience and cause confusion about available free space. Detail info like below: We use project quota to limit disk space usage for a container and run df command inside container. Run df on a directory: [root /]# df -h /etc/ Filesystem=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Size=C2=A0 Used Avail Use% Mounted= on kataShared=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 1.0G=C2=A0=C2=A0 13M 1012M=C2=A0= =C2=A0 2% / Run df on a file: [root /]# df -h /etc/exports Filesystem=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Size=C2=A0 Used Avail Use% Mounted= on kataShared=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 1.5T=C2=A0 778M=C2=A0 1.5T=C2=A0= =C2=A0 1% / Signed-off-by: Chengguang Xu --- fs/f2fs/super.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 1443cee15863..c5b9a92d606b 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1287,8 +1287,9 @@ static int f2fs_statfs(struct dentry *dentry, struct = kstatfs *buf) =09buf->f_fsid.val[1] =3D (u32)(id >> 32); =20 #ifdef CONFIG_QUOTA -=09if (is_inode_flag_set(dentry->d_inode, FI_PROJ_INHERIT) && -=09=09=09sb_has_quota_limits_enabled(sb, PRJQUOTA)) { +=09if ((is_inode_flag_set(dentry->d_inode, FI_PROJ_INHERIT) || +=09 !S_ISDIR(dentry->d_inode->i_mode)) && +=09 sb_has_quota_limits_enabled(sb, PRJQUOTA)) { =09=09f2fs_statfs_project(sb, F2FS_I(dentry->d_inode)->i_projid, buf); =09} #endif --=20 2.20.1