From 70963b67544cdcfe4bfa8d3b8a9b99e93124d47a Mon Sep 17 00:00:00 2001 From: yury Date: Tue, 29 Aug 2006 12:23:57 +0000 Subject: [PATCH] - fixes in seq_store.c. By now controller and regular seq server store their state in different offsets and do not override each other; - some cleanups in mdt handler names. --- lustre/autoconf/lustre-core.m4 | 2 ++ lustre/fid/fid_handler.c | 7 +++++-- lustre/fid/fid_store.c | 19 +++++++++++++++++-- lustre/include/lustre_fid.h | 4 ++-- lustre/mdt/mdt_handler.c | 34 ++++++++++++++++------------------ lustre/mdt/mdt_internal.h | 1 + 6 files changed, 43 insertions(+), 24 deletions(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index a7e1fc3..f0faa87 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -799,6 +799,8 @@ lustre/lmv/Makefile lustre/lmv/autoMakefile lustre/mds/Makefile lustre/mds/autoMakefile +lustre/gtl/Makefile +lustre/gtl/autoMakefile lustre/mdt/Makefile lustre/mdt/autoMakefile lustre/cmm/Makefile diff --git a/lustre/fid/fid_handler.c b/lustre/fid/fid_handler.c index 2177f32..5739b30 100644 --- a/lustre/fid/fid_handler.c +++ b/lustre/fid/fid_handler.c @@ -48,8 +48,11 @@ #include "fid_internal.h" #ifdef __KERNEL__ -/* sequence space, starts from 0x400 to have first 0x400 sequences used for - * special purposes. */ +/* + * Sequence space, starts from 0x400 to have first 0x400 sequences used for + * special purposes. This means that if we have seq-with 10000 fids, we have + * ~10M fids reserved for special purposes (igifs, etc.). + */ const struct lu_range LUSTRE_SEQ_SPACE_RANGE = { (0x400), ((__u64)~0ULL) diff --git a/lustre/fid/fid_store.c b/lustre/fid/fid_store.c index 00ec2e8..a9273c5 100644 --- a/lustre/fid/fid_store.c +++ b/lustre/fid/fid_store.c @@ -60,7 +60,7 @@ int seq_store_write(struct lu_server_seq *seq, struct seq_thread_info *info; struct dt_device *dt_dev; struct thandle *th; - loff_t pos = 0; + loff_t pos; int rc; ENTRY; @@ -76,6 +76,13 @@ int seq_store_write(struct lu_server_seq *seq, /* store ranges in le format */ range_to_le(&info->sti_record.ssr_space, &seq->lss_space); range_to_le(&info->sti_record.ssr_super, &seq->lss_super); + + /* + * Regular seq server stores its ranges at posision 0 and + * controller at position of sizeof(info->sti_record). + */ + pos = (seq->lss_type == LUSTRE_SEQ_SERVER) ? 0 : + sizeof(info->sti_record); rc = dt_obj->do_body_ops->dbo_write(ctx, dt_obj, (char *)&info->sti_record, @@ -102,16 +109,24 @@ int seq_store_read(struct lu_server_seq *seq, { struct dt_object *dt_obj = seq->lss_obj; struct seq_thread_info *info; - loff_t pos = 0; + loff_t pos; int rc; ENTRY; info = lu_context_key_get(ctx, &seq_thread_key); LASSERT(info != NULL); + /* + * Regular seq server stores its ranges at posision 0 and controller at + * position of sizeof(info->sti_record). + */ + pos = (seq->lss_type == LUSTRE_SEQ_SERVER) ? 0 : + sizeof(info->sti_record); + rc = dt_obj->do_body_ops->dbo_read(ctx, dt_obj, (char *)&info->sti_record, sizeof(info->sti_record), &pos); + if (rc == sizeof(info->sti_record)) { seq->lss_space = info->sti_record.ssr_space; lustre_swab_lu_range(&seq->lss_space); diff --git a/lustre/include/lustre_fid.h b/lustre/include/lustre_fid.h index 1c278c9..f8ae53a 100644 --- a/lustre/include/lustre_fid.h +++ b/lustre/include/lustre_fid.h @@ -46,8 +46,8 @@ enum { * sequences). */ LUSTRE_SEQ_META_WIDTH = 0x0000000000000080ULL, - /* this is how many sequences (128 * 128) may be in one - * super-sequence allocated to MDTs. */ + /* this is how many sequences may be in one super-sequence allocated to + * MDTs. */ LUSTRE_SEQ_SUPER_WIDTH = (LUSTRE_SEQ_META_WIDTH * LUSTRE_SEQ_META_WIDTH) }; diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index c4116eb..fa030f9 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -116,11 +116,11 @@ struct mdt_opc_slice { struct mdt_handler *mos_hs; }; -static struct mdt_opc_slice mdt_handlers[]; +static struct mdt_opc_slice mdt_regular_handlers[]; static struct mdt_opc_slice mdt_readpage_handlers[]; -static int mdt_handle (struct ptlrpc_request *req); -static struct mdt_device *mdt_dev (struct lu_device *d); +static struct mdt_device *mdt_dev(struct lu_device *d); +static int mdt_regular_handle(struct ptlrpc_request *req); static int mdt_unpack_req_pack_rep(struct mdt_thread_info *info, __u32 flags); static struct lu_object_operations mdt_obj_ops; @@ -485,7 +485,7 @@ static int mdt_connect(struct mdt_thread_info *info) struct ptlrpc_request *req; req = mdt_info_req(info); - result = target_handle_connect(req, mdt_handle); + result = target_handle_connect(req, mdt_regular_handle); if (result == 0) { LASSERT(req->rq_export != NULL); info->mti_mdt = mdt_dev(req->rq_export->exp_obd->obd_lu_dev); @@ -756,12 +756,12 @@ static int mdt_sync(struct mdt_thread_info *info) RETURN(rc); } -static int mdt_handle_quotacheck(struct mdt_thread_info *info) +static int mdt_quotacheck_handle(struct mdt_thread_info *info) { return -EOPNOTSUPP; } -static int mdt_handle_quotactl(struct mdt_thread_info *info) +static int mdt_quotactl_handle(struct mdt_thread_info *info) { return -EOPNOTSUPP; } @@ -769,7 +769,6 @@ static int mdt_handle_quotactl(struct mdt_thread_info *info) /* * OBD PING and other handlers. */ - static int mdt_obd_ping(struct mdt_thread_info *info) { int result; @@ -1417,9 +1416,9 @@ static int mdt_handle_common(struct ptlrpc_request *req, RETURN(result); } -static int mdt_handle(struct ptlrpc_request *req) +static int mdt_regular_handle(struct ptlrpc_request *req) { - return mdt_handle_common(req, mdt_handlers); + return mdt_handle_common(req, mdt_regular_handlers); } static int mdt_readpage_handle(struct ptlrpc_request *req) @@ -2034,7 +2033,7 @@ static int mdt_start_ptlrpc_service(struct mdt_device *m) "mdt_ldlm_client", m->mdt_ldlm_client); m->mdt_service = - ptlrpc_init_svc_conf(&conf, mdt_handle, LUSTRE_MDT0_NAME, + ptlrpc_init_svc_conf(&conf, mdt_regular_handle, LUSTRE_MDT0_NAME, m->mdt_md_dev.md_lu_dev.ld_proc_entry, NULL); if (m->mdt_service == NULL) @@ -2090,7 +2089,7 @@ static int mdt_start_ptlrpc_service(struct mdt_device *m) }; m->mdt_setattr_service = - ptlrpc_init_svc_conf(&conf, mdt_handle, + ptlrpc_init_svc_conf(&conf, mdt_regular_handle, LUSTRE_MDT0_NAME "_setattr", m->mdt_md_dev.md_lu_dev.ld_proc_entry, NULL); @@ -2750,7 +2749,6 @@ static struct lu_device *mdt_device_alloc(const struct lu_context *ctx, /* * context key constructor/destructor */ - static void *mdt_thread_init(const struct lu_context *ctx, struct lu_context_key *key) { @@ -2908,8 +2906,8 @@ DEF_MDT_HNDL_F(HABEO_CORPUS , CLOSE, mdt_close), DEF_MDT_HNDL_0(0, DONE_WRITING, mdt_done_writing), DEF_MDT_HNDL_F(0 |HABEO_REFERO, PIN, mdt_pin), DEF_MDT_HNDL_0(0, SYNC, mdt_sync), -DEF_MDT_HNDL_0(0, QUOTACHECK, mdt_handle_quotacheck), -DEF_MDT_HNDL_0(0, QUOTACTL, mdt_handle_quotactl) +DEF_MDT_HNDL_0(0, QUOTACHECK, mdt_quotacheck_handle), +DEF_MDT_HNDL_0(0, QUOTACTL, mdt_quotactl_handle) }; #define DEF_OBD_HNDL(flags, name, fn) \ @@ -2937,7 +2935,7 @@ static struct mdt_handler mdt_dlm_ops[] = { static struct mdt_handler mdt_llog_ops[] = { }; -static struct mdt_opc_slice mdt_handlers[] = { +static struct mdt_opc_slice mdt_regular_handlers[] = { { .mos_opc_start = MDS_GETATTR, .mos_opc_end = MDS_LAST_OPC, @@ -2963,21 +2961,21 @@ static struct mdt_opc_slice mdt_handlers[] = { } }; -static struct mdt_handler mdt_mds_readpage_ops[] = { +static struct mdt_handler mdt_readpage_ops[] = { DEF_MDT_HNDL_F(HABEO_CORPUS|HABEO_REFERO, READPAGE, mdt_readpage), /* * XXX: this is ugly and should be fixed one day, see mdc_close() for * detailed comment. --umka */ - DEF_MDT_HNDL_F(HABEO_CORPUS , CLOSE, mdt_close), + DEF_MDT_HNDL_F(HABEO_CORPUS, CLOSE, mdt_close), }; static struct mdt_opc_slice mdt_readpage_handlers[] = { { .mos_opc_start = MDS_GETATTR, .mos_opc_end = MDS_LAST_OPC, - .mos_hs = mdt_mds_readpage_ops + .mos_hs = mdt_readpage_ops }, { .mos_hs = NULL diff --git a/lustre/mdt/mdt_internal.h b/lustre/mdt/mdt_internal.h index 7613f70..494be8a 100644 --- a/lustre/mdt/mdt_internal.h +++ b/lustre/mdt/mdt_internal.h @@ -212,6 +212,7 @@ enum mdt_reint_flag { enum { MDT_NONEED_TRANSNO = (1 << 0) /*Do not need transno for this req*/ }; + /* * Common data shared by mdt-level handlers. This is allocated per-thread to * reduce stack consumption. -- 1.8.3.1