aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/direct.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2008-01-15 14:17:12 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-01-30 02:06:10 -0500
commitf3c391e89c92651105364c6645244118ec9b3952 (patch)
tree248ea7f3f5244b4f00acc8b1f36c57324b61ff31 /fs/nfs/direct.c
parent34f5b4662bf4b54f22b32ce76ce70eccd7ebc68a (diff)
NFS: Optimise away the sigmask code in aio/dio reads and writes
There are no interruptible waits for asynchronous RPC tasks, so we don't need to wrap calls to rpc_run_task() with an rpc_clnt_sigmask/rpc_clnt_unsigmask pair. Instead we can wrap the wait_for_completion_interruptible() in nfs_direct_wait(). This means that we completely optimise away sigmask setting for the case of non-blocking aio/dio. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/direct.c')
-rw-r--r--fs/nfs/direct.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index eadd87f7159f..f8e165c7d5a6 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -188,12 +188,17 @@ static void nfs_direct_req_release(struct nfs_direct_req *dreq)
188static ssize_t nfs_direct_wait(struct nfs_direct_req *dreq) 188static ssize_t nfs_direct_wait(struct nfs_direct_req *dreq)
189{ 189{
190 ssize_t result = -EIOCBQUEUED; 190 ssize_t result = -EIOCBQUEUED;
191 struct rpc_clnt *clnt;
192 sigset_t oldset;
191 193
192 /* Async requests don't wait here */ 194 /* Async requests don't wait here */
193 if (dreq->iocb) 195 if (dreq->iocb)
194 goto out; 196 goto out;
195 197
198 clnt = NFS_CLIENT(dreq->inode);
199 rpc_clnt_sigmask(clnt, &oldset);
196 result = wait_for_completion_interruptible(&dreq->completion); 200 result = wait_for_completion_interruptible(&dreq->completion);
201 rpc_clnt_sigunmask(clnt, &oldset);
197 202
198 if (!result) 203 if (!result)
199 result = dreq->error; 204 result = dreq->error;
@@ -403,9 +408,7 @@ static ssize_t nfs_direct_read(struct kiocb *iocb, const struct iovec *iov,
403 unsigned long nr_segs, loff_t pos) 408 unsigned long nr_segs, loff_t pos)
404{ 409{
405 ssize_t result = 0; 410 ssize_t result = 0;
406 sigset_t oldset;
407 struct inode *inode = iocb->ki_filp->f_mapping->host; 411 struct inode *inode = iocb->ki_filp->f_mapping->host;
408 struct rpc_clnt *clnt = NFS_CLIENT(inode);
409 struct nfs_direct_req *dreq; 412 struct nfs_direct_req *dreq;
410 413
411 dreq = nfs_direct_req_alloc(); 414 dreq = nfs_direct_req_alloc();
@@ -417,11 +420,9 @@ static ssize_t nfs_direct_read(struct kiocb *iocb, const struct iovec *iov,
417 if (!is_sync_kiocb(iocb)) 420 if (!is_sync_kiocb(iocb))
418 dreq->iocb = iocb; 421 dreq->iocb = iocb;
419 422
420 rpc_clnt_sigmask(clnt, &oldset);
421 result = nfs_direct_read_schedule_iovec(dreq, iov, nr_segs, pos); 423 result = nfs_direct_read_schedule_iovec(dreq, iov, nr_segs, pos);
422 if (!result) 424 if (!result)
423 result = nfs_direct_wait(dreq); 425 result = nfs_direct_wait(dreq);
424 rpc_clnt_sigunmask(clnt, &oldset);
425 nfs_direct_req_release(dreq); 426 nfs_direct_req_release(dreq);
426 427
427 return result; 428 return result;
@@ -816,9 +817,7 @@ static ssize_t nfs_direct_write(struct kiocb *iocb, const struct iovec *iov,
816 size_t count) 817 size_t count)
817{ 818{
818 ssize_t result = 0; 819 ssize_t result = 0;
819 sigset_t oldset;
820 struct inode *inode = iocb->ki_filp->f_mapping->host; 820 struct inode *inode = iocb->ki_filp->f_mapping->host;
821 struct rpc_clnt *clnt = NFS_CLIENT(inode);
822 struct nfs_direct_req *dreq; 821 struct nfs_direct_req *dreq;
823 size_t wsize = NFS_SERVER(inode)->wsize; 822 size_t wsize = NFS_SERVER(inode)->wsize;
824 int sync = NFS_UNSTABLE; 823 int sync = NFS_UNSTABLE;
@@ -836,11 +835,9 @@ static ssize_t nfs_direct_write(struct kiocb *iocb, const struct iovec *iov,
836 if (!is_sync_kiocb(iocb)) 835 if (!is_sync_kiocb(iocb))
837 dreq->iocb = iocb; 836 dreq->iocb = iocb;
838 837
839 rpc_clnt_sigmask(clnt, &oldset);
840 result = nfs_direct_write_schedule_iovec(dreq, iov, nr_segs, pos, sync); 838 result = nfs_direct_write_schedule_iovec(dreq, iov, nr_segs, pos, sync);
841 if (!result) 839 if (!result)
842 result = nfs_direct_wait(dreq); 840 result = nfs_direct_wait(dreq);
843 rpc_clnt_sigunmask(clnt, &oldset);
844 nfs_direct_req_release(dreq); 841 nfs_direct_req_release(dreq);
845 842
846 return result; 843 return result;