diff mbox series

[4/6] xfs: merge xfs_inode_free_quota_{eof,cow}blocks

Message ID 20200518170437.1218883-5-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [1/6] xfs: remove xfs_inode_ag_iterator | expand

Commit Message

Christoph Hellwig May 18, 2020, 5:04 p.m. UTC
These two are always called together.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 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 mbox series

Patch

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 *);