Re: [PATCH 27/32] nilfs2: Convert to use blkdev_get_handle_by_path()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 4, 2023 at 9:24 PM Jan Kara wrote:
>
> Convert nilfs2 to use blkdev_get_handle_by_path() and initialize the
> superblock with the handle.
>
> CC: linux-nilfs@xxxxxxxxxxxxxxx
> Signed-off-by: Jan Kara <jack@xxxxxxx>
> ---
>  fs/nilfs2/super.c | 21 ++++++++++++---------
>  1 file changed, 12 insertions(+), 9 deletions(-)

Acked-by: Ryusuke Konishi <konishi.ryusuke@xxxxxxxxx>

You may revise this patch to reflect comments on the patch 1/32, but
the changes here look fine, and I have no objection to rewriting to
use bdev_handle.

Thanks,
Ryusuke Konishi




>
> diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
> index 0ef8c71bde8e..0aba0daa06d2 100644
> --- a/fs/nilfs2/super.c
> +++ b/fs/nilfs2/super.c
> @@ -1283,14 +1283,15 @@ static int nilfs_identify(char *data, struct nilfs_super_data *sd)
>
>  static int nilfs_set_bdev_super(struct super_block *s, void *data)
>  {
> -       s->s_bdev = data;
> +       s->s_bdev_handle = data;
> +       s->s_bdev = s->s_bdev_handle->bdev;
>         s->s_dev = s->s_bdev->bd_dev;
>         return 0;
>  }
>
>  static int nilfs_test_bdev_super(struct super_block *s, void *data)
>  {
> -       return (void *)s->s_bdev == data;
> +       return s->s_bdev == ((struct bdev_handle *)data)->bdev;
>  }
>
>  static struct dentry *
> @@ -1298,15 +1299,17 @@ nilfs_mount(struct file_system_type *fs_type, int flags,
>              const char *dev_name, void *data)
>  {
>         struct nilfs_super_data sd;
> +       struct bdev_handle *bdev_handle;
>         struct super_block *s;
>         struct dentry *root_dentry;
>         int err, s_new = false;
>
> -       sd.bdev = blkdev_get_by_path(dev_name, sb_open_mode(flags), fs_type,
> -                                    NULL);
> -       if (IS_ERR(sd.bdev))
> -               return ERR_CAST(sd.bdev);
> +       bdev_handle = blkdev_get_handle_by_path(dev_name, sb_open_mode(flags),
> +                               fs_type, NULL);
> +       if (IS_ERR(bdev_handle))
> +               return ERR_CAST(bdev_handle);
>
> +       sd.bdev = bdev_handle->bdev;
>         sd.cno = 0;
>         sd.flags = flags;
>         if (nilfs_identify((char *)data, &sd)) {
> @@ -1326,7 +1329,7 @@ nilfs_mount(struct file_system_type *fs_type, int flags,
>                 goto failed;
>         }
>         s = sget(fs_type, nilfs_test_bdev_super, nilfs_set_bdev_super, flags,
> -                sd.bdev);
> +                bdev_handle);
>         mutex_unlock(&sd.bdev->bd_fsfreeze_mutex);
>         if (IS_ERR(s)) {
>                 err = PTR_ERR(s);
> @@ -1374,7 +1377,7 @@ nilfs_mount(struct file_system_type *fs_type, int flags,
>         }
>
>         if (!s_new)
> -               blkdev_put(sd.bdev, fs_type);
> +               blkdev_handle_put(bdev_handle);
>
>         return root_dentry;
>
> @@ -1383,7 +1386,7 @@ nilfs_mount(struct file_system_type *fs_type, int flags,
>
>   failed:
>         if (!s_new)
> -               blkdev_put(sd.bdev, fs_type);
> +               blkdev_handle_put(bdev_handle);
>         return ERR_PTR(err);
>  }
>
> --
> 2.35.3
>




[Index of Archives]     [Linux Filesystem Development]     [Linux BTRFS]     [Linux CIFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux