Commit 91942321 authored by Jaegeuk Kim's avatar Jaegeuk Kim

f2fs: use inode pointer for {set, clear}_inode_flag

This patch refactors to use inode pointer for set_inode_flag and
clear_inode_flag.
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 1c4bf763
...@@ -201,7 +201,6 @@ struct posix_acl *f2fs_get_acl(struct inode *inode, int type) ...@@ -201,7 +201,6 @@ struct posix_acl *f2fs_get_acl(struct inode *inode, int type)
static int __f2fs_set_acl(struct inode *inode, int type, static int __f2fs_set_acl(struct inode *inode, int type,
struct posix_acl *acl, struct page *ipage) struct posix_acl *acl, struct page *ipage)
{ {
struct f2fs_inode_info *fi = F2FS_I(inode);
int name_index; int name_index;
void *value = NULL; void *value = NULL;
size_t size = 0; size_t size = 0;
...@@ -214,7 +213,7 @@ static int __f2fs_set_acl(struct inode *inode, int type, ...@@ -214,7 +213,7 @@ static int __f2fs_set_acl(struct inode *inode, int type,
error = posix_acl_equiv_mode(acl, &inode->i_mode); error = posix_acl_equiv_mode(acl, &inode->i_mode);
if (error < 0) if (error < 0)
return error; return error;
set_acl_inode(fi, inode->i_mode); set_acl_inode(inode, inode->i_mode);
if (error == 0) if (error == 0)
acl = NULL; acl = NULL;
} }
...@@ -233,7 +232,7 @@ static int __f2fs_set_acl(struct inode *inode, int type, ...@@ -233,7 +232,7 @@ static int __f2fs_set_acl(struct inode *inode, int type,
if (acl) { if (acl) {
value = f2fs_acl_to_disk(acl, &size); value = f2fs_acl_to_disk(acl, &size);
if (IS_ERR(value)) { if (IS_ERR(value)) {
clear_inode_flag(fi, FI_ACL_MODE); clear_inode_flag(inode, FI_ACL_MODE);
return (int)PTR_ERR(value); return (int)PTR_ERR(value);
} }
} }
...@@ -244,7 +243,7 @@ static int __f2fs_set_acl(struct inode *inode, int type, ...@@ -244,7 +243,7 @@ static int __f2fs_set_acl(struct inode *inode, int type,
if (!error) if (!error)
set_cached_acl(inode, type, acl); set_cached_acl(inode, type, acl);
clear_inode_flag(fi, FI_ACL_MODE); clear_inode_flag(inode, FI_ACL_MODE);
return error; return error;
} }
......
...@@ -759,28 +759,25 @@ int get_valid_checkpoint(struct f2fs_sb_info *sbi) ...@@ -759,28 +759,25 @@ int get_valid_checkpoint(struct f2fs_sb_info *sbi)
static void __add_dirty_inode(struct inode *inode, enum inode_type type) static void __add_dirty_inode(struct inode *inode, enum inode_type type)
{ {
struct f2fs_sb_info *sbi = F2FS_I_SB(inode); struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
struct f2fs_inode_info *fi = F2FS_I(inode);
int flag = (type == DIR_INODE) ? FI_DIRTY_DIR : FI_DIRTY_FILE; int flag = (type == DIR_INODE) ? FI_DIRTY_DIR : FI_DIRTY_FILE;
if (is_inode_flag_set(fi, flag)) if (is_inode_flag_set(inode, flag))
return; return;
set_inode_flag(fi, flag); set_inode_flag(inode, flag);
list_add_tail(&fi->dirty_list, &sbi->inode_list[type]); list_add_tail(&F2FS_I(inode)->dirty_list, &sbi->inode_list[type]);
stat_inc_dirty_inode(sbi, type); stat_inc_dirty_inode(sbi, type);
} }
static void __remove_dirty_inode(struct inode *inode, enum inode_type type) static void __remove_dirty_inode(struct inode *inode, enum inode_type type)
{ {
struct f2fs_inode_info *fi = F2FS_I(inode);
int flag = (type == DIR_INODE) ? FI_DIRTY_DIR : FI_DIRTY_FILE; int flag = (type == DIR_INODE) ? FI_DIRTY_DIR : FI_DIRTY_FILE;
if (get_dirty_pages(inode) || if (get_dirty_pages(inode) || !is_inode_flag_set(inode, flag))
!is_inode_flag_set(F2FS_I(inode), flag))
return; return;
list_del_init(&fi->dirty_list); list_del_init(&F2FS_I(inode)->dirty_list);
clear_inode_flag(fi, flag); clear_inode_flag(inode, flag);
stat_dec_dirty_inode(F2FS_I_SB(inode), type); stat_dec_dirty_inode(F2FS_I_SB(inode), type);
} }
......
...@@ -321,7 +321,7 @@ int reserve_new_blocks(struct dnode_of_data *dn, blkcnt_t count) ...@@ -321,7 +321,7 @@ int reserve_new_blocks(struct dnode_of_data *dn, blkcnt_t count)
if (!count) if (!count)
return 0; return 0;
if (unlikely(is_inode_flag_set(F2FS_I(dn->inode), FI_NO_ALLOC))) if (unlikely(is_inode_flag_set(dn->inode, FI_NO_ALLOC)))
return -EPERM; return -EPERM;
if (unlikely(!inc_valid_block_count(sbi, dn->inode, &count))) if (unlikely(!inc_valid_block_count(sbi, dn->inode, &count)))
return -ENOSPC; return -ENOSPC;
...@@ -566,7 +566,7 @@ struct page *get_new_data_page(struct inode *inode, ...@@ -566,7 +566,7 @@ struct page *get_new_data_page(struct inode *inode,
((loff_t)(index + 1) << PAGE_SHIFT)) { ((loff_t)(index + 1) << PAGE_SHIFT)) {
i_size_write(inode, ((loff_t)(index + 1) << PAGE_SHIFT)); i_size_write(inode, ((loff_t)(index + 1) << PAGE_SHIFT));
/* Only the directory inode sets new_i_size */ /* Only the directory inode sets new_i_size */
set_inode_flag(F2FS_I(inode), FI_UPDATE_DIR); set_inode_flag(inode, FI_UPDATE_DIR);
} }
return page; return page;
} }
...@@ -580,7 +580,7 @@ static int __allocate_data_block(struct dnode_of_data *dn) ...@@ -580,7 +580,7 @@ static int __allocate_data_block(struct dnode_of_data *dn)
pgoff_t fofs; pgoff_t fofs;
blkcnt_t count = 1; blkcnt_t count = 1;
if (unlikely(is_inode_flag_set(F2FS_I(dn->inode), FI_NO_ALLOC))) if (unlikely(is_inode_flag_set(dn->inode, FI_NO_ALLOC)))
return -EPERM; return -EPERM;
dn->data_blkaddr = datablock_addr(dn->node_page, dn->ofs_in_node); dn->data_blkaddr = datablock_addr(dn->node_page, dn->ofs_in_node);
...@@ -717,8 +717,7 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, ...@@ -717,8 +717,7 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map,
} else { } else {
err = __allocate_data_block(&dn); err = __allocate_data_block(&dn);
if (!err) { if (!err) {
set_inode_flag(F2FS_I(inode), set_inode_flag(inode, FI_APPEND_WRITE);
FI_APPEND_WRITE);
allocated = true; allocated = true;
} }
} }
...@@ -1193,14 +1192,14 @@ int do_write_data_page(struct f2fs_io_info *fio) ...@@ -1193,14 +1192,14 @@ int do_write_data_page(struct f2fs_io_info *fio)
!IS_ATOMIC_WRITTEN_PAGE(page) && !IS_ATOMIC_WRITTEN_PAGE(page) &&
need_inplace_update(inode))) { need_inplace_update(inode))) {
rewrite_data_page(fio); rewrite_data_page(fio);
set_inode_flag(F2FS_I(inode), FI_UPDATE_WRITE); set_inode_flag(inode, FI_UPDATE_WRITE);
trace_f2fs_do_write_data_page(page, IPU); trace_f2fs_do_write_data_page(page, IPU);
} else { } else {
write_data_page(&dn, fio); write_data_page(&dn, fio);
trace_f2fs_do_write_data_page(page, OPU); trace_f2fs_do_write_data_page(page, OPU);
set_inode_flag(F2FS_I(inode), FI_APPEND_WRITE); set_inode_flag(inode, FI_APPEND_WRITE);
if (page->index == 0) if (page->index == 0)
set_inode_flag(F2FS_I(inode), FI_FIRST_BLOCK_WRITTEN); set_inode_flag(inode, FI_FIRST_BLOCK_WRITTEN);
} }
out_writepage: out_writepage:
f2fs_put_dnode(&dn); f2fs_put_dnode(&dn);
...@@ -1469,7 +1468,7 @@ static int f2fs_write_data_pages(struct address_space *mapping, ...@@ -1469,7 +1468,7 @@ static int f2fs_write_data_pages(struct address_space *mapping,
goto skip_write; goto skip_write;
/* skip writing during file defragment */ /* skip writing during file defragment */
if (is_inode_flag_set(F2FS_I(inode), FI_DO_DEFRAG)) if (is_inode_flag_set(inode, FI_DO_DEFRAG))
goto skip_write; goto skip_write;
/* during POR, we don't need to trigger writepage at all. */ /* during POR, we don't need to trigger writepage at all. */
...@@ -1549,7 +1548,7 @@ static int prepare_write_begin(struct f2fs_sb_info *sbi, ...@@ -1549,7 +1548,7 @@ static int prepare_write_begin(struct f2fs_sb_info *sbi,
if (f2fs_has_inline_data(inode)) { if (f2fs_has_inline_data(inode)) {
if (pos + len <= MAX_INLINE_DATA) { if (pos + len <= MAX_INLINE_DATA) {
read_inline_data(page, ipage); read_inline_data(page, ipage);
set_inode_flag(F2FS_I(inode), FI_DATA_EXIST); set_inode_flag(inode, FI_DATA_EXIST);
if (inode->i_nlink) if (inode->i_nlink)
set_inline_node(ipage); set_inline_node(ipage);
} else { } else {
...@@ -1756,7 +1755,7 @@ static ssize_t f2fs_direct_IO(struct kiocb *iocb, struct iov_iter *iter) ...@@ -1756,7 +1755,7 @@ static ssize_t f2fs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
err = blockdev_direct_IO(iocb, inode, iter, get_data_block_dio); err = blockdev_direct_IO(iocb, inode, iter, get_data_block_dio);
if (iov_iter_rw(iter) == WRITE) { if (iov_iter_rw(iter) == WRITE) {
if (err > 0) if (err > 0)
set_inode_flag(F2FS_I(inode), FI_UPDATE_WRITE); set_inode_flag(inode, FI_UPDATE_WRITE);
else if (err < 0) else if (err < 0)
f2fs_write_failed(mapping, offset + count); f2fs_write_failed(mapping, offset + count);
} }
......
...@@ -385,7 +385,7 @@ struct page *init_inode_metadata(struct inode *inode, struct inode *dir, ...@@ -385,7 +385,7 @@ struct page *init_inode_metadata(struct inode *inode, struct inode *dir,
struct page *page; struct page *page;
int err; int err;
if (is_inode_flag_set(F2FS_I(inode), FI_NEW_INODE)) { if (is_inode_flag_set(inode, FI_NEW_INODE)) {
page = new_inode_page(inode); page = new_inode_page(inode);
if (IS_ERR(page)) if (IS_ERR(page))
return page; return page;
...@@ -429,7 +429,7 @@ struct page *init_inode_metadata(struct inode *inode, struct inode *dir, ...@@ -429,7 +429,7 @@ struct page *init_inode_metadata(struct inode *inode, struct inode *dir,
* This file should be checkpointed during fsync. * This file should be checkpointed during fsync.
* We lost i_pino from now on. * We lost i_pino from now on.
*/ */
if (is_inode_flag_set(F2FS_I(inode), FI_INC_LINK)) { if (is_inode_flag_set(inode, FI_INC_LINK)) {
file_lost_pino(inode); file_lost_pino(inode);
/* /*
* If link the tmpfile to alias through linkat path, * If link the tmpfile to alias through linkat path,
...@@ -454,23 +454,23 @@ struct page *init_inode_metadata(struct inode *inode, struct inode *dir, ...@@ -454,23 +454,23 @@ struct page *init_inode_metadata(struct inode *inode, struct inode *dir,
void update_parent_metadata(struct inode *dir, struct inode *inode, void update_parent_metadata(struct inode *dir, struct inode *inode,
unsigned int current_depth) unsigned int current_depth)
{ {
if (inode && is_inode_flag_set(F2FS_I(inode), FI_NEW_INODE)) { if (inode && is_inode_flag_set(inode, FI_NEW_INODE)) {
if (S_ISDIR(inode->i_mode)) { if (S_ISDIR(inode->i_mode)) {
inc_nlink(dir); inc_nlink(dir);
set_inode_flag(F2FS_I(dir), FI_UPDATE_DIR); set_inode_flag(dir, FI_UPDATE_DIR);
} }
clear_inode_flag(F2FS_I(inode), FI_NEW_INODE); clear_inode_flag(inode, FI_NEW_INODE);
} }
dir->i_mtime = dir->i_ctime = CURRENT_TIME; dir->i_mtime = dir->i_ctime = CURRENT_TIME;
mark_inode_dirty(dir); mark_inode_dirty(dir);
if (F2FS_I(dir)->i_current_depth != current_depth) { if (F2FS_I(dir)->i_current_depth != current_depth) {
F2FS_I(dir)->i_current_depth = current_depth; F2FS_I(dir)->i_current_depth = current_depth;
set_inode_flag(F2FS_I(dir), FI_UPDATE_DIR); set_inode_flag(dir, FI_UPDATE_DIR);
} }
if (inode && is_inode_flag_set(F2FS_I(inode), FI_INC_LINK)) if (inode && is_inode_flag_set(inode, FI_INC_LINK))
clear_inode_flag(F2FS_I(inode), FI_INC_LINK); clear_inode_flag(inode, FI_INC_LINK);
} }
int room_for_filename(const void *bitmap, int slots, int max_slots) int room_for_filename(const void *bitmap, int slots, int max_slots)
...@@ -607,9 +607,9 @@ int f2fs_add_regular_entry(struct inode *dir, const struct qstr *new_name, ...@@ -607,9 +607,9 @@ int f2fs_add_regular_entry(struct inode *dir, const struct qstr *new_name,
if (inode) if (inode)
up_write(&F2FS_I(inode)->i_sem); up_write(&F2FS_I(inode)->i_sem);
if (is_inode_flag_set(F2FS_I(dir), FI_UPDATE_DIR)) { if (is_inode_flag_set(dir, FI_UPDATE_DIR)) {
update_inode_page(dir); update_inode_page(dir);
clear_inode_flag(F2FS_I(dir), FI_UPDATE_DIR); clear_inode_flag(dir, FI_UPDATE_DIR);
} }
kunmap(dentry_page); kunmap(dentry_page);
f2fs_put_page(dentry_page, 1); f2fs_put_page(dentry_page, 1);
...@@ -661,7 +661,7 @@ int f2fs_do_tmpfile(struct inode *inode, struct inode *dir) ...@@ -661,7 +661,7 @@ int f2fs_do_tmpfile(struct inode *inode, struct inode *dir)
update_inode(inode, page); update_inode(inode, page);
f2fs_put_page(page, 1); f2fs_put_page(page, 1);
clear_inode_flag(F2FS_I(inode), FI_NEW_INODE); clear_inode_flag(inode, FI_NEW_INODE);
fail: fail:
up_write(&F2FS_I(inode)->i_sem); up_write(&F2FS_I(inode)->i_sem);
f2fs_update_time(F2FS_I_SB(inode), REQ_TIME); f2fs_update_time(F2FS_I_SB(inode), REQ_TIME);
......
...@@ -431,7 +431,7 @@ static unsigned int f2fs_update_extent_tree_range(struct inode *inode, ...@@ -431,7 +431,7 @@ static unsigned int f2fs_update_extent_tree_range(struct inode *inode,
write_lock(&et->lock); write_lock(&et->lock);
if (is_inode_flag_set(F2FS_I(inode), FI_NO_EXTENT)) { if (is_inode_flag_set(inode, FI_NO_EXTENT)) {
write_unlock(&et->lock); write_unlock(&et->lock);
return false; return false;
} }
...@@ -523,11 +523,11 @@ static unsigned int f2fs_update_extent_tree_range(struct inode *inode, ...@@ -523,11 +523,11 @@ static unsigned int f2fs_update_extent_tree_range(struct inode *inode,
prev.len < F2FS_MIN_EXTENT_LEN && prev.len < F2FS_MIN_EXTENT_LEN &&
et->largest.len < F2FS_MIN_EXTENT_LEN) { et->largest.len < F2FS_MIN_EXTENT_LEN) {
et->largest.len = 0; et->largest.len = 0;
set_inode_flag(F2FS_I(inode), FI_NO_EXTENT); set_inode_flag(inode, FI_NO_EXTENT);
} }
} }
if (is_inode_flag_set(F2FS_I(inode), FI_NO_EXTENT)) if (is_inode_flag_set(inode, FI_NO_EXTENT))
__free_extent_tree(sbi, et); __free_extent_tree(sbi, et);
write_unlock(&et->lock); write_unlock(&et->lock);
......
...@@ -1533,64 +1533,62 @@ enum { ...@@ -1533,64 +1533,62 @@ enum {
FI_DIRTY_FILE, /* indicate regular/symlink has dirty pages */ FI_DIRTY_FILE, /* indicate regular/symlink has dirty pages */
}; };
static inline void set_inode_flag(struct f2fs_inode_info *fi, int flag) static inline void set_inode_flag(struct inode *inode, int flag)
{ {
if (!test_bit(flag, &fi->flags)) if (!test_bit(flag, &F2FS_I(inode)->flags))
set_bit(flag, &fi->flags); set_bit(flag, &F2FS_I(inode)->flags);
} }
static inline int is_inode_flag_set(struct f2fs_inode_info *fi, int flag) static inline int is_inode_flag_set(struct inode *inode, int flag)
{ {
return test_bit(flag, &fi->flags); return test_bit(flag, &F2FS_I(inode)->flags);
} }
static inline void clear_inode_flag(struct f2fs_inode_info *fi, int flag) static inline void clear_inode_flag(struct inode *inode, int flag)
{ {
if (test_bit(flag, &fi->flags)) if (test_bit(flag, &F2FS_I(inode)->flags))
clear_bit(flag, &fi->flags); clear_bit(flag, &F2FS_I(inode)->flags);
} }
static inline void set_acl_inode(struct f2fs_inode_info *fi, umode_t mode) static inline void set_acl_inode(struct inode *inode, umode_t mode)
{ {
fi->i_acl_mode = mode; F2FS_I(inode)->i_acl_mode = mode;
set_inode_flag(fi, FI_ACL_MODE); set_inode_flag(inode, FI_ACL_MODE);
} }
static inline void get_inline_info(struct f2fs_inode_info *fi, static inline void get_inline_info(struct inode *inode, struct f2fs_inode *ri)
struct f2fs_inode *ri)
{ {
if (ri->i_inline & F2FS_INLINE_XATTR) if (ri->i_inline & F2FS_INLINE_XATTR)
set_inode_flag(fi, FI_INLINE_XATTR); set_inode_flag(inode, FI_INLINE_XATTR);
if (ri->i_inline & F2FS_INLINE_DATA) if (ri->i_inline & F2FS_INLINE_DATA)
set_inode_flag(fi, FI_INLINE_DATA); set_inode_flag(inode, FI_INLINE_DATA);
if (ri->i_inline & F2FS_INLINE_DENTRY) if (ri->i_inline & F2FS_INLINE_DENTRY)
set_inode_flag(fi, FI_INLINE_DENTRY); set_inode_flag(inode, FI_INLINE_DENTRY);
if (ri->i_inline & F2FS_DATA_EXIST) if (ri->i_inline & F2FS_DATA_EXIST)
set_inode_flag(fi, FI_DATA_EXIST); set_inode_flag(inode, FI_DATA_EXIST);
if (ri->i_inline & F2FS_INLINE_DOTS) if (ri->i_inline & F2FS_INLINE_DOTS)
set_inode_flag(fi, FI_INLINE_DOTS); set_inode_flag(inode, FI_INLINE_DOTS);
} }
static inline void set_raw_inline(struct f2fs_inode_info *fi, static inline void set_raw_inline(struct inode *inode, struct f2fs_inode *ri)
struct f2fs_inode *ri)
{ {
ri->i_inline = 0; ri->i_inline = 0;
if (is_inode_flag_set(fi, FI_INLINE_XATTR)) if (is_inode_flag_set(inode, FI_INLINE_XATTR))
ri->i_inline |= F2FS_INLINE_XATTR; ri->i_inline |= F2FS_INLINE_XATTR;
if (is_inode_flag_set(fi, FI_INLINE_DATA)) if (is_inode_flag_set(inode, FI_INLINE_DATA))
ri->i_inline |= F2FS_INLINE_DATA; ri->i_inline |= F2FS_INLINE_DATA;
if (is_inode_flag_set(fi, FI_INLINE_DENTRY)) if (is_inode_flag_set(inode, FI_INLINE_DENTRY))
ri->i_inline |= F2FS_INLINE_DENTRY; ri->i_inline |= F2FS_INLINE_DENTRY;
if (is_inode_flag_set(fi, FI_DATA_EXIST)) if (is_inode_flag_set(inode, FI_DATA_EXIST))
ri->i_inline |= F2FS_DATA_EXIST; ri->i_inline |= F2FS_DATA_EXIST;
if (is_inode_flag_set(fi, FI_INLINE_DOTS)) if (is_inode_flag_set(inode, FI_INLINE_DOTS))
ri->i_inline |= F2FS_INLINE_DOTS; ri->i_inline |= F2FS_INLINE_DOTS;
} }
static inline int f2fs_has_inline_xattr(struct inode *inode) static inline int f2fs_has_inline_xattr(struct inode *inode)
{ {
return is_inode_flag_set(F2FS_I(inode), FI_INLINE_XATTR); return is_inode_flag_set(inode, FI_INLINE_XATTR);
} }
static inline unsigned int addrs_per_inode(struct inode *inode) static inline unsigned int addrs_per_inode(struct inode *inode)
...@@ -1617,43 +1615,43 @@ static inline int inline_xattr_size(struct inode *inode) ...@@ -1617,43 +1615,43 @@ static inline int inline_xattr_size(struct inode *inode)
static inline int f2fs_has_inline_data(struct inode *inode) static inline int f2fs_has_inline_data(struct inode *inode)
{ {
return is_inode_flag_set(F2FS_I(inode), FI_INLINE_DATA); return is_inode_flag_set(inode, FI_INLINE_DATA);
} }
static inline void f2fs_clear_inline_inode(struct inode *inode) static inline void f2fs_clear_inline_inode(struct inode *inode)
{ {
clear_inode_flag(F2FS_I(inode), FI_INLINE_DATA); clear_inode_flag(inode, FI_INLINE_DATA);
clear_inode_flag(F2FS_I(inode), FI_DATA_EXIST); clear_inode_flag(inode, FI_DATA_EXIST);
} }
static inline int f2fs_exist_data(struct inode *inode) static inline int f2fs_exist_data(struct inode *inode)
{ {
return is_inode_flag_set(F2FS_I(inode), FI_DATA_EXIST); return is_inode_flag_set(inode, FI_DATA_EXIST);
} }
static inline int f2fs_has_inline_dots(struct inode *inode) static inline int f2fs_has_inline_dots(struct inode *inode)
{ {
return is_inode_flag_set(F2FS_I(inode), FI_INLINE_DOTS); return is_inode_flag_set(inode, FI_INLINE_DOTS);
} }
static inline bool f2fs_is_atomic_file(struct inode *inode) static inline bool f2fs_is_atomic_file(struct inode *inode)
{ {
return is_inode_flag_set(F2FS_I(inode), FI_ATOMIC_FILE); return is_inode_flag_set(inode, FI_ATOMIC_FILE);
} }
static inline bool f2fs_is_volatile_file(struct inode *inode) static inline bool f2fs_is_volatile_file(struct inode *inode)
{ {
return is_inode_flag_set(F2FS_I(inode), FI_VOLATILE_FILE); return is_inode_flag_set(inode, FI_VOLATILE_FILE);
} }
static inline bool f2fs_is_first_block_written(struct inode *inode) static inline bool f2fs_is_first_block_written(struct inode *inode)
{ {
return is_inode_flag_set(F2FS_I(inode), FI_FIRST_BLOCK_WRITTEN); return is_inode_flag_set(inode, FI_FIRST_BLOCK_WRITTEN);
} }
static inline bool f2fs_is_drop_cache(struct inode *inode) static inline bool f2fs_is_drop_cache(struct inode *inode)
{ {
return is_inode_flag_set(F2FS_I(inode), FI_DROP_CACHE); return is_inode_flag_set(inode, FI_DROP_CACHE);
} }
static inline void *inline_data_addr(struct page *page) static inline void *inline_data_addr(struct page *page)
...@@ -1664,7 +1662,7 @@ static inline void *inline_data_addr(struct page *page) ...@@ -1664,7 +1662,7 @@ static inline void *inline_data_addr(struct page *page)
static inline int f2fs_has_inline_dentry(struct inode *inode) static inline int f2fs_has_inline_dentry(struct inode *inode)
{ {
return is_inode_flag_set(F2FS_I(inode), FI_INLINE_DENTRY); return is_inode_flag_set(inode, FI_INLINE_DENTRY);
} }
static inline void f2fs_dentry_kunmap(struct inode *dir, struct page *page) static inline void f2fs_dentry_kunmap(struct inode *dir, struct page *page)
...@@ -1712,7 +1710,7 @@ static inline bool is_dot_dotdot(const struct qstr *str) ...@@ -1712,7 +1710,7 @@ static inline bool is_dot_dotdot(const struct qstr *str)
static inline bool f2fs_may_extent_tree(struct inode *inode) static inline bool f2fs_may_extent_tree(struct inode *inode)
{ {
if (!test_opt(F2FS_I_SB(inode), EXTENT_CACHE) || if (!test_opt(F2FS_I_SB(inode), EXTENT_CACHE) ||
is_inode_flag_set(F2FS_I(inode), FI_NO_EXTENT)) is_inode_flag_set(inode, FI_NO_EXTENT))
return false; return false;
return S_ISREG(inode->i_mode); return S_ISREG(inode->i_mode);
...@@ -1748,7 +1746,7 @@ static inline void *f2fs_kvzalloc(size_t size, gfp_t flags) ...@@ -1748,7 +1746,7 @@ static inline void *f2fs_kvzalloc(size_t size, gfp_t flags)
} }
#define get_inode_mode(i) \ #define get_inode_mode(i) \
((is_inode_flag_set(F2FS_I(i), FI_ACL_MODE)) ? \ ((is_inode_flag_set(i, FI_ACL_MODE)) ? \
(F2FS_I(i)->i_acl_mode) : ((i)->i_mode)) (F2FS_I(i)->i_acl_mode) : ((i)->i_mode))
/* get offset of first page in next direct node */ /* get offset of first page in next direct node */
......
...@@ -186,7 +186,6 @@ static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end, ...@@ -186,7 +186,6 @@ static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end,
int datasync, bool atomic) int datasync, bool atomic)
{ {
struct inode *inode = file->f_mapping->host; struct inode *inode = file->f_mapping->host;
struct f2fs_inode_info *fi = F2FS_I(inode);
struct f2fs_sb_info *sbi = F2FS_I_SB(inode); struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
nid_t ino = inode->i_ino; nid_t ino = inode->i_ino;
int ret = 0; int ret = 0;
...@@ -204,9 +203,9 @@ static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end, ...@@ -204,9 +203,9 @@ static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end,
/* if fdatasync is triggered, let's do in-place-update */ /* if fdatasync is triggered, let's do in-place-update */
if (datasync || get_dirty_pages(inode) <= SM_I(sbi)->min_fsync_blocks) if (datasync || get_dirty_pages(inode) <= SM_I(sbi)->min_fsync_blocks)