Skip to content

Commit 11596dc

Browse files
Christoph Hellwigbrauner
authored andcommitted
iomap: pass flags to iomap_file_buffered_write_punch_delalloc
To fix short write error handling, We'll need to figure out what operation iomap_file_buffered_write_punch_delalloc is called for. Pass the flags argument on to it, and reorder the argument list to match that of ->iomap_end so that the compiler only has to add the new punch argument to the end of it instead of reshuffling the registers. Signed-off-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent b53fdb2 commit 11596dc

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

fs/iomap/buffered-io.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
#define IOEND_BATCH_SIZE 4096
2525

26-
typedef int (*iomap_punch_t)(struct inode *inode, loff_t offset, loff_t length);
2726
/*
2827
* Structure allocated for each folio to track per-block uptodate, dirty state
2928
* and I/O completions.
@@ -1200,8 +1199,8 @@ static int iomap_write_delalloc_scan(struct inode *inode,
12001199
* require sprinkling this code with magic "+ 1" and "- 1" arithmetic and expose
12011200
* the code to subtle off-by-one bugs....
12021201
*/
1203-
static int iomap_write_delalloc_release(struct inode *inode,
1204-
loff_t start_byte, loff_t end_byte, iomap_punch_t punch)
1202+
static int iomap_write_delalloc_release(struct inode *inode, loff_t start_byte,
1203+
loff_t end_byte, unsigned flags, iomap_punch_t punch)
12051204
{
12061205
loff_t punch_start_byte = start_byte;
12071206
loff_t scan_end_byte = min(i_size_read(inode), end_byte);
@@ -1301,8 +1300,8 @@ static int iomap_write_delalloc_release(struct inode *inode,
13011300
* internal filesystem allocation lock
13021301
*/
13031302
int iomap_file_buffered_write_punch_delalloc(struct inode *inode,
1304-
struct iomap *iomap, loff_t pos, loff_t length,
1305-
ssize_t written, iomap_punch_t punch)
1303+
loff_t pos, loff_t length, ssize_t written, unsigned flags,
1304+
struct iomap *iomap, iomap_punch_t punch)
13061305
{
13071306
loff_t start_byte;
13081307
loff_t end_byte;
@@ -1330,7 +1329,7 @@ int iomap_file_buffered_write_punch_delalloc(struct inode *inode,
13301329
if (start_byte >= end_byte)
13311330
return 0;
13321331

1333-
return iomap_write_delalloc_release(inode, start_byte, end_byte,
1332+
return iomap_write_delalloc_release(inode, start_byte, end_byte, flags,
13341333
punch);
13351334
}
13361335
EXPORT_SYMBOL_GPL(iomap_file_buffered_write_punch_delalloc);

fs/xfs/xfs_iomap.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,8 +1231,9 @@ xfs_buffered_write_iomap_end(
12311231
struct xfs_mount *mp = XFS_M(inode->i_sb);
12321232
int error;
12331233

1234-
error = iomap_file_buffered_write_punch_delalloc(inode, iomap, offset,
1235-
length, written, &xfs_buffered_write_delalloc_punch);
1234+
error = iomap_file_buffered_write_punch_delalloc(inode, offset, length,
1235+
written, flags, iomap,
1236+
&xfs_buffered_write_delalloc_punch);
12361237
if (error && !xfs_is_shutdown(mp)) {
12371238
xfs_alert(mp, "%s: unable to clean up ino 0x%llx",
12381239
__func__, XFS_I(inode)->i_ino);

include/linux/iomap.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,6 @@ static inline const struct iomap *iomap_iter_srcmap(const struct iomap_iter *i)
258258

259259
ssize_t iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *from,
260260
const struct iomap_ops *ops, void *private);
261-
int iomap_file_buffered_write_punch_delalloc(struct inode *inode,
262-
struct iomap *iomap, loff_t pos, loff_t length, ssize_t written,
263-
int (*punch)(struct inode *inode, loff_t pos, loff_t length));
264-
265261
int iomap_read_folio(struct folio *folio, const struct iomap_ops *ops);
266262
void iomap_readahead(struct readahead_control *, const struct iomap_ops *ops);
267263
bool iomap_is_partially_uptodate(struct folio *, size_t from, size_t count);
@@ -277,6 +273,12 @@ int iomap_truncate_page(struct inode *inode, loff_t pos, bool *did_zero,
277273
const struct iomap_ops *ops);
278274
vm_fault_t iomap_page_mkwrite(struct vm_fault *vmf,
279275
const struct iomap_ops *ops);
276+
277+
typedef int (*iomap_punch_t)(struct inode *inode, loff_t offset, loff_t length);
278+
int iomap_file_buffered_write_punch_delalloc(struct inode *inode, loff_t pos,
279+
loff_t length, ssize_t written, unsigned flag,
280+
struct iomap *iomap, iomap_punch_t punch);
281+
280282
int iomap_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
281283
u64 start, u64 len, const struct iomap_ops *ops);
282284
loff_t iomap_seek_hole(struct inode *inode, loff_t offset,

0 commit comments

Comments
 (0)