Linux filesystem development
 help / color / mirror / Atom feed
* [PATCH] iomap: iomap_bmap should accept unwritten maps
@ 2020-05-05 18:36 Yuxuan Shui
  2020-05-05 19:30 ` Darrick J. Wong
  0 siblings, 1 reply; 11+ messages in thread
From: Yuxuan Shui @ 2020-05-05 18:36 UTC (permalink / raw)
  To: viro; +Cc: linux-fsdevel, Yuxuan Shui

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


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-08-25 18:01 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-05 18:36 [PATCH] iomap: iomap_bmap should accept unwritten maps Yuxuan Shui
2020-05-05 19:30 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox