iomap: Switch from blkno to disk offset
Replace iomap->blkno, the sector number, with iomap->addr, the disk offset in bytes. For invalid disk offsets, use the special value IOMAP_NULL_ADDR instead of IOMAP_NULL_BLOCK. This allows to use iomap for mappings which are not block aligned, such as inline data on ext4. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> # iomap, xfs Reviewed-by: Jan Kara <jack@suse.cz>
This commit is contained in:

committed by
Theodore Ts'o

parent
9e66317d3c
commit
19fe5f643f
@@ -820,11 +820,11 @@ static int ext2_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
|
||||
|
||||
if (ret == 0) {
|
||||
iomap->type = IOMAP_HOLE;
|
||||
iomap->blkno = IOMAP_NULL_BLOCK;
|
||||
iomap->addr = IOMAP_NULL_ADDR;
|
||||
iomap->length = 1 << blkbits;
|
||||
} else {
|
||||
iomap->type = IOMAP_MAPPED;
|
||||
iomap->blkno = (sector_t)bno << (blkbits - 9);
|
||||
iomap->addr = (u64)bno << blkbits;
|
||||
iomap->length = (u64)ret << blkbits;
|
||||
iomap->flags |= IOMAP_F_MERGED;
|
||||
}
|
||||
|
Reference in New Issue
Block a user