Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 105854
b: refs/heads/master
c: cbe5f46
h: refs/heads/master
v: v3
  • Loading branch information
Hidehiro Kawai authored and Linus Torvalds committed Jul 25, 2008
1 parent 6d72116 commit ea2b4c9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8ef2720397bb813d4985405a5ae7b8ad6474188b
refs/heads/master: cbe5f466f6995e10a10c7ae66d6dc8608f08a6b8
35 changes: 28 additions & 7 deletions trunk/fs/jbd/commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,15 @@ static void journal_do_submit_data(struct buffer_head **wbuf, int bufs)
/*
* Submit all the data buffers to disk
*/
static void journal_submit_data_buffers(journal_t *journal,
static int journal_submit_data_buffers(journal_t *journal,
transaction_t *commit_transaction)
{
struct journal_head *jh;
struct buffer_head *bh;
int locked;
int bufs = 0;
struct buffer_head **wbuf = journal->j_wbuf;
int err = 0;

/*
* Whenever we unlock the journal and sleep, things can get added
Expand Down Expand Up @@ -266,6 +267,8 @@ static void journal_submit_data_buffers(journal_t *journal,
put_bh(bh);
} else {
BUFFER_TRACE(bh, "writeout complete: unfile");
if (unlikely(!buffer_uptodate(bh)))
err = -EIO;
__journal_unfile_buffer(jh);
jbd_unlock_bh_state(bh);
if (locked)
Expand All @@ -284,6 +287,8 @@ static void journal_submit_data_buffers(journal_t *journal,
}
spin_unlock(&journal->j_list_lock);
journal_do_submit_data(wbuf, bufs);

return err;
}

/*
Expand Down Expand Up @@ -423,8 +428,7 @@ void journal_commit_transaction(journal_t *journal)
* Now start flushing things to disk, in the order they appear
* on the transaction lists. Data blocks go first.
*/
err = 0;
journal_submit_data_buffers(journal, commit_transaction);
err = journal_submit_data_buffers(journal, commit_transaction);

/*
* Wait for all previously submitted IO to complete.
Expand All @@ -439,10 +443,21 @@ void journal_commit_transaction(journal_t *journal)
if (buffer_locked(bh)) {
spin_unlock(&journal->j_list_lock);
wait_on_buffer(bh);
if (unlikely(!buffer_uptodate(bh)))
err = -EIO;
spin_lock(&journal->j_list_lock);
}
if (unlikely(!buffer_uptodate(bh))) {
if (TestSetPageLocked(bh->b_page)) {
spin_unlock(&journal->j_list_lock);
lock_page(bh->b_page);
spin_lock(&journal->j_list_lock);
}
if (bh->b_page->mapping)
set_bit(AS_EIO, &bh->b_page->mapping->flags);

unlock_page(bh->b_page);
SetPageError(bh->b_page);
err = -EIO;
}
if (!inverted_lock(journal, bh)) {
put_bh(bh);
spin_lock(&journal->j_list_lock);
Expand All @@ -461,8 +476,14 @@ void journal_commit_transaction(journal_t *journal)
}
spin_unlock(&journal->j_list_lock);

if (err)
journal_abort(journal, err);
if (err) {
char b[BDEVNAME_SIZE];

printk(KERN_WARNING
"JBD: Detected IO errors while flushing file data "
"on %s\n", bdevname(journal->j_fs_dev, b));
err = 0;
}

journal_write_revoke_records(journal, commit_transaction);

Expand Down

0 comments on commit ea2b4c9

Please sign in to comment.