Commit f16f1182 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] JBD: remove lock_kernel()

lock_kernel() is no longer needed in JBD.  Remove all the lock_kernel() calls
from fs/jbd/.

Here is where I get to say "ex-parrot".
parent b9c3dc07
...@@ -70,8 +70,6 @@ void journal_commit_transaction(journal_t *journal) ...@@ -70,8 +70,6 @@ void journal_commit_transaction(journal_t *journal)
spin_unlock(&journal->j_list_lock); spin_unlock(&journal->j_list_lock);
#endif #endif
lock_kernel();
J_ASSERT(journal->j_running_transaction != NULL); J_ASSERT(journal->j_running_transaction != NULL);
J_ASSERT(journal->j_committing_transaction == NULL); J_ASSERT(journal->j_committing_transaction == NULL);
...@@ -169,8 +167,6 @@ void journal_commit_transaction(journal_t *journal) ...@@ -169,8 +167,6 @@ void journal_commit_transaction(journal_t *journal)
wake_up(&journal->j_wait_transaction_locked); wake_up(&journal->j_wait_transaction_locked);
spin_unlock(&journal->j_state_lock); spin_unlock(&journal->j_state_lock);
unlock_kernel();
jbd_debug (3, "JBD: commit phase 2\n"); jbd_debug (3, "JBD: commit phase 2\n");
/* /*
......
...@@ -83,11 +83,6 @@ EXPORT_SYMBOL(journal_force_commit); ...@@ -83,11 +83,6 @@ EXPORT_SYMBOL(journal_force_commit);
static int journal_convert_superblock_v1(journal_t *, journal_superblock_t *); static int journal_convert_superblock_v1(journal_t *, journal_superblock_t *);
/*
* List of all journals in the system. Protected by the BKL.
*/
static LIST_HEAD(all_journals);
/* /*
* Helper function used to manage commit timeouts * Helper function used to manage commit timeouts
*/ */
...@@ -137,8 +132,6 @@ int kjournald(void *arg) ...@@ -137,8 +132,6 @@ int kjournald(void *arg)
daemonize("kjournald"); daemonize("kjournald");
lock_kernel();
/* Set up an interval timer which can be used to trigger a /* Set up an interval timer which can be used to trigger a
commit wakeup after the commit interval expires */ commit wakeup after the commit interval expires */
init_timer(&timer); init_timer(&timer);
...@@ -153,10 +146,6 @@ int kjournald(void *arg) ...@@ -153,10 +146,6 @@ int kjournald(void *arg)
printk(KERN_INFO "kjournald starting. Commit interval %ld seconds\n", printk(KERN_INFO "kjournald starting. Commit interval %ld seconds\n",
journal->j_commit_interval / HZ); journal->j_commit_interval / HZ);
lock_kernel();
list_add(&journal->j_all_journals, &all_journals);
unlock_kernel();
/* /*
* And now, wait forever for commit wakeup events. * And now, wait forever for commit wakeup events.
*/ */
...@@ -234,14 +223,9 @@ int kjournald(void *arg) ...@@ -234,14 +223,9 @@ int kjournald(void *arg)
} }
spin_unlock(&journal->j_state_lock); spin_unlock(&journal->j_state_lock);
lock_kernel();
list_del(&journal->j_all_journals);
unlock_kernel();
journal->j_task = NULL; journal->j_task = NULL;
wake_up(&journal->j_wait_done_commit); wake_up(&journal->j_wait_done_commit);
jbd_debug(1, "Journal thread exiting.\n"); jbd_debug(1, "Journal thread exiting.\n");
unlock_kernel();
return 0; return 0;
} }
...@@ -514,7 +498,6 @@ int log_wait_commit(journal_t *journal, tid_t tid) ...@@ -514,7 +498,6 @@ int log_wait_commit(journal_t *journal, tid_t tid)
{ {
int err = 0; int err = 0;
lock_kernel();
#ifdef CONFIG_JBD_DEBUG #ifdef CONFIG_JBD_DEBUG
lock_journal(journal); lock_journal(journal);
spin_lock(&journal->j_state_lock); spin_lock(&journal->j_state_lock);
...@@ -542,8 +525,6 @@ int log_wait_commit(journal_t *journal, tid_t tid) ...@@ -542,8 +525,6 @@ int log_wait_commit(journal_t *journal, tid_t tid)
printk(KERN_EMERG "journal commit I/O error\n"); printk(KERN_EMERG "journal commit I/O error\n");
err = -EIO; err = -EIO;
} }
unlock_kernel();
return err; return err;
} }
...@@ -918,15 +899,14 @@ void journal_update_superblock(journal_t *journal, int wait) ...@@ -918,15 +899,14 @@ void journal_update_superblock(journal_t *journal, int wait)
* any future commit will have to be careful to update the * any future commit will have to be careful to update the
* superblock again to re-record the true start of the log. */ * superblock again to re-record the true start of the log. */
lock_kernel(); spin_lock(&journal->j_state_lock);
if (sb->s_start) if (sb->s_start)
journal->j_flags &= ~JFS_FLUSHED; journal->j_flags &= ~JFS_FLUSHED;
else else
journal->j_flags |= JFS_FLUSHED; journal->j_flags |= JFS_FLUSHED;
unlock_kernel(); spin_unlock(&journal->j_state_lock);
} }
/* /*
* Read the superblock for a given journal, performing initial * Read the superblock for a given journal, performing initial
* validation of the format. * validation of the format.
...@@ -1425,7 +1405,6 @@ void __journal_abort_soft (journal_t *journal, int errno) ...@@ -1425,7 +1405,6 @@ void __journal_abort_soft (journal_t *journal, int errno)
if (journal->j_flags & JFS_ABORT) if (journal->j_flags & JFS_ABORT)
return; return;
lock_kernel();
if (!journal->j_errno) if (!journal->j_errno)
journal->j_errno = errno; journal->j_errno = errno;
...@@ -1433,7 +1412,6 @@ void __journal_abort_soft (journal_t *journal, int errno) ...@@ -1433,7 +1412,6 @@ void __journal_abort_soft (journal_t *journal, int errno)
if (errno) if (errno)
journal_update_superblock(journal, 1); journal_update_superblock(journal, 1);
unlock_kernel();
} }
/** /**
...@@ -1500,17 +1478,17 @@ void journal_abort (journal_t *journal, int errno) ...@@ -1500,17 +1478,17 @@ void journal_abort (journal_t *journal, int errno)
* If the journal has been aborted on this mount time -EROFS will * If the journal has been aborted on this mount time -EROFS will
* be returned. * be returned.
*/ */
int journal_errno (journal_t *journal) int journal_errno(journal_t *journal)
{ {
int err; int err;
lock_journal(journal); lock_journal(journal);
lock_kernel(); spin_lock(&journal->j_state_lock);
if (journal->j_flags & JFS_ABORT) if (journal->j_flags & JFS_ABORT)
err = -EROFS; err = -EROFS;
else else
err = journal->j_errno; err = journal->j_errno;
unlock_kernel(); spin_unlock(&journal->j_state_lock);
unlock_journal(journal); unlock_journal(journal);
return err; return err;
} }
...@@ -1523,17 +1501,17 @@ int journal_errno (journal_t *journal) ...@@ -1523,17 +1501,17 @@ int journal_errno (journal_t *journal)
* An error must be cleared or Acked to take a FS out of readonly * An error must be cleared or Acked to take a FS out of readonly
* mode. * mode.
*/ */
int journal_clear_err (journal_t *journal) int journal_clear_err(journal_t *journal)
{ {
int err = 0; int err = 0;
lock_journal(journal); lock_journal(journal);
lock_kernel(); spin_lock(&journal->j_state_lock);
if (journal->j_flags & JFS_ABORT) if (journal->j_flags & JFS_ABORT)
err = -EROFS; err = -EROFS;
else else
journal->j_errno = 0; journal->j_errno = 0;
unlock_kernel(); spin_unlock(&journal->j_state_lock);
unlock_journal(journal); unlock_journal(journal);
return err; return err;
} }
...@@ -1545,13 +1523,13 @@ int journal_clear_err (journal_t *journal) ...@@ -1545,13 +1523,13 @@ int journal_clear_err (journal_t *journal)
* An error must be cleared or Acked to take a FS out of readonly * An error must be cleared or Acked to take a FS out of readonly
* mode. * mode.
*/ */
void journal_ack_err (journal_t *journal) void journal_ack_err(journal_t *journal)
{ {
lock_journal(journal); lock_journal(journal);
lock_kernel(); spin_lock(&journal->j_state_lock);
if (journal->j_errno) if (journal->j_errno)
journal->j_flags |= JFS_ACK_ERR; journal->j_flags |= JFS_ACK_ERR;
unlock_kernel(); spin_unlock(&journal->j_state_lock);
unlock_journal(journal); unlock_journal(journal);
} }
......
...@@ -290,9 +290,7 @@ handle_t *journal_start(journal_t *journal, int nblocks) ...@@ -290,9 +290,7 @@ handle_t *journal_start(journal_t *journal, int nblocks)
current->journal_info = handle; current->journal_info = handle;
lock_kernel();
err = start_this_handle(journal, handle); err = start_this_handle(journal, handle);
unlock_kernel();
if (err < 0) { if (err < 0) {
jbd_free_handle(handle); jbd_free_handle(handle);
current->journal_info = NULL; current->journal_info = NULL;
...@@ -407,7 +405,6 @@ int journal_restart(handle_t *handle, int nblocks) ...@@ -407,7 +405,6 @@ int journal_restart(handle_t *handle, int nblocks)
J_ASSERT(transaction->t_updates > 0); J_ASSERT(transaction->t_updates > 0);
J_ASSERT(journal_current_handle() == handle); J_ASSERT(journal_current_handle() == handle);
lock_kernel();
spin_lock(&transaction->t_handle_lock); spin_lock(&transaction->t_handle_lock);
transaction->t_outstanding_credits -= handle->h_buffer_credits; transaction->t_outstanding_credits -= handle->h_buffer_credits;
transaction->t_updates--; transaction->t_updates--;
...@@ -421,7 +418,6 @@ int journal_restart(handle_t *handle, int nblocks) ...@@ -421,7 +418,6 @@ int journal_restart(handle_t *handle, int nblocks)
handle->h_buffer_credits = nblocks; handle->h_buffer_credits = nblocks;
ret = start_this_handle(journal, handle); ret = start_this_handle(journal, handle);
unlock_kernel();
return ret; return ret;
} }
...@@ -845,10 +841,8 @@ int journal_get_create_access(handle_t *handle, struct buffer_head *bh) ...@@ -845,10 +841,8 @@ int journal_get_create_access(handle_t *handle, struct buffer_head *bh)
* which hits an assertion error. * which hits an assertion error.
*/ */
JBUFFER_TRACE(jh, "cancelling revoke"); JBUFFER_TRACE(jh, "cancelling revoke");
lock_kernel();
journal_cancel_revoke(handle, jh); journal_cancel_revoke(handle, jh);
journal_put_journal_head(jh); journal_put_journal_head(jh);
unlock_kernel();
out: out:
unlock_journal(journal); unlock_journal(journal);
return err; return err;
...@@ -1385,7 +1379,6 @@ int journal_stop(handle_t *handle) ...@@ -1385,7 +1379,6 @@ int journal_stop(handle_t *handle)
} }
current->journal_info = NULL; current->journal_info = NULL;
lock_kernel();
spin_lock(&transaction->t_handle_lock); spin_lock(&transaction->t_handle_lock);
transaction->t_outstanding_credits -= handle->h_buffer_credits; transaction->t_outstanding_credits -= handle->h_buffer_credits;
transaction->t_updates--; transaction->t_updates--;
...@@ -1431,7 +1424,6 @@ int journal_stop(handle_t *handle) ...@@ -1431,7 +1424,6 @@ int journal_stop(handle_t *handle)
spin_unlock(&transaction->t_handle_lock); spin_unlock(&transaction->t_handle_lock);
} }
unlock_kernel();
jbd_free_handle(handle); jbd_free_handle(handle);
return err; return err;
} }
...@@ -1448,16 +1440,13 @@ int journal_force_commit(journal_t *journal) ...@@ -1448,16 +1440,13 @@ int journal_force_commit(journal_t *journal)
handle_t *handle; handle_t *handle;
int ret; int ret;
lock_kernel();
handle = journal_start(journal, 1); handle = journal_start(journal, 1);
if (IS_ERR(handle)) { if (IS_ERR(handle)) {
ret = PTR_ERR(handle); ret = PTR_ERR(handle);
goto out; } else {
}
handle->h_sync = 1; handle->h_sync = 1;
ret = journal_stop(handle); ret = journal_stop(handle);
out: }
unlock_kernel();
return ret; return ret;
} }
......
...@@ -623,7 +623,6 @@ struct transaction_s ...@@ -623,7 +623,6 @@ struct transaction_s
* a commit? * a commit?
* @j_commit_timer: The timer used to wakeup the commit thread * @j_commit_timer: The timer used to wakeup the commit thread
* @j_commit_timer_active: Timer flag * @j_commit_timer_active: Timer flag
* @j_all_journals: Link all journals together - system-wide
* @j_revoke: The revoke table - maintains the list of revoked blocks in the * @j_revoke: The revoke table - maintains the list of revoked blocks in the
* current transaction. * current transaction.
*/ */
...@@ -804,9 +803,6 @@ struct journal_s ...@@ -804,9 +803,6 @@ struct journal_s
struct timer_list *j_commit_timer; struct timer_list *j_commit_timer;
int j_commit_timer_active; /* [j_state_lock] */ int j_commit_timer_active; /* [j_state_lock] */
/* Link all journals together - system-wide [lock_kernel] */
struct list_head j_all_journals;
/* /*
* The revoke table: maintains the list of revoked blocks in the * The revoke table: maintains the list of revoked blocks in the
* current transaction. [j_revoke_lock] * current transaction. [j_revoke_lock]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment