diff options
author | Christoph Hellwig <hch@lst.de> | 2009-06-08 04:03:38 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2009-06-11 21:36:14 -0400 |
commit | 561e47ce7244168788d4ecef9a2271df204b3c89 (patch) | |
tree | b587db305924ff4fea0ca1ad18b341dfda65281e | |
parent | e28964365faf3b9961695eb62b48cbc9f2a2a245 (diff) |
bfs: add ->sync_fs
Add a ->sync_fs method for data integrity syncs, and reimplement
->write_super ontop of it.
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 | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c index d1d9d9088371..6f60336c6628 100644 --- a/fs/bfs/inode.c +++ b/fs/bfs/inode.c | |||
@@ -216,6 +216,26 @@ static void bfs_delete_inode(struct inode *inode) | |||
216 | clear_inode(inode); | 216 | clear_inode(inode); |
217 | } | 217 | } |
218 | 218 | ||
219 | static int bfs_sync_fs(struct super_block *sb, int wait) | ||
220 | { | ||
221 | struct bfs_sb_info *info = BFS_SB(sb); | ||
222 | |||
223 | mutex_lock(&info->bfs_lock); | ||
224 | mark_buffer_dirty(info->si_sbh); | ||
225 | sb->s_dirt = 0; | ||
226 | mutex_unlock(&info->bfs_lock); | ||
227 | |||
228 | return 0; | ||
229 | } | ||
230 | |||
231 | static void bfs_write_super(struct super_block *sb) | ||
232 | { | ||
233 | if (!(sb->s_flags & MS_RDONLY)) | ||
234 | bfs_sync_fs(sb, 1); | ||
235 | else | ||
236 | sb->s_dirt = 0; | ||
237 | } | ||
238 | |||
219 | static void bfs_put_super(struct super_block *s) | 239 | static void bfs_put_super(struct super_block *s) |
220 | { | 240 | { |
221 | struct bfs_sb_info *info = BFS_SB(s); | 241 | struct bfs_sb_info *info = BFS_SB(s); |
@@ -254,17 +274,6 @@ static int bfs_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
254 | return 0; | 274 | return 0; |
255 | } | 275 | } |
256 | 276 | ||
257 | static void bfs_write_super(struct super_block *s) | ||
258 | { | ||
259 | struct bfs_sb_info *info = BFS_SB(s); | ||
260 | |||
261 | mutex_lock(&info->bfs_lock); | ||
262 | if (!(s->s_flags & MS_RDONLY)) | ||
263 | mark_buffer_dirty(info->si_sbh); | ||
264 | s->s_dirt = 0; | ||
265 | mutex_unlock(&info->bfs_lock); | ||
266 | } | ||
267 | |||
268 | static struct kmem_cache *bfs_inode_cachep; | 277 | static struct kmem_cache *bfs_inode_cachep; |
269 | 278 | ||
270 | static struct inode *bfs_alloc_inode(struct super_block *sb) | 279 | static struct inode *bfs_alloc_inode(struct super_block *sb) |
@@ -312,6 +321,7 @@ static const struct super_operations bfs_sops = { | |||
312 | .delete_inode = bfs_delete_inode, | 321 | .delete_inode = bfs_delete_inode, |
313 | .put_super = bfs_put_super, | 322 | .put_super = bfs_put_super, |
314 | .write_super = bfs_write_super, | 323 | .write_super = bfs_write_super, |
324 | .sync_fs = bfs_sync_fs, | ||
315 | .statfs = bfs_statfs, | 325 | .statfs = bfs_statfs, |
316 | }; | 326 | }; |
317 | 327 | ||