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=-16.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 53D1AC433E0 for ; Sat, 23 Jan 2021 18:53:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1F17F2313E for ; Sat, 23 Jan 2021 18:53:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726198AbhAWSxJ (ORCPT ); Sat, 23 Jan 2021 13:53:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:35292 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726232AbhAWSxE (ORCPT ); Sat, 23 Jan 2021 13:53:04 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id B24A22312F; Sat, 23 Jan 2021 18:52:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611427934; bh=HkV+v1+M13RtbXFKFshv0TMII3eJb5vlu+TTekC5Bqc=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=cBIWP0vvpLFKZiHPegc9c3jyiJePft8ggnGB5hmnmXLTdTvvIl+0y7BZPPBniDa79 Cfgl2ULKXZhN3RD5/PM/d9JcnWqUmzwmLR5aBLOCwcyrNrXjtL7/aCH58LWNZ/x/89 DktnQuS10FwfI0Pnlo08ZhTwbZVve2WFAPy5cSDJF8/gQg3KhUqu/0tvw7vEf/tUBB Q5MY2ZvBaW7taHFqR8+sM2XsWAeZqDeBdStkdn2yv2qF0/07aievg4M7jrDgPz2mHa zV/2sidQFlFfM/PYoZy0oPj++OK7Rt9G8ilXYi8KZ/3vVtx9WTYedO1gVYCKWBhicT qKI34vgU+Tkog== Subject: [PATCH 03/11] xfs: xfs_inode_free_quota_blocks should scan project quota From: "Darrick J. Wong" To: djwong@kernel.org Cc: Christoph Hellwig , linux-xfs@vger.kernel.org, hch@infradead.org, david@fromorbit.com Date: Sat, 23 Jan 2021 10:52:16 -0800 Message-ID: <161142793633.2171939.2299668448645740426.stgit@magnolia> In-Reply-To: <161142791950.2171939.3320927557987463636.stgit@magnolia> References: <161142791950.2171939.3320927557987463636.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Buffered writers who have run out of quota reservation call xfs_inode_free_quota_blocks to try to free any space reservations that might reduce the quota usage. Unfortunately, the buffered write path treats "out of project quota" the same as "out of overall space" so this function has never supported scanning for space that might ease an "out of project quota" condition. We're about to start using this function for cases where we actually /can/ tell if we're out of project quota, so add in this functionality. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- fs/xfs/xfs_icache.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c index 89f9e692fde7..10c1a0dee17d 100644 --- a/fs/xfs/xfs_icache.c +++ b/fs/xfs/xfs_icache.c @@ -1434,6 +1434,15 @@ xfs_inode_free_quota_blocks( } } + if (XFS_IS_PQUOTA_ENFORCED(ip->i_mount)) { + dq = xfs_inode_dquot(ip, XFS_DQTYPE_PROJ); + if (dq && xfs_dquot_lowsp(dq)) { + eofb.eof_prid = ip->i_d.di_projid; + eofb.eof_flags |= XFS_EOF_FLAGS_PRID; + do_work = true; + } + } + if (!do_work) return false;