linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
To: viro-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org
Cc: linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 10/10] nfsd: use RWF_SYNC
Date: Tue, 29 Mar 2016 19:37:34 +0200	[thread overview]
Message-ID: <1459273054-13478-11-git-send-email-hch@lst.de> (raw)
In-Reply-To: <1459273054-13478-1-git-send-email-hch-jcswGhMUV9g@public.gmane.org>

Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
---
 fs/nfsd/vfs.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index d40010e..6fbd81e 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -935,8 +935,8 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
 	int			stable = *stablep;
 	int			use_wgather;
 	loff_t			pos = offset;
-	loff_t			end = LLONG_MAX;
 	unsigned int		pflags = current->flags;
+	int			flags = 0;
 
 	if (test_bit(RQ_LOCAL, &rqstp->rq_flags))
 		/*
@@ -955,9 +955,12 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
 	if (!EX_ISSYNC(exp))
 		stable = 0;
 
+	if (stable && !use_wgather)
+		flags |= RWF_SYNC;
+
 	/* Write the data. */
 	oldfs = get_fs(); set_fs(KERNEL_DS);
-	host_err = vfs_writev(file, (struct iovec __user *)vec, vlen, &pos, 0);
+	host_err = vfs_writev(file, (struct iovec __user *)vec, vlen, &pos, flags);
 	set_fs(oldfs);
 	if (host_err < 0)
 		goto out_nfserr;
@@ -965,15 +968,8 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
 	nfsdstats.io_write += host_err;
 	fsnotify_modify(file);
 
-	if (stable) {
-		if (use_wgather) {
-			host_err = wait_for_concurrent_writes(file);
-		} else {
-			if (*cnt)
-				end = offset + *cnt - 1;
-			host_err = vfs_fsync_range(file, offset, end, 0);
-		}
-	}
+	if (stable && use_wgather)
+		host_err = wait_for_concurrent_writes(file);
 
 out_nfserr:
 	dprintk("nfsd: write complete host_err=%d\n", host_err);
-- 
2.1.4

  parent reply	other threads:[~2016-03-29 17:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-29 17:37 add RWF_(D)SYNC flag to preadv2/pwritev2 Christoph Hellwig
2016-03-29 17:37 ` [PATCH 04/10] direct-io: eliminate the offset argument to ->direct_IO Christoph Hellwig
2016-03-29 17:37 ` [PATCH 05/10] direct-io: remove the offset argument to dio_complete Christoph Hellwig
2016-03-29 17:37 ` [PATCH 06/10] fs: add IOCB_SYNC and IOCB_DSYNC Christoph Hellwig
2016-03-29 17:37 ` [PATCH 07/10] fs: simplify the generic_write_sync prototype Christoph Hellwig
2016-03-29 19:33   ` [PATCH 07/10] " Andreas Dilger
     [not found] ` <1459273054-13478-1-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2016-03-29 17:37   ` [PATCH 01/10] filemap: remove pos variables in generic_file_read_iter Christoph Hellwig
2016-03-29 17:37   ` [PATCH 02/10] filemap: remove the pos argument to generic_file_direct_write Christoph Hellwig
2016-03-29 17:37   ` [PATCH 03/10] xfs: eliminate the pos variable in xfs_file_dio_aio_write Christoph Hellwig
2016-03-29 17:37   ` [PATCH 08/10] ceph: use generic_write_sync Christoph Hellwig
2016-03-29 17:37   ` Christoph Hellwig [this message]
2016-03-29 17:37 ` [PATCH 09/10] fs: add RWF_DSYNC aand RWF_SYNC Christoph Hellwig
     [not found]   ` <1459273054-13478-10-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2016-03-29 19:34     ` [PATCH 09/10] " Andreas Dilger
     [not found]       ` <53D41BC3-65A3-48BB-B2CC-540EBF86A2EC-m1MBpc4rdrD3fQ9qLvQP4Q@public.gmane.org>
2016-03-30  6:54         ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2016-04-07 15:51 add RWF_(D)SYNC flag to preadv2/pwritev2 V2 Christoph Hellwig
2016-04-07 15:52 ` [PATCH 10/10] nfsd: use RWF_SYNC 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=1459273054-13478-11-git-send-email-hch@lst.de \
    --to=hch-jcswghmuv9g@public.gmane.org \
    --cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=viro-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.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;
as well as URLs for NNTP newsgroup(s).