Exemplo n.º 1
0
/* Request sequence-controller node to allocate new super-sequence. */
int seq_client_alloc_super(struct lu_client_seq *seq,
                           const struct lu_env *env)
{
        int rc;
        ENTRY;

	mutex_lock(&seq->lcs_mutex);

        if (seq->lcs_srv) {
#ifdef HAVE_SEQ_SERVER
                LASSERT(env != NULL);
                rc = seq_server_alloc_super(seq->lcs_srv, &seq->lcs_space,
                                            env);
#else
		rc = 0;
#endif
	} else {
		/* Check whether the connection to seq controller has been
		 * setup (lcs_exp != NULL) */
		if (seq->lcs_exp == NULL) {
			mutex_unlock(&seq->lcs_mutex);
			RETURN(-EINPROGRESS);
		}

		rc = seq_client_rpc(seq, &seq->lcs_space,
                                    SEQ_ALLOC_SUPER, "super");
        }
	mutex_unlock(&seq->lcs_mutex);
        RETURN(rc);
}
Exemplo n.º 2
0
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);
}
Exemplo n.º 3
0
/* Request sequence-controller node to allocate new super-sequence. */
int seq_client_alloc_super(struct lu_client_seq *seq,
                           const struct lu_env *env)
{
        int rc;
        ENTRY;

        cfs_mutex_lock(&seq->lcs_mutex);

#ifdef __KERNEL__
        if (seq->lcs_srv) {
                LASSERT(env != NULL);
                rc = seq_server_alloc_super(seq->lcs_srv, &seq->lcs_space,
                                            env);
        } else {
#endif
                rc = seq_client_rpc(seq, &seq->lcs_space,
                                    SEQ_ALLOC_SUPER, "super");
#ifdef __KERNEL__
        }
#endif
        cfs_mutex_unlock(&seq->lcs_mutex);
        RETURN(rc);
}