aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/jbd2.h
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2008-07-11 19:27:31 -0400
committerTheodore Ts'o <tytso@mit.edu>2008-07-11 19:27:31 -0400
commitc851ed540173736e60d48b53b91a16ea5c903896 (patch)
tree828fe0d71b7f18dc170090dbb2fb5ac9deae4ee0 /include/linux/jbd2.h
parentf4c0a0fdfae708f7aa438c27a380ed4071294e11 (diff)
jbd2: Implement data=ordered mode handling via inodes
This patch adds necessary framework into JBD2 to be able to track inodes with each transaction and write-out their dirty data during transaction commit time. This new ordered mode brings all sorts of advantages such as possibility to get rid of journal heads and buffer heads for data buffers in ordered mode, better ordering of writes on transaction commit, simplification of some JBD code, no more anonymous pages when truncate of data being committed happens. Also with this new ordered mode, delayed allocation on ordered mode is much simpler. Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'include/linux/jbd2.h')
-rw-r--r--include/linux/jbd2.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index ec9cadf58227..622c3d8ca4ed 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -381,6 +381,38 @@ static inline void jbd_unlock_bh_journal_head(struct buffer_head *bh)
381 bit_spin_unlock(BH_JournalHead, &bh->b_state); 381 bit_spin_unlock(BH_JournalHead, &bh->b_state);
382} 382}
383 383
384/* Flags in jbd_inode->i_flags */
385#define __JI_COMMIT_RUNNING 0
386/* Commit of the inode data in progress. We use this flag to protect us from
387 * concurrent deletion of inode. We cannot use reference to inode for this
388 * since we cannot afford doing last iput() on behalf of kjournald
389 */
390#define JI_COMMIT_RUNNING (1 << __JI_COMMIT_RUNNING)
391
392/**
393 * struct jbd_inode is the structure linking inodes in ordered mode
394 * present in a transaction so that we can sync them during commit.
395 */
396struct jbd2_inode {
397 /* Which transaction does this inode belong to? Either the running
398 * transaction or the committing one. [j_list_lock] */
399 transaction_t *i_transaction;
400
401 /* Pointer to the running transaction modifying inode's data in case
402 * there is already a committing transaction touching it. [j_list_lock] */
403 transaction_t *i_next_transaction;
404
405 /* List of inodes in the i_transaction [j_list_lock] */
406 struct list_head i_list;
407
408 /* VFS inode this inode belongs to [constant during the lifetime
409 * of the structure] */
410 struct inode *i_vfs_inode;
411
412 /* Flags of inode [j_list_lock] */
413 unsigned int i_flags;
414};
415
384struct jbd2_revoke_table_s; 416struct jbd2_revoke_table_s;
385 417
386/** 418/**
@@ -567,6 +599,12 @@ struct transaction_s
567 struct journal_head *t_log_list; 599 struct journal_head *t_log_list;
568 600
569 /* 601 /*
602 * List of inodes whose data we've modified in data=ordered mode.
603 * [j_list_lock]
604 */
605 struct list_head t_inode_list;
606
607 /*
570 * Protects info related to handles 608 * Protects info related to handles
571 */ 609 */
572 spinlock_t t_handle_lock; 610 spinlock_t t_handle_lock;
@@ -1046,6 +1084,10 @@ extern void jbd2_journal_ack_err (journal_t *);
1046extern int jbd2_journal_clear_err (journal_t *); 1084extern int jbd2_journal_clear_err (journal_t *);
1047extern int jbd2_journal_bmap(journal_t *, unsigned long, unsigned long long *); 1085extern int jbd2_journal_bmap(journal_t *, unsigned long, unsigned long long *);
1048extern int jbd2_journal_force_commit(journal_t *); 1086extern int jbd2_journal_force_commit(journal_t *);
1087extern int jbd2_journal_file_inode(handle_t *handle, struct jbd2_inode *inode);
1088extern int jbd2_journal_begin_ordered_truncate(struct jbd2_inode *inode, loff_t new_size);
1089extern void jbd2_journal_init_jbd_inode(struct jbd2_inode *jinode, struct inode *inode);
1090extern void jbd2_journal_release_jbd_inode(journal_t *journal, struct jbd2_inode *jinode);
1049 1091
1050/* 1092/*
1051 * journal_head management 1093 * journal_head management