diff options
author | Christoph Hellwig <hch@lst.de> | 2009-04-28 12:00:26 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2009-06-11 21:36:06 -0400 |
commit | 8c85e125124a473d6f3e9bb187b0b84207f81d91 (patch) | |
tree | d883424a156c00c55193e46567efdffddb6ef6b9 | |
parent | 517bfae28353e996160518add4d00033d3886e61 (diff) |
remove ->write_super call in generic_shutdown_super
We just did a full fs writeout using sync_filesystem before, and if
that's not enough for the filesystem it can perform it's own writeout
in ->put_super, which many filesystems already do.
Move a call to foofs_write_super into every foofs_put_super for now to
guarantee identical behaviour until it's cleaned up by the individual
filesystem maintainers.
Exceptions:
- affs already has identical copy & pasted code at the beginning of
affs_put_super so no need to do it twice.
- xfs does the right thing without it and I have changes pending for
the xfs tree touching this are so I don't really need conflicts
here..
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/bfs/inode.c | 4 | ||||
-rw-r--r-- | fs/exofs/super.c | 3 | ||||
-rw-r--r-- | fs/ext2/super.c | 3 | ||||
-rw-r--r-- | fs/ext4/super.c | 3 | ||||
-rw-r--r-- | fs/fat/inode.c | 3 | ||||
-rw-r--r-- | fs/hfs/super.c | 2 | ||||
-rw-r--r-- | fs/hfsplus/super.c | 2 | ||||
-rw-r--r-- | fs/jffs2/super.c | 3 | ||||
-rw-r--r-- | fs/nilfs2/super.c | 4 | ||||
-rw-r--r-- | fs/reiserfs/super.c | 3 | ||||
-rw-r--r-- | fs/super.c | 2 | ||||
-rw-r--r-- | fs/sysv/inode.c | 3 | ||||
-rw-r--r-- | fs/ufs/super.c | 3 |
13 files changed, 36 insertions, 2 deletions
diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c index cc4062d12ca..4cf3d269e27 100644 --- a/fs/bfs/inode.c +++ b/fs/bfs/inode.c | |||
@@ -30,6 +30,7 @@ MODULE_LICENSE("GPL"); | |||
30 | #define dprintf(x...) | 30 | #define dprintf(x...) |
31 | #endif | 31 | #endif |
32 | 32 | ||
33 | static void bfs_write_super(struct super_block *s); | ||
33 | void dump_imap(const char *prefix, struct super_block *s); | 34 | void dump_imap(const char *prefix, struct super_block *s); |
34 | 35 | ||
35 | struct inode *bfs_iget(struct super_block *sb, unsigned long ino) | 36 | struct inode *bfs_iget(struct super_block *sb, unsigned long ino) |
@@ -216,6 +217,9 @@ static void bfs_put_super(struct super_block *s) | |||
216 | if (!info) | 217 | if (!info) |
217 | return; | 218 | return; |
218 | 219 | ||
220 | if (s->s_dirt) | ||
221 | bfs_write_super(s); | ||
222 | |||
219 | brelse(info->si_sbh); | 223 | brelse(info->si_sbh); |
220 | mutex_destroy(&info->bfs_lock); | 224 | mutex_destroy(&info->bfs_lock); |
221 | kfree(info->si_imap); | 225 | kfree(info->si_imap); |
diff --git a/fs/exofs/super.c b/fs/exofs/super.c index 9f1985e857e..3cdb761db8a 100644 --- a/fs/exofs/super.c +++ b/fs/exofs/super.c | |||
@@ -258,6 +258,9 @@ static void exofs_put_super(struct super_block *sb) | |||
258 | int num_pend; | 258 | int num_pend; |
259 | struct exofs_sb_info *sbi = sb->s_fs_info; | 259 | struct exofs_sb_info *sbi = sb->s_fs_info; |
260 | 260 | ||
261 | if (sb->s_dirt) | ||
262 | exofs_write_super(sb); | ||
263 | |||
261 | /* make sure there are no pending commands */ | 264 | /* make sure there are no pending commands */ |
262 | for (num_pend = atomic_read(&sbi->s_curr_pending); num_pend > 0; | 265 | for (num_pend = atomic_read(&sbi->s_curr_pending); num_pend > 0; |
263 | num_pend = atomic_read(&sbi->s_curr_pending)) { | 266 | num_pend = atomic_read(&sbi->s_curr_pending)) { |
diff --git a/fs/ext2/super.c b/fs/ext2/super.c index e3c748faf2d..932a2bcb690 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c | |||
@@ -114,6 +114,9 @@ static void ext2_put_super (struct super_block * sb) | |||
114 | int i; | 114 | int i; |
115 | struct ext2_sb_info *sbi = EXT2_SB(sb); | 115 | struct ext2_sb_info *sbi = EXT2_SB(sb); |
116 | 116 | ||
117 | if (sb->s_dirt) | ||
118 | ext2_write_super(sb); | ||
119 | |||
117 | ext2_xattr_put_super(sb); | 120 | ext2_xattr_put_super(sb); |
118 | if (!(sb->s_flags & MS_RDONLY)) { | 121 | if (!(sb->s_flags & MS_RDONLY)) { |
119 | struct ext2_super_block *es = sbi->s_es; | 122 | struct ext2_super_block *es = sbi->s_es; |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index f016707597a..c7b8f8d9b7a 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -576,6 +576,9 @@ static void ext4_put_super(struct super_block *sb) | |||
576 | struct ext4_super_block *es = sbi->s_es; | 576 | struct ext4_super_block *es = sbi->s_es; |
577 | int i, err; | 577 | int i, err; |
578 | 578 | ||
579 | if (sb->s_dirt) | ||
580 | ext4_write_super(sb); | ||
581 | |||
579 | ext4_release_system_zone(sb); | 582 | ext4_release_system_zone(sb); |
580 | ext4_mb_release(sb); | 583 | ext4_mb_release(sb); |
581 | ext4_ext_release(sb); | 584 | ext4_ext_release(sb); |
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 296785a0dec..4978621511b 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c | |||
@@ -451,6 +451,9 @@ static void fat_put_super(struct super_block *sb) | |||
451 | { | 451 | { |
452 | struct msdos_sb_info *sbi = MSDOS_SB(sb); | 452 | struct msdos_sb_info *sbi = MSDOS_SB(sb); |
453 | 453 | ||
454 | if (sb->s_dirt) | ||
455 | fat_write_super(sb); | ||
456 | |||
454 | if (sbi->nls_disk) { | 457 | if (sbi->nls_disk) { |
455 | unload_nls(sbi->nls_disk); | 458 | unload_nls(sbi->nls_disk); |
456 | sbi->nls_disk = NULL; | 459 | sbi->nls_disk = NULL; |
diff --git a/fs/hfs/super.c b/fs/hfs/super.c index a36bb749926..e071e6d0646 100644 --- a/fs/hfs/super.c +++ b/fs/hfs/super.c | |||
@@ -65,6 +65,8 @@ static void hfs_write_super(struct super_block *sb) | |||
65 | */ | 65 | */ |
66 | static void hfs_put_super(struct super_block *sb) | 66 | static void hfs_put_super(struct super_block *sb) |
67 | { | 67 | { |
68 | if (sb->s_dirt) | ||
69 | hfs_write_super(sb); | ||
68 | hfs_mdb_close(sb); | 70 | hfs_mdb_close(sb); |
69 | /* release the MDB's resources */ | 71 | /* release the MDB's resources */ |
70 | hfs_mdb_put(sb); | 72 | hfs_mdb_put(sb); |
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c index f2a64020f42..40bdab79dae 100644 --- a/fs/hfsplus/super.c +++ b/fs/hfsplus/super.c | |||
@@ -199,6 +199,8 @@ static void hfsplus_put_super(struct super_block *sb) | |||
199 | dprint(DBG_SUPER, "hfsplus_put_super\n"); | 199 | dprint(DBG_SUPER, "hfsplus_put_super\n"); |
200 | if (!sb->s_fs_info) | 200 | if (!sb->s_fs_info) |
201 | return; | 201 | return; |
202 | if (sb->s_dirt) | ||
203 | hfsplus_write_super(sb); | ||
202 | if (!(sb->s_flags & MS_RDONLY) && HFSPLUS_SB(sb).s_vhdr) { | 204 | if (!(sb->s_flags & MS_RDONLY) && HFSPLUS_SB(sb).s_vhdr) { |
203 | struct hfsplus_vh *vhdr = HFSPLUS_SB(sb).s_vhdr; | 205 | struct hfsplus_vh *vhdr = HFSPLUS_SB(sb).s_vhdr; |
204 | 206 | ||
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index 4c4e18c54a5..5059e9633ed 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c | |||
@@ -174,6 +174,9 @@ static void jffs2_put_super (struct super_block *sb) | |||
174 | 174 | ||
175 | D2(printk(KERN_DEBUG "jffs2: jffs2_put_super()\n")); | 175 | D2(printk(KERN_DEBUG "jffs2: jffs2_put_super()\n")); |
176 | 176 | ||
177 | if (sb->s_dirt) | ||
178 | jffs2_write_super(sb); | ||
179 | |||
177 | mutex_lock(&c->alloc_sem); | 180 | mutex_lock(&c->alloc_sem); |
178 | jffs2_flush_wbuf_pad(c); | 181 | jffs2_flush_wbuf_pad(c); |
179 | mutex_unlock(&c->alloc_sem); | 182 | mutex_unlock(&c->alloc_sem); |
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index 6989b03e97a..7901d8cbb9b 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c | |||
@@ -65,6 +65,7 @@ MODULE_DESCRIPTION("A New Implementation of the Log-structured Filesystem " | |||
65 | "(NILFS)"); | 65 | "(NILFS)"); |
66 | MODULE_LICENSE("GPL"); | 66 | MODULE_LICENSE("GPL"); |
67 | 67 | ||
68 | static void nilfs_write_super(struct super_block *sb); | ||
68 | static int nilfs_remount(struct super_block *sb, int *flags, char *data); | 69 | static int nilfs_remount(struct super_block *sb, int *flags, char *data); |
69 | static int test_exclusive_mount(struct file_system_type *fs_type, | 70 | static int test_exclusive_mount(struct file_system_type *fs_type, |
70 | struct block_device *bdev, int flags); | 71 | struct block_device *bdev, int flags); |
@@ -315,6 +316,9 @@ static void nilfs_put_super(struct super_block *sb) | |||
315 | struct nilfs_sb_info *sbi = NILFS_SB(sb); | 316 | struct nilfs_sb_info *sbi = NILFS_SB(sb); |
316 | struct the_nilfs *nilfs = sbi->s_nilfs; | 317 | struct the_nilfs *nilfs = sbi->s_nilfs; |
317 | 318 | ||
319 | if (sb->s_dirt) | ||
320 | nilfs_write_super(sb); | ||
321 | |||
318 | nilfs_detach_segment_constructor(sbi); | 322 | nilfs_detach_segment_constructor(sbi); |
319 | 323 | ||
320 | if (!(sb->s_flags & MS_RDONLY)) { | 324 | if (!(sb->s_flags & MS_RDONLY)) { |
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 9dbdcfb5d31..1b52daa351c 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -468,6 +468,9 @@ static void reiserfs_put_super(struct super_block *s) | |||
468 | struct reiserfs_transaction_handle th; | 468 | struct reiserfs_transaction_handle th; |
469 | th.t_trans_id = 0; | 469 | th.t_trans_id = 0; |
470 | 470 | ||
471 | if (s->s_dirt) | ||
472 | reiserfs_write_super(s); | ||
473 | |||
471 | /* change file system state to current state if it was mounted with read-write permissions */ | 474 | /* change file system state to current state if it was mounted with read-write permissions */ |
472 | if (!(s->s_flags & MS_RDONLY)) { | 475 | if (!(s->s_flags & MS_RDONLY)) { |
473 | if (!journal_begin(&th, s, 10)) { | 476 | if (!journal_begin(&th, s, 10)) { |
diff --git a/fs/super.c b/fs/super.c index 721236e6177..d9a29d5b1d2 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -311,8 +311,6 @@ void generic_shutdown_super(struct super_block *sb) | |||
311 | invalidate_inodes(sb); | 311 | invalidate_inodes(sb); |
312 | lock_kernel(); | 312 | lock_kernel(); |
313 | 313 | ||
314 | if (sop->write_super && sb->s_dirt) | ||
315 | sop->write_super(sb); | ||
316 | if (sop->put_super) | 314 | if (sop->put_super) |
317 | sop->put_super(sb); | 315 | sop->put_super(sb); |
318 | 316 | ||
diff --git a/fs/sysv/inode.c b/fs/sysv/inode.c index da20b48d350..cd80316302c 100644 --- a/fs/sysv/inode.c +++ b/fs/sysv/inode.c | |||
@@ -72,6 +72,9 @@ static void sysv_put_super(struct super_block *sb) | |||
72 | { | 72 | { |
73 | struct sysv_sb_info *sbi = SYSV_SB(sb); | 73 | struct sysv_sb_info *sbi = SYSV_SB(sb); |
74 | 74 | ||
75 | if (sb->s_dirt) | ||
76 | sysv_write_super(sb); | ||
77 | |||
75 | if (!(sb->s_flags & MS_RDONLY)) { | 78 | if (!(sb->s_flags & MS_RDONLY)) { |
76 | /* XXX ext2 also updates the state here */ | 79 | /* XXX ext2 also updates the state here */ |
77 | mark_buffer_dirty(sbi->s_bh1); | 80 | mark_buffer_dirty(sbi->s_bh1); |
diff --git a/fs/ufs/super.c b/fs/ufs/super.c index 60359291761..74afb9fbf58 100644 --- a/fs/ufs/super.c +++ b/fs/ufs/super.c | |||
@@ -1152,6 +1152,9 @@ static void ufs_put_super(struct super_block *sb) | |||
1152 | 1152 | ||
1153 | UFSD("ENTER\n"); | 1153 | UFSD("ENTER\n"); |
1154 | 1154 | ||
1155 | if (sb->s_dirt) | ||
1156 | ufs_write_super(sb); | ||
1157 | |||
1155 | if (!(sb->s_flags & MS_RDONLY)) | 1158 | if (!(sb->s_flags & MS_RDONLY)) |
1156 | ufs_put_super_internal(sb); | 1159 | ufs_put_super_internal(sb); |
1157 | 1160 | ||