]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sun, 30 May 2010 16:11:11 +0000 (09:11 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 30 May 2010 16:11:11 +0000 (09:11 -0700)
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6:
  quota: Convert quota statistics to generic percpu_counter
  ext3 uses rb_node = NULL; to zero rb_root.
  quota: Fixup dquot_transfer
  reiserfs: Fix resuming of quotas on remount read-write
  pohmelfs: Remove dead quota code
  ufs: Remove dead quota code
  udf: Remove dead quota code
  quota: rename default quotactl methods to dquot_
  quota: explicitly set ->dq_op and ->s_qcop
  quota: drop remount argument to ->quota_on and ->quota_off
  quota: move unmount handling into the filesystem
  quota: kill the vfs_dq_off and vfs_dq_quota_on_remount wrappers
  quota: move remount handling into the filesystem
  ocfs2: Fix use after free on remount read-only

Fix up conflicts in fs/ext4/super.c and fs/ufs/file.c

1  2 
drivers/staging/pohmelfs/inode.c
fs/ext4/super.c
fs/quota/dquot.c
fs/super.c
fs/udf/file.c
fs/ufs/file.c
fs/ufs/super.c
fs/ufs/truncate.c
include/linux/quotaops.h

index e92595eff1b81fc71e33fc7cee4516d715de58a2,e1ccb49c75ecd3c89c75b4154ca3f7a7eacfcf99..643b413d9f0f395fca978a56641cbe582beee773
@@@ -29,7 -29,6 +29,6 @@@
  #include <linux/slab.h>
  #include <linux/statfs.h>
  #include <linux/writeback.h>
- #include <linux/quotaops.h>
  
  #include "netfs.h"
  
@@@ -880,7 -879,7 +879,7 @@@ static struct inode *pohmelfs_alloc_ino
  /*
   * We want fsync() to work on POHMELFS.
   */
 -static int pohmelfs_fsync(struct file *file, struct dentry *dentry, int datasync)
 +static int pohmelfs_fsync(struct file *file, int datasync)
  {
        struct inode *inode = file->f_mapping->host;
        struct writeback_control wbc = {
@@@ -969,13 -968,6 +968,6 @@@ int pohmelfs_setattr_raw(struct inode *
                goto err_out_exit;
        }
  
-       if ((attr->ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
-           (attr->ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) {
-               err = dquot_transfer(inode, attr);
-               if (err)
-                       goto err_out_exit;
-       }
        err = inode_setattr(inode, attr);
        if (err) {
                dprintk("%s: ino: %llu, failed to set the attributes.\n", __func__, POHMELFS_I(inode)->ino);
diff --combined fs/ext4/super.c
index 49d88c0597c4df9dec2a539872f1e1b88af11278,381e5a931265f84ffb7dc7e3c545231e0d14d587..4e8983a9811b2205773809fad4306f4a79eef8c5
@@@ -241,7 -241,6 +241,7 @@@ handle_t *ext4_journal_start_sb(struct 
        if (sb->s_flags & MS_RDONLY)
                return ERR_PTR(-EROFS);
  
 +      vfs_check_frozen(sb, SB_FREEZE_WRITE);
        /* Special case here: if the journal has aborted behind our
         * backs (eg. EIO in the commit thread), then we still need to
         * take the FS itself readonly cleanly. */
@@@ -646,6 -645,8 +646,8 @@@ static void ext4_put_super(struct super
        struct ext4_super_block *es = sbi->s_es;
        int i, err;
  
+       dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
        flush_workqueue(sbi->dio_unwritten_wq);
        destroy_workqueue(sbi->dio_unwritten_wq);
  
@@@ -942,8 -943,6 +944,8 @@@ static int ext4_show_options(struct seq
        seq_puts(seq, test_opt(sb, BARRIER) ? "1" : "0");
        if (test_opt(sb, JOURNAL_ASYNC_COMMIT))
                seq_puts(seq, ",journal_async_commit");
 +      else if (test_opt(sb, JOURNAL_CHECKSUM))
 +              seq_puts(seq, ",journal_checksum");
        if (test_opt(sb, NOBH))
                seq_puts(seq, ",nobh");
        if (test_opt(sb, I_VERSION))
@@@ -1062,7 -1061,7 +1064,7 @@@ static int ext4_release_dquot(struct dq
  static int ext4_mark_dquot_dirty(struct dquot *dquot);
  static int ext4_write_info(struct super_block *sb, int type);
  static int ext4_quota_on(struct super_block *sb, int type, int format_id,
-                               char *path, int remount);
+                               char *path);
  static int ext4_quota_on_mount(struct super_block *sb, int type);
  static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data,
                               size_t len, loff_t off);
@@@ -1084,12 -1083,12 +1086,12 @@@ static const struct dquot_operations ex
  
  static const struct quotactl_ops ext4_qctl_operations = {
        .quota_on       = ext4_quota_on,
-       .quota_off      = vfs_quota_off,
-       .quota_sync     = vfs_quota_sync,
-       .get_info       = vfs_get_dqinfo,
-       .set_info       = vfs_set_dqinfo,
-       .get_dqblk      = vfs_get_dqblk,
-       .set_dqblk      = vfs_set_dqblk
+       .quota_off      = dquot_quota_off,
+       .quota_sync     = dquot_quota_sync,
+       .get_info       = dquot_get_dqinfo,
+       .set_info       = dquot_set_dqinfo,
+       .get_dqblk      = dquot_get_dqblk,
+       .set_dqblk      = dquot_set_dqblk
  };
  #endif
  
@@@ -2054,7 -2053,7 +2056,7 @@@ static void ext4_orphan_cleanup(struct 
        /* Turn quotas off */
        for (i = 0; i < MAXQUOTAS; i++) {
                if (sb_dqopt(sb)->files[i])
-                       vfs_quota_off(sb, i, 0);
+                       dquot_quota_off(sb, i);
        }
  #endif
        sb->s_flags = s_flags; /* Restore MS_RDONLY status */
@@@ -2216,7 -2215,7 +2218,7 @@@ static unsigned long ext4_get_stripe_si
  struct ext4_attr {
        struct attribute attr;
        ssize_t (*show)(struct ext4_attr *, struct ext4_sb_info *, char *);
 -      ssize_t (*store)(struct ext4_attr *, struct ext4_sb_info *, 
 +      ssize_t (*store)(struct ext4_attr *, struct ext4_sb_info *,
                         const char *, size_t);
        int offset;
  };
@@@ -2433,7 -2432,6 +2435,7 @@@ static int ext4_fill_super(struct super
                                __releases(kernel_lock)
                                __acquires(kernel_lock)
  {
 +      char *orig_data = kstrdup(data, GFP_KERNEL);
        struct buffer_head *bh;
        struct ext4_super_block *es = NULL;
        struct ext4_sb_info *sbi;
        get_random_bytes(&sbi->s_next_generation, sizeof(u32));
        spin_lock_init(&sbi->s_next_gen_lock);
  
 -      err = percpu_counter_init(&sbi->s_freeblocks_counter,
 -                      ext4_count_free_blocks(sb));
 -      if (!err) {
 -              err = percpu_counter_init(&sbi->s_freeinodes_counter,
 -                              ext4_count_free_inodes(sb));
 -      }
 -      if (!err) {
 -              err = percpu_counter_init(&sbi->s_dirs_counter,
 -                              ext4_count_dirs(sb));
 -      }
 -      if (!err) {
 -              err = percpu_counter_init(&sbi->s_dirtyblocks_counter, 0);
 -      }
 -      if (err) {
 -              ext4_msg(sb, KERN_ERR, "insufficient memory");
 -              goto failed_mount3;
 -      }
 -
        sbi->s_stripe = ext4_get_stripe_size(sbi);
        sbi->s_max_writeback_mb_bump = 128;
  
        set_task_ioprio(sbi->s_journal->j_task, journal_ioprio);
  
  no_journal:
 +      err = percpu_counter_init(&sbi->s_freeblocks_counter,
 +                                ext4_count_free_blocks(sb));
 +      if (!err)
 +              err = percpu_counter_init(&sbi->s_freeinodes_counter,
 +                                        ext4_count_free_inodes(sb));
 +      if (!err)
 +              err = percpu_counter_init(&sbi->s_dirs_counter,
 +                                        ext4_count_dirs(sb));
 +      if (!err)
 +              err = percpu_counter_init(&sbi->s_dirtyblocks_counter, 0);
 +      if (err) {
 +              ext4_msg(sb, KERN_ERR, "insufficient memory");
 +              goto failed_mount_wq;
 +      }
        if (test_opt(sb, NOBH)) {
                if (!(test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA)) {
                        ext4_msg(sb, KERN_WARNING, "Ignoring nobh option - "
        err = ext4_setup_system_zone(sb);
        if (err) {
                ext4_msg(sb, KERN_ERR, "failed to initialize system "
 -                       "zone (%d)\n", err);
 +                       "zone (%d)", err);
                goto failed_mount4;
        }
  
        } else
                descr = "out journal";
  
 -      ext4_msg(sb, KERN_INFO, "mounted filesystem with%s", descr);
 +      ext4_msg(sb, KERN_INFO, "mounted filesystem with%s. "
 +              "Opts: %s", descr, orig_data);
  
        lock_kernel();
 +      kfree(orig_data);
        return 0;
  
  cantfind_ext4:
@@@ -3061,10 -3061,6 +3063,10 @@@ failed_mount_wq
                jbd2_journal_destroy(sbi->s_journal);
                sbi->s_journal = NULL;
        }
 +      percpu_counter_destroy(&sbi->s_freeblocks_counter);
 +      percpu_counter_destroy(&sbi->s_freeinodes_counter);
 +      percpu_counter_destroy(&sbi->s_dirs_counter);
 +      percpu_counter_destroy(&sbi->s_dirtyblocks_counter);
  failed_mount3:
        if (sbi->s_flex_groups) {
                if (is_vmalloc_addr(sbi->s_flex_groups))
                else
                        kfree(sbi->s_flex_groups);
        }
 -      percpu_counter_destroy(&sbi->s_freeblocks_counter);
 -      percpu_counter_destroy(&sbi->s_freeinodes_counter);
 -      percpu_counter_destroy(&sbi->s_dirs_counter);
 -      percpu_counter_destroy(&sbi->s_dirtyblocks_counter);
  failed_mount2:
        for (i = 0; i < db_count; i++)
                brelse(sbi->s_group_desc[i]);
@@@ -3091,7 -3091,6 +3093,7 @@@ out_fail
        kfree(sbi->s_blockgroup_lock);
        kfree(sbi);
        lock_kernel();
 +      kfree(orig_data);
        return ret;
  }
  
@@@ -3383,7 -3382,7 +3385,7 @@@ static int ext4_commit_super(struct sup
        if (!(sb->s_flags & MS_RDONLY))
                es->s_wtime = cpu_to_le32(get_seconds());
        es->s_kbytes_written =
 -              cpu_to_le64(EXT4_SB(sb)->s_kbytes_written + 
 +              cpu_to_le64(EXT4_SB(sb)->s_kbytes_written +
                            ((part_stat_read(sb->s_bdev->bd_part, sectors[1]) -
                              EXT4_SB(sb)->s_sectors_written_start) >> 1));
        ext4_free_blocks_count_set(es, percpu_counter_sum_positive(
@@@ -3488,10 -3487,8 +3490,10 @@@ int ext4_force_commit(struct super_bloc
                return 0;
  
        journal = EXT4_SB(sb)->s_journal;
 -      if (journal)
 +      if (journal) {
 +              vfs_check_frozen(sb, SB_FREEZE_WRITE);
                ret = ext4_journal_force_commit(journal);
 +      }
  
        return ret;
  }
@@@ -3540,16 -3537,18 +3542,16 @@@ static int ext4_freeze(struct super_blo
         * the journal.
         */
        error = jbd2_journal_flush(journal);
 -      if (error < 0) {
 -      out:
 -              jbd2_journal_unlock_updates(journal);
 -              return error;
 -      }
 +      if (error < 0)
 +              goto out;
  
        /* Journal blocked and flushed, clear needs_recovery flag. */
        EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER);
        error = ext4_commit_super(sb, 1);
 -      if (error)
 -              goto out;
 -      return 0;
 +out:
 +      /* we rely on s_frozen to stop further updates */
 +      jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal);
 +      return error;
  }
  
  /*
@@@ -3566,6 -3565,7 +3568,6 @@@ static int ext4_unfreeze(struct super_b
        EXT4_SET_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER);
        ext4_commit_super(sb, 1);
        unlock_super(sb);
 -      jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal);
        return 0;
  }
  
@@@ -3576,13 -3576,13 +3578,14 @@@ static int ext4_remount(struct super_bl
        ext4_fsblk_t n_blocks_count = 0;
        unsigned long old_sb_flags;
        struct ext4_mount_options old_opts;
+       int enable_quota = 0;
        ext4_group_t g;
        unsigned int journal_ioprio = DEFAULT_JOURNAL_IOPRIO;
        int err;
  #ifdef CONFIG_QUOTA
        int i;
  #endif
 +      char *orig_data = kstrdup(data, GFP_KERNEL);
  
        lock_kernel();
  
                }
  
                if (*flags & MS_RDONLY) {
+                       err = dquot_suspend(sb, -1);
+                       if (err < 0)
+                               goto restore_opts;
                        /*
                         * First of all, the unconditional stuff we have to do
                         * to disable replay of the journal when we next remount
                                goto restore_opts;
                        if (!ext4_setup_super(sb, es, 0))
                                sb->s_flags &= ~MS_RDONLY;
+                       enable_quota = 1;
                }
        }
        ext4_setup_system_zone(sb);
  #endif
        unlock_super(sb);
        unlock_kernel();
+       if (enable_quota)
+               dquot_resume(sb, -1);
 +
 +      ext4_msg(sb, KERN_INFO, "re-mounted. Opts: %s", orig_data);
 +      kfree(orig_data);
        return 0;
  
  restore_opts:
  #endif
        unlock_super(sb);
        unlock_kernel();
 +      kfree(orig_data);
        return err;
  }
  
@@@ -3913,24 -3916,21 +3923,21 @@@ static int ext4_write_info(struct super
   */
  static int ext4_quota_on_mount(struct super_block *sb, int type)
  {
-       return vfs_quota_on_mount(sb, EXT4_SB(sb)->s_qf_names[type],
-                                 EXT4_SB(sb)->s_jquota_fmt, type);
+       return dquot_quota_on_mount(sb, EXT4_SB(sb)->s_qf_names[type],
+                                       EXT4_SB(sb)->s_jquota_fmt, type);
  }
  
  /*
   * Standard function to be called on quota_on
   */
  static int ext4_quota_on(struct super_block *sb, int type, int format_id,
-                        char *name, int remount)
+                        char *name)
  {
        int err;
        struct path path;
  
        if (!test_opt(sb, QUOTA))
                return -EINVAL;
-       /* When remounting, no checks are needed and in fact, name is NULL */
-       if (remount)
-               return vfs_quota_on(sb, type, format_id, name, remount);
  
        err = kern_path(name, LOOKUP_FOLLOW, &path);
        if (err)
                }
        }
  
-       err = vfs_quota_on_path(sb, type, format_id, &path);
+       err = dquot_quota_on_path(sb, type, format_id, &path);
        path_put(&path);
        return err;
  }
@@@ -4148,7 -4148,6 +4155,7 @@@ static int __init init_ext4_fs(void
  {
        int err;
  
 +      ext4_check_flag_values();
        err = init_ext4_system_zone();
        if (err)
                return err;
diff --combined fs/quota/dquot.c
index 1ad8bf076cfce189045b98942532146742f2f28e,531dee651ef72c90f1788dd06e76cc88811dc817..12c233da1b6b77e6c06d80b1bd18dbca93b65c78
@@@ -228,10 -228,6 +228,6 @@@ static struct hlist_head *dquot_hash
  
  struct dqstats dqstats;
  EXPORT_SYMBOL(dqstats);
- #ifdef CONFIG_SMP
- struct dqstats *dqstats_pcpu;
- EXPORT_SYMBOL(dqstats_pcpu);
- #endif
  
  static qsize_t inode_get_rsv_space(struct inode *inode);
  static void __dquot_initialize(struct inode *inode, int type);
@@@ -584,7 -580,7 +580,7 @@@ out
  }
  EXPORT_SYMBOL(dquot_scan_active);
  
- int vfs_quota_sync(struct super_block *sb, int type, int wait)
+ int dquot_quota_sync(struct super_block *sb, int type, int wait)
  {
        struct list_head *dirty;
        struct dquot *dquot;
  
        return 0;
  }
- EXPORT_SYMBOL(vfs_quota_sync);
+ EXPORT_SYMBOL(dquot_quota_sync);
  
  /* Free unused dquots from cache */
  static void prune_dqcache(int count)
        }
  }
  
- static int dqstats_read(unsigned int type)
- {
-       int count = 0;
- #ifdef CONFIG_SMP
-       int cpu;
-       for_each_possible_cpu(cpu)
-               count += per_cpu_ptr(dqstats_pcpu, cpu)->stat[type];
-       /* Statistics reading is racy, but absolute accuracy isn't required */
-       if (count < 0)
-               count = 0;
- #else
-       count = dqstats.stat[type];
- #endif
-       return count;
- }
  /*
   * This is called from kswapd when we think we need some
   * more memory
   */
  static int shrink_dqcache_memory(int nr, gfp_t gfp_mask)
  {
        if (nr) {
                prune_dqcache(nr);
                spin_unlock(&dq_list_lock);
        }
-       return (dqstats_read(DQST_FREE_DQUOTS)/100) * sysctl_vfs_cache_pressure;
+       return ((unsigned)
+               percpu_counter_read_positive(&dqstats.counter[DQST_FREE_DQUOTS])
+               /100) * sysctl_vfs_cache_pressure;
  }
  
  static struct shrinker dqcache_shrinker = {
@@@ -1514,13 -1495,11 +1495,13 @@@ static void inode_decr_space(struct ino
  /*
   * This operation can block, but only after everything is updated
   */
 -int __dquot_alloc_space(struct inode *inode, qsize_t number,
 -              int warn, int reserve)
 +int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags)
  {
        int cnt, ret = 0;
        char warntype[MAXQUOTAS];
 +      int warn = flags & DQUOT_SPACE_WARN;
 +      int reserve = flags & DQUOT_SPACE_RESERVE;
 +      int nofail = flags & DQUOT_SPACE_NOFAIL;
  
        /*
         * First test before acquiring mutex - solves deadlocks when we
                        continue;
                ret = check_bdq(inode->i_dquot[cnt], number, !warn,
                                warntype+cnt);
 -              if (ret) {
 +              if (ret && !nofail) {
                        spin_unlock(&dq_data_lock);
                        goto out_flush_warn;
                }
@@@ -1640,11 -1619,10 +1621,11 @@@ EXPORT_SYMBOL(dquot_claim_space_nodirty
  /*
   * This operation can block, but only after everything is updated
   */
 -void __dquot_free_space(struct inode *inode, qsize_t number, int reserve)
 +void __dquot_free_space(struct inode *inode, qsize_t number, int flags)
  {
        unsigned int cnt;
        char warntype[MAXQUOTAS];
 +      int reserve = flags & DQUOT_SPACE_RESERVE;
  
        /* First test before acquiring mutex - solves deadlocks when we
           * re-enter the quota code and are already holding the mutex */
@@@ -1815,7 -1793,7 +1796,7 @@@ int dquot_transfer(struct inode *inode
        if (iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid)
                transfer_to[USRQUOTA] = dqget(sb, iattr->ia_uid, USRQUOTA);
        if (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)
-               transfer_to[GRPQUOTA] = dqget(sb, iattr->ia_uid, GRPQUOTA);
+               transfer_to[GRPQUOTA] = dqget(sb, iattr->ia_gid, GRPQUOTA);
  
        ret = __dquot_transfer(inode, transfer_to);
        dqput_all(transfer_to);
@@@ -1850,6 -1828,7 +1831,7 @@@ const struct dquot_operations dquot_ope
        .alloc_dquot    = dquot_alloc,
        .destroy_dquot  = dquot_destroy,
  };
+ EXPORT_SYMBOL(dquot_operations);
  
  /*
   * Generic helper for ->open on filesystems supporting disk quotas.
@@@ -1868,7 -1847,7 +1850,7 @@@ EXPORT_SYMBOL(dquot_file_open)
  /*
   * Turn quota off on a device. type == -1 ==> quotaoff for all types (umount)
   */
- int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags)
+ int dquot_disable(struct super_block *sb, int type, unsigned int flags)
  {
        int cnt, ret = 0;
        struct quota_info *dqopt = sb_dqopt(sb);
@@@ -1998,14 -1977,15 +1980,15 @@@ put_inodes
                }
        return ret;
  }
- EXPORT_SYMBOL(vfs_quota_disable);
+ EXPORT_SYMBOL(dquot_disable);
  
- int vfs_quota_off(struct super_block *sb, int type, int remount)
+ int dquot_quota_off(struct super_block *sb, int type)
  {
-       return vfs_quota_disable(sb, type, remount ? DQUOT_SUSPENDED :
-                                (DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED));
+       return dquot_disable(sb, type,
+                            DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
  }
- EXPORT_SYMBOL(vfs_quota_off);
+ EXPORT_SYMBOL(dquot_quota_off);
  /*
   *    Turn quotas on on a device
   */
@@@ -2123,36 -2103,43 +2106,43 @@@ out_fmt
  }
  
  /* Reenable quotas on remount RW */
static int vfs_quota_on_remount(struct super_block *sb, int type)
int dquot_resume(struct super_block *sb, int type)
  {
        struct quota_info *dqopt = sb_dqopt(sb);
        struct inode *inode;
-       int ret;
+       int ret = 0, cnt;
        unsigned int flags;
  
-       mutex_lock(&dqopt->dqonoff_mutex);
-       if (!sb_has_quota_suspended(sb, type)) {
+       for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
+               if (type != -1 && cnt != type)
+                       continue;
+               mutex_lock(&dqopt->dqonoff_mutex);
+               if (!sb_has_quota_suspended(sb, cnt)) {
+                       mutex_unlock(&dqopt->dqonoff_mutex);
+                       continue;
+               }
+               inode = dqopt->files[cnt];
+               dqopt->files[cnt] = NULL;
+               spin_lock(&dq_state_lock);
+               flags = dqopt->flags & dquot_state_flag(DQUOT_USAGE_ENABLED |
+                                                       DQUOT_LIMITS_ENABLED,
+                                                       cnt);
+               dqopt->flags &= ~dquot_state_flag(DQUOT_STATE_FLAGS, cnt);
+               spin_unlock(&dq_state_lock);
                mutex_unlock(&dqopt->dqonoff_mutex);
-               return 0;
-       }
-       inode = dqopt->files[type];
-       dqopt->files[type] = NULL;
-       spin_lock(&dq_state_lock);
-       flags = dqopt->flags & dquot_state_flag(DQUOT_USAGE_ENABLED |
-                                               DQUOT_LIMITS_ENABLED, type);
-       dqopt->flags &= ~dquot_state_flag(DQUOT_STATE_FLAGS, type);
-       spin_unlock(&dq_state_lock);
-       mutex_unlock(&dqopt->dqonoff_mutex);
  
-       flags = dquot_generic_flag(flags, type);
-       ret = vfs_load_quota_inode(inode, type, dqopt->info[type].dqi_fmt_id,
-                                  flags);
-       iput(inode);
+               flags = dquot_generic_flag(flags, cnt);
+               ret = vfs_load_quota_inode(inode, cnt,
+                               dqopt->info[cnt].dqi_fmt_id, flags);
+               iput(inode);
+       }
  
        return ret;
  }
+ EXPORT_SYMBOL(dquot_resume);
  
- int vfs_quota_on_path(struct super_block *sb, int type, int format_id,
+ int dquot_quota_on_path(struct super_block *sb, int type, int format_id,
                      struct path *path)
  {
        int error = security_quota_on(path->dentry);
                                             DQUOT_LIMITS_ENABLED);
        return error;
  }
- EXPORT_SYMBOL(vfs_quota_on_path);
+ EXPORT_SYMBOL(dquot_quota_on_path);
  
- int vfs_quota_on(struct super_block *sb, int type, int format_id, char *name,
-                int remount)
+ int dquot_quota_on(struct super_block *sb, int type, int format_id, char *name)
  {
        struct path path;
        int error;
  
-       if (remount)
-               return vfs_quota_on_remount(sb, type);
        error = kern_path(name, LOOKUP_FOLLOW, &path);
        if (!error) {
-               error = vfs_quota_on_path(sb, type, format_id, &path);
+               error = dquot_quota_on_path(sb, type, format_id, &path);
                path_put(&path);
        }
        return error;
  }
- EXPORT_SYMBOL(vfs_quota_on);
+ EXPORT_SYMBOL(dquot_quota_on);
  
  /*
   * More powerful function for turning on quotas allowing setting
   * of individual quota flags
   */
- int vfs_quota_enable(struct inode *inode, int type, int format_id,
-               unsigned int flags)
+ int dquot_enable(struct inode *inode, int type, int format_id,
+                unsigned int flags)
  {
        int ret = 0;
        struct super_block *sb = inode->i_sb;
        struct quota_info *dqopt = sb_dqopt(sb);
  
        /* Just unsuspend quotas? */
-       if (flags & DQUOT_SUSPENDED)
-               return vfs_quota_on_remount(sb, type);
+       BUG_ON(flags & DQUOT_SUSPENDED);
        if (!flags)
                return 0;
        /* Just updating flags needed? */
@@@ -2232,13 -2215,13 +2218,13 @@@ out_lock
  load_quota:
        return vfs_load_quota_inode(inode, type, format_id, flags);
  }
- EXPORT_SYMBOL(vfs_quota_enable);
+ EXPORT_SYMBOL(dquot_enable);
  
  /*
   * This function is used when filesystem needs to initialize quotas
   * during mount time.
   */
- int vfs_quota_on_mount(struct super_block *sb, char *qf_name,
+ int dquot_quota_on_mount(struct super_block *sb, char *qf_name,
                int format_id, int type)
  {
        struct dentry *dentry;
@@@ -2264,24 -2247,7 +2250,7 @@@ out
        dput(dentry);
        return error;
  }
- EXPORT_SYMBOL(vfs_quota_on_mount);
- /* Wrapper to turn on quotas when remounting rw */
- int vfs_dq_quota_on_remount(struct super_block *sb)
- {
-       int cnt;
-       int ret = 0, err;
-       if (!sb->s_qcop || !sb->s_qcop->quota_on)
-               return -ENOSYS;
-       for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
-               err = sb->s_qcop->quota_on(sb, cnt, 0, NULL, 1);
-               if (err < 0 && !ret)
-                       ret = err;
-       }
-       return ret;
- }
- EXPORT_SYMBOL(vfs_dq_quota_on_remount);
+ EXPORT_SYMBOL(dquot_quota_on_mount);
  
  static inline qsize_t qbtos(qsize_t blocks)
  {
@@@ -2316,8 -2282,8 +2285,8 @@@ static void do_get_dqblk(struct dquot *
        spin_unlock(&dq_data_lock);
  }
  
- int vfs_get_dqblk(struct super_block *sb, int type, qid_t id,
-                 struct fs_disk_quota *di)
+ int dquot_get_dqblk(struct super_block *sb, int type, qid_t id,
+                   struct fs_disk_quota *di)
  {
        struct dquot *dquot;
  
  
        return 0;
  }
- EXPORT_SYMBOL(vfs_get_dqblk);
+ EXPORT_SYMBOL(dquot_get_dqblk);
  
  #define VFS_FS_DQ_MASK \
        (FS_DQ_BCOUNT | FS_DQ_BSOFT | FS_DQ_BHARD | \
@@@ -2428,7 -2394,7 +2397,7 @@@ static int do_set_dqblk(struct dquot *d
        return 0;
  }
  
- int vfs_set_dqblk(struct super_block *sb, int type, qid_t id,
+ int dquot_set_dqblk(struct super_block *sb, int type, qid_t id,
                  struct fs_disk_quota *di)
  {
        struct dquot *dquot;
  out:
        return rc;
  }
- EXPORT_SYMBOL(vfs_set_dqblk);
+ EXPORT_SYMBOL(dquot_set_dqblk);
  
  /* Generic routine for getting common part of quota file information */
- int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii)
+ int dquot_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii)
  {
        struct mem_dqinfo *mi;
    
        mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex);
        return 0;
  }
- EXPORT_SYMBOL(vfs_get_dqinfo);
+ EXPORT_SYMBOL(dquot_get_dqinfo);
  
  /* Generic routine for setting common part of quota file information */
- int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii)
+ int dquot_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii)
  {
        struct mem_dqinfo *mi;
        int err = 0;
        mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex);
        return err;
  }
- EXPORT_SYMBOL(vfs_set_dqinfo);
+ EXPORT_SYMBOL(dquot_set_dqinfo);
  
- const struct quotactl_ops vfs_quotactl_ops = {
-       .quota_on       = vfs_quota_on,
-       .quota_off      = vfs_quota_off,
-       .quota_sync     = vfs_quota_sync,
-       .get_info       = vfs_get_dqinfo,
-       .set_info       = vfs_set_dqinfo,
-       .get_dqblk      = vfs_get_dqblk,
-       .set_dqblk      = vfs_set_dqblk
+ const struct quotactl_ops dquot_quotactl_ops = {
+       .quota_on       = dquot_quota_on,
+       .quota_off      = dquot_quota_off,
+       .quota_sync     = dquot_quota_sync,
+       .get_info       = dquot_get_dqinfo,
+       .set_info       = dquot_set_dqinfo,
+       .get_dqblk      = dquot_get_dqblk,
+       .set_dqblk      = dquot_set_dqblk
  };
+ EXPORT_SYMBOL(dquot_quotactl_ops);
  
  static int do_proc_dqstats(struct ctl_table *table, int write,
                     void __user *buffer, size_t *lenp, loff_t *ppos)
  {
- #ifdef CONFIG_SMP
-       /* Update global table */
        unsigned int type = (int *)table->data - dqstats.stat;
-       dqstats.stat[type] = dqstats_read(type);
- #endif
+       /* Update global table */
+       dqstats.stat[type] =
+                       percpu_counter_sum_positive(&dqstats.counter[type]);
        return proc_dointvec(table, write, buffer, lenp, ppos);
  }
  
@@@ -2609,7 -2575,7 +2578,7 @@@ static ctl_table sys_table[] = 
  
  static int __init dquot_init(void)
  {
-       int i;
+       int i, ret;
        unsigned long nr_hash, order;
  
        printk(KERN_NOTICE "VFS: Disk quotas %s\n", __DQUOT_VERSION__);
        if (!dquot_hash)
                panic("Cannot create dquot hash table");
  
- #ifdef CONFIG_SMP
-       dqstats_pcpu = alloc_percpu(struct dqstats);
-       if (!dqstats_pcpu)
-               panic("Cannot create dquot stats table");
- #endif
-       memset(&dqstats, 0, sizeof(struct dqstats));
+       for (i = 0; i < _DQST_DQSTAT_LAST; i++) {
+               ret = percpu_counter_init(&dqstats.counter[i], 0);
+               if (ret)
+                       panic("Cannot create dquot stat counters");
+       }
  
        /* Find power-of-two hlist_heads which can fit into allocation */
        nr_hash = (1UL << order) * PAGE_SIZE / sizeof(struct hlist_head);
diff --combined fs/super.c
index a67409e5ad942cd75424b8e2b8dcaf1c496d8dfc,af9fd02185aae83f795c55b2a1d3a74865cba6f5..5c35bc7a499e19c97b0f8eba3a91a8224a46ffe4
@@@ -24,7 -24,6 +24,6 @@@
  #include <linux/slab.h>
  #include <linux/acct.h>
  #include <linux/blkdev.h>
- #include <linux/quotaops.h>
  #include <linux/mount.h>
  #include <linux/security.h>
  #include <linux/writeback.h>          /* for the emergency remount stuff */
@@@ -94,8 -93,6 +93,6 @@@ static struct super_block *alloc_super(
                init_rwsem(&s->s_dquot.dqptr_sem);
                init_waitqueue_head(&s->s_wait_unfrozen);
                s->s_maxbytes = MAX_NON_LFS;
-               s->dq_op = sb_dquot_ops;
-               s->s_qcop = sb_quotactl_ops;
                s->s_op = &default_op;
                s->s_time_gran = 1000000000;
        }
@@@ -160,7 -157,6 +157,6 @@@ void deactivate_locked_super(struct sup
  {
        struct file_system_type *fs = s->s_type;
        if (atomic_dec_and_test(&s->s_active)) {
-               vfs_dq_off(s, 0);
                fs->kill_sb(s);
                put_filesystem(fs);
                put_super(s);
@@@ -524,7 -520,7 +520,7 @@@ rescan
  int do_remount_sb(struct super_block *sb, int flags, void *data, int force)
  {
        int retval;
-       int remount_rw, remount_ro;
+       int remount_ro;
  
        if (sb->s_frozen != SB_UNFROZEN)
                return -EBUSY;
        sync_filesystem(sb);
  
        remount_ro = (flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY);
-       remount_rw = !(flags & MS_RDONLY) && (sb->s_flags & MS_RDONLY);
  
        /* If we are remounting RDONLY and current sb is read/write,
           make sure there are no rw files opened */
                        mark_files_ro(sb);
                else if (!fs_may_remount_ro(sb))
                        return -EBUSY;
-               retval = vfs_dq_off(sb, 1);
-               if (retval < 0 && retval != -ENOSYS)
-                       return -EBUSY;
        }
  
        if (sb->s_op->remount_fs) {
                        return retval;
        }
        sb->s_flags = (sb->s_flags & ~MS_RMT_MASK) | (flags & MS_RMT_MASK);
-       if (remount_rw)
-               vfs_dq_quota_on_remount(sb);
        /*
         * Some filesystems modify their metadata via some other path than the
         * bdev buffer cache (eg. use a private mapping, or directories in
@@@ -946,8 -937,8 +937,8 @@@ out
  EXPORT_SYMBOL_GPL(vfs_kern_mount);
  
  /**
 - * freeze_super -- lock the filesystem and force it into a consistent state
 - * @super: the super to lock
 + * freeze_super - lock the filesystem and force it into a consistent state
 + * @sb: the super to lock
   *
   * Syncs the super to make sure the filesystem is consistent and calls the fs's
   * freeze_fs.  Subsequent calls to this without first thawing the fs will return
diff --combined fs/udf/file.c
index 0660280aa18075c6c353514c040bf920c215df92,0db1d672950e55956aa053bafd0ac41630904b78..94e06d6bddbd1fb973d7bd70b37664c485973529
@@@ -34,7 -34,6 +34,6 @@@
  #include <linux/errno.h>
  #include <linux/smp_lock.h>
  #include <linux/pagemap.h>
- #include <linux/quotaops.h>
  #include <linux/buffer_head.h>
  #include <linux/aio.h>
  #include <linux/smp_lock.h>
@@@ -219,39 -218,16 +218,16 @@@ const struct file_operations udf_file_o
        .read                   = do_sync_read,
        .aio_read               = generic_file_aio_read,
        .unlocked_ioctl         = udf_ioctl,
-       .open                   = dquot_file_open,
+       .open                   = generic_file_open,
        .mmap                   = generic_file_mmap,
        .write                  = do_sync_write,
        .aio_write              = udf_file_aio_write,
        .release                = udf_release_file,
 -      .fsync                  = simple_fsync,
 +      .fsync                  = generic_file_fsync,
        .splice_read            = generic_file_splice_read,
        .llseek                 = generic_file_llseek,
  };
  
- int udf_setattr(struct dentry *dentry, struct iattr *iattr)
- {
-       struct inode *inode = dentry->d_inode;
-       int error;
-       error = inode_change_ok(inode, iattr);
-       if (error)
-               return error;
-       if (is_quota_modification(inode, iattr))
-               dquot_initialize(inode);
-       if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
-             (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
-               error = dquot_transfer(inode, iattr);
-               if (error)
-                       return error;
-       }
-       return inode_setattr(inode, iattr);
- }
  const struct inode_operations udf_file_inode_operations = {
        .truncate               = udf_truncate,
-       .setattr                = udf_setattr,
  };
diff --combined fs/ufs/file.c
index d4c30d1bef8648f048290bb67cd257deb203032f,73655c61240a0bb756ad4af3d0b841f04c709ae1..33afa20d450982eafb4e1bcc77193cce152270d1
@@@ -24,7 -24,6 +24,6 @@@
   */
  
  #include <linux/fs.h>
- #include <linux/quotaops.h>
  
  #include "ufs_fs.h"
  #include "ufs.h"
@@@ -41,7 -40,7 +40,7 @@@ const struct file_operations ufs_file_o
        .write          = do_sync_write,
        .aio_write      = generic_file_aio_write,
        .mmap           = generic_file_mmap,
-       .open           = dquot_file_open,
+       .open           = generic_file_open,
 -      .fsync          = simple_fsync,
 +      .fsync          = generic_file_fsync,
        .splice_read    = generic_file_splice_read,
  };
diff --combined fs/ufs/super.c
index ad9bc1ebd3a65d2f8ddd5d7172378b64499d3263,3c9bbf23c2ffc3f835a0b470ddf49a6dd8b37da0..3ec5a9eb6efb3ff17654c01b6d00ae3d6bb4e44e
@@@ -77,7 -77,6 +77,6 @@@
  
  #include <linux/errno.h>
  #include <linux/fs.h>
- #include <linux/quotaops.h>
  #include <linux/slab.h>
  #include <linux/time.h>
  #include <linux/stat.h>
@@@ -918,7 -917,6 +917,7 @@@ again
        sbi->s_bytesex = BYTESEX_LE;
        switch ((uspi->fs_magic = fs32_to_cpu(sb, usb3->fs_magic))) {
                case UFS_MAGIC:
 +              case UFS_MAGIC_BW:
                case UFS2_MAGIC:
                case UFS_MAGIC_LFN:
                case UFS_MAGIC_FEA:
        sbi->s_bytesex = BYTESEX_BE;
        switch ((uspi->fs_magic = fs32_to_cpu(sb, usb3->fs_magic))) {
                case UFS_MAGIC:
 +              case UFS_MAGIC_BW:
                case UFS2_MAGIC:
                case UFS_MAGIC_LFN:
                case UFS_MAGIC_FEA:
@@@ -1047,7 -1044,7 +1046,7 @@@ magic_found
         */
        sb->s_op = &ufs_super_ops;
        sb->s_export_op = &ufs_export_ops;
-       sb->dq_op = NULL; /***/
        sb->s_magic = fs32_to_cpu(sb, usb3->fs_magic);
  
        uspi->s_sblkno = fs32_to_cpu(sb, usb1->fs_sblkno);
@@@ -1437,126 -1434,19 +1436,19 @@@ static void destroy_inodecache(void
        kmem_cache_destroy(ufs_inode_cachep);
  }
  
- static void ufs_clear_inode(struct inode *inode)
- {
-       dquot_drop(inode);
- }
- #ifdef CONFIG_QUOTA
- static ssize_t ufs_quota_read(struct super_block *, int, char *,size_t, loff_t);
- static ssize_t ufs_quota_write(struct super_block *, int, const char *, size_t, loff_t);
- #endif
  static const struct super_operations ufs_super_ops = {
        .alloc_inode    = ufs_alloc_inode,
        .destroy_inode  = ufs_destroy_inode,
        .write_inode    = ufs_write_inode,
        .delete_inode   = ufs_delete_inode,
-       .clear_inode    = ufs_clear_inode,
        .put_super      = ufs_put_super,
        .write_super    = ufs_write_super,
        .sync_fs        = ufs_sync_fs,
        .statfs         = ufs_statfs,
        .remount_fs     = ufs_remount,
        .show_options   = ufs_show_options,
- #ifdef CONFIG_QUOTA
-       .quota_read     = ufs_quota_read,
-       .quota_write    = ufs_quota_write,
- #endif
  };
  
- #ifdef CONFIG_QUOTA
- /* Read data from quotafile - avoid pagecache and such because we cannot afford
-  * acquiring the locks... As quota files are never truncated and quota code
-  * itself serializes the operations (and noone else should touch the files)
-  * we don't have to be afraid of races */
- static ssize_t ufs_quota_read(struct super_block *sb, int type, char *data,
-                              size_t len, loff_t off)
- {
-       struct inode *inode = sb_dqopt(sb)->files[type];
-       sector_t blk = off >> sb->s_blocksize_bits;
-       int err = 0;
-       int offset = off & (sb->s_blocksize - 1);
-       int tocopy;
-       size_t toread;
-       struct buffer_head *bh;
-       loff_t i_size = i_size_read(inode);
-       if (off > i_size)
-               return 0;
-       if (off+len > i_size)
-               len = i_size-off;
-       toread = len;
-       while (toread > 0) {
-               tocopy = sb->s_blocksize - offset < toread ?
-                               sb->s_blocksize - offset : toread;
-               bh = ufs_bread(inode, blk, 0, &err);
-               if (err)
-                       return err;
-               if (!bh)        /* A hole? */
-                       memset(data, 0, tocopy);
-               else {
-                       memcpy(data, bh->b_data+offset, tocopy);
-                       brelse(bh);
-               }
-               offset = 0;
-               toread -= tocopy;
-               data += tocopy;
-               blk++;
-       }
-       return len;
- }
- /* Write to quotafile */
- static ssize_t ufs_quota_write(struct super_block *sb, int type,
-                               const char *data, size_t len, loff_t off)
- {
-       struct inode *inode = sb_dqopt(sb)->files[type];
-       sector_t blk = off >> sb->s_blocksize_bits;
-       int err = 0;
-       int offset = off & (sb->s_blocksize - 1);
-       int tocopy;
-       size_t towrite = len;
-       struct buffer_head *bh;
-       mutex_lock_nested(&inode->i_mutex, I_MUTEX_QUOTA);
-       while (towrite > 0) {
-               tocopy = sb->s_blocksize - offset < towrite ?
-                               sb->s_blocksize - offset : towrite;
-               bh = ufs_bread(inode, blk, 1, &err);
-               if (!bh)
-                       goto out;
-               lock_buffer(bh);
-               memcpy(bh->b_data+offset, data, tocopy);
-               flush_dcache_page(bh->b_page);
-               set_buffer_uptodate(bh);
-               mark_buffer_dirty(bh);
-               unlock_buffer(bh);
-               brelse(bh);
-               offset = 0;
-               towrite -= tocopy;
-               data += tocopy;
-               blk++;
-       }
- out:
-       if (len == towrite) {
-               mutex_unlock(&inode->i_mutex);
-               return err;
-       }
-       if (inode->i_size < off+len-towrite)
-               i_size_write(inode, off+len-towrite);
-       inode->i_version++;
-       inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
-       mark_inode_dirty(inode);
-       mutex_unlock(&inode->i_mutex);
-       return len - towrite;
- }
- #endif
  static int ufs_get_sb(struct file_system_type *fs_type,
        int flags, const char *dev_name, void *data, struct vfsmount *mnt)
  {
diff --combined fs/ufs/truncate.c
index 3733057e78339ed076d271581dbe87b6021c5b7f,4171e2df18dde84df5e9de16c182df88ca885600..589e01a465bad16f8708b74de4b0fad11e24676d
@@@ -44,7 -44,6 +44,6 @@@
  #include <linux/buffer_head.h>
  #include <linux/blkdev.h>
  #include <linux/sched.h>
- #include <linux/quotaops.h>
  
  #include "ufs_fs.h"
  #include "ufs.h"
@@@ -501,10 -500,12 +500,10 @@@ out
        return err;
  }
  
 -
  /*
 - * We don't define our `inode->i_op->truncate', and call it here,
 - * because of:
 - * - there is no way to know old size
 - * - there is no way inform user about error, if it happens in `truncate'
 + * TODO:
 + *    - truncate case should use proper ordering instead of using
 + *      simple_setsize
   */
  int ufs_setattr(struct dentry *dentry, struct iattr *attr)
  {
        if (error)
                return error;
  
-       if (is_quota_modification(inode, attr))
-               dquot_initialize(inode);
-       if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
-           (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) {
-               error = dquot_transfer(inode, attr);
-               if (error)
-                       return error;
-       }
        if (ia_valid & ATTR_SIZE && attr->ia_size != inode->i_size) {
                loff_t old_i_size = inode->i_size;
  
 -              error = vmtruncate(inode, attr->ia_size);
 +              error = simple_setsize(inode, attr->ia_size);
                if (error)
                        return error;
                error = ufs_truncate(inode, old_i_size);
diff --combined include/linux/quotaops.h
index e38ae53f3529b08b20f5597dc5cd3b25881ad864,0c77cd8d2822f3cf23f8143edb83ab945b735f4c..aa36793b48bd11b80b4b33765c7b7d074a899e7f
@@@ -9,10 -9,6 +9,10 @@@
  
  #include <linux/fs.h>
  
 +#define DQUOT_SPACE_WARN      0x1
 +#define DQUOT_SPACE_RESERVE   0x2
 +#define DQUOT_SPACE_NOFAIL    0x4
 +
  static inline struct quota_info *sb_dqopt(struct super_block *sb)
  {
        return &sb->s_dquot;
@@@ -45,14 -41,23 +45,22 @@@ int dquot_scan_active(struct super_bloc
  struct dquot *dquot_alloc(struct super_block *sb, int type);
  void dquot_destroy(struct dquot *dquot);
  
 -int __dquot_alloc_space(struct inode *inode, qsize_t number,
 -              int warn, int reserve);
 -void __dquot_free_space(struct inode *inode, qsize_t number, int reserve);
 +int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags);
 +void __dquot_free_space(struct inode *inode, qsize_t number, int flags);
  
  int dquot_alloc_inode(const struct inode *inode);
  
  int dquot_claim_space_nodirty(struct inode *inode, qsize_t number);
  void dquot_free_inode(const struct inode *inode);
  
+ int dquot_disable(struct super_block *sb, int type, unsigned int flags);
+ /* Suspend quotas on remount RO */
+ static inline int dquot_suspend(struct super_block *sb, int type)
+ {
+       return dquot_disable(sb, type, DQUOT_SUSPENDED);
+ }
+ int dquot_resume(struct super_block *sb, int type);
  int dquot_commit(struct dquot *dquot);
  int dquot_acquire(struct dquot *dquot);
  int dquot_release(struct dquot *dquot);
@@@ -61,27 -66,25 +69,25 @@@ int dquot_mark_dquot_dirty(struct dquo
  
  int dquot_file_open(struct inode *inode, struct file *file);
  
- int vfs_quota_on(struct super_block *sb, int type, int format_id,
-       char *path, int remount);
- int vfs_quota_enable(struct inode *inode, int type, int format_id,
+ int dquot_quota_on(struct super_block *sb, int type, int format_id,
+       char *path);
+ int dquot_enable(struct inode *inode, int type, int format_id,
        unsigned int flags);
- int vfs_quota_on_path(struct super_block *sb, int type, int format_id,
+ int dquot_quota_on_path(struct super_block *sb, int type, int format_id,
        struct path *path);
- int vfs_quota_on_mount(struct super_block *sb, char *qf_name,
+ int dquot_quota_on_mount(struct super_block *sb, char *qf_name,
        int format_id, int type);
- int vfs_quota_off(struct super_block *sb, int type, int remount);
- int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags);
- int vfs_quota_sync(struct super_block *sb, int type, int wait);
- int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
- int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
- int vfs_get_dqblk(struct super_block *sb, int type, qid_t id,
+ int dquot_quota_off(struct super_block *sb, int type);
+ int dquot_quota_sync(struct super_block *sb, int type, int wait);
+ int dquot_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
+ int dquot_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
+ int dquot_get_dqblk(struct super_block *sb, int type, qid_t id,
                struct fs_disk_quota *di);
- int vfs_set_dqblk(struct super_block *sb, int type, qid_t id,
+ int dquot_set_dqblk(struct super_block *sb, int type, qid_t id,
                struct fs_disk_quota *di);
  
  int __dquot_transfer(struct inode *inode, struct dquot **transfer_to);
  int dquot_transfer(struct inode *inode, struct iattr *iattr);
- int vfs_dq_quota_on_remount(struct super_block *sb);
  
  static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type)
  {
@@@ -148,20 -151,7 +154,7 @@@ static inline unsigned sb_any_quota_act
   * Operations supported for diskquotas.
   */
  extern const struct dquot_operations dquot_operations;
- extern const struct quotactl_ops vfs_quotactl_ops;
- #define sb_dquot_ops (&dquot_operations)
- #define sb_quotactl_ops (&vfs_quotactl_ops)
- /* Cannot be called inside a transaction */
- static inline int vfs_dq_off(struct super_block *sb, int remount)
- {
-       int ret = -ENOSYS;
-       if (sb->s_qcop && sb->s_qcop->quota_off)
-               ret = sb->s_qcop->quota_off(sb, -1, remount);
-       return ret;
- }
+ extern const struct quotactl_ops dquot_quotactl_ops;
  
  #else
  
@@@ -206,12 -196,6 +199,6 @@@ static inline int sb_any_quota_active(s
        return 0;
  }
  
- /*
-  * NO-OP when quota not configured.
-  */
- #define sb_dquot_ops                          (NULL)
- #define sb_quotactl_ops                               (NULL)
  static inline void dquot_initialize(struct inode *inode)
  {
  }
@@@ -229,33 -213,23 +216,23 @@@ static inline void dquot_free_inode(con
  {
  }
  
- static inline int vfs_dq_off(struct super_block *sb, int remount)
- {
-       return 0;
- }
- static inline int vfs_dq_quota_on_remount(struct super_block *sb)
- {
-       return 0;
- }
  static inline int dquot_transfer(struct inode *inode, struct iattr *iattr)
  {
        return 0;
  }
  
  static inline int __dquot_alloc_space(struct inode *inode, qsize_t number,
 -              int warn, int reserve)
 +              int flags)
  {
 -      if (!reserve)
 +      if (!(flags & DQUOT_SPACE_RESERVE))
                inode_add_bytes(inode, number);
        return 0;
  }
  
  static inline void __dquot_free_space(struct inode *inode, qsize_t number,
 -              int reserve)
 +              int flags)
  {
 -      if (!reserve)
 +      if (!(flags & DQUOT_SPACE_RESERVE))
                inode_sub_bytes(inode, number);
  }
  
@@@ -265,19 -239,29 +242,35 @@@ static inline int dquot_claim_space_nod
        return 0;
  }
  
+ static inline int dquot_disable(struct super_block *sb, int type,
+               unsigned int flags)
+ {
+       return 0;
+ }
+ static inline int dquot_suspend(struct super_block *sb, int type)
+ {
+       return 0;
+ }
+ static inline int dquot_resume(struct super_block *sb, int type)
+ {
+       return 0;
+ }
  #define dquot_file_open               generic_file_open
  
  #endif /* CONFIG_QUOTA */
  
  static inline int dquot_alloc_space_nodirty(struct inode *inode, qsize_t nr)
  {
 -      return __dquot_alloc_space(inode, nr, 1, 0);
 +      return __dquot_alloc_space(inode, nr, DQUOT_SPACE_WARN);
 +}
 +
 +static inline void dquot_alloc_space_nofail(struct inode *inode, qsize_t nr)
 +{
 +      __dquot_alloc_space(inode, nr, DQUOT_SPACE_WARN|DQUOT_SPACE_NOFAIL);
 +      mark_inode_dirty(inode);
  }
  
  static inline int dquot_alloc_space(struct inode *inode, qsize_t nr)
@@@ -295,11 -279,6 +288,11 @@@ static inline int dquot_alloc_block_nod
        return dquot_alloc_space_nodirty(inode, nr << inode->i_blkbits);
  }
  
 +static inline void dquot_alloc_block_nofail(struct inode *inode, qsize_t nr)
 +{
 +      dquot_alloc_space_nofail(inode, nr << inode->i_blkbits);
 +}
 +
  static inline int dquot_alloc_block(struct inode *inode, qsize_t nr)
  {
        return dquot_alloc_space(inode, nr << inode->i_blkbits);
  
  static inline int dquot_prealloc_block_nodirty(struct inode *inode, qsize_t nr)
  {
 -      return __dquot_alloc_space(inode, nr << inode->i_blkbits, 0, 0);
 +      return __dquot_alloc_space(inode, nr << inode->i_blkbits, 0);
  }
  
  static inline int dquot_prealloc_block(struct inode *inode, qsize_t nr)
  
  static inline int dquot_reserve_block(struct inode *inode, qsize_t nr)
  {
 -      return __dquot_alloc_space(inode, nr << inode->i_blkbits, 1, 1);
 +      return __dquot_alloc_space(inode, nr << inode->i_blkbits,
 +                              DQUOT_SPACE_WARN|DQUOT_SPACE_RESERVE);
  }
  
  static inline int dquot_claim_block(struct inode *inode, qsize_t nr)
@@@ -360,7 -338,7 +353,7 @@@ static inline void dquot_free_block(str
  static inline void dquot_release_reservation_block(struct inode *inode,
                qsize_t nr)
  {
 -      __dquot_free_space(inode, nr << inode->i_blkbits, 1);
 +      __dquot_free_space(inode, nr << inode->i_blkbits, DQUOT_SPACE_RESERVE);
  }
  
  #endif /* _LINUX_QUOTAOPS_ */