mirror of
https://github.com/torvalds/linux.git
synced 2026-09-12 12:34:02 +02:00
xfs: factor out a xfs_iomap_set_anon_write helper
De-duplicate the iomap setup for zoned writes. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Hans Holmberg <hans.holmberg@wdc.com> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Signed-off-by: Carlos Maiolino <cem@kernel.org>
This commit is contained in:
parent
4bc67fc800
commit
0510346e8e
|
|
@ -633,12 +633,8 @@ xfs_zoned_map_blocks(
|
|||
XFS_BMAPI_REMAP);
|
||||
xfs_iunlock(ip, XFS_ILOCK_EXCL);
|
||||
|
||||
wpc->iomap.type = IOMAP_MAPPED;
|
||||
wpc->iomap.bdev = mp->m_rtdev_targp->bt_bdev;
|
||||
wpc->iomap.offset = offset;
|
||||
wpc->iomap.length = XFS_FSB_TO_B(mp, count_fsb);
|
||||
wpc->iomap.flags = IOMAP_F_ANON_WRITE | IOMAP_F_DIRTY;
|
||||
|
||||
xfs_iomap_set_anon_write(ip, &wpc->iomap, offset,
|
||||
XFS_FSB_TO_B(mp, count_fsb));
|
||||
trace_xfs_zoned_map_blocks(ip, offset, wpc->iomap.length);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1083,11 +1083,7 @@ xfs_zoned_direct_write_iomap_begin(
|
|||
return error;
|
||||
}
|
||||
|
||||
iomap->type = IOMAP_MAPPED;
|
||||
iomap->bdev = ip->i_mount->m_rtdev_targp->bt_bdev;
|
||||
iomap->offset = offset;
|
||||
iomap->length = length;
|
||||
iomap->flags = IOMAP_F_ANON_WRITE | IOMAP_F_DIRTY;
|
||||
xfs_iomap_set_anon_write(ip, iomap, offset, length);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,20 @@ int xfs_zero_range(struct xfs_inode *ip, loff_t pos, loff_t len,
|
|||
int xfs_truncate_page(struct xfs_inode *ip, loff_t pos,
|
||||
struct xfs_zone_alloc_ctx *ac, bool *did_zero);
|
||||
|
||||
static inline void
|
||||
xfs_iomap_set_anon_write(
|
||||
struct xfs_inode *ip,
|
||||
struct iomap *iomap,
|
||||
loff_t offset,
|
||||
loff_t length)
|
||||
{
|
||||
iomap->type = IOMAP_MAPPED;
|
||||
iomap->bdev = ip->i_mount->m_rtdev_targp->bt_bdev;
|
||||
iomap->offset = offset;
|
||||
iomap->length = length;
|
||||
iomap->flags = IOMAP_F_ANON_WRITE | IOMAP_F_DIRTY;
|
||||
}
|
||||
|
||||
static inline xfs_filblks_t
|
||||
xfs_aligned_fsb_count(
|
||||
xfs_fileoff_t offset_fsb,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user