Skip to content

Commit fe4e0fa

Browse files
Christoph Hellwigcmaiolino
authored andcommitted
xfs: remove xfs_page_mkwrite_iomap_ops
Shared the regular buffered write iomap_ops with the page fault path and just check for the IOMAP_FAULT flag to skip delalloc punching. This keeps the delalloc punching checks in one place, and will make it easier to convert iomap to an iter model where the begin and end handlers are merged into a single callback. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Carlos Maiolino <[email protected]>
1 parent a7fd332 commit fe4e0fa

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

fs/xfs/xfs_file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1474,7 +1474,7 @@ xfs_write_fault(
14741474
if (IS_DAX(inode))
14751475
ret = xfs_dax_fault_locked(vmf, order, true);
14761476
else
1477-
ret = iomap_page_mkwrite(vmf, &xfs_page_mkwrite_iomap_ops);
1477+
ret = iomap_page_mkwrite(vmf, &xfs_buffered_write_iomap_ops);
14781478
xfs_iunlock(ip, lock_mode);
14791479

14801480
sb_end_pagefault(inode->i_sb);

fs/xfs/xfs_iomap.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,6 +1234,14 @@ xfs_buffered_write_iomap_end(
12341234
if (iomap->type != IOMAP_DELALLOC || !(iomap->flags & IOMAP_F_NEW))
12351235
return 0;
12361236

1237+
/*
1238+
* iomap_page_mkwrite() will never fail in a way that requires delalloc
1239+
* extents that it allocated to be revoked. Hence never try to release
1240+
* them here.
1241+
*/
1242+
if (flags & IOMAP_FAULT)
1243+
return 0;
1244+
12371245
/* Nothing to do if we've written the entire delalloc extent */
12381246
start_byte = iomap_last_written_block(inode, offset, written);
12391247
end_byte = round_up(offset + length, i_blocksize(inode));
@@ -1260,15 +1268,6 @@ const struct iomap_ops xfs_buffered_write_iomap_ops = {
12601268
.iomap_end = xfs_buffered_write_iomap_end,
12611269
};
12621270

1263-
/*
1264-
* iomap_page_mkwrite() will never fail in a way that requires delalloc extents
1265-
* that it allocated to be revoked. Hence we do not need an .iomap_end method
1266-
* for this operation.
1267-
*/
1268-
const struct iomap_ops xfs_page_mkwrite_iomap_ops = {
1269-
.iomap_begin = xfs_buffered_write_iomap_begin,
1270-
};
1271-
12721271
static int
12731272
xfs_read_iomap_begin(
12741273
struct inode *inode,

fs/xfs/xfs_iomap.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ xfs_aligned_fsb_count(
4848
}
4949

5050
extern const struct iomap_ops xfs_buffered_write_iomap_ops;
51-
extern const struct iomap_ops xfs_page_mkwrite_iomap_ops;
5251
extern const struct iomap_ops xfs_direct_write_iomap_ops;
5352
extern const struct iomap_ops xfs_read_iomap_ops;
5453
extern const struct iomap_ops xfs_seek_iomap_ops;

0 commit comments

Comments
 (0)