unsigned long lqr_dirty:1; /* recalc round-robin list */
};
+/* allow statfs data caching for 1 second */
+#define OBD_STATFS_CACHE_SECONDS 1
+
struct lov_statfs_data {
struct obd_info lsd_oi;
struct obd_statfs lsd_statfs;
/* For now we will always get up-to-date statfs values, but in the
* future we may allow some amount of caching on the client (e.g.
* from QOS or lprocfs updates). */
- rc = llu_statfs_internal(sbi, &osfs, cfs_time_current_64() - CFS_HZ);
+ rc = llu_statfs_internal(sbi, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS));
if (rc)
return rc;
GOTO(out_md, err);
}
- err = obd_statfs(obd, &osfs, cfs_time_current_64() - CFS_HZ, 0);
+ err = obd_statfs(obd, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), 0);
if (err)
GOTO(out_md_fid, err);
CDEBUG(D_VFSTRACE, "VFS Op: at "LPU64" jiffies\n", get_jiffies_64());
ll_stats_ops_tally(ll_s2sbi(sb), LPROC_LL_STAFS, 1);
- /* For now we will always get up-to-date statfs values, but in the
- * future we may allow some amount of caching on the client (e.g.
- * from QOS or lprocfs updates). */
- rc = ll_statfs_internal(sb, &osfs, cfs_time_current_64() - 1, 0);
+ /* Some amount of caching on the client is allowed */
+ rc = ll_statfs_internal(sb, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
+ 0);
if (rc)
return rc;
int rc;
LASSERT(sb != NULL);
- rc = ll_statfs_internal(sb, &osfs, cfs_time_current_64() - CFS_HZ,
+ rc = ll_statfs_internal(sb, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc) {
*eof = 1;
int rc;
LASSERT(sb != NULL);
- rc = ll_statfs_internal(sb, &osfs, cfs_time_current_64() - CFS_HZ,
+ rc = ll_statfs_internal(sb, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc) {
__u32 blk_size = osfs.os_bsize >> 10;
int rc;
LASSERT(sb != NULL);
- rc = ll_statfs_internal(sb, &osfs, cfs_time_current_64() - CFS_HZ,
+ rc = ll_statfs_internal(sb, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc) {
__u32 blk_size = osfs.os_bsize >> 10;
int rc;
LASSERT(sb != NULL);
- rc = ll_statfs_internal(sb, &osfs, cfs_time_current_64() - CFS_HZ,
+ rc = ll_statfs_internal(sb, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc) {
__u32 blk_size = osfs.os_bsize >> 10;
int rc;
LASSERT(sb != NULL);
- rc = ll_statfs_internal(sb, &osfs, cfs_time_current_64() - CFS_HZ,
+ rc = ll_statfs_internal(sb, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc) {
*eof = 1;
int rc;
LASSERT(sb != NULL);
- rc = ll_statfs_internal(sb, &osfs, cfs_time_current_64() - CFS_HZ,
+ rc = ll_statfs_internal(sb, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc) {
*eof = 1;
RETURN(-EFAULT);
rc = obd_statfs(mdc_obd, &stat_buf,
- cfs_time_current_64() - CFS_HZ, 0);
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
+ 0);
if (rc)
RETURN(rc);
if (cfs_copy_to_user(data->ioc_pbuf1, &stat_buf,
* later in alloc_qos(), we will wait for those rpcs to complete if
* the osfs age is older than 2 * qos_maxage */
qos_statfs_update(exp->exp_obd,
- cfs_time_shift_64(-lov->desc.ld_qos_maxage) + CFS_HZ,
+ cfs_time_shift_64(-lov->desc.ld_qos_maxage +
+ OBD_STATFS_CACHE_SECONDS),
0);
rc = lov_prep_create_set(exp, &oinfo, ea, src_oa, oti, &set);
/* got statfs data */
rc = obd_statfs(osc_obd, &stat_buf,
- cfs_time_current_64() - CFS_HZ, 0);
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
+ 0);
if (rc)
RETURN(rc);
if (cfs_copy_to_user(data->ioc_pbuf1, &stat_buf,
GOTO(out, rc = -EFAULT);
rc = mdc_statfs(obd, &stat_buf,
- cfs_time_current_64() - CFS_HZ, 0);
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
+ 0);
if (rc != 0)
GOTO(out, rc);
int *eof, void *data)
{
struct obd_statfs osfs;
- int rc = obd_statfs(data, &osfs, cfs_time_current_64() - CFS_HZ,
+ int rc = obd_statfs(data, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc) {
*eof = 1;
int *eof, void *data)
{
struct obd_statfs osfs;
- int rc = obd_statfs(data, &osfs, cfs_time_current_64() - CFS_HZ,
+ int rc = obd_statfs(data, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc) {
__u32 blk_size = osfs.os_bsize >> 10;
int *eof, void *data)
{
struct obd_statfs osfs;
- int rc = obd_statfs(data, &osfs, cfs_time_current_64() - CFS_HZ,
+ int rc = obd_statfs(data, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc) {
__u32 blk_size = osfs.os_bsize >> 10;
int *eof, void *data)
{
struct obd_statfs osfs;
- int rc = obd_statfs(data, &osfs, cfs_time_current_64() - CFS_HZ,
+ int rc = obd_statfs(data, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc) {
__u32 blk_size = osfs.os_bsize >> 10;
int *eof, void *data)
{
struct obd_statfs osfs;
- int rc = obd_statfs(data, &osfs, cfs_time_current_64() - CFS_HZ,
+ int rc = obd_statfs(data, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc) {
*eof = 1;
int *eof, void *data)
{
struct obd_statfs osfs;
- int rc = obd_statfs(data, &osfs, cfs_time_current_64() - CFS_HZ,
+ int rc = obd_statfs(data, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc) {
*eof = 1;
OBD_ALLOC(osfs, sizeof(*osfs));
if (osfs == NULL)
RETURN(-ENOMEM);
- rc = filter_statfs(obd, osfs, cfs_time_current_64() - CFS_HZ,
+ rc = filter_statfs(obd, osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
0);
if (rc == 0 && osfs->os_bavail < (osfs->os_blocks >> 10)) {
CDEBUG(D_RPCTRACE,"%s: not enough space for create "
LASSERT_SPIN_LOCKED(&obd->obd_osfs_lock);
if (cfs_time_before_64(obd->obd_osfs_age,
- cfs_time_current_64() - CFS_HZ)) {
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS))) {
restat:
rc = fsfilt_statfs(obd, obd->u.obt.obt_sb,
- cfs_time_current_64() + CFS_HZ);
+ cfs_time_shift_64(OBD_STATFS_CACHE_SECONDS));
if (rc) /* N.B. statfs can't really fail */
RETURN(0);
statfs_done = 1;
osfs = req_capsule_server_get(&req->rq_pill, &RMF_OBD_STATFS);
req->rq_status = obd_statfs(req->rq_export->exp_obd, osfs,
- cfs_time_current_64() - CFS_HZ, 0);
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
+ 0);
if (req->rq_status != 0)
CERROR("ost: statfs failed: rc %d\n", req->rq_status);