Source-Changes-HG archive

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

[src/trunk]: src/sys/nfs nfsm_wcc_data: update n_ctime and n_nctime if no one...



details:   https://anonhg.NetBSD.org/src/rev/1914186232e6
branches:  trunk
changeset: 565366:1914186232e6
user:      yamt <yamt%NetBSD.org@localhost>
date:      Mon Apr 05 10:28:23 2004 +0000

description:
nfsm_wcc_data: update n_ctime and n_nctime if no one other than us
changed the file in the meantime so that we won't invalidate caches
unnecessarily due to our own activities.

diffstat:

 sys/nfs/nfsm_subs.h |  17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diffs (41 lines):

diff -r fa87514c0323 -r 1914186232e6 sys/nfs/nfsm_subs.h
--- a/sys/nfs/nfsm_subs.h       Mon Apr 05 10:27:11 2004 +0000
+++ b/sys/nfs/nfsm_subs.h       Mon Apr 05 10:28:23 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nfsm_subs.h,v 1.34 2004/03/19 13:52:07 yamt Exp $      */
+/*     $NetBSD: nfsm_subs.h,v 1.35 2004/04/05 10:28:23 yamt Exp $      */
 
 /*
  * Copyright (c) 1989, 1993
@@ -258,10 +258,19 @@
 #define NFSV3_WCCCHK   1
 
 #define        nfsm_wcc_data(v, f, flags) \
-               { int ttattrf, ttretf = 0; \
+               { int ttattrf, ttretf = 0, renewctime = 0, renewnctime = 0; \
                nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \
                if (*tl == nfs_true) { \
+                       struct timespec ctime; \
                        nfsm_dissect(tl, u_int32_t *, 6 * NFSX_UNSIGNED); \
+                       fxdr_nfsv3time(tl + 4, &ctime); \
+                       if (VTONFS(v)->n_ctime == ctime.tv_sec) \
+                               renewctime = 1; \
+                       if ((v)->v_type == VDIR) { \
+                               if (timespeccmp(&VTONFS(v)->n_nctime, \
+                                   &ctime, ==)) \
+                                       renewnctime = 1; \
+                       } \
                        if (f) { \
                                struct timespec mtime; \
                                fxdr_nfsv3time(tl + 2, &mtime); \
@@ -270,6 +279,10 @@
                        } \
                } \
                nfsm_postop_attr((v), ttattrf, (flags)); \
+               if (renewctime && ttattrf) \
+                       VTONFS(v)->n_ctime = VTONFS(v)->n_vattr->va_ctime.tv_sec; \
+               if (renewnctime && ttattrf) \
+                       VTONFS(v)->n_nctime = VTONFS(v)->n_vattr->va_ctime; \
                if (f) { \
                        (f) = ttretf; \
                } else { \



Home | Main Index | Thread Index | Old Index