aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ufs/super.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2009-06-08 04:08:05 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2009-06-11 21:36:16 -0400
commit8c8006564a58d0ea912bf7f2d0a758d97e4b464f (patch)
tree696dd67b5b2c3e303fe17bf992ced9ccb4b34806 /fs/ufs/super.c
parentad43ffdeea0a7bd3e6036c4aeec2e6699aef8ac7 (diff)
ufs: 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>
Diffstat (limited to 'fs/ufs/super.c')
-rw-r--r--fs/ufs/super.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index 6560dda7b18c..5faed7954d0a 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -1125,7 +1125,7 @@ failed_nomem:
1125 return -ENOMEM; 1125 return -ENOMEM;
1126} 1126}
1127 1127
1128static void ufs_write_super(struct super_block *sb) 1128static int ufs_sync_fs(struct super_block *sb, int wait)
1129{ 1129{
1130 struct ufs_sb_private_info * uspi; 1130 struct ufs_sb_private_info * uspi;
1131 struct ufs_super_block_first * usb1; 1131 struct ufs_super_block_first * usb1;
@@ -1134,25 +1134,36 @@ static void ufs_write_super(struct super_block *sb)
1134 1134
1135 lock_super(sb); 1135 lock_super(sb);
1136 lock_kernel(); 1136 lock_kernel();
1137
1137 UFSD("ENTER\n"); 1138 UFSD("ENTER\n");
1139
1138 flags = UFS_SB(sb)->s_flags; 1140 flags = UFS_SB(sb)->s_flags;
1139 uspi = UFS_SB(sb)->s_uspi; 1141 uspi = UFS_SB(sb)->s_uspi;
1140 usb1 = ubh_get_usb_first(uspi); 1142 usb1 = ubh_get_usb_first(uspi);
1141 usb3 = ubh_get_usb_third(uspi); 1143 usb3 = ubh_get_usb_third(uspi);
1142 1144
1143 if (!(sb->s_flags & MS_RDONLY)) { 1145 usb1->fs_time = cpu_to_fs32(sb, get_seconds());
1144 usb1->fs_time = cpu_to_fs32(sb, get_seconds()); 1146 if ((flags & UFS_ST_MASK) == UFS_ST_SUN ||
1145 if ((flags & UFS_ST_MASK) == UFS_ST_SUN 1147 (flags & UFS_ST_MASK) == UFS_ST_SUNOS ||
1146 || (flags & UFS_ST_MASK) == UFS_ST_SUNOS 1148 (flags & UFS_ST_MASK) == UFS_ST_SUNx86)
1147 || (flags & UFS_ST_MASK) == UFS_ST_SUNx86) 1149 ufs_set_fs_state(sb, usb1, usb3,
1148 ufs_set_fs_state(sb, usb1, usb3, 1150 UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time));
1149 UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time)); 1151 ufs_put_cstotal(sb);
1150 ufs_put_cstotal(sb);
1151 }
1152 sb->s_dirt = 0; 1152 sb->s_dirt = 0;
1153
1153 UFSD("EXIT\n"); 1154 UFSD("EXIT\n");
1154 unlock_kernel(); 1155 unlock_kernel();
1155 unlock_super(sb); 1156 unlock_super(sb);
1157
1158 return 0;
1159}
1160
1161static void ufs_write_super(struct super_block *sb)
1162{
1163 if (!(sb->s_flags & MS_RDONLY))
1164 ufs_sync_fs(sb, 1);
1165 else
1166 sb->s_dirt = 0;
1156} 1167}
1157 1168
1158static void ufs_put_super(struct super_block *sb) 1169static void ufs_put_super(struct super_block *sb)
@@ -1381,6 +1392,7 @@ static const struct super_operations ufs_super_ops = {
1381 .delete_inode = ufs_delete_inode, 1392 .delete_inode = ufs_delete_inode,
1382 .put_super = ufs_put_super, 1393 .put_super = ufs_put_super,
1383 .write_super = ufs_write_super, 1394 .write_super = ufs_write_super,
1395 .sync_fs = ufs_sync_fs,
1384 .statfs = ufs_statfs, 1396 .statfs = ufs_statfs,
1385 .remount_fs = ufs_remount, 1397 .remount_fs = ufs_remount,
1386 .show_options = ufs_show_options, 1398 .show_options = ufs_show_options,