obj->opo_non_exist = 1;
}
- /* Invalid the opo cache for the object after the object
- * is being created, so attr_get will try to get attr
- * from the remote object. XXX this can be improved when
- * we have object lock/cache invalidate mechanism in OSP
- * layer */
- if (obj->opo_ooa != NULL) {
- spin_lock(&obj->opo_lock);
- obj->opo_ooa->ooa_attr.la_valid = 0;
- spin_unlock(&obj->opo_lock);
- }
+ /*
+ * invalidate opo cache for the object after the object is created, so
+ * attr_get will try to get attr from remote object.
+ */
+ osp_invalidate(env, &obj->opo_obj);
return 0;
}
struct dt_object_format *dof,
struct thandle *th)
{
- struct osp_object *obj = dt2osp_obj(dt);
- int rc;
-
- if (obj->opo_ooa == NULL) {
- rc = osp_oac_init(obj);
- if (rc != 0)
- return rc;
- }
-
return osp_trans_update_request_create(th);
}
dt->do_lu.lo_header->loh_attr |= LOHA_EXISTS | (attr->la_mode & S_IFMT);
dt2osp_obj(dt)->opo_non_exist = 0;
- LASSERT(obj->opo_ooa != NULL);
- obj->opo_ooa->ooa_attr = *attr;
+ obj->opo_attr = *attr;
out:
return rc;
}
.do_index_try = osp_md_index_try,
.do_object_lock = osp_md_object_lock,
.do_object_unlock = osp_md_object_unlock,
+ .do_invalidate = osp_invalidate,
};
/**
/* XXX: how about the write error happened later? */
*pos += buf->lb_len;
- if (obj->opo_ooa != NULL &&
- obj->opo_ooa->ooa_attr.la_valid & LA_SIZE &&
- obj->opo_ooa->ooa_attr.la_size < *pos)
- obj->opo_ooa->ooa_attr.la_size = *pos;
+ if (obj->opo_attr.la_valid & LA_SIZE && obj->opo_attr.la_size < *pos)
+ obj->opo_attr.la_size = *pos;
RETURN(buf->lb_len);
}