ocfs2: convert inode refcount test to a helper
Replace the open-coded inode refcount flag test with a helper function to reduce the potential for bugs. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
This commit is contained in:
@@ -1030,7 +1030,7 @@ int ocfs2_extend_no_holes(struct inode *inode, struct buffer_head *di_bh,
|
||||
* Only quota files call this without a bh, and they can't be
|
||||
* refcounted.
|
||||
*/
|
||||
BUG_ON(!di_bh && (oi->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL));
|
||||
BUG_ON(!di_bh && ocfs2_is_refcount_inode(inode));
|
||||
BUG_ON(!di_bh && !(oi->ip_flags & OCFS2_INODE_SYSTEM_FILE));
|
||||
|
||||
clusters_to_add = ocfs2_clusters_for_bytes(inode->i_sb, new_i_size);
|
||||
@@ -1719,8 +1719,7 @@ static int ocfs2_remove_inode_range(struct inode *inode,
|
||||
* within one cluster(means is not exactly aligned to clustersize).
|
||||
*/
|
||||
|
||||
if (OCFS2_I(inode)->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL) {
|
||||
|
||||
if (ocfs2_is_refcount_inode(inode)) {
|
||||
ret = ocfs2_cow_file_pos(inode, di_bh, byte_start);
|
||||
if (ret) {
|
||||
mlog_errno(ret);
|
||||
@@ -2036,7 +2035,7 @@ int ocfs2_check_range_for_refcount(struct inode *inode, loff_t pos,
|
||||
struct super_block *sb = inode->i_sb;
|
||||
|
||||
if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb)) ||
|
||||
!(OCFS2_I(inode)->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL) ||
|
||||
!ocfs2_is_refcount_inode(inode) ||
|
||||
OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL)
|
||||
return 0;
|
||||
|
||||
|
Reference in New Issue
Block a user