diff options
| author | Gao Xiang <hsiangkao@linux.alibaba.com> | 2025-07-16 17:22:54 +0800 |
|---|---|---|
| committer | Gao Xiang <hsiangkao@linux.alibaba.com> | 2025-07-24 19:42:06 +0800 |
| commit | f768685427c073d46887d78423882e2771276705 (patch) | |
| tree | fe5e83c9f5e021299ea891bd32cca38032b0ad21 /fs/erofs | |
| parent | df50848bcd9f17e4e60e6d5823d0e8fe8982bbab (diff) | |
| download | linux-f768685427c073d46887d78423882e2771276705.tar.gz linux-f768685427c073d46887d78423882e2771276705.tar.bz2 linux-f768685427c073d46887d78423882e2771276705.zip | |
erofs: refine erofs_iomap_begin()
- Avoid calling erofs_map_dev() for unmapped extents;
- Assign `iomap->addr` for inline extents too (since they have physical
location).
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20250716092254.3826715-1-hsiangkao@linux.alibaba.com
Diffstat (limited to 'fs/erofs')
| -rw-r--r-- | fs/erofs/data.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/fs/erofs/data.c b/fs/erofs/data.c index dd7d86809c18..383c1337e157 100644 --- a/fs/erofs/data.c +++ b/fs/erofs/data.c @@ -269,6 +269,16 @@ static int erofs_iomap_begin(struct inode *inode, loff_t offset, loff_t length, if (ret < 0) return ret; + iomap->offset = map.m_la; + iomap->length = map.m_llen; + iomap->flags = 0; + iomap->private = NULL; + if (!(map.m_flags & EROFS_MAP_MAPPED)) { + iomap->type = IOMAP_HOLE; + iomap->addr = IOMAP_NULL_ADDR; + return 0; + } + mdev = (struct erofs_map_dev) { .m_deviceid = map.m_deviceid, .m_pa = map.m_pa, @@ -277,22 +287,14 @@ static int erofs_iomap_begin(struct inode *inode, loff_t offset, loff_t length, if (ret) return ret; - iomap->offset = map.m_la; if (flags & IOMAP_DAX) iomap->dax_dev = mdev.m_dif->dax_dev; else iomap->bdev = mdev.m_bdev; - iomap->length = map.m_llen; - iomap->flags = 0; - iomap->private = NULL; - if (!(map.m_flags & EROFS_MAP_MAPPED)) { - iomap->type = IOMAP_HOLE; - iomap->addr = IOMAP_NULL_ADDR; - if (!iomap->length) - iomap->length = length; - return 0; - } + iomap->addr = mdev.m_dif->fsoff + mdev.m_pa; + if (flags & IOMAP_DAX) + iomap->addr += mdev.m_dif->dax_part_off; if (map.m_flags & EROFS_MAP_META) { void *ptr; @@ -306,9 +308,6 @@ static int erofs_iomap_begin(struct inode *inode, loff_t offset, loff_t length, iomap->private = buf.base; } else { iomap->type = IOMAP_MAPPED; - iomap->addr = mdev.m_dif->fsoff + mdev.m_pa; - if (flags & IOMAP_DAX) - iomap->addr += mdev.m_dif->dax_part_off; } return 0; } |
