From d2721be299c124d76b611ab2980c51be148fa1a7 Mon Sep 17 00:00:00 2001 From: Benjamin Kaduk Date: Mon, 20 Feb 2017 22:18:09 -0600 Subject: [PATCH] XBSD: do not claim AFS_VM_RDWR_ENV The AFS_VM_RDWR_ENV configuration parameter (defined or not defined in each platform's param.h) is undocumented, but appears to be an indication of a property of the platform OS's VFS layer, or perhaps just of the complexity of the read/write vnops that we implement for it. That is, AFS_VM_RDWR_ENV is defined when the read/write vnops implement partial write logic (and presumably when they interact with the OS VM layer in ways not expressed by the afs_write() abstraction); systems that do not define AFS_VM_RDWR_ENV can use the afs_write() function fairly directly as the vnode operation. Use of AFS_VM_RDWR_ENV evolved over time, with the original (AFS 3.2/3.3-era) code using a simple scheme that handled partial writes directly in afs_write() and avoided complexity in callers. In AFS 3.4, sunos and solaris gained a more complicated read/write vnop that incorporated the afs_DoPartialWrite() call itself, and eventually in 3.6 we see the behavior established at the original IBM import, with all the (Unix) OSes supported at that time defining AFS_VM_RDWR_ENV. When DARWIN support was brought in in commit a41175cfbbf4d06ccfe14ae54bef8b7464ecd80b, its param.h properly did not define AFS_VM_RDWR_ENV, as OS X uses a VFS interface that shares some level of abstraction with the traditional BSD VFS and its read/write/getpages/putpages operations, so the afs_write() behavior was natural and no extra complications needed for integration with the VM layer or other optimizations. However, when the initial FreeBSD support came in a few months later, it seems to have taken inspiration from the OSes that were supported in the initial IBM import, and kept the AFS_VM_RDWR_ENV definition. This was then propagated to all the later BSDs as they were added. Perhaps the most noticeable consequence of this definition is that the calls to afs_DoPartialWrite() from afs_write() are bypassed, with a comment that "[i]f write is implemented via VM, afs_DoPartialWrite() is called from the high-level write op" (and calls to afs_FakeOpen() and afs_FakeClose() are similarly skipped). This means that attempting to write a file larger than the local cache will hang waiting for more space to be freed, which will never happen as the vcache remains locked and will not be written out in the background. In the absence of a documented meaning for AFS_VM_RDWR_ENV, this also gives us a proxy that can be used to indicate whether a given OS's support intended to claim the AFS_VM_RDWR_ENV -- such platforms will actually contain the call to afs_DoPartialWrite() in the appropriate vnode operation. This can be used to sanity-check the places where AFS_VM_RDWR_ENV is removed by this commit. Interestingly, HP-UX does not call afs_DoPartialWrite() but also is clearly in a VFS that uses a rdwr()-based approach, as the corresponding vnode operation is implemented by mp_afs_rdwr(), so leave it unchanged for now. Tim Creech is responsible for noting the lack of calls to afs_DoPartialWrite() on FreeBSD, and Chaskiel Grundman for the historical research into pre-OpenAFS AFS behavior. Designing and implementing more complicated BSD read/write vnops that incorporate afs_DoPartialWrite() and other improvements is left for future work. Change-Id: I8e89855ac31303934f97d0753b64899fb7e3867c Reviewed-on: https://gerrit.openafs.org/12520 Tested-by: BuildBot Reviewed-by: Antoine Verheijen Reviewed-by: Tim Creech Reviewed-by: Benjamin Kaduk --- src/config/param.alpha_nbsd15.h | 1 - src/config/param.alpha_nbsd16.h | 1 - src/config/param.generic_fbsd.h | 1 - src/config/param.i386_dfbsd_23.h | 1 - src/config/param.i386_nbsd15.h | 1 - src/config/param.i386_nbsd16.h | 1 - src/config/param.nbsd15.h | 1 - src/config/param.nbsd16.h | 1 - src/config/param.nbsd20.h | 1 - src/config/param.nbsd21.h | 1 - src/config/param.nbsd30.h | 1 - src/config/param.nbsd40.h | 1 - src/config/param.nbsd50.h | 1 - src/config/param.nbsd60.h | 1 - src/config/param.nbsd70.h | 1 - src/config/param.obsd31.h | 1 - src/config/param.obsd32.h | 1 - src/config/param.obsd33.h | 1 - src/config/param.obsd34.h | 1 - src/config/param.obsd35.h | 1 - src/config/param.obsd36.h | 1 - src/config/param.obsd37.h | 1 - src/config/param.obsd38.h | 1 - src/config/param.obsd39.h | 1 - src/config/param.obsd40.h | 1 - src/config/param.obsd41.h | 1 - src/config/param.obsd42.h | 1 - src/config/param.obsd43.h | 1 - src/config/param.obsd44.h | 1 - src/config/param.obsd45.h | 1 - src/config/param.obsd46.h | 1 - src/config/param.obsd47.h | 1 - src/config/param.obsd48.h | 1 - src/config/param.obsd49.h | 1 - src/config/param.obsd50.h | 1 - src/config/param.obsd51.h | 1 - src/config/param.obsd52.h | 1 - src/config/param.obsd53.h | 1 - src/config/param.obsd54.h | 1 - src/config/param.ppc_nbsd16.h | 1 - 40 files changed, 40 deletions(-) diff --git a/src/config/param.alpha_nbsd15.h b/src/config/param.alpha_nbsd15.h index 2c3dc2fad..bf17abb8d 100644 --- a/src/config/param.alpha_nbsd15.h +++ b/src/config/param.alpha_nbsd15.h @@ -48,7 +48,6 @@ #define AFSLITTLE_ENDIAN 1 #define AFS_HAVE_FFS 1 /* Use system's ffs. */ #define AFS_HAVE_STATVFS 0 /* System doesn't support statvfs */ -#define AFS_VM_RDWR_ENV 1 /* read/write implemented via VM */ #define afsio_iov uio_iov #define afsio_iovcnt uio_iovcnt diff --git a/src/config/param.alpha_nbsd16.h b/src/config/param.alpha_nbsd16.h index b16e9e9c9..b73a6b262 100644 --- a/src/config/param.alpha_nbsd16.h +++ b/src/config/param.alpha_nbsd16.h @@ -48,7 +48,6 @@ #define AFSLITTLE_ENDIAN 1 #define AFS_HAVE_FFS 1 /* Use system's ffs. */ #define AFS_HAVE_STATVFS 0 /* System doesn't support statvfs */ -#define AFS_VM_RDWR_ENV 1 /* read/write implemented via VM */ #define afsio_iov uio_iov #define afsio_iovcnt uio_iovcnt diff --git a/src/config/param.generic_fbsd.h b/src/config/param.generic_fbsd.h index f8bea607a..9977eeeea 100644 --- a/src/config/param.generic_fbsd.h +++ b/src/config/param.generic_fbsd.h @@ -3,7 +3,6 @@ #define AFSLITTLE_ENDIAN 1 #define AFS_HAVE_FFS 1 /* Use system's ffs. */ -#define AFS_VM_RDWR_ENV 1 /* read/write implemented via VM */ #ifndef UKERNEL /* This section for kernel libafs compiles only */ diff --git a/src/config/param.i386_dfbsd_23.h b/src/config/param.i386_dfbsd_23.h index e28642742..088781990 100644 --- a/src/config/param.i386_dfbsd_23.h +++ b/src/config/param.i386_dfbsd_23.h @@ -8,7 +8,6 @@ #define AFSLITTLE_ENDIAN 1 #define AFS_HAVE_FFS 1 /* Use system's ffs. */ #define AFS_HAVE_STATVFS 1 /* System doesn't support statvfs */ -#define AFS_VM_RDWR_ENV 1 /* read/write implemented via VM */ #define AFS_FAKEOPEN_ENV 1 /* call afs_FakeOpen as if !AFS_VM_RDWR */ diff --git a/src/config/param.i386_nbsd15.h b/src/config/param.i386_nbsd15.h index a27b33d34..206241965 100644 --- a/src/config/param.i386_nbsd15.h +++ b/src/config/param.i386_nbsd15.h @@ -50,7 +50,6 @@ #define AFSLITTLE_ENDIAN 1 #define AFS_HAVE_FFS 1 /* Use system's ffs. */ #define AFS_HAVE_STATVFS 0 /* System doesn't support statvfs */ -#define AFS_VM_RDWR_ENV 1 /* read/write implemented via VM */ #define afsio_iov uio_iov #define afsio_iovcnt uio_iovcnt diff --git a/src/config/param.i386_nbsd16.h b/src/config/param.i386_nbsd16.h index 08facf559..261224393 100644 --- a/src/config/param.i386_nbsd16.h +++ b/src/config/param.i386_nbsd16.h @@ -52,7 +52,6 @@ #define AFSLITTLE_ENDIAN 1 #define AFS_HAVE_FFS 1 /* Use system's ffs. */ #define AFS_HAVE_STATVFS 0 /* System doesn't support statvfs */ -#define AFS_VM_RDWR_ENV 1 /* read/write implemented via VM */ #define afsio_iov uio_iov #define afsio_iovcnt uio_iovcnt diff --git a/src/config/param.nbsd15.h b/src/config/param.nbsd15.h index 80b16ae67..905a1c107 100644 --- a/src/config/param.nbsd15.h +++ b/src/config/param.nbsd15.h @@ -32,7 +32,6 @@ #include -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_VFSINCL_ENV 1 #define AFS_GREEDY43_ENV 1 diff --git a/src/config/param.nbsd16.h b/src/config/param.nbsd16.h index a4edddeb4..bb88fe200 100644 --- a/src/config/param.nbsd16.h +++ b/src/config/param.nbsd16.h @@ -33,7 +33,6 @@ #include -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_VFSINCL_ENV 1 #define AFS_GREEDY43_ENV 1 diff --git a/src/config/param.nbsd20.h b/src/config/param.nbsd20.h index 77c7891db..07e741567 100644 --- a/src/config/param.nbsd20.h +++ b/src/config/param.nbsd20.h @@ -56,7 +56,6 @@ #include -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_GREEDY43_ENV 1 diff --git a/src/config/param.nbsd21.h b/src/config/param.nbsd21.h index 0b5344e66..bb63588df 100644 --- a/src/config/param.nbsd21.h +++ b/src/config/param.nbsd21.h @@ -56,7 +56,6 @@ #include -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_GREEDY43_ENV 1 diff --git a/src/config/param.nbsd30.h b/src/config/param.nbsd30.h index 1fc306290..95a1c0246 100644 --- a/src/config/param.nbsd30.h +++ b/src/config/param.nbsd30.h @@ -52,7 +52,6 @@ #include -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_GREEDY43_ENV 1 diff --git a/src/config/param.nbsd40.h b/src/config/param.nbsd40.h index 13876a71a..d4b473081 100644 --- a/src/config/param.nbsd40.h +++ b/src/config/param.nbsd40.h @@ -55,7 +55,6 @@ #include -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_GREEDY43_ENV 1 diff --git a/src/config/param.nbsd50.h b/src/config/param.nbsd50.h index 9a7677e1b..a65e5c980 100644 --- a/src/config/param.nbsd50.h +++ b/src/config/param.nbsd50.h @@ -62,7 +62,6 @@ #include -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_GREEDY43_ENV 1 diff --git a/src/config/param.nbsd60.h b/src/config/param.nbsd60.h index 8d42db55a..196e9d40b 100644 --- a/src/config/param.nbsd60.h +++ b/src/config/param.nbsd60.h @@ -63,7 +63,6 @@ #include -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_GREEDY43_ENV 1 diff --git a/src/config/param.nbsd70.h b/src/config/param.nbsd70.h index f54c5eec6..f01ecb9b4 100644 --- a/src/config/param.nbsd70.h +++ b/src/config/param.nbsd70.h @@ -64,7 +64,6 @@ #include -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_GREEDY43_ENV 1 diff --git a/src/config/param.obsd31.h b/src/config/param.obsd31.h index fb9835202..a660e98fd 100644 --- a/src/config/param.obsd31.h +++ b/src/config/param.obsd31.h @@ -23,7 +23,6 @@ #undef AFS_NONFSTRANS #define AFS_NONFSTRANS 1 -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_VFSINCL_ENV 1 diff --git a/src/config/param.obsd32.h b/src/config/param.obsd32.h index c0fd71f10..0abbf7d08 100644 --- a/src/config/param.obsd32.h +++ b/src/config/param.obsd32.h @@ -22,7 +22,6 @@ #undef AFS_NONFSTRANS #define AFS_NONFSTRANS 1 -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_VFSINCL_ENV 1 diff --git a/src/config/param.obsd33.h b/src/config/param.obsd33.h index b2290279b..80119092a 100644 --- a/src/config/param.obsd33.h +++ b/src/config/param.obsd33.h @@ -23,7 +23,6 @@ #undef AFS_NONFSTRANS #define AFS_NONFSTRANS 1 -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_VFSINCL_ENV 1 diff --git a/src/config/param.obsd34.h b/src/config/param.obsd34.h index 560627590..177b331e4 100644 --- a/src/config/param.obsd34.h +++ b/src/config/param.obsd34.h @@ -24,7 +24,6 @@ #undef AFS_NONFSTRANS #define AFS_NONFSTRANS 1 -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_VFSINCL_ENV 1 diff --git a/src/config/param.obsd35.h b/src/config/param.obsd35.h index c57197a1f..c67ef63e0 100644 --- a/src/config/param.obsd35.h +++ b/src/config/param.obsd35.h @@ -24,7 +24,6 @@ #undef AFS_NONFSTRANS #define AFS_NONFSTRANS 1 -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_VFSINCL_ENV 1 diff --git a/src/config/param.obsd36.h b/src/config/param.obsd36.h index c657b1c9d..2f0ebd079 100644 --- a/src/config/param.obsd36.h +++ b/src/config/param.obsd36.h @@ -26,7 +26,6 @@ #undef AFS_NONFSTRANS #define AFS_NONFSTRANS 1 -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_VFSINCL_ENV 1 diff --git a/src/config/param.obsd37.h b/src/config/param.obsd37.h index 58625b628..401cfa841 100644 --- a/src/config/param.obsd37.h +++ b/src/config/param.obsd37.h @@ -27,7 +27,6 @@ #undef AFS_NONFSTRANS #define AFS_NONFSTRANS 1 -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_VFSINCL_ENV 1 diff --git a/src/config/param.obsd38.h b/src/config/param.obsd38.h index 384e4f98b..2eb5f2931 100644 --- a/src/config/param.obsd38.h +++ b/src/config/param.obsd38.h @@ -28,7 +28,6 @@ #undef AFS_NONFSTRANS #define AFS_NONFSTRANS 1 -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_VFSINCL_ENV 1 diff --git a/src/config/param.obsd39.h b/src/config/param.obsd39.h index 16330efb6..2d3d9a364 100644 --- a/src/config/param.obsd39.h +++ b/src/config/param.obsd39.h @@ -32,7 +32,6 @@ #undef AFS_NONFSTRANS #define AFS_NONFSTRANS 1 -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_VFSINCL_ENV 1 diff --git a/src/config/param.obsd40.h b/src/config/param.obsd40.h index 73c8025f2..6f6c0608b 100644 --- a/src/config/param.obsd40.h +++ b/src/config/param.obsd40.h @@ -30,7 +30,6 @@ #undef AFS_NONFSTRANS #define AFS_NONFSTRANS 1 -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_VFSINCL_ENV 1 diff --git a/src/config/param.obsd41.h b/src/config/param.obsd41.h index 7ca5a4c03..7c4453b36 100644 --- a/src/config/param.obsd41.h +++ b/src/config/param.obsd41.h @@ -31,7 +31,6 @@ #undef AFS_NONFSTRANS #define AFS_NONFSTRANS 1 -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_VFSINCL_ENV 1 diff --git a/src/config/param.obsd42.h b/src/config/param.obsd42.h index 0d29ec1f2..a8b5edd0c 100644 --- a/src/config/param.obsd42.h +++ b/src/config/param.obsd42.h @@ -32,7 +32,6 @@ #undef AFS_NONFSTRANS #define AFS_NONFSTRANS 1 -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_VFSINCL_ENV 1 diff --git a/src/config/param.obsd43.h b/src/config/param.obsd43.h index 8c2b5e46c..9be4abdb2 100644 --- a/src/config/param.obsd43.h +++ b/src/config/param.obsd43.h @@ -33,7 +33,6 @@ #undef AFS_NONFSTRANS #define AFS_NONFSTRANS 1 -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_VFSINCL_ENV 1 diff --git a/src/config/param.obsd44.h b/src/config/param.obsd44.h index 9f628405c..26bdc07b3 100644 --- a/src/config/param.obsd44.h +++ b/src/config/param.obsd44.h @@ -34,7 +34,6 @@ #undef AFS_NONFSTRANS #define AFS_NONFSTRANS 1 -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_VFSINCL_ENV 1 diff --git a/src/config/param.obsd45.h b/src/config/param.obsd45.h index 511b51aad..ed8a99604 100644 --- a/src/config/param.obsd45.h +++ b/src/config/param.obsd45.h @@ -34,7 +34,6 @@ #define AFS_OBSD45_ENV 1 #undef AFS_NONFSTRANS #define AFS_NONFSTRANS 1 -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_VFSINCL_ENV 1 diff --git a/src/config/param.obsd46.h b/src/config/param.obsd46.h index 76cd82114..4157780ce 100644 --- a/src/config/param.obsd46.h +++ b/src/config/param.obsd46.h @@ -35,7 +35,6 @@ #define AFS_OBSD46_ENV 1 #undef AFS_NONFSTRANS #define AFS_NONFSTRANS 1 -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_VFSINCL_ENV 1 diff --git a/src/config/param.obsd47.h b/src/config/param.obsd47.h index 175065800..556140690 100644 --- a/src/config/param.obsd47.h +++ b/src/config/param.obsd47.h @@ -36,7 +36,6 @@ #define AFS_OBSD47_ENV 1 #undef AFS_NONFSTRANS #define AFS_NONFSTRANS 1 -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_VFSINCL_ENV 1 diff --git a/src/config/param.obsd48.h b/src/config/param.obsd48.h index 652916bcf..6c4462083 100644 --- a/src/config/param.obsd48.h +++ b/src/config/param.obsd48.h @@ -37,7 +37,6 @@ #define AFS_OBSD48_ENV 1 #undef AFS_NONFSTRANS #define AFS_NONFSTRANS 1 -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_VFSINCL_ENV 1 diff --git a/src/config/param.obsd49.h b/src/config/param.obsd49.h index a5c1f3ed8..7adf325d3 100644 --- a/src/config/param.obsd49.h +++ b/src/config/param.obsd49.h @@ -38,7 +38,6 @@ #define AFS_OBSD49_ENV 1 #undef AFS_NONFSTRANS #define AFS_NONFSTRANS 1 -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_VFSINCL_ENV 1 diff --git a/src/config/param.obsd50.h b/src/config/param.obsd50.h index 660b95805..06d1990e4 100644 --- a/src/config/param.obsd50.h +++ b/src/config/param.obsd50.h @@ -39,7 +39,6 @@ #define AFS_OBSD50_ENV 1 #undef AFS_NONFSTRANS #define AFS_NONFSTRANS 1 -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_VFSINCL_ENV 1 diff --git a/src/config/param.obsd51.h b/src/config/param.obsd51.h index ccfc3448b..8c7756a17 100644 --- a/src/config/param.obsd51.h +++ b/src/config/param.obsd51.h @@ -40,7 +40,6 @@ #define AFS_OBSD51_ENV 1 #undef AFS_NONFSTRANS #define AFS_NONFSTRANS 1 -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_VFSINCL_ENV 1 diff --git a/src/config/param.obsd52.h b/src/config/param.obsd52.h index af217cb5c..4d2757685 100644 --- a/src/config/param.obsd52.h +++ b/src/config/param.obsd52.h @@ -41,7 +41,6 @@ #define AFS_OBSD52_ENV 1 #undef AFS_NONFSTRANS #define AFS_NONFSTRANS 1 -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_VFSINCL_ENV 1 diff --git a/src/config/param.obsd53.h b/src/config/param.obsd53.h index dc3e588fd..58b4282c3 100644 --- a/src/config/param.obsd53.h +++ b/src/config/param.obsd53.h @@ -42,7 +42,6 @@ #define AFS_OBSD53_ENV 1 #undef AFS_NONFSTRANS #define AFS_NONFSTRANS 1 -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_VFSINCL_ENV 1 diff --git a/src/config/param.obsd54.h b/src/config/param.obsd54.h index 4f6268236..45d0cc192 100644 --- a/src/config/param.obsd54.h +++ b/src/config/param.obsd54.h @@ -43,7 +43,6 @@ #define AFS_OBSD54_ENV 1 #undef AFS_NONFSTRANS #define AFS_NONFSTRANS 1 -#define AFS_VM_RDWR_ENV 1 #define AFS_VFS_ENV 1 #define AFS_VFSINCL_ENV 1 diff --git a/src/config/param.ppc_nbsd16.h b/src/config/param.ppc_nbsd16.h index f97e68ce4..e4a90694d 100644 --- a/src/config/param.ppc_nbsd16.h +++ b/src/config/param.ppc_nbsd16.h @@ -47,7 +47,6 @@ #define AFSLITTLE_ENDIAN 1 #define AFS_HAVE_FFS 1 /* Use system's ffs. */ #define AFS_HAVE_STATVFS 0 /* System doesn't support statvfs */ -#define AFS_VM_RDWR_ENV 1 /* read/write implemented via VM */ #define afsio_iov uio_iov #define afsio_iovcnt uio_iovcnt -- 2.39.5