Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 95019
b: refs/heads/master
c: 1dfc322
h: refs/heads/master
i:
  95017: 6c01311
  95015: 2769d18
v: v3
  • Loading branch information
Josef Bacik authored and Theodore Ts'o committed Apr 17, 2008
1 parent e16695b commit 2b58ce8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 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: 9fc7c63a1d6e9920038ced782390a54888ed70a6
refs/heads/master: 1dfc3220d963385a317264b11154c462a83596ed
3 changes: 3 additions & 0 deletions trunk/fs/jbd2/commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,9 @@ void jbd2_journal_commit_transaction(journal_t *journal)
stats.u.run.rs_blocks = commit_transaction->t_outstanding_credits;
stats.u.run.rs_blocks_logged = 0;

J_ASSERT(commit_transaction->t_nr_buffers <=
commit_transaction->t_outstanding_credits);

descriptor = NULL;
bufs = 0;
while (commit_transaction->t_buffers) {
Expand Down
21 changes: 18 additions & 3 deletions trunk/fs/jbd2/transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -1243,6 +1243,7 @@ int jbd2_journal_forget (handle_t *handle, struct buffer_head *bh)
struct journal_head *jh;
int drop_reserve = 0;
int err = 0;
int was_modified = 0;

BUFFER_TRACE(bh, "entry");

Expand All @@ -1261,6 +1262,9 @@ int jbd2_journal_forget (handle_t *handle, struct buffer_head *bh)
goto not_jbd;
}

/* keep track of wether or not this transaction modified us */
was_modified = jh->b_modified;

/*
* The buffer's going from the transaction, we must drop
* all references -bzzz
Expand All @@ -1278,7 +1282,12 @@ int jbd2_journal_forget (handle_t *handle, struct buffer_head *bh)

JBUFFER_TRACE(jh, "belongs to current transaction: unfile");

drop_reserve = 1;
/*
* we only want to drop a reference if this transaction
* modified the buffer
*/
if (was_modified)
drop_reserve = 1;

/*
* We are no longer going to journal this buffer.
Expand Down Expand Up @@ -1318,7 +1327,13 @@ int jbd2_journal_forget (handle_t *handle, struct buffer_head *bh)
if (jh->b_next_transaction) {
J_ASSERT(jh->b_next_transaction == transaction);
jh->b_next_transaction = NULL;
drop_reserve = 1;

/*
* only drop a reference if this transaction modified
* the buffer
*/
if (was_modified)
drop_reserve = 1;
}
}

Expand Down Expand Up @@ -2090,7 +2105,7 @@ void __jbd2_journal_refile_buffer(struct journal_head *jh)
jh->b_transaction = jh->b_next_transaction;
jh->b_next_transaction = NULL;
__jbd2_journal_file_buffer(jh, jh->b_transaction,
was_dirty ? BJ_Metadata : BJ_Reserved);
jh->b_modified ? BJ_Metadata : BJ_Reserved);
J_ASSERT_JH(jh, jh->b_transaction->t_state == T_RUNNING);

if (was_dirty)
Expand Down

0 comments on commit 2b58ce8

Please sign in to comment.