aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/jbd2.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/jbd2.h')
-rw-r--r--include/linux/jbd2.h73
1 files changed, 51 insertions, 22 deletions
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index d147f0f90360..3dd209007098 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -168,6 +168,8 @@ struct commit_header {
168 unsigned char h_chksum_size; 168 unsigned char h_chksum_size;
169 unsigned char h_padding[2]; 169 unsigned char h_padding[2];
170 __be32 h_chksum[JBD2_CHECKSUM_BYTES]; 170 __be32 h_chksum[JBD2_CHECKSUM_BYTES];
171 __be64 h_commit_sec;
172 __be32 h_commit_nsec;
171}; 173};
172 174
173/* 175/*
@@ -379,6 +381,38 @@ static inline void jbd_unlock_bh_journal_head(struct buffer_head *bh)
379 bit_spin_unlock(BH_JournalHead, &bh->b_state); 381 bit_spin_unlock(BH_JournalHead, &bh->b_state);
380} 382}
381 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
382struct jbd2_revoke_table_s; 416struct jbd2_revoke_table_s;
383 417
384/** 418/**
@@ -509,24 +543,12 @@ struct transaction_s
509 struct journal_head *t_reserved_list; 543 struct journal_head *t_reserved_list;
510 544
511 /* 545 /*
512 * Doubly-linked circular list of all buffers under writeout during
513 * commit [j_list_lock]
514 */
515 struct journal_head *t_locked_list;
516
517 /*
518 * Doubly-linked circular list of all metadata buffers owned by this 546 * Doubly-linked circular list of all metadata buffers owned by this
519 * transaction [j_list_lock] 547 * transaction [j_list_lock]
520 */ 548 */
521 struct journal_head *t_buffers; 549 struct journal_head *t_buffers;
522 550
523 /* 551 /*
524 * Doubly-linked circular list of all data buffers still to be
525 * flushed before this transaction can be committed [j_list_lock]
526 */
527 struct journal_head *t_sync_datalist;
528
529 /*
530 * Doubly-linked circular list of all forget buffers (superseded 552 * Doubly-linked circular list of all forget buffers (superseded
531 * buffers which we can un-checkpoint once this transaction commits) 553 * buffers which we can un-checkpoint once this transaction commits)
532 * [j_list_lock] 554 * [j_list_lock]
@@ -565,6 +587,12 @@ struct transaction_s
565 struct journal_head *t_log_list; 587 struct journal_head *t_log_list;
566 588
567 /* 589 /*
590 * List of inodes whose data we've modified in data=ordered mode.
591 * [j_list_lock]
592 */
593 struct list_head t_inode_list;
594
595 /*
568 * Protects info related to handles 596 * Protects info related to handles
569 */ 597 */
570 spinlock_t t_handle_lock; 598 spinlock_t t_handle_lock;
@@ -1004,7 +1032,6 @@ extern int jbd2_journal_extend (handle_t *, int nblocks);
1004extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *); 1032extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *);
1005extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *); 1033extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *);
1006extern int jbd2_journal_get_undo_access(handle_t *, struct buffer_head *); 1034extern int jbd2_journal_get_undo_access(handle_t *, struct buffer_head *);
1007extern int jbd2_journal_dirty_data (handle_t *, struct buffer_head *);
1008extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *); 1035extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *);
1009extern void jbd2_journal_release_buffer (handle_t *, struct buffer_head *); 1036extern void jbd2_journal_release_buffer (handle_t *, struct buffer_head *);
1010extern int jbd2_journal_forget (handle_t *, struct buffer_head *); 1037extern int jbd2_journal_forget (handle_t *, struct buffer_head *);
@@ -1044,6 +1071,10 @@ extern void jbd2_journal_ack_err (journal_t *);
1044extern int jbd2_journal_clear_err (journal_t *); 1071extern int jbd2_journal_clear_err (journal_t *);
1045extern int jbd2_journal_bmap(journal_t *, unsigned long, unsigned long long *); 1072extern int jbd2_journal_bmap(journal_t *, unsigned long, unsigned long long *);
1046extern int jbd2_journal_force_commit(journal_t *); 1073extern int jbd2_journal_force_commit(journal_t *);
1074extern int jbd2_journal_file_inode(handle_t *handle, struct jbd2_inode *inode);
1075extern int jbd2_journal_begin_ordered_truncate(struct jbd2_inode *inode, loff_t new_size);
1076extern void jbd2_journal_init_jbd_inode(struct jbd2_inode *jinode, struct inode *inode);
1077extern void jbd2_journal_release_jbd_inode(journal_t *journal, struct jbd2_inode *jinode);
1047 1078
1048/* 1079/*
1049 * journal_head management 1080 * journal_head management
@@ -1179,15 +1210,13 @@ static inline int jbd_space_needed(journal_t *journal)
1179 1210
1180/* journaling buffer types */ 1211/* journaling buffer types */
1181#define BJ_None 0 /* Not journaled */ 1212#define BJ_None 0 /* Not journaled */
1182#define BJ_SyncData 1 /* Normal data: flush before commit */ 1213#define BJ_Metadata 1 /* Normal journaled metadata */
1183#define BJ_Metadata 2 /* Normal journaled metadata */ 1214#define BJ_Forget 2 /* Buffer superseded by this transaction */
1184#define BJ_Forget 3 /* Buffer superseded by this transaction */ 1215#define BJ_IO 3 /* Buffer is for temporary IO use */
1185#define BJ_IO 4 /* Buffer is for temporary IO use */ 1216#define BJ_Shadow 4 /* Buffer contents being shadowed to the log */
1186#define BJ_Shadow 5 /* Buffer contents being shadowed to the log */ 1217#define BJ_LogCtl 5 /* Buffer contains log descriptors */
1187#define BJ_LogCtl 6 /* Buffer contains log descriptors */ 1218#define BJ_Reserved 6 /* Buffer is reserved for access by journal */
1188#define BJ_Reserved 7 /* Buffer is reserved for access by journal */ 1219#define BJ_Types 7
1189#define BJ_Locked 8 /* Locked for I/O during commit */
1190#define BJ_Types 9
1191 1220
1192extern int jbd_blocks_per_page(struct inode *inode); 1221extern int jbd_blocks_per_page(struct inode *inode);
1193 1222