diff options
Diffstat (limited to 'include/linux/jbd2.h')
| -rw-r--r-- | include/linux/jbd2.h | 431 |
1 files changed, 268 insertions, 163 deletions
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index 296d1e0ea87b..b708e5169d1d 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h | |||
| @@ -418,26 +418,41 @@ static inline void jbd_unlock_bh_journal_head(struct buffer_head *bh) | |||
| 418 | #define JI_WAIT_DATA (1 << __JI_WAIT_DATA) | 418 | #define JI_WAIT_DATA (1 << __JI_WAIT_DATA) |
| 419 | 419 | ||
| 420 | /** | 420 | /** |
| 421 | * struct jbd_inode is the structure linking inodes in ordered mode | 421 | * struct jbd_inode - The jbd_inode type is the structure linking inodes in |
| 422 | * present in a transaction so that we can sync them during commit. | 422 | * ordered mode present in a transaction so that we can sync them during commit. |
| 423 | */ | 423 | */ |
| 424 | struct jbd2_inode { | 424 | struct jbd2_inode { |
| 425 | /* Which transaction does this inode belong to? Either the running | 425 | /** |
| 426 | * transaction or the committing one. [j_list_lock] */ | 426 | * @i_transaction: |
| 427 | * | ||
| 428 | * Which transaction does this inode belong to? Either the running | ||
| 429 | * transaction or the committing one. [j_list_lock] | ||
| 430 | */ | ||
| 427 | transaction_t *i_transaction; | 431 | transaction_t *i_transaction; |
| 428 | 432 | ||
| 429 | /* Pointer to the running transaction modifying inode's data in case | 433 | /** |
| 430 | * there is already a committing transaction touching it. [j_list_lock] */ | 434 | * @i_next_transaction: |
| 435 | * | ||
| 436 | * Pointer to the running transaction modifying inode's data in case | ||
| 437 | * there is already a committing transaction touching it. [j_list_lock] | ||
| 438 | */ | ||
| 431 | transaction_t *i_next_transaction; | 439 | transaction_t *i_next_transaction; |
| 432 | 440 | ||
| 433 | /* List of inodes in the i_transaction [j_list_lock] */ | 441 | /** |
| 442 | * @i_list: List of inodes in the i_transaction [j_list_lock] | ||
| 443 | */ | ||
| 434 | struct list_head i_list; | 444 | struct list_head i_list; |
| 435 | 445 | ||
| 436 | /* VFS inode this inode belongs to [constant during the lifetime | 446 | /** |
| 437 | * of the structure] */ | 447 | * @i_vfs_inode: |
| 448 | * | ||
| 449 | * VFS inode this inode belongs to [constant for lifetime of structure] | ||
| 450 | */ | ||
| 438 | struct inode *i_vfs_inode; | 451 | struct inode *i_vfs_inode; |
| 439 | 452 | ||
| 440 | /* Flags of inode [j_list_lock] */ | 453 | /** |
| 454 | * @i_flags: Flags of inode [j_list_lock] | ||
| 455 | */ | ||
| 441 | unsigned long i_flags; | 456 | unsigned long i_flags; |
| 442 | }; | 457 | }; |
| 443 | 458 | ||
| @@ -447,12 +462,20 @@ struct jbd2_revoke_table_s; | |||
| 447 | * struct handle_s - The handle_s type is the concrete type associated with | 462 | * struct handle_s - The handle_s type is the concrete type associated with |
| 448 | * handle_t. | 463 | * handle_t. |
| 449 | * @h_transaction: Which compound transaction is this update a part of? | 464 | * @h_transaction: Which compound transaction is this update a part of? |
| 465 | * @h_journal: Which journal handle belongs to - used iff h_reserved set. | ||
| 466 | * @h_rsv_handle: Handle reserved for finishing the logical operation. | ||
| 450 | * @h_buffer_credits: Number of remaining buffers we are allowed to dirty. | 467 | * @h_buffer_credits: Number of remaining buffers we are allowed to dirty. |
| 451 | * @h_ref: Reference count on this handle | 468 | * @h_ref: Reference count on this handle. |
| 452 | * @h_err: Field for caller's use to track errors through large fs operations | 469 | * @h_err: Field for caller's use to track errors through large fs operations. |
| 453 | * @h_sync: flag for sync-on-close | 470 | * @h_sync: Flag for sync-on-close. |
| 454 | * @h_jdata: flag to force data journaling | 471 | * @h_jdata: Flag to force data journaling. |
| 455 | * @h_aborted: flag indicating fatal error on handle | 472 | * @h_reserved: Flag for handle for reserved credits. |
| 473 | * @h_aborted: Flag indicating fatal error on handle. | ||
| 474 | * @h_type: For handle statistics. | ||
| 475 | * @h_line_no: For handle statistics. | ||
| 476 | * @h_start_jiffies: Handle Start time. | ||
| 477 | * @h_requested_credits: Holds @h_buffer_credits after handle is started. | ||
| 478 | * @saved_alloc_context: Saved context while transaction is open. | ||
| 456 | **/ | 479 | **/ |
| 457 | 480 | ||
| 458 | /* Docbook can't yet cope with the bit fields, but will leave the documentation | 481 | /* Docbook can't yet cope with the bit fields, but will leave the documentation |
| @@ -462,32 +485,23 @@ struct jbd2_revoke_table_s; | |||
| 462 | struct jbd2_journal_handle | 485 | struct jbd2_journal_handle |
| 463 | { | 486 | { |
| 464 | union { | 487 | union { |
| 465 | /* Which compound transaction is this update a part of? */ | ||
| 466 | transaction_t *h_transaction; | 488 | transaction_t *h_transaction; |
| 467 | /* Which journal handle belongs to - used iff h_reserved set */ | 489 | /* Which journal handle belongs to - used iff h_reserved set */ |
| 468 | journal_t *h_journal; | 490 | journal_t *h_journal; |
| 469 | }; | 491 | }; |
| 470 | 492 | ||
| 471 | /* Handle reserved for finishing the logical operation */ | ||
| 472 | handle_t *h_rsv_handle; | 493 | handle_t *h_rsv_handle; |
| 473 | |||
| 474 | /* Number of remaining buffers we are allowed to dirty: */ | ||
| 475 | int h_buffer_credits; | 494 | int h_buffer_credits; |
| 476 | |||
| 477 | /* Reference count on this handle */ | ||
| 478 | int h_ref; | 495 | int h_ref; |
| 479 | |||
| 480 | /* Field for caller's use to track errors through large fs */ | ||
| 481 | /* operations */ | ||
| 482 | int h_err; | 496 | int h_err; |
| 483 | 497 | ||
| 484 | /* Flags [no locking] */ | 498 | /* Flags [no locking] */ |
| 485 | unsigned int h_sync: 1; /* sync-on-close */ | 499 | unsigned int h_sync: 1; |
| 486 | unsigned int h_jdata: 1; /* force data journaling */ | 500 | unsigned int h_jdata: 1; |
| 487 | unsigned int h_reserved: 1; /* handle with reserved credits */ | 501 | unsigned int h_reserved: 1; |
| 488 | unsigned int h_aborted: 1; /* fatal error on handle */ | 502 | unsigned int h_aborted: 1; |
| 489 | unsigned int h_type: 8; /* for handle statistics */ | 503 | unsigned int h_type: 8; |
| 490 | unsigned int h_line_no: 16; /* for handle statistics */ | 504 | unsigned int h_line_no: 16; |
| 491 | 505 | ||
| 492 | unsigned long h_start_jiffies; | 506 | unsigned long h_start_jiffies; |
| 493 | unsigned int h_requested_credits; | 507 | unsigned int h_requested_credits; |
| @@ -729,228 +743,253 @@ jbd2_time_diff(unsigned long start, unsigned long end) | |||
| 729 | /** | 743 | /** |
| 730 | * struct journal_s - The journal_s type is the concrete type associated with | 744 | * struct journal_s - The journal_s type is the concrete type associated with |
| 731 | * journal_t. | 745 | * journal_t. |
| 732 | * @j_flags: General journaling state flags | ||
| 733 | * @j_errno: Is there an outstanding uncleared error on the journal (from a | ||
| 734 | * prior abort)? | ||
| 735 | * @j_sb_buffer: First part of superblock buffer | ||
| 736 | * @j_superblock: Second part of superblock buffer | ||
| 737 | * @j_format_version: Version of the superblock format | ||
| 738 | * @j_state_lock: Protect the various scalars in the journal | ||
| 739 | * @j_barrier_count: Number of processes waiting to create a barrier lock | ||
| 740 | * @j_barrier: The barrier lock itself | ||
| 741 | * @j_running_transaction: The current running transaction.. | ||
| 742 | * @j_committing_transaction: the transaction we are pushing to disk | ||
| 743 | * @j_checkpoint_transactions: a linked circular list of all transactions | ||
| 744 | * waiting for checkpointing | ||
| 745 | * @j_wait_transaction_locked: Wait queue for waiting for a locked transaction | ||
| 746 | * to start committing, or for a barrier lock to be released | ||
| 747 | * @j_wait_done_commit: Wait queue for waiting for commit to complete | ||
| 748 | * @j_wait_commit: Wait queue to trigger commit | ||
| 749 | * @j_wait_updates: Wait queue to wait for updates to complete | ||
| 750 | * @j_wait_reserved: Wait queue to wait for reserved buffer credits to drop | ||
| 751 | * @j_checkpoint_mutex: Mutex for locking against concurrent checkpoints | ||
| 752 | * @j_head: Journal head - identifies the first unused block in the journal | ||
| 753 | * @j_tail: Journal tail - identifies the oldest still-used block in the | ||
| 754 | * journal. | ||
| 755 | * @j_free: Journal free - how many free blocks are there in the journal? | ||
| 756 | * @j_first: The block number of the first usable block | ||
| 757 | * @j_last: The block number one beyond the last usable block | ||
| 758 | * @j_dev: Device where we store the journal | ||
| 759 | * @j_blocksize: blocksize for the location where we store the journal. | ||
| 760 | * @j_blk_offset: starting block offset for into the device where we store the | ||
| 761 | * journal | ||
| 762 | * @j_fs_dev: Device which holds the client fs. For internal journal this will | ||
| 763 | * be equal to j_dev | ||
| 764 | * @j_reserved_credits: Number of buffers reserved from the running transaction | ||
| 765 | * @j_maxlen: Total maximum capacity of the journal region on disk. | ||
| 766 | * @j_list_lock: Protects the buffer lists and internal buffer state. | ||
| 767 | * @j_inode: Optional inode where we store the journal. If present, all journal | ||
| 768 | * block numbers are mapped into this inode via bmap(). | ||
| 769 | * @j_tail_sequence: Sequence number of the oldest transaction in the log | ||
| 770 | * @j_transaction_sequence: Sequence number of the next transaction to grant | ||
| 771 | * @j_commit_sequence: Sequence number of the most recently committed | ||
| 772 | * transaction | ||
| 773 | * @j_commit_request: Sequence number of the most recent transaction wanting | ||
| 774 | * commit | ||
| 775 | * @j_uuid: Uuid of client object. | ||
| 776 | * @j_task: Pointer to the current commit thread for this journal | ||
| 777 | * @j_max_transaction_buffers: Maximum number of metadata buffers to allow in a | ||
| 778 | * single compound commit transaction | ||
| 779 | * @j_commit_interval: What is the maximum transaction lifetime before we begin | ||
| 780 | * a commit? | ||
| 781 | * @j_commit_timer: The timer used to wakeup the commit thread | ||
| 782 | * @j_revoke_lock: Protect the revoke table | ||
| 783 | * @j_revoke: The revoke table - maintains the list of revoked blocks in the | ||
| 784 | * current transaction. | ||
| 785 | * @j_revoke_table: alternate revoke tables for j_revoke | ||
| 786 | * @j_wbuf: array of buffer_heads for jbd2_journal_commit_transaction | ||
| 787 | * @j_wbufsize: maximum number of buffer_heads allowed in j_wbuf, the | ||
| 788 | * number that will fit in j_blocksize | ||
| 789 | * @j_last_sync_writer: most recent pid which did a synchronous write | ||
| 790 | * @j_history_lock: Protect the transactions statistics history | ||
| 791 | * @j_proc_entry: procfs entry for the jbd statistics directory | ||
| 792 | * @j_stats: Overall statistics | ||
| 793 | * @j_private: An opaque pointer to fs-private information. | ||
| 794 | * @j_trans_commit_map: Lockdep entity to track transaction commit dependencies | ||
| 795 | */ | 746 | */ |
| 796 | |||
| 797 | struct journal_s | 747 | struct journal_s |
| 798 | { | 748 | { |
| 799 | /* General journaling state flags [j_state_lock] */ | 749 | /** |
| 750 | * @j_flags: General journaling state flags [j_state_lock] | ||
| 751 | */ | ||
| 800 | unsigned long j_flags; | 752 | unsigned long j_flags; |
| 801 | 753 | ||
| 802 | /* | 754 | /** |
| 755 | * @j_errno: | ||
| 756 | * | ||
| 803 | * Is there an outstanding uncleared error on the journal (from a prior | 757 | * Is there an outstanding uncleared error on the journal (from a prior |
| 804 | * abort)? [j_state_lock] | 758 | * abort)? [j_state_lock] |
| 805 | */ | 759 | */ |
| 806 | int j_errno; | 760 | int j_errno; |
| 807 | 761 | ||
| 808 | /* The superblock buffer */ | 762 | /** |
| 763 | * @j_sb_buffer: The first part of the superblock buffer. | ||
| 764 | */ | ||
| 809 | struct buffer_head *j_sb_buffer; | 765 | struct buffer_head *j_sb_buffer; |
| 766 | |||
| 767 | /** | ||
| 768 | * @j_superblock: The second part of the superblock buffer. | ||
| 769 | */ | ||
| 810 | journal_superblock_t *j_superblock; | 770 | journal_superblock_t *j_superblock; |
| 811 | 771 | ||
| 812 | /* Version of the superblock format */ | 772 | /** |
| 773 | * @j_format_version: Version of the superblock format. | ||
| 774 | */ | ||
| 813 | int j_format_version; | 775 | int j_format_version; |
| 814 | 776 | ||
| 815 | /* | 777 | /** |
| 816 | * Protect the various scalars in the journal | 778 | * @j_state_lock: Protect the various scalars in the journal. |
| 817 | */ | 779 | */ |
| 818 | rwlock_t j_state_lock; | 780 | rwlock_t j_state_lock; |
| 819 | 781 | ||
| 820 | /* | 782 | /** |
| 783 | * @j_barrier_count: | ||
| 784 | * | ||
| 821 | * Number of processes waiting to create a barrier lock [j_state_lock] | 785 | * Number of processes waiting to create a barrier lock [j_state_lock] |
| 822 | */ | 786 | */ |
| 823 | int j_barrier_count; | 787 | int j_barrier_count; |
| 824 | 788 | ||
| 825 | /* The barrier lock itself */ | 789 | /** |
| 790 | * @j_barrier: The barrier lock itself. | ||
| 791 | */ | ||
| 826 | struct mutex j_barrier; | 792 | struct mutex j_barrier; |
| 827 | 793 | ||
| 828 | /* | 794 | /** |
| 795 | * @j_running_transaction: | ||
| 796 | * | ||
| 829 | * Transactions: The current running transaction... | 797 | * Transactions: The current running transaction... |
| 830 | * [j_state_lock] [caller holding open handle] | 798 | * [j_state_lock] [caller holding open handle] |
| 831 | */ | 799 | */ |
| 832 | transaction_t *j_running_transaction; | 800 | transaction_t *j_running_transaction; |
| 833 | 801 | ||
| 834 | /* | 802 | /** |
| 803 | * @j_committing_transaction: | ||
| 804 | * | ||
| 835 | * the transaction we are pushing to disk | 805 | * the transaction we are pushing to disk |
| 836 | * [j_state_lock] [caller holding open handle] | 806 | * [j_state_lock] [caller holding open handle] |
| 837 | */ | 807 | */ |
| 838 | transaction_t *j_committing_transaction; | 808 | transaction_t *j_committing_transaction; |
| 839 | 809 | ||
| 840 | /* | 810 | /** |
| 811 | * @j_checkpoint_transactions: | ||
| 812 | * | ||
| 841 | * ... and a linked circular list of all transactions waiting for | 813 | * ... and a linked circular list of all transactions waiting for |
| 842 | * checkpointing. [j_list_lock] | 814 | * checkpointing. [j_list_lock] |
| 843 | */ | 815 | */ |
| 844 | transaction_t *j_checkpoint_transactions; | 816 | transaction_t *j_checkpoint_transactions; |
| 845 | 817 | ||
| 846 | /* | 818 | /** |
| 819 | * @j_wait_transaction_locked: | ||
| 820 | * | ||
| 847 | * Wait queue for waiting for a locked transaction to start committing, | 821 | * Wait queue for waiting for a locked transaction to start committing, |
| 848 | * or for a barrier lock to be released | 822 | * or for a barrier lock to be released. |
| 849 | */ | 823 | */ |
| 850 | wait_queue_head_t j_wait_transaction_locked; | 824 | wait_queue_head_t j_wait_transaction_locked; |
| 851 | 825 | ||
| 852 | /* Wait queue for waiting for commit to complete */ | 826 | /** |
| 827 | * @j_wait_done_commit: Wait queue for waiting for commit to complete. | ||
| 828 | */ | ||
| 853 | wait_queue_head_t j_wait_done_commit; | 829 | wait_queue_head_t j_wait_done_commit; |
| 854 | 830 | ||
| 855 | /* Wait queue to trigger commit */ | 831 | /** |
| 832 | * @j_wait_commit: Wait queue to trigger commit. | ||
| 833 | */ | ||
| 856 | wait_queue_head_t j_wait_commit; | 834 | wait_queue_head_t j_wait_commit; |
| 857 | 835 | ||
| 858 | /* Wait queue to wait for updates to complete */ | 836 | /** |
| 837 | * @j_wait_updates: Wait queue to wait for updates to complete. | ||
| 838 | */ | ||
| 859 | wait_queue_head_t j_wait_updates; | 839 | wait_queue_head_t j_wait_updates; |
| 860 | 840 | ||
| 861 | /* Wait queue to wait for reserved buffer credits to drop */ | 841 | /** |
| 842 | * @j_wait_reserved: | ||
| 843 | * | ||
| 844 | * Wait queue to wait for reserved buffer credits to drop. | ||
| 845 | */ | ||
| 862 | wait_queue_head_t j_wait_reserved; | 846 | wait_queue_head_t j_wait_reserved; |
| 863 | 847 | ||
| 864 | /* Semaphore for locking against concurrent checkpoints */ | 848 | /** |
| 849 | * @j_checkpoint_mutex: | ||
| 850 | * | ||
| 851 | * Semaphore for locking against concurrent checkpoints. | ||
| 852 | */ | ||
| 865 | struct mutex j_checkpoint_mutex; | 853 | struct mutex j_checkpoint_mutex; |
| 866 | 854 | ||
| 867 | /* | 855 | /** |
| 856 | * @j_chkpt_bhs: | ||
| 857 | * | ||
| 868 | * List of buffer heads used by the checkpoint routine. This | 858 | * List of buffer heads used by the checkpoint routine. This |
| 869 | * was moved from jbd2_log_do_checkpoint() to reduce stack | 859 | * was moved from jbd2_log_do_checkpoint() to reduce stack |
| 870 | * usage. Access to this array is controlled by the | 860 | * usage. Access to this array is controlled by the |
| 871 | * j_checkpoint_mutex. [j_checkpoint_mutex] | 861 | * @j_checkpoint_mutex. [j_checkpoint_mutex] |
| 872 | */ | 862 | */ |
| 873 | struct buffer_head *j_chkpt_bhs[JBD2_NR_BATCH]; | 863 | struct buffer_head *j_chkpt_bhs[JBD2_NR_BATCH]; |
| 874 | 864 | ||
| 875 | /* | 865 | /** |
| 866 | * @j_head: | ||
| 867 | * | ||
| 876 | * Journal head: identifies the first unused block in the journal. | 868 | * Journal head: identifies the first unused block in the journal. |
| 877 | * [j_state_lock] | 869 | * [j_state_lock] |
| 878 | */ | 870 | */ |
| 879 | unsigned long j_head; | 871 | unsigned long j_head; |
| 880 | 872 | ||
| 881 | /* | 873 | /** |
| 874 | * @j_tail: | ||
| 875 | * | ||
| 882 | * Journal tail: identifies the oldest still-used block in the journal. | 876 | * Journal tail: identifies the oldest still-used block in the journal. |
| 883 | * [j_state_lock] | 877 | * [j_state_lock] |
| 884 | */ | 878 | */ |
| 885 | unsigned long j_tail; | 879 | unsigned long j_tail; |
| 886 | 880 | ||
| 887 | /* | 881 | /** |
| 882 | * @j_free: | ||
| 883 | * | ||
| 888 | * Journal free: how many free blocks are there in the journal? | 884 | * Journal free: how many free blocks are there in the journal? |
| 889 | * [j_state_lock] | 885 | * [j_state_lock] |
| 890 | */ | 886 | */ |
| 891 | unsigned long j_free; | 887 | unsigned long j_free; |
| 892 | 888 | ||
| 893 | /* | 889 | /** |
| 894 | * Journal start and end: the block numbers of the first usable block | 890 | * @j_first: |
| 895 | * and one beyond the last usable block in the journal. [j_state_lock] | 891 | * |
| 892 | * The block number of the first usable block in the journal | ||
| 893 | * [j_state_lock]. | ||
| 896 | */ | 894 | */ |
| 897 | unsigned long j_first; | 895 | unsigned long j_first; |
| 896 | |||
| 897 | /** | ||
| 898 | * @j_last: | ||
| 899 | * | ||
| 900 | * The block number one beyond the last usable block in the journal | ||
| 901 | * [j_state_lock]. | ||
| 902 | */ | ||
| 898 | unsigned long j_last; | 903 | unsigned long j_last; |
| 899 | 904 | ||
| 900 | /* | 905 | /** |
| 901 | * Device, blocksize and starting block offset for the location where we | 906 | * @j_dev: Device where we store the journal. |
| 902 | * store the journal. | ||
| 903 | */ | 907 | */ |
| 904 | struct block_device *j_dev; | 908 | struct block_device *j_dev; |
| 909 | |||
| 910 | /** | ||
| 911 | * @j_blocksize: Block size for the location where we store the journal. | ||
| 912 | */ | ||
| 905 | int j_blocksize; | 913 | int j_blocksize; |
| 914 | |||
| 915 | /** | ||
| 916 | * @j_blk_offset: | ||
| 917 | * | ||
| 918 | * Starting block offset into the device where we store the journal. | ||
| 919 | */ | ||
| 906 | unsigned long long j_blk_offset; | 920 | unsigned long long j_blk_offset; |
| 921 | |||
| 922 | /** | ||
| 923 | * @j_devname: Journal device name. | ||
| 924 | */ | ||
| 907 | char j_devname[BDEVNAME_SIZE+24]; | 925 | char j_devname[BDEVNAME_SIZE+24]; |
| 908 | 926 | ||
| 909 | /* | 927 | /** |
| 928 | * @j_fs_dev: | ||
| 929 | * | ||
| 910 | * Device which holds the client fs. For internal journal this will be | 930 | * Device which holds the client fs. For internal journal this will be |
| 911 | * equal to j_dev. | 931 | * equal to j_dev. |
| 912 | */ | 932 | */ |
| 913 | struct block_device *j_fs_dev; | 933 | struct block_device *j_fs_dev; |
| 914 | 934 | ||
| 915 | /* Total maximum capacity of the journal region on disk. */ | 935 | /** |
| 936 | * @j_maxlen: Total maximum capacity of the journal region on disk. | ||
| 937 | */ | ||
| 916 | unsigned int j_maxlen; | 938 | unsigned int j_maxlen; |
| 917 | 939 | ||
| 918 | /* Number of buffers reserved from the running transaction */ | 940 | /** |
| 941 | * @j_reserved_credits: | ||
| 942 | * | ||
| 943 | * Number of buffers reserved from the running transaction. | ||
| 944 | */ | ||
| 919 | atomic_t j_reserved_credits; | 945 | atomic_t j_reserved_credits; |
| 920 | 946 | ||
| 921 | /* | 947 | /** |
| 922 | * Protects the buffer lists and internal buffer state. | 948 | * @j_list_lock: Protects the buffer lists and internal buffer state. |
| 923 | */ | 949 | */ |
| 924 | spinlock_t j_list_lock; | 950 | spinlock_t j_list_lock; |
| 925 | 951 | ||
| 926 | /* Optional inode where we store the journal. If present, all */ | 952 | /** |
| 927 | /* journal block numbers are mapped into this inode via */ | 953 | * @j_inode: |
| 928 | /* bmap(). */ | 954 | * |
| 955 | * Optional inode where we store the journal. If present, all | ||
| 956 | * journal block numbers are mapped into this inode via bmap(). | ||
| 957 | */ | ||
| 929 | struct inode *j_inode; | 958 | struct inode *j_inode; |
| 930 | 959 | ||
| 931 | /* | 960 | /** |
| 961 | * @j_tail_sequence: | ||
| 962 | * | ||
| 932 | * Sequence number of the oldest transaction in the log [j_state_lock] | 963 | * Sequence number of the oldest transaction in the log [j_state_lock] |
| 933 | */ | 964 | */ |
| 934 | tid_t j_tail_sequence; | 965 | tid_t j_tail_sequence; |
| 935 | 966 | ||
| 936 | /* | 967 | /** |
| 968 | * @j_transaction_sequence: | ||
| 969 | * | ||
| 937 | * Sequence number of the next transaction to grant [j_state_lock] | 970 | * Sequence number of the next transaction to grant [j_state_lock] |
| 938 | */ | 971 | */ |
| 939 | tid_t j_transaction_sequence; | 972 | tid_t j_transaction_sequence; |
| 940 | 973 | ||
| 941 | /* | 974 | /** |
| 975 | * @j_commit_sequence: | ||
| 976 | * | ||
| 942 | * Sequence number of the most recently committed transaction | 977 | * Sequence number of the most recently committed transaction |
| 943 | * [j_state_lock]. | 978 | * [j_state_lock]. |
| 944 | */ | 979 | */ |
| 945 | tid_t j_commit_sequence; | 980 | tid_t j_commit_sequence; |
| 946 | 981 | ||
| 947 | /* | 982 | /** |
| 983 | * @j_commit_request: | ||
| 984 | * | ||
| 948 | * Sequence number of the most recent transaction wanting commit | 985 | * Sequence number of the most recent transaction wanting commit |
| 949 | * [j_state_lock] | 986 | * [j_state_lock] |
| 950 | */ | 987 | */ |
| 951 | tid_t j_commit_request; | 988 | tid_t j_commit_request; |
| 952 | 989 | ||
| 953 | /* | 990 | /** |
| 991 | * @j_uuid: | ||
| 992 | * | ||
| 954 | * Journal uuid: identifies the object (filesystem, LVM volume etc) | 993 | * Journal uuid: identifies the object (filesystem, LVM volume etc) |
| 955 | * backed by this journal. This will eventually be replaced by an array | 994 | * backed by this journal. This will eventually be replaced by an array |
| 956 | * of uuids, allowing us to index multiple devices within a single | 995 | * of uuids, allowing us to index multiple devices within a single |
| @@ -958,85 +997,151 @@ struct journal_s | |||
| 958 | */ | 997 | */ |
| 959 | __u8 j_uuid[16]; | 998 | __u8 j_uuid[16]; |
| 960 | 999 | ||
| 961 | /* Pointer to the current commit thread for this journal */ | 1000 | /** |
| 1001 | * @j_task: Pointer to the current commit thread for this journal. | ||
| 1002 | */ | ||
| 962 | struct task_struct *j_task; | 1003 | struct task_struct *j_task; |
| 963 | 1004 | ||
| 964 | /* | 1005 | /** |
| 1006 | * @j_max_transaction_buffers: | ||
| 1007 | * | ||
| 965 | * Maximum number of metadata buffers to allow in a single compound | 1008 | * Maximum number of metadata buffers to allow in a single compound |
| 966 | * commit transaction | 1009 | * commit transaction. |
| 967 | */ | 1010 | */ |
| 968 | int j_max_transaction_buffers; | 1011 | int j_max_transaction_buffers; |
| 969 | 1012 | ||
| 970 | /* | 1013 | /** |
| 1014 | * @j_commit_interval: | ||
| 1015 | * | ||
| 971 | * What is the maximum transaction lifetime before we begin a commit? | 1016 | * What is the maximum transaction lifetime before we begin a commit? |
| 972 | */ | 1017 | */ |
| 973 | unsigned long j_commit_interval; | 1018 | unsigned long j_commit_interval; |
| 974 | 1019 | ||
| 975 | /* The timer used to wakeup the commit thread: */ | 1020 | /** |
| 1021 | * @j_commit_timer: The timer used to wakeup the commit thread. | ||
| 1022 | */ | ||
| 976 | struct timer_list j_commit_timer; | 1023 | struct timer_list j_commit_timer; |
| 977 | 1024 | ||
| 978 | /* | 1025 | /** |
| 979 | * The revoke table: maintains the list of revoked blocks in the | 1026 | * @j_revoke_lock: Protect the revoke table. |
| 980 | * current transaction. [j_revoke_lock] | ||
| 981 | */ | 1027 | */ |
| 982 | spinlock_t j_revoke_lock; | 1028 | spinlock_t j_revoke_lock; |
| 1029 | |||
| 1030 | /** | ||
| 1031 | * @j_revoke: | ||
| 1032 | * | ||
| 1033 | * The revoke table - maintains the list of revoked blocks in the | ||
| 1034 | * current transaction. | ||
| 1035 | */ | ||
| 983 | struct jbd2_revoke_table_s *j_revoke; | 1036 | struct jbd2_revoke_table_s *j_revoke; |
| 1037 | |||
| 1038 | /** | ||
| 1039 | * @j_revoke_table: Alternate revoke tables for j_revoke. | ||
| 1040 | */ | ||
| 984 | struct jbd2_revoke_table_s *j_revoke_table[2]; | 1041 | struct jbd2_revoke_table_s *j_revoke_table[2]; |
| 985 | 1042 | ||
| 986 | /* | 1043 | /** |
| 987 | * array of bhs for jbd2_journal_commit_transaction | 1044 | * @j_wbuf: Array of bhs for jbd2_journal_commit_transaction. |
| 988 | */ | 1045 | */ |
| 989 | struct buffer_head **j_wbuf; | 1046 | struct buffer_head **j_wbuf; |
| 1047 | |||
| 1048 | /** | ||
| 1049 | * @j_wbufsize: | ||
| 1050 | * | ||
| 1051 | * Size of @j_wbuf array. | ||
| 1052 | */ | ||
| 990 | int j_wbufsize; | 1053 | int j_wbufsize; |
| 991 | 1054 | ||
| 992 | /* | 1055 | /** |
| 993 | * this is the pid of hte last person to run a synchronous operation | 1056 | * @j_last_sync_writer: |
| 994 | * through the journal | 1057 | * |
| 1058 | * The pid of the last person to run a synchronous operation | ||
| 1059 | * through the journal. | ||
| 995 | */ | 1060 | */ |
| 996 | pid_t j_last_sync_writer; | 1061 | pid_t j_last_sync_writer; |
| 997 | 1062 | ||
| 998 | /* | 1063 | /** |
| 999 | * the average amount of time in nanoseconds it takes to commit a | 1064 | * @j_average_commit_time: |
| 1065 | * | ||
| 1066 | * The average amount of time in nanoseconds it takes to commit a | ||
| 1000 | * transaction to disk. [j_state_lock] | 1067 | * transaction to disk. [j_state_lock] |
| 1001 | */ | 1068 | */ |
| 1002 | u64 j_average_commit_time; | 1069 | u64 j_average_commit_time; |
| 1003 | 1070 | ||
| 1004 | /* | 1071 | /** |
| 1005 | * minimum and maximum times that we should wait for | 1072 | * @j_min_batch_time: |
| 1006 | * additional filesystem operations to get batched into a | 1073 | * |
| 1007 | * synchronous handle in microseconds | 1074 | * Minimum time that we should wait for additional filesystem operations |
| 1075 | * to get batched into a synchronous handle in microseconds. | ||
| 1008 | */ | 1076 | */ |
| 1009 | u32 j_min_batch_time; | 1077 | u32 j_min_batch_time; |
| 1078 | |||
| 1079 | /** | ||
| 1080 | * @j_max_batch_time: | ||
| 1081 | * | ||
| 1082 | * Maximum time that we should wait for additional filesystem operations | ||
| 1083 | * to get batched into a synchronous handle in microseconds. | ||
| 1084 | */ | ||
| 1010 | u32 j_max_batch_time; | 1085 | u32 j_max_batch_time; |
| 1011 | 1086 | ||
| 1012 | /* This function is called when a transaction is closed */ | 1087 | /** |
| 1088 | * @j_commit_callback: | ||
| 1089 | * | ||
| 1090 | * This function is called when a transaction is closed. | ||
| 1091 | */ | ||
| 1013 | void (*j_commit_callback)(journal_t *, | 1092 | void (*j_commit_callback)(journal_t *, |
| 1014 | transaction_t *); | 1093 | transaction_t *); |
| 1015 | 1094 | ||
| 1016 | /* | 1095 | /* |
| 1017 | * Journal statistics | 1096 | * Journal statistics |
| 1018 | */ | 1097 | */ |
| 1098 | |||
| 1099 | /** | ||
| 1100 | * @j_history_lock: Protect the transactions statistics history. | ||
| 1101 | */ | ||
| 1019 | spinlock_t j_history_lock; | 1102 | spinlock_t j_history_lock; |
| 1103 | |||
| 1104 | /** | ||
| 1105 | * @j_proc_entry: procfs entry for the jbd statistics directory. | ||
| 1106 | */ | ||
| 1020 | struct proc_dir_entry *j_proc_entry; | 1107 | struct proc_dir_entry *j_proc_entry; |
| 1108 | |||
| 1109 | /** | ||
| 1110 | * @j_stats: Overall statistics. | ||
| 1111 | */ | ||
| 1021 | struct transaction_stats_s j_stats; | 1112 | struct transaction_stats_s j_stats; |
| 1022 | 1113 | ||
| 1023 | /* Failed journal commit ID */ | 1114 | /** |
| 1115 | * @j_failed_commit: Failed journal commit ID. | ||
| 1116 | */ | ||
| 1024 | unsigned int j_failed_commit; | 1117 | unsigned int j_failed_commit; |
| 1025 | 1118 | ||
| 1026 | /* | 1119 | /** |
| 1120 | * @j_private: | ||
| 1121 | * | ||
| 1027 | * An opaque pointer to fs-private information. ext3 puts its | 1122 | * An opaque pointer to fs-private information. ext3 puts its |
| 1028 | * superblock pointer here | 1123 | * superblock pointer here. |
| 1029 | */ | 1124 | */ |
| 1030 | void *j_private; | 1125 | void *j_private; |
| 1031 | 1126 | ||
| 1032 | /* Reference to checksum algorithm driver via cryptoapi */ | 1127 | /** |
| 1128 | * @j_chksum_driver: | ||
| 1129 | * | ||
| 1130 | * Reference to checksum algorithm driver via cryptoapi. | ||
| 1131 | */ | ||
| 1033 | struct crypto_shash *j_chksum_driver; | 1132 | struct crypto_shash *j_chksum_driver; |
| 1034 | 1133 | ||
| 1035 | /* Precomputed journal UUID checksum for seeding other checksums */ | 1134 | /** |
| 1135 | * @j_csum_seed: | ||
| 1136 | * | ||
| 1137 | * Precomputed journal UUID checksum for seeding other checksums. | ||
| 1138 | */ | ||
| 1036 | __u32 j_csum_seed; | 1139 | __u32 j_csum_seed; |
| 1037 | 1140 | ||
| 1038 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 1141 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 1039 | /* | 1142 | /** |
| 1143 | * @j_trans_commit_map: | ||
| 1144 | * | ||
| 1040 | * Lockdep entity to track transaction commit dependencies. Handles | 1145 | * Lockdep entity to track transaction commit dependencies. Handles |
| 1041 | * hold this "lock" for read, when we wait for commit, we acquire the | 1146 | * hold this "lock" for read, when we wait for commit, we acquire the |
| 1042 | * "lock" for writing. This matches the properties of jbd2 journalling | 1147 | * "lock" for writing. This matches the properties of jbd2 journalling |
