static struct lu_device *lovsub_device_fini(const struct lu_env *env, struct lu_device *d) { struct lu_device *next; struct lovsub_device *lsd; ENTRY; lsd = lu2lovsub_dev(d); next = cl2lu_dev(lsd->acid_next); lsd->acid_next = NULL; RETURN(next); }
static struct lu_device *lovsub_device_fini(const struct lu_env *env, struct lu_device *d) { struct lu_device *next; struct lovsub_device *lsd; lsd = lu2lovsub_dev(d); next = cl2lu_dev(lsd->acid_next); lsd->acid_super = NULL; lsd->acid_next = NULL; return next; }
static struct lu_device *lovsub_device_free(const struct lu_env *env, struct lu_device *d) { struct lovsub_device *lsd = lu2lovsub_dev(d); struct lu_device *next = cl2lu_dev(lsd->acid_next); if (atomic_read(&d->ld_ref) && d->ld_site) { LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, D_ERROR, NULL); lu_site_print(env, d->ld_site, &msgdata, lu_cdebug_printer); } cl_device_fini(lu2cl_dev(d)); OBD_FREE_PTR(lsd); return next; }
int lovsub_object_init(const struct lu_env *env, struct lu_object *obj, const struct lu_object_conf *conf) { struct lovsub_device *dev = lu2lovsub_dev(obj->lo_dev); struct lu_object *below; struct lu_device *under; int result; under = &dev->acid_next->cd_lu_dev; below = under->ld_ops->ldo_object_alloc(env, obj->lo_header, under); if (below) { lu_object_add(obj, below); cl_object_page_init(lu2cl(obj), sizeof(struct lovsub_page)); result = 0; } else { result = -ENOMEM; } return result; }
static int lovsub_device_init(const struct lu_env *env, struct lu_device *d, const char *name, struct lu_device *next) { struct lovsub_device *lsd = lu2lovsub_dev(d); struct lu_device_type *ldt; int rc; next->ld_site = d->ld_site; ldt = next->ld_type; LASSERT(ldt != NULL); rc = ldt->ldt_ops->ldto_device_init(env, next, ldt->ldt_name, NULL); if (rc) { next->ld_site = NULL; return rc; } lu_device_get(next); lu_ref_add(&next->ld_reference, "lu-stack", &lu_site_init); lsd->acid_next = lu2cl_dev(next); return rc; }