From b97100cdfbbb1861e87606df54f53b705bd17b74 Mon Sep 17 00:00:00 2001 From: yangsheng <yangsheng> Date: Thu, 7 Aug 2008 02:55:33 +0000 Subject: [PATCH] Branch b1_6 b=16342 i=adilger, shadow Don't update obd_osfs_age for osc using the cached info. --- lustre/include/lustre/lustre_idl.h | 3 +++ lustre/include/obd_class.h | 1 + lustre/lov/lov_internal.h | 4 ++-- lustre/lov/lov_request.c | 18 ++++++++++-------- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h index 33d4482f41..5826bd9c5b 100644 --- a/lustre/include/lustre/lustre_idl.h +++ b/lustre/include/lustre/lustre_idl.h @@ -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 diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index c1e7a5ccea..a193befb6c 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -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); } diff --git a/lustre/lov/lov_internal.h b/lustre/lov/lov_internal.h index 4689e16988..bbeca84800 100644 --- a/lustre/lov/lov_internal.h +++ b/lustre/lov/lov_internal.h @@ -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); diff --git a/lustre/lov/lov_request.c b/lustre/lov/lov_request.c index 3b3e749c75..ba7c9c6f8c 100644 --- a/lustre/lov/lov_request.c +++ b/lustre/lov/lov_request.c @@ -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); -- GitLab