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:
Andreas Gruenbacher
2017-10-01 17:55:54 -04:00
committed by Theodore Ts'o
parent 9e66317d3c
commit 19fe5f643f
8 changed files with 22 additions and 23 deletions

View File

@@ -15,8 +15,8 @@ struct vm_fault;
*/
#define IOMAP_HOLE 0x01 /* no blocks allocated, need allocation */
#define IOMAP_DELALLOC 0x02 /* delayed allocation blocks */
#define IOMAP_MAPPED 0x03 /* blocks allocated @blkno */
#define IOMAP_UNWRITTEN 0x04 /* blocks allocated @blkno in unwritten state */
#define IOMAP_MAPPED 0x03 /* blocks allocated at @addr */
#define IOMAP_UNWRITTEN 0x04 /* blocks allocated at @addr in unwritten state */
/*
* Flags for all iomap mappings:
@@ -30,12 +30,12 @@ struct vm_fault;
#define IOMAP_F_SHARED 0x20 /* block shared with another file */
/*
* Magic value for blkno:
* Magic value for addr:
*/
#define IOMAP_NULL_BLOCK -1LL /* blkno is not valid */
#define IOMAP_NULL_ADDR -1ULL /* addr is not valid */
struct iomap {
sector_t blkno; /* 1st sector of mapping, 512b units */
u64 addr; /* disk offset of mapping, bytes */
loff_t offset; /* file offset of mapping, bytes */
u64 length; /* length of mapping, bytes */
u16 type; /* type of mapping */