From dd6bb755da27dc07048bb1ab8d1814a33ecfaae6 Mon Sep 17 00:00:00 2001 From: yury Date: Sat, 4 Nov 2006 08:27:23 +0000 Subject: [PATCH] - cleanups and fixes in fid/lproc* stuff; - in mdd_dir_page_build() added check for wrong hash. - in mdd_dir_page_build() fixed using not swabbed fid. --- lustre/fid/lproc_fid.c | 43 ++++++++++++++++++++++--------------------- lustre/mdd/mdd_object.c | 30 +++++++++++++++++++++++++----- 2 files changed, 47 insertions(+), 26 deletions(-) diff --git a/lustre/fid/lproc_fid.c b/lustre/fid/lproc_fid.c index 2700c50..cf1896f 100644 --- a/lustre/fid/lproc_fid.c +++ b/lustre/fid/lproc_fid.c @@ -101,9 +101,8 @@ seq_server_proc_write_space(struct file *file, const char *buffer, rc = seq_proc_write_common(file, buffer, count, data, &seq->lss_space); if (rc == 0) { - CDEBUG(D_INFO, "%s: Sequences space has " - "changed to "DRANGE"\n", seq->lss_name, - PRANGE(&seq->lss_space)); + CDEBUG(D_INFO, "%s: Space: "DRANGE"\n", + seq->lss_name, PRANGE(&seq->lss_space)); } up(&seq->lss_sem); @@ -134,6 +133,7 @@ seq_server_proc_read_server(char *page, char **start, off_t off, int count, int *eof, void *data) { struct lu_server_seq *seq = (struct lu_server_seq *)data; + struct client_obd *cli; int rc; ENTRY; @@ -141,12 +141,16 @@ seq_server_proc_read_server(char *page, char **start, off_t off, *eof = 1; if (seq->lss_cli) { - struct obd_export *exp = seq->lss_cli->lcs_exp; - - rc = snprintf(page, count, "%s\n", - exp->exp_client_uuid.uuid); + if (seq->lss_cli->lcs_exp != NULL) { + cli = &seq->lss_cli->lcs_exp->exp_obd->u.cli; + rc = snprintf(page, count, "%s\n", + cli->cl_target_uuid.uuid); + } else { + rc = snprintf(page, count, "%s\n", + seq->lss_cli->lcs_srv->lss_name); + } } else { - rc = snprintf(page, count, "\n"); + rc = snprintf(page, count, "\n"); } RETURN(rc); @@ -171,8 +175,8 @@ seq_server_proc_write_width(struct file *file, const char *buffer, seq->lss_width = val; if (rc == 0) { - CDEBUG(D_INFO, "%s: Allocation unit has changed to " - LPU64"\n", seq->lss_name, seq->lss_width); + CDEBUG(D_INFO, "%s: Width: "LPU64"\n", + seq->lss_name, seq->lss_width); } up(&seq->lss_sem); @@ -213,9 +217,8 @@ seq_client_proc_write_space(struct file *file, const char *buffer, data, &seq->lcs_space); if (rc == 0) { - CDEBUG(D_INFO, "%s: Sequences space has " - "changed to "DRANGE"\n", seq->lcs_name, - PRANGE(&seq->lcs_space)); + CDEBUG(D_INFO, "%s: Space: "DRANGE"\n", + seq->lcs_name, PRANGE(&seq->lcs_space)); } up(&seq->lcs_sem); @@ -289,8 +292,8 @@ seq_client_proc_read_width(char *page, char **start, off_t off, } static int -seq_client_proc_read_next_fid(char *page, char **start, off_t off, - int count, int *eof, void *data) +seq_client_proc_read_fid(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; @@ -319,11 +322,9 @@ seq_client_proc_read_server(char *page, char **start, off_t off, if (seq->lcs_exp != NULL) { cli = &seq->lcs_exp->exp_obd->u.cli; rc = snprintf(page, count, "%s\n", cli->cl_target_uuid.uuid); - } else - /* - * Export-less sequence, see mdt_seq_init(). - */ - rc = snprintf(page, count, "none\n"); + } else { + rc = snprintf(page, count, "%s\n", seq->lcs_srv->lss_name); + } RETURN(rc); } @@ -337,6 +338,6 @@ struct lprocfs_vars seq_client_proc_list[] = { { "space", seq_client_proc_read_space, seq_client_proc_write_space, NULL }, { "width", seq_client_proc_read_width, seq_client_proc_write_width, NULL }, { "server", seq_client_proc_read_server, NULL, NULL }, - { "next_fid", seq_client_proc_read_next_fid, NULL, NULL }, + { "fid", seq_client_proc_read_fid, NULL, NULL }, { NULL }}; #endif diff --git a/lustre/mdd/mdd_object.c b/lustre/mdd/mdd_object.c index 4a83877..e96dda8 100644 --- a/lustre/mdd/mdd_object.c +++ b/lustre/mdd/mdd_object.c @@ -1234,13 +1234,14 @@ static int mdd_readpage_sanity_check(const struct lu_env *env, } static int mdd_dir_page_build(const struct lu_env *env, int first, - void *area, int nob, - struct dt_it_ops *iops, struct dt_it *it, - __u32 *start, __u32 *end, struct lu_dirent **last) + void *area, int nob, struct dt_it_ops *iops, + struct dt_it *it, __u32 *start, __u32 *end, + struct lu_dirent **last) { - int result; + struct lu_fid *fid2 = &mdd_env_info(env)->mti_fid2; struct mdd_thread_info *info = mdd_env_info(env); struct lu_fid *fid = &info->mti_fid; + int result; struct lu_dirent *ent; if (first) { @@ -1263,12 +1264,31 @@ static int mdd_dir_page_build(const struct lu_env *env, int first, len = iops->key_size(env, it); fid = (struct lu_fid *)iops->rec(env, it); + fid_be_to_cpu(fid2, fid); recsize = (sizeof(*ent) + len + 3) & ~3; hash = iops->store(env, it); + if (ent != area) { + /* + * This is not first entry, *start is initialized so + * that we can check hash for validness, that is, if it + * fits into allowed range. It should not be smaller + * than *start. Otherwise - iam iterator is buggy. + */ + if (hash < *start) { + CERROR("Entry hash (%#8.8x) < page hash (%#8.8x) - [" + "%p %p %d "DFID": %#8.8x (%d) \"%*.*s\"]\n", + hash, *start, name, ent, nob, PFID(fid2), hash, + len, len, len, name); + result = iops->next(env, it); + continue; + } + } + *end = hash; + CDEBUG(D_INFO, "%p %p %d "DFID": %#8.8x (%d) \"%*.*s\"\n", - name, ent, nob, PFID(fid), hash, len, len, len, name); + name, ent, nob, PFID(fid2), hash, len, len, len, name); if (nob >= recsize) { fid_be_to_cpu(&ent->lde_fid, fid); -- 1.8.3.1