aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/jbd2.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/jbd2.h')
-rw-r--r--include/linux/jbd2.h50
1 files changed, 18 insertions, 32 deletions
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 638ce4554c76..0b52924a0cb6 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -30,6 +30,7 @@
30#include <linux/bit_spinlock.h> 30#include <linux/bit_spinlock.h>
31#include <linux/mutex.h> 31#include <linux/mutex.h>
32#include <linux/timer.h> 32#include <linux/timer.h>
33#include <linux/slab.h>
33#endif 34#endif
34 35
35#define journal_oom_retry 1 36#define journal_oom_retry 1
@@ -69,15 +70,8 @@ extern u8 jbd2_journal_enable_debug;
69#define jbd_debug(f, a...) /**/ 70#define jbd_debug(f, a...) /**/
70#endif 71#endif
71 72
72static inline void *jbd2_alloc(size_t size, gfp_t flags) 73extern void *jbd2_alloc(size_t size, gfp_t flags);
73{ 74extern void jbd2_free(void *ptr, size_t size);
74 return (void *)__get_free_pages(flags, get_order(size));
75}
76
77static inline void jbd2_free(void *ptr, size_t size)
78{
79 free_pages((unsigned long)ptr, get_order(size));
80};
81 75
82#define JBD2_MIN_JOURNAL_BLOCKS 1024 76#define JBD2_MIN_JOURNAL_BLOCKS 1024
83 77
@@ -284,19 +278,8 @@ typedef struct journal_superblock_s
284 278
285#define J_ASSERT(assert) BUG_ON(!(assert)) 279#define J_ASSERT(assert) BUG_ON(!(assert))
286 280
287#if defined(CONFIG_BUFFER_DEBUG)
288void buffer_assertion_failure(struct buffer_head *bh);
289#define J_ASSERT_BH(bh, expr) \
290 do { \
291 if (!(expr)) \
292 buffer_assertion_failure(bh); \
293 J_ASSERT(expr); \
294 } while (0)
295#define J_ASSERT_JH(jh, expr) J_ASSERT_BH(jh2bh(jh), expr)
296#else
297#define J_ASSERT_BH(bh, expr) J_ASSERT(expr) 281#define J_ASSERT_BH(bh, expr) J_ASSERT(expr)
298#define J_ASSERT_JH(jh, expr) J_ASSERT(expr) 282#define J_ASSERT_JH(jh, expr) J_ASSERT(expr)
299#endif
300 283
301#if defined(JBD2_PARANOID_IOFAIL) 284#if defined(JBD2_PARANOID_IOFAIL)
302#define J_EXPECT(expr, why...) J_ASSERT(expr) 285#define J_EXPECT(expr, why...) J_ASSERT(expr)
@@ -618,13 +601,13 @@ struct transaction_s
618 * Number of outstanding updates running on this transaction 601 * Number of outstanding updates running on this transaction
619 * [t_handle_lock] 602 * [t_handle_lock]
620 */ 603 */
621 int t_updates; 604 atomic_t t_updates;
622 605
623 /* 606 /*
624 * Number of buffers reserved for use by all handles in this transaction 607 * Number of buffers reserved for use by all handles in this transaction
625 * handle but not yet modified. [t_handle_lock] 608 * handle but not yet modified. [t_handle_lock]
626 */ 609 */
627 int t_outstanding_credits; 610 atomic_t t_outstanding_credits;
628 611
629 /* 612 /*
630 * Forward and backward links for the circular list of all transactions 613 * Forward and backward links for the circular list of all transactions
@@ -646,7 +629,7 @@ struct transaction_s
646 /* 629 /*
647 * How many handles used this transaction? [t_handle_lock] 630 * How many handles used this transaction? [t_handle_lock]
648 */ 631 */
649 int t_handle_count; 632 atomic_t t_handle_count;
650 633
651 /* 634 /*
652 * This transaction is being forced and some process is 635 * This transaction is being forced and some process is
@@ -781,7 +764,7 @@ struct journal_s
781 /* 764 /*
782 * Protect the various scalars in the journal 765 * Protect the various scalars in the journal
783 */ 766 */
784 spinlock_t j_state_lock; 767 rwlock_t j_state_lock;
785 768
786 /* 769 /*
787 * Number of processes waiting to create a barrier lock [j_state_lock] 770 * Number of processes waiting to create a barrier lock [j_state_lock]
@@ -1043,11 +1026,12 @@ void __jbd2_journal_insert_checkpoint(struct journal_head *, transaction_t *);
1043 1026
1044struct jbd2_buffer_trigger_type { 1027struct jbd2_buffer_trigger_type {
1045 /* 1028 /*
1046 * Fired just before a buffer is written to the journal. 1029 * Fired a the moment data to write to the journal are known to be
1047 * mapped_data is a mapped buffer that is the frozen data for 1030 * stable - so either at the moment b_frozen_data is created or just
1048 * commit. 1031 * before a buffer is written to the journal. mapped_data is a mapped
1032 * buffer that is the frozen data for commit.
1049 */ 1033 */
1050 void (*t_commit)(struct jbd2_buffer_trigger_type *type, 1034 void (*t_frozen)(struct jbd2_buffer_trigger_type *type,
1051 struct buffer_head *bh, void *mapped_data, 1035 struct buffer_head *bh, void *mapped_data,
1052 size_t size); 1036 size_t size);
1053 1037
@@ -1059,7 +1043,7 @@ struct jbd2_buffer_trigger_type {
1059 struct buffer_head *bh); 1043 struct buffer_head *bh);
1060}; 1044};
1061 1045
1062extern void jbd2_buffer_commit_trigger(struct journal_head *jh, 1046extern void jbd2_buffer_frozen_trigger(struct journal_head *jh,
1063 void *mapped_data, 1047 void *mapped_data,
1064 struct jbd2_buffer_trigger_type *triggers); 1048 struct jbd2_buffer_trigger_type *triggers);
1065extern void jbd2_buffer_abort_trigger(struct journal_head *jh, 1049extern void jbd2_buffer_abort_trigger(struct journal_head *jh,
@@ -1098,7 +1082,9 @@ static inline handle_t *journal_current_handle(void)
1098 */ 1082 */
1099 1083
1100extern handle_t *jbd2_journal_start(journal_t *, int nblocks); 1084extern handle_t *jbd2_journal_start(journal_t *, int nblocks);
1101extern int jbd2_journal_restart (handle_t *, int nblocks); 1085extern handle_t *jbd2__journal_start(journal_t *, int nblocks, int gfp_mask);
1086extern int jbd2_journal_restart(handle_t *, int nblocks);
1087extern int jbd2__journal_restart(handle_t *, int nblocks, int gfp_mask);
1102extern int jbd2_journal_extend (handle_t *, int nblocks); 1088extern int jbd2_journal_extend (handle_t *, int nblocks);
1103extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *); 1089extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *);
1104extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *); 1090extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *);
@@ -1273,8 +1259,8 @@ static inline int jbd_space_needed(journal_t *journal)
1273{ 1259{
1274 int nblocks = journal->j_max_transaction_buffers; 1260 int nblocks = journal->j_max_transaction_buffers;
1275 if (journal->j_committing_transaction) 1261 if (journal->j_committing_transaction)
1276 nblocks += journal->j_committing_transaction-> 1262 nblocks += atomic_read(&journal->j_committing_transaction->
1277 t_outstanding_credits; 1263 t_outstanding_credits);
1278 return nblocks; 1264 return nblocks;
1279} 1265}
1280 1266