Saner locking around deactivate_super()
[safe/jmp/linux-2.6] / fs / omfs / inode.c
index 633e9dc..b44bb83 100644 (file)
@@ -3,14 +3,15 @@
  * Copyright (C) 2006 Bob Copeland <me@bobcopeland.com>
  * Released under GPL v2.
  */
-#include <linux/version.h>
 #include <linux/module.h>
 #include <linux/sched.h>
+#include <linux/slab.h>
 #include <linux/fs.h>
 #include <linux/vfs.h>
 #include <linux/parser.h>
 #include <linux/buffer_head.h>
 #include <linux/vmalloc.h>
+#include <linux/writeback.h>
 #include <linux/crc-itu-t.h>
 #include "omfs.h"
 
@@ -89,7 +90,7 @@ static void omfs_update_checksums(struct omfs_inode *oi)
        oi->i_head.h_check_xor = xor;
 }
 
-static int omfs_write_inode(struct inode *inode, int wait)
+static int __omfs_write_inode(struct inode *inode, int wait)
 {
        struct omfs_inode *oi;
        struct omfs_sb_info *sbi = OMFS_SB(inode->i_sb);
@@ -162,9 +163,14 @@ out:
        return ret;
 }
 
+static int omfs_write_inode(struct inode *inode, struct writeback_control *wbc)
+{
+       return __omfs_write_inode(inode, wbc->sync_mode == WB_SYNC_ALL);
+}
+
 int omfs_sync_inode(struct inode *inode)
 {
-       return omfs_write_inode(inode, 1);
+       return __omfs_write_inode(inode, 1);
 }
 
 /*
@@ -262,18 +268,23 @@ static int omfs_statfs(struct dentry *dentry, struct kstatfs *buf)
 {
        struct super_block *s = dentry->d_sb;
        struct omfs_sb_info *sbi = OMFS_SB(s);
+       u64 id = huge_encode_dev(s->s_bdev->bd_dev);
+
        buf->f_type = OMFS_MAGIC;
        buf->f_bsize = sbi->s_blocksize;
        buf->f_blocks = sbi->s_num_blocks;
        buf->f_files = sbi->s_num_blocks;
        buf->f_namelen = OMFS_NAMELEN;
+       buf->f_fsid.val[0] = (u32)id;
+       buf->f_fsid.val[1] = (u32)(id >> 32);
 
        buf->f_bfree = buf->f_bavail = buf->f_ffree =
                omfs_count_free(s);
+
        return 0;
 }
 
-static struct super_operations omfs_sops = {
+static const struct super_operations omfs_sops = {
        .write_inode    = omfs_write_inode,
        .delete_inode   = omfs_delete_inode,
        .put_super      = omfs_put_super,
@@ -421,7 +432,7 @@ static int omfs_fill_super(struct super_block *sb, void *data, int silent)
 
        sbi->s_uid = current_uid();
        sbi->s_gid = current_gid();
-       sbi->s_dmask = sbi->s_fmask = current->fs->umask;
+       sbi->s_dmask = sbi->s_fmask = current_umask();
 
        if (!parse_options((char *) data, sbi))
                goto end;