aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChao Yu <chao2.yu@samsung.com>2014-03-17 04:35:06 -0400
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2014-03-17 20:29:46 -0400
commit4bc8e9bcf50103216a7a316ab66b9bb8e81baa27 (patch)
tree5ad730ee7f19734aa11ae9a55ec025727115251e /fs
parent90aa6dc9b9dd9b3ee832bb6e91e2d8ba8ebb93b6 (diff)
f2fs: introduce f2fs_has_xattr_block for better readability
This patch introduces a help function f2fs_has_xattr_block for better readability. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/f2fs/f2fs.h5
-rw-r--r--fs/f2fs/node.c4
-rw-r--r--fs/f2fs/node.h2
3 files changed, 8 insertions, 3 deletions
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 1f87a04f1441..292cc3c25b28 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -637,6 +637,11 @@ static inline int F2FS_HAS_BLOCKS(struct inode *inode)
637 return inode->i_blocks > F2FS_DEFAULT_ALLOCATED_BLOCKS; 637 return inode->i_blocks > F2FS_DEFAULT_ALLOCATED_BLOCKS;
638} 638}
639 639
640static inline bool f2fs_has_xattr_block(unsigned int ofs)
641{
642 return ofs == XATTR_NODE_OFFSET;
643}
644
640static inline bool inc_valid_block_count(struct f2fs_sb_info *sbi, 645static inline bool inc_valid_block_count(struct f2fs_sb_info *sbi,
641 struct inode *inode, blkcnt_t count) 646 struct inode *inode, blkcnt_t count)
642{ 647{
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index c618fad3e6c3..3e36240d81c1 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -836,7 +836,7 @@ struct page *new_node_page(struct dnode_of_data *dn,
836 SetPageUptodate(page); 836 SetPageUptodate(page);
837 set_page_dirty(page); 837 set_page_dirty(page);
838 838
839 if (ofs == XATTR_NODE_OFFSET) 839 if (f2fs_has_xattr_block(ofs))
840 F2FS_I(dn->inode)->i_xattr_nid = dn->nid; 840 F2FS_I(dn->inode)->i_xattr_nid = dn->nid;
841 841
842 dn->node_page = page; 842 dn->node_page = page;
@@ -1533,7 +1533,7 @@ bool recover_xattr_data(struct inode *inode, struct page *page, block_t blkaddr)
1533 1533
1534 recover_inline_xattr(inode, page); 1534 recover_inline_xattr(inode, page);
1535 1535
1536 if (ofs_of_node(page) != XATTR_NODE_OFFSET) 1536 if (!f2fs_has_xattr_block(ofs_of_node(page)))
1537 return false; 1537 return false;
1538 1538
1539 /* 1: invalidate the previous xattr nid */ 1539 /* 1: invalidate the previous xattr nid */
diff --git a/fs/f2fs/node.h b/fs/f2fs/node.h
index 4dea719766ef..ee6d28684ee8 100644
--- a/fs/f2fs/node.h
+++ b/fs/f2fs/node.h
@@ -242,7 +242,7 @@ static inline bool IS_DNODE(struct page *node_page)
242{ 242{
243 unsigned int ofs = ofs_of_node(node_page); 243 unsigned int ofs = ofs_of_node(node_page);
244 244
245 if (ofs == XATTR_NODE_OFFSET) 245 if (f2fs_has_xattr_block(ofs))
246 return false; 246 return false;
247 247
248 if (ofs == 3 || ofs == 4 + NIDS_PER_BLOCK || 248 if (ofs == 3 || ofs == 4 + NIDS_PER_BLOCK ||