From: yury Date: Wed, 2 Aug 2006 11:01:03 +0000 (+0000) Subject: - mostly changes according to Mike's CODEINSP; X-Git-Tag: v1_8_0_110~486^2~1298 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=e2fd75ee2d478f13ddf71200b6a4b96df42f2530;p=fs%2Flustre-release.git - mostly changes according to Mike's CODEINSP; --- diff --git a/lustre/fid/fid_handler.c b/lustre/fid/fid_handler.c index fd38b8e..d165019 100644 --- a/lustre/fid/fid_handler.c +++ b/lustre/fid/fid_handler.c @@ -64,24 +64,29 @@ const struct lu_range LUSTRE_SEQ_ZERO_RANGE = { EXPORT_SYMBOL(LUSTRE_SEQ_ZERO_RANGE); /* assigns client to sequence controller node */ -int -seq_server_init_ctlr(struct lu_server_seq *seq, - struct lu_client_seq *cli, - const struct lu_context *ctx) +int seq_server_set_cli(struct lu_server_seq *seq, + struct lu_client_seq *cli, + const struct lu_context *ctx) { int rc = 0; ENTRY; - LASSERT(cli != NULL); + 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; + RETURN(0); + } if (seq->seq_cli) { - CERROR("SEQ-MGR(srv): sequence-controller " - "is already assigned\n"); + CERROR("%s: sequence-controller is already " + "assigned\n", seq->seq_name); RETURN(-EINVAL); } - CDEBUG(D_INFO|D_WARNING, "SEQ-MGR(srv): assign " - "sequence controller client %s\n", + CDEBUG(D_INFO|D_WARNING, "%s: attached " + "sequence client %s\n", seq->seq_name, cli->seq_exp->exp_client_uuid.uuid); /* asking client for new range, assign that range to ->seq_super and @@ -119,27 +124,13 @@ out_up: up(&seq->seq_sem); return rc; } -EXPORT_SYMBOL(seq_server_init_ctlr); - -void -seq_server_fini_ctlr(struct lu_server_seq *seq) -{ - ENTRY; - - down(&seq->seq_sem); - seq->seq_cli = NULL; - up(&seq->seq_sem); - - EXIT; -} -EXPORT_SYMBOL(seq_server_fini_ctlr); +EXPORT_SYMBOL(seq_server_set_cli); /* on controller node, allocate new super sequence for regular sequence * server. */ -static int -__seq_server_alloc_super(struct lu_server_seq *seq, - struct lu_range *range, - const struct lu_context *ctx) +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; int rc; @@ -171,17 +162,17 @@ __seq_server_alloc_super(struct lu_server_seq *seq, } if (rc == 0) { - CDEBUG(D_INFO, "SEQ-MGR(srv): allocated super-sequence " - "["LPX64"-"LPX64"]\n", range->lr_start, range->lr_end); + CDEBUG(D_INFO, "%s: allocated super-sequence " + "["LPX64"-"LPX64"]\n", seq->seq_name, + range->lr_start, range->lr_end); } RETURN(rc); } -static int -seq_server_alloc_super(struct lu_server_seq *seq, - struct lu_range *range, - const struct lu_context *ctx) +static int seq_server_alloc_super(struct lu_server_seq *seq, + struct lu_range *range, + const struct lu_context *ctx) { int rc; ENTRY; @@ -193,10 +184,9 @@ seq_server_alloc_super(struct lu_server_seq *seq, RETURN(rc); } -static int -__seq_server_alloc_meta(struct lu_server_seq *seq, - struct lu_range *range, - const struct lu_context *ctx) +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; int rc = 0; @@ -232,17 +222,17 @@ __seq_server_alloc_meta(struct lu_server_seq *seq, } if (rc == 0) { - CDEBUG(D_INFO, "SEQ-MGR(srv): allocated meta-sequence " - "["LPX64"-"LPX64"]\n", range->lr_start, range->lr_end); + CDEBUG(D_INFO, "%s: allocated meta-sequence " + "["LPX64"-"LPX64"]\n", seq->seq_name, + range->lr_start, range->lr_end); } RETURN(rc); } -static int -seq_server_alloc_meta(struct lu_server_seq *seq, - struct lu_range *range, - const struct lu_context *ctx) +static int seq_server_alloc_meta(struct lu_server_seq *seq, + struct lu_range *range, + const struct lu_context *ctx) { int rc; ENTRY; @@ -254,9 +244,8 @@ seq_server_alloc_meta(struct lu_server_seq *seq, RETURN(rc); } -static int -seq_req_handle0(const struct lu_context *ctx, - struct ptlrpc_request *req) +static int seq_req_handle0(const struct lu_context *ctx, + struct ptlrpc_request *req) { int rep_buf_size[2] = { 0, }; struct req_capsule pill; @@ -292,11 +281,11 @@ seq_req_handle0(const struct lu_context *ctx, rc = seq_server_alloc_meta(site->ls_server_seq, out, ctx); break; case SEQ_ALLOC_SUPER: - if (!site->ls_ctlr_seq) { + if (!site->ls_control_seq) { CERROR("sequence-controller is not initialized\n"); GOTO(out_pill, rc == -EINVAL); } - rc = seq_server_alloc_super(site->ls_ctlr_seq, out, ctx); + rc = seq_server_alloc_super(site->ls_control_seq, out, ctx); break; default: CERROR("wrong opc 0x%x\n", *opc); @@ -312,8 +301,7 @@ out_pill: 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; @@ -345,8 +333,7 @@ seq_req_handle(struct ptlrpc_request *req) } #ifdef LPROCFS -static int -seq_server_proc_init(struct lu_server_seq *seq) +static int seq_server_proc_init(struct lu_server_seq *seq) { int rc; ENTRY; @@ -389,8 +376,7 @@ err: return rc; } -static void -seq_server_proc_fini(struct lu_server_seq *seq) +static void seq_server_proc_fini(struct lu_server_seq *seq) { ENTRY; if (seq->seq_proc_entry) { @@ -406,12 +392,11 @@ seq_server_proc_fini(struct lu_server_seq *seq) } #endif -int -seq_server_init(struct lu_server_seq *seq, - struct dt_device *dev, - const char *uuid, - lu_server_type_t type, - const struct lu_context *ctx) +int seq_server_init(struct lu_server_seq *seq, + struct dt_device *dev, + const char *uuid, + lu_server_type_t type, + const struct lu_context *ctx) { int rc, portal = (type == LUSTRE_SEQ_SRV) ? SEQ_SRV_PORTAL : SEQ_CTLR_PORTAL; @@ -441,7 +426,7 @@ seq_server_init(struct lu_server_seq *seq, seq->seq_meta_width = LUSTRE_SEQ_META_WIDTH; snprintf(seq->seq_name, sizeof(seq->seq_name), "%s-%s-%s", - LUSTRE_SEQ_NAME, (type == LUSTRE_SEQ_SRV ? "srv" : "ctlr"), + LUSTRE_SEQ_NAME, (type == LUSTRE_SEQ_SRV ? "srv" : "ctl"), uuid); seq->seq_space = LUSTRE_SEQ_SPACE_RANGE; @@ -457,11 +442,13 @@ seq_server_init(struct lu_server_seq *seq, rc = seq_store_read(seq, ctx); if (rc == -ENODATA) { if (type == LUSTRE_SEQ_SRV) { - CDEBUG(D_INFO|D_WARNING, "SEQ-MGR(srv): no data on " - "disk found, waiting for controller assign\n"); + CDEBUG(D_INFO|D_WARNING, "%s: no data on " + "disk found, wait for controller " + "attach\n", seq->seq_name); } else { - CDEBUG(D_INFO|D_WARNING, "SEQ-MGR(ctlr): no data on " - "disk found, this is first controller run\n"); + CDEBUG(D_INFO|D_WARNING, "%s: no data on " + "disk found, this is first controller " + "run\n", seq->seq_name); } } else if (rc) { CERROR("can't read sequence state, rc = %d\n", @@ -499,9 +486,8 @@ out: } EXPORT_SYMBOL(seq_server_init); -void -seq_server_fini(struct lu_server_seq *seq, - const struct lu_context *ctx) +void seq_server_fini(struct lu_server_seq *seq, + const struct lu_context *ctx) { ENTRY; @@ -537,17 +523,14 @@ static int fid_fini(void) RETURN(0); } -static int -__init fid_mod_init(void) - +static int __init fid_mod_init(void) { /* init caches if any */ fid_init(); return 0; } -static void -__exit fid_mod_exit(void) +static void __exit fid_mod_exit(void) { /* free caches if any */ fid_fini(); diff --git a/lustre/fid/fid_request.c b/lustre/fid/fid_request.c index feb2b53..88674e8 100644 --- a/lustre/fid/fid_request.c +++ b/lustre/fid/fid_request.c @@ -47,10 +47,9 @@ #include #include "fid_internal.h" -static int -seq_client_rpc(struct lu_client_seq *seq, - struct lu_range *range, - __u32 opc) +static int seq_client_rpc(struct lu_client_seq *seq, + struct lu_range *range, + __u32 opc) { struct obd_export *exp = seq->seq_exp; int repsize = sizeof(struct lu_range); @@ -102,33 +101,29 @@ out_req: return rc; } -static int -__seq_client_alloc_opc(struct lu_client_seq *seq, - int opc, const char *opcname) +static int __seq_client_alloc_opc(struct lu_client_seq *seq, + int opc, const char *opcname) { int rc; ENTRY; rc = seq_client_rpc(seq, &seq->seq_range, opc); if (rc == 0) { - CDEBUG(D_INFO, "SEQ-MGR(cli): allocated " - "%s-sequence ["LPX64"-"LPX64"]\n", - opcname, seq->seq_range.lr_start, - seq->seq_range.lr_end); + CDEBUG(D_INFO, "%s: allocated %s-sequence [" + LPX64"-"LPX64"]\n", seq->seq_name, opcname, + seq->seq_range.lr_start, seq->seq_range.lr_end); } RETURN(rc); } /* 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) { ENTRY; RETURN(__seq_client_alloc_opc(seq, SEQ_ALLOC_SUPER, "super")); } -int -seq_client_alloc_super(struct lu_client_seq *seq) +int seq_client_alloc_super(struct lu_client_seq *seq) { int rc; ENTRY; @@ -142,15 +137,13 @@ seq_client_alloc_super(struct lu_client_seq *seq) 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) { ENTRY; RETURN(__seq_client_alloc_opc(seq, SEQ_ALLOC_META, "meta")); } -int -seq_client_alloc_meta(struct lu_client_seq *seq) +int seq_client_alloc_meta(struct lu_client_seq *seq) { int rc; ENTRY; @@ -164,8 +157,7 @@ seq_client_alloc_meta(struct lu_client_seq *seq) EXPORT_SYMBOL(seq_client_alloc_meta); /* allocate new sequence for client (llite or MDC are expected to use this) */ -static int -__seq_client_alloc_seq(struct lu_client_seq *seq, seqno_t *seqnr) +static int __seq_client_alloc_seq(struct lu_client_seq *seq, seqno_t *seqnr) { int rc = 0; ENTRY; @@ -186,13 +178,12 @@ __seq_client_alloc_seq(struct lu_client_seq *seq, seqno_t *seqnr) *seqnr = seq->seq_range.lr_start; seq->seq_range.lr_start++; - CDEBUG(D_INFO, "SEQ-MGR(cli): allocated " - "sequence ["LPX64"]\n", *seqnr); + CDEBUG(D_INFO, "%s: allocated sequence ["LPX64"]\n", + seq->seq_name, *seqnr); RETURN(rc); } -int -seq_client_alloc_seq(struct lu_client_seq *seq, seqno_t *seqnr) +int seq_client_alloc_seq(struct lu_client_seq *seq, seqno_t *seqnr) { int rc = 0; ENTRY; @@ -205,8 +196,7 @@ seq_client_alloc_seq(struct lu_client_seq *seq, seqno_t *seqnr) } EXPORT_SYMBOL(seq_client_alloc_seq); -int -seq_client_alloc_fid(struct lu_client_seq *seq, struct lu_fid *fid) +int seq_client_alloc_fid(struct lu_client_seq *seq, struct lu_fid *fid) { seqno_t seqnr = 0; int rc; @@ -244,8 +234,8 @@ seq_client_alloc_fid(struct lu_client_seq *seq, struct lu_fid *fid) *fid = seq->seq_fid; LASSERT(fid_is_sane(fid)); - CDEBUG(D_INFO, "SEQ-MGR(cli): allocated FID "DFID3"\n", - PFID3(fid)); + CDEBUG(D_INFO, "%s: allocated FID "DFID3"\n", + seq->seq_name, PFID3(fid)); EXIT; out: @@ -255,8 +245,7 @@ out: EXPORT_SYMBOL(seq_client_alloc_fid); #ifdef LPROCFS -static int -seq_client_proc_init(struct lu_client_seq *seq) +static int seq_client_proc_init(struct lu_client_seq *seq) { int rc; ENTRY; @@ -288,8 +277,7 @@ err: return rc; } -static void -seq_client_proc_fini(struct lu_client_seq *seq) +static void seq_client_proc_fini(struct lu_client_seq *seq) { ENTRY; if (seq->seq_proc_dir) { @@ -300,10 +288,9 @@ seq_client_proc_fini(struct lu_client_seq *seq) } #endif -int -seq_client_init(struct lu_client_seq *seq, - const char *uuid, - struct obd_export *exp) +int seq_client_init(struct lu_client_seq *seq, + const char *uuid, + struct obd_export *exp) { int rc = 0; ENTRY; @@ -317,7 +304,7 @@ seq_client_init(struct lu_client_seq *seq, seq->seq_width = LUSTRE_SEQ_MAX_WIDTH; snprintf(seq->seq_name, sizeof(seq->seq_name), - "%s-%s", LUSTRE_SEQ_NAME, uuid); + "%s-cli-%s", LUSTRE_SEQ_NAME, uuid); #ifdef LPROCFS rc = seq_client_proc_init(seq); diff --git a/lustre/fid/fid_store.c b/lustre/fid/fid_store.c index 6668a01..7f1fd74 100644 --- a/lustre/fid/fid_store.c +++ b/lustre/fid/fid_store.c @@ -58,9 +58,8 @@ enum { }; /* this function implies that caller takes care about locking */ -int -seq_store_write(struct lu_server_seq *seq, - const struct lu_context *ctx) +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; @@ -96,9 +95,8 @@ seq_store_write(struct lu_server_seq *seq, /* this function implies that caller takes care about locking or locking is not * needed (init time). */ -int -seq_store_read(struct lu_server_seq *seq, - const struct lu_context *ctx) +int seq_store_read(struct lu_server_seq *seq, + const struct lu_context *ctx) { struct dt_object *dt_obj = seq->seq_obj; struct seq_store_capsule capsule; @@ -124,9 +122,8 @@ seq_store_read(struct lu_server_seq *seq, RETURN(rc); } -int -seq_store_init(struct lu_server_seq *seq, - const struct lu_context *ctx) +int seq_store_init(struct lu_server_seq *seq, + const struct lu_context *ctx) { struct dt_device *dt = seq->seq_dev; struct dt_object *dt_obj; @@ -148,9 +145,8 @@ seq_store_init(struct lu_server_seq *seq, RETURN(rc); } -void -seq_store_fini(struct lu_server_seq *seq, - const struct lu_context *ctx) +void seq_store_fini(struct lu_server_seq *seq, + const struct lu_context *ctx) { ENTRY; if (seq->seq_obj != NULL) { diff --git a/lustre/fld/fld_cache.c b/lustre/fld/fld_cache.c index 6bb2732..13f76ec 100644 --- a/lustre/fld/fld_cache.c +++ b/lustre/fld/fld_cache.c @@ -53,8 +53,7 @@ #include "fld_internal.h" #ifdef __KERNEL__ -struct fld_cache_info * -fld_cache_init(int size) +struct fld_cache_info *fld_cache_init(int size) { struct fld_cache_info *cache; int i; @@ -89,8 +88,7 @@ fld_cache_init(int size) } EXPORT_SYMBOL(fld_cache_init); -void -fld_cache_fini(struct fld_cache_info *cache) +void fld_cache_fini(struct fld_cache_info *cache) { struct fld_cache_entry *flde; struct hlist_head *bucket; @@ -121,9 +119,8 @@ fld_cache_fini(struct fld_cache_info *cache) } EXPORT_SYMBOL(fld_cache_fini); -int -fld_cache_insert(struct fld_cache_info *cache, - seqno_t seq, mdsno_t mds) +int fld_cache_insert(struct fld_cache_info *cache, + seqno_t seq, mdsno_t mds) { struct fld_cache_entry *flde, *fldt; struct hlist_head *bucket; @@ -159,8 +156,7 @@ exit_unlock: } EXPORT_SYMBOL(fld_cache_insert); -void -fld_cache_delete(struct fld_cache_info *cache, seqno_t seq) +void fld_cache_delete(struct fld_cache_info *cache, seqno_t seq) { struct fld_cache_entry *flde; struct hlist_head *bucket; @@ -185,9 +181,8 @@ out_unlock: } EXPORT_SYMBOL(fld_cache_delete); -int -fld_cache_lookup(struct fld_cache_info *cache, - seqno_t seq, mdsno_t *mds) +int fld_cache_lookup(struct fld_cache_info *cache, + seqno_t seq, mdsno_t *mds) { struct fld_cache_entry *flde; struct hlist_head *bucket; @@ -210,24 +205,22 @@ fld_cache_lookup(struct fld_cache_info *cache, } EXPORT_SYMBOL(fld_cache_lookup); #else -int -fld_cache_insert(struct fld_cache_info *cache, - seqno_t seq, mdsno_t mds) +int fld_cache_insert(struct fld_cache_info *cache, + seqno_t seq, mdsno_t mds) { return -ENOTSUPP; } EXPORT_SYMBOL(fld_cache_insert); -void -fld_cache_delete(struct fld_cache_info *cache, seqno_t seq) +void fld_cache_delete(struct fld_cache_info *cache, + seqno_t seq) { return; } EXPORT_SYMBOL(fld_cache_delete); -int -fld_cache_lookup(struct fld_cache_info *cache, - seqno_t seq, mdsno_t *mds) +int fld_cache_lookup(struct fld_cache_info *cache, + seqno_t seq, mdsno_t *mds) { return -ENOTSUPP; } diff --git a/lustre/fld/fld_handler.c b/lustre/fld/fld_handler.c index 5454b43..9d890b8 100644 --- a/lustre/fld/fld_handler.c +++ b/lustre/fld/fld_handler.c @@ -67,10 +67,9 @@ static void __exit fld_mod_exit(void) } /* insert index entry and update cache */ -int -fld_server_create(struct lu_server_fld *fld, - const struct lu_context *ctx, - seqno_t seq, mdsno_t mds) +int fld_server_create(struct lu_server_fld *fld, + const struct lu_context *ctx, + seqno_t seq, mdsno_t mds) { ENTRY; RETURN(fld_index_create(fld, ctx, seq, mds)); @@ -78,10 +77,9 @@ fld_server_create(struct lu_server_fld *fld, EXPORT_SYMBOL(fld_server_create); /* delete index entry */ -int -fld_server_delete(struct lu_server_fld *fld, - const struct lu_context *ctx, - seqno_t seq) +int fld_server_delete(struct lu_server_fld *fld, + const struct lu_context *ctx, + seqno_t seq) { ENTRY; RETURN(fld_index_delete(fld, ctx, seq)); @@ -89,20 +87,18 @@ fld_server_delete(struct lu_server_fld *fld, EXPORT_SYMBOL(fld_server_delete); /* issue on-disk index lookup */ -int -fld_server_lookup(struct lu_server_fld *fld, - const struct lu_context *ctx, - seqno_t seq, mdsno_t *mds) +int fld_server_lookup(struct lu_server_fld *fld, + const struct lu_context *ctx, + seqno_t seq, mdsno_t *mds) { ENTRY; RETURN(fld_index_lookup(fld, ctx, seq, mds)); } EXPORT_SYMBOL(fld_server_lookup); -static int -fld_server_handle(struct lu_server_fld *fld, - const struct lu_context *ctx, - __u32 opc, struct md_fld *mf) +static int fld_server_handle(struct lu_server_fld *fld, + const struct lu_context *ctx, + __u32 opc, struct md_fld *mf) { int rc; ENTRY; @@ -127,10 +123,9 @@ fld_server_handle(struct lu_server_fld *fld, } -static int -fld_req_handle0(const struct lu_context *ctx, - struct lu_server_fld *fld, - struct ptlrpc_request *req) +static int fld_req_handle0(const struct lu_context *ctx, + struct lu_server_fld *fld, + struct ptlrpc_request *req) { int rep_buf_size[3] = { 0, }; struct req_capsule pill; @@ -174,7 +169,7 @@ static int fld_req_handle(struct ptlrpc_request *req) { int fail = OBD_FAIL_FLD_ALL_REPLY_NET; const struct lu_context *ctx; - struct lu_site *site; + struct lu_site *site; int rc = -EPROTO; ENTRY; @@ -233,8 +228,7 @@ int fid_is_local(struct lu_site *site, const struct lu_fid *fid) EXPORT_SYMBOL(fid_is_local); #ifdef LPROCFS -static int -fld_server_proc_init(struct lu_server_fld *fld) +static int fld_server_proc_init(struct lu_server_fld *fld) { int rc; ENTRY; @@ -276,8 +270,7 @@ err: return rc; } -static void -fld_server_proc_fini(struct lu_server_fld *fld) +static void fld_server_proc_fini(struct lu_server_fld *fld) { ENTRY; if (fld->fld_proc_entry) { @@ -293,11 +286,10 @@ fld_server_proc_fini(struct lu_server_fld *fld) } #endif -int -fld_server_init(struct lu_server_fld *fld, - const struct lu_context *ctx, - struct dt_device *dt, - const char *uuid) +int fld_server_init(struct lu_server_fld *fld, + const struct lu_context *ctx, + struct dt_device *dt, + const char *uuid) { int rc; struct ptlrpc_service_conf fld_conf = { @@ -317,7 +309,7 @@ fld_server_init(struct lu_server_fld *fld, lu_device_get(&dt->dd_lu_dev); snprintf(fld->fld_name, sizeof(fld->fld_name), - "%s-%s", LUSTRE_FLD_NAME, uuid); + "%s-srv-%s", LUSTRE_FLD_NAME, uuid); rc = fld_index_init(fld, ctx); if (rc) @@ -349,9 +341,8 @@ out: } EXPORT_SYMBOL(fld_server_init); -void -fld_server_fini(struct lu_server_fld *fld, - const struct lu_context *ctx) +void fld_server_fini(struct lu_server_fld *fld, + const struct lu_context *ctx) { ENTRY; diff --git a/lustre/fld/fld_request.c b/lustre/fld/fld_request.c index 4ffe7b2..b8ef8c1 100644 --- a/lustre/fld/fld_request.c +++ b/lustre/fld/fld_request.c @@ -52,8 +52,8 @@ #include #include "fld_internal.h" -static int -fld_rrb_hash(struct lu_client_fld *fld, seqno_t seq) +static int fld_rrb_hash(struct lu_client_fld *fld, + seqno_t seq) { if (fld->fld_count == 0) return 0; @@ -61,8 +61,8 @@ fld_rrb_hash(struct lu_client_fld *fld, seqno_t seq) return do_div(seq, fld->fld_count); } -static int -fld_dht_hash(struct lu_client_fld *fld, seqno_t seq) +static int fld_dht_hash(struct lu_client_fld *fld, + seqno_t seq) { /* XXX: here should be DHT hash */ return fld_rrb_hash(fld, seq); @@ -86,15 +86,16 @@ struct lu_fld_hash fld_hash[3] = { * passed @hash. In case of usual round-robin hash, this is decided by comparing * hash and target's index. In the case of DHT, algorithm is a bit more * complicated. */ -static int -fld_client_apt_target(struct fld_target *target, int hash) +static int fld_client_apt_target(struct fld_target *target, + int hash) { /* XXX: DHT case should be worked out. */ return (target->fldt_idx == hash); } static struct fld_target * -fld_client_get_target(struct lu_client_fld *fld, seqno_t seq) +fld_client_get_target(struct lu_client_fld *fld, + seqno_t seq) { struct fld_target *target; int hash; @@ -122,9 +123,8 @@ fld_client_get_target(struct lu_client_fld *fld, seqno_t seq) /* add export to FLD. This is usually done by CMM and LMV as they are main users * of FLD module. */ -int -fld_client_add_target(struct lu_client_fld *fld, - struct obd_export *exp) +int fld_client_add_target(struct lu_client_fld *fld, + struct obd_export *exp) { struct client_obd *cli = &exp->exp_obd->u.cli; struct fld_target *target, *tmp; @@ -132,8 +132,8 @@ fld_client_add_target(struct lu_client_fld *fld, LASSERT(exp != NULL); - CDEBUG(D_INFO|D_WARNING, "FLD(cli): adding export %s\n", - cli->cl_target_uuid.uuid); + CDEBUG(D_INFO|D_WARNING, "%s: adding export %s\n", + fld->fld_name, cli->cl_target_uuid.uuid); OBD_ALLOC_PTR(target); if (target == NULL) @@ -163,9 +163,8 @@ fld_client_add_target(struct lu_client_fld *fld, EXPORT_SYMBOL(fld_client_add_target); /* remove export from FLD */ -int -fld_client_del_target(struct lu_client_fld *fld, - struct obd_export *exp) +int fld_client_del_target(struct lu_client_fld *fld, + struct obd_export *exp) { struct fld_target *target, *tmp; ENTRY; @@ -190,8 +189,7 @@ fld_client_del_target(struct lu_client_fld *fld, EXPORT_SYMBOL(fld_client_del_target); #ifdef LPROCFS -static int -fld_client_proc_init(struct lu_client_fld *fld) +static int fld_client_proc_init(struct lu_client_fld *fld) { int rc; ENTRY; @@ -223,8 +221,7 @@ err: return rc; } -static void -fld_client_proc_fini(struct lu_client_fld *fld) +static void fld_client_proc_fini(struct lu_client_fld *fld) { ENTRY; if (fld->fld_proc_dir) { @@ -240,9 +237,8 @@ static inline int hash_is_sane(int hash) return (hash >= 0 && hash < ARRAY_SIZE(fld_hash)); } -int -fld_client_init(struct lu_client_fld *fld, - const char *uuid, int hash) +int fld_client_init(struct lu_client_fld *fld, + const char *uuid, int hash) { int rc = 0; ENTRY; @@ -260,7 +256,7 @@ fld_client_init(struct lu_client_fld *fld, fld->fld_count = 0; snprintf(fld->fld_name, sizeof(fld->fld_name), - "%s-%s", LUSTRE_FLD_NAME, uuid); + "%s-cli-%s", LUSTRE_FLD_NAME, uuid); #ifdef __KERNEL__ fld->fld_cache = fld_cache_init(FLD_HTABLE_SIZE); @@ -290,8 +286,7 @@ out: } EXPORT_SYMBOL(fld_client_init); -void -fld_client_fini(struct lu_client_fld *fld) +void fld_client_fini(struct lu_client_fld *fld) { struct fld_target *target, *tmp; ENTRY; @@ -322,9 +317,8 @@ fld_client_fini(struct lu_client_fld *fld) } EXPORT_SYMBOL(fld_client_fini); -static int -fld_client_rpc(struct obd_export *exp, - struct md_fld *mf, __u32 fld_op) +static int fld_client_rpc(struct obd_export *exp, + struct md_fld *mf, __u32 fld_op) { int size[2] = {sizeof(__u32), sizeof(struct md_fld)}, rc; int mf_size = sizeof(struct md_fld); @@ -373,9 +367,8 @@ out_req: return rc; } -static int -__fld_client_create(struct lu_client_fld *fld, - seqno_t seq, mdsno_t mds, +static int __fld_client_create(struct lu_client_fld *fld, + seqno_t seq, mdsno_t mds, struct md_fld *md_fld) { struct fld_target *target; @@ -399,9 +392,8 @@ __fld_client_create(struct lu_client_fld *fld, RETURN(rc); } -int -fld_client_create(struct lu_client_fld *fld, - seqno_t seq, mdsno_t mds) +int fld_client_create(struct lu_client_fld *fld, + seqno_t seq, mdsno_t mds) { struct md_fld md_fld = { .mf_seq = seq, .mf_mds = mds }; __u32 rc; @@ -412,9 +404,8 @@ fld_client_create(struct lu_client_fld *fld, } EXPORT_SYMBOL(fld_client_create); -static int -__fld_client_delete(struct lu_client_fld *fld, - seqno_t seq, struct md_fld *md_fld) +static int __fld_client_delete(struct lu_client_fld *fld, + seqno_t seq, struct md_fld *md_fld) { struct fld_target *target; __u32 rc; @@ -430,9 +421,8 @@ __fld_client_delete(struct lu_client_fld *fld, RETURN(rc); } -int -fld_client_delete(struct lu_client_fld *fld, - seqno_t seq) +int fld_client_delete(struct lu_client_fld *fld, + seqno_t seq) { struct md_fld md_fld = { .mf_seq = seq, .mf_mds = 0 }; __u32 rc; @@ -442,10 +432,9 @@ fld_client_delete(struct lu_client_fld *fld, } EXPORT_SYMBOL(fld_client_delete); -static int -__fld_client_lookup(struct lu_client_fld *fld, - seqno_t seq, mdsno_t *mds, - struct md_fld *md_fld) +static int __fld_client_lookup(struct lu_client_fld *fld, + seqno_t seq, mdsno_t *mds, + struct md_fld *md_fld) { struct fld_target *target; int rc; @@ -473,9 +462,8 @@ __fld_client_lookup(struct lu_client_fld *fld, RETURN(rc); } -int -fld_client_lookup(struct lu_client_fld *fld, - seqno_t seq, mdsno_t *mds) +int fld_client_lookup(struct lu_client_fld *fld, + seqno_t seq, mdsno_t *mds) { struct md_fld md_fld = { .mf_seq = seq, .mf_mds = 0 }; int rc; diff --git a/lustre/include/lu_object.h b/lustre/include/lu_object.h index 611d6ce..b5831b9 100644 --- a/lustre/include/lu_object.h +++ b/lustre/include/lu_object.h @@ -520,15 +520,15 @@ struct lu_site { /* * Controller Seq Manager */ - struct lu_server_seq *ls_ctlr_seq; + struct lu_server_seq *ls_control_seq; /* - * Clienbt Seq Manager + * Client Seq Manager */ struct lu_client_seq *ls_client_seq; - /* sequence controller node */ - struct obd_export *ls_ctlr_exp; + /* Sequence controller node */ + struct obd_export *ls_client_exp; /* statistical counters. Protected by nothing, races are accepted. */ struct { diff --git a/lustre/include/lustre_fid.h b/lustre/include/lustre_fid.h index c0612d7..04d48d2 100644 --- a/lustre/include/lustre_fid.h +++ b/lustre/include/lustre_fid.h @@ -140,11 +140,9 @@ int seq_server_init(struct lu_server_seq *seq, void seq_server_fini(struct lu_server_seq *seq, const struct lu_context *ctx); -int seq_server_init_ctlr(struct lu_server_seq *seq, - struct lu_client_seq *cli, - const struct lu_context *ctx); - -void seq_server_fini_ctlr(struct lu_server_seq *seq); +int seq_server_set_cli(struct lu_server_seq *seq, + struct lu_client_seq *cli, + const struct lu_context *ctx); #endif int seq_client_init(struct lu_client_seq *seq, diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 299959e..4169b5f 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -1746,10 +1746,10 @@ static int mdt_seq_fini(const struct lu_context *ctx, OBD_FREE_PTR(ls->ls_server_seq); ls->ls_server_seq = NULL; } - if (ls && ls->ls_ctlr_seq) { - seq_server_fini(ls->ls_ctlr_seq, ctx); - OBD_FREE_PTR(ls->ls_ctlr_seq); - ls->ls_ctlr_seq = NULL; + if (ls && ls->ls_control_seq) { + seq_server_fini(ls->ls_control_seq, ctx); + OBD_FREE_PTR(ls->ls_control_seq); + ls->ls_control_seq = NULL; } RETURN(0); } @@ -1766,11 +1766,11 @@ static int mdt_seq_init(const struct lu_context *ctx, /* sequence-controller node */ if (ls->ls_node_id == 0) { - LASSERT(ls->ls_ctlr_seq == NULL); - OBD_ALLOC_PTR(ls->ls_ctlr_seq); + LASSERT(ls->ls_control_seq == NULL); + OBD_ALLOC_PTR(ls->ls_control_seq); - if (ls->ls_ctlr_seq != NULL) { - rc = seq_server_init(ls->ls_ctlr_seq, + if (ls->ls_control_seq != NULL) { + rc = seq_server_init(ls->ls_control_seq, m->mdt_bottom, uuid, LUSTRE_SEQ_CTLR, ctx); @@ -1795,10 +1795,13 @@ static int mdt_seq_init(const struct lu_context *ctx, RETURN(rc); } -/* XXX: this is ugly, should be something else */ -static int mdt_seq_init_ctlr(const struct lu_context *ctx, - struct mdt_device *m, - struct lustre_cfg *cfg) +/* + * Init client sequence manager which is used by local MDS to talk to sequence + * controller on remote node. + */ +static int mdt_seq_init_cli(const struct lu_context *ctx, + struct mdt_device *m, + struct lustre_cfg *cfg) { struct lu_site *ls = m->mdt_md_dev.md_lu_dev.ld_site; struct obd_device *mdc; @@ -1823,7 +1826,7 @@ static int mdt_seq_init_ctlr(const struct lu_context *ctx, /* check if this is first MDC add and controller is not yet * initialized. */ - if (index != 0 || ls->ls_ctlr_exp) + if (index != 0 || ls->ls_client_exp) RETURN(0); uuid_str = lustre_cfg_string(cfg, 1); @@ -1848,14 +1851,14 @@ static int mdt_seq_init_ctlr(const struct lu_context *ctx, CERROR("target %s connect error %d\n", mdc->obd_name, rc); } else { - ls->ls_ctlr_exp = class_conn2export(&conn); + ls->ls_client_exp = class_conn2export(&conn); OBD_ALLOC_PTR(ls->ls_client_seq); if (ls->ls_client_seq != NULL) { rc = seq_client_init(ls->ls_client_seq, mdc->obd_name, - ls->ls_ctlr_exp); + ls->ls_client_exp); } else rc = -ENOMEM; @@ -1864,16 +1867,16 @@ static int mdt_seq_init_ctlr(const struct lu_context *ctx, LASSERT(ls->ls_server_seq != NULL); - rc = seq_server_init_ctlr(ls->ls_server_seq, - ls->ls_client_seq, - ctx); + rc = seq_server_set_cli(ls->ls_server_seq, + ls->ls_client_seq, + ctx); } } RETURN(rc); } -static void mdt_seq_fini_ctlr(struct mdt_device *m) +static void mdt_seq_fini_cli(struct mdt_device *m) { struct lu_site *ls; @@ -1882,7 +1885,8 @@ static void mdt_seq_fini_ctlr(struct mdt_device *m) ls = m->mdt_md_dev.md_lu_dev.ld_site; if (ls && ls->ls_server_seq) - seq_server_fini_ctlr(ls->ls_server_seq); + seq_server_set_cli(ls->ls_server_seq, + NULL, NULL); if (ls && ls->ls_client_seq) { seq_client_fini(ls->ls_client_seq); @@ -1890,9 +1894,9 @@ static void mdt_seq_fini_ctlr(struct mdt_device *m) ls->ls_client_seq = NULL; } - if (ls && ls->ls_ctlr_exp) { - int rc = obd_disconnect(ls->ls_ctlr_exp); - ls->ls_ctlr_exp = NULL; + if (ls && ls->ls_client_exp) { + int rc = obd_disconnect(ls->ls_client_exp); + ls->ls_client_exp = NULL; if (rc) { CERROR("failure to disconnect " @@ -2199,7 +2203,7 @@ static void mdt_fini(const struct lu_context *ctx, struct mdt_device *m) mdt_fld_fini(ctx, m); mdt_seq_fini(ctx, m); - mdt_seq_fini_ctlr(m); + mdt_seq_fini_cli(m); LASSERT(atomic_read(&d->ld_ref) == 0); md_device_fini(&m->mdt_md_dev); @@ -2327,9 +2331,11 @@ static int mdt_process_config(const struct lu_context *ctx, switch (cfg->lcfg_command) { case LCFG_ADD_MDC: - /* add mdc hook to get first MDT uuid and connect it to - * ls->controller to use for seq manager. */ - err = mdt_seq_init_ctlr(ctx, mdt_dev(d), cfg); + /* + * Add mdc hook to get first MDT uuid and connect it to + * ls->controller to use for seq manager. + */ + err = mdt_seq_init_cli(ctx, mdt_dev(d), cfg); if (err) { CERROR("can't initialize controller export, " "rc %d\n", err);