]> err.no Git - linux-2.6/blobdiff - fs/ext2/super.c
[PATCH] nfsd4: recovery lookup dir check
[linux-2.6] / fs / ext2 / super.c
index dcfe331dc4c4816d8a208ecccf625439c94cc8cc..8d6819846fc97241375542c7316d2d9cd6a0b26e 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/config.h>
 #include <linux/module.h>
 #include <linux/string.h>
+#include <linux/fs.h>
 #include <linux/slab.h>
 #include <linux/init.h>
 #include <linux/blkdev.h>
@@ -27,6 +28,8 @@
 #include <linux/buffer_head.h>
 #include <linux/smp_lock.h>
 #include <linux/vfs.h>
+#include <linux/seq_file.h>
+#include <linux/mount.h>
 #include <asm/uaccess.h>
 #include "ext2.h"
 #include "xattr.h"
@@ -201,6 +204,26 @@ static void ext2_clear_inode(struct inode *inode)
 #endif
 }
 
+static int ext2_show_options(struct seq_file *seq, struct vfsmount *vfs)
+{
+       struct ext2_sb_info *sbi = EXT2_SB(vfs->mnt_sb);
+
+       if (sbi->s_mount_opt & EXT2_MOUNT_GRPID)
+               seq_puts(seq, ",grpid");
+       else
+               seq_puts(seq, ",nogrpid");
+
+#if defined(CONFIG_QUOTA)
+       if (sbi->s_mount_opt & EXT2_MOUNT_USRQUOTA)
+               seq_puts(seq, ",usrquota");
+
+       if (sbi->s_mount_opt & EXT2_MOUNT_GRPQUOTA)
+               seq_puts(seq, ",grpquota");
+#endif
+
+       return 0;
+}
+
 #ifdef CONFIG_QUOTA
 static ssize_t ext2_quota_read(struct super_block *sb, int type, char *data, size_t len, loff_t off);
 static ssize_t ext2_quota_write(struct super_block *sb, int type, const char *data, size_t len, loff_t off);
@@ -218,6 +241,7 @@ static struct super_operations ext2_sops = {
        .statfs         = ext2_statfs,
        .remount_fs     = ext2_remount,
        .clear_inode    = ext2_clear_inode,
+       .show_options   = ext2_show_options,
 #ifdef CONFIG_QUOTA
        .quota_read     = ext2_quota_read,
        .quota_write    = ext2_quota_write,
@@ -256,10 +280,11 @@ static unsigned long get_sb_block(void **data)
 
 enum {
        Opt_bsd_df, Opt_minix_df, Opt_grpid, Opt_nogrpid,
-       Opt_resgid, Opt_resuid, Opt_sb, Opt_err_cont, Opt_err_panic, Opt_err_ro,
-       Opt_nouid32, Opt_check, Opt_nocheck, Opt_debug, Opt_oldalloc, Opt_orlov, Opt_nobh,
-       Opt_user_xattr, Opt_nouser_xattr, Opt_acl, Opt_noacl, Opt_xip,
-       Opt_ignore, Opt_err,
+       Opt_resgid, Opt_resuid, Opt_sb, Opt_err_cont, Opt_err_panic,
+       Opt_err_ro, Opt_nouid32, Opt_nocheck, Opt_debug,
+       Opt_oldalloc, Opt_orlov, Opt_nobh, Opt_user_xattr, Opt_nouser_xattr,
+       Opt_acl, Opt_noacl, Opt_xip, Opt_ignore, Opt_err, Opt_quota,
+       Opt_usrquota, Opt_grpquota
 };
 
 static match_table_t tokens = {
@@ -278,7 +303,6 @@ static match_table_t tokens = {
        {Opt_nouid32, "nouid32"},
        {Opt_nocheck, "check=none"},
        {Opt_nocheck, "nocheck"},
-       {Opt_check, "check"},
        {Opt_debug, "debug"},
        {Opt_oldalloc, "oldalloc"},
        {Opt_orlov, "orlov"},
@@ -288,10 +312,10 @@ static match_table_t tokens = {
        {Opt_acl, "acl"},
        {Opt_noacl, "noacl"},
        {Opt_xip, "xip"},
-       {Opt_ignore, "grpquota"},
+       {Opt_grpquota, "grpquota"},
        {Opt_ignore, "noquota"},
-       {Opt_ignore, "quota"},
-       {Opt_ignore, "usrquota"},
+       {Opt_quota, "quota"},
+       {Opt_usrquota, "usrquota"},
        {Opt_err, NULL}
 };
 
@@ -351,13 +375,6 @@ static int parse_options (char * options,
                case Opt_nouid32:
                        set_opt (sbi->s_mount_opt, NO_UID32);
                        break;
-               case Opt_check:
-#ifdef CONFIG_EXT2_CHECK
-                       set_opt (sbi->s_mount_opt, CHECK);
-#else
-                       printk("EXT2 Check option not supported\n");
-#endif
-                       break;
                case Opt_nocheck:
                        clear_opt (sbi->s_mount_opt, CHECK);
                        break;
@@ -406,6 +423,26 @@ static int parse_options (char * options,
                        printk("EXT2 xip option not supported\n");
 #endif
                        break;
+
+#if defined(CONFIG_QUOTA)
+               case Opt_quota:
+               case Opt_usrquota:
+                       set_opt(sbi->s_mount_opt, USRQUOTA);
+                       break;
+
+               case Opt_grpquota:
+                       set_opt(sbi->s_mount_opt, GRPQUOTA);
+                       break;
+#else
+               case Opt_quota:
+               case Opt_usrquota:
+               case Opt_grpquota:
+                       printk(KERN_ERR
+                               "EXT2-fs: quota operations not supported.\n");
+
+                       break;
+#endif
+
                case Opt_ignore:
                        break;
                default:
@@ -458,12 +495,6 @@ static int ext2_setup_super (struct super_block * sb,
                        EXT2_BLOCKS_PER_GROUP(sb),
                        EXT2_INODES_PER_GROUP(sb),
                        sbi->s_mount_opt);
-#ifdef CONFIG_EXT2_CHECK
-       if (test_opt (sb, CHECK)) {
-               ext2_check_blocks_bitmap (sb);
-               ext2_check_inodes_bitmap (sb);
-       }
-#endif
        return res;
 }
 
@@ -850,7 +881,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
        }
        if (EXT2_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL))
                ext2_warning(sb, __FUNCTION__,
-                       "mounting ext3 filesystem as ext2\n");
+                       "mounting ext3 filesystem as ext2");
        ext2_setup_super (sb, es, sb->s_flags & MS_RDONLY);
        percpu_counter_mod(&sbi->s_freeblocks_counter,
                                ext2_count_free_blocks(sb));
@@ -1121,7 +1152,7 @@ static ssize_t ext2_quota_write(struct super_block *sb, int type,
        struct buffer_head tmp_bh;
        struct buffer_head *bh;
 
-       down(&inode->i_sem);
+       mutex_lock(&inode->i_mutex);
        while (towrite > 0) {
                tocopy = sb->s_blocksize - offset < towrite ?
                                sb->s_blocksize - offset : towrite;
@@ -1158,7 +1189,7 @@ out:
        inode->i_version++;
        inode->i_mtime = inode->i_ctime = CURRENT_TIME;
        mark_inode_dirty(inode);
-       up(&inode->i_sem);
+       mutex_unlock(&inode->i_mutex);
        return len - towrite;
 }