public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
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	[thread overview]
Message-ID: <20200518170437.1218883-7-hch@lst.de> (raw)
In-Reply-To: <20200518170437.1218883-1-hch@lst.de>

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   |  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;
 	}
-- 
2.26.2


  parent reply	other threads:[~2020-05-18 17:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-18 17:04 inode iterator cleanups Christoph Hellwig
2020-05-18 17:04 ` [PATCH 1/6] xfs: remove xfs_inode_ag_iterator Christoph Hellwig
2020-05-18 17:04 ` [PATCH 2/6] xfs: mark xfs_inode_ag_iterator_tag static Christoph Hellwig
2020-05-18 17:04 ` [PATCH 3/6] xfs: remove __xfs_icache_free_eofblocks Christoph Hellwig
2020-05-18 17:04 ` [PATCH 4/6] xfs: merge xfs_inode_free_quota_{eof,cow}blocks Christoph Hellwig
2020-05-18 17:04 ` [PATCH 5/6] xfs: add a flags argument to xfs_icache_free_cowblocks Christoph Hellwig
2020-05-18 17:04 ` Christoph Hellwig [this message]
2020-05-19  1:23 ` inode iterator cleanups Darrick J. Wong
2020-05-19  6:40   ` Christoph Hellwig
2020-05-20  1:45     ` Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200518170437.1218883-7-hch@lst.de \
    --to=hch@lst.de \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox