Whamcloud - gitweb
- re-arrange seq and fld lprocfs stuff, put their lproc into "fld" and "seq" dirs...
authoryury <yury>
Sun, 24 Sep 2006 10:40:16 +0000 (10:40 +0000)
committeryury <yury>
Sun, 24 Sep 2006 10:40:16 +0000 (10:40 +0000)
- fixes in mdt_enqueue() with handling obd_fail_loc;
- fixed missed lu_context_key_register() in fid init time.

lustre/fid/fid_handler.c
lustre/fid/fid_internal.h
lustre/fid/fid_request.c
lustre/fld/fld_handler.c
lustre/fld/fld_internal.h
lustre/fld/fld_request.c
lustre/include/lustre_fld.h
lustre/mdt/mdt_handler.c
lustre/mdt/mdt_reint.c
lustre/tests/replay-single.sh

index 4a797e1..58c6724 100644 (file)
@@ -433,7 +433,7 @@ static int seq_server_proc_init(struct lu_server_seq *seq)
         ENTRY;
 
         seq->lss_proc_dir = lprocfs_register(seq->lss_name,
-                                             proc_lustre_root,
+                                             seq_type_proc_dir,
                                              NULL, NULL);
         if (IS_ERR(seq->lss_proc_dir)) {
                 rc = PTR_ERR(seq->lss_proc_dir);
@@ -496,9 +496,8 @@ int seq_server_init(struct lu_server_seq *seq,
         seq->lss_super_width = LUSTRE_SEQ_SUPER_WIDTH;
         seq->lss_meta_width = LUSTRE_SEQ_META_WIDTH;
 
-        snprintf(seq->lss_name, sizeof(seq->lss_name), "%s-%s-%s",
-                 LUSTRE_SEQ_NAME, (is_srv ? "srv" : "ctl"),
-                 prefix);
+        snprintf(seq->lss_name, sizeof(seq->lss_name), "%s-%s",
+                 (is_srv ? "srv" : "ctl"), prefix);
 
         seq->lss_space = LUSTRE_SEQ_SPACE_RANGE;
         seq->lss_super = LUSTRE_SEQ_ZERO_RANGE;
@@ -548,30 +547,30 @@ void seq_server_fini(struct lu_server_seq *seq,
 }
 EXPORT_SYMBOL(seq_server_fini);
 
-static int fid_init(void)
-{
-       ENTRY;
-       RETURN(0);
-}
-
-static int fid_fini(void)
-{
-       ENTRY;
-       RETURN(0);
-}
+cfs_proc_dir_entry_t *seq_type_proc_dir = NULL;
 
 static int __init fid_mod_init(void)
 {
-        /* init caches if any */
-        fid_init();
+        printk(KERN_INFO "Lustre: Sequence Manager; "
+               "info@clusterfs.com\n");
+        
+        seq_type_proc_dir = lprocfs_register(LUSTRE_SEQ_NAME,
+                                             proc_lustre_root,
+                                             NULL, NULL);
+        if (IS_ERR(seq_type_proc_dir))
+                return PTR_ERR(seq_type_proc_dir);
+        
+        lu_context_key_register(&seq_thread_key);
         return 0;
 }
 
 static void __exit fid_mod_exit(void)
 {
-        /* free caches if any */
-        fid_fini();
-        return;
+        lu_context_key_degister(&seq_thread_key);
+        if (seq_type_proc_dir != NULL && !IS_ERR(seq_type_proc_dir)) {
+                lprocfs_remove(seq_type_proc_dir);
+                seq_type_proc_dir = NULL;
+        }
 }
 
 MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
index d241016..537f601 100644 (file)
@@ -70,4 +70,6 @@ extern struct lprocfs_vars seq_client_proc_list[];
 
 #endif
 
+extern cfs_proc_dir_entry_t *seq_type_proc_dir;
+
 #endif /* __FID_INTERNAL_H */
index d078bc9..26da8b7 100644 (file)
@@ -294,7 +294,7 @@ static int seq_client_proc_init(struct lu_client_seq *seq)
         ENTRY;
 
         seq->lcs_proc_dir = lprocfs_register(seq->lcs_name,
-                                             proc_lustre_root,
+                                             seq_type_proc_dir,
                                              NULL, NULL);
 
         if (IS_ERR(seq->lcs_proc_dir)) {
@@ -368,7 +368,7 @@ int seq_client_init(struct lu_client_seq *seq,
         }
 
         snprintf(seq->lcs_name, sizeof(seq->lcs_name),
-                 "%s-cli-%s", LUSTRE_SEQ_NAME, prefix);
+                 "cli-%s", prefix);
 
         rc = seq_client_proc_init(seq);
         if (rc)
index 0190e39..20c5f11 100644 (file)
@@ -79,9 +79,19 @@ struct lu_context_key fld_thread_key = {
         .lct_fini = fld_key_fini
 };
 
+cfs_proc_dir_entry_t *fld_type_proc_dir = NULL;
+
 static int __init fld_mod_init(void)
 {
-        printk(KERN_INFO "Lustre: Fid Location Database; info@clusterfs.com\n");
+        printk(KERN_INFO "Lustre: Fid Location Database; "
+               "info@clusterfs.com\n");
+        
+        fld_type_proc_dir = lprocfs_register(LUSTRE_FLD_NAME,
+                                             proc_lustre_root,
+                                             NULL, NULL);
+        if (IS_ERR(fld_type_proc_dir))
+                return PTR_ERR(fld_type_proc_dir);
+        
         lu_context_key_register(&fld_thread_key);
         return 0;
 }
@@ -89,7 +99,10 @@ static int __init fld_mod_init(void)
 static void __exit fld_mod_exit(void)
 {
         lu_context_key_degister(&fld_thread_key);
-        return;
+        if (fld_type_proc_dir != NULL && !IS_ERR(fld_type_proc_dir)) {
+                lprocfs_remove(fld_type_proc_dir);
+                fld_type_proc_dir = NULL;
+        }
 }
 
 /* insert index entry and update cache */
@@ -283,7 +296,7 @@ static int fld_server_proc_init(struct lu_server_fld *fld)
         ENTRY;
 
         fld->lsf_proc_dir = lprocfs_register(fld->lsf_name,
-                                             proc_lustre_root,
+                                             fld_type_proc_dir,
                                              fld_server_proc_list, fld);
         if (IS_ERR(fld->lsf_proc_dir)) {
                 rc = PTR_ERR(fld->lsf_proc_dir);
@@ -316,13 +329,13 @@ static void fld_server_proc_fini(struct lu_server_fld *fld)
 #endif
 
 int fld_server_init(struct lu_server_fld *fld, struct dt_device *dt,
-                    const char *uuid, const struct lu_context *ctx)
+                    const char *prefix, const struct lu_context *ctx)
 {
         int rc;
         ENTRY;
 
         snprintf(fld->lsf_name, sizeof(fld->lsf_name),
-                 "%s-srv-%s", LUSTRE_FLD_NAME, uuid);
+                 "srv-%s", prefix);
 
         rc = fld_index_init(fld, ctx, dt);
         if (rc)
index 90ab180..0715ba4 100644 (file)
@@ -99,4 +99,6 @@ fld_target_name(struct lu_fld_target *tar)
         return tar->ft_exp->exp_client_uuid.uuid;
 }
 
+extern cfs_proc_dir_entry_t *fld_type_proc_dir;
+
 #endif /* __FLD_INTERNAL_H */
index 9fb6cd0..1d90126 100644 (file)
@@ -212,7 +212,7 @@ static int fld_client_proc_init(struct lu_client_fld *fld)
         ENTRY;
 
         fld->lcf_proc_dir = lprocfs_register(fld->lcf_name,
-                                             proc_lustre_root,
+                                             fld_type_proc_dir,
                                              NULL, NULL);
 
         if (IS_ERR(fld->lcf_proc_dir)) {
@@ -290,7 +290,7 @@ int fld_client_init(struct lu_client_fld *fld,
         INIT_LIST_HEAD(&fld->lcf_targets);
 
         snprintf(fld->lcf_name, sizeof(fld->lcf_name),
-                 "%s-cli-%s", LUSTRE_FLD_NAME, prefix);
+                 "cli-%s", prefix);
 
 #ifdef __KERNEL__
         cache_size = FLD_CACHE_SIZE /
index 43469ee..f6de9bb 100644 (file)
@@ -139,7 +139,7 @@ int fld_query(struct com_thread_info *info);
 /* Server methods */
 int fld_server_init(struct lu_server_fld *fld,
                     struct dt_device *dt,
-                    const char *uuid,
+                    const char *prefix,
                     const struct lu_context *ctx);
 
 void fld_server_fini(struct lu_server_fld *fld,
index 8a420b8..9bd4053 100644 (file)
@@ -1109,8 +1109,8 @@ static struct ldlm_callback_suite cbs = {
 
 static int mdt_enqueue(struct mdt_thread_info *info)
 {
-        int rc;
         struct ptlrpc_request *req;
+        int rc;
 
         /*
          * info->mti_dlm_req already contains swapped and (if necessary)
@@ -1118,10 +1118,15 @@ static int mdt_enqueue(struct mdt_thread_info *info)
          */
         LASSERT(info->mti_dlm_req != NULL);
 
+        if (OBD_FAIL_CHECK_ONCE(OBD_FAIL_LDLM_ENQUEUE)) {
+                info->mti_fail_id = OBD_FAIL_LDLM_ENQUEUE;
+                return 0;
+        }
+
         req = mdt_info_req(info);
-        info->mti_fail_id = OBD_FAIL_LDLM_REPLY;
         rc = ldlm_handle_enqueue0(info->mti_mdt->mdt_namespace,
-                                      req, info->mti_dlm_req, &cbs);
+                                  req, info->mti_dlm_req, &cbs);
+        info->mti_fail_id = OBD_FAIL_LDLM_REPLY;
         return rc ? : req->rq_status;
 }
 
@@ -1451,9 +1456,10 @@ static int mdt_req_handle(struct mdt_thread_info *info,
                  * Set to info->mti_fail_id to handler fail_id, it will be used
                  * later, and better than use default fail_id.
                  */
-                info->mti_fail_id = h->mh_fail_id;
-                if (OBD_FAIL_CHECK(h->mh_fail_id))
+                if (OBD_FAIL_CHECK(h->mh_fail_id)) {
+                        info->mti_fail_id = h->mh_fail_id;
                         RETURN(0);
+                }
         }
 
         rc = 0;
@@ -1510,10 +1516,9 @@ static int mdt_req_handle(struct mdt_thread_info *info,
         }
 
         /* If we're DISCONNECTing, the mdt_export_data is already freed */
-
-        if (rc == 0 && h->mh_opc != MDS_DISCONNECT) {
+        if (rc == 0 && h->mh_opc != MDS_DISCONNECT)
                 target_committed_to_req(req);
-        }
+        
         RETURN(rc);
 }
 
index e1d16a1..7838193 100644 (file)
@@ -36,7 +36,6 @@
 
 #include "mdt_internal.h"
 
-
 static int mdt_md_create(struct mdt_thread_info *info)
 {
         struct mdt_device      *mdt = info->mti_mdt;
index aa4c6e1..d82df92 100755 (executable)
@@ -62,13 +62,13 @@ run_test 0b "ensure object created after recover exists. (3284)"
 
 seq_set_width()
 {
-    local fn=`ls /proc/fs/lustre/seq-cli-srv*/seq_width` 
+    local fn=`ls /proc/fs/lustre/seq/cli-srv*/seq_width` 
     echo $1 > $fn
 }
 
 seq_get_width()
 {
-    local fn=`ls /proc/fs/lustre/seq-cli-srv*/seq_width` 
+    local fn=`ls /proc/fs/lustre/seq/cli-srv*/seq_width` 
     cat $fn
 }