Skip to content

Commit bb15cea

Browse files
committed
ext4: rename s_error_work to s_sb_upd_work
The most common use that s_error_work will get scheduled is now the periodic update of the superblock. So rename it to s_sb_upd_work. Also rename the function flush_stashed_error_work() to update_super_work(). Signed-off-by: Theodore Ts'o <tytso@mit.edu>
1 parent ff0722d commit bb15cea

File tree

2 files changed

+22
-19
lines changed

2 files changed

+22
-19
lines changed

fs/ext4/ext4.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1698,10 +1698,13 @@ struct ext4_sb_info {
16981698
const char *s_last_error_func;
16991699
time64_t s_last_error_time;
17001700
/*
1701-
* If we are in a context where we cannot update error information in
1702-
* the on-disk superblock, we queue this work to do it.
1701+
* If we are in a context where we cannot update the on-disk
1702+
* superblock, we queue the work here. This is used to update
1703+
* the error information in the superblock, and for periodic
1704+
* updates of the superblock called from the commit callback
1705+
* function.
17031706
*/
1704-
struct work_struct s_error_work;
1707+
struct work_struct s_sb_upd_work;
17051708

17061709
/* Ext4 fast commit sub transaction ID */
17071710
atomic_t s_fc_subtid;

fs/ext4/super.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ static void ext4_maybe_update_superblock(struct super_block *sb)
481481
diff_size = lifetime_write_kbytes - le64_to_cpu(es->s_kbytes_written);
482482

483483
if (diff_size > EXT4_SB_REFRESH_INTERVAL_KB)
484-
schedule_work(&EXT4_SB(sb)->s_error_work);
484+
schedule_work(&EXT4_SB(sb)->s_sb_upd_work);
485485
}
486486

487487
/*
@@ -723,7 +723,7 @@ static void ext4_handle_error(struct super_block *sb, bool force_ro, int error,
723723
* defer superblock flushing to a workqueue.
724724
*/
725725
if (continue_fs && journal)
726-
schedule_work(&EXT4_SB(sb)->s_error_work);
726+
schedule_work(&EXT4_SB(sb)->s_sb_upd_work);
727727
else
728728
ext4_commit_super(sb);
729729
}
@@ -750,10 +750,10 @@ static void ext4_handle_error(struct super_block *sb, bool force_ro, int error,
750750
sb->s_flags |= SB_RDONLY;
751751
}
752752

753-
static void flush_stashed_error_work(struct work_struct *work)
753+
static void update_super_work(struct work_struct *work)
754754
{
755755
struct ext4_sb_info *sbi = container_of(work, struct ext4_sb_info,
756-
s_error_work);
756+
s_sb_upd_work);
757757
journal_t *journal = sbi->s_journal;
758758
handle_t *handle;
759759

@@ -1078,7 +1078,7 @@ __acquires(bitlock)
10781078
if (!bdev_read_only(sb->s_bdev)) {
10791079
save_error_info(sb, EFSCORRUPTED, ino, block, function,
10801080
line);
1081-
schedule_work(&EXT4_SB(sb)->s_error_work);
1081+
schedule_work(&EXT4_SB(sb)->s_sb_upd_work);
10821082
}
10831083
return;
10841084
}
@@ -1318,10 +1318,10 @@ static void ext4_put_super(struct super_block *sb)
13181318
* Unregister sysfs before destroying jbd2 journal.
13191319
* Since we could still access attr_journal_task attribute via sysfs
13201320
* path which could have sbi->s_journal->j_task as NULL
1321-
* Unregister sysfs before flush sbi->s_error_work.
1321+
* Unregister sysfs before flush sbi->s_sb_upd_work.
13221322
* Since user may read /proc/fs/ext4/xx/mb_groups during umount, If
13231323
* read metadata verify failed then will queue error work.
1324-
* flush_stashed_error_work will call start_this_handle may trigger
1324+
* update_super_work will call start_this_handle may trigger
13251325
* BUG_ON.
13261326
*/
13271327
ext4_unregister_sysfs(sb);
@@ -1333,7 +1333,7 @@ static void ext4_put_super(struct super_block *sb)
13331333
ext4_unregister_li_request(sb);
13341334
ext4_quotas_off(sb, EXT4_MAXQUOTAS);
13351335

1336-
flush_work(&sbi->s_error_work);
1336+
flush_work(&sbi->s_sb_upd_work);
13371337
destroy_workqueue(sbi->rsv_conversion_wq);
13381338
ext4_release_orphan_info(sb);
13391339

@@ -4998,8 +4998,8 @@ static int ext4_load_and_init_journal(struct super_block *sb,
49984998
return 0;
49994999

50005000
out:
5001-
/* flush s_error_work before journal destroy. */
5002-
flush_work(&sbi->s_error_work);
5001+
/* flush s_sb_upd_work before destroying the journal. */
5002+
flush_work(&sbi->s_sb_upd_work);
50035003
jbd2_journal_destroy(sbi->s_journal);
50045004
sbi->s_journal = NULL;
50055005
return -EINVAL;
@@ -5322,7 +5322,7 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
53225322

53235323
timer_setup(&sbi->s_err_report, print_daily_error_info, 0);
53245324
spin_lock_init(&sbi->s_error_lock);
5325-
INIT_WORK(&sbi->s_error_work, flush_stashed_error_work);
5325+
INIT_WORK(&sbi->s_sb_upd_work, update_super_work);
53265326

53275327
err = ext4_group_desc_init(sb, es, logical_sb_block, &first_not_zeroed);
53285328
if (err)
@@ -5666,16 +5666,16 @@ failed_mount9: __maybe_unused
56665666
sbi->s_ea_block_cache = NULL;
56675667

56685668
if (sbi->s_journal) {
5669-
/* flush s_error_work before journal destroy. */
5670-
flush_work(&sbi->s_error_work);
5669+
/* flush s_sb_upd_work before journal destroy. */
5670+
flush_work(&sbi->s_sb_upd_work);
56715671
jbd2_journal_destroy(sbi->s_journal);
56725672
sbi->s_journal = NULL;
56735673
}
56745674
failed_mount3a:
56755675
ext4_es_unregister_shrinker(sbi);
56765676
failed_mount3:
5677-
/* flush s_error_work before sbi destroy */
5678-
flush_work(&sbi->s_error_work);
5677+
/* flush s_sb_upd_work before sbi destroy */
5678+
flush_work(&sbi->s_sb_upd_work);
56795679
del_timer_sync(&sbi->s_err_report);
56805680
ext4_stop_mmpd(sbi);
56815681
ext4_group_desc_free(sbi);
@@ -6551,7 +6551,7 @@ static int __ext4_remount(struct fs_context *fc, struct super_block *sb)
65516551
}
65526552

65536553
/* Flush outstanding errors before changing fs state */
6554-
flush_work(&sbi->s_error_work);
6554+
flush_work(&sbi->s_sb_upd_work);
65556555

65566556
if ((bool)(fc->sb_flags & SB_RDONLY) != sb_rdonly(sb)) {
65576557
if (ext4_forced_shutdown(sb)) {

0 commit comments

Comments
 (0)