Skip to content

Commit 21255af

Browse files
Christoph HellwigChandan Babu R
authored andcommitted
xfs: do not allocate the entire delalloc extent in xfs_bmapi_write
While trying to convert the entire delalloc extent is a good decision for regular writeback as it leads to larger contigous on-disk extents, but for other callers of xfs_bmapi_write is is rather questionable as it forced them to loop creating new transactions just in case there is no large enough contiguous extent to cover the whole delalloc reservation. Change xfs_bmapi_write to only allocate the passed in range instead, whіle the writeback path through xfs_bmapi_convert_delalloc and xfs_bmapi_allocate still always converts the full extents. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: "Darrick J. Wong" <[email protected]> Signed-off-by: Chandan Babu R <[email protected]>
1 parent d69bee6 commit 21255af

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fs/xfs/libxfs/xfs_bmap.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4524,8 +4524,9 @@ xfs_bmapi_write(
45244524
bma.length = XFS_FILBLKS_MIN(len, XFS_MAX_BMBT_EXTLEN);
45254525

45264526
if (wasdelay) {
4527-
bma.offset = bma.got.br_startoff;
4528-
bma.length = bma.got.br_blockcount;
4527+
bma.length = XFS_FILBLKS_MIN(bma.length,
4528+
bma.got.br_blockcount -
4529+
(bno - bma.got.br_startoff));
45294530
} else {
45304531
if (!eof)
45314532
bma.length = XFS_FILBLKS_MIN(bma.length,

0 commit comments

Comments
 (0)