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 b34702984225..52e4f6ee1e23 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c | |||
@@ -2516,20 +2516,19 @@ out: | |||
2516 | * | 2516 | * |
2517 | * Normally the refcount blocks store these refcount should be | 2517 | * Normally the refcount blocks store these refcount should be |
2518 | * contiguous also, so that we can get the number easily. | 2518 | * contiguous also, so that we can get the number easily. |
2519 | * As for meta_ac, we will at most add split 2 refcount record and | 2519 | * We will at most add split 2 refcount records and 2 more |
2520 | * 2 more refcount block, so just check it in a rough way. | 2520 | * refcount blocks, so just check it in a rough way. |
2521 | * | 2521 | * |
2522 | * Caller must hold refcount tree lock. | 2522 | * Caller must hold refcount tree lock. |
2523 | */ | 2523 | */ |
2524 | int ocfs2_prepare_refcount_change_for_del(struct inode *inode, | 2524 | int ocfs2_prepare_refcount_change_for_del(struct inode *inode, |
2525 | struct buffer_head *di_bh, | 2525 | u64 refcount_loc, |
2526 | u64 phys_blkno, | 2526 | u64 phys_blkno, |
2527 | u32 clusters, | 2527 | u32 clusters, |
2528 | int *credits, | 2528 | int *credits, |
2529 | struct ocfs2_alloc_context **meta_ac) | 2529 | int *ref_blocks) |
2530 | { | 2530 | { |
2531 | int ret, ref_blocks = 0; | 2531 | int ret; |
2532 | struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; | ||
2533 | struct ocfs2_inode_info *oi = OCFS2_I(inode); | 2532 | struct ocfs2_inode_info *oi = OCFS2_I(inode); |
2534 | struct buffer_head *ref_root_bh = NULL; | 2533 | struct buffer_head *ref_root_bh = NULL; |
2535 | struct ocfs2_refcount_tree *tree; | 2534 | struct ocfs2_refcount_tree *tree; |
@@ -2546,14 +2545,13 @@ int ocfs2_prepare_refcount_change_for_del(struct inode *inode, | |||
2546 | BUG_ON(!(oi->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL)); | 2545 | BUG_ON(!(oi->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL)); |
2547 | 2546 | ||
2548 | ret = ocfs2_get_refcount_tree(OCFS2_SB(inode->i_sb), | 2547 | ret = ocfs2_get_refcount_tree(OCFS2_SB(inode->i_sb), |
2549 | le64_to_cpu(di->i_refcount_loc), &tree); | 2548 | refcount_loc, &tree); |
2550 | if (ret) { | 2549 | if (ret) { |
2551 | mlog_errno(ret); | 2550 | mlog_errno(ret); |
2552 | goto out; | 2551 | goto out; |
2553 | } | 2552 | } |
2554 | 2553 | ||
2555 | ret = ocfs2_read_refcount_block(&tree->rf_ci, | 2554 | ret = ocfs2_read_refcount_block(&tree->rf_ci, refcount_loc, |
2556 | le64_to_cpu(di->i_refcount_loc), | ||
2557 | &ref_root_bh); | 2555 | &ref_root_bh); |
2558 | if (ret) { | 2556 | if (ret) { |
2559 | mlog_errno(ret); | 2557 | mlog_errno(ret); |
@@ -2564,21 +2562,14 @@ int ocfs2_prepare_refcount_change_for_del(struct inode *inode, | |||
2564 | &tree->rf_ci, | 2562 | &tree->rf_ci, |
2565 | ref_root_bh, | 2563 | ref_root_bh, |
2566 | start_cpos, clusters, | 2564 | start_cpos, clusters, |
2567 | &ref_blocks, credits); | 2565 | ref_blocks, credits); |
2568 | if (ret) { | 2566 | if (ret) { |
2569 | mlog_errno(ret); | 2567 | mlog_errno(ret); |
2570 | goto out; | 2568 | goto out; |
2571 | } | 2569 | } |
2572 | 2570 | ||
2573 | mlog(0, "reserve new metadata %d, credits = %d\n", | 2571 | mlog(0, "reserve new metadata %d blocks, credits = %d\n", |
2574 | ref_blocks, *credits); | 2572 | *ref_blocks, *credits); |
2575 | |||
2576 | if (ref_blocks) { | ||
2577 | ret = ocfs2_reserve_new_metadata_blocks(OCFS2_SB(inode->i_sb), | ||
2578 | ref_blocks, meta_ac); | ||
2579 | if (ret) | ||
2580 | mlog_errno(ret); | ||
2581 | } | ||
2582 | 2573 | ||
2583 | out: | 2574 | out: |
2584 | brelse(ref_root_bh); | 2575 | brelse(ref_root_bh); |