]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - fs/nfs/write.c
[PATCH] slab: remove kmem_cache_t
[net-next-2.6.git] / fs / nfs / write.c
index 8ab3cf10d792b144008815d22b6da8dba066cfed..41b07288f99e89f4d6e189dc010538ba2e5dd1a5 100644 (file)
 #include <linux/mm.h>
 #include <linux/pagemap.h>
 #include <linux/file.h>
-#include <linux/mpage.h>
 #include <linux/writeback.h>
 
 #include <linux/sunrpc/clnt.h>
 #include <linux/nfs_fs.h>
 #include <linux/nfs_mount.h>
 #include <linux/nfs_page.h>
+#include <linux/backing-dev.h>
+
 #include <asm/uaccess.h>
 #include <linux/smp_lock.h>
 
@@ -84,7 +85,7 @@ static const struct rpc_call_ops nfs_write_partial_ops;
 static const struct rpc_call_ops nfs_write_full_ops;
 static const struct rpc_call_ops nfs_commit_ops;
 
-static kmem_cache_t *nfs_wdata_cachep;
+static struct kmem_cache *nfs_wdata_cachep;
 static mempool_t *nfs_wdata_mempool;
 static mempool_t *nfs_commit_mempool;
 
@@ -92,7 +93,7 @@ static DECLARE_WAIT_QUEUE_HEAD(nfs_write_congestion);
 
 struct nfs_write_data *nfs_commit_alloc(void)
 {
-       struct nfs_write_data *p = mempool_alloc(nfs_commit_mempool, SLAB_NOFS);
+       struct nfs_write_data *p = mempool_alloc(nfs_commit_mempool, GFP_NOFS);
 
        if (p) {
                memset(p, 0, sizeof(*p));
@@ -111,7 +112,7 @@ void nfs_commit_free(struct nfs_write_data *p)
 struct nfs_write_data *nfs_writedata_alloc(size_t len)
 {
        unsigned int pagecount = (len + PAGE_SIZE - 1) >> PAGE_SHIFT;
-       struct nfs_write_data *p = mempool_alloc(nfs_wdata_mempool, SLAB_NOFS);
+       struct nfs_write_data *p = mempool_alloc(nfs_wdata_mempool, GFP_NOFS);
 
        if (p) {
                memset(p, 0, sizeof(*p));
@@ -396,6 +397,7 @@ int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc)
 out:
        clear_bit(BDI_write_congested, &bdi->state);
        wake_up_all(&nfs_write_congestion);
+       congestion_end(WRITE);
        return err;
 }
 
@@ -588,10 +590,10 @@ static void nfs_cancel_commit_list(struct list_head *head)
 
        while(!list_empty(head)) {
                req = nfs_list_entry(head->next);
+               dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
                nfs_list_remove_request(req);
                nfs_inode_remove_request(req);
-               nfs_clear_page_writeback(req);
-               dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
+               nfs_unlock_request(req);
        }
 }
 
@@ -1252,7 +1254,13 @@ int nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data)
        dprintk("NFS: %4d nfs_writeback_done (status %d)\n",
                task->tk_pid, task->tk_status);
 
-       /* Call the NFS version-specific code */
+       /*
+        * ->write_done will attempt to use post-op attributes to detect
+        * conflicting writes by other clients.  A strict interpretation
+        * of close-to-open would allow us to continue caching even if
+        * another writer had changed the file, but some applications
+        * depend on tighter cache coherency when writing.
+        */
        status = NFS_PROTO(data->inode)->write_done(task, data);
        if (status != 0)
                return status;
@@ -1273,7 +1281,7 @@ int nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data)
                if (time_before(complain, jiffies)) {
                        dprintk("NFS: faulty NFS server %s:"
                                " (committed = %d) != (stable = %d)\n",
-                               NFS_SERVER(data->inode)->hostname,
+                               NFS_SERVER(data->inode)->nfs_client->cl_hostname,
                                resp->verf->committed, argp->stable);
                        complain = jiffies + 300 * HZ;
                }
@@ -1386,8 +1394,8 @@ nfs_commit_list(struct inode *inode, struct list_head *head, int how)
                req = nfs_list_entry(head->next);
                nfs_list_remove_request(req);
                nfs_mark_request_commit(req);
-               nfs_clear_page_writeback(req);
                dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
+               nfs_clear_page_writeback(req);
        }
        return -ENOMEM;
 }
@@ -1558,7 +1566,6 @@ void nfs_destroy_writepagecache(void)
 {
        mempool_destroy(nfs_commit_mempool);
        mempool_destroy(nfs_wdata_mempool);
-       if (kmem_cache_destroy(nfs_wdata_cachep))
-               printk(KERN_INFO "nfs_write_data: not all structures were freed\n");
+       kmem_cache_destroy(nfs_wdata_cachep);
 }