Merge tag 'ext4_for_linus-6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / fs / ext4 / super.c
index 3585ecabe7344bd7be45c3eec1084aca4779a144..cfb8449c731f9ac53fb3add808e13493175508c4 100644 (file)
@@ -1359,14 +1359,14 @@ static void ext4_put_super(struct super_block *sb)
 
        sync_blockdev(sb->s_bdev);
        invalidate_bdev(sb->s_bdev);
-       if (sbi->s_journal_bdev_handle) {
+       if (sbi->s_journal_bdev_file) {
                /*
                 * Invalidate the journal device's buffers.  We don't want them
                 * floating about in memory - the physical journal device may
                 * hotswapped, and it breaks the `ro-after' testing code.
                 */
-               sync_blockdev(sbi->s_journal_bdev_handle->bdev);
-               invalidate_bdev(sbi->s_journal_bdev_handle->bdev);
+               sync_blockdev(file_bdev(sbi->s_journal_bdev_file));
+               invalidate_bdev(file_bdev(sbi->s_journal_bdev_file));
        }
 
        ext4_xattr_destroy_cache(sbi->s_ea_inode_cache);
@@ -1500,7 +1500,7 @@ static int __init init_inodecache(void)
 {
        ext4_inode_cachep = kmem_cache_create_usercopy("ext4_inode_cache",
                                sizeof(struct ext4_inode_info), 0,
-                               SLAB_RECLAIM_ACCOUNT|SLAB_ACCOUNT,
+                               SLAB_RECLAIM_ACCOUNT | SLAB_ACCOUNT,
                                offsetof(struct ext4_inode_info, i_data),
                                sizeof_field(struct ext4_inode_info, i_data),
                                init_once);
@@ -1599,7 +1599,7 @@ 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 struct dquot **ext4_get_dquots(struct inode *inode)
+static struct dquot __rcu **ext4_get_dquots(struct inode *inode)
 {
        return EXT4_I(inode)->i_dquot;
 }
@@ -4232,7 +4232,7 @@ int ext4_calculate_overhead(struct super_block *sb)
         * Add the internal journal blocks whether the journal has been
         * loaded or not
         */
-       if (sbi->s_journal && !sbi->s_journal_bdev_handle)
+       if (sbi->s_journal && !sbi->s_journal_bdev_file)
                overhead += EXT4_NUM_B2C(sbi, sbi->s_journal->j_total_len);
        else if (ext4_has_feature_journal(sb) && !sbi->s_journal && j_inum) {
                /* j_inum for internal journal is non-zero */
@@ -5341,7 +5341,7 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
                sb->s_qcop = &ext4_qctl_operations;
        sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP | QTYPE_MASK_PRJ;
 #endif
-       memcpy(&sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));
+       super_set_uuid(sb, es->s_uuid, sizeof(es->s_uuid));
 
        INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */
        mutex_init(&sbi->s_orphan_lock);
@@ -5479,6 +5479,7 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
                goto failed_mount4;
        }
 
+       generic_set_sb_d_ops(sb);
        sb->s_root = d_make_root(root);
        if (!sb->s_root) {
                ext4_msg(sb, KERN_ERR, "get root dentry failed");
@@ -5665,9 +5666,9 @@ failed_mount:
 #endif
        fscrypt_free_dummy_policy(&sbi->s_dummy_enc_policy);
        brelse(sbi->s_sbh);
-       if (sbi->s_journal_bdev_handle) {
-               invalidate_bdev(sbi->s_journal_bdev_handle->bdev);
-               bdev_release(sbi->s_journal_bdev_handle);
+       if (sbi->s_journal_bdev_file) {
+               invalidate_bdev(file_bdev(sbi->s_journal_bdev_file));
+               fput(sbi->s_journal_bdev_file);
        }
 out_fail:
        invalidate_bdev(sb->s_bdev);
@@ -5837,30 +5838,30 @@ static journal_t *ext4_open_inode_journal(struct super_block *sb,
        return journal;
 }
 
-static struct bdev_handle *ext4_get_journal_blkdev(struct super_block *sb,
+static struct file *ext4_get_journal_blkdev(struct super_block *sb,
                                        dev_t j_dev, ext4_fsblk_t *j_start,
                                        ext4_fsblk_t *j_len)
 {
        struct buffer_head *bh;
        struct block_device *bdev;
-       struct bdev_handle *bdev_handle;
+       struct file *bdev_file;
        int hblock, blocksize;
        ext4_fsblk_t sb_block;
        unsigned long offset;
        struct ext4_super_block *es;
        int errno;
 
-       bdev_handle = bdev_open_by_dev(j_dev,
+       bdev_file = bdev_file_open_by_dev(j_dev,
                BLK_OPEN_READ | BLK_OPEN_WRITE | BLK_OPEN_RESTRICT_WRITES,
                sb, &fs_holder_ops);
-       if (IS_ERR(bdev_handle)) {
+       if (IS_ERR(bdev_file)) {
                ext4_msg(sb, KERN_ERR,
                         "failed to open journal device unknown-block(%u,%u) %ld",
-                        MAJOR(j_dev), MINOR(j_dev), PTR_ERR(bdev_handle));
-               return bdev_handle;
+                        MAJOR(j_dev), MINOR(j_dev), PTR_ERR(bdev_file));
+               return bdev_file;
        }
 
-       bdev = bdev_handle->bdev;
+       bdev = file_bdev(bdev_file);
        blocksize = sb->s_blocksize;
        hblock = bdev_logical_block_size(bdev);
        if (blocksize < hblock) {
@@ -5907,12 +5908,12 @@ static struct bdev_handle *ext4_get_journal_blkdev(struct super_block *sb,
        *j_start = sb_block + 1;
        *j_len = ext4_blocks_count(es);
        brelse(bh);
-       return bdev_handle;
+       return bdev_file;
 
 out_bh:
        brelse(bh);
 out_bdev:
-       bdev_release(bdev_handle);
+       fput(bdev_file);
        return ERR_PTR(errno);
 }
 
@@ -5922,14 +5923,14 @@ static journal_t *ext4_open_dev_journal(struct super_block *sb,
        journal_t *journal;
        ext4_fsblk_t j_start;
        ext4_fsblk_t j_len;
-       struct bdev_handle *bdev_handle;
+       struct file *bdev_file;
        int errno = 0;
 
-       bdev_handle = ext4_get_journal_blkdev(sb, j_dev, &j_start, &j_len);
-       if (IS_ERR(bdev_handle))
-               return ERR_CAST(bdev_handle);
+       bdev_file = ext4_get_journal_blkdev(sb, j_dev, &j_start, &j_len);
+       if (IS_ERR(bdev_file))
+               return ERR_CAST(bdev_file);
 
-       journal = jbd2_journal_init_dev(bdev_handle->bdev, sb->s_bdev, j_start,
+       journal = jbd2_journal_init_dev(file_bdev(bdev_file), sb->s_bdev, j_start,
                                        j_len, sb->s_blocksize);
        if (IS_ERR(journal)) {
                ext4_msg(sb, KERN_ERR, "failed to create device journal");
@@ -5944,14 +5945,14 @@ static journal_t *ext4_open_dev_journal(struct super_block *sb,
                goto out_journal;
        }
        journal->j_private = sb;
-       EXT4_SB(sb)->s_journal_bdev_handle = bdev_handle;
+       EXT4_SB(sb)->s_journal_bdev_file = bdev_file;
        ext4_init_journal_params(sb, journal);
        return journal;
 
 out_journal:
        jbd2_journal_destroy(journal);
 out_bdev:
-       bdev_release(bdev_handle);
+       fput(bdev_file);
        return ERR_PTR(errno);
 }
 
@@ -7321,12 +7322,12 @@ static inline int ext3_feature_set_ok(struct super_block *sb)
 static void ext4_kill_sb(struct super_block *sb)
 {
        struct ext4_sb_info *sbi = EXT4_SB(sb);
-       struct bdev_handle *handle = sbi ? sbi->s_journal_bdev_handle : NULL;
+       struct file *bdev_file = sbi ? sbi->s_journal_bdev_file : NULL;
 
        kill_block_super(sb);
 
-       if (handle)
-               bdev_release(handle);
+       if (bdev_file)
+               fput(bdev_file);
 }
 
 static struct file_system_type ext4_fs_type = {