diff options
Diffstat (limited to 'fs/jbd2/journal.c')
-rw-r--r-- | fs/jbd2/journal.c | 55 |
1 files changed, 25 insertions, 30 deletions
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index 954cff001df6..53632e3e8457 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c | |||
@@ -534,7 +534,7 @@ int jbd2_log_wait_commit(journal_t *journal, tid_t tid) | |||
534 | if (!tid_geq(journal->j_commit_request, tid)) { | 534 | if (!tid_geq(journal->j_commit_request, tid)) { |
535 | printk(KERN_EMERG | 535 | printk(KERN_EMERG |
536 | "%s: error: j_commit_request=%d, tid=%d\n", | 536 | "%s: error: j_commit_request=%d, tid=%d\n", |
537 | __FUNCTION__, journal->j_commit_request, tid); | 537 | __func__, journal->j_commit_request, tid); |
538 | } | 538 | } |
539 | spin_unlock(&journal->j_state_lock); | 539 | spin_unlock(&journal->j_state_lock); |
540 | #endif | 540 | #endif |
@@ -599,7 +599,7 @@ int jbd2_journal_bmap(journal_t *journal, unsigned long blocknr, | |||
599 | 599 | ||
600 | printk(KERN_ALERT "%s: journal block not found " | 600 | printk(KERN_ALERT "%s: journal block not found " |
601 | "at offset %lu on %s\n", | 601 | "at offset %lu on %s\n", |
602 | __FUNCTION__, | 602 | __func__, |
603 | blocknr, | 603 | blocknr, |
604 | bdevname(journal->j_dev, b)); | 604 | bdevname(journal->j_dev, b)); |
605 | err = -EIO; | 605 | err = -EIO; |
@@ -904,19 +904,10 @@ static void jbd2_stats_proc_init(journal_t *journal) | |||
904 | snprintf(name, sizeof(name) - 1, "%s", bdevname(journal->j_dev, name)); | 904 | snprintf(name, sizeof(name) - 1, "%s", bdevname(journal->j_dev, name)); |
905 | journal->j_proc_entry = proc_mkdir(name, proc_jbd2_stats); | 905 | journal->j_proc_entry = proc_mkdir(name, proc_jbd2_stats); |
906 | if (journal->j_proc_entry) { | 906 | if (journal->j_proc_entry) { |
907 | struct proc_dir_entry *p; | 907 | proc_create_data("history", S_IRUGO, journal->j_proc_entry, |
908 | p = create_proc_entry("history", S_IRUGO, | 908 | &jbd2_seq_history_fops, journal); |
909 | journal->j_proc_entry); | 909 | proc_create_data("info", S_IRUGO, journal->j_proc_entry, |
910 | if (p) { | 910 | &jbd2_seq_info_fops, journal); |
911 | p->proc_fops = &jbd2_seq_history_fops; | ||
912 | p->data = journal; | ||
913 | p = create_proc_entry("info", S_IRUGO, | ||
914 | journal->j_proc_entry); | ||
915 | if (p) { | ||
916 | p->proc_fops = &jbd2_seq_info_fops; | ||
917 | p->data = journal; | ||
918 | } | ||
919 | } | ||
920 | } | 911 | } |
921 | } | 912 | } |
922 | 913 | ||
@@ -1006,13 +997,14 @@ fail: | |||
1006 | */ | 997 | */ |
1007 | 998 | ||
1008 | /** | 999 | /** |
1009 | * journal_t * jbd2_journal_init_dev() - creates an initialises a journal structure | 1000 | * journal_t * jbd2_journal_init_dev() - creates and initialises a journal structure |
1010 | * @bdev: Block device on which to create the journal | 1001 | * @bdev: Block device on which to create the journal |
1011 | * @fs_dev: Device which hold journalled filesystem for this journal. | 1002 | * @fs_dev: Device which hold journalled filesystem for this journal. |
1012 | * @start: Block nr Start of journal. | 1003 | * @start: Block nr Start of journal. |
1013 | * @len: Length of the journal in blocks. | 1004 | * @len: Length of the journal in blocks. |
1014 | * @blocksize: blocksize of journalling device | 1005 | * @blocksize: blocksize of journalling device |
1015 | * @returns: a newly created journal_t * | 1006 | * |
1007 | * Returns: a newly created journal_t * | ||
1016 | * | 1008 | * |
1017 | * jbd2_journal_init_dev creates a journal which maps a fixed contiguous | 1009 | * jbd2_journal_init_dev creates a journal which maps a fixed contiguous |
1018 | * range of blocks on an arbitrary block device. | 1010 | * range of blocks on an arbitrary block device. |
@@ -1036,7 +1028,7 @@ journal_t * jbd2_journal_init_dev(struct block_device *bdev, | |||
1036 | journal->j_wbuf = kmalloc(n * sizeof(struct buffer_head*), GFP_KERNEL); | 1028 | journal->j_wbuf = kmalloc(n * sizeof(struct buffer_head*), GFP_KERNEL); |
1037 | if (!journal->j_wbuf) { | 1029 | if (!journal->j_wbuf) { |
1038 | printk(KERN_ERR "%s: Cant allocate bhs for commit thread\n", | 1030 | printk(KERN_ERR "%s: Cant allocate bhs for commit thread\n", |
1039 | __FUNCTION__); | 1031 | __func__); |
1040 | kfree(journal); | 1032 | kfree(journal); |
1041 | journal = NULL; | 1033 | journal = NULL; |
1042 | goto out; | 1034 | goto out; |
@@ -1092,7 +1084,7 @@ journal_t * jbd2_journal_init_inode (struct inode *inode) | |||
1092 | journal->j_wbuf = kmalloc(n * sizeof(struct buffer_head*), GFP_KERNEL); | 1084 | journal->j_wbuf = kmalloc(n * sizeof(struct buffer_head*), GFP_KERNEL); |
1093 | if (!journal->j_wbuf) { | 1085 | if (!journal->j_wbuf) { |
1094 | printk(KERN_ERR "%s: Cant allocate bhs for commit thread\n", | 1086 | printk(KERN_ERR "%s: Cant allocate bhs for commit thread\n", |
1095 | __FUNCTION__); | 1087 | __func__); |
1096 | kfree(journal); | 1088 | kfree(journal); |
1097 | return NULL; | 1089 | return NULL; |
1098 | } | 1090 | } |
@@ -1101,7 +1093,7 @@ journal_t * jbd2_journal_init_inode (struct inode *inode) | |||
1101 | /* If that failed, give up */ | 1093 | /* If that failed, give up */ |
1102 | if (err) { | 1094 | if (err) { |
1103 | printk(KERN_ERR "%s: Cannnot locate journal superblock\n", | 1095 | printk(KERN_ERR "%s: Cannnot locate journal superblock\n", |
1104 | __FUNCTION__); | 1096 | __func__); |
1105 | kfree(journal); | 1097 | kfree(journal); |
1106 | return NULL; | 1098 | return NULL; |
1107 | } | 1099 | } |
@@ -1187,7 +1179,7 @@ int jbd2_journal_create(journal_t *journal) | |||
1187 | */ | 1179 | */ |
1188 | printk(KERN_EMERG | 1180 | printk(KERN_EMERG |
1189 | "%s: creation of journal on external device!\n", | 1181 | "%s: creation of journal on external device!\n", |
1190 | __FUNCTION__); | 1182 | __func__); |
1191 | BUG(); | 1183 | BUG(); |
1192 | } | 1184 | } |
1193 | 1185 | ||
@@ -1985,9 +1977,10 @@ static int journal_init_jbd2_journal_head_cache(void) | |||
1985 | 1977 | ||
1986 | static void jbd2_journal_destroy_jbd2_journal_head_cache(void) | 1978 | static void jbd2_journal_destroy_jbd2_journal_head_cache(void) |
1987 | { | 1979 | { |
1988 | J_ASSERT(jbd2_journal_head_cache != NULL); | 1980 | if (jbd2_journal_head_cache) { |
1989 | kmem_cache_destroy(jbd2_journal_head_cache); | 1981 | kmem_cache_destroy(jbd2_journal_head_cache); |
1990 | jbd2_journal_head_cache = NULL; | 1982 | jbd2_journal_head_cache = NULL; |
1983 | } | ||
1991 | } | 1984 | } |
1992 | 1985 | ||
1993 | /* | 1986 | /* |
@@ -2006,7 +1999,7 @@ static struct journal_head *journal_alloc_journal_head(void) | |||
2006 | jbd_debug(1, "out of memory for journal_head\n"); | 1999 | jbd_debug(1, "out of memory for journal_head\n"); |
2007 | if (time_after(jiffies, last_warning + 5*HZ)) { | 2000 | if (time_after(jiffies, last_warning + 5*HZ)) { |
2008 | printk(KERN_NOTICE "ENOMEM in %s, retrying.\n", | 2001 | printk(KERN_NOTICE "ENOMEM in %s, retrying.\n", |
2009 | __FUNCTION__); | 2002 | __func__); |
2010 | last_warning = jiffies; | 2003 | last_warning = jiffies; |
2011 | } | 2004 | } |
2012 | while (!ret) { | 2005 | while (!ret) { |
@@ -2143,13 +2136,13 @@ static void __journal_remove_journal_head(struct buffer_head *bh) | |||
2143 | if (jh->b_frozen_data) { | 2136 | if (jh->b_frozen_data) { |
2144 | printk(KERN_WARNING "%s: freeing " | 2137 | printk(KERN_WARNING "%s: freeing " |
2145 | "b_frozen_data\n", | 2138 | "b_frozen_data\n", |
2146 | __FUNCTION__); | 2139 | __func__); |
2147 | jbd2_free(jh->b_frozen_data, bh->b_size); | 2140 | jbd2_free(jh->b_frozen_data, bh->b_size); |
2148 | } | 2141 | } |
2149 | if (jh->b_committed_data) { | 2142 | if (jh->b_committed_data) { |
2150 | printk(KERN_WARNING "%s: freeing " | 2143 | printk(KERN_WARNING "%s: freeing " |
2151 | "b_committed_data\n", | 2144 | "b_committed_data\n", |
2152 | __FUNCTION__); | 2145 | __func__); |
2153 | jbd2_free(jh->b_committed_data, bh->b_size); | 2146 | jbd2_free(jh->b_committed_data, bh->b_size); |
2154 | } | 2147 | } |
2155 | bh->b_private = NULL; | 2148 | bh->b_private = NULL; |
@@ -2314,10 +2307,12 @@ static int __init journal_init(void) | |||
2314 | BUILD_BUG_ON(sizeof(struct journal_superblock_s) != 1024); | 2307 | BUILD_BUG_ON(sizeof(struct journal_superblock_s) != 1024); |
2315 | 2308 | ||
2316 | ret = journal_init_caches(); | 2309 | ret = journal_init_caches(); |
2317 | if (ret != 0) | 2310 | if (ret == 0) { |
2311 | jbd2_create_debugfs_entry(); | ||
2312 | jbd2_create_jbd_stats_proc_entry(); | ||
2313 | } else { | ||
2318 | jbd2_journal_destroy_caches(); | 2314 | jbd2_journal_destroy_caches(); |
2319 | jbd2_create_debugfs_entry(); | 2315 | } |
2320 | jbd2_create_jbd_stats_proc_entry(); | ||
2321 | return ret; | 2316 | return ret; |
2322 | } | 2317 | } |
2323 | 2318 | ||