]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - fs/nfs/file.c
pnfs/blocklayout: include vmalloc.h for __vmalloc
[karo-tx-linux.git] / fs / nfs / file.c
index 524dd80d189862db5a76a7bb9e8a263ce857ffeb..23e5f0ea5c83bc210d691e1f07cddacd7fb4254a 100644 (file)
@@ -36,6 +36,7 @@
 #include "internal.h"
 #include "iostat.h"
 #include "fscache.h"
+#include "pnfs.h"
 
 #include "nfstrace.h"
 
@@ -327,6 +328,12 @@ static int nfs_want_read_modify_write(struct file *file, struct page *page,
        unsigned int offset = pos & (PAGE_CACHE_SIZE - 1);
        unsigned int end = offset + len;
 
+       if (pnfs_ld_read_whole_page(file->f_mapping->host)) {
+               if (!PageUptodate(page))
+                       return 1;
+               return 0;
+       }
+
        if ((file->f_mode & FMODE_READ) &&      /* open for read? */
            !PageUptodate(page) &&              /* Uptodate? */
            !PagePrivate(page) &&               /* i/o request already? */
@@ -539,13 +546,25 @@ static int nfs_launder_page(struct page *page)
 static int nfs_swap_activate(struct swap_info_struct *sis, struct file *file,
                                                sector_t *span)
 {
+       int ret;
+       struct rpc_clnt *clnt = NFS_CLIENT(file->f_mapping->host);
+
        *span = sis->pages;
-       return xs_swapper(NFS_CLIENT(file->f_mapping->host)->cl_xprt, 1);
+
+       rcu_read_lock();
+       ret = xs_swapper(rcu_dereference(clnt->cl_xprt), 1);
+       rcu_read_unlock();
+
+       return ret;
 }
 
 static void nfs_swap_deactivate(struct file *file)
 {
-       xs_swapper(NFS_CLIENT(file->f_mapping->host)->cl_xprt, 0);
+       struct rpc_clnt *clnt = NFS_CLIENT(file->f_mapping->host);
+
+       rcu_read_lock();
+       xs_swapper(rcu_dereference(clnt->cl_xprt), 0);
+       rcu_read_unlock();
 }
 #endif