From 75a336c1904e33697f338409f30fdfca18edc11b Mon Sep 17 00:00:00 2001 From: yangsheng <yangsheng> Date: Thu, 7 Aug 2008 02:59:38 +0000 Subject: [PATCH] Branch HEAD 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 7b19bf497f..01e6ce129d 100644 --- a/lustre/include/lustre/lustre_idl.h +++ b/lustre/include/lustre/lustre_idl.h @@ -920,6 +920,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 8c156153bb..f75b144f33 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -1020,6 +1020,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 fbcf06c1a6..90db5db247 100644 --- a/lustre/lov/lov_internal.h +++ b/lustre/lov/lov_internal.h @@ -246,8 +246,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 17b699d51f..4df9dff069 100644 --- a/lustre/lov/lov_request.c +++ b/lustre/lov/lov_request.c @@ -1479,7 +1479,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); } @@ -1506,15 +1506,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)); @@ -1608,7 +1604,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