static int seq_server_handle(struct lu_site *site, const struct lu_env *env, __u32 opc, struct lu_seq_range *out) { int rc; struct seq_server_site *ss_site; ENTRY; ss_site = lu_site2seq(site); switch (opc) { case SEQ_ALLOC_META: if (!ss_site->ss_server_seq) { CERROR("Sequence server is not " "initialized\n"); RETURN(-EINVAL); } rc = seq_server_alloc_meta(ss_site->ss_server_seq, out, env); break; case SEQ_ALLOC_SUPER: if (!ss_site->ss_control_seq) { CERROR("Sequence controller is not " "initialized\n"); RETURN(-EINVAL); } rc = seq_server_alloc_super(ss_site->ss_control_seq, out, env); break; default: rc = -EINVAL; break; } RETURN(rc); }
static int fld_handle_read(struct tgt_session_info *tsi) { struct obd_export *exp = tsi->tsi_exp; struct lu_site *site = exp->exp_obd->obd_lu_dev->ld_site; struct lu_seq_range *in; void *data; int rc; ENTRY; req_capsule_set(tsi->tsi_pill, &RQF_FLD_READ); in = req_capsule_client_get(tsi->tsi_pill, &RMF_FLD_MDFLD); if (in == NULL) RETURN(err_serious(-EPROTO)); req_capsule_set_size(tsi->tsi_pill, &RMF_GENERIC_DATA, RCL_SERVER, PAGE_CACHE_SIZE); rc = req_capsule_server_pack(tsi->tsi_pill); if (unlikely(rc != 0)) RETURN(err_serious(rc)); data = req_capsule_server_get(tsi->tsi_pill, &RMF_GENERIC_DATA); rc = fld_server_read(tsi->tsi_env, lu_site2seq(site)->ss_server_fld, in, data, PAGE_CACHE_SIZE); RETURN(rc); }
/** * All MDT server handle fld lookup operation. But only MDT0 has fld index. * if entry is not found in cache we need to forward lookup request to MDT0 */ static int fld_handle_lookup(struct tgt_session_info *tsi) { struct obd_export *exp = tsi->tsi_exp; struct lu_site *site = exp->exp_obd->obd_lu_dev->ld_site; struct lu_server_fld *fld; struct lu_seq_range *in; struct lu_seq_range *out; int rc; ENTRY; in = req_capsule_client_get(tsi->tsi_pill, &RMF_FLD_MDFLD); if (in == NULL) RETURN(err_serious(-EPROTO)); rc = req_capsule_server_pack(tsi->tsi_pill); if (unlikely(rc != 0)) RETURN(err_serious(rc)); out = req_capsule_server_get(tsi->tsi_pill, &RMF_FLD_MDFLD); if (out == NULL) RETURN(err_serious(-EPROTO)); *out = *in; fld = lu_site2seq(site)->ss_server_fld; rc = fld_server_lookup(tsi->tsi_env, fld, in->lsr_start, out); CDEBUG(D_INFO, "%s: FLD req handle: error %d (range: "DRANGE")\n", fld->lsf_name, rc, PRANGE(out)); RETURN(rc); }
/* * Returns true, if fid is local to this server node. * * WARNING: this function is *not* guaranteed to return false if fid is * remote: it makes an educated conservative guess only. * * fid_is_local() is supposed to be used in assertion checks only. */ int fid_is_local(const struct lu_env *env, struct lu_site *site, const struct lu_fid *fid) { int result; struct seq_server_site *ss_site; struct lu_seq_range *range; struct fld_thread_info *info; ENTRY; info = lu_context_key_get(&env->le_ctx, &fld_thread_key); range = &info->fti_lrange; result = 1; /* conservatively assume fid is local */ ss_site = lu_site2seq(site); if (ss_site->ss_client_fld != NULL) { int rc; rc = fld_cache_lookup(ss_site->ss_client_fld->lcf_cache, fid_seq(fid), range); if (rc == 0) result = (range->lsr_index == ss_site->ss_node_id); } return result; }