Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-3]: src/sys/nfs Pull up following revision(s) (requested by yamt ...



details:   https://anonhg.NetBSD.org/src/rev/04c8c7f0a8d4
branches:  netbsd-3
changeset: 577527:04c8c7f0a8d4
user:      tron <tron%NetBSD.org@localhost>
date:      Mon Nov 21 20:51:21 2005 +0000

description:
Pull up following revision(s) (requested by yamt in ticket #980):
        sys/nfs/nfs_bio.c: revision 1.137
nfs_bioread: push delayed truncation and tweak loop accordingly.
PR/31926 from Jed Davis.

diffstat:

 sys/nfs/nfs_bio.c |  23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)

diffs (60 lines):

diff -r d0cd514b2051 -r 04c8c7f0a8d4 sys/nfs/nfs_bio.c
--- a/sys/nfs/nfs_bio.c Mon Nov 21 20:50:39 2005 +0000
+++ b/sys/nfs/nfs_bio.c Mon Nov 21 20:51:21 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nfs_bio.c,v 1.128.2.1 2005/11/21 20:50:39 tron Exp $   */
+/*     $NetBSD: nfs_bio.c,v 1.128.2.2 2005/11/21 20:51:21 tron Exp $   */
 
 /*
  * Copyright (c) 1989, 1993
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_bio.c,v 1.128.2.1 2005/11/21 20:50:39 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_bio.c,v 1.128.2.2 2005/11/21 20:51:21 tron Exp $");
 
 #include "opt_nfs.h"
 #include "opt_ddb.h"
@@ -191,24 +191,23 @@
                nfsstats.biocache_reads++;
 
                error = 0;
-               while (uio->uio_offset < np->n_size && uio->uio_resid > 0) {
+               while (uio->uio_resid > 0) {
                        void *win;
                        int flags;
-                       const u_quad_t nsize = np->n_size;
-                       vsize_t bytelen = MIN(nsize - uio->uio_offset,
-                                             uio->uio_resid);
+                       vsize_t bytelen;
 
+                       nfs_delayedtruncate(vp);
+                       if (np->n_size <= uio->uio_offset) {
+                               break;
+                       }
+                       bytelen =
+                           MIN(np->n_size - uio->uio_offset, uio->uio_resid);
                        win = ubc_alloc(&vp->v_uobj, uio->uio_offset,
                                        &bytelen, UBC_READ);
                        error = uiomove(win, bytelen, uio);
                        flags = UBC_WANT_UNMAP(vp) ? UBC_UNMAP : 0;
                        ubc_release(win, flags);
                        if (error) {
-                               if (nsize <= np->n_size) {
-                                       /* report error */
-                                       break;
-                               }
-
                                /*
                                 * XXXkludge
                                 * the file has been truncated on the server.
@@ -217,6 +216,8 @@
                                if (uio->uio_offset >= np->n_size) {
                                        /* end of file */
                                        error = 0;
+                               } else {
+                                       break;
                                }
                        }
                }



Home | Main Index | Thread Index | Old Index