]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
jbd: fix the way the b_modified flag is cleared
authorJosef Bacik <jbacik@redhat.com>
Mon, 28 Apr 2008 09:16:10 +0000 (02:16 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 6 Aug 2008 17:10:57 +0000 (10:10 -0700)
commitabc527c920d94205e1ffefaf2e5cbd0c4ea98c8f
treeb57ad77f7e06c51e54d63907090d4604291740c6
parent1556ec27122f2ada7f05c4216d5b0bfc16149084
jbd: fix the way the b_modified flag is cleared

commit 5bc833feaa8b2236265764e7e81f44937be46eda upstream

Currently at the start of a journal commit we loop through all of the buffers
on the committing transaction and clear the b_modified flag (the flag that is
set when a transaction modifies the buffer) under the j_list_lock.

The problem is that everywhere else this flag is modified only under the jbd
lock buffer flag, so it will race with a running transaction who could
potentially set it, and have it unset by the committing transaction.

This is also a big waste, you can have several thousands of buffers that you
are clearing the modified flag on when you may not need to.  This patch
removes this code and instead clears the b_modified flag upon entering
do_get_write_access/journal_get_create_access, so if that transaction does
indeed use the buffer then it will be accounted for properly, and if it does
not then we know we didn't use it.

That will be important for the next patch in this series.  Tested thoroughly
by myself using postmark/iozone/bonnie++.

Signed-off-by: Josef Bacik <jbacik@redhat.com>
Cc: <linux-ext4@vger.kernel.org>
Acked-by: Jan Kara <jack@ucw.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/jbd/commit.c
fs/jbd/transaction.c