aboutsummaryrefslogtreecommitdiff
path: root/e2fsprogs/ext2fs/kernel-jbd.h
diff options
context:
space:
mode:
Diffstat (limited to 'e2fsprogs/ext2fs/kernel-jbd.h')
-rw-r--r--e2fsprogs/ext2fs/kernel-jbd.h140
1 files changed, 70 insertions, 70 deletions
diff --git a/e2fsprogs/ext2fs/kernel-jbd.h b/e2fsprogs/ext2fs/kernel-jbd.h
index d0efdb3f7..8a5de5e3e 100644
--- a/e2fsprogs/ext2fs/kernel-jbd.h
+++ b/e2fsprogs/ext2fs/kernel-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
@@ -51,7 +51,7 @@ extern int journal_enable_debug;
51 if ((n) <= journal_enable_debug) { \ 51 if ((n) <= journal_enable_debug) { \
52 printk (KERN_DEBUG "(%s, %d): %s: ", \ 52 printk (KERN_DEBUG "(%s, %d): %s: ", \
53 __FILE__, __LINE__, __FUNCTION__); \ 53 __FILE__, __LINE__, __FUNCTION__); \
54 printk (f, ## a); \ 54 printk (f, ## a); \
55 } \ 55 } \
56 } while (0) 56 } while (0)
57#else 57#else
@@ -59,7 +59,7 @@ extern int journal_enable_debug;
59#define jbd_debug(f, a...) /**/ 59#define jbd_debug(f, a...) /**/
60#else 60#else
61#define jbd_debug(f, ...) /**/ 61#define jbd_debug(f, ...) /**/
62#endif 62#endif
63#endif 63#endif
64#else 64#else
65#define jbd_debug(x) /* AIX doesn't do STDC */ 65#define jbd_debug(x) /* AIX doesn't do STDC */
@@ -88,7 +88,7 @@ typedef struct journal_s journal_t; /* Journal control structure */
88 * On-disk structures 88 * On-disk structures
89 */ 89 */
90 90
91/* 91/*
92 * Descriptor block types: 92 * Descriptor block types:
93 */ 93 */
94 94
@@ -109,8 +109,8 @@ typedef struct journal_header_s
109} journal_header_t; 109} journal_header_t;
110 110
111 111
112/* 112/*
113 * The block tag: used to describe a single buffer in the journal 113 * The block tag: used to describe a single buffer in the journal
114 */ 114 */
115typedef struct journal_block_tag_s 115typedef struct journal_block_tag_s
116{ 116{
@@ -118,9 +118,9 @@ typedef struct journal_block_tag_s
118 __u32 t_flags; /* See below */ 118 __u32 t_flags; /* See below */
119} journal_block_tag_t; 119} journal_block_tag_t;
120 120
121/* 121/*
122 * The revoke descriptor: used on disk to describe a series of blocks to 122 * The revoke descriptor: used on disk to describe a series of blocks to
123 * be revoked from the log 123 * be revoked from the log
124 */ 124 */
125typedef struct journal_revoke_header_s 125typedef struct journal_revoke_header_s
126{ 126{
@@ -149,7 +149,7 @@ typedef struct journal_superblock_s
149 __u32 s_blocksize; /* journal device blocksize */ 149 __u32 s_blocksize; /* journal device blocksize */
150 __u32 s_maxlen; /* total blocks in journal file */ 150 __u32 s_maxlen; /* total blocks in journal file */
151 __u32 s_first; /* first block of log information */ 151 __u32 s_first; /* first block of log information */
152 152
153/* 0x0018 */ 153/* 0x0018 */
154 /* Dynamic information describing the current state of the log */ 154 /* Dynamic information describing the current state of the log */
155 __u32 s_sequence; /* first commit ID expected in log */ 155 __u32 s_sequence; /* first commit ID expected in log */
@@ -161,17 +161,17 @@ typedef struct journal_superblock_s
161 161
162/* 0x0024 */ 162/* 0x0024 */
163 /* Remaining fields are only valid in a version-2 superblock */ 163 /* Remaining fields are only valid in a version-2 superblock */
164 __u32 s_feature_compat; /* compatible feature set */ 164 __u32 s_feature_compat; /* compatible feature set */
165 __u32 s_feature_incompat; /* incompatible feature set */ 165 __u32 s_feature_incompat; /* incompatible feature set */
166 __u32 s_feature_ro_compat; /* readonly-compatible feature set */ 166 __u32 s_feature_ro_compat; /* readonly-compatible feature set */
167/* 0x0030 */ 167/* 0x0030 */
168 __u8 s_uuid[16]; /* 128-bit uuid for journal */ 168 __u8 s_uuid[16]; /* 128-bit uuid for journal */
169 169
170/* 0x0040 */ 170/* 0x0040 */
171 __u32 s_nr_users; /* Nr of filesystems sharing log */ 171 __u32 s_nr_users; /* Nr of filesystems sharing log */
172 172
173 __u32 s_dynsuper; /* Blocknr of dynamic superblock copy*/ 173 __u32 s_dynsuper; /* Blocknr of dynamic superblock copy*/
174 174
175/* 0x0048 */ 175/* 0x0048 */
176 __u32 s_max_transaction; /* Limit of journal blocks per trans.*/ 176 __u32 s_max_transaction; /* Limit of journal blocks per trans.*/
177 __u32 s_max_trans_data; /* Limit of data blocks per trans. */ 177 __u32 s_max_trans_data; /* Limit of data blocks per trans. */
@@ -276,7 +276,7 @@ struct jbd_revoke_table_s;
276 * the transaction, so that at all times we know how many buffers the 276 * the transaction, so that at all times we know how many buffers the
277 * outstanding updates on a transaction might possibly touch. */ 277 * outstanding updates on a transaction might possibly touch. */
278 278
279struct handle_s 279struct handle_s
280{ 280{
281 /* Which compound transaction is this update a part of? */ 281 /* Which compound transaction is this update a part of? */
282 transaction_t * h_transaction; 282 transaction_t * h_transaction;
@@ -314,14 +314,14 @@ struct handle_s
314 * flushed to home for finished transactions. 314 * flushed to home for finished transactions.
315 */ 315 */
316 316
317struct transaction_s 317struct transaction_s
318{ 318{
319 /* Pointer to the journal for this transaction. */ 319 /* Pointer to the journal for this transaction. */
320 journal_t * t_journal; 320 journal_t * t_journal;
321 321
322 /* Sequence number for this transaction */ 322 /* Sequence number for this transaction */
323 tid_t t_tid; 323 tid_t t_tid;
324 324
325 /* Transaction's current state */ 325 /* Transaction's current state */
326 enum { 326 enum {
327 T_RUNNING, 327 T_RUNNING,
@@ -329,74 +329,74 @@ struct transaction_s
329 T_RUNDOWN, 329 T_RUNDOWN,
330 T_FLUSH, 330 T_FLUSH,
331 T_COMMIT, 331 T_COMMIT,
332 T_FINISHED 332 T_FINISHED
333 } t_state; 333 } t_state;
334 334
335 /* Where in the log does this transaction's commit start? */ 335 /* Where in the log does this transaction's commit start? */
336 unsigned long t_log_start; 336 unsigned long t_log_start;
337 337
338 /* Doubly-linked circular list of all inodes owned by this 338 /* Doubly-linked circular list of all inodes owned by this
339 transaction */ /* AKPM: unused */ 339 transaction */ /* AKPM: unused */
340 struct inode * t_ilist; 340 struct inode * t_ilist;
341 341
342 /* Number of buffers on the t_buffers list */ 342 /* Number of buffers on the t_buffers list */
343 int t_nr_buffers; 343 int t_nr_buffers;
344 344
345 /* Doubly-linked circular list of all buffers reserved but not 345 /* Doubly-linked circular list of all buffers reserved but not
346 yet modified by this transaction */ 346 yet modified by this transaction */
347 struct journal_head * t_reserved_list; 347 struct journal_head * t_reserved_list;
348 348
349 /* Doubly-linked circular list of all metadata buffers owned by this 349 /* Doubly-linked circular list of all metadata buffers owned by this
350 transaction */ 350 transaction */
351 struct journal_head * t_buffers; 351 struct journal_head * t_buffers;
352 352
353 /* 353 /*
354 * Doubly-linked circular list of all data buffers still to be 354 * Doubly-linked circular list of all data buffers still to be
355 * flushed before this transaction can be committed. 355 * flushed before this transaction can be committed.
356 * Protected by journal_datalist_lock. 356 * Protected by journal_datalist_lock.
357 */ 357 */
358 struct journal_head * t_sync_datalist; 358 struct journal_head * t_sync_datalist;
359 359
360 /* 360 /*
361 * Doubly-linked circular list of all writepage data buffers 361 * Doubly-linked circular list of all writepage data buffers
362 * still to be written before this transaction can be committed. 362 * still to be written before this transaction can be committed.
363 * Protected by journal_datalist_lock. 363 * Protected by journal_datalist_lock.
364 */ 364 */
365 struct journal_head * t_async_datalist; 365 struct journal_head * t_async_datalist;
366 366
367 /* Doubly-linked circular list of all forget buffers (superceded 367 /* Doubly-linked circular list of all forget buffers (superceded
368 buffers which we can un-checkpoint once this transaction 368 buffers which we can un-checkpoint once this transaction
369 commits) */ 369 commits) */
370 struct journal_head * t_forget; 370 struct journal_head * t_forget;
371 371
372 /* 372 /*
373 * Doubly-linked circular list of all buffers still to be 373 * Doubly-linked circular list of all buffers still to be
374 * flushed before this transaction can be checkpointed. 374 * flushed before this transaction can be checkpointed.
375 */ 375 */
376 /* Protected by journal_datalist_lock */ 376 /* Protected by journal_datalist_lock */
377 struct journal_head * t_checkpoint_list; 377 struct journal_head * t_checkpoint_list;
378 378
379 /* Doubly-linked circular list of temporary buffers currently 379 /* Doubly-linked circular list of temporary buffers currently
380 undergoing IO in the log */ 380 undergoing IO in the log */
381 struct journal_head * t_iobuf_list; 381 struct journal_head * t_iobuf_list;
382 382
383 /* Doubly-linked circular list of metadata buffers being 383 /* Doubly-linked circular list of metadata buffers being
384 shadowed by log IO. The IO buffers on the iobuf list and the 384 shadowed by log IO. The IO buffers on the iobuf list and the
385 shadow buffers on this list match each other one for one at 385 shadow buffers on this list match each other one for one at
386 all times. */ 386 all times. */
387 struct journal_head * t_shadow_list; 387 struct journal_head * t_shadow_list;
388 388
389 /* Doubly-linked circular list of control buffers being written 389 /* Doubly-linked circular list of control buffers being written
390 to the log. */ 390 to the log. */
391 struct journal_head * t_log_list; 391 struct journal_head * t_log_list;
392 392
393 /* Number of outstanding updates running on this transaction */ 393 /* Number of outstanding updates running on this transaction */
394 int t_updates; 394 int t_updates;
395 395
396 /* Number of buffers reserved for use by all handles in this 396 /* Number of buffers reserved for use by all handles in this
397 * transaction handle but not yet modified. */ 397 * transaction handle but not yet modified. */
398 int t_outstanding_credits; 398 int t_outstanding_credits;
399 399
400 /* 400 /*
401 * Forward and backward links for the circular list of all 401 * Forward and backward links for the circular list of all
402 * transactions awaiting checkpoint. 402 * transactions awaiting checkpoint.
@@ -415,7 +415,7 @@ struct transaction_s
415 415
416/* The journal_t maintains all of the journaling state information for a 416/* The journal_t maintains all of the journaling state information for a
417 * single filesystem. It is linked to from the fs superblock structure. 417 * single filesystem. It is linked to from the fs superblock structure.
418 * 418 *
419 * We use the journal_t to keep track of all outstanding transaction 419 * We use the journal_t to keep track of all outstanding transaction
420 * activity on the filesystem, and to manage the state of the log 420 * activity on the filesystem, and to manage the state of the log
421 * writing process. */ 421 * writing process. */
@@ -428,7 +428,7 @@ struct journal_s
428 /* Is there an outstanding uncleared error on the journal (from 428 /* Is there an outstanding uncleared error on the journal (from
429 * a prior abort)? */ 429 * a prior abort)? */
430 int j_errno; 430 int j_errno;
431 431
432 /* The superblock buffer */ 432 /* The superblock buffer */
433 struct buffer_head * j_sb_buffer; 433 struct buffer_head * j_sb_buffer;
434 journal_superblock_t * j_superblock; 434 journal_superblock_t * j_superblock;
@@ -438,49 +438,49 @@ struct journal_s
438 438
439 /* Number of processes waiting to create a barrier lock */ 439 /* Number of processes waiting to create a barrier lock */
440 int j_barrier_count; 440 int j_barrier_count;
441 441
442 /* The barrier lock itself */ 442 /* The barrier lock itself */
443 struct semaphore j_barrier; 443 struct semaphore j_barrier;
444 444
445 /* Transactions: The current running transaction... */ 445 /* Transactions: The current running transaction... */
446 transaction_t * j_running_transaction; 446 transaction_t * j_running_transaction;
447 447
448 /* ... the transaction we are pushing to disk ... */ 448 /* ... the transaction we are pushing to disk ... */
449 transaction_t * j_committing_transaction; 449 transaction_t * j_committing_transaction;
450 450
451 /* ... and a linked circular list of all transactions waiting 451 /* ... and a linked circular list of all transactions waiting
452 * for checkpointing. */ 452 * for checkpointing. */
453 /* Protected by journal_datalist_lock */ 453 /* Protected by journal_datalist_lock */
454 transaction_t * j_checkpoint_transactions; 454 transaction_t * j_checkpoint_transactions;
455 455
456 /* Wait queue for waiting for a locked transaction to start 456 /* Wait queue for waiting for a locked transaction to start
457 committing, or for a barrier lock to be released */ 457 committing, or for a barrier lock to be released */
458 wait_queue_head_t j_wait_transaction_locked; 458 wait_queue_head_t j_wait_transaction_locked;
459 459
460 /* Wait queue for waiting for checkpointing to complete */ 460 /* Wait queue for waiting for checkpointing to complete */
461 wait_queue_head_t j_wait_logspace; 461 wait_queue_head_t j_wait_logspace;
462 462
463 /* Wait queue for waiting for commit to complete */ 463 /* Wait queue for waiting for commit to complete */
464 wait_queue_head_t j_wait_done_commit; 464 wait_queue_head_t j_wait_done_commit;
465 465
466 /* Wait queue to trigger checkpointing */ 466 /* Wait queue to trigger checkpointing */
467 wait_queue_head_t j_wait_checkpoint; 467 wait_queue_head_t j_wait_checkpoint;
468 468
469 /* Wait queue to trigger commit */ 469 /* Wait queue to trigger commit */
470 wait_queue_head_t j_wait_commit; 470 wait_queue_head_t j_wait_commit;
471 471
472 /* Wait queue to wait for updates to complete */ 472 /* Wait queue to wait for updates to complete */
473 wait_queue_head_t j_wait_updates; 473 wait_queue_head_t j_wait_updates;
474 474
475 /* Semaphore for locking against concurrent checkpoints */ 475 /* Semaphore for locking against concurrent checkpoints */
476 struct semaphore j_checkpoint_sem; 476 struct semaphore j_checkpoint_sem;
477 477
478 /* The main journal lock, used by lock_journal() */ 478 /* The main journal lock, used by lock_journal() */
479 struct semaphore j_sem; 479 struct semaphore j_sem;
480 480
481 /* Journal head: identifies the first unused block in the journal. */ 481 /* Journal head: identifies the first unused block in the journal. */
482 unsigned long j_head; 482 unsigned long j_head;
483 483
484 /* Journal tail: identifies the oldest still-used block in the 484 /* Journal tail: identifies the oldest still-used block in the
485 * journal. */ 485 * journal. */
486 unsigned long j_tail; 486 unsigned long j_tail;
@@ -546,12 +546,12 @@ struct journal_s
546 struct list_head j_all_journals; 546 struct list_head j_all_journals;
547 547
548 /* The revoke table: maintains the list of revoked blocks in the 548 /* The revoke table: maintains the list of revoked blocks in the
549 current transaction. */ 549 current transaction. */
550 struct jbd_revoke_table_s *j_revoke; 550 struct jbd_revoke_table_s *j_revoke;
551}; 551};
552 552
553/* 553/*
554 * Journal flag definitions 554 * Journal flag definitions
555 */ 555 */
556#define JFS_UNMOUNT 0x001 /* Journal thread is being destroyed */ 556#define JFS_UNMOUNT 0x001 /* Journal thread is being destroyed */
557#define JFS_ABORT 0x002 /* Journaling has been aborted for errors. */ 557#define JFS_ABORT 0x002 /* Journaling has been aborted for errors. */
@@ -559,7 +559,7 @@ struct journal_s
559#define JFS_FLUSHED 0x008 /* The journal superblock has been flushed */ 559#define JFS_FLUSHED 0x008 /* The journal superblock has been flushed */
560#define JFS_LOADED 0x010 /* The journal superblock has been loaded */ 560#define JFS_LOADED 0x010 /* The journal superblock has been loaded */
561 561
562/* 562/*
563 * Function declarations for the journaling transaction and buffer 563 * Function declarations for the journaling transaction and buffer
564 * management 564 * management
565 */ 565 */
@@ -589,7 +589,7 @@ extern void journal_insert_checkpoint(struct journal_head *, transaction_t *);
589extern void __journal_insert_checkpoint(struct journal_head *,transaction_t *); 589extern void __journal_insert_checkpoint(struct journal_head *,transaction_t *);
590 590
591/* Buffer IO */ 591/* Buffer IO */
592extern int 592extern int
593journal_write_metadata_buffer(transaction_t *transaction, 593journal_write_metadata_buffer(transaction_t *transaction,
594 struct journal_head *jh_in, 594 struct journal_head *jh_in,
595 struct journal_head **jh_out, 595 struct journal_head **jh_out,
@@ -603,7 +603,7 @@ extern void __wait_on_journal (journal_t *);
603 * 603 *
604 * We need to lock the journal during transaction state changes so that 604 * We need to lock the journal during transaction state changes so that
605 * nobody ever tries to take a handle on the running transaction while 605 * nobody ever tries to take a handle on the running transaction while
606 * we are in the middle of moving it to the commit phase. 606 * we are in the middle of moving it to the commit phase.
607 * 607 *
608 * Note that the locking is completely interrupt unsafe. We never touch 608 * Note that the locking is completely interrupt unsafe. We never touch
609 * journal structures from interrupts. 609 * journal structures from interrupts.
@@ -637,7 +637,7 @@ static inline handle_t *journal_current_handle(void)
637/* The journaling code user interface: 637/* The journaling code user interface:
638 * 638 *
639 * Create and destroy handles 639 * Create and destroy handles
640 * Register buffer modifications against the current transaction. 640 * Register buffer modifications against the current transaction.
641 */ 641 */
642 642
643extern handle_t *journal_start(journal_t *, int nblocks); 643extern handle_t *journal_start(journal_t *, int nblocks);
@@ -665,11 +665,11 @@ extern journal_t * journal_init_dev(kdev_t dev, kdev_t fs_dev,
665 int start, int len, int bsize); 665 int start, int len, int bsize);
666extern journal_t * journal_init_inode (struct inode *); 666extern journal_t * journal_init_inode (struct inode *);
667extern int journal_update_format (journal_t *); 667extern int journal_update_format (journal_t *);
668extern int journal_check_used_features 668extern int journal_check_used_features
669 (journal_t *, unsigned long, unsigned long, unsigned long); 669 (journal_t *, unsigned long, unsigned long, unsigned long);
670extern int journal_check_available_features 670extern int journal_check_available_features
671 (journal_t *, unsigned long, unsigned long, unsigned long); 671 (journal_t *, unsigned long, unsigned long, unsigned long);
672extern int journal_set_features 672extern int journal_set_features
673 (journal_t *, unsigned long, unsigned long, unsigned long); 673 (journal_t *, unsigned long, unsigned long, unsigned long);
674extern int journal_create (journal_t *); 674extern int journal_create (journal_t *);
675extern int journal_load (journal_t *journal); 675extern int journal_load (journal_t *journal);
@@ -747,7 +747,7 @@ do { \
747 * bit, when set, indicates that we have had a fatal error somewhere, 747 * bit, when set, indicates that we have had a fatal error somewhere,
748 * either inside the journaling layer or indicated to us by the client 748 * either inside the journaling layer or indicated to us by the client
749 * (eg. ext3), and that we and should not commit any further 749 * (eg. ext3), and that we and should not commit any further
750 * transactions. 750 * transactions.
751 */ 751 */
752 752
753static inline int is_journal_aborted(journal_t *journal) 753static inline int is_journal_aborted(journal_t *journal)
@@ -770,7 +770,7 @@ static inline void journal_abort_handle(handle_t *handle)
770/* Not all architectures define BUG() */ 770/* Not all architectures define BUG() */
771#ifndef BUG 771#ifndef BUG
772#define BUG() do { \ 772#define BUG() do { \
773 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ 773 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
774 * ((char *) 0) = 0; \ 774 * ((char *) 0) = 0; \
775 } while (0) 775 } while (0)
776#endif /* BUG */ 776#endif /* BUG */
@@ -826,7 +826,7 @@ extern int journal_blocks_per_page(struct inode *inode);
826#define BJ_LogCtl 7 /* Buffer contains log descriptors */ 826#define BJ_LogCtl 7 /* Buffer contains log descriptors */
827#define BJ_Reserved 8 /* Buffer is reserved for access by journal */ 827#define BJ_Reserved 8 /* Buffer is reserved for access by journal */
828#define BJ_Types 9 828#define BJ_Types 9
829 829
830extern int jbd_blocks_per_page(struct inode *inode); 830extern int jbd_blocks_per_page(struct inode *inode);
831 831
832#ifdef __KERNEL__ 832#ifdef __KERNEL__