journal.c (ec66ee3797e5848356cf593c6ec7aabf30a00cf1) | journal.c (b7271b0a39947f757d7969f6150dcb16c1976b91) |
---|---|
1/* 2 * linux/fs/jbd2/journal.c 3 * 4 * Written by Stephen C. Tweedie <sct@redhat.com>, 1998 5 * 6 * Copyright 1998 Red Hat corp --- All Rights Reserved 7 * 8 * This file is part of the Linux kernel and is made available under --- 29 unchanged lines hidden (view full) --- 38#include <linux/debugfs.h> 39#include <linux/seq_file.h> 40#include <linux/math64.h> 41#include <linux/hash.h> 42#include <linux/log2.h> 43#include <linux/vmalloc.h> 44#include <linux/backing-dev.h> 45#include <linux/bitops.h> | 1/* 2 * linux/fs/jbd2/journal.c 3 * 4 * Written by Stephen C. Tweedie <sct@redhat.com>, 1998 5 * 6 * Copyright 1998 Red Hat corp --- All Rights Reserved 7 * 8 * This file is part of the Linux kernel and is made available under --- 29 unchanged lines hidden (view full) --- 38#include <linux/debugfs.h> 39#include <linux/seq_file.h> 40#include <linux/math64.h> 41#include <linux/hash.h> 42#include <linux/log2.h> 43#include <linux/vmalloc.h> 44#include <linux/backing-dev.h> 45#include <linux/bitops.h> |
46#include <linux/ratelimit.h> |
|
46 47#define CREATE_TRACE_POINTS 48#include <trace/events/jbd2.h> 49 50#include <asm/uaccess.h> 51#include <asm/page.h> 52#include <asm/system.h> 53 --- 768 unchanged lines hidden (view full) --- 822 823static journal_t * journal_init_common (void) 824{ 825 journal_t *journal; 826 int err; 827 828 journal = kzalloc(sizeof(*journal), GFP_KERNEL); 829 if (!journal) | 47 48#define CREATE_TRACE_POINTS 49#include <trace/events/jbd2.h> 50 51#include <asm/uaccess.h> 52#include <asm/page.h> 53#include <asm/system.h> 54 --- 768 unchanged lines hidden (view full) --- 823 824static journal_t * journal_init_common (void) 825{ 826 journal_t *journal; 827 int err; 828 829 journal = kzalloc(sizeof(*journal), GFP_KERNEL); 830 if (!journal) |
830 goto fail; | 831 return NULL; |
831 832 init_waitqueue_head(&journal->j_wait_transaction_locked); 833 init_waitqueue_head(&journal->j_wait_logspace); 834 init_waitqueue_head(&journal->j_wait_done_commit); 835 init_waitqueue_head(&journal->j_wait_checkpoint); 836 init_waitqueue_head(&journal->j_wait_commit); 837 init_waitqueue_head(&journal->j_wait_updates); 838 mutex_init(&journal->j_barrier); --- 8 unchanged lines hidden (view full) --- 847 848 /* The journal is marked for error until we succeed with recovery! */ 849 journal->j_flags = JBD2_ABORT; 850 851 /* Set up a default-sized revoke table for the new mount. */ 852 err = jbd2_journal_init_revoke(journal, JOURNAL_REVOKE_DEFAULT_HASH); 853 if (err) { 854 kfree(journal); | 832 833 init_waitqueue_head(&journal->j_wait_transaction_locked); 834 init_waitqueue_head(&journal->j_wait_logspace); 835 init_waitqueue_head(&journal->j_wait_done_commit); 836 init_waitqueue_head(&journal->j_wait_checkpoint); 837 init_waitqueue_head(&journal->j_wait_commit); 838 init_waitqueue_head(&journal->j_wait_updates); 839 mutex_init(&journal->j_barrier); --- 8 unchanged lines hidden (view full) --- 848 849 /* The journal is marked for error until we succeed with recovery! */ 850 journal->j_flags = JBD2_ABORT; 851 852 /* Set up a default-sized revoke table for the new mount. */ 853 err = jbd2_journal_init_revoke(journal, JOURNAL_REVOKE_DEFAULT_HASH); 854 if (err) { 855 kfree(journal); |
855 goto fail; | 856 return NULL; |
856 } 857 858 spin_lock_init(&journal->j_history_lock); 859 860 return journal; | 857 } 858 859 spin_lock_init(&journal->j_history_lock); 860 861 return journal; |
861fail: 862 return NULL; | |
863} 864 865/* jbd2_journal_init_dev and jbd2_journal_init_inode: 866 * 867 * Create a journal structure assigned some fixed set of disk blocks to 868 * the journal. We don't actually touch those disk blocks yet, but we 869 * need to set up all of the mapping information to tell the journaling 870 * system where the journal blocks are. --- 1106 unchanged lines hidden (view full) --- 1977} 1978 1979/* 1980 * journal_head splicing and dicing 1981 */ 1982static struct journal_head *journal_alloc_journal_head(void) 1983{ 1984 struct journal_head *ret; | 862} 863 864/* jbd2_journal_init_dev and jbd2_journal_init_inode: 865 * 866 * Create a journal structure assigned some fixed set of disk blocks to 867 * the journal. We don't actually touch those disk blocks yet, but we 868 * need to set up all of the mapping information to tell the journaling 869 * system where the journal blocks are. --- 1106 unchanged lines hidden (view full) --- 1976} 1977 1978/* 1979 * journal_head splicing and dicing 1980 */ 1981static struct journal_head *journal_alloc_journal_head(void) 1982{ 1983 struct journal_head *ret; |
1985 static unsigned long last_warning; | |
1986 1987#ifdef CONFIG_JBD2_DEBUG 1988 atomic_inc(&nr_journal_heads); 1989#endif 1990 ret = kmem_cache_alloc(jbd2_journal_head_cache, GFP_NOFS); 1991 if (!ret) { 1992 jbd_debug(1, "out of memory for journal_head\n"); | 1984 1985#ifdef CONFIG_JBD2_DEBUG 1986 atomic_inc(&nr_journal_heads); 1987#endif 1988 ret = kmem_cache_alloc(jbd2_journal_head_cache, GFP_NOFS); 1989 if (!ret) { 1990 jbd_debug(1, "out of memory for journal_head\n"); |
1993 if (time_after(jiffies, last_warning + 5*HZ)) { 1994 printk(KERN_NOTICE "ENOMEM in %s, retrying.\n", 1995 __func__); 1996 last_warning = jiffies; 1997 } | 1991 pr_notice_ratelimited("ENOMEM in %s, retrying.\n", __func__); |
1998 while (!ret) { 1999 yield(); 2000 ret = kmem_cache_alloc(jbd2_journal_head_cache, GFP_NOFS); 2001 } 2002 } 2003 return ret; 2004} 2005 --- 433 unchanged lines hidden --- | 1992 while (!ret) { 1993 yield(); 1994 ret = kmem_cache_alloc(jbd2_journal_head_cache, GFP_NOFS); 1995 } 1996 } 1997 return ret; 1998} 1999 --- 433 unchanged lines hidden --- |