aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2012-07-12 09:28:07 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-07-22 15:58:14 -0400
commit7bd54ef722e9938768f524677be0ac4985d8473a (patch)
treedca26fd9d6420dec3ebb65f9b8aa58c05afd9236 /fs
parent65e5e83f7d01a3790deb1ba2e0d887e715c43307 (diff)
fs/ufs: re-arrange the code a bit
This patch does not do any functional changes. It only moves 3 functions in fs/ufs/super.c a little bit up in order to prepare for further changes where I'll need this new arrangement to avoid forward declarations. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/ufs/super.c117
1 files changed, 58 insertions, 59 deletions
diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index ae91e0af2664..ad56c6dffc64 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -691,6 +691,64 @@ static void ufs_put_super_internal(struct super_block *sb)
691 UFSD("EXIT\n"); 691 UFSD("EXIT\n");
692} 692}
693 693
694static int ufs_sync_fs(struct super_block *sb, int wait)
695{
696 struct ufs_sb_private_info * uspi;
697 struct ufs_super_block_first * usb1;
698 struct ufs_super_block_third * usb3;
699 unsigned flags;
700
701 lock_ufs(sb);
702 lock_super(sb);
703
704 UFSD("ENTER\n");
705
706 flags = UFS_SB(sb)->s_flags;
707 uspi = UFS_SB(sb)->s_uspi;
708 usb1 = ubh_get_usb_first(uspi);
709 usb3 = ubh_get_usb_third(uspi);
710
711 usb1->fs_time = cpu_to_fs32(sb, get_seconds());
712 if ((flags & UFS_ST_MASK) == UFS_ST_SUN ||
713 (flags & UFS_ST_MASK) == UFS_ST_SUNOS ||
714 (flags & UFS_ST_MASK) == UFS_ST_SUNx86)
715 ufs_set_fs_state(sb, usb1, usb3,
716 UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time));
717 ufs_put_cstotal(sb);
718 sb->s_dirt = 0;
719
720 UFSD("EXIT\n");
721 unlock_super(sb);
722 unlock_ufs(sb);
723
724 return 0;
725}
726
727static void ufs_write_super(struct super_block *sb)
728{
729 if (!(sb->s_flags & MS_RDONLY))
730 ufs_sync_fs(sb, 1);
731 else
732 sb->s_dirt = 0;
733}
734
735static void ufs_put_super(struct super_block *sb)
736{
737 struct ufs_sb_info * sbi = UFS_SB(sb);
738
739 UFSD("ENTER\n");
740
741 if (!(sb->s_flags & MS_RDONLY))
742 ufs_put_super_internal(sb);
743
744 ubh_brelse_uspi (sbi->s_uspi);
745 kfree (sbi->s_uspi);
746 kfree (sbi);
747 sb->s_fs_info = NULL;
748 UFSD("EXIT\n");
749 return;
750}
751
694static int ufs_fill_super(struct super_block *sb, void *data, int silent) 752static int ufs_fill_super(struct super_block *sb, void *data, int silent)
695{ 753{
696 struct ufs_sb_info * sbi; 754 struct ufs_sb_info * sbi;
@@ -1191,65 +1249,6 @@ failed_nomem:
1191 return -ENOMEM; 1249 return -ENOMEM;
1192} 1250}
1193 1251
1194static int ufs_sync_fs(struct super_block *sb, int wait)
1195{
1196 struct ufs_sb_private_info * uspi;
1197 struct ufs_super_block_first * usb1;
1198 struct ufs_super_block_third * usb3;
1199 unsigned flags;
1200
1201 lock_ufs(sb);
1202 lock_super(sb);
1203
1204 UFSD("ENTER\n");
1205
1206 flags = UFS_SB(sb)->s_flags;
1207 uspi = UFS_SB(sb)->s_uspi;
1208 usb1 = ubh_get_usb_first(uspi);
1209 usb3 = ubh_get_usb_third(uspi);
1210
1211 usb1->fs_time = cpu_to_fs32(sb, get_seconds());
1212 if ((flags & UFS_ST_MASK) == UFS_ST_SUN ||
1213 (flags & UFS_ST_MASK) == UFS_ST_SUNOS ||
1214 (flags & UFS_ST_MASK) == UFS_ST_SUNx86)
1215 ufs_set_fs_state(sb, usb1, usb3,
1216 UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time));
1217 ufs_put_cstotal(sb);
1218 sb->s_dirt = 0;
1219
1220 UFSD("EXIT\n");
1221 unlock_super(sb);
1222 unlock_ufs(sb);
1223
1224 return 0;
1225}
1226
1227static void ufs_write_super(struct super_block *sb)
1228{
1229 if (!(sb->s_flags & MS_RDONLY))
1230 ufs_sync_fs(sb, 1);
1231 else
1232 sb->s_dirt = 0;
1233}
1234
1235static void ufs_put_super(struct super_block *sb)
1236{
1237 struct ufs_sb_info * sbi = UFS_SB(sb);
1238
1239 UFSD("ENTER\n");
1240
1241 if (!(sb->s_flags & MS_RDONLY))
1242 ufs_put_super_internal(sb);
1243
1244 ubh_brelse_uspi (sbi->s_uspi);
1245 kfree (sbi->s_uspi);
1246 kfree (sbi);
1247 sb->s_fs_info = NULL;
1248 UFSD("EXIT\n");
1249 return;
1250}
1251
1252
1253static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) 1252static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
1254{ 1253{
1255 struct ufs_sb_private_info * uspi; 1254 struct ufs_sb_private_info * uspi;