aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/jbd.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/jbd.h')
-rw-r--r--include/linux/jbd.h74
1 files changed, 38 insertions, 36 deletions
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index 20eb34403d0c..fe89444b1c6f 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * linux/include/linux/jbd.h 2 * linux/include/linux/jbd.h
3 * 3 *
4 * Written by Stephen C. Tweedie <sct@redhat.com> 4 * Written by Stephen C. Tweedie <sct@redhat.com>
5 * 5 *
6 * Copyright 1998-2000 Red Hat, Inc --- All Rights Reserved 6 * Copyright 1998-2000 Red Hat, Inc --- All Rights Reserved
@@ -64,7 +64,7 @@ extern int journal_enable_debug;
64 if ((n) <= journal_enable_debug) { \ 64 if ((n) <= journal_enable_debug) { \
65 printk (KERN_DEBUG "(%s, %d): %s: ", \ 65 printk (KERN_DEBUG "(%s, %d): %s: ", \
66 __FILE__, __LINE__, __FUNCTION__); \ 66 __FILE__, __LINE__, __FUNCTION__); \
67 printk (f, ## a); \ 67 printk (f, ## a); \
68 } \ 68 } \
69 } while (0) 69 } while (0)
70#else 70#else
@@ -72,6 +72,9 @@ extern int journal_enable_debug;
72#endif 72#endif
73 73
74extern void * __jbd_kmalloc (const char *where, size_t size, gfp_t flags, int retry); 74extern void * __jbd_kmalloc (const char *where, size_t size, gfp_t flags, int retry);
75extern void * jbd_slab_alloc(size_t size, gfp_t flags);
76extern void jbd_slab_free(void *ptr, size_t size);
77
75#define jbd_kmalloc(size, flags) \ 78#define jbd_kmalloc(size, flags) \
76 __jbd_kmalloc(__FUNCTION__, (size), (flags), journal_oom_retry) 79 __jbd_kmalloc(__FUNCTION__, (size), (flags), journal_oom_retry)
77#define jbd_rep_kmalloc(size, flags) \ 80#define jbd_rep_kmalloc(size, flags) \
@@ -94,8 +97,8 @@ extern void * __jbd_kmalloc (const char *where, size_t size, gfp_t flags, int re
94 * number of outstanding buffers possible at any time. When the 97 * number of outstanding buffers possible at any time. When the
95 * operation completes, any buffer credits not used are credited back to 98 * operation completes, any buffer credits not used are credited back to
96 * the transaction, so that at all times we know how many buffers the 99 * the transaction, so that at all times we know how many buffers the
97 * outstanding updates on a transaction might possibly touch. 100 * outstanding updates on a transaction might possibly touch.
98 * 101 *
99 * This is an opaque datatype. 102 * This is an opaque datatype.
100 **/ 103 **/
101typedef struct handle_s handle_t; /* Atomic operation type */ 104typedef struct handle_s handle_t; /* Atomic operation type */
@@ -105,7 +108,7 @@ typedef struct handle_s handle_t; /* Atomic operation type */
105 * typedef journal_t - The journal_t maintains all of the journaling state information for a single filesystem. 108 * typedef journal_t - The journal_t maintains all of the journaling state information for a single filesystem.
106 * 109 *
107 * journal_t is linked to from the fs superblock structure. 110 * journal_t is linked to from the fs superblock structure.
108 * 111 *
109 * We use the journal_t to keep track of all outstanding transaction 112 * We use the journal_t to keep track of all outstanding transaction
110 * activity on the filesystem, and to manage the state of the log 113 * activity on the filesystem, and to manage the state of the log
111 * writing process. 114 * writing process.
@@ -125,7 +128,7 @@ typedef struct journal_s journal_t; /* Journal control structure */
125 * On-disk structures 128 * On-disk structures
126 */ 129 */
127 130
128/* 131/*
129 * Descriptor block types: 132 * Descriptor block types:
130 */ 133 */
131 134
@@ -146,8 +149,8 @@ typedef struct journal_header_s
146} journal_header_t; 149} journal_header_t;
147 150
148 151
149/* 152/*
150 * The block tag: used to describe a single buffer in the journal 153 * The block tag: used to describe a single buffer in the journal
151 */ 154 */
152typedef struct journal_block_tag_s 155typedef struct journal_block_tag_s
153{ 156{
@@ -155,9 +158,9 @@ typedef struct journal_block_tag_s
155 __be32 t_flags; /* See below */ 158 __be32 t_flags; /* See below */
156} journal_block_tag_t; 159} journal_block_tag_t;
157 160
158/* 161/*
159 * The revoke descriptor: used on disk to describe a series of blocks to 162 * The revoke descriptor: used on disk to describe a series of blocks to
160 * be revoked from the log 163 * be revoked from the log
161 */ 164 */
162typedef struct journal_revoke_header_s 165typedef struct journal_revoke_header_s
163{ 166{
@@ -198,9 +201,9 @@ typedef struct journal_superblock_s
198 201
199/* 0x0024 */ 202/* 0x0024 */
200 /* Remaining fields are only valid in a version-2 superblock */ 203 /* Remaining fields are only valid in a version-2 superblock */
201 __be32 s_feature_compat; /* compatible feature set */ 204 __be32 s_feature_compat; /* compatible feature set */
202 __be32 s_feature_incompat; /* incompatible feature set */ 205 __be32 s_feature_incompat; /* incompatible feature set */
203 __be32 s_feature_ro_compat; /* readonly-compatible feature set */ 206 __be32 s_feature_ro_compat; /* readonly-compatible feature set */
204/* 0x0030 */ 207/* 0x0030 */
205 __u8 s_uuid[16]; /* 128-bit uuid for journal */ 208 __u8 s_uuid[16]; /* 128-bit uuid for journal */
206 209
@@ -371,10 +374,10 @@ struct jbd_revoke_table_s;
371 **/ 374 **/
372 375
373/* Docbook can't yet cope with the bit fields, but will leave the documentation 376/* Docbook can't yet cope with the bit fields, but will leave the documentation
374 * in so it can be fixed later. 377 * in so it can be fixed later.
375 */ 378 */
376 379
377struct handle_s 380struct handle_s
378{ 381{
379 /* Which compound transaction is this update a part of? */ 382 /* Which compound transaction is this update a part of? */
380 transaction_t *h_transaction; 383 transaction_t *h_transaction;
@@ -432,7 +435,7 @@ struct handle_s
432 * 435 *
433 */ 436 */
434 437
435struct transaction_s 438struct transaction_s
436{ 439{
437 /* Pointer to the journal for this transaction. [no locking] */ 440 /* Pointer to the journal for this transaction. [no locking] */
438 journal_t *t_journal; 441 journal_t *t_journal;
@@ -452,7 +455,7 @@ struct transaction_s
452 T_RUNDOWN, 455 T_RUNDOWN,
453 T_FLUSH, 456 T_FLUSH,
454 T_COMMIT, 457 T_COMMIT,
455 T_FINISHED 458 T_FINISHED
456 } t_state; 459 } t_state;
457 460
458 /* 461 /*
@@ -566,7 +569,7 @@ struct transaction_s
566 * journal_t. 569 * journal_t.
567 * @j_flags: General journaling state flags 570 * @j_flags: General journaling state flags
568 * @j_errno: Is there an outstanding uncleared error on the journal (from a 571 * @j_errno: Is there an outstanding uncleared error on the journal (from a
569 * prior abort)? 572 * prior abort)?
570 * @j_sb_buffer: First part of superblock buffer 573 * @j_sb_buffer: First part of superblock buffer
571 * @j_superblock: Second part of superblock buffer 574 * @j_superblock: Second part of superblock buffer
572 * @j_format_version: Version of the superblock format 575 * @j_format_version: Version of the superblock format
@@ -580,7 +583,7 @@ struct transaction_s
580 * @j_wait_transaction_locked: Wait queue for waiting for a locked transaction 583 * @j_wait_transaction_locked: Wait queue for waiting for a locked transaction
581 * to start committing, or for a barrier lock to be released 584 * to start committing, or for a barrier lock to be released
582 * @j_wait_logspace: Wait queue for waiting for checkpointing to complete 585 * @j_wait_logspace: Wait queue for waiting for checkpointing to complete
583 * @j_wait_done_commit: Wait queue for waiting for commit to complete 586 * @j_wait_done_commit: Wait queue for waiting for commit to complete
584 * @j_wait_checkpoint: Wait queue to trigger checkpointing 587 * @j_wait_checkpoint: Wait queue to trigger checkpointing
585 * @j_wait_commit: Wait queue to trigger commit 588 * @j_wait_commit: Wait queue to trigger commit
586 * @j_wait_updates: Wait queue to wait for updates to complete 589 * @j_wait_updates: Wait queue to wait for updates to complete
@@ -589,7 +592,7 @@ struct transaction_s
589 * @j_tail: Journal tail - identifies the oldest still-used block in the 592 * @j_tail: Journal tail - identifies the oldest still-used block in the
590 * journal. 593 * journal.
591 * @j_free: Journal free - how many free blocks are there in the journal? 594 * @j_free: Journal free - how many free blocks are there in the journal?
592 * @j_first: The block number of the first usable block 595 * @j_first: The block number of the first usable block
593 * @j_last: The block number one beyond the last usable block 596 * @j_last: The block number one beyond the last usable block
594 * @j_dev: Device where we store the journal 597 * @j_dev: Device where we store the journal
595 * @j_blocksize: blocksize for the location where we store the journal. 598 * @j_blocksize: blocksize for the location where we store the journal.
@@ -601,12 +604,12 @@ struct transaction_s
601 * @j_list_lock: Protects the buffer lists and internal buffer state. 604 * @j_list_lock: Protects the buffer lists and internal buffer state.
602 * @j_inode: Optional inode where we store the journal. If present, all journal 605 * @j_inode: Optional inode where we store the journal. If present, all journal
603 * block numbers are mapped into this inode via bmap(). 606 * block numbers are mapped into this inode via bmap().
604 * @j_tail_sequence: Sequence number of the oldest transaction in the log 607 * @j_tail_sequence: Sequence number of the oldest transaction in the log
605 * @j_transaction_sequence: Sequence number of the next transaction to grant 608 * @j_transaction_sequence: Sequence number of the next transaction to grant
606 * @j_commit_sequence: Sequence number of the most recently committed 609 * @j_commit_sequence: Sequence number of the most recently committed
607 * transaction 610 * transaction
608 * @j_commit_request: Sequence number of the most recent transaction wanting 611 * @j_commit_request: Sequence number of the most recent transaction wanting
609 * commit 612 * commit
610 * @j_uuid: Uuid of client object. 613 * @j_uuid: Uuid of client object.
611 * @j_task: Pointer to the current commit thread for this journal 614 * @j_task: Pointer to the current commit thread for this journal
612 * @j_max_transaction_buffers: Maximum number of metadata buffers to allow in a 615 * @j_max_transaction_buffers: Maximum number of metadata buffers to allow in a
@@ -696,7 +699,7 @@ struct journal_s
696 wait_queue_head_t j_wait_updates; 699 wait_queue_head_t j_wait_updates;
697 700
698 /* Semaphore for locking against concurrent checkpoints */ 701 /* Semaphore for locking against concurrent checkpoints */
699 struct mutex j_checkpoint_mutex; 702 struct mutex j_checkpoint_mutex;
700 703
701 /* 704 /*
702 * Journal head: identifies the first unused block in the journal. 705 * Journal head: identifies the first unused block in the journal.
@@ -729,7 +732,7 @@ struct journal_s
729 */ 732 */
730 struct block_device *j_dev; 733 struct block_device *j_dev;
731 int j_blocksize; 734 int j_blocksize;
732 unsigned int j_blk_offset; 735 unsigned long j_blk_offset;
733 736
734 /* 737 /*
735 * Device which holds the client fs. For internal journal this will be 738 * Device which holds the client fs. For internal journal this will be
@@ -820,8 +823,8 @@ struct journal_s
820 void *j_private; 823 void *j_private;
821}; 824};
822 825
823/* 826/*
824 * Journal flag definitions 827 * Journal flag definitions
825 */ 828 */
826#define JFS_UNMOUNT 0x001 /* Journal thread is being destroyed */ 829#define JFS_UNMOUNT 0x001 /* Journal thread is being destroyed */
827#define JFS_ABORT 0x002 /* Journaling has been aborted for errors. */ 830#define JFS_ABORT 0x002 /* Journaling has been aborted for errors. */
@@ -830,7 +833,7 @@ struct journal_s
830#define JFS_LOADED 0x010 /* The journal superblock has been loaded */ 833#define JFS_LOADED 0x010 /* The journal superblock has been loaded */
831#define JFS_BARRIER 0x020 /* Use IDE barriers */ 834#define JFS_BARRIER 0x020 /* Use IDE barriers */
832 835
833/* 836/*
834 * Function declarations for the journaling transaction and buffer 837 * Function declarations for the journaling transaction and buffer
835 * management 838 * management
836 */ 839 */
@@ -859,11 +862,11 @@ int __journal_remove_checkpoint(struct journal_head *);
859void __journal_insert_checkpoint(struct journal_head *, transaction_t *); 862void __journal_insert_checkpoint(struct journal_head *, transaction_t *);
860 863
861/* Buffer IO */ 864/* Buffer IO */
862extern int 865extern int
863journal_write_metadata_buffer(transaction_t *transaction, 866journal_write_metadata_buffer(transaction_t *transaction,
864 struct journal_head *jh_in, 867 struct journal_head *jh_in,
865 struct journal_head **jh_out, 868 struct journal_head **jh_out,
866 int blocknr); 869 unsigned long blocknr);
867 870
868/* Transaction locking */ 871/* Transaction locking */
869extern void __wait_on_journal (journal_t *); 872extern void __wait_on_journal (journal_t *);
@@ -887,7 +890,7 @@ static inline handle_t *journal_current_handle(void)
887/* The journaling code user interface: 890/* The journaling code user interface:
888 * 891 *
889 * Create and destroy handles 892 * Create and destroy handles
890 * Register buffer modifications against the current transaction. 893 * Register buffer modifications against the current transaction.
891 */ 894 */
892 895
893extern handle_t *journal_start(journal_t *, int nblocks); 896extern handle_t *journal_start(journal_t *, int nblocks);
@@ -914,11 +917,11 @@ extern journal_t * journal_init_dev(struct block_device *bdev,
914 int start, int len, int bsize); 917 int start, int len, int bsize);
915extern journal_t * journal_init_inode (struct inode *); 918extern journal_t * journal_init_inode (struct inode *);
916extern int journal_update_format (journal_t *); 919extern int journal_update_format (journal_t *);
917extern int journal_check_used_features 920extern int journal_check_used_features
918 (journal_t *, unsigned long, unsigned long, unsigned long); 921 (journal_t *, unsigned long, unsigned long, unsigned long);
919extern int journal_check_available_features 922extern int journal_check_available_features
920 (journal_t *, unsigned long, unsigned long, unsigned long); 923 (journal_t *, unsigned long, unsigned long, unsigned long);
921extern int journal_set_features 924extern int journal_set_features
922 (journal_t *, unsigned long, unsigned long, unsigned long); 925 (journal_t *, unsigned long, unsigned long, unsigned long);
923extern int journal_create (journal_t *); 926extern int journal_create (journal_t *);
924extern int journal_load (journal_t *journal); 927extern int journal_load (journal_t *journal);
@@ -974,7 +977,6 @@ extern void journal_write_revoke_records(journal_t *, transaction_t *);
974extern int journal_set_revoke(journal_t *, unsigned long, tid_t); 977extern int journal_set_revoke(journal_t *, unsigned long, tid_t);
975extern int journal_test_revoke(journal_t *, unsigned long, tid_t); 978extern int journal_test_revoke(journal_t *, unsigned long, tid_t);
976extern void journal_clear_revoke(journal_t *); 979extern void journal_clear_revoke(journal_t *);
977extern void journal_brelse_array(struct buffer_head *b[], int n);
978extern void journal_switch_revoke_table(journal_t *journal); 980extern void journal_switch_revoke_table(journal_t *journal);
979 981
980/* 982/*
@@ -1012,7 +1014,7 @@ do { \
1012 * bit, when set, indicates that we have had a fatal error somewhere, 1014 * bit, when set, indicates that we have had a fatal error somewhere,
1013 * either inside the journaling layer or indicated to us by the client 1015 * either inside the journaling layer or indicated to us by the client
1014 * (eg. ext3), and that we and should not commit any further 1016 * (eg. ext3), and that we and should not commit any further
1015 * transactions. 1017 * transactions.
1016 */ 1018 */
1017 1019
1018static inline int is_journal_aborted(journal_t *journal) 1020static inline int is_journal_aborted(journal_t *journal)
@@ -1079,7 +1081,7 @@ static inline int jbd_space_needed(journal_t *journal)
1079#define BJ_Reserved 7 /* Buffer is reserved for access by journal */ 1081#define BJ_Reserved 7 /* Buffer is reserved for access by journal */
1080#define BJ_Locked 8 /* Locked for I/O during commit */ 1082#define BJ_Locked 8 /* Locked for I/O during commit */
1081#define BJ_Types 9 1083#define BJ_Types 9
1082 1084
1083extern int jbd_blocks_per_page(struct inode *inode); 1085extern int jbd_blocks_per_page(struct inode *inode);
1084 1086
1085#ifdef __KERNEL__ 1087#ifdef __KERNEL__