Pull asus into release branch
[pandora-kernel.git] / fs / nfs / direct.c
index bdfabf8..2877744 100644 (file)
@@ -58,7 +58,7 @@
 
 #define NFSDBG_FACILITY                NFSDBG_VFS
 
-static kmem_cache_t *nfs_direct_cachep;
+static struct kmem_cache *nfs_direct_cachep;
 
 /*
  * This represents a set of asynchronous requests that we're waiting on
@@ -116,7 +116,7 @@ static inline int put_dreq(struct nfs_direct_req *dreq)
 ssize_t nfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_t pos, unsigned long nr_segs)
 {
        dprintk("NFS: nfs_direct_IO (%s) off/no(%Ld/%lu) EINVAL\n",
-                       iocb->ki_filp->f_dentry->d_name.name,
+                       iocb->ki_filp->f_path.dentry->d_name.name,
                        (long long) pos, nr_segs);
 
        return -EINVAL;
@@ -143,7 +143,7 @@ static inline struct nfs_direct_req *nfs_direct_req_alloc(void)
 {
        struct nfs_direct_req *dreq;
 
-       dreq = kmem_cache_alloc(nfs_direct_cachep, SLAB_KERNEL);
+       dreq = kmem_cache_alloc(nfs_direct_cachep, GFP_KERNEL);
        if (!dreq)
                return NULL;
 
@@ -307,11 +307,10 @@ static ssize_t nfs_direct_read_schedule(struct nfs_direct_req *dreq, unsigned lo
 
                data->task.tk_cookie = (unsigned long) inode;
 
-               lock_kernel();
                rpc_execute(&data->task);
-               unlock_kernel();
 
-               dfprintk(VFS, "NFS: %5u initiated direct read call (req %s/%Ld, %zu bytes @ offset %Lu)\n",
+               dprintk("NFS: %5u initiated direct read call "
+                       "(req %s/%Ld, %zu bytes @ offset %Lu)\n",
                                data->task.tk_pid,
                                inode->i_sb->s_id,
                                (long long)NFS_FILEID(inode),
@@ -433,10 +432,10 @@ static void nfs_direct_commit_result(struct rpc_task *task, void *calldata)
        if (NFS_PROTO(data->inode)->commit_done(task, data) != 0)
                return;
        if (unlikely(task->tk_status < 0)) {
-               dreq->error = task->tk_status;
+               dprintk("NFS: %5u commit failed with error %d.\n",
+                               task->tk_pid, task->tk_status);
                dreq->flags = NFS_ODIRECT_RESCHED_WRITES;
-       }
-       if (memcmp(&dreq->verf, &data->verf, sizeof(data->verf))) {
+       } else if (memcmp(&dreq->verf, &data->verf, sizeof(data->verf))) {
                dprintk("NFS: %5u commit verify failed\n", task->tk_pid);
                dreq->flags = NFS_ODIRECT_RESCHED_WRITES;
        }
@@ -475,9 +474,7 @@ static void nfs_direct_commit_schedule(struct nfs_direct_req *dreq)
 
        dprintk("NFS: %5u initiated commit call\n", data->task.tk_pid);
 
-       lock_kernel();
        rpc_execute(&data->task);
-       unlock_kernel();
 }
 
 static void nfs_direct_write_complete(struct nfs_direct_req *dreq, struct inode *inode)
@@ -534,9 +531,12 @@ static void nfs_direct_write_result(struct rpc_task *task, void *calldata)
 
        spin_lock(&dreq->lock);
 
+       if (unlikely(dreq->error != 0))
+               goto out_unlock;
        if (unlikely(status < 0)) {
+               /* An error has occured, so we should not commit */
+               dreq->flags = 0;
                dreq->error = status;
-               goto out_unlock;
        }
 
        dreq->count += data->res.count;
@@ -641,11 +641,10 @@ static ssize_t nfs_direct_write_schedule(struct nfs_direct_req *dreq, unsigned l
                data->task.tk_priority = RPC_PRIORITY_NORMAL;
                data->task.tk_cookie = (unsigned long) inode;
 
-               lock_kernel();
                rpc_execute(&data->task);
-               unlock_kernel();
 
-               dfprintk(VFS, "NFS: %5u initiated direct write call (req %s/%Ld, %zu bytes @ offset %Lu)\n",
+               dprintk("NFS: %5u initiated direct write call "
+                       "(req %s/%Ld, %zu bytes @ offset %Lu)\n",
                                data->task.tk_pid,
                                inode->i_sb->s_id,
                                (long long)NFS_FILEID(inode),
@@ -740,8 +739,8 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, const struct iovec *iov,
        size_t count = iov[0].iov_len;
 
        dprintk("nfs: direct read(%s/%s, %lu@%Ld)\n",
-               file->f_dentry->d_parent->d_name.name,
-               file->f_dentry->d_name.name,
+               file->f_path.dentry->d_parent->d_name.name,
+               file->f_path.dentry->d_name.name,
                (unsigned long) count, (long long) pos);
 
        if (nr_segs != 1)
@@ -803,9 +802,9 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
        const char __user *buf = iov[0].iov_base;
        size_t count = iov[0].iov_len;
 
-       dfprintk(VFS, "nfs: direct write(%s/%s, %lu@%Ld)\n",
-               file->f_dentry->d_parent->d_name.name,
-               file->f_dentry->d_name.name,
+       dprintk("nfs: direct write(%s/%s, %lu@%Ld)\n",
+               file->f_path.dentry->d_parent->d_name.name,
+               file->f_path.dentry->d_name.name,
                (unsigned long) count, (long long) pos);
 
        if (nr_segs != 1)