jbd2: Add function jbd2_trans_will_send_data_barrier()
Provide a function which returns whether a transaction with given tid will send a flush to the filesystem device. The function will be used by ext4 to detect whether fsync needs to send a separate flush or not. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
This commit is contained in:
+9
-1
@@ -677,6 +677,10 @@ start_journal_io:
|
||||
err = 0;
|
||||
}
|
||||
|
||||
write_lock(&journal->j_state_lock);
|
||||
J_ASSERT(commit_transaction->t_state == T_COMMIT);
|
||||
commit_transaction->t_state = T_COMMIT_DFLUSH;
|
||||
write_unlock(&journal->j_state_lock);
|
||||
/*
|
||||
* If the journal is not located on the file system device,
|
||||
* then we must flush the file system device before we issue
|
||||
@@ -804,6 +808,10 @@ wait_for_iobuf:
|
||||
jbd2_journal_abort(journal, err);
|
||||
|
||||
jbd_debug(3, "JBD: commit phase 5\n");
|
||||
write_lock(&journal->j_state_lock);
|
||||
J_ASSERT(commit_transaction->t_state == T_COMMIT_DFLUSH);
|
||||
commit_transaction->t_state = T_COMMIT_JFLUSH;
|
||||
write_unlock(&journal->j_state_lock);
|
||||
|
||||
if (!JBD2_HAS_INCOMPAT_FEATURE(journal,
|
||||
JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)) {
|
||||
@@ -959,7 +967,7 @@ restart_loop:
|
||||
|
||||
jbd_debug(3, "JBD: commit phase 7\n");
|
||||
|
||||
J_ASSERT(commit_transaction->t_state == T_COMMIT);
|
||||
J_ASSERT(commit_transaction->t_state == T_COMMIT_JFLUSH);
|
||||
|
||||
commit_transaction->t_start = jiffies;
|
||||
stats.run.rs_logging = jbd2_time_diff(stats.run.rs_logging,
|
||||
|
||||
Reference in New Issue
Block a user