Beispiel #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);
}
Beispiel #2
0
/* Request sequence-controller node to allocate new meta-sequence. */
static int seq_client_alloc_meta(const struct lu_env *env,
                                 struct lu_client_seq *seq)
{
        int rc;
        ENTRY;

        if (seq->lcs_srv) {
#ifdef HAVE_SEQ_SERVER
                LASSERT(env != NULL);
                rc = seq_server_alloc_meta(seq->lcs_srv, &seq->lcs_space, env);
#else
		rc = 0;
#endif
	} else {
		do {
			/* If meta server return -EINPROGRESS or EAGAIN,
			 * it means meta server might not be ready to
			 * allocate super sequence from sequence controller
			 * (MDT0)yet */
			rc = seq_client_rpc(seq, &seq->lcs_space,
					    SEQ_ALLOC_META, "meta");
		} while (rc == -EINPROGRESS || rc == -EAGAIN);
        }

        RETURN(rc);
}
Beispiel #3
0
/* Request sequence-controller node to allocate new meta-sequence. */
static int seq_client_alloc_meta(const struct lu_env *env,
				 struct lu_client_seq *seq)
{
	int rc;

	do {
		/* If meta server return -EINPROGRESS or EAGAIN,
		 * it means meta server might not be ready to
		 * allocate super sequence from sequence controller
		 * (MDT0)yet
		 */
		rc = seq_client_rpc(seq, &seq->lcs_space,
				    SEQ_ALLOC_META, "meta");
	} while (rc == -EINPROGRESS || rc == -EAGAIN);

	return rc;
}
Beispiel #4
0
/* Request sequence-controller node to allocate new meta-sequence. */
static int seq_client_alloc_meta(const struct lu_env *env,
                                 struct lu_client_seq *seq)
{
        int rc;
        ENTRY;

#ifdef __KERNEL__
        if (seq->lcs_srv) {
                LASSERT(env != NULL);
                rc = seq_server_alloc_meta(seq->lcs_srv, &seq->lcs_space, env);
        } else {
#endif
                rc = seq_client_rpc(seq, &seq->lcs_space,
                                    SEQ_ALLOC_META, "meta");
#ifdef __KERNEL__
        }
#endif
        RETURN(rc);
}
Beispiel #5
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;

	mutex_lock(&seq->lcs_mutex);

	if (seq->lcs_srv) {
		rc = 0;
	} 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;
}
Beispiel #6
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);
}
Beispiel #7
0
/* Request sequence-controller node to allocate new meta-sequence. */
static int seq_client_alloc_meta(const struct lu_env *env,
                                 struct lu_client_seq *seq)
{
        int rc;
        ENTRY;

        if (seq->lcs_srv) {
#ifdef HAVE_SEQ_SERVER
                LASSERT(env != NULL);
                rc = seq_server_alloc_meta(seq->lcs_srv, &seq->lcs_space, env);
#else
		rc = 0;
#endif
	} else {
		do {
			/* If meta server return -EINPROGRESS or EAGAIN,
			 * it means meta server might not be ready to
			 * allocate super sequence from sequence controller
			 * (MDT0)yet */
			rc = seq_client_rpc(seq, &seq->lcs_space,
					    SEQ_ALLOC_META, "meta");
			if (rc == -EINPROGRESS || rc == -EAGAIN) {
				wait_queue_head_t waitq;
				struct l_wait_info  lwi;

				/* MDT0 is not ready, let's wait for 2
				 * seconds and retry. */
				init_waitqueue_head(&waitq);
				lwi = LWI_TIMEOUT(cfs_time_seconds(2), NULL,
						  NULL);
				l_wait_event(waitq, 0, &lwi);
			}
		} while (rc == -EINPROGRESS || rc == -EAGAIN);
        }

        RETURN(rc);
}