diff options
author | Chao Yu <chao2.yu@samsung.com> | 2014-09-15 06:03:32 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2014-09-23 14:10:21 -0400 |
commit | 14cecc5cd6ed33ef3cb7328de904cc636dd390a4 (patch) | |
tree | f0de29f6c96b43157d0521e4b311503e24421a3d /fs | |
parent | 55cf9cb63f0e5439f208d78ed944de9a8df65011 (diff) |
f2fs: skip punching hole in special condition
Now punching hole in directory is not supported in f2fs, so let's limit file
type in punch_hole().
In addition, in punch_hole if offset is exceed file size, we should skip
punching hole.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/f2fs/file.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index a95ba23e3bd3..ac8c6804097f 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c | |||
@@ -658,6 +658,13 @@ static int punch_hole(struct inode *inode, loff_t offset, loff_t len) | |||
658 | loff_t off_start, off_end; | 658 | loff_t off_start, off_end; |
659 | int ret = 0; | 659 | int ret = 0; |
660 | 660 | ||
661 | if (!S_ISREG(inode->i_mode)) | ||
662 | return -EOPNOTSUPP; | ||
663 | |||
664 | /* skip punching hole beyond i_size */ | ||
665 | if (offset >= inode->i_size) | ||
666 | return ret; | ||
667 | |||
661 | ret = f2fs_convert_inline_data(inode, MAX_INLINE_DATA + 1, NULL); | 668 | ret = f2fs_convert_inline_data(inode, MAX_INLINE_DATA + 1, NULL); |
662 | if (ret) | 669 | if (ret) |
663 | return ret; | 670 | return ret; |