ext4: drop sync argument of ext4_commit_super()

Everybody passes 1 as sync argument of ext4_commit_super(). Just drop
it.

Reviewed-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20201216101844.22917-3-jack@suse.cz
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
Jan Kara 2020-12-16 11:18:38 +01:00 committed by Theodore Ts'o
parent e789ca0cc1
commit 4392fbc4ba
1 changed files with 22 additions and 25 deletions

View File

@ -65,7 +65,7 @@ static struct ratelimit_state ext4_mount_msg_ratelimit;
static int ext4_load_journal(struct super_block *, struct ext4_super_block *, static int ext4_load_journal(struct super_block *, struct ext4_super_block *,
unsigned long journal_devnum); unsigned long journal_devnum);
static int ext4_show_options(struct seq_file *seq, struct dentry *root); static int ext4_show_options(struct seq_file *seq, struct dentry *root);
static int ext4_commit_super(struct super_block *sb, int sync); static int ext4_commit_super(struct super_block *sb);
static int ext4_mark_recovery_complete(struct super_block *sb, static int ext4_mark_recovery_complete(struct super_block *sb,
struct ext4_super_block *es); struct ext4_super_block *es);
static int ext4_clear_journal_err(struct super_block *sb, static int ext4_clear_journal_err(struct super_block *sb,
@ -621,7 +621,7 @@ static void save_error_info(struct super_block *sb, int error,
{ {
__save_error_info(sb, error, ino, block, func, line); __save_error_info(sb, error, ino, block, func, line);
if (!bdev_read_only(sb->s_bdev)) if (!bdev_read_only(sb->s_bdev))
ext4_commit_super(sb, 1); ext4_commit_super(sb);
} }
/* Deal with the reporting of failure conditions on a filesystem such as /* Deal with the reporting of failure conditions on a filesystem such as
@ -686,7 +686,7 @@ static void flush_stashed_error_work(struct work_struct *work)
struct ext4_sb_info *sbi = container_of(work, struct ext4_sb_info, struct ext4_sb_info *sbi = container_of(work, struct ext4_sb_info,
s_error_work); s_error_work);
ext4_commit_super(sbi->s_sb, 1); ext4_commit_super(sbi->s_sb);
} }
#define ext4_error_ratelimit(sb) \ #define ext4_error_ratelimit(sb) \
@ -1152,7 +1152,7 @@ static void ext4_put_super(struct super_block *sb)
es->s_state = cpu_to_le16(sbi->s_mount_state); es->s_state = cpu_to_le16(sbi->s_mount_state);
} }
if (!sb_rdonly(sb)) if (!sb_rdonly(sb))
ext4_commit_super(sb, 1); ext4_commit_super(sb);
rcu_read_lock(); rcu_read_lock();
group_desc = rcu_dereference(sbi->s_group_desc); group_desc = rcu_dereference(sbi->s_group_desc);
@ -2642,7 +2642,7 @@ static int ext4_setup_super(struct super_block *sb, struct ext4_super_block *es,
if (sbi->s_journal) if (sbi->s_journal)
ext4_set_feature_journal_needs_recovery(sb); ext4_set_feature_journal_needs_recovery(sb);
err = ext4_commit_super(sb, 1); err = ext4_commit_super(sb);
done: done:
if (test_opt(sb, DEBUG)) if (test_opt(sb, DEBUG))
printk(KERN_INFO "[EXT4 FS bs=%lu, gc=%u, " printk(KERN_INFO "[EXT4 FS bs=%lu, gc=%u, "
@ -4869,7 +4869,7 @@ no_journal:
if (DUMMY_ENCRYPTION_ENABLED(sbi) && !sb_rdonly(sb) && if (DUMMY_ENCRYPTION_ENABLED(sbi) && !sb_rdonly(sb) &&
!ext4_has_feature_encrypt(sb)) { !ext4_has_feature_encrypt(sb)) {
ext4_set_feature_encrypt(sb); ext4_set_feature_encrypt(sb);
ext4_commit_super(sb, 1); ext4_commit_super(sb);
} }
/* /*
@ -5424,7 +5424,7 @@ static int ext4_load_journal(struct super_block *sb,
es->s_journal_dev = cpu_to_le32(journal_devnum); es->s_journal_dev = cpu_to_le32(journal_devnum);
/* Make sure we flush the recovery flag to disk. */ /* Make sure we flush the recovery flag to disk. */
ext4_commit_super(sb, 1); ext4_commit_super(sb);
} }
return 0; return 0;
@ -5434,7 +5434,7 @@ err_out:
return err; return err;
} }
static int ext4_commit_super(struct super_block *sb, int sync) static int ext4_commit_super(struct super_block *sb)
{ {
struct ext4_sb_info *sbi = EXT4_SB(sb); struct ext4_sb_info *sbi = EXT4_SB(sb);
struct ext4_super_block *es = EXT4_SB(sb)->s_es; struct ext4_super_block *es = EXT4_SB(sb)->s_es;
@ -5515,8 +5515,7 @@ static int ext4_commit_super(struct super_block *sb, int sync)
BUFFER_TRACE(sbh, "marking dirty"); BUFFER_TRACE(sbh, "marking dirty");
ext4_superblock_csum_set(sb); ext4_superblock_csum_set(sb);
if (sync) lock_buffer(sbh);
lock_buffer(sbh);
if (buffer_write_io_error(sbh) || !buffer_uptodate(sbh)) { if (buffer_write_io_error(sbh) || !buffer_uptodate(sbh)) {
/* /*
* Oh, dear. A previous attempt to write the * Oh, dear. A previous attempt to write the
@ -5532,16 +5531,14 @@ static int ext4_commit_super(struct super_block *sb, int sync)
set_buffer_uptodate(sbh); set_buffer_uptodate(sbh);
} }
mark_buffer_dirty(sbh); mark_buffer_dirty(sbh);
if (sync) { unlock_buffer(sbh);
unlock_buffer(sbh); error = __sync_dirty_buffer(sbh,
error = __sync_dirty_buffer(sbh, REQ_SYNC | (test_opt(sb, BARRIER) ? REQ_FUA : 0));
REQ_SYNC | (test_opt(sb, BARRIER) ? REQ_FUA : 0)); if (buffer_write_io_error(sbh)) {
if (buffer_write_io_error(sbh)) { ext4_msg(sb, KERN_ERR, "I/O error while writing "
ext4_msg(sb, KERN_ERR, "I/O error while writing " "superblock");
"superblock"); clear_buffer_write_io_error(sbh);
clear_buffer_write_io_error(sbh); set_buffer_uptodate(sbh);
set_buffer_uptodate(sbh);
}
} }
return error; return error;
} }
@ -5572,7 +5569,7 @@ static int ext4_mark_recovery_complete(struct super_block *sb,
if (ext4_has_feature_journal_needs_recovery(sb) && sb_rdonly(sb)) { if (ext4_has_feature_journal_needs_recovery(sb) && sb_rdonly(sb)) {
ext4_clear_feature_journal_needs_recovery(sb); ext4_clear_feature_journal_needs_recovery(sb);
ext4_commit_super(sb, 1); ext4_commit_super(sb);
} }
out: out:
jbd2_journal_unlock_updates(journal); jbd2_journal_unlock_updates(journal);
@ -5614,7 +5611,7 @@ static int ext4_clear_journal_err(struct super_block *sb,
EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS; EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS;
es->s_state |= cpu_to_le16(EXT4_ERROR_FS); es->s_state |= cpu_to_le16(EXT4_ERROR_FS);
ext4_commit_super(sb, 1); ext4_commit_super(sb);
jbd2_journal_clear_err(journal); jbd2_journal_clear_err(journal);
jbd2_journal_update_sb_errno(journal); jbd2_journal_update_sb_errno(journal);
@ -5716,7 +5713,7 @@ static int ext4_freeze(struct super_block *sb)
ext4_clear_feature_journal_needs_recovery(sb); ext4_clear_feature_journal_needs_recovery(sb);
} }
error = ext4_commit_super(sb, 1); error = ext4_commit_super(sb);
out: out:
if (journal) if (journal)
/* we rely on upper layer to stop further updates */ /* we rely on upper layer to stop further updates */
@ -5738,7 +5735,7 @@ static int ext4_unfreeze(struct super_block *sb)
ext4_set_feature_journal_needs_recovery(sb); ext4_set_feature_journal_needs_recovery(sb);
} }
ext4_commit_super(sb, 1); ext4_commit_super(sb);
return 0; return 0;
} }
@ -5998,7 +5995,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
} }
if (sbi->s_journal == NULL && !(old_sb_flags & SB_RDONLY)) { if (sbi->s_journal == NULL && !(old_sb_flags & SB_RDONLY)) {
err = ext4_commit_super(sb, 1); err = ext4_commit_super(sb);
if (err) if (err)
goto restore_opts; goto restore_opts;
} }