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.h81
1 files changed, 57 insertions, 24 deletions
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index d147f0f90360..d2e91ea998fd 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;
@@ -822,7 +850,8 @@ struct journal_s
822 */ 850 */
823 struct block_device *j_dev; 851 struct block_device *j_dev;
824 int j_blocksize; 852 int j_blocksize;
825 unsigned long long j_blk_offset; 853 unsigned long long j_blk_offset;
854 char j_devname[BDEVNAME_SIZE+24];
826 855
827 /* 856 /*
828 * Device which holds the client fs. For internal journal this will be 857 * Device which holds the client fs. For internal journal this will be
@@ -938,6 +967,9 @@ struct journal_s
938#define JBD2_FLUSHED 0x008 /* The journal superblock has been flushed */ 967#define JBD2_FLUSHED 0x008 /* The journal superblock has been flushed */
939#define JBD2_LOADED 0x010 /* The journal superblock has been loaded */ 968#define JBD2_LOADED 0x010 /* The journal superblock has been loaded */
940#define JBD2_BARRIER 0x020 /* Use IDE barriers */ 969#define JBD2_BARRIER 0x020 /* Use IDE barriers */
970#define JBD2_ABORT_ON_SYNCDATA_ERR 0x040 /* Abort the journal on file
971 * data write error in ordered
972 * mode */
941 973
942/* 974/*
943 * Function declarations for the journaling transaction and buffer 975 * Function declarations for the journaling transaction and buffer
@@ -1004,7 +1036,6 @@ extern int jbd2_journal_extend (handle_t *, int nblocks);
1004extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *); 1036extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *);
1005extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *); 1037extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *);
1006extern int jbd2_journal_get_undo_access(handle_t *, struct buffer_head *); 1038extern 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 *); 1039extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *);
1009extern void jbd2_journal_release_buffer (handle_t *, struct buffer_head *); 1040extern void jbd2_journal_release_buffer (handle_t *, struct buffer_head *);
1010extern int jbd2_journal_forget (handle_t *, struct buffer_head *); 1041extern int jbd2_journal_forget (handle_t *, struct buffer_head *);
@@ -1032,7 +1063,7 @@ extern void jbd2_journal_clear_features
1032 (journal_t *, unsigned long, unsigned long, unsigned long); 1063 (journal_t *, unsigned long, unsigned long, unsigned long);
1033extern int jbd2_journal_create (journal_t *); 1064extern int jbd2_journal_create (journal_t *);
1034extern int jbd2_journal_load (journal_t *journal); 1065extern int jbd2_journal_load (journal_t *journal);
1035extern void jbd2_journal_destroy (journal_t *); 1066extern int jbd2_journal_destroy (journal_t *);
1036extern int jbd2_journal_recover (journal_t *journal); 1067extern int jbd2_journal_recover (journal_t *journal);
1037extern int jbd2_journal_wipe (journal_t *, int); 1068extern int jbd2_journal_wipe (journal_t *, int);
1038extern int jbd2_journal_skip_recovery (journal_t *); 1069extern int jbd2_journal_skip_recovery (journal_t *);
@@ -1044,6 +1075,10 @@ extern void jbd2_journal_ack_err (journal_t *);
1044extern int jbd2_journal_clear_err (journal_t *); 1075extern int jbd2_journal_clear_err (journal_t *);
1045extern int jbd2_journal_bmap(journal_t *, unsigned long, unsigned long long *); 1076extern int jbd2_journal_bmap(journal_t *, unsigned long, unsigned long long *);
1046extern int jbd2_journal_force_commit(journal_t *); 1077extern int jbd2_journal_force_commit(journal_t *);
1078extern int jbd2_journal_file_inode(handle_t *handle, struct jbd2_inode *inode);
1079extern int jbd2_journal_begin_ordered_truncate(struct jbd2_inode *inode, loff_t new_size);
1080extern void jbd2_journal_init_jbd_inode(struct jbd2_inode *jinode, struct inode *inode);
1081extern void jbd2_journal_release_jbd_inode(journal_t *journal, struct jbd2_inode *jinode);
1047 1082
1048/* 1083/*
1049 * journal_head management 1084 * journal_head management
@@ -1179,15 +1214,13 @@ static inline int jbd_space_needed(journal_t *journal)
1179 1214
1180/* journaling buffer types */ 1215/* journaling buffer types */
1181#define BJ_None 0 /* Not journaled */ 1216#define BJ_None 0 /* Not journaled */
1182#define BJ_SyncData 1 /* Normal data: flush before commit */ 1217#define BJ_Metadata 1 /* Normal journaled metadata */
1183#define BJ_Metadata 2 /* Normal journaled metadata */ 1218#define BJ_Forget 2 /* Buffer superseded by this transaction */
1184#define BJ_Forget 3 /* Buffer superseded by this transaction */ 1219#define BJ_IO 3 /* Buffer is for temporary IO use */
1185#define BJ_IO 4 /* Buffer is for temporary IO use */ 1220#define BJ_Shadow 4 /* Buffer contents being shadowed to the log */
1186#define BJ_Shadow 5 /* Buffer contents being shadowed to the log */ 1221#define BJ_LogCtl 5 /* Buffer contains log descriptors */
1187#define BJ_LogCtl 6 /* Buffer contains log descriptors */ 1222#define BJ_Reserved 6 /* Buffer is reserved for access by journal */
1188#define BJ_Reserved 7 /* Buffer is reserved for access by journal */ 1223#define BJ_Types 7
1189#define BJ_Locked 8 /* Locked for I/O during commit */
1190#define BJ_Types 9
1191 1224
1192extern int jbd_blocks_per_page(struct inode *inode); 1225extern int jbd_blocks_per_page(struct inode *inode);
1193 1226