]> Pileus Git - ~andy/linux/commitdiff
Merge branch 'for_next' into for_linus
authorJan Kara <jack@suse.cz>
Fri, 3 May 2013 09:41:39 +0000 (11:41 +0200)
committerJan Kara <jack@suse.cz>
Fri, 3 May 2013 09:41:39 +0000 (11:41 +0200)
fs/ext3/inode.c
fs/jbd/journal.c
fs/jbd/transaction.c
include/linux/jbd.h

index d512c4bc4ad7103b968d454266d1814b8d59de41..d706dbfa62203cd67d15675b88ca32f5ddf5eb45 100644 (file)
@@ -218,7 +218,8 @@ void ext3_evict_inode (struct inode *inode)
         */
        if (inode->i_nlink && ext3_should_journal_data(inode) &&
            EXT3_SB(inode->i_sb)->s_journal &&
-           (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode))) {
+           (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode)) &&
+           inode->i_ino != EXT3_JOURNAL_INO) {
                tid_t commit_tid = atomic_read(&ei->i_datasync_tid);
                journal_t *journal = EXT3_SB(inode->i_sb)->s_journal;
 
index 81cc7eaff86321c2788c0aa83c236778e6fb4b70..726a4432cbb15a05f8758f9bcf99e8d74170f569 100644 (file)
@@ -564,6 +564,16 @@ int log_wait_commit(journal_t *journal, tid_t tid)
        spin_unlock(&journal->j_state_lock);
 #endif
        spin_lock(&journal->j_state_lock);
+       /*
+        * Not running or committing trans? Must be already committed. This
+        * saves us from waiting for a *long* time when tid overflows.
+        */
+       if (!((journal->j_running_transaction &&
+              journal->j_running_transaction->t_tid == tid) ||
+             (journal->j_committing_transaction &&
+              journal->j_committing_transaction->t_tid == tid)))
+               goto out_unlock;
+
        if (!tid_geq(journal->j_commit_waited, tid))
                journal->j_commit_waited = tid;
        while (tid_gt(tid, journal->j_commit_sequence)) {
@@ -575,6 +585,7 @@ int log_wait_commit(journal_t *journal, tid_t tid)
                                !tid_gt(tid, journal->j_commit_sequence));
                spin_lock(&journal->j_state_lock);
        }
+out_unlock:
        spin_unlock(&journal->j_state_lock);
 
        if (unlikely(is_journal_aborted(journal))) {
@@ -1845,7 +1856,7 @@ static struct journal_head *journal_alloc_journal_head(void)
 #ifdef CONFIG_JBD_DEBUG
        atomic_inc(&nr_journal_heads);
 #endif
-       ret = kmem_cache_alloc(journal_head_cache, GFP_NOFS);
+       ret = kmem_cache_zalloc(journal_head_cache, GFP_NOFS);
        if (ret == NULL) {
                jbd_debug(1, "out of memory for journal_head\n");
                printk_ratelimited(KERN_NOTICE "ENOMEM in %s, retrying.\n",
@@ -1853,7 +1864,7 @@ static struct journal_head *journal_alloc_journal_head(void)
 
                while (ret == NULL) {
                        yield();
-                       ret = kmem_cache_alloc(journal_head_cache, GFP_NOFS);
+                       ret = kmem_cache_zalloc(journal_head_cache, GFP_NOFS);
                }
        }
        return ret;
@@ -1915,10 +1926,8 @@ struct journal_head *journal_add_journal_head(struct buffer_head *bh)
        struct journal_head *new_jh = NULL;
 
 repeat:
-       if (!buffer_jbd(bh)) {
+       if (!buffer_jbd(bh))
                new_jh = journal_alloc_journal_head();
-               memset(new_jh, 0, sizeof(*new_jh));
-       }
 
        jbd_lock_bh_journal_head(bh);
        if (buffer_jbd(bh)) {
index 071d6905f0dd92c57dc2a8e6a5e62f81993ca5e8..e3e255c0a50968cd41efe9f9b9706290875f47fd 100644 (file)
@@ -245,7 +245,6 @@ static handle_t *new_handle(int nblocks)
        handle_t *handle = jbd_alloc_handle(GFP_NOFS);
        if (!handle)
                return NULL;
-       memset(handle, 0, sizeof(*handle));
        handle->h_buffer_credits = nblocks;
        handle->h_ref = 1;
 
index c8f32975f0e41699164c772701a183184379ba32..7e0b622503c4ae90300c0e9281a7c02cc55ac9a4 100644 (file)
@@ -887,7 +887,7 @@ extern struct kmem_cache *jbd_handle_cache;
 
 static inline handle_t *jbd_alloc_handle(gfp_t gfp_flags)
 {
-       return kmem_cache_alloc(jbd_handle_cache, gfp_flags);
+       return kmem_cache_zalloc(jbd_handle_cache, gfp_flags);
 }
 
 static inline void jbd_free_handle(handle_t *handle)