upgrade to fedora-2.6.12-1.1398.FC4 + vserver 2.0.rc7
[linux-2.6.git] / fs / nfs / write.c
index 847b77d..6f7a4af 100644 (file)
@@ -61,7 +61,6 @@
 #include <linux/nfs_page.h>
 #include <asm/uaccess.h>
 #include <linux/smp_lock.h>
-#include <linux/mempool.h>
 
 #include "delegation.h"
 
@@ -81,17 +80,18 @@ static void nfs_writeback_done_partial(struct nfs_write_data *, int);
 static void nfs_writeback_done_full(struct nfs_write_data *, int);
 static int nfs_wait_on_write_congestion(struct address_space *, int);
 static int nfs_wait_on_requests(struct inode *, unsigned long, unsigned int);
+static int nfs_flush_inode(struct inode *inode, unsigned long idx_start,
+                          unsigned int npages, int how);
 
 static kmem_cache_t *nfs_wdata_cachep;
-static mempool_t *nfs_wdata_mempool;
+mempool_t *nfs_wdata_mempool;
 static mempool_t *nfs_commit_mempool;
 
 static DECLARE_WAIT_QUEUE_HEAD(nfs_write_congestion);
 
-static __inline__ struct nfs_write_data *nfs_writedata_alloc(void)
+static inline struct nfs_write_data *nfs_commit_alloc(void)
 {
-       struct nfs_write_data   *p;
-       p = (struct nfs_write_data *)mempool_alloc(nfs_wdata_mempool, SLAB_NOFS);
+       struct nfs_write_data *p = mempool_alloc(nfs_commit_mempool, SLAB_NOFS);
        if (p) {
                memset(p, 0, sizeof(*p));
                INIT_LIST_HEAD(&p->pages);
@@ -99,9 +99,9 @@ static __inline__ struct nfs_write_data *nfs_writedata_alloc(void)
        return p;
 }
 
-static __inline__ void nfs_writedata_free(struct nfs_write_data *p)
+static inline void nfs_commit_free(struct nfs_write_data *p)
 {
-       mempool_free(p, nfs_wdata_mempool);
+       mempool_free(p, nfs_commit_mempool);
 }
 
 static void nfs_writedata_release(struct rpc_task *task)
@@ -110,22 +110,6 @@ static void nfs_writedata_release(struct rpc_task *task)
        nfs_writedata_free(wdata);
 }
 
-static __inline__ struct nfs_write_data *nfs_commit_alloc(void)
-{
-       struct nfs_write_data   *p;
-       p = (struct nfs_write_data *)mempool_alloc(nfs_commit_mempool, SLAB_NOFS);
-       if (p) {
-               memset(p, 0, sizeof(*p));
-               INIT_LIST_HEAD(&p->pages);
-       }
-       return p;
-}
-
-static __inline__ void nfs_commit_free(struct nfs_write_data *p)
-{
-       mempool_free(p, nfs_commit_mempool);
-}
-
 /* Adjust the file length if we're writing beyond the end */
 static void nfs_grow_file(struct page *page, unsigned int offset, unsigned int count)
 {
@@ -184,11 +168,10 @@ static int nfs_writepage_sync(struct nfs_open_context *ctx, struct inode *inode,
        int             result, written = 0;
        struct nfs_write_data *wdata;
 
-       wdata = kmalloc(sizeof(*wdata), GFP_NOFS);
+       wdata = nfs_writedata_alloc();
        if (!wdata)
                return -ENOMEM;
 
-       memset(wdata, 0, sizeof(*wdata));
        wdata->flags = how;
        wdata->cred = ctx->cred;
        wdata->inode = inode;
@@ -238,8 +221,7 @@ static int nfs_writepage_sync(struct nfs_open_context *ctx, struct inode *inode,
 
 io_error:
        nfs_end_data_update_defer(inode);
-
-       kfree(wdata);
+       nfs_writedata_free(wdata);
        return written ? written : result;
 }
 
@@ -1025,7 +1007,7 @@ static int nfs_flush_one(struct list_head *head, struct inode *inode, int how)
        return -ENOMEM;
 }
 
-int
+static int
 nfs_flush_list(struct list_head *head, int wpages, int how)
 {
        LIST_HEAD(one_request);
@@ -1199,7 +1181,8 @@ void nfs_writeback_done(struct rpc_task *task)
                }
                if (time_before(complain, jiffies)) {
                        printk(KERN_WARNING
-                              "NFS: Server wrote less than requested.\n");
+                              "NFS: Server wrote zero bytes, expected %u.\n",
+                                       argp->count);
                        complain = jiffies + 300 * HZ;
                }
                /* Can't do anything about it except throw an error. */
@@ -1274,7 +1257,7 @@ static void nfs_commit_rpcsetup(struct list_head *head,
 /*
  * Commit dirty pages
  */
-int
+static int
 nfs_commit_list(struct list_head *head, int how)
 {
        struct nfs_write_data   *data;
@@ -1348,8 +1331,8 @@ nfs_commit_done(struct rpc_task *task)
 }
 #endif
 
-int nfs_flush_inode(struct inode *inode, unsigned long idx_start,
-                  unsigned int npages, int how)
+static int nfs_flush_inode(struct inode *inode, unsigned long idx_start,
+                          unsigned int npages, int how)
 {
        struct nfs_inode *nfsi = NFS_I(inode);
        LIST_HEAD(head);