f2fs: fix to migrate blocks correctly during defragment
authorChao Yu <yuchao0@huawei.com>
Mon, 29 Jul 2019 15:02:29 +0000 (23:02 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Fri, 23 Aug 2019 14:57:13 +0000 (07:57 -0700)
commitd3a1a0e1bf5d4d2107d6b485c5d33e65acaa7cf6
tree63c87ffa83c892c3508698509c683c3db508353f
parent33ac18a15c880d253565c08e8cec3ee4c8a76657
f2fs: fix to migrate blocks correctly during defragment

During defragment, we missed to trigger fragmented blocks migration
for below condition:

In defragment region:
- total number of valid blocks is smaller than 512;
- the tail part of the region are all holes;

In addtion, return zero to user via range->len if there is no
fragmented blocks.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/file.c