f2fs allows preallocation beyond isize, but f2fs_fiemap only look up
extents within isize. Therefore add this support.

Note: It's possible that there are holes after isize, for example,
fallocate  multiple discontinuous extents after isize with 
FALLOC_FL_KEEP_SIZE set. Since I can tell no differences between 
EOF and holes from return of get_data_block, I'm afaid this patch
can't support such scenarios. 


Signed-off-by: Fan li <fanofcode...@samsung.com>
---
 fs/f2fs/data.c |    7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index a9a4d89..f89cf07 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -798,12 +798,6 @@ int f2fs_fiemap(struct inode *inode, struct 
fiemap_extent_info *fieinfo,
        isize = i_size_read(inode);
 
        mutex_lock(&inode->i_mutex);
-       if (start >= isize)
-               goto out;
-
-       if (start + len > isize)
-               len = isize - start;
-
        if (logical_to_blk(inode, len) == 0)
                len = blk_to_logical(inode, 1);
 
@@ -829,6 +823,7 @@ next:
                 * punch holes beyond isize and keep size unchanged.
                 */
                flags |= FIEMAP_EXTENT_LAST;
+               last_blk = start_blk - 1;
        }
 
        if (size)
-- 
1.7.9.5


------------------------------------------------------------------------------
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to