git: 7dc87eef4695 - stable/15 - swap_pager_seek_data(): move the clipping at the object size to consumers

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Wed, 24 Dec 2025 00:42:11 UTC
The branch stable/15 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=7dc87eef4695c93765b598f4558ff5e55bf8bf05

commit 7dc87eef4695c93765b598f4558ff5e55bf8bf05
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-12-16 05:32:37 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-12-24 00:33:00 +0000

    swap_pager_seek_data(): move the clipping at the object size to consumers
    
    (cherry picked from commit 30ae88e3b217b12476dba665d163ab0d8dd6a8a7)
---
 sys/fs/tmpfs/tmpfs_vnops.c | 2 ++
 sys/vm/swap_pager.c        | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c
index 0f4ea2fdc28c..e1bc0d156baa 100644
--- a/sys/fs/tmpfs/tmpfs_vnops.c
+++ b/sys/fs/tmpfs/tmpfs_vnops.c
@@ -2091,6 +2091,8 @@ tmpfs_seek_data_locked(vm_object_t obj, off_t noff)
 	vm_pindex_t p;
 
 	p = swap_pager_seek_data(obj, OFF_TO_IDX(noff));
+	if (p == OBJ_MAX_SIZE)
+		p = obj->size;
 	return (p == OFF_TO_IDX(noff) ? noff : IDX_TO_OFF(p));
 }
 
diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c
index 5e9a0ad94cb3..ab95bde34ceb 100644
--- a/sys/vm/swap_pager.c
+++ b/sys/vm/swap_pager.c
@@ -2479,8 +2479,6 @@ swap_pager_seek_data(vm_object_t object, vm_pindex_t pindex)
 			return (pages.index);
 		m = vm_radix_iter_step(&pages);
 	}
-	if (swap_index == OBJ_MAX_SIZE)
-		swap_index = object->size;
 	return (swap_index);
 }