]> git.ipfire.org Git - people/ms/linux.git/blobdiff - fs/zonefs/super.c
Merge branch 'for-6.0/dax' into libnvdimm-fixes
[people/ms/linux.git] / fs / zonefs / super.c
index 053299758deb98abfe8a2154dd14fb6e32646a07..860f0b1032c65c633d401e5f3652bb76600380c5 100644 (file)
@@ -60,8 +60,7 @@ static void zonefs_account_active(struct inode *inode)
        }
 }
 
-static inline int zonefs_zone_mgmt(struct inode *inode,
-                                  enum req_opf op)
+static inline int zonefs_zone_mgmt(struct inode *inode, enum req_op op)
 {
        struct zonefs_inode_info *zi = ZONEFS_I(inode);
        int ret;
@@ -232,13 +231,6 @@ static const struct iomap_writeback_ops zonefs_writeback_ops = {
        .map_blocks             = zonefs_write_map_blocks,
 };
 
-static int zonefs_writepage(struct page *page, struct writeback_control *wbc)
-{
-       struct iomap_writepage_ctx wpc = { };
-
-       return iomap_writepage(page, wbc, &wpc, &zonefs_writeback_ops);
-}
-
 static int zonefs_writepages(struct address_space *mapping,
                             struct writeback_control *wbc)
 {
@@ -266,12 +258,11 @@ static int zonefs_swap_activate(struct swap_info_struct *sis,
 static const struct address_space_operations zonefs_file_aops = {
        .read_folio             = zonefs_read_folio,
        .readahead              = zonefs_readahead,
-       .writepage              = zonefs_writepage,
        .writepages             = zonefs_writepages,
        .dirty_folio            = filemap_dirty_folio,
        .release_folio          = iomap_release_folio,
        .invalidate_folio       = iomap_invalidate_folio,
-       .migratepage            = iomap_migrate_page,
+       .migrate_folio          = filemap_migrate_folio,
        .is_partially_uptodate  = iomap_is_partially_uptodate,
        .error_remove_page      = generic_error_remove_page,
        .direct_IO              = noop_direct_IO,
@@ -525,7 +516,7 @@ static int zonefs_file_truncate(struct inode *inode, loff_t isize)
 {
        struct zonefs_inode_info *zi = ZONEFS_I(inode);
        loff_t old_isize;
-       enum req_opf op;
+       enum req_op op;
        int ret = 0;
 
        /*
@@ -616,7 +607,7 @@ static int zonefs_inode_setattr(struct user_namespace *mnt_userns,
             !uid_eq(iattr->ia_uid, inode->i_uid)) ||
            ((iattr->ia_valid & ATTR_GID) &&
             !gid_eq(iattr->ia_gid, inode->i_gid))) {
-               ret = dquot_transfer(inode, iattr);
+               ret = dquot_transfer(mnt_userns, inode, iattr);
                if (ret)
                        return ret;
        }
@@ -780,7 +771,7 @@ static ssize_t zonefs_file_dio_append(struct kiocb *iocb, struct iov_iter *from)
                        REQ_OP_ZONE_APPEND | REQ_SYNC | REQ_IDLE, GFP_NOFS);
        bio->bi_iter.bi_sector = zi->i_zsector;
        bio->bi_ioprio = iocb->ki_ioprio;
-       if (iocb->ki_flags & IOCB_DSYNC)
+       if (iocb_is_dsync(iocb))
                bio->bi_opf |= REQ_FUA;
 
        ret = bio_iov_iter_get_pages(bio, from);
@@ -1394,7 +1385,7 @@ static void zonefs_init_dir_inode(struct inode *parent, struct inode *inode,
 {
        struct super_block *sb = parent->i_sb;
 
-       inode->i_ino = blkdev_nr_zones(sb->s_bdev->bd_disk) + type + 1;
+       inode->i_ino = bdev_nr_zones(sb->s_bdev) + type + 1;
        inode_init_owner(&init_user_ns, inode, parent, S_IFDIR | 0555);
        inode->i_op = &zonefs_dir_inode_operations;
        inode->i_fop = &simple_dir_operations;
@@ -1540,7 +1531,7 @@ static int zonefs_create_zgroup(struct zonefs_zone_data *zd,
        /*
         * The first zone contains the super block: skip it.
         */
-       end = zd->zones + blkdev_nr_zones(sb->s_bdev->bd_disk);
+       end = zd->zones + bdev_nr_zones(sb->s_bdev);
        for (zone = &zd->zones[1]; zone < end; zone = next) {
 
                next = zone + 1;
@@ -1635,8 +1626,8 @@ static int zonefs_get_zone_info(struct zonefs_zone_data *zd)
        struct block_device *bdev = zd->sb->s_bdev;
        int ret;
 
-       zd->zones = kvcalloc(blkdev_nr_zones(bdev->bd_disk),
-                            sizeof(struct blk_zone), GFP_KERNEL);
+       zd->zones = kvcalloc(bdev_nr_zones(bdev), sizeof(struct blk_zone),
+                            GFP_KERNEL);
        if (!zd->zones)
                return -ENOMEM;
 
@@ -1648,9 +1639,9 @@ static int zonefs_get_zone_info(struct zonefs_zone_data *zd)
                return ret;
        }
 
-       if (ret != blkdev_nr_zones(bdev->bd_disk)) {
+       if (ret != bdev_nr_zones(bdev)) {
                zonefs_err(zd->sb, "Invalid zone report (%d/%u zones)\n",
-                          ret, blkdev_nr_zones(bdev->bd_disk));
+                          ret, bdev_nr_zones(bdev));
                return -EIO;
        }
 
@@ -1687,11 +1678,11 @@ static int zonefs_read_super(struct super_block *sb)
        if (ret)
                goto free_page;
 
-       super = kmap(page);
+       super = page_address(page);
 
        ret = -EINVAL;
        if (le32_to_cpu(super->s_magic) != ZONEFS_MAGIC)
-               goto unmap;
+               goto free_page;
 
        stored_crc = le32_to_cpu(super->s_crc);
        super->s_crc = 0;
@@ -1699,14 +1690,14 @@ static int zonefs_read_super(struct super_block *sb)
        if (crc != stored_crc) {
                zonefs_err(sb, "Invalid checksum (Expected 0x%08x, got 0x%08x)",
                           crc, stored_crc);
-               goto unmap;
+               goto free_page;
        }
 
        sbi->s_features = le64_to_cpu(super->s_features);
        if (sbi->s_features & ~ZONEFS_F_DEFINED_FEATURES) {
                zonefs_err(sb, "Unknown features set 0x%llx\n",
                           sbi->s_features);
-               goto unmap;
+               goto free_page;
        }
 
        if (sbi->s_features & ZONEFS_F_UID) {
@@ -1714,7 +1705,7 @@ static int zonefs_read_super(struct super_block *sb)
                                       le32_to_cpu(super->s_uid));
                if (!uid_valid(sbi->s_uid)) {
                        zonefs_err(sb, "Invalid UID feature\n");
-                       goto unmap;
+                       goto free_page;
                }
        }
 
@@ -1723,7 +1714,7 @@ static int zonefs_read_super(struct super_block *sb)
                                       le32_to_cpu(super->s_gid));
                if (!gid_valid(sbi->s_gid)) {
                        zonefs_err(sb, "Invalid GID feature\n");
-                       goto unmap;
+                       goto free_page;
                }
        }
 
@@ -1732,14 +1723,12 @@ static int zonefs_read_super(struct super_block *sb)
 
        if (memchr_inv(super->s_reserved, 0, sizeof(super->s_reserved))) {
                zonefs_err(sb, "Reserved area is being used\n");
-               goto unmap;
+               goto free_page;
        }
 
        import_uuid(&sbi->s_uuid, super->s_uuid);
        ret = 0;
 
-unmap:
-       kunmap(page);
 free_page:
        __free_page(page);
 
@@ -1816,8 +1805,7 @@ static int zonefs_fill_super(struct super_block *sb, void *data, int silent)
        if (ret)
                goto cleanup;
 
-       zonefs_info(sb, "Mounting %u zones",
-                   blkdev_nr_zones(sb->s_bdev->bd_disk));
+       zonefs_info(sb, "Mounting %u zones", bdev_nr_zones(sb->s_bdev));
 
        if (!sbi->s_max_wro_seq_files &&
            !sbi->s_max_active_seq_files &&
@@ -1833,7 +1821,7 @@ static int zonefs_fill_super(struct super_block *sb, void *data, int silent)
        if (!inode)
                goto cleanup;
 
-       inode->i_ino = blkdev_nr_zones(sb->s_bdev->bd_disk);
+       inode->i_ino = bdev_nr_zones(sb->s_bdev);
        inode->i_mode = S_IFDIR | 0555;
        inode->i_ctime = inode->i_mtime = inode->i_atime = current_time(inode);
        inode->i_op = &zonefs_dir_inode_operations;