From 6fd7c4165c9e2687f2c4ea537be2a67d60fadcea Mon Sep 17 00:00:00 2001 From: yury Date: Thu, 10 Aug 2006 10:33:41 +0000 Subject: [PATCH] - more in fld and seq fixes after Nikita's CODEINSP. --- lustre/fid/fid_handler.c | 132 ++++++++++++++++++++++---------------------- lustre/fid/fid_request.c | 97 ++++++++++++++++---------------- lustre/fid/fid_store.c | 30 +++++----- lustre/fid/lproc_fid.c | 100 ++++++++++++++++----------------- lustre/fld/fld_request.c | 15 ++--- lustre/include/lustre_fid.h | 42 +++++++------- lustre/include/lustre_net.h | 13 ++++- 7 files changed, 219 insertions(+), 210 deletions(-) diff --git a/lustre/fid/fid_handler.c b/lustre/fid/fid_handler.c index 0663194..e8f91ad 100644 --- a/lustre/fid/fid_handler.c +++ b/lustre/fid/fid_handler.c @@ -73,32 +73,32 @@ int seq_server_set_cli(struct lu_server_seq *seq, if (cli == NULL) { CDEBUG(D_INFO|D_WARNING, "%s: detached " - "sequence mgr client %s\n", seq->seq_name, - cli->seq_exp->exp_client_uuid.uuid); - seq->seq_cli = cli; + "sequence mgr client %s\n", seq->lss_name, + cli->lcs_exp->exp_client_uuid.uuid); + seq->lss_cli = cli; RETURN(0); } - if (seq->seq_cli) { + if (seq->lss_cli) { CERROR("%s: sequence-controller is already " - "assigned\n", seq->seq_name); + "assigned\n", seq->lss_name); RETURN(-EINVAL); } CDEBUG(D_INFO|D_WARNING, "%s: attached " - "sequence client %s\n", seq->seq_name, - cli->seq_exp->exp_client_uuid.uuid); + "sequence client %s\n", seq->lss_name, + cli->lcs_exp->exp_client_uuid.uuid); /* asking client for new range, assign that range to ->seq_super and * write seq state to backing store should be atomic. */ - down(&seq->seq_sem); + down(&seq->lss_sem); /* assign controller */ - seq->seq_cli = cli; + seq->lss_cli = cli; /* get new range from controller only if super-sequence is not yet * initialized from backing store or something else. */ - if (range_is_zero(&seq->seq_super)) { + if (range_is_zero(&seq->lss_super)) { rc = seq_client_alloc_super(cli); if (rc) { CERROR("can't allocate super-sequence, " @@ -107,9 +107,9 @@ int seq_server_set_cli(struct lu_server_seq *seq, } /* take super-seq from client seq mgr */ - LASSERT(range_is_sane(&cli->seq_range)); + LASSERT(range_is_sane(&cli->lcs_range)); - seq->seq_super = cli->seq_range; + seq->lss_super = cli->lcs_range; /* save init seq to backing store. */ rc = seq_store_write(seq, ctx); @@ -121,7 +121,7 @@ int seq_server_set_cli(struct lu_server_seq *seq, EXIT; out_up: - up(&seq->seq_sem); + up(&seq->lss_sem); return rc; } EXPORT_SYMBOL(seq_server_set_cli); @@ -132,13 +132,13 @@ static int __seq_server_alloc_super(struct lu_server_seq *seq, struct lu_range *range, const struct lu_context *ctx) { - struct lu_range *space = &seq->seq_space; + struct lu_range *space = &seq->lss_space; int rc; ENTRY; LASSERT(range_is_sane(space)); - if (range_space(space) < seq->seq_super_width) { + if (range_space(space) < seq->lss_super_width) { CWARN("sequences space is going to exhaust soon. " "Can allocate only "LPU64" sequences\n", range_space(space)); @@ -149,7 +149,7 @@ static int __seq_server_alloc_super(struct lu_server_seq *seq, CERROR("sequences space is exhausted\n"); rc = -ENOSPC; } else { - range_alloc(range, space, seq->seq_super_width); + range_alloc(range, space, seq->lss_super_width); rc = 0; } @@ -163,7 +163,7 @@ static int __seq_server_alloc_super(struct lu_server_seq *seq, if (rc == 0) { CDEBUG(D_INFO, "%s: allocated super-sequence " - DRANGE"\n", seq->seq_name, PRANGE(range)); + DRANGE"\n", seq->lss_name, PRANGE(range)); } RETURN(rc); @@ -176,9 +176,9 @@ static int seq_server_alloc_super(struct lu_server_seq *seq, int rc; ENTRY; - down(&seq->seq_sem); + down(&seq->lss_sem); rc = __seq_server_alloc_super(seq, range, ctx); - up(&seq->seq_sem); + up(&seq->lss_sem); RETURN(rc); } @@ -187,7 +187,7 @@ static int __seq_server_alloc_meta(struct lu_server_seq *seq, struct lu_range *range, const struct lu_context *ctx) { - struct lu_range *super = &seq->seq_super; + struct lu_range *super = &seq->lss_super; int rc = 0; ENTRY; @@ -196,12 +196,12 @@ static int __seq_server_alloc_meta(struct lu_server_seq *seq, /* XXX: here we should avoid cascading RPCs using kind of async * preallocation when meta-sequence is close to exhausting. */ if (range_is_exhausted(super)) { - if (!seq->seq_cli) { + if (!seq->lss_cli) { CERROR("no seq-controller client is setup\n"); RETURN(-EOPNOTSUPP); } - rc = seq_client_alloc_super(seq->seq_cli); + rc = seq_client_alloc_super(seq->lss_cli); if (rc) { CERROR("can't allocate new super-sequence, " "rc %d\n", rc); @@ -209,10 +209,10 @@ static int __seq_server_alloc_meta(struct lu_server_seq *seq, } /* saving new range into allocation space. */ - *super = seq->seq_cli->seq_range; + *super = seq->lss_cli->lcs_range; LASSERT(range_is_sane(super)); } - range_alloc(range, super, seq->seq_meta_width); + range_alloc(range, super, seq->lss_meta_width); rc = seq_store_write(seq, ctx); if (rc) { @@ -222,7 +222,7 @@ static int __seq_server_alloc_meta(struct lu_server_seq *seq, if (rc == 0) { CDEBUG(D_INFO, "%s: allocated meta-sequence " - DRANGE"\n", seq->seq_name, PRANGE(range)); + DRANGE"\n", seq->lss_name, PRANGE(range)); } RETURN(rc); @@ -235,9 +235,9 @@ static int seq_server_alloc_meta(struct lu_server_seq *seq, int rc; ENTRY; - down(&seq->seq_sem); + down(&seq->lss_sem); rc = __seq_server_alloc_meta(seq, range, ctx); - up(&seq->seq_sem); + up(&seq->lss_sem); RETURN(rc); } @@ -394,25 +394,25 @@ static int seq_server_proc_init(struct lu_server_seq *seq) int rc; ENTRY; - seq->seq_proc_dir = lprocfs_register(seq->seq_name, + seq->lss_proc_dir = lprocfs_register(seq->lss_name, proc_lustre_root, NULL, NULL); - if (IS_ERR(seq->seq_proc_dir)) { + if (IS_ERR(seq->lss_proc_dir)) { CERROR("LProcFS failed in seq-init\n"); - rc = PTR_ERR(seq->seq_proc_dir); + rc = PTR_ERR(seq->lss_proc_dir); RETURN(rc); } - seq->seq_proc_entry = lprocfs_register("services", - seq->seq_proc_dir, + seq->lss_proc_entry = lprocfs_register("services", + seq->lss_proc_dir, NULL, NULL); - if (IS_ERR(seq->seq_proc_entry)) { + if (IS_ERR(seq->lss_proc_entry)) { CERROR("LProcFS failed in seq-init\n"); - rc = PTR_ERR(seq->seq_proc_entry); + rc = PTR_ERR(seq->lss_proc_entry); GOTO(out_cleanup, rc); } - rc = lprocfs_add_vars(seq->seq_proc_dir, + rc = lprocfs_add_vars(seq->lss_proc_dir, seq_server_proc_list, seq); if (rc) { CERROR("can't init sequence manager " @@ -430,16 +430,16 @@ out_cleanup: static void seq_server_proc_fini(struct lu_server_seq *seq) { ENTRY; - if (seq->seq_proc_entry != NULL) { - if (!IS_ERR(seq->seq_proc_entry)) - lprocfs_remove(seq->seq_proc_entry); - seq->seq_proc_entry = NULL; + if (seq->lss_proc_entry != NULL) { + if (!IS_ERR(seq->lss_proc_entry)) + lprocfs_remove(seq->lss_proc_entry); + seq->lss_proc_entry = NULL; } - if (seq->seq_proc_dir != NULL) { - if (!IS_ERR(seq->seq_proc_dir)) - lprocfs_remove(seq->seq_proc_dir); - seq->seq_proc_dir = NULL; + if (seq->lss_proc_dir != NULL) { + if (!IS_ERR(seq->lss_proc_dir)) + lprocfs_remove(seq->lss_proc_dir); + seq->lss_proc_dir = NULL; } EXIT; } @@ -469,8 +469,8 @@ int seq_server_init(struct lu_server_seq *seq, 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_max_req_size = SEQ_MAXREQSIZE, + .psc_max_reply_size = SEQ_MAXREPSIZE, .psc_req_portal = portal, .psc_rep_portal = MDC_REPLY_PORTAL, .psc_watchdog_timeout = SEQ_SERVICE_WATCHDOG_TIMEOUT, @@ -482,22 +482,22 @@ int seq_server_init(struct lu_server_seq *seq, LASSERT(dev != NULL); LASSERT(uuid != NULL); - seq->seq_dev = dev; - seq->seq_cli = NULL; - seq->seq_type = type; - sema_init(&seq->seq_sem, 1); + seq->lss_dev = dev; + seq->lss_cli = NULL; + seq->lss_type = type; + sema_init(&seq->lss_sem, 1); - seq->seq_super_width = LUSTRE_SEQ_SUPER_WIDTH; - seq->seq_meta_width = LUSTRE_SEQ_META_WIDTH; + seq->lss_super_width = LUSTRE_SEQ_SUPER_WIDTH; + seq->lss_meta_width = LUSTRE_SEQ_META_WIDTH; - snprintf(seq->seq_name, sizeof(seq->seq_name), "%s-%s-%s", + snprintf(seq->lss_name, sizeof(seq->lss_name), "%s-%s-%s", LUSTRE_SEQ_NAME, (is_srv ? "srv" : "ctl"), uuid); - seq->seq_space = LUSTRE_SEQ_SPACE_RANGE; - seq->seq_super = LUSTRE_SEQ_ZERO_RANGE; + seq->lss_space = LUSTRE_SEQ_SPACE_RANGE; + seq->lss_super = LUSTRE_SEQ_ZERO_RANGE; - lu_device_get(&seq->seq_dev->dd_lu_dev); + lu_device_get(&seq->lss_dev->dd_lu_dev); rc = seq_store_init(seq, ctx); if (rc) @@ -507,7 +507,7 @@ int seq_server_init(struct lu_server_seq *seq, rc = seq_store_read(seq, ctx); if (rc == -ENODATA) { CDEBUG(D_INFO|D_WARNING, "%s: no data on " - "storage was found, %s\n", seq->seq_name, + "storage was found, %s\n", seq->lss_name, is_srv ? "wait for controller attach" : "this is first controller run"); } else if (rc) { @@ -520,13 +520,13 @@ int seq_server_init(struct lu_server_seq *seq, if (rc) GOTO(out, rc); - seq->seq_service = ptlrpc_init_svc_conf(&seq_conf, + seq->lss_service = ptlrpc_init_svc_conf(&seq_conf, seq_req_handle, LUSTRE_SEQ_NAME, - seq->seq_proc_entry, + seq->lss_proc_entry, NULL); - if (seq->seq_service != NULL) - rc = ptlrpc_start_threads(NULL, seq->seq_service, + if (seq->lss_service != NULL) + rc = ptlrpc_start_threads(NULL, seq->lss_service, LUSTRE_SEQ_NAME); else rc = -ENOMEM; @@ -549,17 +549,17 @@ void seq_server_fini(struct lu_server_seq *seq, { ENTRY; - if (seq->seq_service != NULL) { - ptlrpc_unregister_service(seq->seq_service); - seq->seq_service = NULL; + if (seq->lss_service != NULL) { + ptlrpc_unregister_service(seq->lss_service); + seq->lss_service = NULL; } seq_server_proc_fini(seq); seq_store_fini(seq, ctx); - if (seq->seq_dev != NULL) { - lu_device_put(&seq->seq_dev->dd_lu_dev); - seq->seq_dev = NULL; + if (seq->lss_dev != NULL) { + lu_device_put(&seq->lss_dev->dd_lu_dev); + seq->lss_dev = NULL; } EXIT; diff --git a/lustre/fid/fid_request.c b/lustre/fid/fid_request.c index 6ab5d2d..ed211cb 100644 --- a/lustre/fid/fid_request.c +++ b/lustre/fid/fid_request.c @@ -51,7 +51,7 @@ static int seq_client_rpc(struct lu_client_seq *seq, struct lu_range *range, __u32 opc, const char *opcname) { - struct obd_export *exp = seq->seq_exp; + struct obd_export *exp = seq->lcs_exp; int repsize = sizeof(struct lu_range); int rc, reqsize = sizeof(__u32); struct ptlrpc_request *req; @@ -102,7 +102,7 @@ static int seq_client_rpc(struct lu_client_seq *seq, if (rc == 0) { CDEBUG(D_INFO, "%s: allocated %s-sequence " - DRANGE"]\n", seq->seq_name, opcname, + DRANGE"]\n", seq->lcs_name, opcname, PRANGE(range)); } @@ -116,7 +116,7 @@ out_req: /* request sequence-controller node to allocate new super-sequence. */ static int __seq_client_alloc_super(struct lu_client_seq *seq) { - return seq_client_rpc(seq, &seq->seq_range, + return seq_client_rpc(seq, &seq->lcs_range, SEQ_ALLOC_SUPER, "super"); } @@ -125,9 +125,9 @@ int seq_client_alloc_super(struct lu_client_seq *seq) int rc; ENTRY; - down(&seq->seq_sem); + down(&seq->lcs_sem); rc = __seq_client_alloc_super(seq); - up(&seq->seq_sem); + up(&seq->lcs_sem); RETURN(rc); } @@ -136,7 +136,7 @@ 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) { - return seq_client_rpc(seq, &seq->seq_range, + return seq_client_rpc(seq, &seq->lcs_range, SEQ_ALLOC_META, "meta"); } @@ -145,9 +145,9 @@ int seq_client_alloc_meta(struct lu_client_seq *seq) int rc; ENTRY; - down(&seq->seq_sem); + down(&seq->lcs_sem); rc = __seq_client_alloc_meta(seq); - up(&seq->seq_sem); + up(&seq->lcs_sem); RETURN(rc); } @@ -159,11 +159,11 @@ static int __seq_client_alloc_seq(struct lu_client_seq *seq, seqno_t *seqnr) int rc = 0; ENTRY; - LASSERT(range_is_sane(&seq->seq_range)); + LASSERT(range_is_sane(&seq->lcs_range)); /* 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->seq_range) == 0) { + if (range_space(&seq->lcs_range) == 0) { rc = __seq_client_alloc_meta(seq); if (rc) { CERROR("can't allocate new meta-sequence, " @@ -172,12 +172,12 @@ static int __seq_client_alloc_seq(struct lu_client_seq *seq, seqno_t *seqnr) } } - LASSERT(range_space(&seq->seq_range) > 0); - *seqnr = seq->seq_range.lr_start; - seq->seq_range.lr_start++; + LASSERT(range_space(&seq->lcs_range) > 0); + *seqnr = seq->lcs_range.lr_start; + seq->lcs_range.lr_start++; CDEBUG(D_INFO, "%s: allocated sequence ["LPX64"]\n", - seq->seq_name, *seqnr); + seq->lcs_name, *seqnr); RETURN(rc); } @@ -186,9 +186,9 @@ int seq_client_alloc_seq(struct lu_client_seq *seq, seqno_t *seqnr) int rc = 0; ENTRY; - down(&seq->seq_sem); + down(&seq->lcs_sem); rc = __seq_client_alloc_seq(seq, seqnr); - up(&seq->seq_sem); + up(&seq->lcs_sem); RETURN(rc); } @@ -201,10 +201,10 @@ int seq_client_alloc_fid(struct lu_client_seq *seq, struct lu_fid *fid) LASSERT(fid != NULL); - down(&seq->seq_sem); + down(&seq->lcs_sem); - if (!fid_is_sane(&seq->seq_fid) || - fid_oid(&seq->seq_fid) >= seq->seq_width) + if (!fid_is_sane(&seq->lcs_fid) || + fid_oid(&seq->lcs_fid) >= seq->lcs_width) { seqno_t seqnr; @@ -218,70 +218,71 @@ int seq_client_alloc_fid(struct lu_client_seq *seq, struct lu_fid *fid) } /* init new fid */ - seq->seq_fid.f_oid = LUSTRE_FID_INIT_OID; - seq->seq_fid.f_seq = seqnr; - seq->seq_fid.f_ver = 0; + seq->lcs_fid.f_oid = LUSTRE_FID_INIT_OID; + seq->lcs_fid.f_seq = seqnr; + seq->lcs_fid.f_ver = 0; /* inform caller that sequence switch is performed to allow it * to setup FLD for it. */ rc = 1; } else { - seq->seq_fid.f_oid++; + seq->lcs_fid.f_oid++; rc = 0; } - *fid = seq->seq_fid; + *fid = seq->lcs_fid; LASSERT(fid_is_sane(fid)); CDEBUG(D_INFO, "%s: allocated FID "DFID"\n", - seq->seq_name, PFID(fid)); + seq->lcs_name, PFID(fid)); EXIT; out: - up(&seq->seq_sem); + up(&seq->lcs_sem); return rc; } EXPORT_SYMBOL(seq_client_alloc_fid); +static void seq_client_proc_fini(struct lu_client_seq *seq); + #ifdef LPROCFS static int seq_client_proc_init(struct lu_client_seq *seq) { int rc; ENTRY; - seq->seq_proc_dir = lprocfs_register(seq->seq_name, + seq->lcs_proc_dir = lprocfs_register(seq->lcs_name, proc_lustre_root, NULL, NULL); - if (IS_ERR(seq->seq_proc_dir)) { + if (IS_ERR(seq->lcs_proc_dir)) { CERROR("LProcFS failed in seq-init\n"); - rc = PTR_ERR(seq->seq_proc_dir); - GOTO(err, rc); + rc = PTR_ERR(seq->lcs_proc_dir); + RETURN(rc); } - rc = lprocfs_add_vars(seq->seq_proc_dir, + rc = lprocfs_add_vars(seq->lcs_proc_dir, seq_client_proc_list, seq); if (rc) { CERROR("can't init sequence manager " "proc, rc %d\n", rc); - GOTO(err_dir, rc); + GOTO(out_cleanup, rc); } RETURN(0); -err_dir: - lprocfs_remove(seq->seq_proc_dir); -err: - seq->seq_proc_dir = NULL; +out_cleanup: + seq_client_proc_fini(seq); return rc; } static void seq_client_proc_fini(struct lu_client_seq *seq) { ENTRY; - if (seq->seq_proc_dir) { - lprocfs_remove(seq->seq_proc_dir); - seq->seq_proc_dir = NULL; + if (seq->lcs_proc_dir) { + if (!IS_ERR(seq->lcs_proc_dir)) + lprocfs_remove(seq->lcs_proc_dir); + seq->lcs_proc_dir = NULL; } EXIT; } @@ -306,13 +307,13 @@ int seq_client_init(struct lu_client_seq *seq, LASSERT(exp != NULL); - fid_zero(&seq->seq_fid); - range_zero(&seq->seq_range); - sema_init(&seq->seq_sem, 1); - seq->seq_exp = class_export_get(exp); - seq->seq_width = LUSTRE_SEQ_MAX_WIDTH; + fid_zero(&seq->lcs_fid); + range_zero(&seq->lcs_range); + sema_init(&seq->lcs_sem, 1); + seq->lcs_exp = class_export_get(exp); + seq->lcs_width = LUSTRE_SEQ_MAX_WIDTH; - snprintf(seq->seq_name, sizeof(seq->seq_name), + snprintf(seq->lcs_name, sizeof(seq->lcs_name), "%s-cli-%s", LUSTRE_SEQ_NAME, uuid); rc = seq_client_proc_init(seq); @@ -331,9 +332,9 @@ void seq_client_fini(struct lu_client_seq *seq) seq_client_proc_fini(seq); - if (seq->seq_exp != NULL) { - class_export_put(seq->seq_exp); - seq->seq_exp = NULL; + if (seq->lcs_exp != NULL) { + class_export_put(seq->lcs_exp); + seq->lcs_exp = NULL; } CDEBUG(D_INFO|D_WARNING, "Client Sequence Manager\n"); diff --git a/lustre/fid/fid_store.c b/lustre/fid/fid_store.c index ac14353..95361ed 100644 --- a/lustre/fid/fid_store.c +++ b/lustre/fid/fid_store.c @@ -56,8 +56,8 @@ enum { int seq_store_write(struct lu_server_seq *seq, const struct lu_context *ctx) { - struct dt_object *dt_obj = seq->seq_obj; - struct dt_device *dt_dev = seq->seq_dev; + struct dt_object *dt_obj = seq->lss_obj; + struct dt_device *dt_dev = seq->lss_dev; struct seq_thread_info *info; struct thandle *th; loff_t pos = 0; @@ -73,8 +73,8 @@ int seq_store_write(struct lu_server_seq *seq, th = dt_dev->dd_ops->dt_trans_start(ctx, dt_dev, &info->sti_txn); if (!IS_ERR(th)) { /* store ranges in le format */ - range_to_le(&info->sti_record.ssr_space, &seq->seq_space); - range_to_le(&info->sti_record.ssr_super, &seq->seq_super); + range_to_le(&info->sti_record.ssr_space, &seq->lss_space); + range_to_le(&info->sti_record.ssr_super, &seq->lss_super); rc = dt_obj->do_body_ops->dbo_write(ctx, dt_obj, (char *)&info->sti_record, @@ -99,7 +99,7 @@ int seq_store_write(struct lu_server_seq *seq, int seq_store_read(struct lu_server_seq *seq, const struct lu_context *ctx) { - struct dt_object *dt_obj = seq->seq_obj; + struct dt_object *dt_obj = seq->lss_obj; struct seq_thread_info *info; loff_t pos = 0; int rc; @@ -112,11 +112,11 @@ int seq_store_read(struct lu_server_seq *seq, (char *)&info->sti_record, sizeof(info->sti_record), &pos); if (rc == sizeof(info->sti_record)) { - seq->seq_space = info->sti_record.ssr_space; - lustre_swab_lu_range(&seq->seq_space); + seq->lss_space = info->sti_record.ssr_space; + lustre_swab_lu_range(&seq->lss_space); - seq->seq_super = info->sti_record.ssr_super; - lustre_swab_lu_range(&seq->seq_super); + seq->lss_super = info->sti_record.ssr_super; + lustre_swab_lu_range(&seq->lss_super); rc = 0; } else if (rc == 0) { rc = -ENODATA; @@ -132,17 +132,17 @@ int seq_store_read(struct lu_server_seq *seq, int seq_store_init(struct lu_server_seq *seq, const struct lu_context *ctx) { - struct dt_device *dt = seq->seq_dev; + struct dt_device *dt = seq->lss_dev; struct dt_object *dt_obj; struct lu_fid fid; int rc; ENTRY; - LASSERT(seq->seq_service == NULL); + LASSERT(seq->lss_service == NULL); dt_obj = dt_store_open(ctx, dt, "seq", &fid); if (!IS_ERR(dt_obj)) { - seq->seq_obj = dt_obj; + seq->lss_obj = dt_obj; rc = 0; } else { CERROR("cannot find \"seq\" obj %d\n", @@ -157,9 +157,9 @@ void seq_store_fini(struct lu_server_seq *seq, const struct lu_context *ctx) { ENTRY; - if (seq->seq_obj != NULL) { - lu_object_put(ctx, &seq->seq_obj->do_lu); - seq->seq_obj = NULL; + if (seq->lss_obj != NULL) { + lu_object_put(ctx, &seq->lss_obj->do_lu); + seq->lss_obj = NULL; } EXIT; } diff --git a/lustre/fid/lproc_fid.c b/lustre/fid/lproc_fid.c index 730690a..4308c77 100644 --- a/lustre/fid/lproc_fid.c +++ b/lustre/fid/lproc_fid.c @@ -102,15 +102,15 @@ seq_proc_write_space(struct file *file, const char *buffer, LASSERT(seq != NULL); - down(&seq->seq_sem); + down(&seq->lss_sem); rc = seq_proc_write_common(file, buffer, count, - data, &seq->seq_space); + data, &seq->lss_space); if (rc == 0) { CDEBUG(D_WARNING, "SEQ-MGR(srv): sequences space has " - "changed to "DRANGE"\n", PRANGE(&seq->seq_space)); + "changed to "DRANGE"\n", PRANGE(&seq->lss_space)); } - up(&seq->seq_sem); + up(&seq->lss_sem); RETURN(count); } @@ -125,10 +125,10 @@ seq_proc_read_space(char *page, char **start, off_t off, LASSERT(seq != NULL); - down(&seq->seq_sem); + down(&seq->lss_sem); rc = seq_proc_read_common(page, start, off, count, eof, - data, &seq->seq_space); - up(&seq->seq_sem); + data, &seq->lss_space); + up(&seq->lss_sem); RETURN(rc); } @@ -143,16 +143,16 @@ seq_proc_write_super(struct file *file, const char *buffer, LASSERT(seq != NULL); - down(&seq->seq_sem); + down(&seq->lss_sem); rc = seq_proc_write_common(file, buffer, count, - data, &seq->seq_super); + data, &seq->lss_super); if (rc == 0) { CDEBUG(D_WARNING, "SEQ-MGR(srv): super-sequence has " - "changed to "DRANGE"\n", PRANGE(&seq->seq_super)); + "changed to "DRANGE"\n", PRANGE(&seq->lss_super)); } - up(&seq->seq_sem); + up(&seq->lss_sem); RETURN(count); } @@ -167,10 +167,10 @@ seq_proc_read_super(char *page, char **start, off_t off, LASSERT(seq != NULL); - down(&seq->seq_sem); + down(&seq->lss_sem); rc = seq_proc_read_common(page, start, off, count, eof, - data, &seq->seq_super); - up(&seq->seq_sem); + data, &seq->lss_super); + up(&seq->lss_sem); RETURN(rc); } @@ -186,8 +186,8 @@ seq_proc_read_controller(char *page, char **start, off_t off, LASSERT(seq != NULL); *eof = 1; - if (seq->seq_cli) { - struct obd_export *exp = seq->seq_cli->seq_exp; + if (seq->lss_cli) { + struct obd_export *exp = seq->lss_cli->lcs_exp; rc = snprintf(page, count, "%s\n", exp->exp_client_uuid.uuid); @@ -208,20 +208,20 @@ seq_proc_write_super_width(struct file *file, const char *buffer, LASSERT(seq != NULL); - down(&seq->seq_sem); + down(&seq->lss_sem); rc = lprocfs_write_helper(buffer, count, &val); if (rc) RETURN(rc); - seq->seq_super_width = val; + seq->lss_super_width = val; if (rc == 0) { CDEBUG(D_WARNING, "SEQ-MGR(srv): super-sequence width " - "has changed to "LPU64"\n", seq->seq_super_width); + "has changed to "LPU64"\n", seq->lss_super_width); } - up(&seq->seq_sem); + up(&seq->lss_sem); RETURN(count); } @@ -236,9 +236,9 @@ seq_proc_read_super_width(char *page, char **start, off_t off, LASSERT(seq != NULL); - down(&seq->seq_sem); - rc = snprintf(page, count, LPU64"\n", seq->seq_super_width); - up(&seq->seq_sem); + down(&seq->lss_sem); + rc = snprintf(page, count, LPU64"\n", seq->lss_super_width); + up(&seq->lss_sem); RETURN(rc); } @@ -253,22 +253,22 @@ seq_proc_write_meta_width(struct file *file, const char *buffer, LASSERT(seq != NULL); - down(&seq->seq_sem); + down(&seq->lss_sem); rc = lprocfs_write_helper(buffer, count, &val); if (rc) RETURN(rc); - if (val <= seq->seq_super_width) { - seq->seq_meta_width = val; + if (val <= seq->lss_super_width) { + seq->lss_meta_width = val; if (rc == 0) { CDEBUG(D_WARNING, "SEQ-MGR(srv): meta-sequence width " - "has changed to "LPU64"\n", seq->seq_meta_width); + "has changed to "LPU64"\n", seq->lss_meta_width); } } - up(&seq->seq_sem); + up(&seq->lss_sem); RETURN(count); } @@ -282,9 +282,9 @@ seq_proc_read_meta_width(char *page, char **start, off_t off, LASSERT(seq != NULL); - down(&seq->seq_sem); - rc = snprintf(page, count, LPU64"\n", seq->seq_meta_width); - up(&seq->seq_sem); + down(&seq->lss_sem); + rc = snprintf(page, count, LPU64"\n", seq->lss_meta_width); + up(&seq->lss_sem); RETURN(rc); } @@ -300,16 +300,16 @@ seq_proc_write_range(struct file *file, const char *buffer, LASSERT(seq != NULL); - down(&seq->seq_sem); + down(&seq->lcs_sem); rc = seq_proc_write_common(file, buffer, count, - data, &seq->seq_range); + data, &seq->lcs_range); if (rc == 0) { CDEBUG(D_WARNING, "SEQ-MGR(cli): range has changed to " - DRANGE"\n", PRANGE(&seq->seq_range)); + DRANGE"\n", PRANGE(&seq->lcs_range)); } - up(&seq->seq_sem); + up(&seq->lcs_sem); RETURN(count); } @@ -324,10 +324,10 @@ seq_proc_read_range(char *page, char **start, off_t off, LASSERT(seq != NULL); - down(&seq->seq_sem); + down(&seq->lcs_sem); rc = seq_proc_read_common(page, start, off, count, eof, - data, &seq->seq_range); - up(&seq->seq_sem); + data, &seq->lcs_range); + up(&seq->lcs_sem); RETURN(rc); } @@ -342,22 +342,22 @@ seq_proc_write_seq_width(struct file *file, const char *buffer, LASSERT(seq != NULL); - down(&seq->seq_sem); + down(&seq->lcs_sem); rc = lprocfs_write_helper(buffer, count, &val); if (rc) RETURN(rc); if (val <= LUSTRE_SEQ_MAX_WIDTH) { - seq->seq_width = val; + seq->lcs_width = val; if (rc == 0) { CDEBUG(D_WARNING, "SEQ-MGR(cli): sequence width " - "has changed to "LPU64"\n", seq->seq_width); + "has changed to "LPU64"\n", seq->lcs_width); } } - up(&seq->seq_sem); + up(&seq->lcs_sem); RETURN(count); } @@ -372,10 +372,9 @@ seq_proc_read_seq_width(char *page, char **start, off_t off, LASSERT(seq != NULL); - down(&seq->seq_sem); - rc = snprintf(page, count, LPU64"\n", - seq->seq_width); - up(&seq->seq_sem); + down(&seq->lcs_sem); + rc = snprintf(page, count, LPU64"\n", seq->lcs_width); + up(&seq->lcs_sem); RETURN(rc); } @@ -390,10 +389,9 @@ seq_proc_read_next_fid(char *page, char **start, off_t off, LASSERT(seq != NULL); - down(&seq->seq_sem); - rc = snprintf(page, count, DFID"\n", - PFID(&seq->seq_fid)); - up(&seq->seq_sem); + down(&seq->lcs_sem); + rc = snprintf(page, count, DFID"\n", PFID(&seq->lcs_fid)); + up(&seq->lcs_sem); RETURN(rc); } @@ -403,7 +401,7 @@ seq_proc_read_server(char *page, char **start, off_t off, int count, int *eof, void *data) { struct lu_client_seq *seq = (struct lu_client_seq *)data; - struct client_obd *cli = &seq->seq_exp->exp_obd->u.cli; + struct client_obd *cli = &seq->lcs_exp->exp_obd->u.cli; int rc; ENTRY; diff --git a/lustre/fld/fld_request.c b/lustre/fld/fld_request.c index 78d44aa..8edfb21 100644 --- a/lustre/fld/fld_request.c +++ b/lustre/fld/fld_request.c @@ -188,6 +188,8 @@ int fld_client_del_target(struct lu_client_fld *fld, } EXPORT_SYMBOL(fld_client_del_target); +static void fld_client_proc_fini(struct lu_client_fld *fld); + #ifdef LPROCFS static int fld_client_proc_init(struct lu_client_fld *fld) { @@ -201,7 +203,7 @@ static int fld_client_proc_init(struct lu_client_fld *fld) if (IS_ERR(fld->fld_proc_dir)) { CERROR("LProcFS failed in fld-init\n"); rc = PTR_ERR(fld->fld_proc_dir); - GOTO(err, rc); + RETURN(rc); } rc = lprocfs_add_vars(fld->fld_proc_dir, @@ -209,15 +211,13 @@ static int fld_client_proc_init(struct lu_client_fld *fld) if (rc) { CERROR("can't init FLD " "proc, rc %d\n", rc); - GOTO(err_dir, rc); + GOTO(out_cleanup, rc); } RETURN(0); -err_dir: - lprocfs_remove(fld->fld_proc_dir); -err: - fld->fld_proc_dir = NULL; +out_cleanup: + fld_client_proc_fini(fld); return rc; } @@ -225,7 +225,8 @@ static void fld_client_proc_fini(struct lu_client_fld *fld) { ENTRY; if (fld->fld_proc_dir) { - lprocfs_remove(fld->fld_proc_dir); + if (!IS_ERR(fld->fld_proc_dir)) + lprocfs_remove(fld->fld_proc_dir); fld->fld_proc_dir = NULL; } EXIT; diff --git a/lustre/include/lustre_fid.h b/lustre/include/lustre_fid.h index 75efb36..4a65066 100644 --- a/lustre/include/lustre_fid.h +++ b/lustre/include/lustre_fid.h @@ -59,70 +59,70 @@ enum lu_mgr_type { /* client sequence manager interface */ struct lu_client_seq { /* sequence-controller export. */ - struct obd_export *seq_exp; - struct semaphore seq_sem; + struct obd_export *lcs_exp; + struct semaphore lcs_sem; /* range of allowed for allocation sequeces. When using lu_client_seq on * clients, this contains meta-sequence range. And for servers this * contains super-sequence range. */ - struct lu_range seq_range; + struct lu_range lcs_range; /* seq related proc */ - cfs_proc_dir_entry_t *seq_proc_dir; + cfs_proc_dir_entry_t *lcs_proc_dir; /* this holds last allocated fid in last obtained seq */ - struct lu_fid seq_fid; + struct lu_fid lcs_fid; /* service uuid, passed from MDT + seq name to form unique seq name to * use it with procfs. */ - char seq_name[80]; + char lcs_name[80]; /* sequence width, that is how many objects may be allocated in one * sequence. Default value for it is LUSTRE_SEQ_MAX_WIDTH. */ - __u64 seq_width; + __u64 lcs_width; }; #ifdef __KERNEL__ /* server sequence manager interface */ struct lu_server_seq { /* available sequence space */ - struct lu_range seq_space; + struct lu_range lss_space; /* super-sequence range, all super-sequences for other servers are * allocated from it. */ - struct lu_range seq_super; + struct lu_range lss_super; /* device for server side seq manager needs (saving sequences to backing * store). */ - struct dt_device *seq_dev; + struct dt_device *lss_dev; /* /seq file object device */ - struct dt_object *seq_obj; + struct dt_object *lss_obj; /* seq related proc */ - cfs_proc_dir_entry_t *seq_proc_entry; - cfs_proc_dir_entry_t *seq_proc_dir; + cfs_proc_dir_entry_t *lss_proc_entry; + cfs_proc_dir_entry_t *lss_proc_dir; - /* LUSTRE_SEQ_SRV or LUSTRE_SEQ_CTLR */ - enum lu_mgr_type seq_type; + /* LUSTRE_SEQ_SERVER or LUSTRE_SEQ_CONTROLLER */ + enum lu_mgr_type lss_type; /* server side seq service */ - struct ptlrpc_service *seq_service; + struct ptlrpc_service *lss_service; /* client interafce to request controller */ - struct lu_client_seq *seq_cli; + struct lu_client_seq *lss_cli; /* semaphore for protecting allocation */ - struct semaphore seq_sem; + struct semaphore lss_sem; /* service uuid, passed from MDT + seq name to form unique seq name to * use it with procfs. */ - char seq_name[80]; + char lss_name[80]; /* allocation chunks for super and meta sequences. Default values are * LUSTRE_SEQ_SUPER_WIDTH and LUSTRE_SEQ_META_WIDTH. */ - __u64 seq_super_width; - __u64 seq_meta_width; + __u64 lss_super_width; + __u64 lss_meta_width; }; #endif diff --git a/lustre/include/lustre_net.h b/lustre/include/lustre_net.h index 5d47d3e..6c45cfb 100644 --- a/lustre/include/lustre_net.h +++ b/lustre/include/lustre_net.h @@ -124,8 +124,17 @@ #define MDS_MAXREQSIZE (5 * 1024) #define MDS_MAXREPSIZE max(9 * 1024, 280 + LOV_MAX_STRIPE_COUNT * 56) -#define FLD_MAXREQSIZE (8192) -#define FLD_MAXREPSIZE (16) +/* FLD_MAXREQSIZE == lustre_msg + __u32 padding + opc + md_fld */ +#define FLD_MAXREQSIZE (96) + +/* FLD_MAXREPSIZE == lustre_msg + __u32 padding + md_fld */ +#define FLD_MAXREPSIZE (88) + +/* SEQ_MAXREQSIZE == lustre_msg + __u32 padding + opc + __u32 padding */ +#define SEQ_MAXREQSIZE (80) + +/* SEQ_MAXREPSIZE == lustre_msg + __u32 padding + lu_range */ +#define SEQ_MAXREPSIZE (88) /* FIXME fix all constants here. Andreas suggests dyamically adding threads. */ #define MGS_MAX_THREADS 8UL -- 1.8.3.1