Whamcloud - gitweb
Branch b1_6
authoryangsheng <yangsheng>
Thu, 7 Aug 2008 02:55:33 +0000 (02:55 +0000)
committeryangsheng <yangsheng>
Thu, 7 Aug 2008 02:55:33 +0000 (02:55 +0000)
b=16342
i=adilger, shadow

Don't update obd_osfs_age for osc using the cached info.

lustre/include/lustre/lustre_idl.h
lustre/include/obd_class.h
lustre/lov/lov_internal.h
lustre/lov/lov_request.c

index 33d4482..5826bd9 100644 (file)
@@ -592,6 +592,9 @@ extern void lustre_swab_obd_statfs (struct obd_statfs *os);
 #define OBD_STATFS_NODELAY      0x0001  /* requests should be send without delay
                                          * and resends for avoid deadlocks */
 
+#define OBD_STATFS_FROM_CACHE   0x0002  /* the statfs callback should not update
+                                         * obd_osfs_age */
+
 /* ost_body.data values for OST_BRW */
 
 #define OBD_BRW_READ            0x01
index c1e7a5c..a193bef 100644 (file)
@@ -794,6 +794,7 @@ static inline int obd_statfs_async(struct obd_device *obd,
                 spin_lock(&obd->obd_osfs_lock);
                 memcpy(oinfo->oi_osfs, &obd->obd_osfs, sizeof(*oinfo->oi_osfs));
                 spin_unlock(&obd->obd_osfs_lock);
+                oinfo->oi_flags |= OBD_STATFS_FROM_CACHE;
                 if (oinfo->oi_cb_up)
                         oinfo->oi_cb_up(oinfo, 0);
         }
index 4689e16..bbeca84 100644 (file)
@@ -243,8 +243,8 @@ int lov_prep_cancel_set(struct obd_export *exp, struct obd_info *oinfo,
 int lov_fini_cancel_set(struct lov_request_set *set);
 int lov_prep_statfs_set(struct obd_device *obd, struct obd_info *oinfo,
                         struct lov_request_set **reqset);
-void lov_update_statfs(struct obd_device *obd, struct obd_statfs *osfs,
-                       struct obd_statfs *lov_sfs, int success);
+void lov_update_statfs(struct obd_statfs *osfs, struct obd_statfs *lov_sfs,
+                       int success);
 int lov_fini_statfs(struct obd_device *obd, struct obd_statfs *osfs,
                     int success);
 int lov_fini_statfs_set(struct lov_request_set *set);
index 3b3e749..ba7c9c6 100644 (file)
@@ -1465,7 +1465,7 @@ int lov_fini_statfs(struct obd_device *obd, struct obd_statfs *osfs,int success)
 
                 spin_lock(&obd->obd_osfs_lock);
                 memcpy(&obd->obd_osfs, osfs, sizeof(*osfs));
-                obd->obd_osfs_age = get_jiffies_64();
+                obd->obd_osfs_age = cfs_time_current_64();
                 spin_unlock(&obd->obd_osfs_lock);
                 RETURN(0);
         }
@@ -1492,15 +1492,11 @@ int lov_fini_statfs_set(struct lov_request_set *set)
         RETURN(rc);
 }
 
-void lov_update_statfs(struct obd_device *obd, struct obd_statfs *osfs,
-                       struct obd_statfs *lov_sfs, int success)
+void lov_update_statfs(struct obd_statfs *osfs, struct obd_statfs *lov_sfs,
+                       int success)
 {
         int shift = 0, quit = 0;
         __u64 tmp;
-        spin_lock(&obd->obd_osfs_lock);
-        memcpy(&obd->obd_osfs, lov_sfs, sizeof(*lov_sfs));
-        obd->obd_osfs_age = get_jiffies_64();
-        spin_unlock(&obd->obd_osfs_lock);
 
         if (success == 0) {
                 memcpy(osfs, lov_sfs, sizeof(*lov_sfs));
@@ -1594,7 +1590,13 @@ static int cb_statfs_update(struct obd_info *oinfo, int rc)
                 RETURN(rc);
         }
 
-        lov_update_statfs(obd, osfs, lov_sfs, success);
+        spin_lock(&obd->obd_osfs_lock);
+        memcpy(&obd->obd_osfs, lov_sfs, sizeof(*lov_sfs));
+        if ((oinfo->oi_flags & OBD_STATFS_FROM_CACHE) == 0)
+                obd->obd_osfs_age = cfs_time_current_64();
+        spin_unlock(&obd->obd_osfs_lock);
+
+        lov_update_statfs(osfs, lov_sfs, success);
         qos_update(lov);
 
         RETURN(0);