Skip to content

Commit

Permalink
kill-the-bkl/reiserfs: conditionaly release the write lock on fs_chan…
Browse files Browse the repository at this point in the history
…ged()

The goal of fs_changed() is to check whether the tree changed during a
schedule(). This is a BKL legacy.

A recent patch added an explicit unconditional release/reacquire of the
write lock around the cond_resched() called inside fs_changed.

But it's wasteful to unconditionally do that, we are creating superfluous
lock contention in !TIF_NEED_RESCHED case.

This patch manage that by calling reiserfs_cond_resched() from fs_changed()
which only releases the lock if we are going to reschedule.

[ Impact: inject less lock contention and tree job retries ]

Cc: Jeff Mahoney <jeffm@suse.com>
Cc: Chris Mason <chris.mason@oracle.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Alexander Beregalov <a.beregalov@gmail.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
  • Loading branch information
Frederic Weisbecker committed Sep 14, 2009
1 parent e43d3f2 commit d663af8
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions include/linux/reiserfs_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1348,9 +1348,7 @@ static inline loff_t max_reiserfs_offset(struct inode *inode)
#define __fs_changed(gen,s) (gen != get_generation (s))
#define fs_changed(gen,s) \
({ \
reiserfs_write_unlock(s); \
cond_resched(); \
reiserfs_write_lock(s); \
reiserfs_cond_resched(s); \
__fs_changed(gen, s); \
})

Expand Down

0 comments on commit d663af8

Please sign in to comment.