vfs: rename block_fsync() to blkdev_fsync()
[safe/jmp/linux-2.6] / include / linux / jbd.h
index 346e2b8..516a2a2 100644 (file)
 #include <linux/mutex.h>
 #include <linux/timer.h>
 #include <linux/lockdep.h>
+#include <linux/slab.h>
 
 #define journal_oom_retry 1
 
 /*
- * Define JBD_PARANIOD_IOFAIL to cause a kernel BUG() if ext3 finds
+ * Define JBD_PARANOID_IOFAIL to cause a kernel BUG() if ext3 finds
  * certain classes of error which can occur due to failed IOs.  Under
  * normal use we want ext3 to continue after such errors, because
  * hardware _can_ fail, but for debugging purposes when running tests on
@@ -246,19 +247,8 @@ typedef struct journal_superblock_s
 
 #define J_ASSERT(assert)       BUG_ON(!(assert))
 
-#if defined(CONFIG_BUFFER_DEBUG)
-void buffer_assertion_failure(struct buffer_head *bh);
-#define J_ASSERT_BH(bh, expr)                                          \
-       do {                                                            \
-               if (!(expr))                                            \
-                       buffer_assertion_failure(bh);                   \
-               J_ASSERT(expr);                                         \
-       } while (0)
-#define J_ASSERT_JH(jh, expr)  J_ASSERT_BH(jh2bh(jh), expr)
-#else
 #define J_ASSERT_BH(bh, expr)  J_ASSERT(expr)
 #define J_ASSERT_JH(jh, expr)  J_ASSERT(expr)
-#endif
 
 #if defined(JBD_PARANOID_IOFAIL)
 #define J_EXPECT(expr, why...)         J_ASSERT(expr)
@@ -446,7 +436,7 @@ struct transaction_s
        /*
         * Where in the log does this transaction's commit start? [no locking]
         */
-       unsigned long           t_log_start;
+       unsigned int            t_log_start;
 
        /* Number of buffers on the t_buffers list [j_list_lock] */
        int                     t_nr_buffers;
@@ -543,10 +533,20 @@ struct transaction_s
        unsigned long           t_expires;
 
        /*
+        * When this transaction started, in nanoseconds [no locking]
+        */
+       ktime_t                 t_start_time;
+
+       /*
         * How many handles used this transaction? [t_handle_lock]
         */
        int t_handle_count;
 
+       /*
+        * This transaction is being forced and some process is
+        * waiting for it to finish.
+        */
+       unsigned int t_synchronous_commit:1;
 };
 
 /**
@@ -609,6 +609,8 @@ struct transaction_s
  * @j_wbufsize: maximum number of buffer_heads allowed in j_wbuf, the
  *     number that will fit in j_blocksize
  * @j_last_sync_writer: most recent pid which did a synchronous write
+ * @j_average_commit_time: the average amount of time in nanoseconds it
+ *     takes to commit a transaction to the disk.
  * @j_private: An opaque pointer to fs-private information.
  */
 
@@ -689,26 +691,26 @@ struct journal_s
         * Journal head: identifies the first unused block in the journal.
         * [j_state_lock]
         */
-       unsigned long           j_head;
+       unsigned int            j_head;
 
        /*
         * Journal tail: identifies the oldest still-used block in the journal.
         * [j_state_lock]
         */
-       unsigned long           j_tail;
+       unsigned int            j_tail;
 
        /*
         * Journal free: how many free blocks are there in the journal?
         * [j_state_lock]
         */
-       unsigned long           j_free;
+       unsigned int            j_free;
 
        /*
         * Journal start and end: the block numbers of the first usable block
         * and one beyond the last usable block in the journal. [j_state_lock]
         */
-       unsigned long           j_first;
-       unsigned long           j_last;
+       unsigned int            j_first;
+       unsigned int            j_last;
 
        /*
         * Device, blocksize and starting block offset for the location where we
@@ -716,7 +718,7 @@ struct journal_s
         */
        struct block_device     *j_dev;
        int                     j_blocksize;
-       unsigned long           j_blk_offset;
+       unsigned int            j_blk_offset;
 
        /*
         * Device which holds the client fs.  For internal journal this will be
@@ -798,9 +800,19 @@ struct journal_s
        struct buffer_head      **j_wbuf;
        int                     j_wbufsize;
 
+       /*
+        * this is the pid of the last person to run a synchronous operation
+        * through the journal.
+        */
        pid_t                   j_last_sync_writer;
 
        /*
+        * the average amount of time in nanoseconds it takes to commit a
+        * transaction to the disk.  [j_state_lock]
+        */
+       u64                     j_average_commit_time;
+
+       /*
         * An opaque pointer to fs-private information.  ext3 puts its
         * superblock pointer here
         */
@@ -837,7 +849,7 @@ extern void __journal_clean_data_list(transaction_t *transaction);
 
 /* Log buffer allocation */
 extern struct journal_head * journal_get_descriptor_buffer(journal_t *);
-int journal_next_log_block(journal_t *, unsigned long *);
+int journal_next_log_block(journal_t *, unsigned int *);
 
 /* Commit management */
 extern void journal_commit_transaction(journal_t *);
@@ -852,7 +864,7 @@ extern int
 journal_write_metadata_buffer(transaction_t      *transaction,
                              struct journal_head  *jh_in,
                              struct journal_head **jh_out,
-                             unsigned long        blocknr);
+                             unsigned int blocknr);
 
 /* Transaction locking */
 extern void            __wait_on_journal (journal_t *);
@@ -920,7 +932,7 @@ extern void    journal_abort      (journal_t *, int);
 extern int        journal_errno      (journal_t *);
 extern void       journal_ack_err    (journal_t *);
 extern int        journal_clear_err  (journal_t *);
-extern int        journal_bmap(journal_t *, unsigned long, unsigned long *);
+extern int        journal_bmap(journal_t *, unsigned int, unsigned int *);
 extern int        journal_force_commit(journal_t *);
 
 /*
@@ -954,13 +966,14 @@ extern int           journal_init_revoke_caches(void);
 
 extern void       journal_destroy_revoke(journal_t *);
 extern int        journal_revoke (handle_t *,
-                               unsigned long, struct buffer_head *);
+                               unsigned int, struct buffer_head *);
 extern int        journal_cancel_revoke(handle_t *, struct journal_head *);
-extern void       journal_write_revoke_records(journal_t *, transaction_t *);
+extern void       journal_write_revoke_records(journal_t *,
+                                               transaction_t *, int);
 
 /* Recovery revoke support */
-extern int     journal_set_revoke(journal_t *, unsigned long, tid_t);
-extern int     journal_test_revoke(journal_t *, unsigned long, tid_t);
+extern int     journal_set_revoke(journal_t *, unsigned int, tid_t);
+extern int     journal_test_revoke(journal_t *, unsigned int, tid_t);
 extern void    journal_clear_revoke(journal_t *);
 extern void    journal_switch_revoke_table(journal_t *journal);