ALSA: usb-audio: add support for Akai MPD16
[safe/jmp/linux-2.6] / fs / hpfs / super.c
index c40f6e2..aa53842 100644 (file)
@@ -13,6 +13,9 @@
 #include <linux/statfs.h>
 #include <linux/magic.h>
 #include <linux/sched.h>
+#include <linux/smp_lock.h>
+#include <linux/bitmap.h>
+#include <linux/slab.h>
 
 /* Mark the filesystem dirty, so that chkdsk checks it when os/2 booted */
 
@@ -99,25 +102,28 @@ int hpfs_stop_cycles(struct super_block *s, int key, int *c1, int *c2,
 static void hpfs_put_super(struct super_block *s)
 {
        struct hpfs_sb_info *sbi = hpfs_sb(s);
+
+       lock_kernel();
+
        kfree(sbi->sb_cp_table);
        kfree(sbi->sb_bmp_dir);
        unmark_dirty(s);
        s->s_fs_info = NULL;
        kfree(sbi);
+
+       unlock_kernel();
 }
 
 unsigned hpfs_count_one_bitmap(struct super_block *s, secno secno)
 {
        struct quad_buffer_head qbh;
-       unsigned *bits;
-       unsigned i, count;
-       if (!(bits = hpfs_map_4sectors(s, secno, &qbh, 4))) return 0;
-       count = 0;
-       for (i = 0; i < 2048 / sizeof(unsigned); i++) {
-               unsigned b; 
-               if (!bits[i]) continue;
-               for (b = bits[i]; b; b>>=1) count += b & 1;
-       }
+       unsigned long *bits;
+       unsigned count;
+
+       bits = hpfs_map_4sectors(s, secno, &qbh, 4);
+       if (!bits)
+               return 0;
+       count = bitmap_weight(bits, 2048 * BITS_PER_BYTE);
        hpfs_brelse4(&qbh);
        return count;
 }
@@ -393,6 +399,8 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data)
        
        *flags |= MS_NOATIME;
        
+       lock_kernel();
+       lock_super(s);
        uid = sbi->sb_uid; gid = sbi->sb_gid;
        umask = 0777 & ~sbi->sb_mode;
        lowercase = sbi->sb_lowercase; conv = sbi->sb_conv;
@@ -423,12 +431,15 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data)
 
        if (!(*flags & MS_RDONLY)) mark_dirty(s);
 
-       kfree(s->s_options);
-       s->s_options = new_opts;
+       replace_mount_options(s, new_opts);
 
+       unlock_super(s);
+       unlock_kernel();
        return 0;
 
 out_err:
+       unlock_super(s);
+       unlock_kernel();
        kfree(new_opts);
        return -EINVAL;
 }
@@ -480,7 +491,7 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
 
        uid = current_uid();
        gid = current_gid();
-       umask = current->fs->umask;
+       umask = current_umask();
        lowercase = 0;
        conv = CONV_BINARY;
        eas = 2;