aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jbd2/journal.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jbd2/journal.c')
-rw-r--r--fs/jbd2/journal.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index eb7eb6c27bcb..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;
@@ -997,13 +997,14 @@ fail:
997 */ 997 */
998 998
999/** 999/**
1000 * 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
1001 * @bdev: Block device on which to create the journal 1001 * @bdev: Block device on which to create the journal
1002 * @fs_dev: Device which hold journalled filesystem for this journal. 1002 * @fs_dev: Device which hold journalled filesystem for this journal.
1003 * @start: Block nr Start of journal. 1003 * @start: Block nr Start of journal.
1004 * @len: Length of the journal in blocks. 1004 * @len: Length of the journal in blocks.
1005 * @blocksize: blocksize of journalling device 1005 * @blocksize: blocksize of journalling device
1006 * @returns: a newly created journal_t * 1006 *
1007 * Returns: a newly created journal_t *
1007 * 1008 *
1008 * 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
1009 * range of blocks on an arbitrary block device. 1010 * range of blocks on an arbitrary block device.
@@ -1027,7 +1028,7 @@ journal_t * jbd2_journal_init_dev(struct block_device *bdev,
1027 journal->j_wbuf = kmalloc(n * sizeof(struct buffer_head*), GFP_KERNEL); 1028 journal->j_wbuf = kmalloc(n * sizeof(struct buffer_head*), GFP_KERNEL);
1028 if (!journal->j_wbuf) { 1029 if (!journal->j_wbuf) {
1029 printk(KERN_ERR "%s: Cant allocate bhs for commit thread\n", 1030 printk(KERN_ERR "%s: Cant allocate bhs for commit thread\n",
1030 __FUNCTION__); 1031 __func__);
1031 kfree(journal); 1032 kfree(journal);
1032 journal = NULL; 1033 journal = NULL;
1033 goto out; 1034 goto out;
@@ -1083,7 +1084,7 @@ journal_t * jbd2_journal_init_inode (struct inode *inode)
1083 journal->j_wbuf = kmalloc(n * sizeof(struct buffer_head*), GFP_KERNEL); 1084 journal->j_wbuf = kmalloc(n * sizeof(struct buffer_head*), GFP_KERNEL);
1084 if (!journal->j_wbuf) { 1085 if (!journal->j_wbuf) {
1085 printk(KERN_ERR "%s: Cant allocate bhs for commit thread\n", 1086 printk(KERN_ERR "%s: Cant allocate bhs for commit thread\n",
1086 __FUNCTION__); 1087 __func__);
1087 kfree(journal); 1088 kfree(journal);
1088 return NULL; 1089 return NULL;
1089 } 1090 }
@@ -1092,7 +1093,7 @@ journal_t * jbd2_journal_init_inode (struct inode *inode)
1092 /* If that failed, give up */ 1093 /* If that failed, give up */
1093 if (err) { 1094 if (err) {
1094 printk(KERN_ERR "%s: Cannnot locate journal superblock\n", 1095 printk(KERN_ERR "%s: Cannnot locate journal superblock\n",
1095 __FUNCTION__); 1096 __func__);
1096 kfree(journal); 1097 kfree(journal);
1097 return NULL; 1098 return NULL;
1098 } 1099 }
@@ -1178,7 +1179,7 @@ int jbd2_journal_create(journal_t *journal)
1178 */ 1179 */
1179 printk(KERN_EMERG 1180 printk(KERN_EMERG
1180 "%s: creation of journal on external device!\n", 1181 "%s: creation of journal on external device!\n",
1181 __FUNCTION__); 1182 __func__);
1182 BUG(); 1183 BUG();
1183 } 1184 }
1184 1185
@@ -1976,9 +1977,10 @@ static int journal_init_jbd2_journal_head_cache(void)
1976 1977
1977static void jbd2_journal_destroy_jbd2_journal_head_cache(void) 1978static void jbd2_journal_destroy_jbd2_journal_head_cache(void)
1978{ 1979{
1979 J_ASSERT(jbd2_journal_head_cache != NULL); 1980 if (jbd2_journal_head_cache) {
1980 kmem_cache_destroy(jbd2_journal_head_cache); 1981 kmem_cache_destroy(jbd2_journal_head_cache);
1981 jbd2_journal_head_cache = NULL; 1982 jbd2_journal_head_cache = NULL;
1983 }
1982} 1984}
1983 1985
1984/* 1986/*
@@ -1997,7 +1999,7 @@ static struct journal_head *journal_alloc_journal_head(void)
1997 jbd_debug(1, "out of memory for journal_head\n"); 1999 jbd_debug(1, "out of memory for journal_head\n");
1998 if (time_after(jiffies, last_warning + 5*HZ)) { 2000 if (time_after(jiffies, last_warning + 5*HZ)) {
1999 printk(KERN_NOTICE "ENOMEM in %s, retrying.\n", 2001 printk(KERN_NOTICE "ENOMEM in %s, retrying.\n",
2000 __FUNCTION__); 2002 __func__);
2001 last_warning = jiffies; 2003 last_warning = jiffies;
2002 } 2004 }
2003 while (!ret) { 2005 while (!ret) {
@@ -2134,13 +2136,13 @@ static void __journal_remove_journal_head(struct buffer_head *bh)
2134 if (jh->b_frozen_data) { 2136 if (jh->b_frozen_data) {
2135 printk(KERN_WARNING "%s: freeing " 2137 printk(KERN_WARNING "%s: freeing "
2136 "b_frozen_data\n", 2138 "b_frozen_data\n",
2137 __FUNCTION__); 2139 __func__);
2138 jbd2_free(jh->b_frozen_data, bh->b_size); 2140 jbd2_free(jh->b_frozen_data, bh->b_size);
2139 } 2141 }
2140 if (jh->b_committed_data) { 2142 if (jh->b_committed_data) {
2141 printk(KERN_WARNING "%s: freeing " 2143 printk(KERN_WARNING "%s: freeing "
2142 "b_committed_data\n", 2144 "b_committed_data\n",
2143 __FUNCTION__); 2145 __func__);
2144 jbd2_free(jh->b_committed_data, bh->b_size); 2146 jbd2_free(jh->b_committed_data, bh->b_size);
2145 } 2147 }
2146 bh->b_private = NULL; 2148 bh->b_private = NULL;
@@ -2305,10 +2307,12 @@ static int __init journal_init(void)
2305 BUILD_BUG_ON(sizeof(struct journal_superblock_s) != 1024); 2307 BUILD_BUG_ON(sizeof(struct journal_superblock_s) != 1024);
2306 2308
2307 ret = journal_init_caches(); 2309 ret = journal_init_caches();
2308 if (ret != 0) 2310 if (ret == 0) {
2311 jbd2_create_debugfs_entry();
2312 jbd2_create_jbd_stats_proc_entry();
2313 } else {
2309 jbd2_journal_destroy_caches(); 2314 jbd2_journal_destroy_caches();
2310 jbd2_create_debugfs_entry(); 2315 }
2311 jbd2_create_jbd_stats_proc_entry();
2312 return ret; 2316 return ret;
2313} 2317}
2314 2318