aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/journal.h
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2010-03-25 22:09:29 -0400
committerTao Ma <tao.ma@oracle.com>2010-03-25 22:09:29 -0400
commit8b06bc592ebc5a31e8d0b9c2ab17c6e78dde1f86 (patch)
treeb05dc205b03329aa3e0c0963b76317fc91973a04 /fs/ocfs2/journal.h
parent2b6cb576aa80611f1f6a3c88708d1e68a8d97985 (diff)
ocfs2: Grow discontig block groups in one transaction.
Rather than extending the transaction every time we add an extent to a discontiguous block group, we grab enough credits to fill the extent list up front. This means we can free the bits in the same transaction if we end up not getting enough space. Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/journal.h')
-rw-r--r--fs/ocfs2/journal.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h
index 7dc56561c9ae..b5baaa8e710f 100644
--- a/fs/ocfs2/journal.h
+++ b/fs/ocfs2/journal.h
@@ -561,6 +561,18 @@ static inline int ocfs2_calc_group_alloc_credits(struct super_block *sb,
561 return blocks; 561 return blocks;
562} 562}
563 563
564/*
565 * Allocating a discontiguous block group requires the credits from
566 * ocfs2_calc_group_alloc_credits() as well as enough credits to fill
567 * the group descriptor's extent list. The caller already has started
568 * the transaction with ocfs2_calc_group_alloc_credits(). They extend
569 * it with these credits.
570 */
571static inline int ocfs2_calc_bg_discontig_credits(struct super_block *sb)
572{
573 return ocfs2_extent_recs_per_gd(sb);
574}
575
564static inline int ocfs2_calc_tree_trunc_credits(struct super_block *sb, 576static inline int ocfs2_calc_tree_trunc_credits(struct super_block *sb,
565 unsigned int clusters_to_del, 577 unsigned int clusters_to_del,
566 struct ocfs2_dinode *fe, 578 struct ocfs2_dinode *fe,