]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE12-linux-cleanup-partial-writes-20020801
authorChas Williams <chas@cmf.nrl.navy.mil>
Thu, 1 Aug 2002 20:12:01 +0000 (20:12 +0000)
committerDerrick Brashear <shadow@dementia.org>
Thu, 1 Aug 2002 20:12:01 +0000 (20:12 +0000)
Clean up partial write support on Linux by calling afs_DoPartialWrite
from afs_linux_writepage_sync.

(cherry picked from commit 14dc5dfa08cfe64f9abd3e5d98a5e6dc08f69736)

src/afs/LINUX/osi_vnodeops.c
src/afs/VNOPS/afs_vnop_write.c

index 85c8809d4a63006c771f3093f98d57665347ffda..e58af0ac7d2cdddbec3a48d376febd3ac74a83a9 100644 (file)
@@ -1405,13 +1405,24 @@ int afs_linux_writepage_sync(struct inode *ip, struct page *pp,
               ICL_TYPE_POINTER, pp,
               ICL_TYPE_INT32, atomic_read(&pp->count),
               ICL_TYPE_INT32, 99999);
+
     setup_uio(&tuio, &iovec, buffer, base, count, UIO_WRITE, AFS_UIOSYS);
 
     code = afs_write(vcp, &tuio, f_flags, credp, 0);
 
     vcache2inode(vcp);
 
+    if (!code && afs_stats_cmperf.cacheCurrDirtyChunks >
+                afs_stats_cmperf.cacheMaxDirtyChunks) {
+       struct vrequest treq;
+
+       ObtainWriteLock(&vcp->lock, 533);
+       if (!afs_InitReq(&treq, credp))
+           code = afs_DoPartialWrite(vcp, &treq);
+       ReleaseWriteLock(&vcp->lock);
+    }
     code = code ? -code : count - tuio.uio_resid;
+
     afs_Trace4(afs_iclSetp, CM_TRACE_UPDATEPAGE, ICL_TYPE_POINTER, vcp,
               ICL_TYPE_POINTER, pp,
               ICL_TYPE_INT32, atomic_read(&pp->count),
index a2b926b98e03f87b0aa0489b0a11b724fc325a77..6fe89f9016a4ffbfe4ae1a9e0e6280a334107b8c 100644 (file)
@@ -283,7 +283,7 @@ afs_MemWrite(avc, auio, aio, acred, noLock)
        if (filePos > avc->m.Length)
            avc->m.Length = filePos;
 #endif
-#if !defined(AFS_VM_RDWR_ENV) || defined(AFS_LINUX22_ENV)
+#if !defined(AFS_VM_RDWR_ENV)
        /*
         * If write is implemented via VM, afs_DoPartialWrite() is called from
         * the high-level write op.
@@ -580,7 +580,7 @@ afs_UFSWrite(avc, auio, aio, acred, noLock)
        }
 #endif
        osi_UFSClose(tfile);
-#if !defined(AFS_VM_RDWR_ENV) || defined(AFS_LINUX22_ENV)
+#if !defined(AFS_VM_RDWR_ENV)
        /*
         * If write is implemented via VM, afs_DoPartialWrite() is called from
         * the high-level write op.