[PATCH] ufs: easy debug
[pandora-kernel.git] / fs / ufs / super.c
index e9a42c7..4242599 100644 (file)
 #include "swab.h"
 #include "util.h"
 
-#undef UFS_SUPER_DEBUG
-#undef UFS_SUPER_DEBUG_MORE
-
-
-#undef UFS_SUPER_DEBUG_MORE
-#ifdef UFS_SUPER_DEBUG
-#define UFSD(x) printk("(%s, %d), %s: ", __FILE__, __LINE__, __FUNCTION__); printk x;
-#else
-#define UFSD(x)
-#endif
-
-#ifdef UFS_SUPER_DEBUG_MORE
+#ifdef CONFIG_UFS_DEBUG
 /*
  * Print contents of ufs_super_block, useful for debugging
  */
@@ -157,18 +146,23 @@ void ufs2_print_super_stuff(
        printk("ufs_print_super_stuff\n");
        printk("size of usb:     %u\n", sizeof(struct ufs_super_block));
        printk("  magic:         0x%x\n", fs32_to_cpu(sb, usb->fs_magic));
-       printk("  fs_size:   %u\n",fs64_to_cpu(sb, usb->fs_u11.fs_u2.fs_size));
-       printk("  fs_dsize:  %u\n",fs64_to_cpu(sb, usb->fs_u11.fs_u2.fs_dsize));
-       printk("  bsize:         %u\n", fs32_to_cpu(usb, usb->fs_bsize));
-       printk("  fsize:         %u\n", fs32_to_cpu(usb, usb->fs_fsize));
+       printk("  fs_size:   %llu\n",
+              (unsigned long long)fs64_to_cpu(sb, usb->fs_u11.fs_u2.fs_size));
+       printk("  fs_dsize:  %llu\n",
+              (unsigned long long)fs64_to_cpu(sb, usb->fs_u11.fs_u2.fs_dsize));
+       printk("  bsize:         %u\n", fs32_to_cpu(sb, usb->fs_bsize));
+       printk("  fsize:         %u\n", fs32_to_cpu(sb, usb->fs_fsize));
        printk("  fs_volname:  %s\n", usb->fs_u11.fs_u2.fs_volname);
        printk("  fs_fsmnt:  %s\n", usb->fs_u11.fs_u2.fs_fsmnt);
-       printk("  fs_sblockloc: %u\n",fs64_to_cpu(sb,
-                       usb->fs_u11.fs_u2.fs_sblockloc));
-       printk("  cs_ndir(No of dirs):  %u\n",fs64_to_cpu(sb,
-                       usb->fs_u11.fs_u2.fs_cstotal.cs_ndir));
-       printk("  cs_nbfree(No of free blocks):  %u\n",fs64_to_cpu(sb,
-                       usb->fs_u11.fs_u2.fs_cstotal.cs_nbfree));
+       printk("  fs_sblockloc: %llu\n",
+              (unsigned long long)fs64_to_cpu(sb,
+                                              usb->fs_u11.fs_u2.fs_sblockloc));
+       printk("  cs_ndir(No of dirs):  %llu\n",
+              (unsigned long long)fs64_to_cpu(sb,
+                                        usb->fs_u11.fs_u2.fs_cstotal.cs_ndir));
+       printk("  cs_nbfree(No of free blocks):  %llu\n",
+              (unsigned long long)fs64_to_cpu(sb,
+                                      usb->fs_u11.fs_u2.fs_cstotal.cs_nbfree));
        printk("\n");
 }
 
@@ -207,7 +201,7 @@ void ufs_print_cylinder_stuff(struct super_block *sb, struct ufs_cylinder_group
        printk("  nclusterblks  %u\n", fs32_to_cpu(sb, cg->cg_u.cg_44.cg_nclusterblks));
        printk("\n");
 }
-#endif /* UFS_SUPER_DEBUG_MORE */
+#endif /* CONFIG_UFS_DEBUG */
 
 static struct super_operations ufs_super_ops;
 
