Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: fdmanana@kernel.org
To: linux-btrfs@vger.kernel.org
Subject: [PATCH] Btrfs: allocate ulists in btrfs_check_shared() using GFP_KERNEL
Date: Mon, 15 Apr 2019 09:29:10 +0100	[thread overview]
Message-ID: <20190415082910.2073-1-fdmanana@kernel.org> (raw)

From: Filipe Manana <fdmanana@suse.com>

As of commit bb739cf08e8f32 ("btrfs: btrfs_check_shared should manage its
own transaction") btrfs_check_shared() manages its own transaction, it
no longer receives a transaction handle as parameter. Since it is used
only in the fiemap path, the ulists it needs to use are allocated before
it grabs a transaction handle and we are not holding any locks that could
cause a deadlock in case reclaim happens during a memory allocation, we
can use the GFP_KERNEL flag to allocate the ulists instead of GFP_NOFS.
So do that switch.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/backref.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index 876e6bb93797..377978bb8845 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -1481,8 +1481,8 @@ int btrfs_check_shared(struct btrfs_root *root, u64 inum, u64 bytenr)
 		.share_count = 0,
 	};
 
-	tmp = ulist_alloc(GFP_NOFS);
-	roots = ulist_alloc(GFP_NOFS);
+	tmp = ulist_alloc(GFP_KERNEL);
+	roots = ulist_alloc(GFP_KERNEL);
 	if (!tmp || !roots) {
 		ulist_free(tmp);
 		ulist_free(roots);
-- 
2.11.0


             reply	other threads:[~2019-04-15  8:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-15  8:29 fdmanana [this message]
2019-04-15 14:35 ` [PATCH] Btrfs: allocate ulists in btrfs_check_shared() using GFP_KERNEL David Sterba
2019-04-15 14:44   ` Filipe Manana
2019-04-15 14:58     ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190415082910.2073-1-fdmanana@kernel.org \
    --to=fdmanana@kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox