diff options
| author | Chao Yu <yuchao0@huawei.com> | 2016-10-11 22:57:04 +0800 |
|---|---|---|
| committer | Mister Oyster <oysterized@gmail.com> | 2017-04-13 12:34:16 +0200 |
| commit | 1f1fc98f525cb9b2b4c3f222b9684a548b6412ec (patch) | |
| tree | 8f00e8a13ecda79a7a01402b6fb719ad56c6c844 | |
| parent | 29481cbef3cf6e1a51d1daa36aee58527d16c15d (diff) | |
f2fs: be aware of extent beyond EOF in fiemap
f2fs can support fallocating blocks beyond file size without changing the
size, but ->fiemap of f2fs was restricted and can't detect these extents
fallocated past EOF, now relieve the restriction.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
| -rw-r--r-- | fs/f2fs/data.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index dc9f5ee39..207942c1b 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -880,7 +880,6 @@ int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, struct buffer_head map_bh; sector_t start_blk, last_blk; pgoff_t next_pgofs; - loff_t isize; u64 logical = 0, phys = 0, size = 0; u32 flags = 0; int ret = 0; @@ -897,13 +896,6 @@ int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, inode_lock(inode); - isize = i_size_read(inode); - 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); @@ -922,13 +914,11 @@ next: /* HOLE */ if (!buffer_mapped(&map_bh)) { start_blk = next_pgofs; - /* Go through holes util pass the EOF */ - if (blk_to_logical(inode, start_blk) < isize) + + if (blk_to_logical(inode, start_blk) < blk_to_logical(inode, + F2FS_I_SB(inode)->max_file_blocks)) goto prep_next; - /* Found a hole beyond isize means no more extents. - * Note that the premise is that filesystems don't - * punch holes beyond isize and keep size unchanged. - */ + flags |= FIEMAP_EXTENT_LAST; } |
