Commit 745483ea authored by Rajeev Tapadia's avatar Rajeev Tapadia Committed by David Sterba
Browse files

btrfs: fix comment in alloc_bitmap() and drop stale TODO



All callers of alloc_bitmap() hold a transaction handle, so GFP_NOFS is
needed to avoid deadlocks on recursion. Update the comment and drop the
stale TODO.

Reviewed-by: default avatarFilipe Manana <fdmanana@suse.com>
Signed-off-by: default avatarRajeev Tapadia <rtapadia730@gmail.com>
Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 725e4629
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -165,11 +165,9 @@ static unsigned long *alloc_bitmap(u32 bitmap_size)

	/*
	 * GFP_NOFS doesn't work with kvmalloc(), but we really can't recurse
	 * into the filesystem as the free space bitmap can be modified in the
	 * critical section of a transaction commit.
	 *
	 * TODO: push the memalloc_nofs_{save,restore}() to the caller where we
	 * know that recursion is unsafe.
	 * into the filesystem here. All callers hold a transaction handle
	 * open, so if a GFP_KERNEL allocation recurses into the filesystem
	 * and triggers a transaction commit, we would deadlock.
	 */
	nofs_flag = memalloc_nofs_save();
	ret = kvzalloc(bitmap_rounded_size, GFP_KERNEL);