Merge branch 'master' into upstream
[sfrench/cifs-2.6.git] / include / linux / jbd.h
index 4fc7dffd66efecb37424da50cd8d718677fb22e4..fe89444b1c6f32145f4a0a02d1e8f13258e3f299 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * linux/include/linux/jbd.h
- * 
+ *
  * Written by Stephen C. Tweedie <sct@redhat.com>
  *
  * Copyright 1998-2000 Red Hat, Inc --- All Rights Reserved
@@ -64,7 +64,7 @@ extern int journal_enable_debug;
                if ((n) <= journal_enable_debug) {                      \
                        printk (KERN_DEBUG "(%s, %d): %s: ",            \
                                __FILE__, __LINE__, __FUNCTION__);      \
-                       printk (f, ## a);                               \
+                       printk (f, ## a);                               \
                }                                                       \
        } while (0)
 #else
@@ -72,6 +72,9 @@ extern int journal_enable_debug;
 #endif
 
 extern void * __jbd_kmalloc (const char *where, size_t size, gfp_t flags, int retry);
+extern void * jbd_slab_alloc(size_t size, gfp_t flags);
+extern void jbd_slab_free(void *ptr, size_t size);
+
 #define jbd_kmalloc(size, flags) \
        __jbd_kmalloc(__FUNCTION__, (size), (flags), journal_oom_retry)
 #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
  * number of outstanding buffers possible at any time.  When the
  * operation completes, any buffer credits not used are credited back to
  * the transaction, so that at all times we know how many buffers the
- * outstanding updates on a transaction might possibly touch. 
- * 
+ * outstanding updates on a transaction might possibly touch.
+ *
  * This is an opaque datatype.
  **/
 typedef struct handle_s                handle_t;       /* Atomic operation type */
@@ -105,7 +108,7 @@ typedef struct handle_s             handle_t;       /* Atomic operation type */
  * typedef journal_t - The journal_t maintains all of the journaling state information for a single filesystem.
  *
  * journal_t is linked to from the fs superblock structure.
- * 
+ *
  * We use the journal_t to keep track of all outstanding transaction
  * activity on the filesystem, and to manage the state of the log
  * writing process.
@@ -125,7 +128,7 @@ typedef struct journal_s    journal_t;      /* Journal control structure */
  * On-disk structures
  */
 
-/* 
+/*
  * Descriptor block types:
  */
 
@@ -146,8 +149,8 @@ typedef struct journal_header_s
 } journal_header_t;
 
 
-/* 
- * The block tag: used to describe a single buffer in the journal 
+/*
+ * The block tag: used to describe a single buffer in the journal
  */
 typedef struct journal_block_tag_s
 {
@@ -155,9 +158,9 @@ typedef struct journal_block_tag_s
        __be32          t_flags;        /* See below */
 } journal_block_tag_t;
 
