int seq_store_init(struct lu_server_seq *seq, const struct lu_env *env, struct dt_device *dt) { struct dt_object *dt_obj; struct lu_fid fid; const char *name; int rc; ENTRY; name = seq->lss_type == LUSTRE_SEQ_SERVER ? LUSTRE_SEQ_SRV_NAME : LUSTRE_SEQ_CTL_NAME; dt_obj = dt_store_open(env, dt, "", name, &fid); if (!IS_ERR(dt_obj)) { seq->lss_obj = dt_obj; rc = 0; } else { CERROR("%s: Can't find \"%s\" obj %d\n", seq->lss_name, name, (int)PTR_ERR(dt_obj)); rc = PTR_ERR(dt_obj); } RETURN(rc); }
/** * open the PENDING directory for device \a mdd * * The PENDING directory persistently tracks files and directories that were * unlinked from the namespace (nlink == 0) but are still held open by clients. * Those inodes shouldn't be deleted if the MDS crashes, because the clients * would not be able to recover and reopen those files. Instead, these inodes * are linked into the PENDING directory on disk, and only deleted if all * clients close them, or the MDS finishes client recovery without any client * reopening them (i.e. former clients didn't join recovery). * \param d mdd device being started. * * \retval 0 success * \retval -ve index operation error. * */ int orph_index_init(const struct lu_env *env, struct mdd_device *mdd) { struct lu_fid fid; struct dt_object *d; int rc = 0; ENTRY; d = dt_store_open(env, mdd->mdd_child, "", orph_index_name, &fid); if (!IS_ERR(d)) { mdd->mdd_orphans = d; if (!dt_try_as_dir(env, d)) { rc = -ENOTDIR; CERROR("\"%s\" is not an index! : rc = %d\n", orph_index_name, rc); } } else { CERROR("cannot find \"%s\" obj %d\n", orph_index_name, (int)PTR_ERR(d)); rc = PTR_ERR(d); } RETURN(rc); }
int fld_index_init(struct lu_server_fld *fld, const struct lu_env *env, struct dt_device *dt) { struct dt_object *dt_obj; struct lu_fid fid; int rc; ENTRY; dt_obj = dt_store_open(env, dt, "", fld_index_name, &fid); if (!IS_ERR(dt_obj)) { fld->lsf_obj = dt_obj; rc = dt_obj->do_ops->do_index_try(env, dt_obj, &fld_index_features); if (rc == 0) { LASSERT(dt_obj->do_index_ops != NULL); rc = fld_insert_igif_fld(fld, env); if (rc != 0) { CERROR("insert igif in fld! = %d\n", rc); lu_object_put(env, &dt_obj->do_lu); fld->lsf_obj = NULL; } } else CERROR("%s: File \"%s\" is not an index!\n", fld->lsf_name, fld_index_name); } else { CERROR("%s: Can't find \"%s\" obj %d\n", fld->lsf_name, fld_index_name, (int)PTR_ERR(dt_obj)); rc = PTR_ERR(dt_obj); } RETURN(rc); }