Skip to content

Commit cb0d9d4

Browse files
jankaratytso
authored andcommitted
jbd2: save some atomic ops in __JI_COMMIT_RUNNING handling
Currently we used atomic bit operations to manipulate __JI_COMMIT_RUNNING bit. However this is unnecessary as i_flags are always written and read under j_list_lock. So just change the operations to standard bit operations. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
1 parent 1101cd4 commit cb0d9d4

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

‎fs/jbd2/commit.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ static int journal_submit_data_buffers(journal_t *journal,
220220
spin_lock(&journal->j_list_lock);
221221
list_for_each_entry(jinode, &commit_transaction->t_inode_list, i_list) {
222222
mapping = jinode->i_vfs_inode->i_mapping;
223-
set_bit(__JI_COMMIT_RUNNING, &jinode->i_flags);
223+
jinode->i_flags |= JI_COMMIT_RUNNING;
224224
spin_unlock(&journal->j_list_lock);
225225
/*
226226
* submit the inode data buffers. We use writepage
@@ -234,8 +234,8 @@ static int journal_submit_data_buffers(journal_t *journal,
234234
ret = err;
235235
spin_lock(&journal->j_list_lock);
236236
J_ASSERT(jinode->i_transaction == commit_transaction);
237-
clear_bit(__JI_COMMIT_RUNNING, &jinode->i_flags);
238-
smp_mb__after_atomic();
237+
jinode->i_flags &= ~JI_COMMIT_RUNNING;
238+
smp_mb();
239239
wake_up_bit(&jinode->i_flags, __JI_COMMIT_RUNNING);
240240
}
241241
spin_unlock(&journal->j_list_lock);
@@ -256,7 +256,7 @@ static int journal_finish_inode_data_buffers(journal_t *journal,
256256
/* For locking, see the comment in journal_submit_data_buffers() */
257257
spin_lock(&journal->j_list_lock);
258258
list_for_each_entry(jinode, &commit_transaction->t_inode_list, i_list) {
259-
set_bit(__JI_COMMIT_RUNNING, &jinode->i_flags);
259+
jinode->i_flags |= JI_COMMIT_RUNNING;
260260
spin_unlock(&journal->j_list_lock);
261261
err = filemap_fdatawait(jinode->i_vfs_inode->i_mapping);
262262
if (err) {
@@ -272,8 +272,8 @@ static int journal_finish_inode_data_buffers(journal_t *journal,
272272
ret = err;
273273
}
274274
spin_lock(&journal->j_list_lock);
275-
clear_bit(__JI_COMMIT_RUNNING, &jinode->i_flags);
276-
smp_mb__after_atomic();
275+
jinode->i_flags &= ~JI_COMMIT_RUNNING;
276+
smp_mb();
277277
wake_up_bit(&jinode->i_flags, __JI_COMMIT_RUNNING);
278278
}
279279

‎fs/jbd2/journal.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2587,7 +2587,7 @@ void jbd2_journal_release_jbd_inode(journal_t *journal,
25872587
restart:
25882588
spin_lock(&journal->j_list_lock);
25892589
/* Is commit writing out inode - we have to wait */
2590-
if (test_bit(__JI_COMMIT_RUNNING, &jinode->i_flags)) {
2590+
if (jinode->i_flags & JI_COMMIT_RUNNING) {
25912591
wait_queue_head_t *wq;
25922592
DEFINE_WAIT_BIT(wait, &jinode->i_flags, __JI_COMMIT_RUNNING);
25932593
wq = bit_waitqueue(&jinode->i_flags, __JI_COMMIT_RUNNING);

0 commit comments

Comments
 (0)