NFS: Clean up writeback code
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Tue, 11 Jun 2019 20:49:52 +0000 (16:49 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Sat, 6 Jul 2019 18:54:52 +0000 (14:54 -0400)
Now that the VM promises never to recurse back into the filesystem
layer on writeback, remove all the GFP_NOFS references etc from
the generic writeback code.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/pagelist.c
fs/nfs/pnfs.c
fs/nfs/write.c

index 6ef5278326b673b7044f9593774603ffa5d01067..ed4e1b07447bde1280a41a98120689aafc258ab6 100644 (file)
@@ -77,7 +77,7 @@ void nfs_set_pgio_error(struct nfs_pgio_header *hdr, int error, loff_t pos)
 static inline struct nfs_page *
 nfs_page_alloc(void)
 {
-       struct nfs_page *p = kmem_cache_zalloc(nfs_page_cachep, GFP_NOIO);
+       struct nfs_page *p = kmem_cache_zalloc(nfs_page_cachep, GFP_KERNEL);
        if (p)
                INIT_LIST_HEAD(&p->wb_list);
        return p;
@@ -775,8 +775,6 @@ int nfs_generic_pgio(struct nfs_pageio_descriptor *desc,
        if (pagecount <= ARRAY_SIZE(pg_array->page_array))
                pg_array->pagevec = pg_array->page_array;
        else {
-               if (hdr->rw_mode == FMODE_WRITE)
-                       gfp_flags = GFP_NOIO;
                pg_array->pagevec = kcalloc(pagecount, sizeof(struct page *), gfp_flags);
                if (!pg_array->pagevec) {
                        pg_array->npages = 0;
@@ -851,7 +849,7 @@ nfs_pageio_alloc_mirrors(struct nfs_pageio_descriptor *desc,
        desc->pg_mirrors_dynamic = NULL;
        if (mirror_count == 1)
                return desc->pg_mirrors_static;
-       ret = kmalloc_array(mirror_count, sizeof(*ret), GFP_NOFS);
+       ret = kmalloc_array(mirror_count, sizeof(*ret), GFP_KERNEL);
        if (ret != NULL) {
                for (i = 0; i < mirror_count; i++)
                        nfs_pageio_mirror_init(&ret[i], desc->pg_bsize);
index 83722e936b4a3a66428fb70d55d2688cb12d58f1..56e423cd8180a4bc754dd1621712c7ddb0cbad6c 100644 (file)
@@ -2468,7 +2468,7 @@ pnfs_generic_pg_init_write(struct nfs_pageio_descriptor *pgio,
                                                   wb_size,
                                                   IOMODE_RW,
                                                   false,
-                                                  GFP_NOFS);
+                                                  GFP_KERNEL);
                if (IS_ERR(pgio->pg_lseg)) {
                        pgio->pg_error = PTR_ERR(pgio->pg_lseg);
                        pgio->pg_lseg = NULL;
index 059a7c38bc4fcac4d2e623557d9c1fdd0e2b9b8d..92d9cadc61027c642bcab5755be7c5d221e7b0b1 100644 (file)
@@ -103,7 +103,7 @@ EXPORT_SYMBOL_GPL(nfs_commit_free);
 
 static struct nfs_pgio_header *nfs_writehdr_alloc(void)
 {
-       struct nfs_pgio_header *p = mempool_alloc(nfs_wdata_mempool, GFP_NOIO);
+       struct nfs_pgio_header *p = mempool_alloc(nfs_wdata_mempool, GFP_KERNEL);
 
        memset(p, 0, sizeof(*p));
        p->rw_mode = FMODE_WRITE;
@@ -721,12 +721,11 @@ int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc)
        struct inode *inode = mapping->host;
        struct nfs_pageio_descriptor pgio;
        struct nfs_io_completion *ioc;
-       unsigned int pflags = memalloc_nofs_save();
        int err;
 
        nfs_inc_stats(inode, NFSIOS_VFSWRITEPAGES);
 
-       ioc = nfs_io_completion_alloc(GFP_NOFS);
+       ioc = nfs_io_completion_alloc(GFP_KERNEL);
        if (ioc)
                nfs_io_completion_init(ioc, nfs_io_completion_commit, inode);
 
@@ -737,8 +736,6 @@ int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc)
        nfs_pageio_complete(&pgio);
        nfs_io_completion_put(ioc);
 
-       memalloc_nofs_restore(pflags);
-
        if (err < 0)
                goto out_err;
        err = pgio.pg_error;