Merge to Fedora kernel-2.6.18-1.2224_FC5 patched with stable patch-2.6.18.1-vs2.0...
[linux-2.6.git] / fs / reiserfs / super.c
index bb275eb..c586898 100644 (file)
@@ -11,7 +11,6 @@
  * NO WARRANTY
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/vmalloc.h>
 #include <linux/time.h>
@@ -60,7 +59,7 @@ static int is_any_reiserfs_magic_string(struct reiserfs_super_block *rs)
 }
 
 static int reiserfs_remount(struct super_block *s, int *flags, char *data);
-static int reiserfs_statfs(struct super_block *s, struct kstatfs *buf);
+static int reiserfs_statfs(struct dentry *dentry, struct kstatfs *buf);
 
 static int reiserfs_sync_fs(struct super_block *s, int wait)
 {
@@ -431,22 +430,29 @@ int remove_save_link(struct inode *inode, int truncate)
        return journal_end(&th, inode->i_sb, JOURNAL_PER_BALANCE_CNT);
 }
 
+static void reiserfs_kill_sb(struct super_block *s)
+{
+       if (REISERFS_SB(s)) {
+               if (REISERFS_SB(s)->xattr_root) {
+                       d_invalidate(REISERFS_SB(s)->xattr_root);
+                       dput(REISERFS_SB(s)->xattr_root);
+                       REISERFS_SB(s)->xattr_root = NULL;
+               }
+               if (REISERFS_SB(s)->priv_root) {
+                       d_invalidate(REISERFS_SB(s)->priv_root);
+                       dput(REISERFS_SB(s)->priv_root);
+                       REISERFS_SB(s)->priv_root = NULL;
+               }
+               kill_block_super(s);
+       }
+}
+
 static void reiserfs_put_super(struct super_block *s)
 {
        int i;
        struct reiserfs_transaction_handle th;
        th.t_trans_id = 0;
 
-       if (REISERFS_SB(s)->xattr_root) {
-               d_invalidate(REISERFS_SB(s)->xattr_root);
-               dput(REISERFS_SB(s)->xattr_root);
-       }
-
-       if (REISERFS_SB(s)->priv_root) {
-               d_invalidate(REISERFS_SB(s)->priv_root);
-               dput(REISERFS_SB(s)->priv_root);
-       }
-
        /* change file system state to current state if it was mounted with read-write permissions */
        if (!(s->s_flags & MS_RDONLY)) {
                if (!journal_begin(&th, s, 10)) {
@@ -1951,15 +1957,15 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
        return errval;
 }
 
-static int reiserfs_statfs(struct super_block *s, struct kstatfs *buf)
+static int reiserfs_statfs(struct dentry *dentry, struct kstatfs *buf)
 {
-       struct reiserfs_super_block *rs = SB_DISK_SUPER_BLOCK(s);
+       struct reiserfs_super_block *rs = SB_DISK_SUPER_BLOCK(dentry->d_sb);
 
        buf->f_namelen = (REISERFS_MAX_NAME(s->s_blocksize));
        buf->f_bfree = sb_free_blocks(rs);
        buf->f_bavail = buf->f_bfree;
        buf->f_blocks = sb_block_count(rs) - sb_bmap_nr(rs) - 1;
-       buf->f_bsize = s->s_blocksize;
+       buf->f_bsize = dentry->d_sb->s_blocksize;
        /* changed to accommodate gcc folks. */
        buf->f_type = REISERFS_SUPER_MAGIC;
        return 0;
@@ -2217,7 +2223,7 @@ static ssize_t reiserfs_quota_write(struct super_block *sb, int type,
        size_t towrite = len;
        struct buffer_head tmp_bh, *bh;
 
-       mutex_lock(&inode->i_mutex);
+       mutex_lock_nested(&inode->i_mutex, I_MUTEX_QUOTA);
        while (towrite > 0) {
                tocopy = sb->s_blocksize - offset < towrite ?
                    sb->s_blocksize - offset : towrite;
@@ -2262,11 +2268,12 @@ static ssize_t reiserfs_quota_write(struct super_block *sb, int type,
 
 #endif
 
-static struct super_block *get_super_block(struct file_system_type *fs_type,
-                                          int flags, const char *dev_name,
-                                          void *data)
+static int get_super_block(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, reiserfs_fill_super);
+       return get_sb_bdev(fs_type, flags, dev_name, data, reiserfs_fill_super,
+                          mnt);
 }
 
 static int __init init_reiserfs_fs(void)
@@ -2313,7 +2320,7 @@ struct file_system_type reiserfs_fs_type = {
        .owner = THIS_MODULE,
        .name = "reiserfs",
        .get_sb = get_super_block,
-       .kill_sb = kill_block_super,
+       .kill_sb = reiserfs_kill_sb,
        .fs_flags = FS_REQUIRES_DEV,
 };