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.h60
1 files changed, 50 insertions, 10 deletions
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 0b52924a0cb6..d087c2e7b2aa 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -94,7 +94,7 @@ extern void jbd2_free(void *ptr, size_t size);
94 * 94 *
95 * This is an opaque datatype. 95 * This is an opaque datatype.
96 **/ 96 **/
97typedef struct handle_s handle_t; /* Atomic operation type */ 97typedef struct jbd2_journal_handle handle_t; /* Atomic operation type */
98 98
99 99
100/** 100/**
@@ -395,7 +395,7 @@ struct jbd2_inode {
395 struct inode *i_vfs_inode; 395 struct inode *i_vfs_inode;
396 396
397 /* Flags of inode [j_list_lock] */ 397 /* Flags of inode [j_list_lock] */
398 unsigned int i_flags; 398 unsigned long i_flags;
399}; 399};
400 400
401struct jbd2_revoke_table_s; 401struct jbd2_revoke_table_s;
@@ -416,7 +416,7 @@ struct jbd2_revoke_table_s;
416 * in so it can be fixed later. 416 * in so it can be fixed later.
417 */ 417 */
418 418
419struct handle_s 419struct jbd2_journal_handle
420{ 420{
421 /* Which compound transaction is this update a part of? */ 421 /* Which compound transaction is this update a part of? */
422 transaction_t *h_transaction; 422 transaction_t *h_transaction;
@@ -432,13 +432,35 @@ struct handle_s
432 int h_err; 432 int h_err;
433 433
434 /* Flags [no locking] */ 434 /* Flags [no locking] */
435 unsigned int h_sync: 1; /* sync-on-close */ 435 unsigned int h_sync:1; /* sync-on-close */
436 unsigned int h_jdata: 1; /* force data journaling */ 436 unsigned int h_jdata:1; /* force data journaling */
437 unsigned int h_aborted: 1; /* fatal error on handle */ 437 unsigned int h_aborted:1; /* fatal error on handle */
438 unsigned int h_cowing:1; /* COWing block to snapshot */
439
440 /* Number of buffers requested by user:
441 * (before adding the COW credits factor) */
442 unsigned int h_base_credits:14;
443
444 /* Number of buffers the user is allowed to dirty:
445 * (counts only buffers dirtied when !h_cowing) */
446 unsigned int h_user_credits:14;
447
438 448
439#ifdef CONFIG_DEBUG_LOCK_ALLOC 449#ifdef CONFIG_DEBUG_LOCK_ALLOC
440 struct lockdep_map h_lockdep_map; 450 struct lockdep_map h_lockdep_map;
441#endif 451#endif
452
453#ifdef CONFIG_JBD2_DEBUG
454 /* COW debugging counters: */
455 unsigned int h_cow_moved; /* blocks moved to snapshot */
456 unsigned int h_cow_copied; /* blocks copied to snapshot */
457 unsigned int h_cow_ok_jh; /* blocks already COWed during current
458 transaction */
459 unsigned int h_cow_ok_bitmap; /* blocks not set in COW bitmap */
460 unsigned int h_cow_ok_mapped;/* blocks already mapped in snapshot */
461 unsigned int h_cow_bitmaps; /* COW bitmaps created */
462 unsigned int h_cow_excluded; /* blocks set in exclude bitmap */
463#endif
442}; 464};
443 465
444 466
@@ -507,9 +529,10 @@ struct transaction_s
507 enum { 529 enum {
508 T_RUNNING, 530 T_RUNNING,
509 T_LOCKED, 531 T_LOCKED,
510 T_RUNDOWN,
511 T_FLUSH, 532 T_FLUSH,
512 T_COMMIT, 533 T_COMMIT,
534 T_COMMIT_DFLUSH,
535 T_COMMIT_JFLUSH,
513 T_FINISHED 536 T_FINISHED
514 } t_state; 537 } t_state;
515 538
@@ -636,7 +659,9 @@ struct transaction_s
636 * waiting for it to finish. 659 * waiting for it to finish.
637 */ 660 */
638 unsigned int t_synchronous_commit:1; 661 unsigned int t_synchronous_commit:1;
639 unsigned int t_flushed_data_blocks:1; 662
663 /* Disk flush needs to be sent to fs partition [no locking] */
664 int t_need_data_flush;
640 665
641 /* 666 /*
642 * For use by the filesystem to store fs-specific data 667 * For use by the filesystem to store fs-specific data
@@ -999,7 +1024,6 @@ struct journal_s
999 1024
1000/* Filing buffers */ 1025/* Filing buffers */
1001extern void jbd2_journal_unfile_buffer(journal_t *, struct journal_head *); 1026extern void jbd2_journal_unfile_buffer(journal_t *, struct journal_head *);
1002extern void __jbd2_journal_unfile_buffer(struct journal_head *);
1003extern void __jbd2_journal_refile_buffer(struct journal_head *); 1027extern void __jbd2_journal_refile_buffer(struct journal_head *);
1004extern void jbd2_journal_refile_buffer(journal_t *, struct journal_head *); 1028extern void jbd2_journal_refile_buffer(journal_t *, struct journal_head *);
1005extern void __jbd2_journal_file_buffer(struct journal_head *, transaction_t *, int); 1029extern void __jbd2_journal_file_buffer(struct journal_head *, transaction_t *, int);
@@ -1140,7 +1164,6 @@ extern void jbd2_journal_release_jbd_inode(journal_t *journal, struct jbd2_in
1140 */ 1164 */
1141struct journal_head *jbd2_journal_add_journal_head(struct buffer_head *bh); 1165struct journal_head *jbd2_journal_add_journal_head(struct buffer_head *bh);
1142struct journal_head *jbd2_journal_grab_journal_head(struct buffer_head *bh); 1166struct journal_head *jbd2_journal_grab_journal_head(struct buffer_head *bh);
1143void jbd2_journal_remove_journal_head(struct buffer_head *bh);
1144void jbd2_journal_put_journal_head(struct journal_head *jh); 1167void jbd2_journal_put_journal_head(struct journal_head *jh);
1145 1168
1146/* 1169/*
@@ -1158,6 +1181,22 @@ static inline void jbd2_free_handle(handle_t *handle)
1158 kmem_cache_free(jbd2_handle_cache, handle); 1181 kmem_cache_free(jbd2_handle_cache, handle);
1159} 1182}
1160 1183
1184/*
1185 * jbd2_inode management (optional, for those file systems that want to use
1186 * dynamically allocated jbd2_inode structures)
1187 */
1188extern struct kmem_cache *jbd2_inode_cache;
1189
1190static inline struct jbd2_inode *jbd2_alloc_inode(gfp_t gfp_flags)
1191{
1192 return kmem_cache_alloc(jbd2_inode_cache, gfp_flags);
1193}
1194
1195static inline void jbd2_free_inode(struct jbd2_inode *jinode)
1196{
1197 kmem_cache_free(jbd2_inode_cache, jinode);
1198}
1199
1161/* Primary revoke support */ 1200/* Primary revoke support */
1162#define JOURNAL_REVOKE_DEFAULT_HASH 256 1201#define JOURNAL_REVOKE_DEFAULT_HASH 256
1163extern int jbd2_journal_init_revoke(journal_t *, int); 1202extern int jbd2_journal_init_revoke(journal_t *, int);
@@ -1190,6 +1229,7 @@ int jbd2_journal_start_commit(journal_t *journal, tid_t *tid);
1190int jbd2_journal_force_commit_nested(journal_t *journal); 1229int jbd2_journal_force_commit_nested(journal_t *journal);
1191int jbd2_log_wait_commit(journal_t *journal, tid_t tid); 1230int jbd2_log_wait_commit(journal_t *journal, tid_t tid);
1192int jbd2_log_do_checkpoint(journal_t *journal); 1231int jbd2_log_do_checkpoint(journal_t *journal);
1232int jbd2_trans_will_send_data_barrier(journal_t *journal, tid_t tid);
1193 1233
1194void __jbd2_log_wait_for_space(journal_t *journal); 1234void __jbd2_log_wait_for_space(journal_t *journal);
1195extern void __jbd2_journal_drop_transaction(journal_t *, transaction_t *); 1235extern void __jbd2_journal_drop_transaction(journal_t *, transaction_t *);