Commit f7b5c340 authored by Trond Myklebust's avatar Trond Myklebust

NFS: Cleanup nfs_direct_complete()

There is only one caller that sets the "write" argument to true,
so just move the call to nfs_zap_mapping() and get rid of the
now redundant argument.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent a5864c99
...@@ -372,13 +372,10 @@ static ssize_t nfs_direct_wait(struct nfs_direct_req *dreq) ...@@ -372,13 +372,10 @@ static ssize_t nfs_direct_wait(struct nfs_direct_req *dreq)
* Synchronous I/O uses a stack-allocated iocb. Thus we can't trust * Synchronous I/O uses a stack-allocated iocb. Thus we can't trust
* the iocb is still valid here if this is a synchronous request. * the iocb is still valid here if this is a synchronous request.
*/ */
static void nfs_direct_complete(struct nfs_direct_req *dreq, bool write) static void nfs_direct_complete(struct nfs_direct_req *dreq)
{ {
struct inode *inode = dreq->inode; struct inode *inode = dreq->inode;
if (write)
nfs_zap_mapping(inode, inode->i_mapping);
inode_dio_end(inode); inode_dio_end(inode);
if (dreq->iocb) { if (dreq->iocb) {
...@@ -431,7 +428,7 @@ static void nfs_direct_read_completion(struct nfs_pgio_header *hdr) ...@@ -431,7 +428,7 @@ static void nfs_direct_read_completion(struct nfs_pgio_header *hdr)
} }
out_put: out_put:
if (put_dreq(dreq)) if (put_dreq(dreq))
nfs_direct_complete(dreq, false); nfs_direct_complete(dreq);
hdr->release(hdr); hdr->release(hdr);
} }
...@@ -537,7 +534,7 @@ static ssize_t nfs_direct_read_schedule_iovec(struct nfs_direct_req *dreq, ...@@ -537,7 +534,7 @@ static ssize_t nfs_direct_read_schedule_iovec(struct nfs_direct_req *dreq,
} }
if (put_dreq(dreq)) if (put_dreq(dreq))
nfs_direct_complete(dreq, false); nfs_direct_complete(dreq);
return 0; return 0;
} }
...@@ -764,7 +761,8 @@ static void nfs_direct_write_schedule_work(struct work_struct *work) ...@@ -764,7 +761,8 @@ static void nfs_direct_write_schedule_work(struct work_struct *work)
nfs_direct_write_reschedule(dreq); nfs_direct_write_reschedule(dreq);
break; break;
default: default:
nfs_direct_complete(dreq, true); nfs_zap_mapping(dreq->inode, dreq->inode->i_mapping);
nfs_direct_complete(dreq);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment