static inline int lu_device_is_cmm(struct lu_device *d)
{
- /*
- * XXX for now. Tags in lu_device_type->ldt_something are needed.
- */
return ergo(d != NULL && d->ld_ops != NULL, d->ld_ops == &cmm_lu_ops);
}
if (cmm_dev->cmm_local_num == 0)
return cmm_child_ops(cmm_dev)->mdo_root_get(ctx,
cmm_dev->cmm_child, fid);
- else
+ else
return -EINVAL;
}
RETURN (rc);
}
-int cmm_notify(const struct lu_context *ctxt, struct md_device *md,
- struct obd_device *watched,
+int cmm_notify(const struct lu_context *ctxt, struct md_device *md,
+ struct obd_device *watched,
enum obd_notify_event ev, void *data)
{
struct cmm_device *cmm_dev = md2cmm_dev(md);
int rc;
- rc = cmm_child_ops(cmm_dev)->mdo_notify(ctxt, cmm_dev->cmm_child,
+ rc = cmm_child_ops(cmm_dev)->mdo_notify(ctxt, cmm_dev->cmm_child,
watched, ev, data);
return rc;
const char *index = lustre_cfg_string(cfg, 2);
char *p;
LASSERT(index);
-
+
/* lower layers should be set up at first */
err = next->ld_ops->ldo_process_config(ctx, next, cfg);
if (err == 0) {
OBD_ALLOC_PTR(ls->ls_client_fld);
if (!ls->ls_client_fld)
RETURN(-ENOMEM);
-
+
err = fld_client_init(ls->ls_client_fld, "CMM_UUID",
LUSTRE_CLI_FLD_HASH_RRB);
if (err) {
fld_client_fini(ls->ls_client_fld);
OBD_FREE_PTR(ls->ls_client_fld);
ls->ls_client_fld = NULL;
-
+
/* finish all mdc devices */
spin_lock(&cm->cmm_tgt_guard);
list_for_each_entry_safe(mc, tmp, &cm->cmm_targets, mc_linkage) {
};
static struct lu_device_type cmm_device_type = {
- .ldt_tags = LU_DEVICE_MD,
- .ldt_name = LUSTRE_CMM0_NAME,
- .ldt_ops = &cmm_device_type_ops
+ .ldt_tags = LU_DEVICE_MD,
+ .ldt_name = LUSTRE_CMM0_NAME,
+ .ldt_ops = &cmm_device_type_ops,
+ .ldt_ctx_tags = LCT_MD_THREAD
};
struct lprocfs_vars lprocfs_cmm_obd_vars[] = {
static inline int lu_device_is_mdc(struct lu_device *ld)
{
- /*
- * XXX for now. Tags in lu_device_type->ldt_something are needed.
- */
return ergo(ld != NULL && ld->ld_ops != NULL,
ld->ld_ops == &mdc_lu_ops);
}
ENTRY;
LASSERT(uuid_str);
LASSERT(index);
-
+
mc->mc_num = simple_strtol(index, &p, 10);
if (*p) {
- CERROR("Invalid index in lustre_cgf, offset 2\n");
+ CERROR("Invalid index in lustre_cgf, offset 2\n");
RETURN(-EINVAL);
}
}
struct lu_context_key mdc_thread_key = {
+ .lct_tags = LCT_MD_THREAD|LCT_CL_THREAD,
.lct_init = mdc_thread_init,
.lct_fini = mdc_thread_fini
};
};
struct lu_device_type mdc_device_type = {
- .ldt_tags = LU_DEVICE_MD,
- .ldt_name = LUSTRE_MDC0_NAME,
- .ldt_ops = &mdc_device_type_ops
+ .ldt_tags = LU_DEVICE_MD,
+ .ldt_name = LUSTRE_MDC0_NAME,
+ .ldt_ops = &mdc_device_type_ops,
+ .ldt_ctx_tags = LCT_MD_THREAD|LCT_CL_THREAD
};
{
int rc = 0;
ENTRY;
-
+
LASSERT(cli != NULL);
if (seq->seq_cli) {
cli->seq_exp->exp_client_uuid.uuid);
down(&seq->seq_sem);
-
+
/* assign controller */
seq->seq_cli = cli;
down(&seq->seq_sem);
seq->seq_cli = NULL;
up(&seq->seq_sem);
-
+
EXIT;
}
EXPORT_SYMBOL(seq_server_fini_ctlr);
ENTRY;
LASSERT(range_is_sane(space));
-
+
if (range_space(space) < seq->seq_super_width) {
CWARN("sequences space is going to exhaust soon. "
"Only can allocate "LPU64" sequences\n",
CDEBUG(D_INFO, "SEQ-MGR(srv): allocated super-sequence "
"["LPX64"-"LPX64"]\n", range->lr_start, range->lr_end);
}
-
+
RETURN(rc);
}
down(&seq->seq_sem);
rc = __seq_server_alloc_super(seq, range, ctx);
up(&seq->seq_sem);
-
+
RETURN(rc);
}
down(&seq->seq_sem);
rc = __seq_server_alloc_meta(seq, range, ctx);
up(&seq->seq_sem);
-
+
RETURN(rc);
}
static int
seq_server_handle(struct lu_server_seq *seq,
- const struct lu_context *ctx,
+ const struct lu_context *ctx,
struct lu_range *range,
__u32 opc)
{
static int
seq_req_handle0(const struct lu_context *ctx,
- struct ptlrpc_request *req)
+ struct ptlrpc_request *req)
{
int rep_buf_size[2] = { 0, };
struct obd_device *obd;
CERROR("can't get range buffer\n");
GOTO(out_pill, rc= -EPROTO);
}
-
+
if (*opc == SEQ_ALLOC_META) {
if (!site->ls_server_seq) {
CERROR("sequence-server is not initialized\n");
return rc;
}
-static int
-seq_req_handle(struct ptlrpc_request *req)
+static int
+seq_req_handle(struct ptlrpc_request *req)
{
int fail = OBD_FAIL_SEQ_ALL_REPLY_NET;
const struct lu_context *ctx;
ENTRY;
OBD_FAIL_RETURN(OBD_FAIL_SEQ_ALL_REPLY_NET | OBD_FAIL_ONCE, 0);
-
+
ctx = req->rq_svc_thread->t_ctx;
LASSERT(ctx != NULL);
LASSERT(ctx->lc_thread == req->rq_svc_thread);
out:
target_send_reply(req, rc, fail);
return 0;
-}
+}
#ifdef LPROCFS
static int
struct dt_device *dev,
const char *uuid,
lu_server_type_t type,
- const struct lu_context *ctx)
+ const struct lu_context *ctx)
{
int rc, portal = (type == LUSTRE_SEQ_SRV) ?
SEQ_SRV_PORTAL : SEQ_CTLR_PORTAL;
-
- struct ptlrpc_service_conf seq_conf = {
- .psc_nbufs = MDS_NBUFS,
- .psc_bufsize = MDS_BUFSIZE,
+
+ struct ptlrpc_service_conf seq_conf = {
+ .psc_nbufs = MDS_NBUFS,
+ .psc_bufsize = MDS_BUFSIZE,
.psc_max_req_size = MDS_MAXREQSIZE,
.psc_max_reply_size = MDS_MAXREPSIZE,
.psc_req_portal = portal,
.psc_rep_portal = MDC_REPLY_PORTAL,
- .psc_watchdog_timeout = SEQ_SERVICE_WATCHDOG_TIMEOUT,
- .psc_num_threads = SEQ_NUM_THREADS
+ .psc_watchdog_timeout = SEQ_SERVICE_WATCHDOG_TIMEOUT,
+ .psc_num_threads = SEQ_NUM_THREADS,
+ .psc_ctx_tags = LCT_MD_THREAD|LCT_DT_THREAD
};
ENTRY;
snprintf(seq->seq_name, sizeof(seq->seq_name), "%s-%s-%s",
LUSTRE_SEQ_NAME, (type == LUSTRE_SEQ_SRV ? "srv" : "ctlr"),
uuid);
-
+
seq->seq_space = LUSTRE_SEQ_SPACE_RANGE;
seq->seq_super = LUSTRE_SEQ_ZERO_RANGE;
-
+
lu_device_get(&seq->seq_dev->dd_lu_dev);
rc = seq_store_init(seq, ctx);
if (rc)
GOTO(out, rc);
-
+
/* request backing store for saved sequence info */
rc = seq_store_read(seq, ctx);
if (rc == -ENODATA) {
rc);
GOTO(out, rc);
}
-
+
#ifdef LPROCFS
rc = seq_server_proc_init(seq);
if (rc)
seq->seq_service = ptlrpc_init_svc_conf(&seq_conf,
seq_req_handle,
LUSTRE_SEQ_NAME,
- seq->seq_proc_entry,
- NULL);
+ seq->seq_proc_entry,
+ NULL);
if (seq->seq_service != NULL)
rc = ptlrpc_start_threads(NULL, seq->seq_service,
LUSTRE_SEQ_NAME);
- else
- rc = -ENOMEM;
+ else
+ rc = -ENOMEM;
EXIT;
(type == LUSTRE_SEQ_SRV ? "Server" : "Controller"));
}
return rc;
-}
+}
EXPORT_SYMBOL(seq_server_init);
void
seq_server_fini(struct lu_server_seq *seq,
- const struct lu_context *ctx)
+ const struct lu_context *ctx)
{
ENTRY;
lu_device_put(&seq->seq_dev->dd_lu_dev);
seq->seq_dev = NULL;
}
-
+
CDEBUG(D_INFO|D_WARNING, "Server Sequence "
"Manager\n");
EXIT;
RETURN(0);
}
-static int
-__init fid_mod_init(void)
+static int
+__init fid_mod_init(void)
{
/* init caches if any */
return 0;
}
-static void
-__exit fid_mod_exit(void)
+static void
+__exit fid_mod_exit(void)
{
/* free caches if any */
fid_fini();
.psc_req_portal = FLD_REQUEST_PORTAL,
.psc_rep_portal = MDC_REPLY_PORTAL,
.psc_watchdog_timeout = FLD_SERVICE_WATCHDOG_TIMEOUT,
- .psc_num_threads = FLD_NUM_THREADS
+ .psc_num_threads = FLD_NUM_THREADS,
+ .psc_ctx_tags = LCT_DT_THREAD|LCT_MD_THREAD
};
ENTRY;
static int fld_key_registered = 0;
static struct lu_context_key fld_thread_key = {
+ .lct_tags = LCT_MD_THREAD|LCT_DT_THREAD,
.lct_init = fld_key_init,
.lct_fini = fld_key_fini
};
* XXX: temporary pointer to associated obd_type.
*/
struct obd_type *ldt_obd_type;
+ /*
+ * XXX: temporary: context tags used by obd_*() calls.
+ */
+ __u32 ldt_ctx_tags;
};
/*
*
* To achieve this, set of tags in introduced. Contexts and keys are
* marked with tags. Key value are created only for context whose set
- * of tags has non-empty intersection with one for key. NOT YET
- * IMPLEMENTED.
+ * of tags has non-empty intersection with one for key. Tags are taken
+ * from enum lu_context_tag.
*/
__u32 lc_tags;
/*
* lu_context_key interface. Similar to pthread_key.
*/
+enum lu_context_tag {
+ LCT_MD_THREAD = 1 << 0,
+ LCT_DT_THREAD = 1 << 1,
+ LCT_TX_HANDLE = 1 << 2,
+ LCT_CL_THREAD = 1 << 3
+};
/*
* Key. Represents per-context value slot.
*/
struct lu_context_key {
/*
+ * Set of tags for which values of this key are to be instantiated.
+ */
+ __u32 lct_tags;
+ /*
* Value constructor. This is called when new value is created for a
* context. Returns pointer to new value of error pointer.
*/
/*
* Initialize context data-structure. Create values for all keys.
*/
-int lu_context_init(struct lu_context *ctx);
+int lu_context_init(struct lu_context *ctx, __u32 tags);
/*
* Finalize context data-structure. Destroy key values.
*/
cfs_waitq_t srv_free_rs_waitq;
/*
+ * Tags for lu_context associated with this thread, see struct
+ * lu_context.
+ */
+ __u32 srv_ctx_tags;
+ /*
* if non-NULL called during thread creation (ptlrpc_start_thread())
* to initialize service specific per-thread state.
*/
int psc_rep_portal;
int psc_watchdog_timeout; /* in ms */
int psc_num_threads;
+ __u32 psc_ctx_tags;
};
/* ptlrpc/service.c */
int watchdog_timeout, /* in ms */
svc_handler_t, char *name,
cfs_proc_dir_entry_t *proc_entry,
- svcreq_printfn_t, int num_threads);
+ svcreq_printfn_t, int num_threads,
+ __u32 ctx_tags);
void ptlrpc_stop_all_threads(struct ptlrpc_service *svc);
int ptlrpc_start_threads(struct obd_device *dev, struct ptlrpc_service *svc,
if (ldt != NULL) {
struct lu_context ctx;
- rc = lu_context_init(&ctx);
+ rc = lu_context_init(&ctx, ldt->ldt_ctx_tags);
if (rc == 0) {
lu_context_enter(&ctx);
d = ldt->ldt_ops->ldto_device_alloc(&ctx, ldt, cfg);
if (ldt != NULL && d != NULL) {
struct lu_context ctx;
- rc = lu_context_init(&ctx);
+ rc = lu_context_init(&ctx, ldt->ldt_ctx_tags);
if (rc == 0) {
lu_context_enter(&ctx);
ldt->ldt_ops->ldto_device_free(&ctx, d);
if (ldt != NULL && d != NULL) {
struct lu_context ctx;
- rc = lu_context_init(&ctx);
+ rc = lu_context_init(&ctx, ldt->ldt_ctx_tags);
if (rc == 0) {
lu_context_enter(&ctx);
rc = d->ld_ops->ldo_process_config(&ctx, d, data);
Index: iam/fs/ext3/Makefile
===================================================================
--- iam.orig/fs/ext3/Makefile 2006-05-31 20:24:32.000000000 +0400
-+++ iam/fs/ext3/Makefile 2006-07-07 23:18:44.000000000 +0400
++++ iam/fs/ext3/Makefile 2006-07-19 15:20:42.000000000 +0400
@@ -6,7 +6,7 @@ obj-$(CONFIG_EXT3_FS) += ext3.o
ext3-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o iopen.o \
Index: iam/include/linux/lustre_iam.h
===================================================================
--- iam.orig/include/linux/lustre_iam.h 2006-05-31 20:24:32.000000000 +0400
-+++ iam/include/linux/lustre_iam.h 2006-07-07 23:18:44.000000000 +0400
++++ iam/include/linux/lustre_iam.h 2006-07-19 15:20:42.000000000 +0400
@@ -1,9 +1,68 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
Index: iam/fs/ext3/Makefile
===================================================================
---- iam.orig/fs/ext3/Makefile 2006-07-07 23:18:44.000000000 +0400
-+++ iam/fs/ext3/Makefile 2006-07-07 23:18:45.000000000 +0400
+--- iam.orig/fs/ext3/Makefile 2006-07-19 15:20:42.000000000 +0400
++++ iam/fs/ext3/Makefile 2006-07-19 15:20:43.000000000 +0400
@@ -6,7 +6,7 @@ obj-$(CONFIG_EXT3_FS) += ext3.o
ext3-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o iopen.o \
ext3-$(CONFIG_EXT3_FS_POSIX_ACL) += acl.o
Index: iam/fs/ext3/dir.c
===================================================================
---- iam.orig/fs/ext3/dir.c 2006-07-07 23:18:44.000000000 +0400
-+++ iam/fs/ext3/dir.c 2006-07-07 23:18:45.000000000 +0400
+--- iam.orig/fs/ext3/dir.c 2006-07-19 15:20:42.000000000 +0400
++++ iam/fs/ext3/dir.c 2006-07-19 15:20:43.000000000 +0400
@@ -28,6 +28,7 @@
#include <linux/smp_lock.h>
#include <linux/slab.h>
(filp->f_version != inode->i_version)) {
Index: iam/fs/ext3/file.c
===================================================================
---- iam.orig/fs/ext3/file.c 2006-07-07 23:18:44.000000000 +0400
-+++ iam/fs/ext3/file.c 2006-07-07 23:18:45.000000000 +0400
+--- iam.orig/fs/ext3/file.c 2006-07-19 15:20:42.000000000 +0400
++++ iam/fs/ext3/file.c 2006-07-19 15:20:43.000000000 +0400
@@ -23,6 +23,7 @@
#include <linux/jbd.h>
#include <linux/ext3_fs.h>
Index: iam/fs/ext3/iam-uapi.c
===================================================================
--- iam.orig/fs/ext3/iam-uapi.c 2004-04-06 17:27:52.000000000 +0400
-+++ iam/fs/ext3/iam-uapi.c 2006-07-07 23:18:45.000000000 +0400
++++ iam/fs/ext3/iam-uapi.c 2006-07-19 15:20:43.000000000 +0400
@@ -0,0 +1,361 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+}
Index: iam/fs/ext3/ioctl.c
===================================================================
---- iam.orig/fs/ext3/ioctl.c 2006-07-07 23:18:44.000000000 +0400
-+++ iam/fs/ext3/ioctl.c 2006-07-07 23:18:45.000000000 +0400
+--- iam.orig/fs/ext3/ioctl.c 2006-07-19 15:20:42.000000000 +0400
++++ iam/fs/ext3/ioctl.c 2006-07-19 15:20:43.000000000 +0400
@@ -250,6 +250,6 @@ flags_err:
}
Index: iam/include/linux/lustre_iam.h
===================================================================
---- iam.orig/include/linux/lustre_iam.h 2006-07-07 23:18:44.000000000 +0400
-+++ iam/include/linux/lustre_iam.h 2006-07-07 23:18:45.000000000 +0400
+--- iam.orig/include/linux/lustre_iam.h 2006-07-19 15:20:42.000000000 +0400
++++ iam/include/linux/lustre_iam.h 2006-07-19 15:20:43.000000000 +0400
@@ -30,9 +30,6 @@
#ifndef __LINUX_LUSTRE_IAM_H__
#define __LINUX_LUSTRE_IAM_H__
LDLM_MAXREPSIZE, LDLM_CB_REQUEST_PORTAL,
LDLM_CB_REPLY_PORTAL, ldlm_timeout * 900,
ldlm_callback_handler, "ldlm_cbd",
- ldlm_svc_proc_dir, NULL, LDLM_NUM_THREADS);
+ ldlm_svc_proc_dir, NULL, LDLM_NUM_THREADS,
+ LCT_MD_THREAD|LCT_DT_THREAD);
if (!ldlm_state->ldlm_cb_service) {
CERROR("failed to start service\n");
LDLM_MAXREPSIZE, LDLM_CANCEL_REQUEST_PORTAL,
LDLM_CANCEL_REPLY_PORTAL, 30000,
ldlm_cancel_handler, "ldlm_canceld",
- ldlm_svc_proc_dir, NULL, LDLM_NUM_THREADS);
+ ldlm_svc_proc_dir, NULL, LDLM_NUM_THREADS,
+ LCT_MD_THREAD|LCT_DT_THREAD);
if (!ldlm_state->ldlm_cancel_service) {
CERROR("failed to start service\n");
GOTO(cleanup, rc);
inserted = 1;
-
+
if (dt_try_as_dir(ctxt, dt_son)) {
rc = __mdd_ref_add(ctxt, mdo, handle);
if (rc)
};
static struct lu_device_type mdd_device_type = {
- .ldt_tags = LU_DEVICE_MD,
- .ldt_name = LUSTRE_MDD0_NAME,
- .ldt_ops = &mdd_device_type_ops
+ .ldt_tags = LU_DEVICE_MD,
+ .ldt_name = LUSTRE_MDD0_NAME,
+ .ldt_ops = &mdd_device_type_ops,
+ .ldt_ctx_tags = LCT_MD_THREAD
};
static void *mdd_key_init(const struct lu_context *ctx,
}
static struct lu_context_key mdd_thread_key = {
+ .lct_tags = LCT_MD_THREAD,
.lct_init = mdd_key_init,
.lct_fini = mdd_key_fini
};
int mdd_lov_init(const struct lu_context *ctxt, struct mdd_device *mdd,
struct lustre_cfg *cfg);
int mdd_lov_fini(const struct lu_context *ctxt, struct mdd_device *mdd);
-int mdd_notify(const struct lu_context *ctxt, struct md_device *md,
- struct obd_device *watched, enum obd_notify_event ev,
+int mdd_notify(const struct lu_context *ctxt, struct md_device *md,
+ struct obd_device *watched, enum obd_notify_event ev,
void *data);
int mdd_xattr_set(const struct lu_context *ctxt, struct md_object *obj,
const void *buf, int buf_len, const char *name);
int mdd_lov_set_md(const struct lu_context *ctxt, struct md_object *pobj,
- struct md_object *child, struct lov_mds_md *lmm,
+ struct md_object *child, struct lov_mds_md *lmm,
int lmm_size);
int mdd_lov_create(const struct lu_context *ctxt, struct mdd_device *mdd,
- struct mdd_object *child, struct lov_mds_md **lmm,
+ struct mdd_object *child, struct lov_mds_md **lmm,
int *lmm_size);
struct mdd_thread_info *mdd_ctx_info(const struct lu_context *ctx);
extern struct lu_device_operations mdd_lu_ops;
static inline int lu_device_is_mdd(struct lu_device *d)
{
- /*
- * XXX for now. Tags in lu_device_type->ldt_something are needed.
- */
return ergo(d != NULL && d->ld_ops != NULL, d->ld_ops == &mdd_lu_ops);
}
MDS_MAXREPSIZE, MDS_REQUEST_PORTAL,
MDC_REPLY_PORTAL, MDS_SERVICE_WATCHDOG_TIMEOUT,
mds_handle, LUSTRE_MDS_NAME,
- obd->obd_proc_entry, NULL, mds_num_threads);
+ obd->obd_proc_entry, NULL, mds_num_threads, 0);
if (!mds->mds_service) {
CERROR("failed to start service\n");
MDS_MAXREPSIZE, MDS_SETATTR_PORTAL,
MDC_REPLY_PORTAL, MDS_SERVICE_WATCHDOG_TIMEOUT,
mds_handle, "mds_setattr",
- obd->obd_proc_entry, NULL, mds_num_threads);
+ obd->obd_proc_entry, NULL, mds_num_threads, 0);
if (!mds->mds_setattr_service) {
CERROR("failed to start getattr service\n");
GOTO(err_thread, rc = -ENOMEM);
MDS_MAXREPSIZE, MDS_READPAGE_PORTAL,
MDC_REPLY_PORTAL, MDS_SERVICE_WATCHDOG_TIMEOUT,
mds_handle, "mds_readpage",
- obd->obd_proc_entry, NULL, mds_num_threads);
+ obd->obd_proc_entry, NULL, mds_num_threads, 0);
if (!mds->mds_readpage_service) {
CERROR("failed to start readpage service\n");
GOTO(err_thread2, rc = -ENOMEM);
* It should not be possible to fail adding an existing client - otherwise
* mdt_init_server_data() callsite needs to be fixed.
*/
-int mdt_client_add(const struct lu_context *ctxt,
+int mdt_client_add(const struct lu_context *ctxt,
struct mdt_device *mdt,
- struct mdt_export_data *med,
+ struct mdt_export_data *med,
int cl_idx)
{
unsigned long *bitmap = mdt->mdt_client_bitmap;
cl_idx, med->med_mcd->mcd_uuid);
med->med_lr_idx = cl_idx;
- med->med_lr_off = le32_to_cpu(msd->msd_client_start) +
+ med->med_lr_off = le32_to_cpu(msd->msd_client_start) +
(cl_idx * le16_to_cpu(msd->msd_client_size));
LASSERTF(med->med_lr_off > 0, "med_lr_off = %llu\n", med->med_lr_off);
if (new_client) {
loff_t off = med->med_lr_off;
int rc = 0;
-
+
/*
- rc = mdt->mdt_last->do_body_ops->dbo_write(ctxt,
+ rc = mdt->mdt_last->do_body_ops->dbo_write(ctxt,
mdt->mdt_last,
- mcd, sizeof(*mcd),
+ mcd, sizeof(*mcd),
&off);
*/
if (rc)
return 0;
}
-int mdt_update_server_data(const struct lu_context *ctxt,
- struct mdt_device *mdt,
+int mdt_update_server_data(const struct lu_context *ctxt,
+ struct mdt_device *mdt,
int sync)
{
struct mdt_server_data *msd = &mdt->mdt_msd;
CDEBUG(D_SUPER, "MDS mount_count is "LPU64", last_transno is "LPU64"\n",
mdt->mdt_mount_count, mdt->mdt_last_transno);
-
+
msd->msd_last_transno = cpu_to_le64(mdt->mdt_last_transno);
/*
- rc = mdt->mdt_last->do_body_ops->dbo_write(ctxt,
+ rc = mdt->mdt_last->do_body_ops->dbo_write(ctxt,
mdt->mdt_last,
msd,
sizeof(*msd), &off);
}
-int mdt_client_free(const struct lu_context *ctxt,
- struct mdt_device *mdt,
+int mdt_client_free(const struct lu_context *ctxt,
+ struct mdt_device *mdt,
struct mdt_export_data *med)
{
struct mdt_client_data *mcd = med->med_mcd;
memset(mcd, 0, sizeof *mcd);
/*
- rc = mdt->mdt_last->do_body_ops->dbo_write(ctxt,
+ rc = mdt->mdt_last->do_body_ops->dbo_write(ctxt,
mdt->mdt_last,
mcd,
sizeof(*mcd), &off);
return 0;
}
-static int mdt_init_server_data(const struct lu_context *ctxt,
+static int mdt_init_server_data(const struct lu_context *ctxt,
struct mdt_device *mdt)
{
struct mdt_server_data *msd = &mdt->mdt_msd;
OBD_INCOMPAT_COMMON_LR);
} else {
/*
- rc = mdt->mdt_last->do_body_ops->dbo_read(ctxt,
+ rc = mdt->mdt_last->do_body_ops->dbo_read(ctxt,
mdt->mdt_last,
msd,
sizeof(*msd), &off);
off = le32_to_cpu(msd->msd_client_start) +
cl_idx * le16_to_cpu(msd->msd_client_size);
/*
- rc = mdt->mdt_last->do_body_ops->dbo_read(ctxt,
+ rc = mdt->mdt_last->do_body_ops->dbo_read(ctxt,
mdt->mdt_last,
mcd,
sizeof(*mcd), &off);
}
/*
- * last_rcvd update callbacks
+ * last_rcvd update callbacks
*/
extern struct lu_context_key mdt_txn_key;
return 0;
}
-
-int mdt_fs_setup(const struct lu_context *ctxt,
+
+int mdt_fs_setup(const struct lu_context *ctxt,
struct mdt_device *mdt)
{
//struct lu_fid last_fid;
mdt->mdt_txn_cb.dtc_txn_stop = mdt_txn_stop_cb;
mdt->mdt_txn_cb.dtc_txn_commit = mdt_txn_commit_cb;
mdt->mdt_txn_cb.dtc_cookie = mdt;
-
+
dt_txn_callback_add(mdt->mdt_bottom, &mdt->mdt_txn_cb);
-/*
+/*
last = dt_store_open(ctxt, mdt->mdt_bottom, LAST_RCVD, &last_fid);
if(!IS_ERR(last)) {
mdt->mdt_last_rcvd = last;
}
-void mdt_fs_cleanup(const struct lu_context *ctxt,
+void mdt_fs_cleanup(const struct lu_context *ctxt,
struct mdt_device *mdt)
{
struct obd_device *obd = mdt->mdt_md_dev.md_lu_dev.ld_obd;
-
+
/* remove transaction callback */
dt_txn_callback_del(mdt->mdt_bottom, &mdt->mdt_txn_cb);
*/
unsigned long mdt_num_threads;
-/* ptlrpc request handler for MDT. All handlers are
+/* ptlrpc request handler for MDT. All handlers are
* grouped into several slices - struct mdt_opc_slice,
* and stored in an array - mdt_handlers[].
*/
int mh_fail_id;
/* Operation code for this handler */
__u32 mh_opc;
- /* flags are listed in enum mdt_handler_flags below. */
+ /* flags are listed in enum mdt_handler_flags below. */
__u32 mh_flags;
/* The actual handler function to execute. */
int (*mh_act)(struct mdt_thread_info *info);
RETURN(result);
}
-void mdt_pack_attr2body(struct mdt_body *b,
- struct lu_attr *attr,
+void mdt_pack_attr2body(struct mdt_body *b,
+ struct lu_attr *attr,
const struct lu_fid *fid)
{
b->valid |= OBD_MD_FLCTIME | OBD_MD_FLUID |
rc = mo_attr_get(ctxt, next, la);
if (rc == -EREMOTE) {
/* FIXME: This object is located on remote node.
- * What value should we return to client?
- * also in mdt_md_create() and mdt_object_open()
+ * What value should we return to client?
+ * also in mdt_md_create() and mdt_object_open()
*/
if (need_pack_reply) {
rc = req_capsule_pack(&info->mti_pill);
repbody->fid1 = *mdt_object_fid(o);
repbody->valid |= OBD_MD_FLID;
RETURN(0);
- }
+ }
if (rc){
CERROR("getattr error for "DFID3": %d\n",
PFID3(mdt_object_fid(o)), rc);
if ( !need_pack_reply)
goto skip_packing;
-
+
/* pre-getattr: to guess how many bytes we need. */
if (mdt_body_has_lov(la, reqbody)) {
/* this should return the total length, or error */
RETURN(rc);
}
rc = 0;
- }
+ }
req_capsule_set_size(pill, &RMF_EADATA, RCL_SERVER, rc);
}
#endif
repbody->valid |= OBD_MD_FLMODEASIZE;
}
- if (rc != 0)
+ if (rc != 0)
RETURN(rc);
#ifdef CONFIG_FS_POSIX_ACL
if ((req->rq_export->exp_connect_flags & OBD_CONNECT_ACL) &&
&RMF_EADATA,
RCL_SERVER);
if (length > 0) {
- rc = mo_xattr_get(info->mti_ctxt, next, buffer,
+ rc = mo_xattr_get(info->mti_ctxt, next, buffer,
length, XATTR_NAME_ACL_ACCESS);
if (rc < 0) {
CERROR("got acl size: %d\n", rc);
name = req_capsule_client_get(&info->mti_pill, &RMF_NAME);
if (name == NULL)
RETURN(-EFAULT);
-
+
intent_set_disposition(ldlm_rep, DISP_LOOKUP_EXECD);
if (strlen(name) == 0) {
/* only open the child. parent is on another node. */
result = mdt_object_lock(info, child, lhc, child_bits);
if (result != 0) {
/* finally, we can get attr for child. */
- result = mdt_getattr_internal(info, child,
+ result = mdt_getattr_internal(info, child,
ldlm_rep ? 0 : 1);
if (result != 0)
mdt_object_unlock(info, child, lhc);
/*
*step 3: find the child object by fid & lock it.
* regardless if it is local or remote.
- */
+ */
mdt_lock_handle_init(lhc);
lhc->mlh_mode = LCK_CR;
child = mdt_object_find_lock(info, child_fid, lhc, child_bits);
rc = mo_attr_get(info->mti_ctxt,
next, &info->mti_attr.ma_attr);
if (rc == 0) {
- body = req_capsule_server_get(pill,
+ body = req_capsule_server_get(pill,
&RMF_MDT_BODY);
- mdt_pack_attr2body(body,
- &info->mti_attr.ma_attr,
+ mdt_pack_attr2body(body,
+ &info->mti_attr.ma_attr,
fid);
}
}
RETURN(m);
}
-int mdt_object_lock(struct mdt_thread_info *info, struct mdt_object *o,
+int mdt_object_lock(struct mdt_thread_info *info, struct mdt_object *o,
struct mdt_lock_handle *lh, __u64 ibits)
{
ldlm_policy_data_t *policy = &info->mti_policy;
}
spin_unlock(&mdt->mdt_transno_lock);
}
-
+
/*last_committed = (mdt->mdt_last_committed);*/
last_committed = last_transno;
#endif
txi = lu_context_key_get(info->mti_ctxt, &mdt_txn_key);
last_transno = txi->txi_transno;
- CDEBUG(D_INFO, "last_transno = %llu, last_committed = %llu\n",
+ CDEBUG(D_INFO, "last_transno = %llu, last_committed = %llu\n",
last_transno, last_committed);
req->rq_repmsg->transno = req->rq_transno = last_transno;
req->rq_repmsg->last_xid = req->rq_xid;
result = mdt_unpack_req_pack_rep(info, flags);
}
-
+
if (result == 0 && flags & HABEO_MUTABOR) {
if (req->rq_export->exp_connect_flags & OBD_CONNECT_RDONLY)
- result = -EROFS;
+ result = -EROFS;
}
if (result == 0 && flags & HABEO_CLAVIS) {
struct ldlm_request *dlm_req;
}
/* If we're DISCONNECTing, the mdt_export_data is already freed */
-
+
if (h->mh_opc != MDS_DISCONNECT &&
h->mh_opc != MDS_READPAGE &&
h->mh_opc != LDLM_ENQUEUE) {
int i;
memset(info, 0, sizeof(*info));
-
+
info->mti_rep_buf_nr = ARRAY_SIZE(info->mti_rep_buf_size);
for (i = 0; i < ARRAY_SIZE(info->mti_lh); i++)
mdt_lock_handle_init(&info->mti_lh[i]);
RETURN(+1);
}
-static int mdt_reply(struct ptlrpc_request *req, int result,
+static int mdt_reply(struct ptlrpc_request *req, int result,
struct mdt_thread_info *info)
{
struct obd_device *obd;
ldlm_rep = req_capsule_server_get(&info->mti_pill, &RMF_DLM_REP);
intent_set_disposition(ldlm_rep, DISP_IT_EXECD);
- ldlm_rep->lock_policy_res2 =
+ ldlm_rep->lock_policy_res2 =
mdt_getattr_name_lock(info, lhc, child_bits, ldlm_rep);
if (intent_disposition(ldlm_rep, DISP_LOOKUP_NEG))
* We'd like to have a mechanism to set this on a per-device
* basis, but alas...
*/
- .psc_num_threads = min(max(mdt_num_threads, MDT_MIN_THREADS),
- MDT_MAX_THREADS)
+ .psc_num_threads = min(max(mdt_num_threads, MDT_MIN_THREADS),
+ MDT_MAX_THREADS),
+ .psc_ctx_tags = LCT_MD_THREAD
};
ENTRY;
MDC_REPLY_PORTAL, MDT_SERVICE_WATCHDOG_TIMEOUT,
mdt_handle, "mds_readpage",
m->mdt_md_dev.md_lu_dev.ld_proc_entry, NULL,
- min(max(mdt_num_threads, MDT_MIN_THREADS), MDT_MAX_THREADS));
+ min(max(mdt_num_threads, MDT_MIN_THREADS),
+ MDT_MAX_THREADS), LCT_MD_THREAD);
if (m->mdt_readpage_service == NULL) {
CERROR("failed to start readpage service\n");
struct lu_site *ls = d->ld_site;
ENTRY;
-
+
mdt_fs_cleanup(ctx, m);
ping_evictor_stop();
LASSERT(info != NULL);
obd = class_name2obd(dev);
-
+
spin_lock_init(&m->mdt_transno_lock);
/* FIXME: We need to load them from disk. But now fake it */
m->mdt_last_transno = 100;
snprintf(info->mti_u.ns_name, sizeof info->mti_u.ns_name,
LUSTRE_MDT0_NAME"-%p", m);
- m->mdt_namespace = ldlm_namespace_new(info->mti_u.ns_name,
+ m->mdt_namespace = ldlm_namespace_new(info->mti_u.ns_name,
LDLM_NAMESPACE_SERVER);
if (m->mdt_namespace == NULL)
GOTO(err_fini_seq, rc = -ENOMEM);
int rc = 0;
ENTRY;
- CDEBUG(D_INFO, "object init, fid = "DFID3"\n",
+ CDEBUG(D_INFO, "object init, fid = "DFID3"\n",
PFID3(&o->lo_header->loh_fid));
under = &d->mdt_child->md_lu_dev;
if (mcd != NULL) {
memcpy(mcd->mcd_uuid, cluuid, sizeof mcd->mcd_uuid);
med->med_mcd = mcd;
- rc = lu_context_init(&ctxt);
+ rc = lu_context_init(&ctxt, LCT_MD_THREAD);
if (rc == 0) {
lu_context_enter(&ctxt);
/*
if (obd_uuid_equals(&export->exp_client_uuid, &obd->obd_uuid))
RETURN(0);
- rc = lu_context_init(&ctxt);
+ rc = lu_context_init(&ctxt, LCT_MD_THREAD);
if (rc)
RETURN(rc);
int rc;
ENTRY;
- lu_context_init(&ctxt);
+ lu_context_init(&ctxt, LCT_MD_THREAD);
mdt = mdt_dev(obd->obd_lu_dev);
next = mdt->mdt_child;
-
+
lu_context_enter(&ctxt);
rc = next->md_ops->mdo_notify(&ctxt, next, watched, ev, data);
lu_context_exit(&ctxt);
-
+
lu_context_fini(&ctxt);
RETURN(rc);
}
}
static struct lu_context_key mdt_thread_key = {
+ .lct_tags = LCT_MD_THREAD,
.lct_init = mdt_thread_init,
.lct_fini = mdt_thread_fini
};
}
struct lu_context_key mdt_txn_key = {
+ .lct_tags = LCT_TX_HANDLE|LCT_MD_THREAD,
.lct_init = mdt_txn_init,
.lct_fini = mdt_txn_fini
};
};
static struct lu_device_type mdt_device_type = {
- .ldt_tags = LU_DEVICE_MD,
- .ldt_name = LUSTRE_MDT0_NAME,
- .ldt_ops = &mdt_device_type_ops
+ .ldt_tags = LU_DEVICE_MD,
+ .ldt_name = LUSTRE_MDT0_NAME,
+ .ldt_ops = &mdt_device_type_ops,
+ .ldt_ctx_tags = LCT_MD_THREAD
};
static struct lprocfs_vars lprocfs_mdt_obd_vars[] = {
DEF_MDT_HNDL_F(0 |HABEO_REFERO, GETSTATUS, mdt_getstatus),
DEF_MDT_HNDL_F(HABEO_CORPUS, GETATTR, mdt_getattr),
DEF_MDT_HNDL_F(HABEO_CORPUS, GETATTR_NAME, mdt_getattr_name),
-DEF_MDT_HNDL_F(HABEO_CORPUS|HABEO_REFERO|HABEO_MUTABOR,
+DEF_MDT_HNDL_F(HABEO_CORPUS|HABEO_REFERO|HABEO_MUTABOR,
SETXATTR, mdt_setxattr),
DEF_MDT_HNDL_F(HABEO_CORPUS, GETXATTR, mdt_getxattr),
DEF_MDT_HNDL_F(0 |HABEO_REFERO, STATFS, mdt_statfs),
MGS_MAXREPSIZE, MGS_REQUEST_PORTAL,
MGC_REPLY_PORTAL, MGS_SERVICE_WATCHDOG_TIMEOUT,
mgs_handle, LUSTRE_MGS_NAME,
- obd->obd_proc_entry, NULL, MGS_NUM_THREADS);
+ obd->obd_proc_entry, NULL, MGS_NUM_THREADS,
+ LCT_MD_THREAD);
if (!mgs->mgs_service) {
CERROR("failed to start service\n");
/* Free the namespace in it's own thread, so that if the
ldlm_cancel_handler put the last mgs obd ref, we won't
deadlock here. */
- cfs_kernel_thread(mgs_ldlm_nsfree, obd->obd_namespace,
+ cfs_kernel_thread(mgs_ldlm_nsfree, obd->obd_namespace,
CLONE_VM | CLONE_FILES);
lvfs_clear_rdonly(save_dev);
struct lu_context_key *key;
key = lu_keys[i];
- if (key != NULL) {
+ if (key != NULL && key->lct_tags & ctx->lc_tags) {
void *value;
LASSERT(key->lct_init != NULL);
/*
* Initialize context data-structure. Create values for all keys.
*/
-int lu_context_init(struct lu_context *ctx)
+int lu_context_init(struct lu_context *ctx, __u32 tags)
{
memset(ctx, 0, sizeof *ctx);
+ ctx->lc_tags = tags;
keys_init(ctx);
return 0;
}
th->th_dev = d;
lu_device_get(&d->dd_lu_dev);
/* add commit callback */
- lu_context_init(&th->th_ctx);
+ lu_context_init(&th->th_ctx, LCT_TX_HANDLE);
journal_callback_set(jh, osd_trans_commit_cb,
(struct journal_callback *)&oh->ot_jcb);
} else {
}
static struct lu_context_key osd_key = {
+ .lct_tags = LCT_MD_THREAD|LCT_DT_THREAD,
.lct_init = osd_key_init,
.lct_fini = osd_key_fini
};
};
static struct lu_device_type osd_device_type = {
- .ldt_tags = LU_DEVICE_DT,
- .ldt_name = LUSTRE_OSD0_NAME,
- .ldt_ops = &osd_device_type_ops
+ .ldt_tags = LU_DEVICE_DT,
+ .ldt_name = LUSTRE_OSD0_NAME,
+ .ldt_ops = &osd_device_type_ops,
+ .ldt_ctx_tags = LCT_MD_THREAD|LCT_DT_THREAD
};
/*
OSC_REPLY_PORTAL,
obd_timeout * 1000, ost_handle, LUSTRE_OSS_NAME,
obd->obd_proc_entry, ost_print_req,
- ost_num_threads);
+ ost_num_threads, LCT_DT_THREAD);
if (ost->ost_service == NULL) {
CERROR("failed to start service\n");
GOTO(out_lprocfs, rc = -ENOMEM);
OST_MAXREPSIZE, OST_CREATE_PORTAL,
OSC_REPLY_PORTAL,
obd_timeout * 1000, ost_handle, "ost_create",
- obd->obd_proc_entry, ost_print_req, 1);
+ obd->obd_proc_entry, ost_print_req, 1,
+ LCT_DT_THREAD);
if (ost->ost_create_service == NULL) {
CERROR("failed to start OST create service\n");
GOTO(out_service, rc = -ENOMEM);
OSC_REPLY_PORTAL,
obd_timeout * 1000, ost_handle, "ost_io",
obd->obd_proc_entry, ost_print_req,
- ost_num_threads);
+ ost_num_threads, LCT_DT_THREAD);
if (ost->ost_io_service == NULL) {
CERROR("failed to start OST I/O service\n");
GOTO(out_create, rc = -ENOMEM);
c->psc_req_portal, c->psc_rep_portal,
c->psc_watchdog_timeout,
h, name, proc_entry,
- prntfn, c->psc_num_threads);
+ prntfn, c->psc_num_threads, c->psc_ctx_tags);
}
EXPORT_SYMBOL(ptlrpc_init_svc_conf);
int req_portal, int rep_portal, int watchdog_timeout,
svc_handler_t handler, char *name,
cfs_proc_dir_entry_t *proc_entry,
- svcreq_printfn_t svcreq_printfn, int num_threads)
+ svcreq_printfn_t svcreq_printfn, int num_threads,
+ __u32 ctx_tags)
{
int rc;
struct ptlrpc_service *service;
LASSERT (nbufs > 0);
LASSERT (bufsize >= max_req_size);
+ LASSERT (ctx_tags != 0);
OBD_ALLOC(service, sizeof(*service));
if (service == NULL)
service->srv_request_seq = 1; /* valid seq #s start at 1 */
service->srv_request_max_cull_seq = 0;
service->srv_num_threads = num_threads;
+ service->srv_ctx_tags = ctx_tags;
CFS_INIT_LIST_HEAD(&service->srv_request_queue);
CFS_INIT_LIST_HEAD(&service->srv_idle_rqbds);
goto out;
}
- rc = lu_context_init(&ctx);
+ rc = lu_context_init(&ctx, svc->srv_ctx_tags);
if (rc)
goto out_srv_init;