* [PATCH 3/5] f2fs: skip punching hole in special condition
@ 2014-09-15 10:03 Chao Yu
0 siblings, 0 replies; only message in thread
From: Chao Yu @ 2014-09-15 10:03 UTC (permalink / raw)
To: Jaegeuk Kim, Changman Lee; +Cc: linux-kernel, linux-f2fs-devel
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>
---
fs/f2fs/file.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 7b34101..ecf94e1 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -645,6 +645,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;
--
2.0.1.474.g72c7794
------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-09-15 10:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-15 10:03 [PATCH 3/5] f2fs: skip punching hole in special condition Chao Yu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).