]> git.hungrycats.org Git - linux/commit
btrfs: Remove false alert when fiemap range is smaller than on-disk extent
authorQu Wenruo <quwenruo@cn.fujitsu.com>
Thu, 22 Jun 2017 02:01:21 +0000 (10:01 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 13 Aug 2017 02:34:28 +0000 (19:34 -0700)
commitd5ad330817a3d6d3e781bd2d0edc72c72fed9e5c
tree65cc030a29e0282feaa3f74459877c55e8bebafd
parentc4b3691a2c83c696ec65bdf9bda4b28095e18331
btrfs: Remove false alert when fiemap range is smaller than on-disk extent

commit 848c23b78fafdcd3270b06a30737f8dbd70c347f upstream.

Commit 4751832da990 ("btrfs: fiemap: Cache and merge fiemap extent before
submit it to user") introduced a warning to catch unemitted cached
fiemap extent.

However such warning doesn't take the following case into consideration:

0 4K 8K
|<---- fiemap range --->|
|<----------- On-disk extent ------------------>|

In this case, the whole 0~8K is cached, and since it's larger than
fiemap range, it break the fiemap extent emit loop.
This leaves the fiemap extent cached but not emitted, and caught by the
final fiemap extent sanity check, causing kernel warning.

This patch removes the kernel warning and renames the sanity check to
emit_last_fiemap_cache() since it's possible and valid to have cached
fiemap extent.

Reported-by: David Sterba <dsterba@suse.cz>
Reported-by: Adam Borowski <kilobyte@angband.pl>
Fixes: 4751832da990 ("btrfs: fiemap: Cache and merge fiemap extent ...")
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Cc: Holger Hoffstätte <holger@applied-asynchrony.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/extent_io.c