diff options
author | Mel Gorman <mgorman@suse.de> | 2012-07-31 19:45:12 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-31 21:42:48 -0400 |
commit | a564b8f0398636ba30b07c0eaebdef7ff7837249 (patch) | |
tree | 10478aa5cfb2a3696db34618a479413b358c3831 /net/sunrpc/sched.c | |
parent | 29418aa4bd487c82016733ef5c6a06d656ed3c7d (diff) |
nfs: enable swap on NFS
Implement the new swapfile a_ops for NFS and hook up ->direct_IO. This
will set the NFS socket to SOCK_MEMALLOC and run socket reconnect under
PF_MEMALLOC as well as reset SOCK_MEMALLOC before engaging the protocol
->connect() method.
PF_MEMALLOC should allow the allocation of struct socket and related
objects and the early (re)setting of SOCK_MEMALLOC should allow us to
receive the packets required for the TCP connection buildup.
[jlayton@redhat.com: Restore PF_MEMALLOC task flags in all cases]
[dfeng@redhat.com: Fix handling of multiple swap files]
[a.p.zijlstra@chello.nl: Original patch]
Signed-off-by: Mel Gorman <mgorman@suse.de>
Acked-by: Rik van Riel <riel@redhat.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Eric B Munson <emunson@mgebm.net>
Cc: Eric Paris <eparis@redhat.com>
Cc: James Morris <jmorris@namei.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Mike Christie <michaelc@cs.wisc.edu>
Cc: Neil Brown <neilb@suse.de>
Cc: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: Xiaotian Feng <dfeng@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'net/sunrpc/sched.c')
-rw-r--r-- | net/sunrpc/sched.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index 994cfea2bad6..83a4c43cee7f 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c | |||
@@ -812,7 +812,10 @@ static void rpc_async_schedule(struct work_struct *work) | |||
812 | void *rpc_malloc(struct rpc_task *task, size_t size) | 812 | void *rpc_malloc(struct rpc_task *task, size_t size) |
813 | { | 813 | { |
814 | struct rpc_buffer *buf; | 814 | struct rpc_buffer *buf; |
815 | gfp_t gfp = RPC_IS_SWAPPER(task) ? GFP_ATOMIC : GFP_NOWAIT; | 815 | gfp_t gfp = GFP_NOWAIT; |
816 | |||
817 | if (RPC_IS_SWAPPER(task)) | ||
818 | gfp |= __GFP_MEMALLOC; | ||
816 | 819 | ||
817 | size += sizeof(struct rpc_buffer); | 820 | size += sizeof(struct rpc_buffer); |
818 | if (size <= RPC_BUFFER_MAXSIZE) | 821 | if (size <= RPC_BUFFER_MAXSIZE) |
@@ -886,7 +889,7 @@ static void rpc_init_task(struct rpc_task *task, const struct rpc_task_setup *ta | |||
886 | static struct rpc_task * | 889 | static struct rpc_task * |
887 | rpc_alloc_task(void) | 890 | rpc_alloc_task(void) |
888 | { | 891 | { |
889 | return (struct rpc_task *)mempool_alloc(rpc_task_mempool, GFP_NOFS); | 892 | return (struct rpc_task *)mempool_alloc(rpc_task_mempool, GFP_NOIO); |
890 | } | 893 | } |
891 | 894 | ||
892 | /* | 895 | /* |