]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: fix defrag regression
authorLi Zefan <lizefan@huawei.com>
Mon, 11 Jun 2012 08:03:35 +0000 (16:03 +0800)
committerChris Mason <chris.mason@oracle.com>
Fri, 15 Jun 2012 01:30:55 +0000 (21:30 -0400)
commit383084babc3d3d8498e4eed62e15aeb70f72d725
tree97d8a780a577d21c0f237f2140f3a129f40096bf
parentdd2673b01f5fc15c0fe23bf48b29f859589eaf91
Btrfs: fix defrag regression

If a file has 3 small extents:

| ext1 | ext2 | ext3 |

Running "btrfs fi defrag" will only defrag the last two extents, if those
extent mappings hasn't been read into memory from disk.

This bug was introduced by commit 13c73a7f318dffa368442dedd59a65f8957fad5a
("Btrfs: add a check to decide if we should defrag the range")

The cause is, that commit looked into previous and next extents using
lookup_extent_mapping() only.

While at it, remove the code that checks the previous extent, since
it's sufficient to check the next extent.

Signed-off-by: Li Zefan <lizefan@huawei.com>
fs/btrfs/ioctl.c