Skip to contentSkip to conversation

erofs: fix fsdax partition offset handling

PATCH In review Gao Xiang 3 participants 5 messages Jan 13, 2022 – Jan 24, 2022 EROFS file system

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/1 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.

Fixes de2051147771 ("fsdax: shift partition offset handling into the file systems")
---
 fs/erofs/data.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
fs/erofs/data.c +4 -4
index fa7ddb7ad980..226a57c57ee6 100644
@@ -252,12 +252,10 @@ static int erofs_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
 		return ret;
 
 	iomap->offset = map.m_la;
-	if (flags & IOMAP_DAX) {
+	if (flags & IOMAP_DAX)
 		iomap->dax_dev = mdev.m_daxdev;
-		iomap->offset += mdev.m_dax_part_off;
-	} else {
+	else
 		iomap->bdev = mdev.m_bdev;
-	}
 	iomap->length = map.m_llen;
 	iomap->flags = 0;
 	iomap->private = NULL;
@@ -284,6 +282,8 @@ static int erofs_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
 	} else {
 		iomap->type = IOMAP_MAPPED;
 		iomap->addr = mdev.m_pa;
+		if (flags & IOMAP_DAX)
+			iomap->addr += mdev.m_dax_part_off;
 	}
 	return 0;
 }
Signature · 1 line
2.24.4
maintainer Reviewed-by on v1 1/1
#3 lore raw
In reply to Gao Xiang
Quoted 6 lines · Gao Xiang

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
Quoted 8 lines

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.

Fixes de2051147771 ("fsdax: shift partition offset handling into the file systems")

Thanks,

author
#4 lore raw
Quoted 10 lines · Chao Yu
Quoted 9 lines · Gao Xiang

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.

Quoted 7 lines
Quoted 5 lines

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.

Fixes de2051147771 ("fsdax: shift partition offset handling into the file systems")

Thanks for the review! I will send this together with other misc fixes this or next week..

Thanks,
Gao Xiang

Quoted 2 lines

Thanks,