All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org, bfoster@redhat.com
Subject: [PATCH 1/2] xfs: don't pass iomap flags to xfs_reflink_allocate_cow
Date: Sun, 24 Feb 2019 12:30:58 -0800	[thread overview]
Message-ID: <155104025871.24373.7462613353398620970.stgit@magnolia> (raw)

From: Darrick J. Wong <darrick.wong@oracle.com>

Don't pass raw iomap flags to xfs_reflink_allocate_cow; signal our
intention with a boolean argument.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/xfs/xfs_iomap.c   |    6 +++---
 fs/xfs/xfs_reflink.c |    4 ++--
 fs/xfs/xfs_reflink.h |    2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)


diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index 01210eae8bf3..a376fb2d4b94 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -983,6 +983,7 @@ xfs_file_iomap_begin(
 	 */
 	if (xfs_is_cow_inode(ip)) {
 		struct xfs_bmbt_irec	orig = imap;
+		bool			convert_now = (flags & IOMAP_DIRECT);
 
 		/* if zeroing doesn't need COW allocation, then we are done. */
 		if ((flags & IOMAP_ZERO) &&
@@ -991,7 +992,7 @@ xfs_file_iomap_begin(
 
 		/* may drop and re-acquire the ilock */
 		error = xfs_reflink_allocate_cow(ip, &imap, &shared, &lockmode,
-						 flags);
+				convert_now);
 		if (error)
 			goto out_unlock;
 
@@ -1002,8 +1003,7 @@ xfs_file_iomap_begin(
 		 * direct I/O code, which must be block aligned we need to
 		 * report the newly allocated address.
 		 */
-		if (!(flags & IOMAP_DIRECT) &&
-		    orig.br_startblock != HOLESTARTBLOCK)
+		if (!convert_now && orig.br_startblock != HOLESTARTBLOCK)
 			imap = orig;
 
 		end_fsb = imap.br_startoff + imap.br_blockcount;
diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index e2d9179bd50d..d42e3ef9050e 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -361,7 +361,7 @@ xfs_reflink_allocate_cow(
 	struct xfs_bmbt_irec	*imap,
 	bool			*shared,
 	uint			*lockmode,
-	unsigned		iomap_flags)
+	bool			convert_now)
 {
 	struct xfs_mount	*mp = ip->i_mount;
 	xfs_fileoff_t		offset_fsb = imap->br_startoff;
@@ -444,7 +444,7 @@ xfs_reflink_allocate_cow(
 	 * to initiate a disk write.  For direct I/O we are going to write the
 	 * data and need the conversion, but for buffered writes we're done.
 	 */
-	if (!(iomap_flags & IOMAP_DIRECT) || imap->br_state == XFS_EXT_NORM)
+	if (!convert_now || imap->br_state == XFS_EXT_NORM)
 		return 0;
 	trace_xfs_reflink_convert_cow(ip, imap);
 	return xfs_reflink_convert_cow_locked(ip, offset_fsb, count_fsb);
diff --git a/fs/xfs/xfs_reflink.h b/fs/xfs/xfs_reflink.h
index 2a3052fbe23e..28a43b7f581d 100644
--- a/fs/xfs/xfs_reflink.h
+++ b/fs/xfs/xfs_reflink.h
@@ -27,7 +27,7 @@ bool xfs_inode_need_cow(struct xfs_inode *ip, struct xfs_bmbt_irec *imap,
 
 extern int xfs_reflink_allocate_cow(struct xfs_inode *ip,
 		struct xfs_bmbt_irec *imap, bool *shared, uint *lockmode,
-		unsigned iomap_flags);
+		bool convert_now);
 extern int xfs_reflink_convert_cow(struct xfs_inode *ip, xfs_off_t offset,
 		xfs_off_t count);
 

             reply	other threads:[~2019-02-24 20:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-24 20:30 Darrick J. Wong [this message]
2019-02-24 20:31 ` [PATCH 2/2] xfs: rework breaking of shared extents in xfs_file_iomap_begin Darrick J. Wong
2019-02-25 12:55   ` Brian Foster
2019-02-25 12:55 ` [PATCH 1/2] xfs: don't pass iomap flags to xfs_reflink_allocate_cow Brian Foster
2019-02-25 16:59   ` Darrick J. Wong
2019-02-25 17:18     ` Brian Foster
2019-02-25 17:43       ` 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=155104025871.24373.7462613353398620970.stgit@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=bfoster@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.