diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-26 20:53:20 +0400 | 
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-26 20:53:20 +0400 | 
| commit | 35806b4f7c5620b547f183e9d53f7cfaeabb582b (patch) | |
| tree | dc966f5edd9e482fdc85b8fb886ae39ce5c5ec80 /fs/jbd2/commit.c | |
| parent | 32e51f141fd8d880f57b6a2eb53ce72856254d4a (diff) | |
| parent | d183e11a4a66d80e10d60b0918a47cf073135379 (diff) | |
| download | linux-35806b4f7c5620b547f183e9d53f7cfaeabb582b.tar.xz | |
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: (61 commits)
  jbd2: Add MAINTAINERS entry
  jbd2: fix a potential leak of a journal_head on an error path
  ext4: teach ext4_ext_split to calculate extents efficiently
  ext4: Convert ext4 to new truncate calling convention
  ext4: do not normalize block requests from fallocate()
  ext4: enable "punch hole" functionality
  ext4: add "punch hole" flag to ext4_map_blocks()
  ext4: punch out extents
  ext4: add new function ext4_block_zero_page_range()
  ext4: add flag to ext4_has_free_blocks
  ext4: reserve inodes and feature code for 'quota' feature
  ext4: add support for multiple mount protection
  ext4: ensure f_bfree returned by ext4_statfs() is non-negative
  ext4: protect bb_first_free in ext4_trim_all_free() with group lock
  ext4: only load buddy bitmap in ext4_trim_fs() when it is needed
  jbd2: Fix comment to match the code in jbd2__journal_start()
  ext4: fix waiting and sending of a barrier in ext4_sync_file()
  jbd2: Add function jbd2_trans_will_send_data_barrier()
  jbd2: fix sending of data flush on journal commit
  ext4: fix ext4_ext_fiemap_cb() to handle blocks before request range correctly
  ...
Diffstat (limited to 'fs/jbd2/commit.c')
| -rw-r--r-- | fs/jbd2/commit.c | 22 | 
1 files changed, 17 insertions, 5 deletions
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index 29148a81c783..7f21cf3aaf92 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c @@ -219,7 +219,6 @@ static int journal_submit_data_buffers(journal_t *journal,  			ret = err;  		spin_lock(&journal->j_list_lock);  		J_ASSERT(jinode->i_transaction == commit_transaction); -		commit_transaction->t_flushed_data_blocks = 1;  		clear_bit(__JI_COMMIT_RUNNING, &jinode->i_flags);  		smp_mb__after_clear_bit();  		wake_up_bit(&jinode->i_flags, __JI_COMMIT_RUNNING); @@ -672,12 +671,16 @@ 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  	 * the commit record  	 */ -	if (commit_transaction->t_flushed_data_blocks && +	if (commit_transaction->t_need_data_flush &&  	    (journal->j_fs_dev != journal->j_dev) &&  	    (journal->j_flags & JBD2_BARRIER))  		blkdev_issue_flush(journal->j_fs_dev, GFP_KERNEL, NULL); @@ -754,8 +757,13 @@ wait_for_iobuf:                     required. */  		JBUFFER_TRACE(jh, "file as BJ_Forget");  		jbd2_journal_file_buffer(jh, commit_transaction, BJ_Forget); -		/* Wake up any transactions which were waiting for this -		   IO to complete */ +		/* +		 * Wake up any transactions which were waiting for this IO to +		 * complete. The barrier must be here so that changes by +		 * jbd2_journal_file_buffer() take effect before wake_up_bit() +		 * does the waitqueue check. +		 */ +		smp_mb();  		wake_up_bit(&bh->b_state, BH_Unshadow);  		JBUFFER_TRACE(jh, "brelse shadowed buffer");  		__brelse(bh); @@ -794,6 +802,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)) { @@ -949,7 +961,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,  | 
