Re: [PATCH] ext4: Implement swap_activate aops using iomap

From: Christoph Hellwig
Date: Mon Sep 07 2020 - 03:13:14 EST


On Fri, Sep 04, 2020 at 02:46:53PM +0530, Ritesh Harjani wrote:
> After moving ext4's bmap to iomap interface, swapon functionality
> on files created using fallocate (which creates unwritten extents) are
> failing. This is since iomap_bmap interface returns 0 for unwritten
> extents and thus generic_swapfile_activate considers this as holes
> and hence bail out with below kernel msg :-
>
> [340.915835] swapon: swapfile has holes
>
> To fix this we need to implement ->swap_activate aops in ext4
> which will use ext4_iomap_report_ops. Since we only need to return
> the list of extents so ext4_iomap_report_ops should be enough.

Looks good,

Reviewed-by: Christoph Hellwig <hch@xxxxxx>