Commit bbd55937 authored by Eric Biggers's avatar Eric Biggers Committed by Theodore Ts'o

ext4: rename s_journal_flag_rwsem to s_writepages_rwsem

In preparation for making s_journal_flag_rwsem synchronize
ext4_writepages() with changes to both the EXTENTS and JOURNAL_DATA
flags (rather than just JOURNAL_DATA as it does currently), rename it to
s_writepages_rwsem.

Link: https://lore.kernel.org/r/20200219183047.47417-2-ebiggers@kernel.orgSigned-off-by: default avatarEric Biggers <ebiggers@google.com>
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Cc: stable@kernel.org
parent 7c990728
...@@ -1553,7 +1553,7 @@ struct ext4_sb_info { ...@@ -1553,7 +1553,7 @@ struct ext4_sb_info {
struct ratelimit_state s_msg_ratelimit_state; struct ratelimit_state s_msg_ratelimit_state;
/* Barrier between changing inodes' journal flags and writepages ops. */ /* Barrier between changing inodes' journal flags and writepages ops. */
struct percpu_rw_semaphore s_journal_flag_rwsem; struct percpu_rw_semaphore s_writepages_rwsem;
struct dax_device *s_daxdev; struct dax_device *s_daxdev;
#ifdef CONFIG_EXT4_DEBUG #ifdef CONFIG_EXT4_DEBUG
unsigned long s_simulate_fail; unsigned long s_simulate_fail;
......
...@@ -2628,7 +2628,7 @@ static int ext4_writepages(struct address_space *mapping, ...@@ -2628,7 +2628,7 @@ static int ext4_writepages(struct address_space *mapping,
if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb))))
return -EIO; return -EIO;
percpu_down_read(&sbi->s_journal_flag_rwsem); percpu_down_read(&sbi->s_writepages_rwsem);
trace_ext4_writepages(inode, wbc); trace_ext4_writepages(inode, wbc);
/* /*
...@@ -2849,7 +2849,7 @@ static int ext4_writepages(struct address_space *mapping, ...@@ -2849,7 +2849,7 @@ static int ext4_writepages(struct address_space *mapping,
out_writepages: out_writepages:
trace_ext4_writepages_result(inode, wbc, ret, trace_ext4_writepages_result(inode, wbc, ret,
nr_to_write - wbc->nr_to_write); nr_to_write - wbc->nr_to_write);
percpu_up_read(&sbi->s_journal_flag_rwsem); percpu_up_read(&sbi->s_writepages_rwsem);
return ret; return ret;
} }
...@@ -2864,13 +2864,13 @@ static int ext4_dax_writepages(struct address_space *mapping, ...@@ -2864,13 +2864,13 @@ static int ext4_dax_writepages(struct address_space *mapping,
if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb))))
return -EIO; return -EIO;
percpu_down_read(&sbi->s_journal_flag_rwsem); percpu_down_read(&sbi->s_writepages_rwsem);
trace_ext4_writepages(inode, wbc); trace_ext4_writepages(inode, wbc);
ret = dax_writeback_mapping_range(mapping, sbi->s_daxdev, wbc); ret = dax_writeback_mapping_range(mapping, sbi->s_daxdev, wbc);
trace_ext4_writepages_result(inode, wbc, ret, trace_ext4_writepages_result(inode, wbc, ret,
nr_to_write - wbc->nr_to_write); nr_to_write - wbc->nr_to_write);
percpu_up_read(&sbi->s_journal_flag_rwsem); percpu_up_read(&sbi->s_writepages_rwsem);
return ret; return ret;
} }
...@@ -5861,7 +5861,7 @@ int ext4_change_inode_journal_flag(struct inode *inode, int val) ...@@ -5861,7 +5861,7 @@ int ext4_change_inode_journal_flag(struct inode *inode, int val)
} }
} }
percpu_down_write(&sbi->s_journal_flag_rwsem); percpu_down_write(&sbi->s_writepages_rwsem);
jbd2_journal_lock_updates(journal); jbd2_journal_lock_updates(journal);
/* /*
...@@ -5878,7 +5878,7 @@ int ext4_change_inode_journal_flag(struct inode *inode, int val) ...@@ -5878,7 +5878,7 @@ int ext4_change_inode_journal_flag(struct inode *inode, int val)
err = jbd2_journal_flush(journal); err = jbd2_journal_flush(journal);
if (err < 0) { if (err < 0) {
jbd2_journal_unlock_updates(journal); jbd2_journal_unlock_updates(journal);
percpu_up_write(&sbi->s_journal_flag_rwsem); percpu_up_write(&sbi->s_writepages_rwsem);
return err; return err;
} }
ext4_clear_inode_flag(inode, EXT4_INODE_JOURNAL_DATA); ext4_clear_inode_flag(inode, EXT4_INODE_JOURNAL_DATA);
...@@ -5886,7 +5886,7 @@ int ext4_change_inode_journal_flag(struct inode *inode, int val) ...@@ -5886,7 +5886,7 @@ int ext4_change_inode_journal_flag(struct inode *inode, int val)
ext4_set_aops(inode); ext4_set_aops(inode);
jbd2_journal_unlock_updates(journal); jbd2_journal_unlock_updates(journal);
percpu_up_write(&sbi->s_journal_flag_rwsem); percpu_up_write(&sbi->s_writepages_rwsem);
if (val) if (val)
up_write(&EXT4_I(inode)->i_mmap_sem); up_write(&EXT4_I(inode)->i_mmap_sem);
......
...@@ -1064,7 +1064,7 @@ static void ext4_put_super(struct super_block *sb) ...@@ -1064,7 +1064,7 @@ static void ext4_put_super(struct super_block *sb)
percpu_counter_destroy(&sbi->s_freeinodes_counter); percpu_counter_destroy(&sbi->s_freeinodes_counter);
percpu_counter_destroy(&sbi->s_dirs_counter); percpu_counter_destroy(&sbi->s_dirs_counter);
percpu_counter_destroy(&sbi->s_dirtyclusters_counter); percpu_counter_destroy(&sbi->s_dirtyclusters_counter);
percpu_free_rwsem(&sbi->s_journal_flag_rwsem); percpu_free_rwsem(&sbi->s_writepages_rwsem);
#ifdef CONFIG_QUOTA #ifdef CONFIG_QUOTA
for (i = 0; i < EXT4_MAXQUOTAS; i++) for (i = 0; i < EXT4_MAXQUOTAS; i++)
kfree(get_qf_name(sb, sbi, i)); kfree(get_qf_name(sb, sbi, i));
...@@ -4626,7 +4626,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) ...@@ -4626,7 +4626,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
err = percpu_counter_init(&sbi->s_dirtyclusters_counter, 0, err = percpu_counter_init(&sbi->s_dirtyclusters_counter, 0,
GFP_KERNEL); GFP_KERNEL);
if (!err) if (!err)
err = percpu_init_rwsem(&sbi->s_journal_flag_rwsem); err = percpu_init_rwsem(&sbi->s_writepages_rwsem);
if (err) { if (err) {
ext4_msg(sb, KERN_ERR, "insufficient memory"); ext4_msg(sb, KERN_ERR, "insufficient memory");
...@@ -4726,7 +4726,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) ...@@ -4726,7 +4726,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
percpu_counter_destroy(&sbi->s_freeinodes_counter); percpu_counter_destroy(&sbi->s_freeinodes_counter);
percpu_counter_destroy(&sbi->s_dirs_counter); percpu_counter_destroy(&sbi->s_dirs_counter);
percpu_counter_destroy(&sbi->s_dirtyclusters_counter); percpu_counter_destroy(&sbi->s_dirtyclusters_counter);
percpu_free_rwsem(&sbi->s_journal_flag_rwsem); percpu_free_rwsem(&sbi->s_writepages_rwsem);
failed_mount5: failed_mount5:
ext4_ext_release(sb); ext4_ext_release(sb);
ext4_release_system_zone(sb); ext4_release_system_zone(sb);
......
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