Whamcloud - gitweb
- landing b_fid.
[fs/lustre-release.git] / lustre / lov / lov_obd.c
index fb34c8b..4f291df 100644 (file)
@@ -118,12 +118,15 @@ static void lov_llh_destroy(struct lov_lock_handles *llh)
 static int lov_connect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt,
                            int activate, unsigned long connect_flags)
 {
-        struct lov_obd *lov = &obd->u.lov;
-        struct obd_uuid *tgt_uuid = &tgt->uuid;
-        struct obd_device *tgt_obd;
         struct obd_uuid lov_osc_uuid = { "LOV_OSC_UUID" };
-        struct lustre_handle conn = {0, };
+        struct obd_uuid *tgt_uuid = &tgt->uuid;
+
+#ifdef __KERNEL__
         struct proc_dir_entry *lov_proc_dir;
+#endif
+        struct lov_obd *lov = &obd->u.lov;
+        struct lustre_handle conn = {0, };
+        struct obd_device *tgt_obd;
         int rc;
         ENTRY;
 
@@ -176,6 +179,7 @@ static int lov_connect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt,
         tgt->active = 1;
         lov->desc.ld_active_tgt_count++;
 
+#ifdef __KERNEL__
         lov_proc_dir = lprocfs_srch(obd->obd_proc_entry, "target_obds");
         if (lov_proc_dir) {
                 struct obd_device *osc_obd = class_conn2obd(&conn);
@@ -200,6 +204,7 @@ static int lov_connect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt,
                         lov_proc_dir = NULL;
                 }
         }
+#endif
 
         RETURN(0);
 }
@@ -207,10 +212,12 @@ static int lov_connect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt,
 static int lov_connect(struct lustre_handle *conn, struct obd_device *obd,
                        struct obd_uuid *cluuid, unsigned long connect_flags)
 {
+#ifdef __KERNEL__
+        struct proc_dir_entry *lov_proc_dir;
+#endif
         struct lov_obd *lov = &obd->u.lov;
         struct lov_tgt_desc *tgt;
         struct obd_export *exp;
-        struct proc_dir_entry *lov_proc_dir;
         int rc, rc2, i;
         ENTRY;
 
@@ -228,6 +235,7 @@ static int lov_connect(struct lustre_handle *conn, struct obd_device *obd,
                 RETURN(0);
         }
 
+#ifdef __KERNEL__
         lov_proc_dir = lprocfs_register("target_obds", obd->obd_proc_entry,
                                         NULL, NULL);
         if (IS_ERR(lov_proc_dir)) {
@@ -235,6 +243,7 @@ static int lov_connect(struct lustre_handle *conn, struct obd_device *obd,
                        obd->obd_type->typ_name, obd->obd_name);
                 lov_proc_dir = NULL;
         }
+#endif
 
         /* connect_flags is the MDS number, save for use in lov_add_obd */
         lov->lov_connect_flags = connect_flags;
@@ -250,8 +259,10 @@ static int lov_connect(struct lustre_handle *conn, struct obd_device *obd,
         RETURN (0);
 
  out_disc:
+#ifdef __KERNEL__
         if (lov_proc_dir)
                 lprocfs_remove(lov_proc_dir);
+#endif
 
         while (i-- > 0) {
                 struct obd_uuid uuid;
@@ -272,12 +283,15 @@ static int lov_connect(struct lustre_handle *conn, struct obd_device *obd,
 static int lov_disconnect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt,
                               int flags)
 {
+#ifdef __KERNEL__
         struct proc_dir_entry *lov_proc_dir;
+#endif
         struct obd_device *osc_obd = class_exp2obd(tgt->ltd_exp);
         struct lov_obd *lov = &obd->u.lov;
         int rc;
         ENTRY;
 
+#ifdef __KERNEL__
         lov_proc_dir = lprocfs_srch(obd->obd_proc_entry, "target_obds");
         if (lov_proc_dir) {
                 struct proc_dir_entry *osc_symlink;
@@ -291,7 +305,8 @@ static int lov_disconnect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt,
                                osc_obd->obd_name);
                 }
         }
-
+#endif
+        
         if (obd->obd_no_recov) {
                 /* Pass it on to our clients.
                  * XXX This should be an argument to disconnect,
@@ -302,7 +317,6 @@ static int lov_disconnect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt,
         }
 
         obd_register_observer(tgt->ltd_exp->exp_obd, NULL);
-
         rc = obd_disconnect(tgt->ltd_exp, flags);
         if (rc) {
                 if (tgt->active) {
@@ -324,9 +338,11 @@ static int lov_disconnect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt,
 static int lov_disconnect(struct obd_export *exp, int flags)
 {
         struct obd_device *obd = class_exp2obd(exp);
+#ifdef __KERNEL__
+        struct proc_dir_entry *lov_proc_dir;
+#endif
         struct lov_obd *lov = &obd->u.lov;
         struct lov_tgt_desc *tgt;
-        struct proc_dir_entry *lov_proc_dir;
         int rc, i;
         ENTRY;
 
@@ -342,6 +358,8 @@ static int lov_disconnect(struct obd_export *exp, int flags)
                 if (tgt->ltd_exp)
                         lov_disconnect_obd(obd, tgt, flags);
         }
+
+#ifdef __KERNEL__
         lov_proc_dir = lprocfs_srch(obd->obd_proc_entry, "target_obds");
         if (lov_proc_dir) {
                 lprocfs_remove(lov_proc_dir);
@@ -349,7 +367,7 @@ static int lov_disconnect(struct obd_export *exp, int flags)
                 CERROR("/proc/fs/lustre/%s/%s/target_obds missing.",
                        obd->obd_type->typ_name, obd->obd_name);
         }
-
+#endif
 
  out_local:
         rc = class_disconnect(exp, 0);