aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/journal.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2/journal.c')
-rw-r--r--fs/ocfs2/journal.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index 3b54dba0f74b..57d7d25a2b9a 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -415,6 +415,26 @@ static void ocfs2_dq_commit_trigger(struct jbd2_buffer_trigger_type *triggers,
415 ocfs2_block_check_compute(data, size, &dqt->dq_check); 415 ocfs2_block_check_compute(data, size, &dqt->dq_check);
416} 416}
417 417
418/*
419 * Directory blocks also have their own trigger because the
420 * struct ocfs2_block_check offset depends on the blocksize.
421 */
422static void ocfs2_db_commit_trigger(struct jbd2_buffer_trigger_type *triggers,
423 struct buffer_head *bh,
424 void *data, size_t size)
425{
426 struct ocfs2_dir_block_trailer *trailer =
427 ocfs2_dir_trailer_from_size(size, data);
428
429 /*
430 * We aren't guaranteed to have the superblock here, so we
431 * must unconditionally compute the ecc data.
432 * __ocfs2_journal_access() will only set the triggers if
433 * metaecc is enabled.
434 */
435 ocfs2_block_check_compute(data, size, &trailer->db_check);
436}
437
418static void ocfs2_abort_trigger(struct jbd2_buffer_trigger_type *triggers, 438static void ocfs2_abort_trigger(struct jbd2_buffer_trigger_type *triggers,
419 struct buffer_head *bh) 439 struct buffer_head *bh)
420{ 440{
@@ -454,6 +474,13 @@ static struct ocfs2_triggers gd_triggers = {
454 .ot_offset = offsetof(struct ocfs2_group_desc, bg_check), 474 .ot_offset = offsetof(struct ocfs2_group_desc, bg_check),
455}; 475};
456 476
477static struct ocfs2_triggers db_triggers = {
478 .ot_triggers = {
479 .t_commit = ocfs2_db_commit_trigger,
480 .t_abort = ocfs2_abort_trigger,
481 },
482};
483
457static struct ocfs2_triggers xb_triggers = { 484static struct ocfs2_triggers xb_triggers = {
458 .ot_triggers = { 485 .ot_triggers = {
459 .t_commit = ocfs2_commit_trigger, 486 .t_commit = ocfs2_commit_trigger,
@@ -555,8 +582,8 @@ int ocfs2_journal_access_gd(handle_t *handle, struct inode *inode,
555int ocfs2_journal_access_db(handle_t *handle, struct inode *inode, 582int ocfs2_journal_access_db(handle_t *handle, struct inode *inode,
556 struct buffer_head *bh, int type) 583 struct buffer_head *bh, int type)
557{ 584{
558 /* Right now, nothing for dirblocks */ 585 return __ocfs2_journal_access(handle, inode, bh, &db_triggers,
559 return __ocfs2_journal_access(handle, inode, bh, NULL, type); 586 type);
560} 587}
561 588
562int ocfs2_journal_access_xb(handle_t *handle, struct inode *inode, 589int ocfs2_journal_access_xb(handle_t *handle, struct inode *inode,