@@ -410,7 +410,7 @@ static int ocfs2_get_refcount_block(struct inode *inode, u64 *ref_blkno)
410
410
goto out ;
411
411
}
412
412
413
- BUG_ON (!( OCFS2_I ( inode ) -> ip_dyn_features & OCFS2_HAS_REFCOUNT_FL ));
413
+ BUG_ON (!ocfs2_is_refcount_inode ( inode ));
414
414
415
415
di = (struct ocfs2_dinode * )di_bh -> b_data ;
416
416
* ref_blkno = le64_to_cpu (di -> i_refcount_loc );
@@ -570,7 +570,7 @@ static int ocfs2_create_refcount_tree(struct inode *inode,
570
570
u32 num_got ;
571
571
u64 suballoc_loc , first_blkno ;
572
572
573
- BUG_ON (oi -> ip_dyn_features & OCFS2_HAS_REFCOUNT_FL );
573
+ BUG_ON (ocfs2_is_refcount_inode ( inode ) );
574
574
575
575
trace_ocfs2_create_refcount_tree (
576
576
(unsigned long long )OCFS2_I (inode )-> ip_blkno );
@@ -708,7 +708,7 @@ static int ocfs2_set_refcount_tree(struct inode *inode,
708
708
struct ocfs2_refcount_block * rb ;
709
709
struct ocfs2_refcount_tree * ref_tree ;
710
710
711
- BUG_ON (oi -> ip_dyn_features & OCFS2_HAS_REFCOUNT_FL );
711
+ BUG_ON (ocfs2_is_refcount_inode ( inode ) );
712
712
713
713
ret = ocfs2_lock_refcount_tree (osb , refcount_loc , 1 ,
714
714
& ref_tree , & ref_root_bh );
@@ -775,7 +775,7 @@ int ocfs2_remove_refcount_tree(struct inode *inode, struct buffer_head *di_bh)
775
775
u64 blk = 0 , bg_blkno = 0 , ref_blkno = le64_to_cpu (di -> i_refcount_loc );
776
776
u16 bit = 0 ;
777
777
778
- if (!( oi -> ip_dyn_features & OCFS2_HAS_REFCOUNT_FL ))
778
+ if (!ocfs2_is_refcount_inode ( inode ))
779
779
return 0 ;
780
780
781
781
BUG_ON (!ref_blkno );
@@ -2299,11 +2299,10 @@ int ocfs2_decrease_refcount(struct inode *inode,
2299
2299
{
2300
2300
int ret ;
2301
2301
u64 ref_blkno ;
2302
- struct ocfs2_inode_info * oi = OCFS2_I (inode );
2303
2302
struct buffer_head * ref_root_bh = NULL ;
2304
2303
struct ocfs2_refcount_tree * tree ;
2305
2304
2306
- BUG_ON (!( oi -> ip_dyn_features & OCFS2_HAS_REFCOUNT_FL ));
2305
+ BUG_ON (!ocfs2_is_refcount_inode ( inode ));
2307
2306
2308
2307
ret = ocfs2_get_refcount_block (inode , & ref_blkno );
2309
2308
if (ret ) {
@@ -2533,7 +2532,6 @@ int ocfs2_prepare_refcount_change_for_del(struct inode *inode,
2533
2532
int * ref_blocks )
2534
2533
{
2535
2534
int ret ;
2536
- struct ocfs2_inode_info * oi = OCFS2_I (inode );
2537
2535
struct buffer_head * ref_root_bh = NULL ;
2538
2536
struct ocfs2_refcount_tree * tree ;
2539
2537
u64 start_cpos = ocfs2_blocks_to_clusters (inode -> i_sb , phys_blkno );
@@ -2544,7 +2542,7 @@ int ocfs2_prepare_refcount_change_for_del(struct inode *inode,
2544
2542
goto out ;
2545
2543
}
2546
2544
2547
- BUG_ON (!( oi -> ip_dyn_features & OCFS2_HAS_REFCOUNT_FL ));
2545
+ BUG_ON (!ocfs2_is_refcount_inode ( inode ));
2548
2546
2549
2547
ret = ocfs2_get_refcount_tree (OCFS2_SB (inode -> i_sb ),
2550
2548
refcount_loc , & tree );
@@ -3412,14 +3410,13 @@ static int ocfs2_refcount_cow_hunk(struct inode *inode,
3412
3410
{
3413
3411
int ret ;
3414
3412
u32 cow_start = 0 , cow_len = 0 ;
3415
- struct ocfs2_inode_info * oi = OCFS2_I (inode );
3416
3413
struct ocfs2_super * osb = OCFS2_SB (inode -> i_sb );
3417
3414
struct ocfs2_dinode * di = (struct ocfs2_dinode * )di_bh -> b_data ;
3418
3415
struct buffer_head * ref_root_bh = NULL ;
3419
3416
struct ocfs2_refcount_tree * ref_tree ;
3420
3417
struct ocfs2_cow_context * context = NULL ;
3421
3418
3422
- BUG_ON (!( oi -> ip_dyn_features & OCFS2_HAS_REFCOUNT_FL ));
3419
+ BUG_ON (!ocfs2_is_refcount_inode ( inode ));
3423
3420
3424
3421
ret = ocfs2_refcount_cal_cow_clusters (inode , & di -> id2 .i_list ,
3425
3422
cpos , write_len , max_cpos ,
@@ -3629,11 +3626,10 @@ int ocfs2_refcount_cow_xattr(struct inode *inode,
3629
3626
{
3630
3627
int ret ;
3631
3628
struct ocfs2_xattr_value_root * xv = vb -> vb_xv ;
3632
- struct ocfs2_inode_info * oi = OCFS2_I (inode );
3633
3629
struct ocfs2_cow_context * context = NULL ;
3634
3630
u32 cow_start , cow_len ;
3635
3631
3636
- BUG_ON (!( oi -> ip_dyn_features & OCFS2_HAS_REFCOUNT_FL ));
3632
+ BUG_ON (!ocfs2_is_refcount_inode ( inode ));
3637
3633
3638
3634
ret = ocfs2_refcount_cal_cow_clusters (inode , & xv -> xr_list ,
3639
3635
cpos , write_len , UINT_MAX ,
@@ -3807,7 +3803,7 @@ static int ocfs2_attach_refcount_tree(struct inode *inode,
3807
3803
3808
3804
ocfs2_init_dealloc_ctxt (& dealloc );
3809
3805
3810
- if (!( oi -> ip_dyn_features & OCFS2_HAS_REFCOUNT_FL )) {
3806
+ if (!ocfs2_is_refcount_inode ( inode )) {
3811
3807
ret = ocfs2_create_refcount_tree (inode , di_bh );
3812
3808
if (ret ) {
3813
3809
mlog_errno (ret );
0 commit comments