This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / include / linux / jbd.h
index fbc8eb9..48cf7ee 100644 (file)
@@ -301,7 +301,6 @@ enum jbd_state_bits {
        BH_JBDDirty,            /* Is dirty but journaled */
        BH_State,               /* Pins most journal_head state */
        BH_JournalHead,         /* Pins bh->b_private and jh->b_bh */
-       BH_Unshadow,            /* Dummy bit, for BJ_Shadow wakeup filtering */
 };
 
 BUFFER_FNS(JBD, jbd)
@@ -354,6 +353,27 @@ static inline void jbd_unlock_bh_journal_head(struct buffer_head *bh)
        bit_spin_unlock(BH_JournalHead, &bh->b_state);
 }
 
+#define HAVE_JOURNAL_CALLBACK_STATUS
+/**
+ *   struct journal_callback - Base structure for callback information.
+ *   @jcb_list: list information for other callbacks attached to the same handle.
+ *   @jcb_func: Function to call with this callback structure. 
+ *
+ *   This struct is a 'seed' structure for a using with your own callback
+ *   structs. If you are using callbacks you must allocate one of these
+ *   or another struct of your own definition which has this struct 
+ *   as it's first element and pass it to journal_callback_set().
+ *
+ *   This is used internally by jbd to maintain callback information.
+ *
+ *   See journal_callback_set for more information.
+ **/
+struct journal_callback {
+       struct list_head jcb_list;              /* t_jcb_lock */
+       void (*jcb_func)(struct journal_callback *jcb, int error);
+       /* user data goes here */
+};
+
 struct jbd_revoke_table_s;
 
 /**
@@ -362,6 +382,7 @@ struct jbd_revoke_table_s;
  * @h_transaction: Which compound transaction is this update a part of?
  * @h_buffer_credits: Number of remaining buffers we are allowed to dirty.
  * @h_ref: Reference count on this handle
+ * @h_jcb: List of application registered callbacks for this handle.
  * @h_err: Field for caller's use to track errors through large fs operations
  * @h_sync: flag for sync-on-close
  * @h_jdata: flag to force data journaling
@@ -387,6 +408,13 @@ struct handle_s
        /* operations */
        int                     h_err;
 
+       /*
+        * List of application registered callbacks for this handle. The
+        * function(s) will be called after the transaction that this handle is
+        * part of has been committed to disk. [t_jcb_lock]
+        */
+       struct list_head        h_jcb;
+
        /* Flags [no locking] */
        unsigned int    h_sync:         1;      /* sync-on-close */
        unsigned int    h_jdata:        1;      /* force data journaling */
@@ -428,6 +456,8 @@ struct handle_s
  *    j_state_lock
  *    ->j_list_lock                    (journal_unmap_buffer)
  *
+ *    t_handle_lock
+ *    ->t_jcb_lock
  */
 
 struct transaction_s 
@@ -551,6 +581,15 @@ struct transaction_s
         */
        int t_handle_count;
 
+       /*
+        * Protects the callback list
+        */
+       spinlock_t              t_jcb_lock;
+       /*
+        * List of registered callback functions for this transaction.
+        * Called when the transaction is committed. [t_jcb_lock]
+        */
+       struct list_head        t_jcb;
 };
 
 /**
@@ -883,6 +922,10 @@ extern int  journal_invalidatepage(journal_t *,
 extern int      journal_try_to_free_buffers(journal_t *, struct page *, int);
 extern int      journal_stop(handle_t *);
 extern int      journal_flush (journal_t *);
+extern void     journal_callback_set(handle_t *handle,
+                                     void (*fn)(struct journal_callback *,int),
+                                     struct journal_callback *jcb);
+
 extern void     journal_lock_updates (journal_t *);
 extern void     journal_unlock_updates (journal_t *);