aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ufs/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ufs/super.c')
-rw-r--r--fs/ufs/super.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index 1427e44bfd2a..cf74548aa85a 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -95,14 +95,16 @@
95/* 95/*
96 * Print contents of ufs_super_block, useful for debugging 96 * Print contents of ufs_super_block, useful for debugging
97 */ 97 */
98static void ufs_print_super_stuff(struct super_block *sb, unsigned flags, 98static void ufs_print_super_stuff(struct super_block *sb,
99 struct ufs_super_block_first *usb1, 99 struct ufs_super_block_first *usb1,
100 struct ufs_super_block_second *usb2, 100 struct ufs_super_block_second *usb2,
101 struct ufs_super_block_third *usb3) 101 struct ufs_super_block_third *usb3)
102{ 102{
103 u32 magic = fs32_to_cpu(sb, usb3->fs_magic);
104
103 printk("ufs_print_super_stuff\n"); 105 printk("ufs_print_super_stuff\n");
104 printk(" magic: 0x%x\n", fs32_to_cpu(sb, usb3->fs_magic)); 106 printk(" magic: 0x%x\n", magic);
105 if ((flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2) { 107 if (fs32_to_cpu(sb, usb3->fs_magic) == UFS2_MAGIC) {
106 printk(" fs_size: %llu\n", (unsigned long long) 108 printk(" fs_size: %llu\n", (unsigned long long)
107 fs64_to_cpu(sb, usb3->fs_un1.fs_u2.fs_size)); 109 fs64_to_cpu(sb, usb3->fs_un1.fs_u2.fs_size));
108 printk(" fs_dsize: %llu\n", (unsigned long long) 110 printk(" fs_dsize: %llu\n", (unsigned long long)
@@ -119,6 +121,12 @@ static void ufs_print_super_stuff(struct super_block *sb, unsigned flags,
119 printk(" cs_nbfree(No of free blocks): %llu\n", 121 printk(" cs_nbfree(No of free blocks): %llu\n",
120 (unsigned long long) 122 (unsigned long long)
121 fs64_to_cpu(sb, usb2->fs_un.fs_u2.cs_nbfree)); 123 fs64_to_cpu(sb, usb2->fs_un.fs_u2.cs_nbfree));
124 printk(KERN_INFO" cs_nifree(Num of free inodes): %llu\n",
125 (unsigned long long)
126 fs64_to_cpu(sb, usb3->fs_un1.fs_u2.cs_nifree));
127 printk(KERN_INFO" cs_nffree(Num of free frags): %llu\n",
128 (unsigned long long)
129 fs64_to_cpu(sb, usb3->fs_un1.fs_u2.cs_nffree));
122 } else { 130 } else {
123 printk(" sblkno: %u\n", fs32_to_cpu(sb, usb1->fs_sblkno)); 131 printk(" sblkno: %u\n", fs32_to_cpu(sb, usb1->fs_sblkno));
124 printk(" cblkno: %u\n", fs32_to_cpu(sb, usb1->fs_cblkno)); 132 printk(" cblkno: %u\n", fs32_to_cpu(sb, usb1->fs_cblkno));
@@ -201,7 +209,7 @@ static void ufs_print_cylinder_stuff(struct super_block *sb,
201 printk("\n"); 209 printk("\n");
202} 210}
203#else 211#else
204# define ufs_print_super_stuff(sb, flags, usb1, usb2, usb3) /**/ 212# define ufs_print_super_stuff(sb, usb1, usb2, usb3) /**/
205# define ufs_print_cylinder_stuff(sb, cg) /**/ 213# define ufs_print_cylinder_stuff(sb, cg) /**/
206#endif /* CONFIG_UFS_DEBUG */ 214#endif /* CONFIG_UFS_DEBUG */
207 215
@@ -424,7 +432,6 @@ static int ufs_read_cylinder_structures(struct super_block *sb)
424{ 432{
425 struct ufs_sb_info *sbi = UFS_SB(sb); 433 struct ufs_sb_info *sbi = UFS_SB(sb);
426 struct ufs_sb_private_info *uspi = sbi->s_uspi; 434 struct ufs_sb_private_info *uspi = sbi->s_uspi;
427 unsigned flags = sbi->s_flags;
428 struct ufs_buffer_head * ubh; 435 struct ufs_buffer_head * ubh;
429 unsigned char * base, * space; 436 unsigned char * base, * space;
430 unsigned size, blks, i; 437 unsigned size, blks, i;
@@ -448,11 +455,7 @@ static int ufs_read_cylinder_structures(struct super_block *sb)
448 if (i + uspi->s_fpb > blks) 455 if (i + uspi->s_fpb > blks)
449 size = (blks - i) * uspi->s_fsize; 456 size = (blks - i) * uspi->s_fsize;
450 457
451 if ((flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2) 458 ubh = ubh_bread(sb, uspi->s_csaddr + i, size);
452 ubh = ubh_bread(sb,
453 fs64_to_cpu(sb, usb3->fs_un1.fs_u2.fs_csaddr) + i, size);
454 else
455 ubh = ubh_bread(sb, uspi->s_csaddr + i, size);
456 459
457 if (!ubh) 460 if (!ubh)
458 goto failed; 461 goto failed;
@@ -547,6 +550,7 @@ static void ufs_put_cstotal(struct super_block *sb)
547 cpu_to_fs32(sb, uspi->cs_total.cs_nffree); 550 cpu_to_fs32(sb, uspi->cs_total.cs_nffree);
548 } 551 }
549 ubh_mark_buffer_dirty(USPI_UBH(uspi)); 552 ubh_mark_buffer_dirty(USPI_UBH(uspi));
553 ufs_print_super_stuff(sb, usb1, usb2, usb3);
550 UFSD("EXIT\n"); 554 UFSD("EXIT\n");
551} 555}
552 556
@@ -574,7 +578,9 @@ static void ufs_put_super_internal(struct super_block *sb)
574 size = uspi->s_bsize; 578 size = uspi->s_bsize;
575 if (i + uspi->s_fpb > blks) 579 if (i + uspi->s_fpb > blks)
576 size = (blks - i) * uspi->s_fsize; 580 size = (blks - i) * uspi->s_fsize;
581
577 ubh = ubh_bread(sb, uspi->s_csaddr + i, size); 582 ubh = ubh_bread(sb, uspi->s_csaddr + i, size);
583
578 ubh_memcpyubh (ubh, space, size); 584 ubh_memcpyubh (ubh, space, size);
579 space += size; 585 space += size;
580 ubh_mark_buffer_uptodate (ubh, 1); 586 ubh_mark_buffer_uptodate (ubh, 1);
@@ -888,7 +894,7 @@ magic_found:
888 } 894 }
889 895
890 896
891 ufs_print_super_stuff(sb, flags, usb1, usb2, usb3); 897 ufs_print_super_stuff(sb, usb1, usb2, usb3);
892 898
893 /* 899 /*
894 * Check, if file system was correctly unmounted. 900 * Check, if file system was correctly unmounted.
@@ -971,7 +977,12 @@ magic_found:
971 uspi->s_npsect = ufs_get_fs_npsect(sb, usb1, usb3); 977 uspi->s_npsect = ufs_get_fs_npsect(sb, usb1, usb3);
972 uspi->s_interleave = fs32_to_cpu(sb, usb1->fs_interleave); 978 uspi->s_interleave = fs32_to_cpu(sb, usb1->fs_interleave);
973 uspi->s_trackskew = fs32_to_cpu(sb, usb1->fs_trackskew); 979 uspi->s_trackskew = fs32_to_cpu(sb, usb1->fs_trackskew);
974 uspi->s_csaddr = fs32_to_cpu(sb, usb1->fs_csaddr); 980
981 if (uspi->fs_magic == UFS2_MAGIC)
982 uspi->s_csaddr = fs64_to_cpu(sb, usb3->fs_un1.fs_u2.fs_csaddr);
983 else
984 uspi->s_csaddr = fs32_to_cpu(sb, usb1->fs_csaddr);
985
975 uspi->s_cssize = fs32_to_cpu(sb, usb1->fs_cssize); 986 uspi->s_cssize = fs32_to_cpu(sb, usb1->fs_cssize);
976 uspi->s_cgsize = fs32_to_cpu(sb, usb1->fs_cgsize); 987 uspi->s_cgsize = fs32_to_cpu(sb, usb1->fs_cgsize);
977 uspi->s_ntrak = fs32_to_cpu(sb, usb1->fs_ntrak); 988 uspi->s_ntrak = fs32_to_cpu(sb, usb1->fs_ntrak);
@@ -1058,7 +1069,6 @@ static void ufs_write_super(struct super_block *sb)
1058 unsigned flags; 1069 unsigned flags;
1059 1070
1060 lock_kernel(); 1071 lock_kernel();
1061
1062 UFSD("ENTER\n"); 1072 UFSD("ENTER\n");
1063 flags = UFS_SB(sb)->s_flags; 1073 flags = UFS_SB(sb)->s_flags;
1064 uspi = UFS_SB(sb)->s_uspi; 1074 uspi = UFS_SB(sb)->s_uspi;