Skip to content

Commit 740fd67

Browse files
Christoph Hellwigdjbw
authored andcommitted
xfs: pass the mapping flags to xfs_bmbt_to_iomap
To prepare for looking at the IOMAP_DAX flag in xfs_bmbt_to_iomap pass in the input mapping flags to xfs_bmbt_to_iomap. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dan Williams <[email protected]>
1 parent a50f6ab commit 740fd67

File tree

5 files changed

+27
-21
lines changed

5 files changed

+27
-21
lines changed

fs/xfs/libxfs/xfs_bmap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4551,7 +4551,7 @@ xfs_bmapi_convert_delalloc(
45514551
* the extent. Just return the real extent at this offset.
45524552
*/
45534553
if (!isnullstartblock(bma.got.br_startblock)) {
4554-
xfs_bmbt_to_iomap(ip, iomap, &bma.got, flags);
4554+
xfs_bmbt_to_iomap(ip, iomap, &bma.got, 0, flags);
45554555
*seq = READ_ONCE(ifp->if_seq);
45564556
goto out_trans_cancel;
45574557
}
@@ -4598,7 +4598,7 @@ xfs_bmapi_convert_delalloc(
45984598
XFS_STATS_INC(mp, xs_xstrat_quick);
45994599

46004600
ASSERT(!isnullstartblock(bma.got.br_startblock));
4601-
xfs_bmbt_to_iomap(ip, iomap, &bma.got, flags);
4601+
xfs_bmbt_to_iomap(ip, iomap, &bma.got, 0, flags);
46024602
*seq = READ_ONCE(ifp->if_seq);
46034603

46044604
if (whichfork == XFS_COW_FORK)

fs/xfs/xfs_aops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ xfs_map_blocks(
359359
isnullstartblock(imap.br_startblock))
360360
goto allocate_blocks;
361361

362-
xfs_bmbt_to_iomap(ip, &wpc->iomap, &imap, 0);
362+
xfs_bmbt_to_iomap(ip, &wpc->iomap, &imap, 0, 0);
363363
trace_xfs_map_blocks_found(ip, offset, count, whichfork, &imap);
364364
return 0;
365365
allocate_blocks:

fs/xfs/xfs_iomap.c

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ xfs_bmbt_to_iomap(
5353
struct xfs_inode *ip,
5454
struct iomap *iomap,
5555
struct xfs_bmbt_irec *imap,
56-
u16 flags)
56+
unsigned int mapping_flags,
57+
u16 iomap_flags)
5758
{
5859
struct xfs_mount *mp = ip->i_mount;
5960
struct xfs_buftarg *target = xfs_inode_buftarg(ip);
@@ -79,7 +80,7 @@ xfs_bmbt_to_iomap(
7980
iomap->length = XFS_FSB_TO_B(mp, imap->br_blockcount);
8081
iomap->bdev = target->bt_bdev;
8182
iomap->dax_dev = target->bt_daxdev;
82-
iomap->flags = flags;
83+
iomap->flags = iomap_flags;
8384

8485
if (xfs_ipincount(ip) &&
8586
(ip->i_itemp->ili_fsync_fields & ~XFS_ILOG_TIMESTAMP))
@@ -799,7 +800,7 @@ xfs_direct_write_iomap_begin(
799800

800801
xfs_iunlock(ip, lockmode);
801802
trace_xfs_iomap_found(ip, offset, length, XFS_DATA_FORK, &imap);
802-
return xfs_bmbt_to_iomap(ip, iomap, &imap, iomap_flags);
803+
return xfs_bmbt_to_iomap(ip, iomap, &imap, flags, iomap_flags);
803804

804805
allocate_blocks:
805806
error = -EAGAIN;
@@ -830,18 +831,19 @@ xfs_direct_write_iomap_begin(
830831
return error;
831832

832833
trace_xfs_iomap_alloc(ip, offset, length, XFS_DATA_FORK, &imap);
833-
return xfs_bmbt_to_iomap(ip, iomap, &imap, iomap_flags | IOMAP_F_NEW);
834+
return xfs_bmbt_to_iomap(ip, iomap, &imap, flags,
835+
iomap_flags | IOMAP_F_NEW);
834836

835837
out_found_cow:
836838
xfs_iunlock(ip, lockmode);
837839
length = XFS_FSB_TO_B(mp, cmap.br_startoff + cmap.br_blockcount);
838840
trace_xfs_iomap_found(ip, offset, length - offset, XFS_COW_FORK, &cmap);
839841
if (imap.br_startblock != HOLESTARTBLOCK) {
840-
error = xfs_bmbt_to_iomap(ip, srcmap, &imap, 0);
842+
error = xfs_bmbt_to_iomap(ip, srcmap, &imap, flags, 0);
841843
if (error)
842844
return error;
843845
}
844-
return xfs_bmbt_to_iomap(ip, iomap, &cmap, IOMAP_F_SHARED);
846+
return xfs_bmbt_to_iomap(ip, iomap, &cmap, flags, IOMAP_F_SHARED);
845847

846848
out_unlock:
847849
if (lockmode)
@@ -1051,23 +1053,24 @@ xfs_buffered_write_iomap_begin(
10511053
*/
10521054
xfs_iunlock(ip, XFS_ILOCK_EXCL);
10531055
trace_xfs_iomap_alloc(ip, offset, count, allocfork, &imap);
1054-
return xfs_bmbt_to_iomap(ip, iomap, &imap, IOMAP_F_NEW);
1056+
return xfs_bmbt_to_iomap(ip, iomap, &imap, flags, IOMAP_F_NEW);
10551057

10561058
found_imap:
10571059
xfs_iunlock(ip, XFS_ILOCK_EXCL);
1058-
return xfs_bmbt_to_iomap(ip, iomap, &imap, 0);
1060+
return xfs_bmbt_to_iomap(ip, iomap, &imap, flags, 0);
10591061

10601062
found_cow:
10611063
xfs_iunlock(ip, XFS_ILOCK_EXCL);
10621064
if (imap.br_startoff <= offset_fsb) {
1063-
error = xfs_bmbt_to_iomap(ip, srcmap, &imap, 0);
1065+
error = xfs_bmbt_to_iomap(ip, srcmap, &imap, flags, 0);
10641066
if (error)
10651067
return error;
1066-
return xfs_bmbt_to_iomap(ip, iomap, &cmap, IOMAP_F_SHARED);
1068+
return xfs_bmbt_to_iomap(ip, iomap, &cmap, flags,
1069+
IOMAP_F_SHARED);
10671070
}
10681071

10691072
xfs_trim_extent(&cmap, offset_fsb, imap.br_startoff - offset_fsb);
1070-
return xfs_bmbt_to_iomap(ip, iomap, &cmap, 0);
1073+
return xfs_bmbt_to_iomap(ip, iomap, &cmap, flags, 0);
10711074

10721075
out_unlock:
10731076
xfs_iunlock(ip, XFS_ILOCK_EXCL);
@@ -1176,7 +1179,8 @@ xfs_read_iomap_begin(
11761179
if (error)
11771180
return error;
11781181
trace_xfs_iomap_found(ip, offset, length, XFS_DATA_FORK, &imap);
1179-
return xfs_bmbt_to_iomap(ip, iomap, &imap, shared ? IOMAP_F_SHARED : 0);
1182+
return xfs_bmbt_to_iomap(ip, iomap, &imap, flags,
1183+
shared ? IOMAP_F_SHARED : 0);
11801184
}
11811185

11821186
const struct iomap_ops xfs_read_iomap_ops = {
@@ -1235,7 +1239,8 @@ xfs_seek_iomap_begin(
12351239
if (data_fsb < cow_fsb + cmap.br_blockcount)
12361240
end_fsb = min(end_fsb, data_fsb);
12371241
xfs_trim_extent(&cmap, offset_fsb, end_fsb);
1238-
error = xfs_bmbt_to_iomap(ip, iomap, &cmap, IOMAP_F_SHARED);
1242+
error = xfs_bmbt_to_iomap(ip, iomap, &cmap, flags,
1243+
IOMAP_F_SHARED);
12391244
/*
12401245
* This is a COW extent, so we must probe the page cache
12411246
* because there could be dirty page cache being backed
@@ -1257,7 +1262,7 @@ xfs_seek_iomap_begin(
12571262
imap.br_state = XFS_EXT_NORM;
12581263
done:
12591264
xfs_trim_extent(&imap, offset_fsb, end_fsb);
1260-
error = xfs_bmbt_to_iomap(ip, iomap, &imap, 0);
1265+
error = xfs_bmbt_to_iomap(ip, iomap, &imap, flags, 0);
12611266
out_unlock:
12621267
xfs_iunlock(ip, lockmode);
12631268
return error;
@@ -1304,7 +1309,7 @@ xfs_xattr_iomap_begin(
13041309
if (error)
13051310
return error;
13061311
ASSERT(nimaps);
1307-
return xfs_bmbt_to_iomap(ip, iomap, &imap, 0);
1312+
return xfs_bmbt_to_iomap(ip, iomap, &imap, flags, 0);
13081313
}
13091314

13101315
const struct iomap_ops xfs_xattr_iomap_ops = {

fs/xfs/xfs_iomap.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ int xfs_iomap_write_unwritten(struct xfs_inode *, xfs_off_t, xfs_off_t, bool);
1717
xfs_fileoff_t xfs_iomap_eof_align_last_fsb(struct xfs_inode *ip,
1818
xfs_fileoff_t end_fsb);
1919

20-
int xfs_bmbt_to_iomap(struct xfs_inode *, struct iomap *,
21-
struct xfs_bmbt_irec *, u16);
20+
int xfs_bmbt_to_iomap(struct xfs_inode *ip, struct iomap *iomap,
21+
struct xfs_bmbt_irec *imap, unsigned int mapping_flags,
22+
u16 iomap_flags);
2223

2324
int xfs_zero_range(struct xfs_inode *ip, loff_t pos, loff_t len,
2425
bool *did_zero);

fs/xfs/xfs_pnfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ xfs_fs_map_blocks(
173173
}
174174
xfs_iunlock(ip, XFS_IOLOCK_EXCL);
175175

176-
error = xfs_bmbt_to_iomap(ip, iomap, &imap, 0);
176+
error = xfs_bmbt_to_iomap(ip, iomap, &imap, 0, 0);
177177
*device_generation = mp->m_generation;
178178
return error;
179179
out_unlock:

0 commit comments

Comments
 (0)