1 --- linux-akpm/fs/buffer.c~sync_fs Thu Dec 5 21:33:56 2002
2 +++ linux-akpm-akpm/fs/buffer.c Thu Dec 5 21:33:56 2002
3 @@ -327,6 +327,8 @@ int fsync_super(struct super_block *sb)
5 if (sb->s_dirt && sb->s_op && sb->s_op->write_super)
6 sb->s_op->write_super(sb);
7 + if (sb->s_op && sb->s_op->sync_fs)
8 + sb->s_op->sync_fs(sb);
12 @@ -346,7 +348,7 @@ int fsync_dev(kdev_t dev)
17 + sync_supers(dev, 1);
20 return sync_buffers(dev, 1);
21 @@ -2833,7 +2835,7 @@ static int sync_old_buffers(void)
24 sync_unlocked_inodes();
30 --- linux-akpm/include/linux/fs.h~sync_fs Thu Dec 5 21:33:56 2002
31 +++ linux-akpm-akpm/include/linux/fs.h Thu Dec 5 21:33:56 2002
32 @@ -894,6 +894,7 @@ struct super_operations {
33 void (*delete_inode) (struct inode *);
34 void (*put_super) (struct super_block *);
35 void (*write_super) (struct super_block *);
36 + int (*sync_fs) (struct super_block *);
37 void (*write_super_lockfs) (struct super_block *);
38 void (*unlockfs) (struct super_block *);
39 int (*statfs) (struct super_block *, struct statfs *);
40 @@ -1240,7 +1241,7 @@ static inline int fsync_inode_data_buffe
41 extern int inode_has_buffers(struct inode *);
42 extern int filemap_fdatasync(struct address_space *);
43 extern int filemap_fdatawait(struct address_space *);
44 -extern void sync_supers(kdev_t);
45 +extern void sync_supers(kdev_t dev, int wait);
46 extern void sync_supers_lockfs(kdev_t);
47 extern void unlockfs(kdev_t);
48 extern int bmap(struct inode *, int);
49 --- linux-akpm/fs/super.c~sync_fs Thu Dec 5 21:33:56 2002
50 +++ linux-akpm-akpm/fs/super.c Thu Dec 5 21:33:56 2002
51 @@ -445,7 +445,7 @@ static inline void write_super(struct su
52 * hold up the sync while mounting a device. (The newly
53 * mounted device won't need syncing.)
55 -void sync_supers(kdev_t dev)
56 +void sync_supers(kdev_t dev, int wait)
58 struct super_block * sb;
60 @@ -454,6 +454,8 @@ void sync_supers(kdev_t dev)
64 + if (wait && sb->s_op && sb->s_op->sync_fs)
65 + sb->s_op->sync_fs(sb);
69 @@ -467,6 +469,8 @@ restart:
70 spin_unlock(&sb_lock);
71 down_read(&sb->s_umount);
73 + if (wait && sb->s_op && sb->s_op->sync_fs)
74 + sb->s_op->sync_fs(sb);
78 --- linux-akpm/fs/ext3/super.c~sync_fs Thu Dec 5 21:33:56 2002
79 +++ linux-akpm-akpm/fs/ext3/super.c Thu Dec 5 21:33:56 2002
80 @@ -47,6 +47,8 @@ static void ext3_mark_recovery_complete(
81 static void ext3_clear_journal_err(struct super_block * sb,
82 struct ext3_super_block * es);
84 +static int ext3_sync_fs(struct super_block * sb);
86 #ifdef CONFIG_JBD_DEBUG
87 int journal_no_write[2];
89 @@ -454,6 +456,7 @@ static struct super_operations ext3_sops
90 delete_inode: ext3_delete_inode, /* BKL not held. We take it */
91 put_super: ext3_put_super, /* BKL held */
92 write_super: ext3_write_super, /* BKL held */
93 + sync_fs: ext3_sync_fs,
94 write_super_lockfs: ext3_write_super_lockfs, /* BKL not held. Take it */
95 unlockfs: ext3_unlockfs, /* BKL not held. We take it */
96 statfs: ext3_statfs, /* BKL held */
97 @@ -1577,24 +1580,22 @@ int ext3_force_commit(struct super_block
98 * This implicitly triggers the writebehind on sync().
101 -static int do_sync_supers = 0;
102 -MODULE_PARM(do_sync_supers, "i");
103 -MODULE_PARM_DESC(do_sync_supers, "Write superblocks synchronously");
105 void ext3_write_super (struct super_block * sb)
107 + if (down_trylock(&sb->s_lock) == 0)
110 + log_start_commit(EXT3_SB(sb)->s_journal, NULL);
113 +static int ext3_sync_fs(struct super_block *sb)
117 - if (down_trylock(&sb->s_lock) == 0)
118 - BUG(); /* aviro detector */
120 target = log_start_commit(EXT3_SB(sb)->s_journal, NULL);
122 - if (do_sync_supers) {
124 - log_wait_commit(EXT3_SB(sb)->s_journal, target);
127 + log_wait_commit(EXT3_SB(sb)->s_journal, target);