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 3F478C4332D for ; Mon, 18 Jan 2021 22:14:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 139C1207C4 for ; Mon, 18 Jan 2021 22:14:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388009AbhARWOY (ORCPT ); Mon, 18 Jan 2021 17:14:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:34110 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387793AbhARWNH (ORCPT ); Mon, 18 Jan 2021 17:13:07 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0223A22CB1; Mon, 18 Jan 2021 22:12:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611007935; bh=HkV+v1+M13RtbXFKFshv0TMII3eJb5vlu+TTekC5Bqc=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=LASmKIZkEmVUSxs48dAYG4tCZyrcNa+/SHIhzv72f4WygAnXjtgMk9J73CZsS+1pB Ih6RoYmaTGwtTSg3493a2yLjRPRTE65QkdDonOvvuVQrPiL4q/nJ0sNH9tI2E5mxT6 38Lzgsdqh/AYyQfl0BJKU6o919F70kUlzGPppAFSmLB6FNEs1gCYGbdPDL7XKNCsEd xqh/ANCBYiM8nwnDC67+TlOZpTGCLpHHd8nR9YnqjSvcUAvhA11MaTX4vPNHJpdyAI gfXmNy9PalOUGVSpYdEiAiPE0U1l16VEGBIdBqsIrphFcOeSEEAeUGjzLYFSYVdEsa aLdc5B6jPE8Wg== 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 Date: Mon, 18 Jan 2021 14:12:14 -0800 Message-ID: <161100793468.88816.9429092187041160477.stgit@magnolia> In-Reply-To: <161100791789.88816.10902093186807310995.stgit@magnolia> References: <161100791789.88816.10902093186807310995.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;