iomap: inline data should be an iomap type, not a flag
Inline data is fundamentally different from our normal mapped case in that it doesn't even have a block address. So instead of having a flag for it it should be an entirely separate iomap range type. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
This commit is contained in:
committed by
Darrick J. Wong
parent
b3751e6ab4
commit
19319b5321
21
fs/iomap.c
21
fs/iomap.c
@@ -502,10 +502,13 @@ static int iomap_to_fiemap(struct fiemap_extent_info *fi,
|
||||
case IOMAP_DELALLOC:
|
||||
flags |= FIEMAP_EXTENT_DELALLOC | FIEMAP_EXTENT_UNKNOWN;
|
||||
break;
|
||||
case IOMAP_MAPPED:
|
||||
break;
|
||||
case IOMAP_UNWRITTEN:
|
||||
flags |= FIEMAP_EXTENT_UNWRITTEN;
|
||||
break;
|
||||
case IOMAP_MAPPED:
|
||||
case IOMAP_INLINE:
|
||||
flags |= FIEMAP_EXTENT_DATA_INLINE;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -513,8 +516,6 @@ static int iomap_to_fiemap(struct fiemap_extent_info *fi,
|
||||
flags |= FIEMAP_EXTENT_MERGED;
|
||||
if (iomap->flags & IOMAP_F_SHARED)
|
||||
flags |= FIEMAP_EXTENT_SHARED;
|
||||
if (iomap->flags & IOMAP_F_DATA_INLINE)
|
||||
flags |= FIEMAP_EXTENT_DATA_INLINE;
|
||||
|
||||
return fiemap_fill_next_extent(fi, iomap->offset,
|
||||
iomap->addr != IOMAP_NULL_ADDR ? iomap->addr : 0,
|
||||
@@ -1214,14 +1215,16 @@ static loff_t iomap_swapfile_activate_actor(struct inode *inode, loff_t pos,
|
||||
struct iomap_swapfile_info *isi = data;
|
||||
int error;
|
||||
|
||||
/* No inline data. */
|
||||
if (iomap->flags & IOMAP_F_DATA_INLINE) {
|
||||
switch (iomap->type) {
|
||||
case IOMAP_MAPPED:
|
||||
case IOMAP_UNWRITTEN:
|
||||
/* Only real or unwritten extents. */
|
||||
break;
|
||||
case IOMAP_INLINE:
|
||||
/* No inline data. */
|
||||
pr_err("swapon: file is inline\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Only real or unwritten extents. */
|
||||
if (iomap->type != IOMAP_MAPPED && iomap->type != IOMAP_UNWRITTEN) {
|
||||
default:
|
||||
pr_err("swapon: file has unallocated extents\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user