From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3794BC433DF for ; Thu, 18 Jun 2020 02:05:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0C31F20B1F for ; Thu, 18 Jun 2020 02:05:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592445937; bh=eA5Cn37u1sfoM/u0eqjABoeZC7g3Uj2f/ifAxgr7le0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ox8UrGq4Gw7RnLiZ+ndtq53Rr6MVC2kKzgpmT0IzR+2i3mMi/K8DKbQ/HVlYNiR3g tIBlSTYC9sFdXsUgQDqUEltDwID/AQXUF7t9G4uiTbnjZ7x3TgMMqL6wkNwk483Oxm mnoSJ23iSd3QaXdNl+pUXKYvv3yT4ph63Mz02b+M= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732069AbgFRCFf (ORCPT ); Wed, 17 Jun 2020 22:05:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:55832 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729604AbgFRBWp (ORCPT ); Wed, 17 Jun 2020 21:22:45 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 70B7520FC3; Thu, 18 Jun 2020 01:22:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592443364; bh=eA5Cn37u1sfoM/u0eqjABoeZC7g3Uj2f/ifAxgr7le0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oeIHRv6tul8EjjLqjU2W25NsGBzbFMTTvDU0pgexb+Tx2vdUFSKbni4NEyaHYXP9l o29EkX7LhrzVUnzikmnTjtgNGvD3q/+dnkSO+o6JSe6FwCU851/7OGkjwcpHL+H7iv Bfz8TbiuJUJ9SxGhQO+imjNKWxYlbP68WkMKN4YM= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Konstantin Khlebnikov , Chao Yu , Jaegeuk Kim , Sasha Levin , linux-f2fs-devel@lists.sourceforge.net Subject: [PATCH AUTOSEL 4.19 020/172] f2fs: report delalloc reserve as non-free in statfs for project quota Date: Wed, 17 Jun 2020 21:19:46 -0400 Message-Id: <20200618012218.607130-20-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200618012218.607130-1-sashal@kernel.org> References: <20200618012218.607130-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Konstantin Khlebnikov [ Upstream commit baaa7ebf25c78c5cb712fac16b7f549100beddd3 ] This reserved space isn't committed yet but cannot be used for allocations. For userspace it has no difference from used space. See the same fix in ext4 commit f06925c73942 ("ext4: report delalloc reserve as non-free in statfs for project quota"). Fixes: ddc34e328d06 ("f2fs: introduce f2fs_statfs_project") Signed-off-by: Konstantin Khlebnikov Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- fs/f2fs/super.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 45f8f6ec22a5..9782250c9815 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1154,7 +1154,8 @@ static int f2fs_statfs_project(struct super_block *sb, limit >>= sb->s_blocksize_bits; if (limit && buf->f_blocks > limit) { - curblock = dquot->dq_dqb.dqb_curspace >> sb->s_blocksize_bits; + curblock = (dquot->dq_dqb.dqb_curspace + + dquot->dq_dqb.dqb_rsvspace) >> sb->s_blocksize_bits; buf->f_blocks = limit; buf->f_bfree = buf->f_bavail = (buf->f_blocks > curblock) ? -- 2.25.1