Linux filesystem development
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Yuxuan Shui <yshuiv7@gmail.com>
Cc: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] iomap: iomap_bmap should accept unwritten maps
Date: Tue, 5 May 2020 12:30:49 -0700	[thread overview]
Message-ID: <20200505193049.GC5694@magnolia> (raw)
In-Reply-To: <20200505183608.10280-1-yshuiv7@gmail.com>

On Tue, May 05, 2020 at 07:36:08PM +0100, Yuxuan Shui wrote:
> commit ac58e4fb03f9d111d733a4ad379d06eef3a24705 moved ext4_bmap from
> generic_block_bmap to iomap_bmap, this introduced a regression which
> prevents some user from using previously working swapfiles. The kernel
> will complain about holes while there is none.
> 
> What is happening here is that the swapfile has unwritten mappings,
> which is rejected by iomap_bmap, but was accepted by ext4_get_block.

...which is why ext4 ought to use iomap_swapfile_activate.

--D

> This commit makes sure iomap_bmap would accept unwritten mappings as
> well.
> 
> Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
> ---
>  fs/iomap/fiemap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/iomap/fiemap.c b/fs/iomap/fiemap.c
> index d55e8f491a5e..fb488dcfa8c7 100644
> --- a/fs/iomap/fiemap.c
> +++ b/fs/iomap/fiemap.c
> @@ -115,7 +115,7 @@ iomap_bmap_actor(struct inode *inode, loff_t pos, loff_t length,
>  {
>  	sector_t *bno = data, addr;
>  
> -	if (iomap->type == IOMAP_MAPPED) {
> +	if (iomap->type == IOMAP_MAPPED || iomap->type == IOMAP_UNWRITTEN) {
>  		addr = (pos - iomap->offset + iomap->addr) >> inode->i_blkbits;
>  		*bno = addr;
>  	}
> -- 
> 2.26.2
> 

  reply	other threads:[~2020-05-05 19:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-05 18:36 [PATCH] iomap: iomap_bmap should accept unwritten maps Yuxuan Shui
2020-05-05 19:30 ` Darrick J. Wong [this message]
2020-08-25  9:26   ` Yuxuan Shui
2020-08-25 10:20     ` Christoph Hellwig
2020-08-25 10:40       ` Yuxuan Shui
2020-08-25 11:21         ` Christoph Hellwig
2020-08-25 11:27         ` Ritesh Harjani
2020-08-25 12:36   ` Ritesh Harjani
2020-08-25 15:49     ` Darrick J. Wong
2020-08-25 18:00       ` Ritesh Harjani
2020-08-25 15:54     ` Yuxuan Shui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200505193049.GC5694@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=yshuiv7@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox