]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - fs/ext4/super.c
Merge tag 'upstream-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs
[linux.git] / fs / ext4 / super.c
index b3cbf8622eab60a2a574f3aae9ecb91beb5bcc2f..1d82b56d9b11f362b35582ab0f804a5ca44f0189 100644 (file)
@@ -1172,9 +1172,9 @@ void ext4_clear_inode(struct inode *inode)
 {
        invalidate_inode_buffers(inode);
        clear_inode(inode);
-       dquot_drop(inode);
        ext4_discard_preallocations(inode);
        ext4_es_remove_extent(inode, 0, EXT_MAX_BLOCKS);
+       dquot_drop(inode);
        if (EXT4_I(inode)->jinode) {
                jbd2_journal_release_jbd_inode(EXT4_JOURNAL(inode),
                                               EXT4_I(inode)->jinode);
@@ -1388,7 +1388,6 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type,
 static int ext4_quota_enable(struct super_block *sb, int type, int format_id,
                             unsigned int flags);
 static int ext4_enable_quotas(struct super_block *sb);
-static int ext4_get_next_id(struct super_block *sb, struct kqid *qid);
 
 static struct dquot **ext4_get_dquots(struct inode *inode)
 {
@@ -1406,7 +1405,7 @@ static const struct dquot_operations ext4_quota_operations = {
        .destroy_dquot          = dquot_destroy,
        .get_projid             = ext4_get_projid,
        .get_inode_usage        = ext4_get_inode_usage,
-       .get_next_id            = ext4_get_next_id,
+       .get_next_id            = dquot_get_next_id,
 };
 
 static const struct quotactl_ops ext4_qctl_operations = {
@@ -2065,7 +2064,7 @@ static int parse_options(char *options, struct super_block *sb,
                         unsigned int *journal_ioprio,
                         int is_remount)
 {
-       struct ext4_sb_info *sbi = EXT4_SB(sb);
+       struct ext4_sb_info __maybe_unused *sbi = EXT4_SB(sb);
        char *p, __maybe_unused *usr_qf_name, __maybe_unused *grp_qf_name;
        substring_t args[MAX_OPT_ARGS];
        int token;
@@ -2119,16 +2118,6 @@ static int parse_options(char *options, struct super_block *sb,
                }
        }
 #endif
-       if (test_opt(sb, DIOREAD_NOLOCK)) {
-               int blocksize =
-                       BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size);
-
-               if (blocksize < PAGE_SIZE) {
-                       ext4_msg(sb, KERN_ERR, "can't mount with "
-                                "dioread_nolock if block size != PAGE_SIZE");
-                       return 0;
-               }
-       }
        return 1;
 }
 
@@ -3569,12 +3558,15 @@ static void ext4_clamp_want_extra_isize(struct super_block *sb)
 {
        struct ext4_sb_info *sbi = EXT4_SB(sb);
        struct ext4_super_block *es = sbi->s_es;
+       unsigned def_extra_isize = sizeof(struct ext4_inode) -
+                                               EXT4_GOOD_OLD_INODE_SIZE;
 
-       /* determine the minimum size of new large inodes, if present */
-       if (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE &&
-           sbi->s_want_extra_isize == 0) {
-               sbi->s_want_extra_isize = sizeof(struct ext4_inode) -
-                                                    EXT4_GOOD_OLD_INODE_SIZE;
+       if (sbi->s_inode_size == EXT4_GOOD_OLD_INODE_SIZE) {
+               sbi->s_want_extra_isize = 0;
+               return;
+       }
+       if (sbi->s_want_extra_isize < 4) {
+               sbi->s_want_extra_isize = def_extra_isize;
                if (ext4_has_feature_extra_isize(sb)) {
                        if (sbi->s_want_extra_isize <
                            le16_to_cpu(es->s_want_extra_isize))
@@ -3587,10 +3579,10 @@ static void ext4_clamp_want_extra_isize(struct super_block *sb)
                }
        }
        /* Check if enough inode space is available */
-       if (EXT4_GOOD_OLD_INODE_SIZE + sbi->s_want_extra_isize >
-                                                       sbi->s_inode_size) {
-               sbi->s_want_extra_isize = sizeof(struct ext4_inode) -
-                                                      EXT4_GOOD_OLD_INODE_SIZE;
+       if ((sbi->s_want_extra_isize > sbi->s_inode_size) ||
+           (EXT4_GOOD_OLD_INODE_SIZE + sbi->s_want_extra_isize >
+                                                       sbi->s_inode_size)) {
+               sbi->s_want_extra_isize = def_extra_isize;
                ext4_msg(sb, KERN_INFO,
                         "required extra inode space not available");
        }
@@ -4453,13 +4445,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
                }
        }
 
-       if ((DUMMY_ENCRYPTION_ENABLED(sbi) || ext4_has_feature_encrypt(sb)) &&
-           (blocksize != PAGE_SIZE)) {
-               ext4_msg(sb, KERN_ERR,
-                        "Unsupported blocksize for fs encryption");
-               goto failed_mount_wq;
-       }
-
        if (ext4_has_feature_verity(sb) && blocksize != PAGE_SIZE) {
                ext4_msg(sb, KERN_ERR, "Unsupported blocksize for fs-verity");
                goto failed_mount_wq;
@@ -5849,7 +5834,7 @@ static int ext4_quota_enable(struct super_block *sb, int type, int format_id,
        /* Don't account quota for quota files to avoid recursion */
        qf_inode->i_flags |= S_NOQUOTA;
        lockdep_set_quota_inode(qf_inode, I_DATA_SEM_QUOTA);
-       err = dquot_enable(qf_inode, type, format_id, flags);
+       err = dquot_load_quota_inode(qf_inode, type, format_id, flags);
        if (err)
                lockdep_set_quota_inode(qf_inode, I_DATA_SEM_NORMAL);
        iput(qf_inode);
@@ -6033,18 +6018,6 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type,
        }
        return len;
 }
-
-static int ext4_get_next_id(struct super_block *sb, struct kqid *qid)
-{
-       const struct quota_format_ops   *ops;
-
-       if (!sb_has_quota_loaded(sb, qid->type))
-               return -ESRCH;
-       ops = sb_dqopt(sb)->ops[qid->type];
-       if (!ops || !ops->get_next_id)
-               return -ENOSYS;
-       return dquot_get_next_id(sb, qid);
-}
 #endif
 
 static struct dentry *ext4_mount(struct file_system_type *fs_type, int flags,