aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/ocfs2/journal.h13
-rw-r--r--fs/ocfs2/quota_global.c18
-rw-r--r--fs/ocfs2/quota_local.c16
3 files changed, 35 insertions, 12 deletions
diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h
index 81e8abcd246e..4a4d3b55fd22 100644
--- a/fs/ocfs2/journal.h
+++ b/fs/ocfs2/journal.h
@@ -330,20 +330,27 @@ int ocfs2_journal_dirty(handle_t *handle,
330/* extended attribute block update */ 330/* extended attribute block update */
331#define OCFS2_XATTR_BLOCK_UPDATE_CREDITS 1 331#define OCFS2_XATTR_BLOCK_UPDATE_CREDITS 1
332 332
333/* Update of a single quota block */
334#define OCFS2_QUOTA_BLOCK_UPDATE_CREDITS 1
335
333/* global quotafile inode update, data block */ 336/* global quotafile inode update, data block */
334#define OCFS2_QINFO_WRITE_CREDITS (OCFS2_INODE_UPDATE_CREDITS + 1) 337#define OCFS2_QINFO_WRITE_CREDITS (OCFS2_INODE_UPDATE_CREDITS + \
338 OCFS2_QUOTA_BLOCK_UPDATE_CREDITS)
335 339
340#define OCFS2_LOCAL_QINFO_WRITE_CREDITS OCFS2_QUOTA_BLOCK_UPDATE_CREDITS
336/* 341/*
337 * The two writes below can accidentally see global info dirty due 342 * The two writes below can accidentally see global info dirty due
338 * to set_info() quotactl so make them prepared for the writes. 343 * to set_info() quotactl so make them prepared for the writes.
339 */ 344 */
340/* quota data block, global info */ 345/* quota data block, global info */
341/* Write to local quota file */ 346/* Write to local quota file */
342#define OCFS2_QWRITE_CREDITS (OCFS2_QINFO_WRITE_CREDITS + 1) 347#define OCFS2_QWRITE_CREDITS (OCFS2_QINFO_WRITE_CREDITS + \
348 OCFS2_QUOTA_BLOCK_UPDATE_CREDITS)
343 349
344/* global quota data block, local quota data block, global quota inode, 350/* global quota data block, local quota data block, global quota inode,
345 * global quota info */ 351 * global quota info */
346#define OCFS2_QSYNC_CREDITS (OCFS2_INODE_UPDATE_CREDITS + 3) 352#define OCFS2_QSYNC_CREDITS (OCFS2_QINFO_WRITE_CREDITS + \
353 2 * OCFS2_QUOTA_BLOCK_UPDATE_CREDITS)
347 354
348static inline int ocfs2_quota_trans_credits(struct super_block *sb) 355static inline int ocfs2_quota_trans_credits(struct super_block *sb)
349{ 356{
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c
index dab45467b5fd..cc8785cf8f61 100644
--- a/fs/ocfs2/quota_global.c
+++ b/fs/ocfs2/quota_global.c
@@ -648,10 +648,15 @@ int ocfs2_calc_qdel_credits(struct super_block *sb, int type)
648 return 0; 648 return 0;
649 649
650 oinfo = sb_dqinfo(sb, type)->dqi_priv; 650 oinfo = sb_dqinfo(sb, type)->dqi_priv;
651 /* We modify tree, leaf block, global info, local chunk header, 651 /*
652 * global and local inode */ 652 * We modify tree, leaf block, global info, local chunk header,
653 return oinfo->dqi_gi.dqi_qtree_depth + 2 + 1 + 653 * global and local inode; OCFS2_QINFO_WRITE_CREDITS already
654 2 * OCFS2_INODE_UPDATE_CREDITS; 654 * accounts for inode update
655 */
656 return oinfo->dqi_gi.dqi_qtree_depth +
657 OCFS2_QINFO_WRITE_CREDITS +
658 2 * OCFS2_QUOTA_BLOCK_UPDATE_CREDITS +
659 OCFS2_INODE_UPDATE_CREDITS;
655} 660}
656 661
657static int ocfs2_release_dquot(struct dquot *dquot) 662static int ocfs2_release_dquot(struct dquot *dquot)
@@ -701,7 +706,10 @@ int ocfs2_calc_qinit_credits(struct super_block *sb, int type)
701 * global file we can modify info, tree and leaf block */ 706 * global file we can modify info, tree and leaf block */
702 return ocfs2_calc_extend_credits(sb, &lfe->id2.i_list, 0) + 707 return ocfs2_calc_extend_credits(sb, &lfe->id2.i_list, 0) +
703 ocfs2_calc_extend_credits(sb, &gfe->id2.i_list, 0) + 708 ocfs2_calc_extend_credits(sb, &gfe->id2.i_list, 0) +
704 3 + oinfo->dqi_gi.dqi_qtree_depth + 2; 709 OCFS2_LOCAL_QINFO_WRITE_CREDITS +
710 2 * OCFS2_QUOTA_BLOCK_UPDATE_CREDITS +
711 oinfo->dqi_gi.dqi_qtree_depth +
712 2 * OCFS2_QUOTA_BLOCK_UPDATE_CREDITS;
705} 713}
706 714
707static int ocfs2_acquire_dquot(struct dquot *dquot) 715static int ocfs2_acquire_dquot(struct dquot *dquot)
diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c
index 9d2993de1082..bdb09cb6e1fe 100644
--- a/fs/ocfs2/quota_local.c
+++ b/fs/ocfs2/quota_local.c
@@ -101,7 +101,8 @@ static int ocfs2_modify_bh(struct inode *inode, struct buffer_head *bh,
101 handle_t *handle; 101 handle_t *handle;
102 int status; 102 int status;
103 103
104 handle = ocfs2_start_trans(OCFS2_SB(sb), 1); 104 handle = ocfs2_start_trans(OCFS2_SB(sb),
105 OCFS2_QUOTA_BLOCK_UPDATE_CREDITS);
105 if (IS_ERR(handle)) { 106 if (IS_ERR(handle)) {
106 status = PTR_ERR(handle); 107 status = PTR_ERR(handle);
107 mlog_errno(status); 108 mlog_errno(status);
@@ -611,7 +612,8 @@ int ocfs2_finish_quota_recovery(struct ocfs2_super *osb,
611 goto out_bh; 612 goto out_bh;
612 /* Mark quota file as clean if we are recovering quota file of 613 /* Mark quota file as clean if we are recovering quota file of
613 * some other node. */ 614 * some other node. */
614 handle = ocfs2_start_trans(osb, 1); 615 handle = ocfs2_start_trans(osb,
616 OCFS2_LOCAL_QINFO_WRITE_CREDITS);
615 if (IS_ERR(handle)) { 617 if (IS_ERR(handle)) {
616 status = PTR_ERR(handle); 618 status = PTR_ERR(handle);
617 mlog_errno(status); 619 mlog_errno(status);
@@ -965,7 +967,10 @@ static struct ocfs2_quota_chunk *ocfs2_local_quota_add_chunk(
965 mlog_errno(status); 967 mlog_errno(status);
966 goto out; 968 goto out;
967 } 969 }
968 handle = ocfs2_start_trans(OCFS2_SB(sb), 3); 970 /* Local quota info and two new blocks we initialize */
971 handle = ocfs2_start_trans(OCFS2_SB(sb),
972 OCFS2_LOCAL_QINFO_WRITE_CREDITS +
973 2 * OCFS2_QUOTA_BLOCK_UPDATE_CREDITS);
969 if (IS_ERR(handle)) { 974 if (IS_ERR(handle)) {
970 status = PTR_ERR(handle); 975 status = PTR_ERR(handle);
971 mlog_errno(status); 976 mlog_errno(status);
@@ -1128,7 +1133,10 @@ static struct ocfs2_quota_chunk *ocfs2_extend_local_quota_file(
1128 } 1133 }
1129 ocfs2_set_new_buffer_uptodate(lqinode, bh); 1134 ocfs2_set_new_buffer_uptodate(lqinode, bh);
1130 1135
1131 handle = ocfs2_start_trans(OCFS2_SB(sb), 3); 1136 /* Local quota info, chunk header and the new block we initialize */
1137 handle = ocfs2_start_trans(OCFS2_SB(sb),
1138 OCFS2_LOCAL_QINFO_WRITE_CREDITS +
1139 2 * OCFS2_QUOTA_BLOCK_UPDATE_CREDITS);
1132 if (IS_ERR(handle)) { 1140 if (IS_ERR(handle)) {
1133 status = PTR_ERR(handle); 1141 status = PTR_ERR(handle);
1134 mlog_errno(status); 1142 mlog_errno(status);