Ejemplo n.º 1
0
static struct dt_object *out_get_dt_obj(struct lu_object *obj)
{
	struct mdt_device *mdt;
	struct dt_device *dt;
	struct lu_object *bottom_obj;

	mdt = lu2mdt_dev(obj->lo_dev);
	dt = mdt->mdt_bottom;

	bottom_obj = lu_object_locate(obj->lo_header, dt->dd_lu_dev.ld_type);
	if (bottom_obj == NULL)
		return ERR_PTR(-ENOENT);

	return lu2dt_obj(bottom_obj);
}
Ejemplo n.º 2
0
static int osp_object_init(const struct lu_env *env, struct lu_object *o,
			   const struct lu_object_conf *conf)
{
	struct osp_object	*po = lu2osp_obj(o);
	int			rc = 0;
	ENTRY;

	if (is_ost_obj(o)) {
		po->opo_obj.do_ops = &osp_obj_ops;
	} else {
		struct lu_attr		*la = &osp_env_info(env)->osi_attr;

		po->opo_obj.do_ops = &osp_md_obj_ops;
		o->lo_header->loh_attr |= LOHA_REMOTE;
		rc = po->opo_obj.do_ops->do_attr_get(env, lu2dt_obj(o),
						     la, NULL);
		if (rc == 0)
			o->lo_header->loh_attr |=
				LOHA_EXISTS | (la->la_mode & S_IFMT);
		if (rc == -ENOENT)
			rc = 0;
	}
	RETURN(rc);
}