linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: viro@ZenIV.linux.org.uk
Cc: linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org
Subject: [PATCH 03/10] xfs: eliminate the pos variable in xfs_file_dio_aio_write
Date: Thu,  7 Apr 2016 08:51:57 -0700	[thread overview]
Message-ID: <1460044324-5298-4-git-send-email-hch@lst.de> (raw)
In-Reply-To: <1460044324-5298-1-git-send-email-hch@lst.de>

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_file.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index 569938a..92f72fb 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -718,18 +718,19 @@ xfs_file_dio_aio_write(
 	int			unaligned_io = 0;
 	int			iolock;
 	size_t			count = iov_iter_count(from);
-	loff_t			pos = iocb->ki_pos;
 	loff_t			end;
 	struct iov_iter		data;
 	struct xfs_buftarg	*target = XFS_IS_REALTIME_INODE(ip) ?
 					mp->m_rtdev_targp : mp->m_ddev_targp;
 
 	/* DIO must be aligned to device logical sector size */
-	if (!IS_DAX(inode) && ((pos | count) & target->bt_logical_sectormask))
+	if (!IS_DAX(inode) &&
+	    ((iocb->ki_pos | count) & target->bt_logical_sectormask))
 		return -EINVAL;
 
 	/* "unaligned" here means not aligned to a filesystem block */
-	if ((pos & mp->m_blockmask) || ((pos + count) & mp->m_blockmask))
+	if ((iocb->ki_pos & mp->m_blockmask) ||
+	    ((iocb->ki_pos + count) & mp->m_blockmask))
 		unaligned_io = 1;
 
 	/*
@@ -760,8 +761,7 @@ xfs_file_dio_aio_write(
 	if (ret)
 		goto out;
 	count = iov_iter_count(from);
-	pos = iocb->ki_pos;
-	end = pos + count - 1;
+	end = iocb->ki_pos + count - 1;
 
 	/*
 	 * See xfs_file_read_iter() for why we do a full-file flush here.
@@ -794,19 +794,18 @@ xfs_file_dio_aio_write(
 	trace_xfs_file_direct_write(ip, count, iocb->ki_pos, 0);
 
 	data = *from;
-	ret = mapping->a_ops->direct_IO(iocb, &data, pos);
+	ret = mapping->a_ops->direct_IO(iocb, &data, iocb->ki_pos);
 
 	/* see generic_file_direct_write() for why this is necessary */
 	if (mapping->nrpages) {
 		invalidate_inode_pages2_range(mapping,
-					      pos >> PAGE_SHIFT,
+					      iocb->ki_pos >> PAGE_SHIFT,
 					      end >> PAGE_SHIFT);
 	}
 
 	if (ret > 0) {
-		pos += ret;
+		iocb->ki_pos += ret;
 		iov_iter_advance(from, ret);
-		iocb->ki_pos = pos;
 	}
 out:
 	xfs_rw_iunlock(ip, iolock);
-- 
2.1.4


  parent reply	other threads:[~2016-04-07 15:52 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-07 15:51 add RWF_(D)SYNC flag to preadv2/pwritev2 V2 Christoph Hellwig
2016-04-07 15:51 ` [PATCH 01/10] filemap: remove pos variables in generic_file_read_iter Christoph Hellwig
2016-04-07 15:51 ` [PATCH 02/10] filemap: remove the pos argument to generic_file_direct_write Christoph Hellwig
2016-04-07 15:51 ` Christoph Hellwig [this message]
2016-04-07 22:31   ` [PATCH 03/10] xfs: eliminate the pos variable in xfs_file_dio_aio_write Dave Chinner
2016-04-07 22:43     ` Christoph Hellwig
2016-04-07 22:50       ` Dave Chinner
2016-04-07 15:51 ` [PATCH 04/10] direct-io: eliminate the offset argument to ->direct_IO Christoph Hellwig
2016-04-07 15:51 ` [PATCH 05/10] direct-io: remove the offset argument to dio_complete Christoph Hellwig
2016-04-07 15:52 ` [PATCH 06/10] fs: add IOCB_SYNC and IOCB_DSYNC Christoph Hellwig
2016-04-07 15:52 ` [PATCH 07/10] fs: simplify the generic_write_sync prototype Christoph Hellwig
2016-04-07 15:52 ` [PATCH 08/10] ceph: use generic_write_sync Christoph Hellwig
2016-04-07 15:52 ` [PATCH 09/10] fs: add RWF_DSYNC aand RWF_SYNC Christoph Hellwig
2016-08-06 21:45   ` Michael Kerrisk (man-pages)
2016-08-09  8:15     ` Christoph Hellwig
2016-09-04  4:56       ` Michael Kerrisk (man-pages)
2016-04-07 15:52 ` [PATCH 10/10] nfsd: use RWF_SYNC Christoph Hellwig
2016-04-25 11:48 ` add RWF_(D)SYNC flag to preadv2/pwritev2 V2 Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2016-03-29 17:37 add RWF_(D)SYNC flag to preadv2/pwritev2 Christoph Hellwig
2016-03-29 17:37 ` [PATCH 03/10] xfs: eliminate the pos variable in xfs_file_dio_aio_write Christoph Hellwig

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=1460044324-5298-4-git-send-email-hch@lst.de \
    --to=hch@lst.de \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).