diff options
author | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-12-26 21:13:21 -0500 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2014-01-06 02:42:12 -0500 |
commit | 8230a0a49fc3f587644b284e51ac092607aa74bf (patch) | |
tree | efc0e5d58266395c758da8b777b7bc2637cee4d3 | |
parent | f185ff979f97943c9d4966ed4edc9819c3342c5b (diff) |
f2fs: convert inline_data for punch_hole
In the punch_hole(), let's convert inline_data all the time for simplicity and
to avoid potential deadlock conditions.
It is pretty much not a big deal to do this.
Reviewed-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
-rw-r--r-- | fs/f2fs/file.c | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 7ef2d6af24ce..f64a1c8291af 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c | |||
@@ -462,25 +462,9 @@ static int punch_hole(struct inode *inode, loff_t offset, loff_t len) | |||
462 | loff_t off_start, off_end; | 462 | loff_t off_start, off_end; |
463 | int ret = 0; | 463 | int ret = 0; |
464 | 464 | ||
465 | if (f2fs_has_inline_data(inode)) { | 465 | ret = f2fs_convert_inline_data(inode, NULL, AOP_FLAG_NOFS); |
466 | struct page *page; | 466 | if (ret) |
467 | unsigned flags = AOP_FLAG_NOFS; | 467 | return ret; |
468 | page = grab_cache_page_write_begin(inode->i_mapping, 0, flags); | ||
469 | if (IS_ERR(page)) | ||
470 | return PTR_ERR(page); | ||
471 | if (offset + len > MAX_INLINE_DATA) { | ||
472 | ret = f2fs_convert_inline_data(inode, page, flags); | ||
473 | f2fs_put_page(page, 1); | ||
474 | if (ret) | ||
475 | return ret; | ||
476 | } else { | ||
477 | zero_user_segment(page, offset, offset + len); | ||
478 | SetPageUptodate(page); | ||
479 | set_page_dirty(page); | ||
480 | f2fs_put_page(page, 1); | ||
481 | return ret; | ||
482 | } | ||
483 | } | ||
484 | 468 | ||
485 | pg_start = ((unsigned long long) offset) >> PAGE_CACHE_SHIFT; | 469 | pg_start = ((unsigned long long) offset) >> PAGE_CACHE_SHIFT; |
486 | pg_end = ((unsigned long long) offset + len) >> PAGE_CACHE_SHIFT; | 470 | pg_end = ((unsigned long long) offset + len) >> PAGE_CACHE_SHIFT; |