btrfs: Fix tail space processing in find_free_dev_extent()
authorZhao Lei <zhaolei@cn.fujitsu.com>
Mon, 16 Feb 2015 10:52:17 +0000 (18:52 +0800)
committerChris Mason <clm@fb.com>
Mon, 13 Apr 2015 14:27:18 +0000 (07:27 -0700)
It is another reason for NO_SPACE case.

When we found enough free space in loop and saved them to
max_hole_start/size before, and tail space contains pending extent,
origional innocent max_hole_start/size are reset in retry.

As a result, find_free_dev_extent() returns less space than it can,
and cause NO_SPACE in user program.

Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/volumes.c

Simple merge