]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - include/linux/jbd2.h
mm/memory_hotplug: export generic_online_page()
[linux.git] / include / linux / jbd2.h
index 2a3d5f50e7a1d07939cc6b9d34c032a5fb2d332e..29dce6ff6bae88fd8c367a47b0fca1eb0f790481 100644 (file)
@@ -313,7 +313,6 @@ enum jbd_state_bits {
        BH_Revoked,             /* Has been revoked from the log */
        BH_RevokeValid,         /* Revoked flag is valid */
        BH_JBDDirty,            /* Is dirty but journaled */
-       BH_State,               /* Pins most journal_head state */
        BH_JournalHead,         /* Pins bh->b_private and jh->b_bh */
        BH_Shadow,              /* IO on shadow buffer is running */
        BH_Verified,            /* Metadata block has been verified ok */
@@ -342,26 +341,6 @@ static inline struct journal_head *bh2jh(struct buffer_head *bh)
        return bh->b_private;
 }
 
-static inline void jbd_lock_bh_state(struct buffer_head *bh)
-{
-       bit_spin_lock(BH_State, &bh->b_state);
-}
-
-static inline int jbd_trylock_bh_state(struct buffer_head *bh)
-{
-       return bit_spin_trylock(BH_State, &bh->b_state);
-}
-
-static inline int jbd_is_locked_bh_state(struct buffer_head *bh)
-{
-       return bit_spin_is_locked(BH_State, &bh->b_state);
-}
-
-static inline void jbd_unlock_bh_state(struct buffer_head *bh)
-{
-       bit_spin_unlock(BH_State, &bh->b_state);
-}
-
 static inline void jbd_lock_bh_journal_head(struct buffer_head *bh)
 {
        bit_spin_lock(BH_JournalHead, &bh->b_state);
@@ -477,7 +456,8 @@ struct jbd2_revoke_table_s;
  * @h_transaction: Which compound transaction is this update a part of?
  * @h_journal: Which journal handle belongs to - used iff h_reserved set.
  * @h_rsv_handle: Handle reserved for finishing the logical operation.
- * @h_buffer_credits: Number of remaining buffers we are allowed to dirty.
+ * @h_total_credits: Number of remaining buffers we are allowed to add to
+       journal. These are dirty buffers and revoke descriptor blocks.
  * @h_revoke_credits: Number of remaining revoke records available for handle
  * @h_ref: Reference count on this handle.
  * @h_err: Field for caller's use to track errors through large fs operations.
@@ -488,7 +468,7 @@ struct jbd2_revoke_table_s;
  * @h_type: For handle statistics.
  * @h_line_no: For handle statistics.
  * @h_start_jiffies: Handle Start time.
- * @h_requested_credits: Holds @h_buffer_credits after handle is started.
+ * @h_requested_credits: Holds @h_total_credits after handle is started.
  * @h_revoke_credits_requested: Holds @h_revoke_credits after handle is started.
  * @saved_alloc_context: Saved context while transaction is open.
  **/
@@ -506,7 +486,7 @@ struct jbd2_journal_handle
        };
 
        handle_t                *h_rsv_handle;
-       int                     h_buffer_credits;
+       int                     h_total_credits;
        int                     h_revoke_credits;
        int                     h_revoke_credits_requested;
        int                     h_ref;
@@ -560,9 +540,9 @@ struct transaction_chp_stats_s {
  *      ->jbd_lock_bh_journal_head()   (This is "innermost")
  *
  *    j_state_lock
- *    ->jbd_lock_bh_state()
+ *    ->b_state_lock
  *
- *    jbd_lock_bh_state()
+ *    b_state_lock
  *    ->j_list_lock
  *
  *    j_state_lock
@@ -1189,7 +1169,7 @@ struct journal_s
 #define jbd2_might_wait_for_commit(j) \
        do { \
                rwsem_acquire(&j->j_trans_commit_map, 0, 0, _THIS_IP_); \
-               rwsem_release(&j->j_trans_commit_map, 1, _THIS_IP_); \
+               rwsem_release(&j->j_trans_commit_map, _THIS_IP_); \
        } while (0)
 
 /* journal feature predicate functions */
@@ -1276,7 +1256,7 @@ JBD2_FEATURE_INCOMPAT_FUNCS(csum3,                CSUM_V3)
 
 /* Filing buffers */
 extern void jbd2_journal_unfile_buffer(journal_t *, struct journal_head *);
-extern void __jbd2_journal_refile_buffer(struct journal_head *);
+extern bool __jbd2_journal_refile_buffer(struct journal_head *);
 extern void jbd2_journal_refile_buffer(journal_t *, struct journal_head *);
 extern void __jbd2_journal_file_buffer(struct journal_head *, transaction_t *, int);
 extern void __journal_free_buffer(struct journal_head *bh);
@@ -1647,12 +1627,16 @@ static inline tid_t  jbd2_get_latest_transaction(journal_t *journal)
        return tid;
 }
 
-
 static inline int jbd2_handle_buffer_credits(handle_t *handle)
 {
-       journal_t *journal = handle->h_transaction->t_journal;
+       journal_t *journal;
+
+       if (!handle->h_reserved)
+               journal = handle->h_transaction->t_journal;
+       else
+               journal = handle->h_journal;
 
-       return handle->h_buffer_credits -
+       return handle->h_total_credits -
                DIV_ROUND_UP(handle->h_revoke_credits_requested,
                             journal->j_revoke_records_per_block);
 }