/* get new range from controller only if super-sequence is not yet
* initialized from backing store or something else. */
if (range_is_zero(&seq->lss_super)) {
- rc = seq_client_alloc_super(cli);
+ rc = seq_client_alloc_super(cli, ctx);
if (rc) {
up(&seq->lss_sem);
CERROR("can't allocate super-sequence, "
RETURN(-EOPNOTSUPP);
}
- rc = seq_client_alloc_super(seq->lss_cli);
+ rc = seq_client_alloc_super(seq->lss_cli, ctx);
if (rc) {
CERROR("can't allocate new super-sequence, "
"rc %d\n", rc);
}
ctx = req->rq_svc_thread->t_ctx;
+ LASSERT(ctx != NULL);
+ LASSERT(ctx->lc_thread == req->rq_svc_thread);
rc = seq_server_handle(site, ctx, *opc, in, out);
} else
rc = -EPROTO;
}
/* request sequence-controller node to allocate new super-sequence. */
-static int __seq_client_alloc_super(struct lu_client_seq *seq)
+static int __seq_client_alloc_super(struct lu_client_seq *seq,
+ const struct lu_context *ctx)
{
int rc;
#ifdef __KERNEL__
if (seq->lcs_srv) {
+ LASSERT(ctx != NULL);
rc = seq_server_alloc_super(seq->lcs_srv, NULL,
&seq->lcs_range,
- seq->lcs_ctx);
+ ctx);
} else {
#endif
rc = seq_client_rpc(seq, &seq->lcs_range,
return rc;
}
-int seq_client_alloc_super(struct lu_client_seq *seq)
+int seq_client_alloc_super(struct lu_client_seq *seq,
+ const struct lu_context *ctx)
{
int rc;
ENTRY;
down(&seq->lcs_sem);
- rc = __seq_client_alloc_super(seq);
+ rc = __seq_client_alloc_super(seq, ctx);
up(&seq->lcs_sem);
RETURN(rc);
EXPORT_SYMBOL(seq_client_alloc_super);
/* request sequence-controller node to allocate new meta-sequence. */
-static int __seq_client_alloc_meta(struct lu_client_seq *seq)
+static int __seq_client_alloc_meta(struct lu_client_seq *seq,
+ const struct lu_context *ctx)
{
int rc;
#ifdef __KERNEL__
if (seq->lcs_srv) {
+ LASSERT(ctx != NULL);
rc = seq_server_alloc_meta(seq->lcs_srv, NULL,
&seq->lcs_range,
- seq->lcs_ctx);
+ ctx);
} else {
#endif
rc = seq_client_rpc(seq, &seq->lcs_range,
return rc;
}
-int seq_client_alloc_meta(struct lu_client_seq *seq)
+int seq_client_alloc_meta(struct lu_client_seq *seq,
+ const struct lu_context *ctx)
{
int rc;
ENTRY;
down(&seq->lcs_sem);
- rc = __seq_client_alloc_meta(seq);
+ rc = __seq_client_alloc_meta(seq, ctx);
up(&seq->lcs_sem);
RETURN(rc);
/* if we still have free sequences in meta-sequence we allocate new seq
* from given range, if not - allocate new meta-sequence. */
if (range_space(&seq->lcs_range) == 0) {
- rc = __seq_client_alloc_meta(seq);
+ rc = __seq_client_alloc_meta(seq, NULL);
if (rc) {
CERROR("can't allocate new meta-sequence, "
"rc %d\n", rc);
struct obd_export *exp,
enum lu_cli_type type,
const char *prefix,
- struct lu_server_seq *srv,
- const struct lu_context *ctx)
+ struct lu_server_seq *srv)
{
int rc;
ENTRY;
LASSERT(seq != NULL);
LASSERT(prefix != NULL);
- seq->lcs_ctx = ctx;
seq->lcs_exp = exp;
seq->lcs_srv = srv;
seq->lcs_type = type;
seq->lcs_width = LUSTRE_SEQ_MAX_WIDTH;
if (exp == NULL) {
- LASSERT(seq->lcs_ctx != NULL);
LASSERT(seq->lcs_srv != NULL);
} else {
LASSERT(seq->lcs_exp != NULL);
/* seq-server for direct talking */
struct lu_server_seq *lcs_srv;
- const struct lu_context *lcs_ctx;
};
/* server sequence manager interface */
struct obd_export *exp,
enum lu_cli_type type,
const char *prefix,
- struct lu_server_seq *srv,
- const struct lu_context *ctx);
+ struct lu_server_seq *srv);
void seq_client_fini(struct lu_client_seq *seq);
-int seq_client_alloc_super(struct lu_client_seq *seq);
-int seq_client_alloc_meta(struct lu_client_seq *seq);
+int seq_client_alloc_super(struct lu_client_seq *seq,
+ const struct lu_context *ctx);
+
+int seq_client_alloc_meta(struct lu_client_seq *seq,
+ const struct lu_context *ctx);
int seq_client_alloc_seq(struct lu_client_seq *seq,
seqno_t *seqnr);
+
int seq_client_alloc_fid(struct lu_client_seq *seq,
struct lu_fid *fid);
/* init client side sequence-manager */
rc = seq_client_init(cli->cl_seq, exp,
LUSTRE_SEQ_METADATA,
- prefix, NULL, NULL);
+ prefix, NULL);
OBD_FREE(prefix, MAX_OBD_NAME + 5);
if (rc)
GOTO(out_free_seq, rc);
/* pre-allocate meta-sequence */
- rc = seq_client_alloc_meta(cli->cl_seq);
+ rc = seq_client_alloc_meta(cli->cl_seq, NULL);
if (rc) {
CERROR("can't allocate new mata-sequence, "
"rc %d\n", rc);
*/
rc = seq_client_init(ls->ls_client_seq, NULL,
LUSTRE_SEQ_METADATA, prefix,
- ls->ls_control_seq, ctx);
+ ls->ls_control_seq);
OBD_FREE(prefix, MAX_OBD_NAME + 5);
if (rc)
rc = seq_client_init(ls->ls_client_seq,
ls->ls_control_exp,
LUSTRE_SEQ_METADATA,
- prefix, NULL, NULL);
+ prefix, NULL);
OBD_FREE(prefix, MAX_OBD_NAME + 5);
} else
rc = -ENOMEM;