]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: be more selective in the defrag ioctl
authorChris Mason <chris.mason@oracle.com>
Wed, 10 Mar 2010 15:52:59 +0000 (10:52 -0500)
committerChris Mason <chris.mason@oracle.com>
Mon, 15 Mar 2010 15:00:10 +0000 (11:00 -0400)
commitb62b3c92186fa5cd84b9f80aa76b70a35d3d5861
tree8eec3d4a95cbc530ddaa82f0d2848e14519eec2a
parentd229498e33e44e2ca35a56914520f178ebfde648
Btrfs: be more selective in the defrag ioctl

The btrfs defrag ioctl had some bugs around delalloc accounting, and it
wasn't properly skipping pages that were not in the mapping.

It wasn't properly clearing the page checked flag, which could make the
writeback code ignore the page forever while pinning it as dirty.

This commit fixes those problems and makes defrag a little smarter.  It
skips holes and it doesn't waste time defragging large extents.  If a
tiny extent comes before a very large extent, it will defrag both of
them to make sure the tiny extent ends up next to something big.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/ioctl.c