Whamcloud - gitweb
b=15899
authornathan <nathan>
Fri, 22 Aug 2008 17:40:52 +0000 (17:40 +0000)
committernathan <nathan>
Fri, 22 Aug 2008 17:40:52 +0000 (17:40 +0000)
i=nathan
i=adilger
add OST pools

lustre/obdclass/lprocfs_status.c

index e06b8e8..ff78f14 100644 (file)
@@ -111,28 +111,34 @@ static int lprocfs_obd_snprintf(char **page, int end, int *len,
         return n;
 }
 
-int lprocfs_add_simple(struct proc_dir_entry *root, char *name,
-                       read_proc_t *read_proc, write_proc_t *write_proc,
-                       void *data)
-{
-        struct proc_dir_entry *proc;
+cfs_proc_dir_entry_t *lprocfs_add_simple(struct proc_dir_entry *root,
+                                        char *name,
+                                        read_proc_t *read_proc,
+                                        write_proc_t *write_proc,
+                                        void *data,
+                                        struct file_operations *fops)
+{
+        cfs_proc_dir_entry_t *proc;
         mode_t mode = 0;
 
         if (root == NULL || name == NULL)
-                return -EINVAL;
+                return ERR_PTR(-EINVAL);
         if (read_proc)
                 mode = 0444;
         if (write_proc)
                 mode |= 0200;
+        if (fops)
+                mode = 0644;
         proc = create_proc_entry(name, mode, root);
         if (!proc) {
                 CERROR("LprocFS: No memory to create /proc entry %s", name);
-                return -ENOMEM;
+                return ERR_PTR(-ENOMEM);
         }
         proc->read_proc = read_proc;
         proc->write_proc = write_proc;
         proc->data = data;
-        return 0;
+        proc->proc_fops = fops;
+        return proc;
 }
 
 
@@ -658,6 +664,7 @@ int lprocfs_rd_timeouts(char *page, char **start, off_t off, int count,
         return rc;
 }
 
+/* see OBD_CONNECT_* */
 static const char *obd_connect_names[] = {
         "read_only",
         "lov_index",
@@ -691,6 +698,7 @@ static const char *obd_connect_names[] = {
         "alt_checksum_algorithm",
         "fid_is_enabled",
         "version_recovery",
+        "pools",
         NULL
 };
 
@@ -1171,6 +1179,10 @@ void lprocfs_init_ops_stats(int num_private_stats, struct lprocfs_stats *stats)
         LPROCFS_OBD_OP_INIT(num_private_stats,stats,unregister_page_removal_cb);
         LPROCFS_OBD_OP_INIT(num_private_stats, stats, register_lock_cancel_cb);
         LPROCFS_OBD_OP_INIT(num_private_stats, stats,unregister_lock_cancel_cb);
+        LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_new);
+        LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_rem);
+        LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_add);
+        LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_del);
 }
 
 void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats)
@@ -1354,6 +1366,7 @@ int lprocfs_exp_setup(struct obd_export *exp, lnet_nid_t *nid, int *newnid)
         struct nid_stat *tmp, *tmp1;
         struct nid_stat_uuid *cursor, *tmp_ns_uuid;
         struct obd_device *obd;
+        cfs_proc_dir_entry_t *entry;
         ENTRY;
 
         *newnid = 0;
@@ -1444,10 +1457,12 @@ int lprocfs_exp_setup(struct obd_export *exp, lnet_nid_t *nid, int *newnid)
         list_add(&tmp_ns_uuid->ns_uuid_list, &tmp->nid_uuid_list);
         spin_unlock(&obd->obd_nid_lock);
 
-        rc = lprocfs_add_simple(tmp->nid_proc, "uuid",
-                                lprocfs_exp_rd_uuid, NULL, tmp);
-        if (rc)
+        entry = lprocfs_add_simple(tmp->nid_proc, "uuid",
+                                   lprocfs_exp_rd_uuid, NULL, tmp, NULL);
+        if (IS_ERR(entry)) {
                 CWARN("Error adding the uuid file\n");
+                rc = PTR_ERR(entry);
+        }
 
         exp->exp_nid_stats = tmp;
         *newnid = 1;