XBSD: do not claim AFS_VM_RDWR_ENV 20/12520/3
authorBenjamin Kaduk <kaduk@mit.edu>
Tue, 21 Feb 2017 04:18:09 +0000 (22:18 -0600)
committerBenjamin Kaduk <kaduk@mit.edu>
Thu, 16 Mar 2017 03:13:31 +0000 (23:13 -0400)
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 <buildbot@rampaginggeek.com>
Reviewed-by: Antoine Verheijen <apv@ualberta.ca>
Reviewed-by: Tim Creech <tcreech@tcreech.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

40 files changed:
src/config/param.alpha_nbsd15.h
src/config/param.alpha_nbsd16.h
src/config/param.generic_fbsd.h
src/config/param.i386_dfbsd_23.h
src/config/param.i386_nbsd15.h
src/config/param.i386_nbsd16.h
src/config/param.nbsd15.h
src/config/param.nbsd16.h
src/config/param.nbsd20.h
src/config/param.nbsd21.h
src/config/param.nbsd30.h
src/config/param.nbsd40.h
src/config/param.nbsd50.h
src/config/param.nbsd60.h
src/config/param.nbsd70.h
src/config/param.obsd31.h
src/config/param.obsd32.h
src/config/param.obsd33.h
src/config/param.obsd34.h
src/config/param.obsd35.h
src/config/param.obsd36.h
src/config/param.obsd37.h
src/config/param.obsd38.h
src/config/param.obsd39.h
src/config/param.obsd40.h
src/config/param.obsd41.h
src/config/param.obsd42.h
src/config/param.obsd43.h
src/config/param.obsd44.h
src/config/param.obsd45.h
src/config/param.obsd46.h
src/config/param.obsd47.h
src/config/param.obsd48.h
src/config/param.obsd49.h
src/config/param.obsd50.h
src/config/param.obsd51.h
src/config/param.obsd52.h
src/config/param.obsd53.h
src/config/param.obsd54.h
src/config/param.ppc_nbsd16.h

index 2c3dc2f..bf17abb 100644 (file)
@@ -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
index b16e9e9..b73a6b2 100644 (file)
@@ -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
index f8bea60..9977eee 100644 (file)
@@ -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 */
index e286427..0887819 100644 (file)
@@ -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 */
 
 
index a27b33d..2062419 100644 (file)
@@ -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
index 08facf5..2612243 100644 (file)
@@ -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
index 80b16ae..905a1c1 100644 (file)
@@ -32,7 +32,6 @@
 
 #include <afs/afs_sysnames.h>
 
-#define AFS_VM_RDWR_ENV        1
 #define AFS_VFS_ENV    1
 #define AFS_VFSINCL_ENV 1
 #define AFS_GREEDY43_ENV       1
index a4eddde..bb88fe2 100644 (file)
@@ -33,7 +33,6 @@
 
 #include <afs/afs_sysnames.h>
 
-#define AFS_VM_RDWR_ENV        1
 #define AFS_VFS_ENV    1
 #define AFS_VFSINCL_ENV 1
 #define AFS_GREEDY43_ENV       1
index 77c7891..07e7415 100644 (file)
@@ -56,7 +56,6 @@
 
 #include <afs/afs_sysnames.h>
 
-#define AFS_VM_RDWR_ENV        1
 #define AFS_VFS_ENV    1
 #define AFS_GREEDY43_ENV       1
 
index 0b5344e..bb63588 100644 (file)
@@ -56,7 +56,6 @@
 
 #include <afs/afs_sysnames.h>
 
-#define AFS_VM_RDWR_ENV        1
 #define AFS_VFS_ENV    1
 #define AFS_GREEDY43_ENV       1
 
index 1fc3062..95a1c02 100644 (file)
@@ -52,7 +52,6 @@
 
 #include <afs/afs_sysnames.h>
 
-#define AFS_VM_RDWR_ENV        1
 #define AFS_VFS_ENV    1
 #define AFS_GREEDY43_ENV       1
 
index 13876a7..d4b4730 100644 (file)
@@ -55,7 +55,6 @@
 
 #include <afs/afs_sysnames.h>
 
-#define AFS_VM_RDWR_ENV        1
 #define AFS_VFS_ENV    1
 #define AFS_GREEDY43_ENV       1
 
index 9a7677e..a65e5c9 100644 (file)
@@ -62,7 +62,6 @@
 
 #include <afs/afs_sysnames.h>
 
-#define AFS_VM_RDWR_ENV        1
 #define AFS_VFS_ENV    1
 #define AFS_GREEDY43_ENV       1
 
index 8d42db5..196e9d4 100644 (file)
@@ -63,7 +63,6 @@
 
 #include <afs/afs_sysnames.h>
 
-#define AFS_VM_RDWR_ENV        1
 #define AFS_VFS_ENV    1
 #define AFS_GREEDY43_ENV       1
 
index f54c5ee..f01ecb9 100644 (file)
@@ -64,7 +64,6 @@
 
 #include <afs/afs_sysnames.h>
 
-#define AFS_VM_RDWR_ENV        1
 #define AFS_VFS_ENV    1
 #define AFS_GREEDY43_ENV       1
 
index fb98352..a660e98 100644 (file)
@@ -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
 
index c0fd71f..0abbf7d 100644 (file)
@@ -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
 
index b229027..8011909 100644 (file)
@@ -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
 
index 5606275..177b331 100644 (file)
@@ -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
 
index c57197a..c67ef63 100644 (file)
@@ -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
 
index c657b1c..2f0ebd0 100644 (file)
@@ -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
 
index 58625b6..401cfa8 100644 (file)
@@ -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
 
index 384e4f9..2eb5f29 100644 (file)
@@ -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
 
index 16330ef..2d3d9a3 100644 (file)
@@ -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
 
index 73c8025..6f6c060 100644 (file)
@@ -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
 
index 7ca5a4c..7c4453b 100644 (file)
@@ -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
 
index 0d29ec1..a8b5edd 100644 (file)
@@ -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
 
index 8c2b5e4..9be4abd 100644 (file)
@@ -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
 
index 9f62840..26bdc07 100644 (file)
@@ -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
 
index 511b51a..ed8a996 100644 (file)
@@ -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
 
index 76cd821..4157780 100644 (file)
@@ -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
 
index 1750658..5561406 100644 (file)
@@ -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
 
index 652916b..6c44620 100644 (file)
@@ -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
 
index a5c1f3e..7adf325 100644 (file)
@@ -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
 
index 660b958..06d1990 100644 (file)
@@ -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
 
index ccfc344..8c7756a 100644 (file)
@@ -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
 
index af217cb..4d27576 100644 (file)
@@ -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
 
index dc3e588..58b4282 100644 (file)
@@ -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
 
index 4f62682..45d0cc1 100644 (file)
@@ -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
 
index f97e68c..e4a9069 100644 (file)
@@ -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