linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yuxuan Shui <yshuiv7@gmail.com>
To: viro@zeniv.linux.org.uk
Cc: linux-fsdevel@vger.kernel.org, Yuxuan Shui <yshuiv7@gmail.com>
Subject: [PATCH] iomap: iomap_bmap should accept unwritten maps
Date: Tue,  5 May 2020 19:36:08 +0100	[thread overview]
Message-ID: <20200505183608.10280-1-yshuiv7@gmail.com> (raw)

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.

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 18:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-05 18:36 Yuxuan Shui [this message]
2020-05-05 19:30 ` [PATCH] iomap: iomap_bmap should accept unwritten maps Darrick J. Wong
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=20200505183608.10280-1-yshuiv7@gmail.com \
    --to=yshuiv7@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).