aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jbd2
diff options
context:
space:
mode:
authorDave Jones <davej@redhat.com>2006-12-12 17:41:41 -0500
committerDave Jones <davej@redhat.com>2006-12-12 17:41:41 -0500
commitc4366889dda8110247be59ca41fddb82951a8c26 (patch)
tree705c1a996bed8fd48ce94ff33ec9fd00f9b94875 /fs/jbd2
parentdb2fb9db5735cc532fd4fc55e94b9a3c3750378e (diff)
parente1036502e5263851259d147771226161e5ccc85a (diff)
Merge ../linus
Conflicts: drivers/cpufreq/cpufreq.c
Diffstat (limited to 'fs/jbd2')
-rw-r--r--fs/jbd2/commit.c8
-rw-r--r--fs/jbd2/journal.c11
-rw-r--r--fs/jbd2/revoke.c4
-rw-r--r--fs/jbd2/transaction.c22
4 files changed, 33 insertions, 12 deletions
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
index 70b2ae1ef2..6bd8005e3d 100644
--- a/fs/jbd2/commit.c
+++ b/fs/jbd2/commit.c
@@ -248,8 +248,12 @@ write_out_data:
248 bufs = 0; 248 bufs = 0;
249 goto write_out_data; 249 goto write_out_data;
250 } 250 }
251 } 251 } else if (!locked && buffer_locked(bh)) {
252 else { 252 __jbd2_journal_file_buffer(jh, commit_transaction,
253 BJ_Locked);
254 jbd_unlock_bh_state(bh);
255 put_bh(bh);
256 } else {
253 BUFFER_TRACE(bh, "writeout complete: unfile"); 257 BUFFER_TRACE(bh, "writeout complete: unfile");
254 __jbd2_journal_unfile_buffer(jh); 258 __jbd2_journal_unfile_buffer(jh);
255 jbd_unlock_bh_state(bh); 259 jbd_unlock_bh_state(bh);
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 10db92ced0..44fc32bfd7 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -31,7 +31,7 @@
31#include <linux/smp_lock.h> 31#include <linux/smp_lock.h>
32#include <linux/init.h> 32#include <linux/init.h>
33#include <linux/mm.h> 33#include <linux/mm.h>
34#include <linux/suspend.h> 34#include <linux/freezer.h>
35#include <linux/pagemap.h> 35#include <linux/pagemap.h>
36#include <linux/kthread.h> 36#include <linux/kthread.h>
37#include <linux/poison.h> 37#include <linux/poison.h>
@@ -725,6 +725,7 @@ journal_t * jbd2_journal_init_dev(struct block_device *bdev,
725 __FUNCTION__); 725 __FUNCTION__);
726 kfree(journal); 726 kfree(journal);
727 journal = NULL; 727 journal = NULL;
728 goto out;
728 } 729 }
729 journal->j_dev = bdev; 730 journal->j_dev = bdev;
730 journal->j_fs_dev = fs_dev; 731 journal->j_fs_dev = fs_dev;
@@ -735,7 +736,7 @@ journal_t * jbd2_journal_init_dev(struct block_device *bdev,
735 J_ASSERT(bh != NULL); 736 J_ASSERT(bh != NULL);
736 journal->j_sb_buffer = bh; 737 journal->j_sb_buffer = bh;
737 journal->j_superblock = (journal_superblock_t *)bh->b_data; 738 journal->j_superblock = (journal_superblock_t *)bh->b_data;
738 739out:
739 return journal; 740 return journal;
740} 741}
741 742
@@ -1640,7 +1641,7 @@ void * __jbd2_kmalloc (const char *where, size_t size, gfp_t flags, int retry)
1640#define JBD_MAX_SLABS 5 1641#define JBD_MAX_SLABS 5
1641#define JBD_SLAB_INDEX(size) (size >> 11) 1642#define JBD_SLAB_INDEX(size) (size >> 11)
1642 1643
1643static kmem_cache_t *jbd_slab[JBD_MAX_SLABS]; 1644static struct kmem_cache *jbd_slab[JBD_MAX_SLABS];
1644static const char *jbd_slab_names[JBD_MAX_SLABS] = { 1645static const char *jbd_slab_names[JBD_MAX_SLABS] = {
1645 "jbd2_1k", "jbd2_2k", "jbd2_4k", NULL, "jbd2_8k" 1646 "jbd2_1k", "jbd2_2k", "jbd2_4k", NULL, "jbd2_8k"
1646}; 1647};
@@ -1703,7 +1704,7 @@ void jbd2_slab_free(void *ptr, size_t size)
1703/* 1704/*
1704 * Journal_head storage management 1705 * Journal_head storage management
1705 */ 1706 */
1706static kmem_cache_t *jbd2_journal_head_cache; 1707static struct kmem_cache *jbd2_journal_head_cache;
1707#ifdef CONFIG_JBD_DEBUG 1708#ifdef CONFIG_JBD_DEBUG
1708static atomic_t nr_journal_heads = ATOMIC_INIT(0); 1709static atomic_t nr_journal_heads = ATOMIC_INIT(0);
1709#endif 1710#endif
@@ -2006,7 +2007,7 @@ static void __exit jbd2_remove_jbd_proc_entry(void)
2006 2007
2007#endif 2008#endif
2008 2009
2009kmem_cache_t *jbd2_handle_cache; 2010struct kmem_cache *jbd2_handle_cache;
2010 2011
2011static int __init journal_init_handle_cache(void) 2012static int __init journal_init_handle_cache(void)
2012{ 2013{
diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c
index 380d19917f..f506646ad0 100644
--- a/fs/jbd2/revoke.c
+++ b/fs/jbd2/revoke.c
@@ -70,8 +70,8 @@
70#include <linux/init.h> 70#include <linux/init.h>
71#endif 71#endif
72 72
73static kmem_cache_t *jbd2_revoke_record_cache; 73static struct kmem_cache *jbd2_revoke_record_cache;
74static kmem_cache_t *jbd2_revoke_table_cache; 74static struct kmem_cache *jbd2_revoke_table_cache;
75 75
76/* Each revoke record represents one single revoked block. During 76/* Each revoke record represents one single revoked block. During
77 journal replay, this involves recording the transaction ID of the 77 journal replay, this involves recording the transaction ID of the
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index 149957bef9..3a8700153c 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -27,6 +27,8 @@
27#include <linux/mm.h> 27#include <linux/mm.h>
28#include <linux/highmem.h> 28#include <linux/highmem.h>
29 29
30static void __jbd2_journal_temp_unlink_buffer(struct journal_head *jh);
31
30/* 32/*
31 * jbd2_get_transaction: obtain a new transaction_t object. 33 * jbd2_get_transaction: obtain a new transaction_t object.
32 * 34 *
@@ -967,6 +969,13 @@ int jbd2_journal_dirty_data(handle_t *handle, struct buffer_head *bh)
967 */ 969 */
968 jbd_lock_bh_state(bh); 970 jbd_lock_bh_state(bh);
969 spin_lock(&journal->j_list_lock); 971 spin_lock(&journal->j_list_lock);
972
973 /* Now that we have bh_state locked, are we really still mapped? */
974 if (!buffer_mapped(bh)) {
975 JBUFFER_TRACE(jh, "unmapped buffer, bailing out");
976 goto no_journal;
977 }
978
970 if (jh->b_transaction) { 979 if (jh->b_transaction) {
971 JBUFFER_TRACE(jh, "has transaction"); 980 JBUFFER_TRACE(jh, "has transaction");
972 if (jh->b_transaction != handle->h_transaction) { 981 if (jh->b_transaction != handle->h_transaction) {
@@ -1028,6 +1037,11 @@ int jbd2_journal_dirty_data(handle_t *handle, struct buffer_head *bh)
1028 sync_dirty_buffer(bh); 1037 sync_dirty_buffer(bh);
1029 jbd_lock_bh_state(bh); 1038 jbd_lock_bh_state(bh);
1030 spin_lock(&journal->j_list_lock); 1039 spin_lock(&journal->j_list_lock);
1040 /* Since we dropped the lock... */
1041 if (!buffer_mapped(bh)) {
1042 JBUFFER_TRACE(jh, "buffer got unmapped");
1043 goto no_journal;
1044 }
1031 /* The buffer may become locked again at any 1045 /* The buffer may become locked again at any
1032 time if it is redirtied */ 1046 time if it is redirtied */
1033 } 1047 }
@@ -1314,13 +1328,14 @@ int jbd2_journal_stop(handle_t *handle)
1314 int old_handle_count, err; 1328 int old_handle_count, err;
1315 pid_t pid; 1329 pid_t pid;
1316 1330
1317 J_ASSERT(transaction->t_updates > 0);
1318 J_ASSERT(journal_current_handle() == handle); 1331 J_ASSERT(journal_current_handle() == handle);
1319 1332
1320 if (is_handle_aborted(handle)) 1333 if (is_handle_aborted(handle))
1321 err = -EIO; 1334 err = -EIO;
1322 else 1335 else {
1336 J_ASSERT(transaction->t_updates > 0);
1323 err = 0; 1337 err = 0;
1338 }
1324 1339
1325 if (--handle->h_ref > 0) { 1340 if (--handle->h_ref > 0) {
1326 jbd_debug(4, "h_ref %d -> %d\n", handle->h_ref + 1, 1341 jbd_debug(4, "h_ref %d -> %d\n", handle->h_ref + 1,
@@ -1823,6 +1838,7 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
1823 } 1838 }
1824 } 1839 }
1825 } else if (transaction == journal->j_committing_transaction) { 1840 } else if (transaction == journal->j_committing_transaction) {
1841 JBUFFER_TRACE(jh, "on committing transaction");
1826 if (jh->b_jlist == BJ_Locked) { 1842 if (jh->b_jlist == BJ_Locked) {
1827 /* 1843 /*
1828 * The buffer is on the committing transaction's locked 1844 * The buffer is on the committing transaction's locked
@@ -1837,7 +1853,6 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
1837 * can remove it's next_transaction pointer from the 1853 * can remove it's next_transaction pointer from the
1838 * running transaction if that is set, but nothing 1854 * running transaction if that is set, but nothing
1839 * else. */ 1855 * else. */
1840 JBUFFER_TRACE(jh, "on committing transaction");
1841 set_buffer_freed(bh); 1856 set_buffer_freed(bh);
1842 if (jh->b_next_transaction) { 1857 if (jh->b_next_transaction) {
1843 J_ASSERT(jh->b_next_transaction == 1858 J_ASSERT(jh->b_next_transaction ==
@@ -1857,6 +1872,7 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
1857 * i_size already for this truncate so recovery will not 1872 * i_size already for this truncate so recovery will not
1858 * expose the disk blocks we are discarding here.) */ 1873 * expose the disk blocks we are discarding here.) */
1859 J_ASSERT_JH(jh, transaction == journal->j_running_transaction); 1874 J_ASSERT_JH(jh, transaction == journal->j_running_transaction);
1875 JBUFFER_TRACE(jh, "on running transaction");
1860 may_free = __dispose_buffer(jh, transaction); 1876 may_free = __dispose_buffer(jh, transaction);
1861 } 1877 }
1862 1878