]>
Commit | Line | Data |
---|---|---|
4e887fbd | 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) | |
4 | lock_super(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); | |
9 | unlock_super(sb); | |
10 | unlock_kernel(); | |
11 | ||
12 | @@ -346,7 +348,7 @@ int fsync_dev(kdev_t dev) | |
13 | lock_kernel(); | |
14 | sync_inodes(dev); | |
15 | DQUOT_SYNC_DEV(dev); | |
16 | - sync_supers(dev); | |
17 | + sync_supers(dev, 1); | |
18 | unlock_kernel(); | |
19 | ||
20 | return sync_buffers(dev, 1); | |
21 | @@ -2833,7 +2835,7 @@ static int sync_old_buffers(void) | |
22 | { | |
23 | lock_kernel(); | |
24 | sync_unlocked_inodes(); | |
25 | - sync_supers(0); | |
26 | + sync_supers(0, 0); | |
27 | unlock_kernel(); | |
28 | ||
29 | for (;;) { | |
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); | |
da5f4fbc JR |
46 | extern void sync_supers_lockfs(kdev_t); |
47 | extern void unlockfs(kdev_t); | |
4e887fbd | 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.) | |
54 | */ | |
55 | -void sync_supers(kdev_t dev) | |
56 | +void sync_supers(kdev_t dev, int wait) | |
57 | { | |
58 | struct super_block * sb; | |
59 | ||
60 | @@ -454,6 +454,8 @@ void sync_supers(kdev_t dev) | |
61 | if (sb) { | |
62 | if (sb->s_dirt) | |
63 | write_super(sb); | |
64 | + if (wait && sb->s_op && sb->s_op->sync_fs) | |
65 | + sb->s_op->sync_fs(sb); | |
66 | drop_super(sb); | |
67 | } | |
68 | return; | |
69 | @@ -467,6 +469,8 @@ restart: | |
70 | spin_unlock(&sb_lock); | |
71 | down_read(&sb->s_umount); | |
72 | write_super(sb); | |
73 | + if (wait && sb->s_op && sb->s_op->sync_fs) | |
74 | + sb->s_op->sync_fs(sb); | |
75 | drop_super(sb); | |
76 | goto restart; | |
77 | } else | |
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); | |
83 | ||
84 | +static int ext3_sync_fs(struct super_block * sb); | |
85 | + | |
86 | #ifdef CONFIG_JBD_DEBUG | |
87 | int journal_no_write[2]; | |
88 | ||
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(). | |
99 | */ | |
100 | ||
101 | -static int do_sync_supers = 0; | |
102 | -MODULE_PARM(do_sync_supers, "i"); | |
103 | -MODULE_PARM_DESC(do_sync_supers, "Write superblocks synchronously"); | |
104 | - | |
105 | void ext3_write_super (struct super_block * sb) | |
106 | { | |
107 | + if (down_trylock(&sb->s_lock) == 0) | |
108 | + BUG(); | |
109 | + sb->s_dirt = 0; | |
110 | + log_start_commit(EXT3_SB(sb)->s_journal, NULL); | |
111 | +} | |
112 | + | |
113 | +static int ext3_sync_fs(struct super_block *sb) | |
114 | +{ | |
115 | tid_t target; | |
116 | ||
117 | - if (down_trylock(&sb->s_lock) == 0) | |
118 | - BUG(); /* aviro detector */ | |
119 | sb->s_dirt = 0; | |
120 | target = log_start_commit(EXT3_SB(sb)->s_journal, NULL); | |
121 | - | |
122 | - if (do_sync_supers) { | |
123 | - unlock_super(sb); | |
124 | - log_wait_commit(EXT3_SB(sb)->s_journal, target); | |
125 | - lock_super(sb); | |
126 | - } | |
127 | + log_wait_commit(EXT3_SB(sb)->s_journal, target); | |
128 | + return 0; | |
129 | } | |
130 | ||
131 | /* |