Index: sys/ufs/ufs/ufs_readwrite.c =================================================================== RCS file: /cvsroot/src/sys/ufs/ufs/ufs_readwrite.c,v retrieving revision 1.128 diff -p -u -r1.128 ufs_readwrite.c --- sys/ufs/ufs/ufs_readwrite.c 21 Feb 2022 17:07:45 -0000 1.128 +++ sys/ufs/ufs/ufs_readwrite.c 19 Oct 2024 13:31:19 -0000 @@ -34,6 +34,8 @@ #include __KERNEL_RCSID(1, "$NetBSD: ufs_readwrite.c,v 1.128 2022/02/21 17:07:45 hannken Exp $"); +#include + #define FS struct fs #define I_FS i_fs #define READ ffs_read @@ -248,6 +250,7 @@ WRITE(void *v) vsize_t bytelen; bool async; struct ufsmount *ump; + const unsigned fshift = ilog2(MAXPHYS); cred = ap->a_cred; ioflag = ap->a_ioflag; @@ -428,10 +431,10 @@ WRITE(void *v) * XXXUBC simplistic async flushing. */ - if (!async && oldoff >> 16 != uio->uio_offset >> 16) { + if (!async && oldoff >> fshift != uio->uio_offset >> fshift) { rw_enter(vp->v_uobj.vmobjlock, RW_WRITER); - error = VOP_PUTPAGES(vp, (oldoff >> 16) << 16, - (uio->uio_offset >> 16) << 16, + error = VOP_PUTPAGES(vp, (oldoff >> fshift) << fshift, + (uio->uio_offset >> fshift) << fshift, PGO_CLEANIT | PGO_JOURNALLOCKED | PGO_LAZY); if (error) break; Index: sys/ufs/ext2fs/ext2fs_readwrite.c =================================================================== RCS file: /cvsroot/src/sys/ufs/ext2fs/ext2fs_readwrite.c,v retrieving revision 1.78 diff -p -u -r1.78 ext2fs_readwrite.c --- sys/ufs/ext2fs/ext2fs_readwrite.c 20 Oct 2021 03:08:19 -0000 1.78 +++ sys/ufs/ext2fs/ext2fs_readwrite.c 19 Oct 2024 13:31:19 -0000 @@ -74,6 +74,7 @@ __KERNEL_RCSID(0, "$NetBSD: ext2fs_readw #include #include #include +#include #include #include @@ -272,6 +273,7 @@ ext2fs_write(void *v) off_t oldoff = 0; /* XXX */ bool async; int advice; + const unsigned fshift = ilog2(MAXPHYS); ioflag = ap->a_ioflag; advice = IO_ADV_DECODE(ioflag); @@ -333,10 +335,10 @@ ext2fs_write(void *v) * XXXUBC simplistic async flushing. */ - if (!async && oldoff >> 16 != uio->uio_offset >> 16) { + if (!async && oldoff >> fshift != uio->uio_offset >> fshift) { rw_enter(vp->v_uobj.vmobjlock, RW_WRITER); - error = VOP_PUTPAGES(vp, (oldoff >> 16) << 16, - (uio->uio_offset >> 16) << 16, + error = VOP_PUTPAGES(vp, (oldoff >> fshift) << fshift, + (uio->uio_offset >> fshift) << fshift, PGO_CLEANIT | PGO_LAZY); } }