f2fs: introduce f2fs_has_xattr_block for better readability
Subsystems (2)
PATCH 1/2 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 <[email protected]>
--- fs/f2fs/f2fs.h | 5 +++++ fs/f2fs/node.c | 4 ++-- fs/f2fs/node.h | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-)
fs/f2fs/f2fs.h +5 -0
@@ -637,6 +637,11 @@ static inline int F2FS_HAS_BLOCKS(struct inode *inode)return inode->i_blocks >F2FS_DEFAULT_ALLOCATED_BLOCKS ; } +static inline bool f2fs_has_xattr_block (unsigned int ofs) +{ +return ofs ==XATTR_NODE_OFFSET ; +} +static inline bool inc_valid_block_count (struct f2fs_sb_info *sbi,struct inode *inode,blkcnt_t count) {
fs/f2fs/node.c +2 -2
@@ -836,7 +836,7 @@ struct page *new_node_page(struct dnode_of_data *dn,SetPageUptodate (page);set_page_dirty (page); -if (ofs ==XATTR_NODE_OFFSET ) +if (f2fs_has_xattr_block (ofs))F2FS_I (dn->inode)->i_xattr_nid = dn->nid; dn->node_page = page;
@@ -1533,7 +1533,7 @@ bool recover_xattr_data(struct inode *inode, struct page *page, block_t blkaddr)recover_inline_xattr (inode, page); -if (ofs_of_node (page) !=XATTR_NODE_OFFSET ) +if (!f2fs_has_xattr_block (ofs_of_node (page)))return false;/* 1: invalidate the previous xattr nid */
fs/f2fs/node.h +1 -1
@@ -242,7 +242,7 @@ static inline bool IS_DNODE(struct page *node_page) {unsigned int ofs =ofs_of_node (node_page); -if (ofs ==XATTR_NODE_OFFSET ) +if (f2fs_has_xattr_block (ofs))return false; if (ofs == 3 || ofs == 4 + NIDS_PER_BLOCK ||
Signature · 10 lines
1.7.9.5 ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/13534_NeoTech