public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@sgi.com>
To: Neil Brown <neilb@cse.unsw.edu.au>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] switch knfsd to vfs_read/vfs_write
Date: Tue, 15 Oct 2002 00:21:10 -0400	[thread overview]
Message-ID: <20021015002110.A18265@sgi.com> (raw)

Switch knfsd to vfs_read/vfs_write to work on aio-only filesystems.
This also gets stuff like the LSM checks and mandatory lock checking
for free.


diff -uNr -p linux-2.5.40-mm1/fs/nfsd/vfs.c linux/fs/nfsd/vfs.c
--- linux-2.5.40-mm1/fs/nfsd/vfs.c	Tue Oct  1 14:23:50 2002
+++ linux/fs/nfsd/vfs.c	Tue Oct  1 14:53:37 2002
@@ -585,8 +585,6 @@ nfsd_read(struct svc_rqst *rqstp, struct
 	if (err)
 		goto out;
 	err = nfserr_perm;
-	if (!file.f_op->read)
-		goto out_close;
 	inode = file.f_dentry->d_inode;
 #ifdef MSNFS
 	if ((fhp->fh_export->ex_flags & NFSEXP_MSNFS) &&
@@ -598,11 +596,10 @@ nfsd_read(struct svc_rqst *rqstp, struct
 	ra = nfsd_get_raparms(inode->i_dev, inode->i_ino);
 	if (ra)
 		file.f_ra = ra->p_ra;
-	file.f_pos = offset;
 
 	oldfs = get_fs();
 	set_fs(KERNEL_DS);
-	err = file.f_op->read(&file, buf, *count, &file.f_pos);
+	err = vfs_read(&file, buf, *count, &offset);
 	set_fs(oldfs);
 
 	/* Write back readahead params */
@@ -644,8 +641,7 @@ nfsd_write(struct svc_rqst *rqstp, struc
 	if (!cnt)
 		goto out_close;
 	err = nfserr_perm;
-	if (!file.f_op->write)
-		goto out_close;
+
 #ifdef MSNFS
 	if ((fhp->fh_export->ex_flags & NFSEXP_MSNFS) &&
 		(!lock_may_write(file.f_dentry->d_inode, offset, cnt)))
@@ -675,11 +671,9 @@ nfsd_write(struct svc_rqst *rqstp, struc
 	if (stable && !EX_WGATHER(exp))
 		file.f_flags |= O_SYNC;
 
-	file.f_pos = offset;		/* set write offset */
-
 	/* Write the data. */
 	oldfs = get_fs(); set_fs(KERNEL_DS);
-	err = file.f_op->write(&file, buf, cnt, &file.f_pos);
+	err = vfs_write(&file, buf, cnt, &offset);
 	if (err >= 0)
 		nfsdstats.io_write += cnt;
 	set_fs(oldfs);

             reply	other threads:[~2002-10-14 21:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-15  4:21 Christoph Hellwig [this message]
2002-10-15  3:14 ` [PATCH] switch knfsd to vfs_read/vfs_write Neil Brown

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=20021015002110.A18265@sgi.com \
    --to=hch@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neilb@cse.unsw.edu.au \
    /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