ext4, jbd2: Provide accessor function for handle credits
[linux-2.6-microblaze.git] / include / linux / jbd2.h
index 603fbc4..727ff91 100644 (file)
@@ -1582,7 +1582,7 @@ static inline int jbd2_space_needed(journal_t *journal)
 static inline unsigned long jbd2_log_space_left(journal_t *journal)
 {
        /* Allow for rounding errors */
-       unsigned long free = journal->j_free - 32;
+       long free = journal->j_free - 32;
 
        if (journal->j_committing_transaction) {
                unsigned long committing = atomic_read(&journal->
@@ -1591,7 +1591,7 @@ static inline unsigned long jbd2_log_space_left(journal_t *journal)
                /* Transaction + control blocks */
                free -= committing + (committing >> JBD2_CONTROL_BLOCKS_SHIFT);
        }
-       return free;
+       return max_t(long, free, 0);
 }
 
 /*
@@ -1645,6 +1645,12 @@ static inline tid_t  jbd2_get_latest_transaction(journal_t *journal)
        return tid;
 }
 
+
+static inline int jbd2_handle_buffer_credits(handle_t *handle)
+{
+       return handle->h_buffer_credits;
+}
+
 #ifdef __KERNEL__
 
 #define buffer_trace_init(bh)  do {} while (0)