diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2016-05-20 19:22:03 +0300 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2016-06-03 04:05:08 +0300 |
commit | fc9581c809722960c46a02445f2434120e5e483b (patch) | |
tree | fe14d15cab1ef6d2d5562410155033e46fdd1afd /fs | |
parent | 91942321e4c9f8460f260cdfcf0a7a48a73a84a4 (diff) | |
download | linux-fc9581c809722960c46a02445f2434120e5e483b.tar.xz |
f2fs: introduce f2fs_i_size_write with mark_inode_dirty_sync
This patch introduces f2fs_i_size_write() to call mark_inode_dirty_sync() with
i_size_write().
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/f2fs/data.c | 10 | ||||
-rw-r--r-- | fs/f2fs/dir.c | 2 | ||||
-rw-r--r-- | fs/f2fs/f2fs.h | 9 | ||||
-rw-r--r-- | fs/f2fs/file.c | 10 | ||||
-rw-r--r-- | fs/f2fs/inline.c | 6 | ||||
-rw-r--r-- | fs/f2fs/recovery.c | 2 | ||||
-rw-r--r-- | fs/f2fs/super.c | 2 |
7 files changed, 23 insertions, 18 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index dd46ca8e0f83..0dd42b6ce6f3 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -564,7 +564,7 @@ struct page *get_new_data_page(struct inode *inode, got_it: if (new_i_size && i_size_read(inode) < ((loff_t)(index + 1) << PAGE_SHIFT)) { - i_size_write(inode, ((loff_t)(index + 1) << PAGE_SHIFT)); + f2fs_i_size_write(inode, ((loff_t)(index + 1) << PAGE_SHIFT)); /* Only the directory inode sets new_i_size */ set_inode_flag(inode, FI_UPDATE_DIR); } @@ -605,7 +605,7 @@ alloc: fofs = start_bidx_of_node(ofs_of_node(dn->node_page), dn->inode) + dn->ofs_in_node; if (i_size_read(dn->inode) < ((loff_t)(fofs + 1) << PAGE_SHIFT)) - i_size_write(dn->inode, + f2fs_i_size_write(dn->inode, ((loff_t)(fofs + 1) << PAGE_SHIFT)); return 0; } @@ -1711,10 +1711,8 @@ static int f2fs_write_end(struct file *file, set_page_dirty(page); - if (pos + copied > i_size_read(inode)) { - i_size_write(inode, pos + copied); - mark_inode_dirty(inode); - } + if (pos + copied > i_size_read(inode)) + f2fs_i_size_write(inode, pos + copied); f2fs_put_page(page, 1); f2fs_update_time(F2FS_I_SB(inode), REQ_TIME); diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index 9fa8d3edb8e0..dc4beae14c92 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c @@ -686,7 +686,7 @@ void f2fs_drop_nlink(struct inode *dir, struct inode *inode, struct page *page) drop_nlink(inode); if (S_ISDIR(inode->i_mode)) { drop_nlink(inode); - i_size_write(inode, 0); + f2fs_i_size_write(inode, 0); } up_write(&F2FS_I(inode)->i_sem); update_inode_page(inode); diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 937106354eae..bdd6b875f50d 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -1556,6 +1556,15 @@ static inline void set_acl_inode(struct inode *inode, umode_t mode) set_inode_flag(inode, FI_ACL_MODE); } +static inline void f2fs_i_size_write(struct inode *inode, loff_t i_size) +{ + if (i_size_read(inode) == i_size) + return; + + i_size_write(inode, i_size); + mark_inode_dirty_sync(inode); +} + static inline void get_inline_info(struct inode *inode, struct f2fs_inode *ri) { if (ri->i_inline & F2FS_INLINE_XATTR) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index e68e5adc23cd..d0f42587309f 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -988,7 +988,7 @@ static int f2fs_collapse_range(struct inode *inode, loff_t offset, loff_t len) ret = truncate_blocks(inode, new_size, true); if (!ret) - i_size_write(inode, new_size); + f2fs_i_size_write(inode, new_size); return ret; } @@ -1125,8 +1125,7 @@ static int f2fs_zero_range(struct inode *inode, loff_t offset, loff_t len, out: if (!(mode & FALLOC_FL_KEEP_SIZE) && i_size_read(inode) < new_size) { - i_size_write(inode, new_size); - mark_inode_dirty(inode); + f2fs_i_size_write(inode, new_size); update_inode_page(inode); } @@ -1186,7 +1185,7 @@ static int f2fs_insert_range(struct inode *inode, loff_t offset, loff_t len) truncate_pagecache(inode, offset); if (!ret) - i_size_write(inode, new_size); + f2fs_i_size_write(inode, new_size); return ret; } @@ -1235,8 +1234,7 @@ static int expand_inode_data(struct inode *inode, loff_t offset, } if (!(mode & FALLOC_FL_KEEP_SIZE) && i_size_read(inode) < new_size) { - i_size_write(inode, new_size); - mark_inode_dirty(inode); + f2fs_i_size_write(inode, new_size); update_inode_page(inode); } diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c index c50dee937c1b..7a9bc442dd77 100644 --- a/fs/f2fs/inline.c +++ b/fs/f2fs/inline.c @@ -340,7 +340,7 @@ int make_empty_inline_dir(struct inode *inode, struct inode *parent, /* update i_size to MAX_INLINE_DATA */ if (i_size_read(inode) < MAX_INLINE_DATA) { - i_size_write(inode, MAX_INLINE_DATA); + f2fs_i_size_write(inode, MAX_INLINE_DATA); set_inode_flag(inode, FI_UPDATE_DIR); } return 0; @@ -402,7 +402,7 @@ static int f2fs_move_inline_dirents(struct inode *dir, struct page *ipage, F2FS_I(dir)->i_current_depth = 1; if (i_size_read(dir) < PAGE_SIZE) { - i_size_write(dir, PAGE_SIZE); + f2fs_i_size_write(dir, PAGE_SIZE); set_inode_flag(dir, FI_UPDATE_DIR); } @@ -493,7 +493,7 @@ recover: lock_page(ipage); memcpy(inline_dentry, backup_dentry, MAX_INLINE_DATA); F2FS_I(dir)->i_current_depth = 0; - i_size_write(dir, MAX_INLINE_DATA); + f2fs_i_size_write(dir, MAX_INLINE_DATA); update_inode(dir, ipage); f2fs_put_page(ipage, 1); diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c index 3d7216d7a288..2500b6a5daf0 100644 --- a/fs/f2fs/recovery.c +++ b/fs/f2fs/recovery.c @@ -175,7 +175,7 @@ static void recover_inode(struct inode *inode, struct page *page) char *name; inode->i_mode = le16_to_cpu(raw->i_mode); - i_size_write(inode, le64_to_cpu(raw->i_size)); + f2fs_i_size_write(inode, le64_to_cpu(raw->i_size)); inode->i_atime.tv_sec = le64_to_cpu(raw->i_mtime); inode->i_ctime.tv_sec = le64_to_cpu(raw->i_ctime); inode->i_mtime.tv_sec = le64_to_cpu(raw->i_mtime); diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 160b15b28b95..d832bf4051b5 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -568,7 +568,7 @@ static int f2fs_drop_inode(struct inode *inode) f2fs_destroy_extent_node(inode); sb_start_intwrite(inode->i_sb); - i_size_write(inode, 0); + f2fs_i_size_write(inode, 0); if (F2FS_HAS_BLOCKS(inode)) f2fs_truncate(inode, true); |