-/* 
+/*
  * The revoke descriptor: used on disk to describe a series of blocks to
- * be revoked from the log 
+ * be revoked from the log
  */
 typedef struct journal_revoke_header_s
 {
@@ -198,9 +201,9 @@ typedef struct journal_superblock_s
 
 /* 0x0024 */
        /* Remaining fields are only valid in a version-2 superblock */
-       __be32  s_feature_compat;       /* compatible feature set */
-       __be32  s_feature_incompat;     /* incompatible feature set */
-       __be32  s_feature_ro_compat;    /* readonly-compatible feature set */
+       __be32  s_feature_compat;       /* compatible feature set */
+       __be32  s_feature_incompat;     /* incompatible feature set */
+       __be32  s_feature_ro_compat;    /* readonly-compatible feature set */
 /* 0x0030 */
        __u8    s_uuid[16];             /* 128-bit uuid for journal */
 
@@ -371,10 +374,10 @@ struct jbd_revoke_table_s;
  **/
 
 /* Docbook can't yet cope with the bit fields, but will leave the documentation
- * in so it can be fixed later. 
+ * in so it can be fixed later.
  */
 
-struct handle_s 
+struct handle_s
 {
        /* Which compound transaction is this update a part of? */
        transaction_t           *h_transaction;
@@ -432,7 +435,7 @@ struct handle_s
  *
  */
 
-struct transaction_s 
+struct transaction_s
 {
        /* Pointer to the journal for this transaction. [no locking] */
        journal_t               *t_journal;
@@ -452,7 +455,7 @@ struct transaction_s
                T_RUNDOWN,
                T_FLUSH,
                T_COMMIT,
-               T_FINISHED 
+               T_FINISHED
        }                       t_state;
 
        /*
@@ -500,6 +503,12 @@ struct transaction_s
         */
        struct journal_head     *t_checkpoint_list;
 
+       /*
+        * Doubly-linked circular list of all buffers submitted for IO while
+        * checkpointing. [j_list_lock]
+        */
+       struct journal_head     *t_checkpoint_io_list;
+
        /*
         * Doubly-linked circular list of temporary buffers currently undergoing
         * IO in the log [j_list_lock]
@@ -560,7 +569,7 @@ struct transaction_s
  *     journal_t.
  * @j_flags:  General journaling state flags
  * @j_errno:  Is there an outstanding uncleared error on the journal (from a
- *     prior abort)? 
+ *     prior abort)?
  * @j_sb_buffer: First part of superblock buffer
  * @j_superblock: Second part of superblock buffer
  * @j_format_version: Version of the superblock format
@@ -574,7 +583,7 @@ struct transaction_s
  * @j_wait_transaction_locked: Wait queue for waiting for a locked transaction
  *  to start committing, or for a barrier lock to be released
  * @j_wait_logspace: Wait queue for waiting for checkpointing to complete
- * @j_wait_done_commit: Wait queue for waiting for commit to complete 
+ * @j_wait_done_commit: Wait queue for waiting for commit to complete
  * @j_wait_checkpoint:  Wait queue to trigger checkpointing
  * @j_wait_commit: Wait queue to trigger commit
  * @j_wait_updates: Wait queue to wait for updates to complete
@@ -583,7 +592,7 @@ struct transaction_s
  * @j_tail: Journal tail - identifies the oldest still-used block in the
  *  journal.
  * @j_free: Journal free - how many free blocks are there in the journal?
- * @j_first: The block number of the first usable block 
+ * @j_first: The block number of the first usable block
  * @j_last: The block number one beyond the last usable block
  * @j_dev: Device where we store the journal
  * @j_blocksize: blocksize for the location where we store the journal.
@@ -595,12 +604,12 @@ struct transaction_s
  * @j_list_lock: Protects the buffer lists and internal buffer state.
  * @j_inode: Optional inode where we store the journal.  If present, all journal
  *     block numbers are mapped into this inode via bmap().
- * @j_tail_sequence:  Sequence number of the oldest transaction in the log 
+ * @j_tail_sequence:  Sequence number of the oldest transaction in the log
  * @j_transaction_sequence: Sequence number of the next transaction to grant
  * @j_commit_sequence: Sequence number of the most recently committed
  *  transaction
  * @j_commit_request: Sequence number of the most recent transaction wanting
- *     commit 
+ *     commit
  * @j_uuid: Uuid of client object.
  * @j_task: Pointer to the current commit thread for this journal
  * @j_max_transaction_buffers:  Maximum number of metadata buffers to allow in a
@@ -690,7 +699,7 @@ struct journal_s
        wait_queue_head_t       j_wait_updates;
 
        /* Semaphore for locking against concurrent checkpoints */
-       struct mutex            j_checkpoint_mutex;
+       struct mutex            j_checkpoint_mutex;
 
        /*
         * Journal head: identifies the first unused block in the journal.
@@ -723,7 +732,7 @@ struct journal_s
         */
        struct block_device     *j_dev;
        int                     j_blocksize;
-       unsigned int            j_blk_offset;
+       unsigned long           j_blk_offset;
 
        /*
         * Device which holds the client fs.  For internal journal this will be
@@ -814,8 +823,8 @@ struct journal_s
        void *j_private;
 };
 
-/* 
- * Journal flag definitions 
+/*
+ * Journal flag definitions
  */
 #define JFS_UNMOUNT    0x001   /* Journal thread is being destroyed */
 #define JFS_ABORT      0x002   /* Journaling has been aborted for errors. */
@@ -824,7 +833,7 @@ struct journal_s
 #define JFS_LOADED     0x010   /* The journal superblock has been loaded */
 #define JFS_BARRIER    0x020   /* Use IDE barriers */
 
-/* 
+/*
  * Function declarations for the journaling transaction and buffer
  * management
  */
@@ -849,15 +858,15 @@ extern void journal_commit_transaction(journal_t *);
 
 /* Checkpoint list management */
 int __journal_clean_checkpoint_list(journal_t *journal);
-void __journal_remove_checkpoint(struct journal_head *);
+int __journal_remove_checkpoint(struct journal_head *);
 void __journal_insert_checkpoint(struct journal_head *, transaction_t *);
 
 /* Buffer IO */
-extern int 
+extern int
 journal_write_metadata_buffer(transaction_t      *transaction,
                              struct journal_head  *jh_in,
                              struct journal_head **jh_out,
-                             int                  blocknr);
+                             unsigned long        blocknr);
 
 /* Transaction locking */
 extern void            __wait_on_journal (journal_t *);
@@ -881,7 +890,7 @@ static inline handle_t *journal_current_handle(void)
 /* The journaling code user interface:
  *
  * Create and destroy handles
- * Register buffer modifications against the current transaction. 
+ * Register buffer modifications against the current transaction.
  */
 
 extern handle_t *journal_start(journal_t *, int nblocks);
@@ -895,7 +904,7 @@ extern int   journal_dirty_metadata (handle_t *, struct buffer_head *);
 extern void     journal_release_buffer (handle_t *, struct buffer_head *);
 extern int      journal_forget (handle_t *, struct buffer_head *);
 extern void     journal_sync_buffer (struct buffer_head *);
-extern int      journal_invalidatepage(journal_t *,
+extern void     journal_invalidatepage(journal_t *,
                                struct page *, unsigned long);
 extern int      journal_try_to_free_buffers(journal_t *, struct page *, gfp_t);
 extern int      journal_stop(handle_t *);
@@ -908,11 +917,11 @@ extern journal_t * journal_init_dev(struct block_device *bdev,
                                int start, int len, int bsize);
 extern journal_t * journal_init_inode (struct inode *);
 extern int        journal_update_format (journal_t *);
-extern int        journal_check_used_features 
+extern int        journal_check_used_features
                   (journal_t *, unsigned long, unsigned long, unsigned long);
-extern int        journal_check_available_features 
+extern int        journal_check_available_features
                   (journal_t *, unsigned long, unsigned long, unsigned long);
-extern int        journal_set_features 
+extern int        journal_set_features
                   (journal_t *, unsigned long, unsigned long, unsigned long);
 extern int        journal_create     (journal_t *);
 extern int        journal_load       (journal_t *journal);
@@ -968,7 +977,6 @@ extern void    journal_write_revoke_records(journal_t *, transaction_t *);
 extern int     journal_set_revoke(journal_t *, unsigned long, tid_t);
 extern int     journal_test_revoke(journal_t *, unsigned long, tid_t);
 extern void    journal_clear_revoke(journal_t *);
-extern void    journal_brelse_array(struct buffer_head *b[], int n);
 extern void    journal_switch_revoke_table(journal_t *journal);
 
 /*
@@ -1006,7 +1014,7 @@ do {                                                                         \
  * bit, when set, indicates that we have had a fatal error somewhere,
  * either inside the journaling layer or indicated to us by the client
  * (eg. ext3), and that we and should not commit any further
- * transactions.  
+ * transactions.
  */
 
 static inline int is_journal_aborted(journal_t *journal)
@@ -1073,7 +1081,7 @@ static inline int jbd_space_needed(journal_t *journal)
 #define BJ_Reserved    7       /* Buffer is reserved for access by journal */
 #define BJ_Locked      8       /* Locked for I/O during commit */
 #define BJ_Types       9
+
 extern int jbd_blocks_per_page(struct inode *inode);
 
 #ifdef __KERNEL__