f2fs: convert inline_data for punch_hole
authorJaegeuk Kim <jaegeuk.kim@samsung.com>
Fri, 27 Dec 2013 02:13:21 +0000 (11:13 +0900)
committerJaegeuk Kim <jaegeuk.kim@samsung.com>
Mon, 6 Jan 2014 07:42:12 +0000 (16:42 +0900)
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>
fs/f2fs/file.c

index 7ef2d6af24ce8a256711e66b6b71bb42aa429649..f64a1c8291af38e04e17a456de6bb13288e39ee1 100644 (file)
@@ -462,25 +462,9 @@ static int punch_hole(struct inode *inode, loff_t offset, loff_t len)
        loff_t off_start, off_end;
        int ret = 0;
 
-       if (f2fs_has_inline_data(inode)) {
-               struct page *page;
-               unsigned flags = AOP_FLAG_NOFS;
-               page = grab_cache_page_write_begin(inode->i_mapping, 0, flags);
-               if (IS_ERR(page))
-                       return PTR_ERR(page);
-               if (offset + len > MAX_INLINE_DATA) {
-                       ret = f2fs_convert_inline_data(inode, page, flags);
-                       f2fs_put_page(page, 1);
-                       if (ret)
-                               return ret;
-               } else {
-                       zero_user_segment(page, offset, offset + len);
-                       SetPageUptodate(page);
-                       set_page_dirty(page);
-                       f2fs_put_page(page, 1);
-                       return ret;
-               }
-       }
+       ret = f2fs_convert_inline_data(inode, NULL, AOP_FLAG_NOFS);
+       if (ret)
+               return ret;
 
        pg_start = ((unsigned long long) offset) >> PAGE_CACHE_SHIFT;
        pg_end = ((unsigned long long) offset + len) >> PAGE_CACHE_SHIFT;