]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/block/nbd.c
treewide: convert PF_MEMALLOC manipulations to new helpers
[karo-tx-linux.git] / drivers / block / nbd.c
index e9e2a9e95a66479ae780a785b3410469ed41451e..9a7bb2c2944772cad8124a965bacc17d0aa8f935 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/sched.h>
+#include <linux/sched/mm.h>
 #include <linux/fs.h>
 #include <linux/bio.h>
 #include <linux/stat.h>
@@ -347,7 +348,7 @@ static int sock_xmit(struct nbd_device *nbd, int index, int send,
        struct socket *sock = config->socks[index]->sock;
        int result;
        struct msghdr msg;
-       unsigned long pflags = current->flags;
+       unsigned int noreclaim_flag;
 
        if (unlikely(!sock)) {
                dev_err_ratelimited(disk_to_dev(nbd->disk),
@@ -358,7 +359,7 @@ static int sock_xmit(struct nbd_device *nbd, int index, int send,
 
        msg.msg_iter = *iter;
 
-       current->flags |= PF_MEMALLOC;
+       noreclaim_flag = memalloc_noreclaim_save();
        do {
                sock->sk->sk_allocation = GFP_NOIO | __GFP_MEMALLOC;
                msg.msg_name = NULL;
@@ -381,7 +382,7 @@ static int sock_xmit(struct nbd_device *nbd, int index, int send,
                        *sent += result;
        } while (msg_data_left(&msg));
 
-       current_restore_flags(pflags, PF_MEMALLOC);
+       memalloc_noreclaim_restore(noreclaim_flag);
 
        return result;
 }