aboutsummaryrefslogtreecommitdiffstats
path: root/fs/affs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/affs')
-rw-r--r--fs/affs/super.c40
1 files changed, 27 insertions, 13 deletions
diff --git a/fs/affs/super.c b/fs/affs/super.c
index c4814937c968..104fdcb3a7fc 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -25,6 +25,19 @@ static int affs_statfs(struct dentry *dentry, struct kstatfs *buf);
25static int affs_remount (struct super_block *sb, int *flags, char *data); 25static int affs_remount (struct super_block *sb, int *flags, char *data);
26 26
27static void 27static void
28affs_commit_super(struct super_block *sb, int clean)
29{
30 struct affs_sb_info *sbi = AFFS_SB(sb);
31 struct buffer_head *bh = sbi->s_root_bh;
32 struct affs_root_tail *tail = AFFS_ROOT_TAIL(sb, bh);
33
34 tail->bm_flag = cpu_to_be32(clean);
35 secs_to_datestamp(get_seconds(), &tail->disk_change);
36 affs_fix_checksum(sb, bh);
37 mark_buffer_dirty(bh);
38}
39
40static void
28affs_put_super(struct super_block *sb) 41affs_put_super(struct super_block *sb)
29{ 42{
30 struct affs_sb_info *sbi = AFFS_SB(sb); 43 struct affs_sb_info *sbi = AFFS_SB(sb);
@@ -32,13 +45,8 @@ affs_put_super(struct super_block *sb)
32 45
33 lock_kernel(); 46 lock_kernel();
34 47
35 if (!(sb->s_flags & MS_RDONLY)) { 48 if (!(sb->s_flags & MS_RDONLY))
36 AFFS_ROOT_TAIL(sb, sbi->s_root_bh)->bm_flag = cpu_to_be32(1); 49 affs_commit_super(sb, 1);
37 secs_to_datestamp(get_seconds(),
38 &AFFS_ROOT_TAIL(sb, sbi->s_root_bh)->disk_change);
39 affs_fix_checksum(sb, sbi->s_root_bh);
40 mark_buffer_dirty(sbi->s_root_bh);
41 }
42 50
43 kfree(sbi->s_prefix); 51 kfree(sbi->s_prefix);
44 affs_free_bitmap(sb); 52 affs_free_bitmap(sb);
@@ -53,18 +61,13 @@ static void
53affs_write_super(struct super_block *sb) 61affs_write_super(struct super_block *sb)
54{ 62{
55 int clean = 2; 63 int clean = 2;
56 struct affs_sb_info *sbi = AFFS_SB(sb);
57 64
58 lock_super(sb); 65 lock_super(sb);
59 if (!(sb->s_flags & MS_RDONLY)) { 66 if (!(sb->s_flags & MS_RDONLY)) {
60 // if (sbi->s_bitmap[i].bm_bh) { 67 // if (sbi->s_bitmap[i].bm_bh) {
61 // if (buffer_dirty(sbi->s_bitmap[i].bm_bh)) { 68 // if (buffer_dirty(sbi->s_bitmap[i].bm_bh)) {
62 // clean = 0; 69 // clean = 0;
63 AFFS_ROOT_TAIL(sb, sbi->s_root_bh)->bm_flag = cpu_to_be32(clean); 70 affs_commit_super(sb, clean);
64 secs_to_datestamp(get_seconds(),
65 &AFFS_ROOT_TAIL(sb, sbi->s_root_bh)->disk_change);
66 affs_fix_checksum(sb, sbi->s_root_bh);
67 mark_buffer_dirty(sbi->s_root_bh);
68 sb->s_dirt = !clean; /* redo until bitmap synced */ 71 sb->s_dirt = !clean; /* redo until bitmap synced */
69 } else 72 } else
70 sb->s_dirt = 0; 73 sb->s_dirt = 0;
@@ -73,6 +76,16 @@ affs_write_super(struct super_block *sb)
73 pr_debug("AFFS: write_super() at %lu, clean=%d\n", get_seconds(), clean); 76 pr_debug("AFFS: write_super() at %lu, clean=%d\n", get_seconds(), clean);
74} 77}
75 78
79static int
80affs_sync_fs(struct super_block *sb, int wait)
81{
82 lock_super(sb);
83 affs_commit_super(sb, 2);
84 sb->s_dirt = 0;
85 unlock_super(sb);
86 return 0;
87}
88
76static struct kmem_cache * affs_inode_cachep; 89static struct kmem_cache * affs_inode_cachep;
77 90
78static struct inode *affs_alloc_inode(struct super_block *sb) 91static struct inode *affs_alloc_inode(struct super_block *sb)
@@ -130,6 +143,7 @@ static const struct super_operations affs_sops = {
130 .clear_inode = affs_clear_inode, 143 .clear_inode = affs_clear_inode,
131 .put_super = affs_put_super, 144 .put_super = affs_put_super,
132 .write_super = affs_write_super, 145 .write_super = affs_write_super,
146 .sync_fs = affs_sync_fs,
133 .statfs = affs_statfs, 147 .statfs = affs_statfs,
134 .remount_fs = affs_remount, 148 .remount_fs = affs_remount,
135 .show_options = generic_show_options, 149 .show_options = generic_show_options,