From: yury Date: Fri, 23 Jun 2006 10:07:54 +0000 (+0000) Subject: - added exporting client side meta-seq to userspace via procfs (not used yet); X-Git-Tag: v1_8_0_110~486^2~1562 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=b6cddd68249a8e3ad44cce0599c7059b6a5817b7;p=fs%2Flustre-release.git - added exporting client side meta-seq to userspace via procfs (not used yet); - cleanups and small fixes in FLD. --- diff --git a/lustre/fid/fid_handler.c b/lustre/fid/fid_handler.c index 50c428f..f99e712 100644 --- a/lustre/fid/fid_handler.c +++ b/lustre/fid/fid_handler.c @@ -408,7 +408,7 @@ seq_server_proc_init(struct lu_server_seq *seq) } rc = lprocfs_add_vars(seq_type_proc_dir, - seq_proc_list, seq); + seq_server_proc_list, seq); if (rc) { CERROR("can't init sequence manager " "proc, rc %d\n", rc); diff --git a/lustre/fid/fid_internal.h b/lustre/fid/fid_internal.h index e65ab9c..91e85f1 100644 --- a/lustre/fid/fid_internal.h +++ b/lustre/fid/fid_internal.h @@ -29,7 +29,8 @@ #define SEQ_SERVICE_WATCHDOG_TIMEOUT (obd_timeout * 1000) #ifdef LPROCFS -extern struct lprocfs_vars seq_proc_list[]; +extern struct lprocfs_vars seq_server_proc_list[]; +extern struct lprocfs_vars seq_client_proc_list[]; #endif #endif diff --git a/lustre/fid/lproc_fid.c b/lustre/fid/lproc_fid.c index 93f2f2c..871fe04 100644 --- a/lustre/fid/lproc_fid.c +++ b/lustre/fid/lproc_fid.c @@ -173,6 +173,49 @@ seq_proc_read_super(char *page, char **start, off_t off, } static int +seq_proc_write_meta(struct file *file, const char *buffer, + unsigned long count, void *data) +{ + struct lu_client_seq *seq = (struct lu_client_seq *)data; + int rc; + ENTRY; + + LASSERT(seq != NULL); + + down(&seq->seq_sem); + rc = seq_proc_write_range(file, buffer, count, + data, &seq->seq_range); + + if (rc == 0) { + CDEBUG(D_WARNING, "SEQ-MGR(cli): meta-sequence has changed to " + "["LPU64"-"LPU64"]\n", seq->seq_range.lr_start, + seq->seq_range.lr_end); + } + + up(&seq->seq_sem); + + RETURN(count); +} + +static int +seq_proc_read_meta(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct lu_client_seq *seq = (struct lu_client_seq *)data; + int rc; + ENTRY; + + LASSERT(seq != NULL); + + down(&seq->seq_sem); + rc = seq_proc_read_range(page, start, off, count, eof, + data, &seq->seq_range); + up(&seq->seq_sem); + + RETURN(rc); +} + +static int seq_proc_read_controller(char *page, char **start, off_t off, int count, int *eof, void *data) { @@ -195,9 +238,13 @@ seq_proc_read_controller(char *page, char **start, off_t off, RETURN(rc); } -struct lprocfs_vars seq_proc_list[] = { +struct lprocfs_vars seq_server_proc_list[] = { { "space", seq_proc_read_space, seq_proc_write_space, NULL }, { "super", seq_proc_read_super, seq_proc_write_super, NULL }, { "controller", seq_proc_read_controller, NULL, NULL }, { NULL }}; + +struct lprocfs_vars seq_client_proc_list[] = { + { "meta", seq_proc_read_meta, seq_proc_write_meta, NULL }, + { NULL }}; #endif diff --git a/lustre/fld/fld_index.c b/lustre/fld/fld_index.c index aad55e5..7b55422 100644 --- a/lustre/fld/fld_index.c +++ b/lustre/fld/fld_index.c @@ -150,8 +150,6 @@ int fld_index_handle_insert(struct lu_server_fld *fld, dt->dd_ops->dt_trans_stop(ctx, th); RETURN(rc); - /* XXX: stub until IAM is ready */ - return 0; } int fld_index_handle_delete(struct lu_server_fld *fld, @@ -172,8 +170,6 @@ int fld_index_handle_delete(struct lu_server_fld *fld, dt->dd_ops->dt_trans_stop(ctx, th); RETURN(rc); - /* XXX: stub until IAM is ready */ - return 0; } int fld_index_handle_lookup(struct lu_server_fld *fld, @@ -190,9 +186,6 @@ int fld_index_handle_lookup(struct lu_server_fld *fld, if (rc == 0) *mds = be64_to_cpu(*(__u64 *)rec); RETURN(rc); - /* XXX: stub until IAM is ready */ - *mds = 0; - return 0; } int fld_index_init(struct lu_server_fld *fld, diff --git a/lustre/fld/fld_request.c b/lustre/fld/fld_request.c index d96b81d..b477ec5 100644 --- a/lustre/fld/fld_request.c +++ b/lustre/fld/fld_request.c @@ -353,8 +353,10 @@ fld_client_create(struct lu_client_fld *fld, md_fld.mf_mds = mds; rc = fld_client_rpc(fld_exp, &md_fld, FLD_CREATE); + #ifdef __KERNEL__ - fld_cache_insert(fld_cache, seq, mds); + if (rc == 0) + rc = fld_cache_insert(fld_cache, seq, mds); #endif RETURN(rc); @@ -363,7 +365,7 @@ EXPORT_SYMBOL(fld_client_create); int fld_client_delete(struct lu_client_fld *fld, - __u64 seq, mdsno_t mds) + __u64 seq) { struct obd_export *fld_exp; struct md_fld md_fld; @@ -378,7 +380,7 @@ fld_client_delete(struct lu_client_fld *fld, RETURN(-EINVAL); md_fld.mf_seq = seq; - md_fld.mf_mds = mds; + md_fld.mf_mds = 0; rc = fld_client_rpc(fld_exp, &md_fld, FLD_DELETE); RETURN(rc); @@ -433,7 +435,8 @@ fld_client_lookup(struct lu_client_fld *fld, RETURN(rc); #ifdef __KERNEL__ - rc = fld_cache_insert(fld_cache, seq, *mds); + if (rc == 0) + rc = fld_cache_insert(fld_cache, seq, *mds); #endif RETURN(rc); diff --git a/lustre/include/lustre_fld.h b/lustre/include/lustre_fld.h index f02dd32..119dfe6 100644 --- a/lustre/include/lustre_fld.h +++ b/lustre/include/lustre_fld.h @@ -72,19 +72,19 @@ int fld_client_init(struct lu_client_fld *fld, void fld_client_fini(struct lu_client_fld *fld); -int fld_client_add_export(struct lu_client_fld *fld, - struct obd_export *exp); - -int fld_client_del_export(struct lu_client_fld *fld, - struct obd_export *exp); +int fld_client_lookup(struct lu_client_fld *fld, + __u64 seq, mdsno_t *mds); int fld_client_create(struct lu_client_fld *fld, __u64 seq, mdsno_t mds); int fld_client_delete(struct lu_client_fld *fld, - __u64 seq, mdsno_t mds); + __u64 seq); -int fld_client_lookup(struct lu_client_fld *fld, - __u64 seq, mdsno_t *mds); +int fld_client_add_export(struct lu_client_fld *fld, + struct obd_export *exp); + +int fld_client_del_export(struct lu_client_fld *fld, + struct obd_export *exp); #endif diff --git a/lustre/lmv/lmv_fld.c b/lustre/lmv/lmv_fld.c index aec66ae..5ebc72a 100644 --- a/lustre/lmv/lmv_fld.c +++ b/lustre/lmv/lmv_fld.c @@ -59,10 +59,10 @@ int lmv_fld_lookup(struct obd_device *obd, const struct lu_fid *fid) fid_seq(fid), rc); RETURN(rc); } - CDEBUG(D_WARNING, "LMV: got MDS %u for sequence: "LPU64"\n", + CDEBUG(D_WARNING, "LMV: got MDS "LPU64" for sequence: "LPU64"\n", mds, fid_seq(fid)); if (mds >= lmv->desc.ld_tgt_count) { - CERROR("Got invalid mdsno: %u (max: %d)\n", + CERROR("Got invalid mdsno: "LPU64" (max: %d)\n", mds, lmv->desc.ld_tgt_count); mds = (__u64)-EINVAL; }