Linux: zfs_putpage: complete async page writeback immediately

For async page writeback, we do not need to wait for the page to be on
disk before returning to the caller; it's enough that the data from the
dirty page be on the DMU and in the in-memory ZIL, just like any other
write.

So, if this is not a syncing write, don't add a callback to the itx, and
instead just unlock the page immediately.

(This is effectively the same concept used for FreeBSD in d323fbf49c).

Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
Closes #17584
Closes #14290
This commit is contained in:
Rob Norris 2025-07-28 10:51:00 +10:00 committed by Brian Behlendorf
parent f72226a75c
commit b9c45fe68c

View File

@ -3682,16 +3682,7 @@ top:
}
static void
zfs_putpage_sync_commit_cb(void *arg)
{
struct page *pp = arg;
ClearPageError(pp);
end_page_writeback(pp);
}
static void
zfs_putpage_async_commit_cb(void *arg)
zfs_putpage_commit_cb(void *arg)
{
struct page *pp = arg;
@ -3895,8 +3886,12 @@ zfs_putpage(struct inode *ip, struct page *pp, struct writeback_control *wbc,
}
zfs_log_write(zfsvfs->z_log, tx, TX_WRITE, zp, pgoff, pglen, commit,
B_FALSE, for_sync ? zfs_putpage_sync_commit_cb :
zfs_putpage_async_commit_cb, pp);
B_FALSE, for_sync ? zfs_putpage_commit_cb : NULL, pp);
if (!for_sync) {
ClearPageError(pp);
end_page_writeback(pp);
}
dmu_tx_commit(tx);