Commit 83e830d0 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] resierfs: scheduling latency improvements

From: Chris Mason <mason@suse.com>

Add conditional schedules to reiserfs to help lower latencies.  Bits of
this orginated long ago in code akpm sent me.
parent 82106056
...@@ -652,8 +652,8 @@ int search_by_key (struct super_block * p_s_sb, ...@@ -652,8 +652,8 @@ int search_by_key (struct super_block * p_s_sb,
stop at leaf level - set to stop at leaf level - set to
DISK_LEAF_NODE_LEVEL */ DISK_LEAF_NODE_LEVEL */
) { ) {
int n_block_number = SB_ROOT_BLOCK (p_s_sb), int n_block_number;
expected_level = SB_TREE_HEIGHT (p_s_sb); int expected_level;
struct buffer_head * p_s_bh; struct buffer_head * p_s_bh;
struct path_element * p_s_last_element; struct path_element * p_s_last_element;
int n_node_level, n_retval; int n_node_level, n_retval;
...@@ -677,6 +677,8 @@ int search_by_key (struct super_block * p_s_sb, ...@@ -677,6 +677,8 @@ int search_by_key (struct super_block * p_s_sb,
/* With each iteration of this loop we search through the items in the /* With each iteration of this loop we search through the items in the
current node, and calculate the next current node(next path element) current node, and calculate the next current node(next path element)
for the next iteration of this loop.. */ for the next iteration of this loop.. */
n_block_number = SB_ROOT_BLOCK (p_s_sb);
expected_level = SB_TREE_HEIGHT (p_s_sb);
while ( 1 ) { while ( 1 ) {
#ifdef CONFIG_REISERFS_CHECK #ifdef CONFIG_REISERFS_CHECK
...@@ -706,16 +708,12 @@ int search_by_key (struct super_block * p_s_sb, ...@@ -706,16 +708,12 @@ int search_by_key (struct super_block * p_s_sb,
return IO_ERROR; return IO_ERROR;
} }
if( fs_changed (fs_gen, p_s_sb) ) {
PROC_INFO_INC( p_s_sb, search_by_key_fs_changed );
PROC_INFO_INC( p_s_sb, sbk_fs_changed[ expected_level - 1 ] );
}
/* It is possible that schedule occurred. We must check whether the key /* It is possible that schedule occurred. We must check whether the key
to search is still in the tree rooted from the current buffer. If to search is still in the tree rooted from the current buffer. If
not then repeat search from the root. */ not then repeat search from the root. */
if ( fs_changed (fs_gen, p_s_sb) && if ( fs_changed (fs_gen, p_s_sb) &&
(!B_IS_IN_TREE (p_s_bh) || !key_in_buffer(p_s_search_path, p_s_key, p_s_sb)) ) { (!B_IS_IN_TREE (p_s_bh) || !key_in_buffer(p_s_search_path, p_s_key, p_s_sb)) ) {
PROC_INFO_INC( p_s_sb, search_by_key_fs_changed );
PROC_INFO_INC( p_s_sb, search_by_key_restarted ); PROC_INFO_INC( p_s_sb, search_by_key_restarted );
PROC_INFO_INC( p_s_sb, sbk_restarted[ expected_level - 1 ] ); PROC_INFO_INC( p_s_sb, sbk_restarted[ expected_level - 1 ] );
decrement_counters_in_path(p_s_search_path); decrement_counters_in_path(p_s_search_path);
...@@ -1103,6 +1101,7 @@ static char prepare_for_delete_or_cut( ...@@ -1103,6 +1101,7 @@ static char prepare_for_delete_or_cut(
for (n_counter = *p_n_removed; for (n_counter = *p_n_removed;
n_counter < n_unfm_number; n_counter++, p_n_unfm_pointer-- ) { n_counter < n_unfm_number; n_counter++, p_n_unfm_pointer-- ) {
cond_resched();
if (item_moved (&s_ih, p_s_path)) { if (item_moved (&s_ih, p_s_path)) {
need_research = 1 ; need_research = 1 ;
break; break;
......
...@@ -1335,7 +1335,8 @@ static inline loff_t max_reiserfs_offset (struct inode * inode) ...@@ -1335,7 +1335,8 @@ static inline loff_t max_reiserfs_offset (struct inode * inode)
#define fs_generation(s) (REISERFS_SB(s)->s_generation_counter) #define fs_generation(s) (REISERFS_SB(s)->s_generation_counter)
#define get_generation(s) atomic_read (&fs_generation(s)) #define get_generation(s) atomic_read (&fs_generation(s))
#define FILESYSTEM_CHANGED_TB(tb) (get_generation((tb)->tb_sb) != (tb)->fs_gen) #define FILESYSTEM_CHANGED_TB(tb) (get_generation((tb)->tb_sb) != (tb)->fs_gen)
#define fs_changed(gen,s) (gen != get_generation (s)) #define __fs_changed(gen,s) (gen != get_generation (s))
#define fs_changed(gen,s) ({cond_resched(); __fs_changed(gen, s);})
/***************************************************************************/ /***************************************************************************/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment