From patchwork Mon May 18 17:04:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11555845 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2782260D for ; Mon, 18 May 2020 17:04:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0763520872 for ; Mon, 18 May 2020 17:04:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Hk7vaQIw" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727777AbgERREn (ORCPT ); Mon, 18 May 2020 13:04:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726958AbgERREn (ORCPT ); Mon, 18 May 2020 13:04:43 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F8F9C061A0C for ; Mon, 18 May 2020 10:04:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:To:From:Sender: Reply-To:Cc:Content-Type:Content-ID:Content-Description; bh=jd0gBRliUSRr+T47eNk6iLhMsQ8vbLHrRMXyvsVzDwc=; b=Hk7vaQIw3lRW+PtXzw7ibIsZ5X fWNMYkvXabtkyv9buipAPCA7Xok+h58/yoniFfNTpQE4Z3hCuomw0AUfkyQwlbeHtUoAOUzUl+ocO Yjh8khVaDo1JpItHpGcWKmBewCdV5cRF6R/cAh/nWfM5xvU+B6E6Wr/6nYZiGuGQjP87pyB/FZ2XM jWh27KHtA+Yp3afIqU2/MsqSyxVuJny4TXwFJzyQKpaz09qTx/TiaCixZG8zugMxS+DLGuhO2JoQA KYyvmXRqCayCb+OnZ+eYTL3I0hCcFrYj5f9XT8qjbzYznQ5wmZopL4R0DiLBofgF5mMcgvn8AS3C8 JW9DmwtQ==; Received: from [2001:4bb8:188:1506:c70:4a89:bc61:2] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jajBy-0001vf-Vt for linux-xfs@vger.kernel.org; Mon, 18 May 2020 17:04:43 +0000 From: Christoph Hellwig To: linux-xfs@vger.kernel.org Subject: [PATCH 1/6] xfs: remove xfs_inode_ag_iterator Date: Mon, 18 May 2020 19:04:32 +0200 Message-Id: <20200518170437.1218883-2-hch@lst.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200518170437.1218883-1-hch@lst.de> References: <20200518170437.1218883-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org This function is entirely unused. Signed-off-by: Christoph Hellwig --- fs/xfs/xfs_icache.c | 11 ----------- fs/xfs/xfs_icache.h | 5 +---- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c index 922a29032e374..1f9b86768f054 100644 --- a/fs/xfs/xfs_icache.c +++ b/fs/xfs/xfs_icache.c @@ -979,17 +979,6 @@ xfs_inode_ag_iterator_flags( return last_error; } -int -xfs_inode_ag_iterator( - struct xfs_mount *mp, - int (*execute)(struct xfs_inode *ip, int flags, - void *args), - int flags, - void *args) -{ - return xfs_inode_ag_iterator_flags(mp, execute, flags, args, 0); -} - int xfs_inode_ag_iterator_tag( struct xfs_mount *mp, diff --git a/fs/xfs/xfs_icache.h b/fs/xfs/xfs_icache.h index 48f1fd2bb6ad8..39712737c0d5c 100644 --- a/fs/xfs/xfs_icache.h +++ b/fs/xfs/xfs_icache.h @@ -24,7 +24,7 @@ struct xfs_eofblocks { * tags for inode radix tree */ #define XFS_ICI_NO_TAG (-1) /* special flag for an untagged lookup - in xfs_inode_ag_iterator */ + in xfs_inode_ag_iterator* */ #define XFS_ICI_RECLAIM_TAG 0 /* inode is to be reclaimed */ #define XFS_ICI_EOFBLOCKS_TAG 1 /* inode has blocks beyond EOF */ #define XFS_ICI_COWBLOCKS_TAG 2 /* inode can have cow blocks to gc */ @@ -71,9 +71,6 @@ int xfs_inode_free_quota_cowblocks(struct xfs_inode *ip); void xfs_cowblocks_worker(struct work_struct *); void xfs_queue_cowblocks(struct xfs_mount *); -int xfs_inode_ag_iterator(struct xfs_mount *mp, - int (*execute)(struct xfs_inode *ip, int flags, void *args), - int flags, void *args); int xfs_inode_ag_iterator_flags(struct xfs_mount *mp, int (*execute)(struct xfs_inode *ip, int flags, void *args), int flags, void *args, int iter_flags); From patchwork Mon May 18 17:04:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11555847 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ABABA60D for ; Mon, 18 May 2020 17:04:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8B685207D8 for ; Mon, 18 May 2020 17:04:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="mtM4lKsB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727973AbgERREq (ORCPT ); Mon, 18 May 2020 13:04:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726958AbgERREp (ORCPT ); Mon, 18 May 2020 13:04:45 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D56CCC061A0C for ; Mon, 18 May 2020 10:04:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:To:From:Sender: Reply-To:Cc:Content-Type:Content-ID:Content-Description; bh=z8tiePGIXsKV+TRlkgIO2fmfPmXAnAfTMfqrnyoR/Cc=; b=mtM4lKsBgIx1dBUUf1SxnRVfm8 /zYoc5iSVWLXwBaA8XUVCzG0Mb6XaluI5nj9US70scC+lbxp8BAhI53kkhtNAxEDwcYgX260uYBRu /eiK5J6LCm5+ygcPrAZoRDb9WWjafyNxiLL1M5M+vG1ASW5IUU1EkBNsc1Z/ZLRgl6fVjl++pbUmE vtrl9NOlWhZF7hxC0r+RYlBeqAhN5JkA3JLxm7gLuB+uEPoshl39EwGKyoODBQHMlygX+gvOq2OPj zro7akmamPfHQszuDdxx2MDSa2gsCmqBY7I1pyOdpgOgFc2h/1TKg+lK8mO6CNzyXuqaTtHs/1V7X Rj6VLGmg==; Received: from [2001:4bb8:188:1506:c70:4a89:bc61:2] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jajC1-0001vx-CI for linux-xfs@vger.kernel.org; Mon, 18 May 2020 17:04:45 +0000 From: Christoph Hellwig To: linux-xfs@vger.kernel.org Subject: [PATCH 2/6] xfs: mark xfs_inode_ag_iterator_tag static Date: Mon, 18 May 2020 19:04:33 +0200 Message-Id: <20200518170437.1218883-3-hch@lst.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200518170437.1218883-1-hch@lst.de> References: <20200518170437.1218883-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org No users outside of xfs_icache.c. Signed-off-by: Christoph Hellwig --- fs/xfs/xfs_icache.c | 2 +- fs/xfs/xfs_icache.h | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c index 1f9b86768f054..6c6f8015ab6ef 100644 --- a/fs/xfs/xfs_icache.c +++ b/fs/xfs/xfs_icache.c @@ -979,7 +979,7 @@ xfs_inode_ag_iterator_flags( return last_error; } -int +static int xfs_inode_ag_iterator_tag( struct xfs_mount *mp, int (*execute)(struct xfs_inode *ip, int flags, diff --git a/fs/xfs/xfs_icache.h b/fs/xfs/xfs_icache.h index 39712737c0d5c..11fd6d877e112 100644 --- a/fs/xfs/xfs_icache.h +++ b/fs/xfs/xfs_icache.h @@ -74,9 +74,6 @@ void xfs_queue_cowblocks(struct xfs_mount *); int xfs_inode_ag_iterator_flags(struct xfs_mount *mp, int (*execute)(struct xfs_inode *ip, int flags, void *args), int flags, void *args, int iter_flags); -int xfs_inode_ag_iterator_tag(struct xfs_mount *mp, - int (*execute)(struct xfs_inode *ip, int flags, void *args), - int flags, void *args, int tag); static inline int xfs_fs_eofblocks_from_user( From patchwork Mon May 18 17:04:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11555849 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ECC80912 for ; Mon, 18 May 2020 17:04:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CC298207D8 for ; Mon, 18 May 2020 17:04:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="K7s244UT" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728043AbgERREs (ORCPT ); Mon, 18 May 2020 13:04:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726958AbgERREs (ORCPT ); Mon, 18 May 2020 13:04:48 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E950C061A0C for ; Mon, 18 May 2020 10:04:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:To:From:Sender: Reply-To:Cc:Content-Type:Content-ID:Content-Description; bh=FadrEfJSi9gd6fZluLolBXj+fE7KbH6CxPclpqq/rJk=; b=K7s244UTy5PJO24gltKyZImsN6 68Bh93U4w1t+bDdZ/zqR+VtVVgx4YczxEUwxeafhBCZHevcTI9nuoMJQXRnSFaND7MuGA+p3DXENd O4XelfpBW/g0OEA00xZvpKgbTXmXJlxoO6UJ//WBKQD9qGdiRctfQMjei6Ag1u63aujzF6kgbLnSN HSagHRXDnDCpwna5cwVAbmXuqMzw3gY5UL6FrTdeosuSY5J2gjhB2/weB0eQMe8oIVPtsFDHrWvNM +tSO1qSiwYSI7IhxEbNEh3UIe91nIuaq6hDzmG9VinTOtRG1Ie4czVEuunkyUacWkq+S82MXUM8Bs 1lYD2nJg==; Received: from [2001:4bb8:188:1506:c70:4a89:bc61:2] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jajC3-0001wU-PH for linux-xfs@vger.kernel.org; Mon, 18 May 2020 17:04:48 +0000 From: Christoph Hellwig To: linux-xfs@vger.kernel.org Subject: [PATCH 3/6] xfs: remove __xfs_icache_free_eofblocks Date: Mon, 18 May 2020 19:04:34 +0200 Message-Id: <20200518170437.1218883-4-hch@lst.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200518170437.1218883-1-hch@lst.de> References: <20200518170437.1218883-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Just open code the trivial logic in the two callers. Signed-off-by: Christoph Hellwig --- fs/xfs/xfs_icache.c | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c index 6c6f8015ab6ef..b638d12fb56a2 100644 --- a/fs/xfs/xfs_icache.c +++ b/fs/xfs/xfs_icache.c @@ -1504,30 +1504,17 @@ xfs_inode_free_eofblocks( return ret; } -static int -__xfs_icache_free_eofblocks( +int +xfs_icache_free_eofblocks( struct xfs_mount *mp, - struct xfs_eofblocks *eofb, - int (*execute)(struct xfs_inode *ip, int flags, - void *args), - int tag) + struct xfs_eofblocks *eofb) { int flags = SYNC_TRYLOCK; if (eofb && (eofb->eof_flags & XFS_EOF_FLAGS_SYNC)) flags = SYNC_WAIT; - - return xfs_inode_ag_iterator_tag(mp, execute, flags, - eofb, tag); -} - -int -xfs_icache_free_eofblocks( - struct xfs_mount *mp, - struct xfs_eofblocks *eofb) -{ - return __xfs_icache_free_eofblocks(mp, eofb, xfs_inode_free_eofblocks, - XFS_ICI_EOFBLOCKS_TAG); + return xfs_inode_ag_iterator_tag(mp, xfs_inode_free_eofblocks, flags, + eofb, XFS_ICI_EOFBLOCKS_TAG); } /* @@ -1789,8 +1776,12 @@ xfs_icache_free_cowblocks( struct xfs_mount *mp, struct xfs_eofblocks *eofb) { - return __xfs_icache_free_eofblocks(mp, eofb, xfs_inode_free_cowblocks, - XFS_ICI_COWBLOCKS_TAG); + int flags = SYNC_TRYLOCK; + + if (eofb && (eofb->eof_flags & XFS_EOF_FLAGS_SYNC)) + flags = SYNC_WAIT; + return xfs_inode_ag_iterator_tag(mp, xfs_inode_free_cowblocks, flags, + eofb, XFS_ICI_COWBLOCKS_TAG); } int From patchwork Mon May 18 17:04:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11555851 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 56061912 for ; Mon, 18 May 2020 17:04:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3D9DD207D8 for ; Mon, 18 May 2020 17:04:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="nahELTat" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728142AbgERREu (ORCPT ); Mon, 18 May 2020 13:04:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726958AbgERREu (ORCPT ); Mon, 18 May 2020 13:04:50 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A940AC061A0C for ; Mon, 18 May 2020 10:04:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:To:From:Sender: Reply-To:Cc:Content-Type:Content-ID:Content-Description; bh=og+HZA99lyMYFqQ2mYARlGEklpPTyQGE97h838sZk4g=; b=nahELTatNm+F5eSYsG6umiGyuL TIgCuTKJAtc2oJQAYdjjXzeI+TxJt5fVpPDlILnVlIYiib2A+oJK8J/gurGuZCmc2jwa+OTqOQ/xv olMKqLZCZ/qPmF3BhC2e3INIKjdRw4pjcliea3PBQcLqb/ngsbBeOCZpjMw0lt71gfa1O5bBOqmno 3ShY7hKqwlP6eectcckZfihY4oq9wQkgO3qMsIQFJHOZR+61Na7mttO7dx8pLcB6daVUp9MURpC+O B0Q4gFdUgqf+AT7vYKZ1J3lPrIhrtE0+ctxV6UozBGZCjRrSu/uiJGLNsUxWjmMWLyTomfdTN2rkC iFv7YnlQ==; Received: from [2001:4bb8:188:1506:c70:4a89:bc61:2] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jajC6-0001wn-7K for linux-xfs@vger.kernel.org; Mon, 18 May 2020 17:04:50 +0000 From: Christoph Hellwig To: linux-xfs@vger.kernel.org Subject: [PATCH 4/6] xfs: merge xfs_inode_free_quota_{eof,cow}blocks Date: Mon, 18 May 2020 19:04:35 +0200 Message-Id: <20200518170437.1218883-5-hch@lst.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200518170437.1218883-1-hch@lst.de> References: <20200518170437.1218883-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org These two are always called together. Signed-off-by: Christoph Hellwig --- fs/xfs/xfs_file.c | 5 +---- fs/xfs/xfs_icache.c | 28 +++++++--------------------- fs/xfs/xfs_icache.h | 3 +-- 3 files changed, 9 insertions(+), 27 deletions(-) diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 4b8bdecc38635..a1a62647f3935 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -650,10 +650,7 @@ xfs_file_buffered_aio_write( */ if (ret == -EDQUOT && !enospc) { xfs_iunlock(ip, iolock); - enospc = xfs_inode_free_quota_eofblocks(ip); - if (enospc) - goto write_retry; - enospc = xfs_inode_free_quota_cowblocks(ip); + enospc = xfs_inode_free_quota_blocks(ip); if (enospc) goto write_retry; iolock = 0; diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c index b638d12fb56a2..aa664be49fd50 100644 --- a/fs/xfs/xfs_icache.c +++ b/fs/xfs/xfs_icache.c @@ -1523,11 +1523,9 @@ xfs_icache_free_eofblocks( * failure. We make a best effort by including each quota under low free space * conditions (less than 1% free space) in the scan. */ -static int -__xfs_inode_free_quota_eofblocks( - struct xfs_inode *ip, - int (*execute)(struct xfs_mount *mp, - struct xfs_eofblocks *eofb)) +int +xfs_inode_free_quota_blocks( + struct xfs_inode *ip) { int scan = 0; struct xfs_eofblocks eofb = {0}; @@ -1557,19 +1555,14 @@ __xfs_inode_free_quota_eofblocks( } } - if (scan) - execute(ip->i_mount, &eofb); + if (scan) { + xfs_icache_free_eofblocks(ip->i_mount, &eofb); + xfs_icache_free_cowblocks(ip->i_mount, &eofb); + } return scan; } -int -xfs_inode_free_quota_eofblocks( - struct xfs_inode *ip) -{ - return __xfs_inode_free_quota_eofblocks(ip, xfs_icache_free_eofblocks); -} - static inline unsigned long xfs_iflag_for_tag( int tag) @@ -1784,13 +1777,6 @@ xfs_icache_free_cowblocks( eofb, XFS_ICI_COWBLOCKS_TAG); } -int -xfs_inode_free_quota_cowblocks( - struct xfs_inode *ip) -{ - return __xfs_inode_free_quota_eofblocks(ip, xfs_icache_free_cowblocks); -} - void xfs_inode_set_cowblocks_tag( xfs_inode_t *ip) diff --git a/fs/xfs/xfs_icache.h b/fs/xfs/xfs_icache.h index 11fd6d877e112..3e4a8b3913f51 100644 --- a/fs/xfs/xfs_icache.h +++ b/fs/xfs/xfs_icache.h @@ -60,14 +60,13 @@ void xfs_inode_set_reclaim_tag(struct xfs_inode *ip); void xfs_inode_set_eofblocks_tag(struct xfs_inode *ip); void xfs_inode_clear_eofblocks_tag(struct xfs_inode *ip); int xfs_icache_free_eofblocks(struct xfs_mount *, struct xfs_eofblocks *); -int xfs_inode_free_quota_eofblocks(struct xfs_inode *ip); +int xfs_inode_free_quota_blocks(struct xfs_inode *ip); void xfs_eofblocks_worker(struct work_struct *); void xfs_queue_eofblocks(struct xfs_mount *); void xfs_inode_set_cowblocks_tag(struct xfs_inode *ip); void xfs_inode_clear_cowblocks_tag(struct xfs_inode *ip); int xfs_icache_free_cowblocks(struct xfs_mount *, struct xfs_eofblocks *); -int xfs_inode_free_quota_cowblocks(struct xfs_inode *ip); void xfs_cowblocks_worker(struct work_struct *); void xfs_queue_cowblocks(struct xfs_mount *); From patchwork Mon May 18 17:04:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11555853 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B868B60D for ; Mon, 18 May 2020 17:04:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A09A0207D8 for ; Mon, 18 May 2020 17:04:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="tx974qWw" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728152AbgERREx (ORCPT ); Mon, 18 May 2020 13:04:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726958AbgERREx (ORCPT ); Mon, 18 May 2020 13:04:53 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 101B5C061A0C for ; Mon, 18 May 2020 10:04:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:To:From:Sender: Reply-To:Cc:Content-Type:Content-ID:Content-Description; bh=/3dRbjitqxcOE5pwhsmfsyWfbxZKLD1n/67fh4aCBVQ=; b=tx974qWwwyx61xSAImsaqWM9TR LCdWuPuHR26gRk54b7hdllDUbPT1pQwEgN0qwPNHyzvev5qeFhZw1t7xgL3yn2ikfFcGmrFRyMTID p4zMH4QATmbrjjyVg28WuS4FmK3dh0PABuUpWGOLoBLQGslVDOrF5mU1jm3sEXH/lozmDWZ3sIJPa HeTeH+3f4XL2TAHKWYqXsh5KffHTB7viJY20v94fPwOaOOLx4A4UCvXLlgtBXbHKxLhT67aF9MV1G Vu5bDoKn8FyfitAj8Dd8YBFftVd2DH+miGOhL1vOwlzA3+PBIzmXzB4TOibRaK0JR/DmlxF8ybLyw I6rYgzag==; Received: from [2001:4bb8:188:1506:c70:4a89:bc61:2] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jajC8-0001x4-J9 for linux-xfs@vger.kernel.org; Mon, 18 May 2020 17:04:52 +0000 From: Christoph Hellwig To: linux-xfs@vger.kernel.org Subject: [PATCH 5/6] xfs: add a flags argument to xfs_icache_free_cowblocks Date: Mon, 18 May 2020 19:04:36 +0200 Message-Id: <20200518170437.1218883-6-hch@lst.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200518170437.1218883-1-hch@lst.de> References: <20200518170437.1218883-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Pass the SYNC_* flags directly instead of hiding the information in the eofblocks structure. Signed-off-by: Christoph Hellwig --- fs/xfs/xfs_file.c | 2 +- fs/xfs/xfs_icache.c | 11 ++++------- fs/xfs/xfs_icache.h | 3 ++- fs/xfs/xfs_super.c | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index a1a62647f3935..6fc1a4a2f1966 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -663,7 +663,7 @@ xfs_file_buffered_aio_write( xfs_iunlock(ip, iolock); eofb.eof_flags = XFS_EOF_FLAGS_SYNC; xfs_icache_free_eofblocks(ip->i_mount, &eofb); - xfs_icache_free_cowblocks(ip->i_mount, &eofb); + xfs_icache_free_cowblocks(ip->i_mount, &eofb, SYNC_WAIT); goto write_retry; } diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c index aa664be49fd50..43273b809fa34 100644 --- a/fs/xfs/xfs_icache.c +++ b/fs/xfs/xfs_icache.c @@ -944,7 +944,7 @@ xfs_cowblocks_worker( if (!sb_start_write_trylock(mp->m_super)) return; - xfs_icache_free_cowblocks(mp, NULL); + xfs_icache_free_cowblocks(mp, NULL, SYNC_TRYLOCK); sb_end_write(mp->m_super); xfs_queue_cowblocks(mp); @@ -1557,7 +1557,7 @@ xfs_inode_free_quota_blocks( if (scan) { xfs_icache_free_eofblocks(ip->i_mount, &eofb); - xfs_icache_free_cowblocks(ip->i_mount, &eofb); + xfs_icache_free_cowblocks(ip->i_mount, &eofb, SYNC_WAIT); } return scan; @@ -1767,12 +1767,9 @@ xfs_inode_free_cowblocks( int xfs_icache_free_cowblocks( struct xfs_mount *mp, - struct xfs_eofblocks *eofb) + struct xfs_eofblocks *eofb, + int flags) { - int flags = SYNC_TRYLOCK; - - if (eofb && (eofb->eof_flags & XFS_EOF_FLAGS_SYNC)) - flags = SYNC_WAIT; return xfs_inode_ag_iterator_tag(mp, xfs_inode_free_cowblocks, flags, eofb, XFS_ICI_COWBLOCKS_TAG); } diff --git a/fs/xfs/xfs_icache.h b/fs/xfs/xfs_icache.h index 3e4a8b3913f51..a850142769226 100644 --- a/fs/xfs/xfs_icache.h +++ b/fs/xfs/xfs_icache.h @@ -66,7 +66,8 @@ void xfs_queue_eofblocks(struct xfs_mount *); void xfs_inode_set_cowblocks_tag(struct xfs_inode *ip); void xfs_inode_clear_cowblocks_tag(struct xfs_inode *ip); -int xfs_icache_free_cowblocks(struct xfs_mount *, struct xfs_eofblocks *); +int xfs_icache_free_cowblocks(struct xfs_mount *mp, struct xfs_eofblocks *eofb, + int flags); void xfs_cowblocks_worker(struct work_struct *); void xfs_queue_cowblocks(struct xfs_mount *); diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index aae469f73efeb..67efcc5c87929 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -1670,7 +1670,7 @@ xfs_remount_ro( xfs_stop_block_reaping(mp); /* Get rid of any leftover CoW reservations... */ - error = xfs_icache_free_cowblocks(mp, NULL); + error = xfs_icache_free_cowblocks(mp, NULL, SYNC_TRYLOCK); if (error) { xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); return error; From patchwork Mon May 18 17:04:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11555855 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2085360D for ; Mon, 18 May 2020 17:04:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0924F20758 for ; Mon, 18 May 2020 17:04:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="BaOUJDcY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728156AbgERREz (ORCPT ); Mon, 18 May 2020 13:04:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726958AbgERREz (ORCPT ); Mon, 18 May 2020 13:04:55 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DEA9C061A0C for ; Mon, 18 May 2020 10:04:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:To:From:Sender: Reply-To:Cc:Content-Type:Content-ID:Content-Description; bh=5EMy9+oYbYg12SE1lZRiHId/u/E9CKToIIVzmaovMlc=; b=BaOUJDcYvLMKa/MKeoBM8P2z6v sHKfdDrQD3IggKUdEm1mQAmHmT1ZLikQeN/42SwiRtTmRXOadlzxRTzAD7uO1glCtg4gDuIBu3W6c WNBbR5VpUbQL3Bgd7faVWCO70blcvSz2XpHqG5O5CwCu5Hi0flDdWzBvxeW0UZ23SJeXHaUyBlCE3 jwNWDXiBxVy14emXcN7GXc/iGEznMSfyxofQLJWNZlHDaMJ422LqpFTV4JzuO1dCiGNb8bjJD09UA JgrUVbyQiHNwsyMXOyMobIkqLaqwxws1N8SnKX5jfOoeJziA5kVrKZRjwHfk/yuinmtNHu6rjSbk3 3Q7Bknqw==; Received: from [2001:4bb8:188:1506:c70:4a89:bc61:2] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jajCA-0001xU-Vd for linux-xfs@vger.kernel.org; Mon, 18 May 2020 17:04:55 +0000 From: Christoph Hellwig To: linux-xfs@vger.kernel.org Subject: [PATCH 6/6] xfs: add a flags argument to xfs_icache_free_eofblocks Date: Mon, 18 May 2020 19:04:37 +0200 Message-Id: <20200518170437.1218883-7-hch@lst.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200518170437.1218883-1-hch@lst.de> References: <20200518170437.1218883-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Pass the SYNC_* flags directly instead of hiding the information in the eofblocks structure. Signed-off-by: Christoph Hellwig --- fs/xfs/xfs_file.c | 3 +-- fs/xfs/xfs_icache.c | 11 ++++------- fs/xfs/xfs_icache.h | 3 ++- fs/xfs/xfs_ioctl.c | 4 +++- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 6fc1a4a2f1966..62fbc0105e45d 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -661,8 +661,7 @@ xfs_file_buffered_aio_write( xfs_flush_inodes(ip->i_mount); xfs_iunlock(ip, iolock); - eofb.eof_flags = XFS_EOF_FLAGS_SYNC; - xfs_icache_free_eofblocks(ip->i_mount, &eofb); + xfs_icache_free_eofblocks(ip->i_mount, &eofb, SYNC_WAIT); xfs_icache_free_cowblocks(ip->i_mount, &eofb, SYNC_WAIT); goto write_retry; } diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c index 43273b809fa34..11bef3e349a68 100644 --- a/fs/xfs/xfs_icache.c +++ b/fs/xfs/xfs_icache.c @@ -912,7 +912,7 @@ xfs_eofblocks_worker( if (!sb_start_write_trylock(mp->m_super)) return; - xfs_icache_free_eofblocks(mp, NULL); + xfs_icache_free_eofblocks(mp, NULL, SYNC_TRYLOCK); sb_end_write(mp->m_super); xfs_queue_eofblocks(mp); @@ -1507,12 +1507,9 @@ xfs_inode_free_eofblocks( int xfs_icache_free_eofblocks( struct xfs_mount *mp, - struct xfs_eofblocks *eofb) + struct xfs_eofblocks *eofb, + int flags) { - int flags = SYNC_TRYLOCK; - - if (eofb && (eofb->eof_flags & XFS_EOF_FLAGS_SYNC)) - flags = SYNC_WAIT; return xfs_inode_ag_iterator_tag(mp, xfs_inode_free_eofblocks, flags, eofb, XFS_ICI_EOFBLOCKS_TAG); } @@ -1556,7 +1553,7 @@ xfs_inode_free_quota_blocks( } if (scan) { - xfs_icache_free_eofblocks(ip->i_mount, &eofb); + xfs_icache_free_eofblocks(ip->i_mount, &eofb, SYNC_WAIT); xfs_icache_free_cowblocks(ip->i_mount, &eofb, SYNC_WAIT); } diff --git a/fs/xfs/xfs_icache.h b/fs/xfs/xfs_icache.h index a850142769226..a82ff6457993b 100644 --- a/fs/xfs/xfs_icache.h +++ b/fs/xfs/xfs_icache.h @@ -59,7 +59,8 @@ void xfs_inode_set_reclaim_tag(struct xfs_inode *ip); void xfs_inode_set_eofblocks_tag(struct xfs_inode *ip); void xfs_inode_clear_eofblocks_tag(struct xfs_inode *ip); -int xfs_icache_free_eofblocks(struct xfs_mount *, struct xfs_eofblocks *); +int xfs_icache_free_eofblocks(struct xfs_mount *mp, struct xfs_eofblocks *eofb, + int flags); int xfs_inode_free_quota_blocks(struct xfs_inode *ip); void xfs_eofblocks_worker(struct work_struct *); void xfs_queue_eofblocks(struct xfs_mount *); diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index 4ee0d13232f3f..4aed4df98722f 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c @@ -2330,7 +2330,9 @@ xfs_file_ioctl( return error; sb_start_write(mp->m_super); - error = xfs_icache_free_eofblocks(mp, &keofb); + error = xfs_icache_free_eofblocks(mp, &keofb, + (keofb.eof_flags & XFS_EOF_FLAGS_SYNC) ? + SYNC_WAIT : SYNC_TRYLOCK); sb_end_write(mp->m_super); return error; }