Whamcloud - gitweb
b=13299
authorkomaln <komaln>
Tue, 20 Nov 2007 15:32:28 +0000 (15:32 +0000)
committerkomaln <komaln>
Tue, 20 Nov 2007 15:32:28 +0000 (15:32 +0000)
r=Nathan, Adilger, Wangdi

To change /proc/fs/lustre/devices to reflect active/inactive state

lustre/include/obd.h
lustre/lov/lov_obd.c
lustre/obdclass/linux/linux-module.c

index 4c40002..0950330 100644 (file)
@@ -847,7 +847,9 @@ struct obd_device {
                      obd_force:1,         /* cleanup with > 0 obd refcount */
                      obd_fail:1,          /* cleanup with failover */
                      obd_async_recov:1,   /* allow asyncronous orphan cleanup */
-                     obd_no_conn:1;       /* deny new connections */
+                     obd_no_conn:1,       /* deny new connections */
+                     obd_inactive:1;      /* device active/inactive
+                                           * (for /proc/status only!!) */
         /* uuid-export hash body */
         struct lustre_class_hash_body *obd_uuid_hash_body;
         /* nid-export hash body */
index 457dd7e..7fb2f21 100644 (file)
@@ -97,6 +97,7 @@ static int lov_connect_obd(struct obd_device *obd, __u32 index, int activate,
         struct obd_uuid lov_osc_uuid = { "LOV_OSC_UUID" };
         struct lustre_handle conn = {0, };
         struct obd_import *imp;
+
 #ifdef __KERNEL__
         cfs_proc_dir_entry_t *lov_proc_dir;
 #endif
@@ -170,6 +171,7 @@ static int lov_connect_obd(struct obd_device *obd, __u32 index, int activate,
         if (activate) {
                 lov->lov_tgts[index]->ltd_active = 1;
                 lov->desc.ld_active_tgt_count++;
+                lov->lov_tgts[index]->ltd_exp->exp_obd->obd_inactive = 0;
         }
         CDEBUG(D_CONFIG, "Connected tgt idx %d %s (%s) %sactive\n", index,
                obd_uuid2str(&tgt_uuid), tgt_obd->obd_name, activate ? "":"in");
@@ -254,6 +256,7 @@ static int lov_disconnect_obd(struct obd_device *obd, __u32 index)
         struct obd_device *osc_obd =
                 class_exp2obd(lov->lov_tgts[index]->ltd_exp);
         int rc;
+
         ENTRY;
 
         CDEBUG(D_CONFIG, "%s: disconnecting target %s\n",
@@ -262,6 +265,7 @@ static int lov_disconnect_obd(struct obd_device *obd, __u32 index)
         if (lov->lov_tgts[index]->ltd_active) {
                 lov->lov_tgts[index]->ltd_active = 0;
                 lov->desc.ld_active_tgt_count--;
+                lov->lov_tgts[index]->ltd_exp->exp_obd->obd_inactive = 1;
         }
 
         lov_proc_dir = lprocfs_srch(obd->obd_proc_entry, "target_obds");
@@ -383,10 +387,14 @@ static int lov_set_osc_active(struct obd_device *obd, struct obd_uuid *uuid,
                activate ? "" : "in");
 
         lov->lov_tgts[i]->ltd_active = activate;
-        if (activate)
+
+        if (activate) {
                 lov->desc.ld_active_tgt_count++;
-        else
+                lov->lov_tgts[i]->ltd_exp->exp_obd->obd_inactive = 0;
+        } else {
                 lov->desc.ld_active_tgt_count--;
+                lov->lov_tgts[i]->ltd_exp->exp_obd->obd_inactive = 1;
+        }
         /* remove any old qos penalty */
         lov->lov_tgts[i]->ltd_qos.ltq_penalty = 0;
 
index 4fd43af..3e08cd2 100644 (file)
@@ -356,6 +356,8 @@ static int obd_device_list_seq_show(struct seq_file *p, void *v)
         LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC);
         if (obd->obd_stopping)
                 status = "ST";
+        else if (obd->obd_inactive)
+                status = "IN";
         else if (obd->obd_set_up)
                 status = "UP";
         else if (obd->obd_attached)