[5/6] xfs: add a flags argument to xfs_icache_free_cowblocks
diff mbox series

Message ID 20200518170437.1218883-6-hch@lst.de
State New
Headers show
Series
  • [1/6] xfs: remove xfs_inode_ag_iterator
Related show

Commit Message

Christoph Hellwig May 18, 2020, 5:04 p.m. UTC
Pass the SYNC_* flags directly instead of hiding the information in the
eofblocks structure.

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

Patch
diff mbox series

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;