diff options
Diffstat (limited to 'fs/jbd2')
-rw-r--r-- | fs/jbd2/journal.c | 34 | ||||
-rw-r--r-- | fs/jbd2/recovery.c | 2 | ||||
-rw-r--r-- | fs/jbd2/transaction.c | 6 |
3 files changed, 20 insertions, 22 deletions
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index f837ba953529..9e4686900f18 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <linux/vmalloc.h> | 43 | #include <linux/vmalloc.h> |
44 | #include <linux/backing-dev.h> | 44 | #include <linux/backing-dev.h> |
45 | #include <linux/bitops.h> | 45 | #include <linux/bitops.h> |
46 | #include <linux/ratelimit.h> | ||
46 | 47 | ||
47 | #define CREATE_TRACE_POINTS | 48 | #define CREATE_TRACE_POINTS |
48 | #include <trace/events/jbd2.h> | 49 | #include <trace/events/jbd2.h> |
@@ -93,6 +94,7 @@ EXPORT_SYMBOL(jbd2_journal_file_inode); | |||
93 | EXPORT_SYMBOL(jbd2_journal_init_jbd_inode); | 94 | EXPORT_SYMBOL(jbd2_journal_init_jbd_inode); |
94 | EXPORT_SYMBOL(jbd2_journal_release_jbd_inode); | 95 | EXPORT_SYMBOL(jbd2_journal_release_jbd_inode); |
95 | EXPORT_SYMBOL(jbd2_journal_begin_ordered_truncate); | 96 | EXPORT_SYMBOL(jbd2_journal_begin_ordered_truncate); |
97 | EXPORT_SYMBOL(jbd2_inode_cache); | ||
96 | 98 | ||
97 | static int journal_convert_superblock_v1(journal_t *, journal_superblock_t *); | 99 | static int journal_convert_superblock_v1(journal_t *, journal_superblock_t *); |
98 | static void __journal_abort_soft (journal_t *journal, int errno); | 100 | static void __journal_abort_soft (journal_t *journal, int errno); |
@@ -827,7 +829,7 @@ static journal_t * journal_init_common (void) | |||
827 | 829 | ||
828 | journal = kzalloc(sizeof(*journal), GFP_KERNEL); | 830 | journal = kzalloc(sizeof(*journal), GFP_KERNEL); |
829 | if (!journal) | 831 | if (!journal) |
830 | goto fail; | 832 | return NULL; |
831 | 833 | ||
832 | init_waitqueue_head(&journal->j_wait_transaction_locked); | 834 | init_waitqueue_head(&journal->j_wait_transaction_locked); |
833 | init_waitqueue_head(&journal->j_wait_logspace); | 835 | init_waitqueue_head(&journal->j_wait_logspace); |
@@ -852,14 +854,12 @@ static journal_t * journal_init_common (void) | |||
852 | err = jbd2_journal_init_revoke(journal, JOURNAL_REVOKE_DEFAULT_HASH); | 854 | err = jbd2_journal_init_revoke(journal, JOURNAL_REVOKE_DEFAULT_HASH); |
853 | if (err) { | 855 | if (err) { |
854 | kfree(journal); | 856 | kfree(journal); |
855 | goto fail; | 857 | return NULL; |
856 | } | 858 | } |
857 | 859 | ||
858 | spin_lock_init(&journal->j_history_lock); | 860 | spin_lock_init(&journal->j_history_lock); |
859 | 861 | ||
860 | return journal; | 862 | return journal; |
861 | fail: | ||
862 | return NULL; | ||
863 | } | 863 | } |
864 | 864 | ||
865 | /* jbd2_journal_init_dev and jbd2_journal_init_inode: | 865 | /* jbd2_journal_init_dev and jbd2_journal_init_inode: |
@@ -1982,7 +1982,6 @@ static void jbd2_journal_destroy_jbd2_journal_head_cache(void) | |||
1982 | static struct journal_head *journal_alloc_journal_head(void) | 1982 | static struct journal_head *journal_alloc_journal_head(void) |
1983 | { | 1983 | { |
1984 | struct journal_head *ret; | 1984 | struct journal_head *ret; |
1985 | static unsigned long last_warning; | ||
1986 | 1985 | ||
1987 | #ifdef CONFIG_JBD2_DEBUG | 1986 | #ifdef CONFIG_JBD2_DEBUG |
1988 | atomic_inc(&nr_journal_heads); | 1987 | atomic_inc(&nr_journal_heads); |
@@ -1990,11 +1989,7 @@ static struct journal_head *journal_alloc_journal_head(void) | |||
1990 | ret = kmem_cache_alloc(jbd2_journal_head_cache, GFP_NOFS); | 1989 | ret = kmem_cache_alloc(jbd2_journal_head_cache, GFP_NOFS); |
1991 | if (!ret) { | 1990 | if (!ret) { |
1992 | jbd_debug(1, "out of memory for journal_head\n"); | 1991 | jbd_debug(1, "out of memory for journal_head\n"); |
1993 | if (time_after(jiffies, last_warning + 5*HZ)) { | 1992 | pr_notice_ratelimited("ENOMEM in %s, retrying.\n", __func__); |
1994 | printk(KERN_NOTICE "ENOMEM in %s, retrying.\n", | ||
1995 | __func__); | ||
1996 | last_warning = jiffies; | ||
1997 | } | ||
1998 | while (!ret) { | 1993 | while (!ret) { |
1999 | yield(); | 1994 | yield(); |
2000 | ret = kmem_cache_alloc(jbd2_journal_head_cache, GFP_NOFS); | 1995 | ret = kmem_cache_alloc(jbd2_journal_head_cache, GFP_NOFS); |
@@ -2292,17 +2287,19 @@ static void __exit jbd2_remove_jbd_stats_proc_entry(void) | |||
2292 | 2287 | ||
2293 | #endif | 2288 | #endif |
2294 | 2289 | ||
2295 | struct kmem_cache *jbd2_handle_cache; | 2290 | struct kmem_cache *jbd2_handle_cache, *jbd2_inode_cache; |
2296 | 2291 | ||
2297 | static int __init journal_init_handle_cache(void) | 2292 | static int __init journal_init_handle_cache(void) |
2298 | { | 2293 | { |
2299 | jbd2_handle_cache = kmem_cache_create("jbd2_journal_handle", | 2294 | jbd2_handle_cache = KMEM_CACHE(jbd2_journal_handle, SLAB_TEMPORARY); |
2300 | sizeof(handle_t), | ||
2301 | 0, /* offset */ | ||
2302 | SLAB_TEMPORARY, /* flags */ | ||
2303 | NULL); /* ctor */ | ||
2304 | if (jbd2_handle_cache == NULL) { | 2295 | if (jbd2_handle_cache == NULL) { |
2305 | printk(KERN_EMERG "JBD: failed to create handle cache\n"); | 2296 | printk(KERN_EMERG "JBD2: failed to create handle cache\n"); |
2297 | return -ENOMEM; | ||
2298 | } | ||
2299 | jbd2_inode_cache = KMEM_CACHE(jbd2_inode, 0); | ||
2300 | if (jbd2_inode_cache == NULL) { | ||
2301 | printk(KERN_EMERG "JBD2: failed to create inode cache\n"); | ||
2302 | kmem_cache_destroy(jbd2_handle_cache); | ||
2306 | return -ENOMEM; | 2303 | return -ENOMEM; |
2307 | } | 2304 | } |
2308 | return 0; | 2305 | return 0; |
@@ -2312,6 +2309,9 @@ static void jbd2_journal_destroy_handle_cache(void) | |||
2312 | { | 2309 | { |
2313 | if (jbd2_handle_cache) | 2310 | if (jbd2_handle_cache) |
2314 | kmem_cache_destroy(jbd2_handle_cache); | 2311 | kmem_cache_destroy(jbd2_handle_cache); |
2312 | if (jbd2_inode_cache) | ||
2313 | kmem_cache_destroy(jbd2_inode_cache); | ||
2314 | |||
2315 | } | 2315 | } |
2316 | 2316 | ||
2317 | /* | 2317 | /* |
diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c index 2bc4d5f116f1..1cad869494f0 100644 --- a/fs/jbd2/recovery.c +++ b/fs/jbd2/recovery.c | |||
@@ -299,10 +299,10 @@ int jbd2_journal_skip_recovery(journal_t *journal) | |||
299 | #ifdef CONFIG_JBD2_DEBUG | 299 | #ifdef CONFIG_JBD2_DEBUG |
300 | int dropped = info.end_transaction - | 300 | int dropped = info.end_transaction - |
301 | be32_to_cpu(journal->j_superblock->s_sequence); | 301 | be32_to_cpu(journal->j_superblock->s_sequence); |
302 | #endif | ||
303 | jbd_debug(1, | 302 | jbd_debug(1, |
304 | "JBD: ignoring %d transaction%s from the journal.\n", | 303 | "JBD: ignoring %d transaction%s from the journal.\n", |
305 | dropped, (dropped == 1) ? "" : "s"); | 304 | dropped, (dropped == 1) ? "" : "s"); |
305 | #endif | ||
306 | journal->j_transaction_sequence = ++info.end_transaction; | 306 | journal->j_transaction_sequence = ++info.end_transaction; |
307 | } | 307 | } |
308 | 308 | ||
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index c7934900dcdd..faad2bd787c7 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c | |||
@@ -340,9 +340,7 @@ handle_t *jbd2__journal_start(journal_t *journal, int nblocks, int gfp_mask) | |||
340 | jbd2_free_handle(handle); | 340 | jbd2_free_handle(handle); |
341 | current->journal_info = NULL; | 341 | current->journal_info = NULL; |
342 | handle = ERR_PTR(err); | 342 | handle = ERR_PTR(err); |
343 | goto out; | ||
344 | } | 343 | } |
345 | out: | ||
346 | return handle; | 344 | return handle; |
347 | } | 345 | } |
348 | EXPORT_SYMBOL(jbd2__journal_start); | 346 | EXPORT_SYMBOL(jbd2__journal_start); |
@@ -589,7 +587,7 @@ do_get_write_access(handle_t *handle, struct journal_head *jh, | |||
589 | transaction = handle->h_transaction; | 587 | transaction = handle->h_transaction; |
590 | journal = transaction->t_journal; | 588 | journal = transaction->t_journal; |
591 | 589 | ||
592 | jbd_debug(5, "buffer_head %p, force_copy %d\n", jh, force_copy); | 590 | jbd_debug(5, "journal_head %p, force_copy %d\n", jh, force_copy); |
593 | 591 | ||
594 | JBUFFER_TRACE(jh, "entry"); | 592 | JBUFFER_TRACE(jh, "entry"); |
595 | repeat: | 593 | repeat: |
@@ -774,7 +772,7 @@ done: | |||
774 | J_EXPECT_JH(jh, buffer_uptodate(jh2bh(jh)), | 772 | J_EXPECT_JH(jh, buffer_uptodate(jh2bh(jh)), |
775 | "Possible IO failure.\n"); | 773 | "Possible IO failure.\n"); |
776 | page = jh2bh(jh)->b_page; | 774 | page = jh2bh(jh)->b_page; |
777 | offset = ((unsigned long) jh2bh(jh)->b_data) & ~PAGE_MASK; | 775 | offset = offset_in_page(jh2bh(jh)->b_data); |
778 | source = kmap_atomic(page, KM_USER0); | 776 | source = kmap_atomic(page, KM_USER0); |
779 | /* Fire data frozen trigger just before we copy the data */ | 777 | /* Fire data frozen trigger just before we copy the data */ |
780 | jbd2_buffer_frozen_trigger(jh, source + offset, | 778 | jbd2_buffer_frozen_trigger(jh, source + offset, |