diff options
Diffstat (limited to 'fs/ocfs2/refcounttree.c')
-rw-r--r-- | fs/ocfs2/refcounttree.c | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index 33dd2a18cb74..6fab28921f3d 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c | |||
@@ -2509,20 +2509,19 @@ out: | |||
2509 | * | 2509 | * |
2510 | * Normally the refcount blocks store these refcount should be | 2510 | * Normally the refcount blocks store these refcount should be |
2511 | * contiguous also, so that we can get the number easily. | 2511 | * contiguous also, so that we can get the number easily. |
2512 | * As for meta_ac, we will at most add split 2 refcount record and | 2512 | * We will at most add split 2 refcount records and 2 more |
2513 | * 2 more refcount block, so just check it in a rough way. | 2513 | * refcount blocks, so just check it in a rough way. |
2514 | * | 2514 | * |
2515 | * Caller must hold refcount tree lock. | 2515 | * Caller must hold refcount tree lock. |
2516 | */ | 2516 | */ |
2517 | int ocfs2_prepare_refcount_change_for_del(struct inode *inode, | 2517 | int ocfs2_prepare_refcount_change_for_del(struct inode *inode, |
2518 | struct buffer_head *di_bh, | 2518 | u64 refcount_loc, |
2519 | u64 phys_blkno, | 2519 | u64 phys_blkno, |
2520 | u32 clusters, | 2520 | u32 clusters, |
2521 | int *credits, | 2521 | int *credits, |
2522 | struct ocfs2_alloc_context **meta_ac) | 2522 | int *ref_blocks) |
2523 | { | 2523 | { |
2524 | int ret, ref_blocks = 0; | 2524 | int ret; |
2525 | struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; | ||
2526 | struct ocfs2_inode_info *oi = OCFS2_I(inode); | 2525 | struct ocfs2_inode_info *oi = OCFS2_I(inode); |
2527 | struct buffer_head *ref_root_bh = NULL; | 2526 | struct buffer_head *ref_root_bh = NULL; |
2528 | struct ocfs2_refcount_tree *tree; | 2527 | struct ocfs2_refcount_tree *tree; |
@@ -2539,14 +2538,13 @@ int ocfs2_prepare_refcount_change_for_del(struct inode *inode, | |||
2539 | BUG_ON(!(oi->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL)); | 2538 | BUG_ON(!(oi->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL)); |
2540 | 2539 | ||
2541 | ret = ocfs2_get_refcount_tree(OCFS2_SB(inode->i_sb), | 2540 | ret = ocfs2_get_refcount_tree(OCFS2_SB(inode->i_sb), |
2542 | le64_to_cpu(di->i_refcount_loc), &tree); | 2541 | refcount_loc, &tree); |
2543 | if (ret) { | 2542 | if (ret) { |
2544 | mlog_errno(ret); | 2543 | mlog_errno(ret); |
2545 | goto out; | 2544 | goto out; |
2546 | } | 2545 | } |
2547 | 2546 | ||
2548 | ret = ocfs2_read_refcount_block(&tree->rf_ci, | 2547 | ret = ocfs2_read_refcount_block(&tree->rf_ci, refcount_loc, |
2549 | le64_to_cpu(di->i_refcount_loc), | ||
2550 | &ref_root_bh); | 2548 | &ref_root_bh); |
2551 | if (ret) { | 2549 | if (ret) { |
2552 | mlog_errno(ret); | 2550 | mlog_errno(ret); |
@@ -2557,21 +2555,14 @@ int ocfs2_prepare_refcount_change_for_del(struct inode *inode, | |||
2557 | &tree->rf_ci, | 2555 | &tree->rf_ci, |
2558 | ref_root_bh, | 2556 | ref_root_bh, |
2559 | start_cpos, clusters, | 2557 | start_cpos, clusters, |
2560 | &ref_blocks, credits); | 2558 | ref_blocks, credits); |
2561 | if (ret) { | 2559 | if (ret) { |
2562 | mlog_errno(ret); | 2560 | mlog_errno(ret); |
2563 | goto out; | 2561 | goto out; |
2564 | } | 2562 | } |
2565 | 2563 | ||
2566 | mlog(0, "reserve new metadata %d, credits = %d\n", | 2564 | mlog(0, "reserve new metadata %d blocks, credits = %d\n", |
2567 | ref_blocks, *credits); | 2565 | *ref_blocks, *credits); |
2568 | |||
2569 | if (ref_blocks) { | ||
2570 | ret = ocfs2_reserve_new_metadata_blocks(OCFS2_SB(inode->i_sb), | ||
2571 | ref_blocks, meta_ac); | ||
2572 | if (ret) | ||
2573 | mlog_errno(ret); | ||
2574 | } | ||
2575 | 2566 | ||
2576 | out: | 2567 | out: |
2577 | brelse(ref_root_bh); | 2568 | brelse(ref_root_bh); |