Skip to content

Commit

Permalink
f2fs: skip punching hole in special condition
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Chao Yu authored and Jaegeuk Kim committed Sep 23, 2014
1 parent 55cf9cb commit 14cecc5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fs/f2fs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,13 @@ static int punch_hole(struct inode *inode, loff_t offset, loff_t len)
loff_t off_start, off_end;
int ret = 0;

if (!S_ISREG(inode->i_mode))
return -EOPNOTSUPP;

/* skip punching hole beyond i_size */
if (offset >= inode->i_size)
return ret;

ret = f2fs_convert_inline_data(inode, MAX_INLINE_DATA + 1, NULL);
if (ret)
return ret;
Expand Down

0 comments on commit 14cecc5

Please sign in to comment.