Btrfs: clear EXTENT_DEFRAG bits in finish_ordered_io
authorLiu Bo <bo.li.liu@oracle.com>
Fri, 26 May 2017 23:44:23 +0000 (17:44 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 10 Nov 2018 15:42:48 +0000 (07:42 -0800)
commitf33ed8438676d4731e0ea66f592ea4cd0e8fa96b
tree8a5ced822479ff8951f01c446ea634bf6bc10817
parent30037edd16f4b43eafdaf8bbfd5c00fb9666004f
Btrfs: clear EXTENT_DEFRAG bits in finish_ordered_io

[ Upstream commit 452e62b71fbbefe2646fad3a968371a026936c6d ]

Before this, we use 'filled' mode here, ie. if all range has been
filled with EXTENT_DEFRAG bits, get to clear it, but if the defrag
range joins the adjacent delalloc range, then we'll have EXTENT_DEFRAG
bits in extent_state until releasing this inode's pages, and that
prevents extent_data from being freed.

This clears the bit if any was found within the ordered extent.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/btrfs/inode.c