Skip to content

Commit e33f42b

Browse files
committed
erofs: fix fsdax partition offset handling
After seeking time on testing today upstream fsdax, I found it actually doesn't work well as below: [ 186.492983] ------------[ cut here ]------------ [ 186.493629] WARNING: CPU: 1 PID: 205 at fs/iomap/iter.c:33 iomap_iter+0x2f6/0x310 The problem is that m_dax_part_off should be applied to physical addresses and very sorry about that I didn't catch this eariler. Anyway, let's fix it up now. Also, I need to find a way to set up a standalone testcase to look after this later. Link: https://lore.kernel.org/r/20220113051845.244461-1-hsiangkao@linux.alibaba.com Fixes: de20511 ("fsdax: shift partition offset handling into the file systems") Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
1 parent e783362 commit e33f42b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

fs/erofs/data.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,10 @@ static int erofs_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
252252
return ret;
253253

254254
iomap->offset = map.m_la;
255-
if (flags & IOMAP_DAX) {
255+
if (flags & IOMAP_DAX)
256256
iomap->dax_dev = mdev.m_daxdev;
257-
iomap->offset += mdev.m_dax_part_off;
258-
} else {
257+
else
259258
iomap->bdev = mdev.m_bdev;
260-
}
261259
iomap->length = map.m_llen;
262260
iomap->flags = 0;
263261
iomap->private = NULL;
@@ -284,6 +282,8 @@ static int erofs_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
284282
} else {
285283
iomap->type = IOMAP_MAPPED;
286284
iomap->addr = mdev.m_pa;
285+
if (flags & IOMAP_DAX)
286+
iomap->addr += mdev.m_dax_part_off;
287287
}
288288
return 0;
289289
}

0 commit comments

Comments
 (0)