]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/ext4/super.c
[PATCH] switch quota_on-related stuff to kern_path()
[linux-2.6-omap-h63xx.git] / fs / ext4 / super.c
index 95127f03d1f640db2cb319b921d2cb24d3932b3c..ae35f176b69770e4bda4439c18439fc25352586e 100644 (file)
@@ -374,66 +374,6 @@ void ext4_update_dynamic_rev(struct super_block *sb)
         */
 }
 
-int ext4_update_compat_feature(handle_t *handle,
-                                       struct super_block *sb, __u32 compat)
-{
-       int err = 0;
-       if (!EXT4_HAS_COMPAT_FEATURE(sb, compat)) {
-               err = ext4_journal_get_write_access(handle,
-                               EXT4_SB(sb)->s_sbh);
-               if (err)
-                       return err;
-               EXT4_SET_COMPAT_FEATURE(sb, compat);
-               sb->s_dirt = 1;
-               handle->h_sync = 1;
-               BUFFER_TRACE(EXT4_SB(sb)->s_sbh,
-                                       "call ext4_journal_dirty_met adata");
-               err = ext4_journal_dirty_metadata(handle,
-                               EXT4_SB(sb)->s_sbh);
-       }
-       return err;
-}
-
-int ext4_update_rocompat_feature(handle_t *handle,
-                                       struct super_block *sb, __u32 rocompat)
-{
-       int err = 0;
-       if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, rocompat)) {
-               err = ext4_journal_get_write_access(handle,
-                               EXT4_SB(sb)->s_sbh);
-               if (err)
-                       return err;
-               EXT4_SET_RO_COMPAT_FEATURE(sb, rocompat);
-               sb->s_dirt = 1;
-               handle->h_sync = 1;
-               BUFFER_TRACE(EXT4_SB(sb)->s_sbh,
-                                       "call ext4_journal_dirty_met adata");
-               err = ext4_journal_dirty_metadata(handle,
-                               EXT4_SB(sb)->s_sbh);
-       }
-       return err;
-}
-
-int ext4_update_incompat_feature(handle_t *handle,
-                                       struct super_block *sb, __u32 incompat)
-{
-       int err = 0;
-       if (!EXT4_HAS_INCOMPAT_FEATURE(sb, incompat)) {
-               err = ext4_journal_get_write_access(handle,
-                               EXT4_SB(sb)->s_sbh);
-               if (err)
-                       return err;
-               EXT4_SET_INCOMPAT_FEATURE(sb, incompat);
-               sb->s_dirt = 1;
-               handle->h_sync = 1;
-               BUFFER_TRACE(EXT4_SB(sb)->s_sbh,
-                                       "call ext4_journal_dirty_met adata");
-               err = ext4_journal_dirty_metadata(handle,
-                               EXT4_SB(sb)->s_sbh);
-       }
-       return err;
-}
-
 /*
  * Open the external journal device
  */
@@ -1771,13 +1711,13 @@ static void ext4_orphan_cleanup(struct super_block *sb,
  *
  * Note, this does *not* consider any metadata overhead for vfs i_blocks.
  */
-static loff_t ext4_max_size(int blkbits)
+static loff_t ext4_max_size(int blkbits, int has_huge_files)
 {
        loff_t res;
        loff_t upper_limit = MAX_LFS_FILESIZE;
 
        /* small i_blocks in vfs inode? */
-       if (sizeof(blkcnt_t) < sizeof(u64)) {
+       if (!has_huge_files || sizeof(blkcnt_t) < sizeof(u64)) {
                /*
                 * CONFIG_LSF is not enabled implies the inode
                 * i_block represent total blocks in 512 bytes
@@ -1807,7 +1747,7 @@ static loff_t ext4_max_size(int blkbits)
  * block limit, and also a limit of (2^48 - 1) 512-byte sectors in i_blocks.
  * We need to be 1 filesystem block less than the 2^48 sector limit.
  */
-static loff_t ext4_max_bitmap_size(int bits)
+static loff_t ext4_max_bitmap_size(int bits, int has_huge_files)
 {
        loff_t res = EXT4_NDIR_BLOCKS;
        int meta_blocks;
@@ -1820,11 +1760,11 @@ static loff_t ext4_max_bitmap_size(int bits)
         * total number of  512 bytes blocks of the file
         */
 
-       if (sizeof(blkcnt_t) < sizeof(u64)) {
+       if (!has_huge_files || sizeof(blkcnt_t) < sizeof(u64)) {
                /*
-                * CONFIG_LSF is not enabled implies the inode
-                * i_block represent total blocks in 512 bytes
-                * 32 == size of vfs inode i_blocks * 8
+                * !has_huge_files or CONFIG_LSF is not enabled
+                * implies the inode i_block represent total blocks in
+                * 512 bytes 32 == size of vfs inode i_blocks * 8
                 */
                upper_limit = (1LL << 32) - 1;
 
@@ -1933,7 +1873,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
        int blocksize;
        int db_count;
        int i;
-       int needs_recovery;
+       int needs_recovery, has_huge_files;
        __le32 features;
        __u64 blocks_count;
        int err;
@@ -2074,7 +2014,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
                       sb->s_id, le32_to_cpu(features));
                goto failed_mount;
        }
-       if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_HUGE_FILE)) {
+       has_huge_files = EXT4_HAS_RO_COMPAT_FEATURE(sb,
+                                   EXT4_FEATURE_RO_COMPAT_HUGE_FILE);
+       if (has_huge_files) {
                /*
                 * Large file size enabled file system can only be
                 * mount if kernel is build with CONFIG_LSF
@@ -2124,8 +2066,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
                }
        }
 
-       sbi->s_bitmap_maxbytes = ext4_max_bitmap_size(sb->s_blocksize_bits);
-       sb->s_maxbytes = ext4_max_size(sb->s_blocksize_bits);
+       sbi->s_bitmap_maxbytes = ext4_max_bitmap_size(sb->s_blocksize_bits,
+                                                     has_huge_files);
+       sb->s_maxbytes = ext4_max_size(sb->s_blocksize_bits, has_huge_files);
 
        if (le32_to_cpu(es->s_rev_level) == EXT4_GOOD_OLD_REV) {
                sbi->s_inode_size = EXT4_GOOD_OLD_INODE_SIZE;
@@ -3385,30 +3328,30 @@ static int ext4_quota_on_mount(struct super_block *sb, int type)
  * Standard function to be called on quota_on
  */
 static int ext4_quota_on(struct super_block *sb, int type, int format_id,
-                        char *path, int remount)
+                        char *name, int remount)
 {
        int err;
-       struct nameidata nd;
+       struct path path;
 
        if (!test_opt(sb, QUOTA))
                return -EINVAL;
-       /* When remounting, no checks are needed and in fact, path is NULL */
+       /* When remounting, no checks are needed and in fact, name is NULL */
        if (remount)
-               return vfs_quota_on(sb, type, format_id, path, remount);
+               return vfs_quota_on(sb, type, format_id, name, remount);
 
-       err = path_lookup(path, LOOKUP_FOLLOW, &nd);
+       err = kern_path(name, LOOKUP_FOLLOW, &path);
        if (err)
                return err;
 
        /* Quotafile not on the same filesystem? */
-       if (nd.path.mnt->mnt_sb != sb) {
-               path_put(&nd.path);
+       if (path.mnt->mnt_sb != sb) {
+               path_put(&path);
                return -EXDEV;
        }
        /* Journaling quota? */
        if (EXT4_SB(sb)->s_qf_names[type]) {
                /* Quotafile not in fs root? */
-               if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode)
+               if (path.dentry->d_parent != sb->s_root)
                        printk(KERN_WARNING
                                "EXT4-fs: Quota file not on filesystem root. "
                                "Journaled quota will not work.\n");
@@ -3418,7 +3361,7 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
         * When we journal data on quota file, we have to flush journal to see
         * all updates to the file when we bypass pagecache...
         */
-       if (ext4_should_journal_data(nd.path.dentry->d_inode)) {
+       if (ext4_should_journal_data(path.dentry->d_inode)) {
                /*
                 * We don't need to lock updates but journal_flush() could
                 * otherwise be livelocked...
@@ -3427,13 +3370,13 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
                err = jbd2_journal_flush(EXT4_SB(sb)->s_journal);
                jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal);
                if (err) {
-                       path_put(&nd.path);
+                       path_put(&path);
                        return err;
                }
        }
 
-       err = vfs_quota_on_path(sb, type, format_id, &nd.path);
-       path_put(&nd.path);
+       err = vfs_quota_on_path(sb, type, format_id, &path);
+       path_put(&path);
        return err;
 }