ext4: improve smp scalability for inode generation
->s_next_generation is protected by s_next_gen_lock but its usage pattern is very primitive. We don't actually need sequentially increasing new generation numbers, so let's use prandom_u32() instead. Reported-by: Dmitry Monakhov <dmonakhov@openvz.org> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
@@ -1138,9 +1138,7 @@ got:
|
||||
inode->i_ino);
|
||||
goto out;
|
||||
}
|
||||
spin_lock(&sbi->s_next_gen_lock);
|
||||
inode->i_generation = sbi->s_next_generation++;
|
||||
spin_unlock(&sbi->s_next_gen_lock);
|
||||
inode->i_generation = prandom_u32();
|
||||
|
||||
/* Precompute checksum seed for inode metadata */
|
||||
if (ext4_has_metadata_csum(sb)) {
|
||||
|
Reference in New Issue
Block a user