f2fs: do not preallocate blocks which has wrong buffer
authorJaegeuk Kim <jaegeuk@kernel.org>
Fri, 13 Jan 2017 21:12:29 +0000 (13:12 -0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Thu, 23 Feb 2017 04:24:48 +0000 (20:24 -0800)
commitdc91de78e5e1d44238b5dd2b57d2e8e67cbc00a1
treed78cc69fe7a50db8a8c3207cb532eab76c051bfd
parentdcc9165dbf9961cf2848af728f8be31f28a3c790
f2fs: do not preallocate blocks which has wrong buffer

Sheng Yong reports needless preallocation if write(small_buffer, large_size)
is called.

In that case, f2fs preallocates large_size, but vfs returns early due to
small_buffer size. Let's detect it before preallocation phase in f2fs.

Reported-by: Sheng Yong <shengyong1@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/data.c
fs/f2fs/f2fs.h
fs/f2fs/file.c