summaryrefslogtreecommitdiff
path: root/fs/xfs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2024-04-29 08:15:28 +0200
committerChandan Babu R <chandanbabu@kernel.org>2024-04-30 09:45:19 +0530
commit21255afdd7296f57dd65f815301426bcf911c82d (patch)
treef46600b38608c488aa1b1a348549991c694aba1f /fs/xfs
parentd69bee6a35d3c5e4873b9e164dd1a9711351a97c (diff)
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 <hch@lst.de> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/libxfs/xfs_bmap.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index ec204c430d53..be515bac8ea1 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -4524,8 +4524,9 @@ xfs_bmapi_write(
bma.length = XFS_FILBLKS_MIN(len, XFS_MAX_BMBT_EXTLEN);
if (wasdelay) {
- bma.offset = bma.got.br_startoff;
- bma.length = bma.got.br_blockcount;
+ bma.length = XFS_FILBLKS_MIN(bma.length,
+ bma.got.br_blockcount -
+ (bno - bma.got.br_startoff));
} else {
if (!eof)
bma.length = XFS_FILBLKS_MIN(bma.length,