@@ -221,11 +215,11 @@ void ufs_error (struct super_block * sb, const char * function,
        va_list args;
 
        uspi = UFS_SB(sb)->s_uspi;
-       usb1 = ubh_get_usb_first(USPI_UBH);
+       usb1 = ubh_get_usb_first(uspi);
        
        if (!(sb->s_flags & MS_RDONLY)) {
                usb1->fs_clean = UFS_FSBAD;
-               ubh_mark_buffer_dirty(USPI_UBH);
+               ubh_mark_buffer_dirty(USPI_UBH(uspi));
                sb->s_dirt = 1;
                sb->s_flags |= MS_RDONLY;
        }
@@ -253,11 +247,11 @@ void ufs_panic (struct super_block * sb, const char * function,
        va_list args;
        
        uspi = UFS_SB(sb)->s_uspi;
-       usb1 = ubh_get_usb_first(USPI_UBH);
+       usb1 = ubh_get_usb_first(uspi);
        
        if (!(sb->s_flags & MS_RDONLY)) {
                usb1->fs_clean = UFS_FSBAD;
-               ubh_mark_buffer_dirty(USPI_UBH);
+               ubh_mark_buffer_dirty(USPI_UBH(uspi));
                sb->s_dirt = 1;
        }
        va_start (args, fmt);
@@ -309,7 +303,7 @@ static int ufs_parse_options (char * options, unsigned * mount_options)
 {
        char * p;
        
-       UFSD(("ENTER\n"))
+       UFSD("ENTER\n");
        
        if (!options)
                return 1;
@@ -388,7 +382,8 @@ static int ufs_parse_options (char * options, unsigned * mount_options)
 /*
  * Read on-disk structures associated with cylinder groups
  */
-static int ufs_read_cylinder_structures (struct super_block *sb) {
+static int ufs_read_cylinder_structures (struct super_block *sb)
+{
        struct ufs_sb_info * sbi = UFS_SB(sb);
        struct ufs_sb_private_info * uspi;
        struct ufs_super_block *usb;
@@ -397,7 +392,7 @@ static int ufs_read_cylinder_structures (struct super_block *sb) {
        unsigned size, blks, i;
        unsigned flags = 0;
        
-       UFSD(("ENTER\n"))
+       UFSD("ENTER\n");
        
        uspi = sbi->s_uspi;
 
@@ -415,26 +410,23 @@ static int ufs_read_cylinder_structures (struct super_block *sb) {
        base = space = kmalloc(size, GFP_KERNEL);
        if (!base)
                goto failed; 
+       sbi->s_csp = (struct ufs_csum *)space;
        for (i = 0; i < blks; i += uspi->s_fpb) {
                size = uspi->s_bsize;
                if (i + uspi->s_fpb > blks)
                        size = (blks - i) * uspi->s_fsize;
 
-               if ((flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2) {
+               if ((flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2) 
                        ubh = ubh_bread(sb,
                                fs64_to_cpu(sb, usb->fs_u11.fs_u2.fs_csaddr) + i, size);
-                       if (!ubh)
-                               goto failed;
-                       ubh_ubhcpymem (space, ubh, size);
-                       sbi->s_csp[ufs_fragstoblks(i)]=(struct ufs_csum *)space;
-               }
-               else {
+               else 
                        ubh = ubh_bread(sb, uspi->s_csaddr + i, size);
-                       if (!ubh)
-                               goto failed;
-                       ubh_ubhcpymem(space, ubh, size);
-                       sbi->s_csp[ufs_fragstoblks(i)]=(struct ufs_csum *)space;
-               }
+               
+               if (!ubh)
+                       goto failed;
+
+               ubh_ubhcpymem (space, ubh, size);
+
                space += size;
                ubh_brelse (ubh);
                ubh = NULL;
@@ -453,12 +445,12 @@ static int ufs_read_cylinder_structures (struct super_block *sb) {
                sbi->s_cgno[i] = UFS_CGNO_EMPTY;
        }
        for (i = 0; i < uspi->s_ncg; i++) {
-               UFSD(("read cg %u\n", i))
+               UFSD("read cg %u\n", i);
                if (!(sbi->s_ucg[i] = sb_bread(sb, ufs_cgcmin(i))))
                        goto failed;
                if (!ufs_cg_chkmagic (sb, (struct ufs_cylinder_group *) sbi->s_ucg[i]->b_data))
                        goto failed;
-#ifdef UFS_SUPER_DEBUG_MORE
+#ifdef CONFIG_UFS_DEBUG
                ufs_print_cylinder_stuff(sb, (struct ufs_cylinder_group *) sbi->s_ucg[i]->b_data);
 #endif
        }
@@ -468,7 +460,7 @@ static int ufs_read_cylinder_structures (struct super_block *sb) {
                sbi->s_cgno[i] = UFS_CGNO_EMPTY;
        }
        sbi->s_cg_loaded = 0;
-       UFSD(("EXIT\n"))
+       UFSD("EXIT\n");
        return 1;
 
 failed:
@@ -481,7 +473,7 @@ failed:
                for (i = 0; i < UFS_MAX_GROUP_LOADED; i++)
                        kfree (sbi->s_ucpi[i]);
        }
-       UFSD(("EXIT (FAILED)\n"))
+       UFSD("EXIT (FAILED)\n");
        return 0;
 }
 
@@ -489,20 +481,21 @@ failed:
  * Put on-disk structures associated with cylinder groups and 
  * write them back to disk
  */
-static void ufs_put_cylinder_structures (struct super_block *sb) {
+static void ufs_put_cylinder_structures (struct super_block *sb)
+{
        struct ufs_sb_info * sbi = UFS_SB(sb);
        struct ufs_sb_private_info * uspi;
        struct ufs_buffer_head * ubh;
        unsigned char * base, * space;
        unsigned blks, size, i;
        
-       UFSD(("ENTER\n"))
+       UFSD("ENTER\n");
        
        uspi = sbi->s_uspi;
 
        size = uspi->s_cssize;
        blks = (size + uspi->s_fsize - 1) >> uspi->s_fshift;
-       base = space = (char*) sbi->s_csp[0];
+       base = space = (char*) sbi->s_csp;
        for (i = 0; i < blks; i += uspi->s_fpb) {
                size = uspi->s_bsize;
                if (i + uspi->s_fpb > blks)
@@ -524,7 +517,7 @@ static void ufs_put_cylinder_structures (struct super_block *sb) {
                brelse (sbi->s_ucg[i]);
        kfree (sbi->s_ucg);
        kfree (base);
-       UFSD(("EXIT\n"))
+       UFSD("EXIT\n");
 }
 
 static int ufs_fill_super(struct super_block *sb, void *data, int silent)
@@ -539,12 +532,13 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
        struct inode *inode;
        unsigned block_size, super_block_size;
        unsigned flags;
+       unsigned super_block_offset;
 
        uspi = NULL;
        ubh = NULL;
        flags = 0;
        
-       UFSD(("ENTER\n"))
+       UFSD("ENTER\n");
                
        sbi = kmalloc(sizeof(struct ufs_sb_info), GFP_KERNEL);
        if (!sbi)
@@ -552,7 +546,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
        sb->s_fs_info = sbi;
        memset(sbi, 0, sizeof(struct ufs_sb_info));
 
-       UFSD(("flag %u\n", (int)(sb->s_flags & MS_RDONLY)))
+       UFSD("flag %u\n", (int)(sb->s_flags & MS_RDONLY));
        
 #ifndef CONFIG_UFS_FS_WRITE
        if (!(sb->s_flags & MS_RDONLY)) {
@@ -575,7 +569,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
                if (!silent)
                        printk("You didn't specify the type of your ufs filesystem\n\n"
                        "mount -t ufs -o ufstype="
-                       "sun|sunx86|44bsd|ufs2|5xbsd|old|hp|nextstep|netxstep-cd|openstep ...\n\n"
+                       "sun|sunx86|44bsd|ufs2|5xbsd|old|hp|nextstep|nextstep-cd|openstep ...\n\n"
                        ">>>WARNING<<< Wrong ufstype may corrupt your filesystem, "
                        "default is ufstype=old\n");
                ufs_set_opt (sbi->s_mount_opt, UFSTYPE_OLD);
@@ -586,13 +580,14 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
        if (!uspi)
                goto failed;
 
+       super_block_offset=UFS_SBLOCK;
+
        /* Keep 2Gig file limit. Some UFS variants need to override 
           this but as I don't know which I'll let those in the know loosen
           the rules */
-          
        switch (sbi->s_mount_opt & UFS_MOUNT_UFSTYPE) {
        case UFS_MOUNT_UFSTYPE_44BSD:
-               UFSD(("ufstype=44bsd\n"))
+               UFSD("ufstype=44bsd\n");
                uspi->s_fsize = block_size = 512;
                uspi->s_fmask = ~(512 - 1);
                uspi->s_fshift = 9;
@@ -601,7 +596,8 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
                flags |= UFS_DE_44BSD | UFS_UID_44BSD | UFS_ST_44BSD | UFS_CG_44BSD;
                break;
        case UFS_MOUNT_UFSTYPE_UFS2:
-               UFSD(("ufstype=ufs2\n"))
+               UFSD("ufstype=ufs2\n");
+               super_block_offset=SBLOCK_UFS2;
                uspi->s_fsize = block_size = 512;
                uspi->s_fmask = ~(512 - 1);
                uspi->s_fshift = 9;
@@ -615,7 +611,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
                break;
                
        case UFS_MOUNT_UFSTYPE_SUN:
-               UFSD(("ufstype=sun\n"))
+               UFSD("ufstype=sun\n");
                uspi->s_fsize = block_size = 1024;
                uspi->s_fmask = ~(1024 - 1);
                uspi->s_fshift = 10;
@@ -626,7 +622,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
                break;
 
        case UFS_MOUNT_UFSTYPE_SUNx86:
-               UFSD(("ufstype=sunx86\n"))
+               UFSD("ufstype=sunx86\n");
                uspi->s_fsize = block_size = 1024;
                uspi->s_fmask = ~(1024 - 1);
                uspi->s_fshift = 10;
@@ -637,7 +633,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
                break;
 
        case UFS_MOUNT_UFSTYPE_OLD:
-               UFSD(("ufstype=old\n"))
+               UFSD("ufstype=old\n");
                uspi->s_fsize = block_size = 1024;
                uspi->s_fmask = ~(1024 - 1);
                uspi->s_fshift = 10;
@@ -652,7 +648,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
                break;
        
        case UFS_MOUNT_UFSTYPE_NEXTSTEP:
-               UFSD(("ufstype=nextstep\n"))
+               UFSD("ufstype=nextstep\n");
                uspi->s_fsize = block_size = 1024;
                uspi->s_fmask = ~(1024 - 1);
                uspi->s_fshift = 10;
@@ -667,7 +663,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
                break;
        
        case UFS_MOUNT_UFSTYPE_NEXTSTEP_CD:
-               UFSD(("ufstype=nextstep-cd\n"))
+               UFSD("ufstype=nextstep-cd\n");
                uspi->s_fsize = block_size = 2048;
                uspi->s_fmask = ~(2048 - 1);
                uspi->s_fshift = 11;
@@ -682,7 +678,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
                break;
        
        case UFS_MOUNT_UFSTYPE_OPENSTEP:
-               UFSD(("ufstype=openstep\n"))
+               UFSD("ufstype=openstep\n");
                uspi->s_fsize = block_size = 1024;
                uspi->s_fmask = ~(1024 - 1);
                uspi->s_fshift = 10;
@@ -697,7 +693,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
                break;
        
        case UFS_MOUNT_UFSTYPE_HP:
-               UFSD(("ufstype=hp\n"))
+               UFSD("ufstype=hp\n");
                uspi->s_fsize = block_size = 1024;
                uspi->s_fmask = ~(1024 - 1);
                uspi->s_fshift = 10;
@@ -725,19 +721,16 @@ again:
        /*
         * read ufs super block from device
         */
-       if ( (flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2) {
-               ubh = ubh_bread_uspi(uspi, sb, uspi->s_sbbase + SBLOCK_UFS2/block_size, super_block_size);
-       }
-       else {
-               ubh = ubh_bread_uspi(uspi, sb, uspi->s_sbbase + UFS_SBLOCK/block_size, super_block_size);
-       }
+
+       ubh = ubh_bread_uspi(uspi, sb, uspi->s_sbbase + super_block_offset/block_size, super_block_size);
+       
        if (!ubh) 
             goto failed;
 
        
-       usb1 = ubh_get_usb_first(USPI_UBH);
-       usb2 = ubh_get_usb_second(USPI_UBH);
-       usb3 = ubh_get_usb_third(USPI_UBH);
+       usb1 = ubh_get_usb_first(uspi);
+       usb2 = ubh_get_usb_second(uspi);
+       usb3 = ubh_get_usb_third(uspi);
        usb  = (struct ufs_super_block *)
                ((struct ufs_buffer_head *)uspi)->bh[0]->b_data ;
 
@@ -821,11 +814,11 @@ magic_found:
                ubh = NULL;
                block_size = uspi->s_fsize;
                super_block_size = uspi->s_sbsize;
-               UFSD(("another value of block_size or super_block_size %u, %u\n", block_size, super_block_size))
+               UFSD("another value of block_size or super_block_size %u, %u\n", block_size, super_block_size);
                goto again;
        }
 
-#ifdef UFS_SUPER_DEBUG_MORE
+#ifdef CONFIG_UFS_DEBUG
         if ((flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2)
                ufs2_print_super_stuff(sb,usb);
         else
@@ -843,13 +836,13 @@ magic_found:
          (ufs_get_fs_state(sb, usb1, usb3) == (UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time))))) {
                switch(usb1->fs_clean) {
                case UFS_FSCLEAN:
-                       UFSD(("fs is clean\n"))
+                       UFSD("fs is clean\n");
                        break;
                case UFS_FSSTABLE:
-                       UFSD(("fs is stable\n"))
+                       UFSD("fs is stable\n");
                        break;
                case UFS_FSOSF1:
-                       UFSD(("fs is DEC OSF/1\n"))
+                       UFSD("fs is DEC OSF/1\n");
                        break;
                case UFS_FSACTIVE:
                        printk("ufs_read_super: fs is active\n");
@@ -902,8 +895,8 @@ magic_found:
        uspi->s_fmask = fs32_to_cpu(sb, usb1->fs_fmask);
        uspi->s_bshift = fs32_to_cpu(sb, usb1->fs_bshift);
        uspi->s_fshift = fs32_to_cpu(sb, usb1->fs_fshift);
-       UFSD(("uspi->s_bshift = %d,uspi->s_fshift = %d", uspi->s_bshift,
-               uspi->s_fshift));
+       UFSD("uspi->s_bshift = %d,uspi->s_fshift = %d", uspi->s_bshift,
+               uspi->s_fshift);
        uspi->s_fpbshift = fs32_to_cpu(sb, usb1->fs_fragshift);
        uspi->s_fsbtodb = fs32_to_cpu(sb, usb1->fs_fsbtodb);
        /* s_sbsize already set */
@@ -936,12 +929,11 @@ magic_found:
         * Compute another frequently used values
         */
        uspi->s_fpbmask = uspi->s_fpb - 1;
-       if ((flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2) {
+       if ((flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2)
                uspi->s_apbshift = uspi->s_bshift - 3;
-       }
-       else {
+       else
                uspi->s_apbshift = uspi->s_bshift - 2;
-       }
+
        uspi->s_2apbshift = uspi->s_apbshift * 2;
        uspi->s_3apbshift = uspi->s_apbshift * 3;
        uspi->s_apb = 1 << uspi->s_apbshift;
@@ -976,7 +968,7 @@ magic_found:
                if (!ufs_read_cylinder_structures(sb))
                        goto failed;
 
-       UFSD(("EXIT\n"))
+       UFSD("EXIT\n");
        return 0;
 
 dalloc_failed:
@@ -987,11 +979,11 @@ failed:
        kfree (uspi);
        kfree(sbi);
        sb->s_fs_info = NULL;
-       UFSD(("EXIT (FAILED)\n"))
+       UFSD("EXIT (FAILED)\n");
        return -EINVAL;
 
 failed_nomem:
-       UFSD(("EXIT (NOMEM)\n"))
+       UFSD("EXIT (NOMEM)\n");
        return -ENOMEM;
 }
 
@@ -1003,11 +995,11 @@ static void ufs_write_super (struct super_block *sb) {
 
        lock_kernel();
 
-       UFSD(("ENTER\n"))
+       UFSD("ENTER\n");
        flags = UFS_SB(sb)->s_flags;
        uspi = UFS_SB(sb)->s_uspi;
-       usb1 = ubh_get_usb_first(USPI_UBH);
-       usb3 = ubh_get_usb_third(USPI_UBH);
+       usb1 = ubh_get_usb_first(uspi);
+       usb3 = ubh_get_usb_third(uspi);
 
        if (!(sb->s_flags & MS_RDONLY)) {
                usb1->fs_time = cpu_to_fs32(sb, get_seconds());
@@ -1015,18 +1007,18 @@ static void ufs_write_super (struct super_block *sb) {
                  || (flags & UFS_ST_MASK) == UFS_ST_SUNx86)
                        ufs_set_fs_state(sb, usb1, usb3,
                                        UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time));
-               ubh_mark_buffer_dirty (USPI_UBH);
+               ubh_mark_buffer_dirty (USPI_UBH(uspi));
        }
        sb->s_dirt = 0;
-       UFSD(("EXIT\n"))
+       UFSD("EXIT\n");
        unlock_kernel();
 }
 
-static void ufs_put_super (struct super_block *sb)
+static void ufs_put_super(struct super_block *sb)
 {
        struct ufs_sb_info * sbi = UFS_SB(sb);
                
-       UFSD(("ENTER\n"))
+       UFSD("ENTER\n");
 
        if (!(sb->s_flags & MS_RDONLY))
                ufs_put_cylinder_structures (sb);
@@ -1035,6 +1027,7 @@ static void ufs_put_super (struct super_block *sb)
        kfree (sbi->s_uspi);
        kfree (sbi);
        sb->s_fs_info = NULL;
+UFSD("EXIT\n");
        return;
 }
 
@@ -1049,8 +1042,8 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
        
        uspi = UFS_SB(sb)->s_uspi;
        flags = UFS_SB(sb)->s_flags;
-       usb1 = ubh_get_usb_first(USPI_UBH);
-       usb3 = ubh_get_usb_third(USPI_UBH);
+       usb1 = ubh_get_usb_first(uspi);
+       usb3 = ubh_get_usb_third(uspi);
        
        /*
         * Allow the "check" option to be passed as a remount option.
@@ -1084,7 +1077,7 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
                  || (flags & UFS_ST_MASK) == UFS_ST_SUNx86) 
                        ufs_set_fs_state(sb, usb1, usb3,
                                UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time));
-               ubh_mark_buffer_dirty (USPI_UBH);
+               ubh_mark_buffer_dirty (USPI_UBH(uspi));
                sb->s_dirt = 0;
                sb->s_flags |= MS_RDONLY;
        }
@@ -1114,8 +1107,9 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
        return 0;
 }
 
-static int ufs_statfs (struct super_block *sb, struct kstatfs *buf)
+static int ufs_statfs (struct dentry *dentry, struct kstatfs *buf)
 {
+       struct super_block *sb = dentry->d_sb;
        struct ufs_sb_private_info * uspi;
        struct ufs_super_block_first * usb1;
        struct ufs_super_block * usb;
@@ -1124,7 +1118,7 @@ static int ufs_statfs (struct super_block *sb, struct kstatfs *buf)
        lock_kernel();
 
        uspi = UFS_SB(sb)->s_uspi;
-       usb1 = ubh_get_usb_first (USPI_UBH);
+       usb1 = ubh_get_usb_first (uspi);
        usb  = (struct ufs_super_block *)
                ((struct ufs_buffer_head *)uspi)->bh[0]->b_data ;
        
@@ -1185,7 +1179,8 @@ static int init_inodecache(void)
 {
        ufs_inode_cachep = kmem_cache_create("ufs_inode_cache",
                                             sizeof(struct ufs_inode_info),
-                                            0, SLAB_RECLAIM_ACCOUNT,
+                                            0, (SLAB_RECLAIM_ACCOUNT|
+                                               SLAB_MEM_SPREAD),
                                             init_once, NULL);
        if (ufs_inode_cachep == NULL)
                return -ENOMEM;
@@ -1311,10 +1306,10 @@ out:
 
 #endif
 
-static struct super_block *ufs_get_sb(struct file_system_type *fs_type,
-       int flags, const char *dev_name, void *data)
+static int ufs_get_sb(struct file_system_type *fs_type,
+       int flags, const char *dev_name, void *data, struct vfsmount *mnt)
 {
-       return get_sb_bdev(fs_type, flags, dev_name, data, ufs_fill_super);
+       return get_sb_bdev(fs_type, flags, dev_name, data, ufs_fill_super, mnt);
 }
 
 static struct file_system_type ufs_fs_type = {