On Tue, May 12, 2026 at 07:35:22AM +0200, Christoph Hellwig wrote:
> Make use of the abstractions we have.  This is a preparation for
> moving more special casing down into block/.
> 
> Signed-off-by: Christoph Hellwig <[email protected]>

Nice straightforward hoist.

Reviewed-by: "Darrick J. Wong" <[email protected]>

--D

> ---
>  block/fops.c  | 6 ++++++
>  mm/swapfile.c | 5 -----
>  2 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/block/fops.c b/block/fops.c
> index bb6642b45937..453141801684 100644
> --- a/block/fops.c
> +++ b/block/fops.c
> @@ -949,6 +949,11 @@ static int blkdev_mmap_prepare(struct vm_area_desc *desc)
>       return generic_file_mmap_prepare(desc);
>  }
>  
> +static int blkdev_swap_activate(struct file *file, struct swap_info_struct 
> *sis)
> +{
> +     return add_swap_extent(sis, sis->max, 0);
> +}
> +
>  const struct file_operations def_blk_fops = {
>       .open           = blkdev_open,
>       .release        = blkdev_release,
> @@ -965,6 +970,7 @@ const struct file_operations def_blk_fops = {
>       .splice_read    = filemap_splice_read,
>       .splice_write   = iter_file_splice_write,
>       .fallocate      = blkdev_fallocate,
> +     .swap_activate  = blkdev_swap_activate,
>       .uring_cmd      = blkdev_uring_cmd,
>       .fop_flags      = FOP_BUFFER_RASYNC,
>  };
> diff --git a/mm/swapfile.c b/mm/swapfile.c
> index 1b7fc03612f4..fbf11c8c5c69 100644
> --- a/mm/swapfile.c
> +++ b/mm/swapfile.c
> @@ -2781,13 +2781,8 @@ EXPORT_SYMBOL_GPL(add_swap_extent);
>  static int setup_swap_extents(struct swap_info_struct *sis,
>                             struct file *swap_file)
>  {
> -     struct address_space *mapping = swap_file->f_mapping;
> -     struct inode *inode = mapping->host;
>       int ret, error = 0;
>  
> -     if (S_ISBLK(inode->i_mode))
> -             return add_swap_extent(sis, sis->max, 0);
> -
>       if (swap_file->f_op->swap_activate)
>               ret = swap_file->f_op->swap_activate(swap_file, sis);
>       else
> -- 
> 2.53.0
> 
> 


_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to