[Ocfs2-commits] mfasheh commits r2609 - trunk/fs/ocfs2
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Thu Sep 22 16:00:17 CDT 2005
Author: mfasheh
Signed-off-by: jlbec
Date: 2005-09-22 16:00:15 -0500 (Thu, 22 Sep 2005)
New Revision: 2609
Removed:
trunk/fs/ocfs2/proc.c
trunk/fs/ocfs2/proc.h
Modified:
trunk/fs/ocfs2/Makefile
trunk/fs/ocfs2/super.c
Log:
* Remove the ocfs2 proc code. All of this is either redundant, not useful
anymore, or needs to go into ocfs2_nodemanager, so we should clean
it up before moving to sysfs.
Signed-off-by: jlbec
Modified: trunk/fs/ocfs2/Makefile
===================================================================
--- trunk/fs/ocfs2/Makefile 2005-09-22 20:45:54 UTC (rev 2608)
+++ trunk/fs/ocfs2/Makefile 2005-09-22 21:00:15 UTC (rev 2609)
@@ -56,7 +56,6 @@
localalloc.c \
mmap.c \
namei.c \
- proc.c \
slot_map.c \
suballoc.c \
super.c \
@@ -87,7 +86,6 @@
localalloc.h \
mmap.h \
namei.h \
- proc.h \
slot_map.h \
suballoc.h \
super.h \
Deleted: trunk/fs/ocfs2/proc.c
===================================================================
--- trunk/fs/ocfs2/proc.c 2005-09-22 20:45:54 UTC (rev 2608)
+++ trunk/fs/ocfs2/proc.c 2005-09-22 21:00:15 UTC (rev 2609)
@@ -1,461 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; -*-
- * vim: noexpandtab sw=8 ts=8 sts=0:
- *
- * proc.c
- *
- * proc interface
- *
- * Copyright (C) 2002, 2004 Oracle. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 021110-1307, USA.
- */
-
-#include <linux/fs.h>
-#include <linux/types.h>
-#include <linux/slab.h>
-#include <linux/proc_fs.h>
-#include <linux/socket.h>
-
-#define MLOG_MASK_PREFIX ML_SUPER
-#include <cluster/masklog.h>
-
-#include "ocfs2.h"
-
-#include "proc.h"
-#include "alloc.h"
-#include "heartbeat.h"
-#include "inode.h"
-#include "journal.h"
-#include "ver.h"
-
-#define OCFS2_PROC_BASENAME "fs/ocfs2"
-
-static struct proc_dir_entry *ocfs2_proc_root_dir = NULL; /* points to /proc/fs/ocfs2 */
-
-static int ocfs2_proc_version(char *page,
- char **start,
- off_t off,
- int count,
- int *eof,
- void *data);
-static int ocfs2_proc_nodenum(char *page,
- char **start,
- off_t off,
- int count,
- int *eof,
- void *data);
-static int ocfs2_proc_slotnum(char *page,
- char **start,
- off_t off,
- int count,
- int *eof,
- void *data);
-static int ocfs2_proc_nodename(char *page,
- char **start,
- off_t off,
- int count,
- int *eof,
- void *data);
-static int ocfs2_proc_uuid(char *page,
- char **start,
- off_t off,
- int count,
- int *eof,
- void *data);
-static int ocfs2_proc_statistics(char *page,
- char **start,
- off_t off,
- int count,
- int *eof,
- void *data);
-static int ocfs2_proc_device(char *page,
- char **start,
- off_t off,
- int count,
- int *eof,
- void *data);
-static int ocfs2_proc_nodes(char *page,
- char **start,
- off_t off,
- int count,
- int *eof,
- void *data);
-static int ocfs2_proc_alloc_stat(char *page,
- char **start,
- off_t off,
- int count,
- int *eof,
- void *data);
-static int ocfs2_proc_label(char *page,
- char **start,
- off_t off,
- int count,
- int *eof,
- void *data);
-
-typedef struct _ocfs2_proc_list
-{
- char *name;
- char *data;
- int (*read_proc) (char *, char **, off_t, int, int *, void *);
- write_proc_t *write_proc;
- mode_t mode;
-} ocfs2_proc_list;
-
-static ocfs2_proc_list top_dir[] = {
- { "version", NULL, ocfs2_proc_version, NULL, S_IFREG | S_IRUGO, },
- { "nodename", NULL, ocfs2_proc_nodename, NULL, S_IFREG | S_IRUGO, },
- { NULL }
-};
-
-static ocfs2_proc_list sub_dir[] = {
- { "nodenum", NULL, ocfs2_proc_nodenum, NULL, S_IFREG | S_IRUGO, },
- { "uuid", NULL, ocfs2_proc_uuid, NULL, S_IFREG | S_IRUGO, },
- { "slotnum", NULL, ocfs2_proc_slotnum, NULL, S_IFREG | S_IRUGO, },
- { "statistics", NULL, ocfs2_proc_statistics, NULL, S_IFREG | S_IRUGO, },
- { "device", NULL, ocfs2_proc_device, NULL, S_IFREG | S_IRUGO, },
- { "nodes", NULL, ocfs2_proc_nodes, NULL, S_IFREG | S_IRUGO, },
- { "allocstat", NULL, ocfs2_proc_alloc_stat, NULL, S_IFREG | S_IRUGO, },
- { "label", NULL, ocfs2_proc_label, NULL, S_IFREG | S_IRUGO, },
- { NULL }
-};
-
-int ocfs2_proc_init(void)
-{
- struct proc_dir_entry *parent = NULL;
- ocfs2_proc_list *p;
- struct proc_dir_entry* entry;
-
- mlog_entry_void();
-
- parent = proc_mkdir(OCFS2_PROC_BASENAME, NULL);
- if (parent) {
- ocfs2_proc_root_dir = parent;
- for (p = top_dir; p->name; p++) {
- entry = create_proc_read_entry(p->name, p->mode,
- parent, p->read_proc,
- p->data);
- if (!entry)
- return -EINVAL;
- if (p->write_proc)
- entry->write_proc = p->write_proc;
-
- entry->owner = THIS_MODULE;
- }
- }
-
- mlog_exit_void();
- return 0;
-}
-
-void ocfs2_proc_deinit(void)
-{
- struct proc_dir_entry *parent = ocfs2_proc_root_dir;
- ocfs2_proc_list *p;
-
- mlog_entry_void();
-
- if (parent) {
- for (p = top_dir; p->name; p++)
- remove_proc_entry(p->name, parent);
- remove_proc_entry(OCFS2_PROC_BASENAME, NULL);
- }
-
- mlog_exit_void();
-}
-
-static int ocfs2_proc_calc_metrics(char *page, char **start, off_t off,
- int count, int *eof, int len)
-{
- mlog_entry_void();
-
- if (len <= off + count)
- *eof = 1;
-
- *start = page + off;
-
- len -= off;
-
- if (len > count)
- len = count;
-
- if (len < 0)
- len = 0;
-
- mlog_exit_void();
- return len;
-}
-
-static int ocfs2_proc_alloc_stat(char *page, char **start, off_t off,
- int count, int *eof, void *data)
-{
- int len, ret;
- char *la_state;
- ocfs2_super *osb = data;
-
- mlog_entry_void();
-
-#define ALLOC_STATS_HDR "%-25s %10u\n"
-
- len = sprintf(page, "%s\n", "*** Disk Allocation Stats ***");
-
- if (osb->local_alloc_state == OCFS2_LA_ENABLED)
- la_state = "enabled";
- else if (osb->local_alloc_state == OCFS2_LA_DISABLED)
- la_state = "disabled";
- else
- la_state = "unused";
-
- len += sprintf(page + len, "%-25s %10s\n", "Local Alloc", la_state);
- len += sprintf(page + len, ALLOC_STATS_HDR, "Window Moves",
- atomic_read(&osb->alloc_stats.moves));
- len += sprintf(page + len, ALLOC_STATS_HDR, "Local Allocs",
- atomic_read(&osb->alloc_stats.local_data));
- len += sprintf(page + len, ALLOC_STATS_HDR, "Bitmap Allocs",
- atomic_read(&osb->alloc_stats.bitmap_data));
- len += sprintf(page + len, ALLOC_STATS_HDR, "Block Group Allocs",
- atomic_read(&osb->alloc_stats.bg_allocs));
- len += sprintf(page + len, ALLOC_STATS_HDR, "Block Group Adds",
- atomic_read(&osb->alloc_stats.bg_extends));
-
- ret = ocfs2_proc_calc_metrics(page, start, off, count, eof, len);
-
- mlog_exit(ret);
-
- return ret;
-}
-
-static int ocfs2_proc_version(char *page, char **start, off_t off,
- int count, int *eof, void *data)
-{
- int len;
- int ret;
-
- mlog_entry_void();
-
- len = ocfs2_str_version(page);
- ret = ocfs2_proc_calc_metrics(page, start, off, count, eof, len);
-
- mlog_exit(ret);
- return ret;
-}
-
-static int ocfs2_proc_nodenum(char *page, char **start, off_t off,
- int count, int *eof, void *data)
-{
- int len;
- int ret;
- ocfs2_super *osb = data;
-
- mlog_entry_void();
-
- len = sprintf(page, "%d\n", osb->node_num);
- ret = ocfs2_proc_calc_metrics(page, start, off, count, eof, len);
-
- mlog_exit(ret);
- return ret;
-}
-
-static int ocfs2_proc_slotnum(char *page, char **start, off_t off,
- int count, int *eof, void *data)
-{
- int len;
- int ret;
- ocfs2_super *osb = data;
-
- mlog_entry_void();
-
- len = sprintf(page, "%d\n", osb->slot_num);
- ret = ocfs2_proc_calc_metrics(page, start, off, count, eof, len);
-
- mlog_exit(ret);
- return ret;
-}
-
-static int ocfs2_proc_nodename(char *page, char **start, off_t off,
- int count, int *eof, void *data)
-{
- int len;
- int ret;
- struct o2nm_node *node;
-
- mlog_entry_void();
-
- node = o2nm_get_node_by_num(o2nm_this_node());
-
- if (node) {
- len = sprintf(page, "%s\n", node->nd_name);
- o2nm_node_put(node);
- } else
- len = sprintf(page, "(unknown)\n");
-
- ret = ocfs2_proc_calc_metrics(page, start, off, count, eof, len);
-
- mlog_exit(ret);
- return ret;
-}
-
-void ocfs2_proc_add_volume(ocfs2_super * osb)
-{
- char newdir[20];
- struct proc_dir_entry *parent = NULL;
- struct proc_dir_entry* entry;
- ocfs2_proc_list *p;
-
- mlog_entry_void();
-
- snprintf(newdir, sizeof(newdir), "%u_%u",
- MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev));
- parent = proc_mkdir(newdir, ocfs2_proc_root_dir);
- osb->proc_sub_dir = parent;
-
- if (!parent) {
- mlog_exit_void();
- return;
- }
-
- for (p = sub_dir; p->name; p++) {
- /* XXX: What do we do if
- * create_proc_read_entry fails?! */
- entry = create_proc_read_entry(p->name, p->mode,
- parent, p->read_proc,
- (char *)osb);
- if (entry) {
- if (p->write_proc)
- entry->write_proc = p->write_proc;
-
- entry->owner = THIS_MODULE;
- }
- }
-
- mlog_exit_void();
-}
-
-void ocfs2_proc_remove_volume(ocfs2_super * osb)
-{
- ocfs2_proc_list *p;
- char dir[20];
-
- mlog_entry_void();
-
- if (osb->proc_sub_dir) {
- for (p = sub_dir; p->name; p++)
- remove_proc_entry(p->name, osb->proc_sub_dir);
-
- snprintf(dir, sizeof(dir), "%u_%u",
- MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev));
- remove_proc_entry(dir, ocfs2_proc_root_dir);
- }
-
- mlog_exit_void();
-}
-
-static int ocfs2_proc_uuid(char *page, char **start, off_t off,
- int count, int *eof, void *data)
-{
- int len, ret;
- ocfs2_super *osb = data;
-
- mlog_entry_void();
-
- len = sprintf(page, "%s\n", osb->uuid_str);
- ret = ocfs2_proc_calc_metrics(page, start, off, count, eof, len);
-
- mlog_exit(ret);
- return ret;
-}
-
-static int ocfs2_proc_statistics(char *page, char **start, off_t off,
- int count, int *eof, void *data)
-{
- int len;
- int ret = 0;
- ocfs2_super *osb = data;
-
- mlog_entry_void();
-
-#define PROC_STATS \
- "Number of nodes : %u\n" \
- "Cluster size : %d\n" \
- "Volume size : %"MLFu64"\n" \
- "Open Transactions: : %u\n"
-
- len = sprintf(page, PROC_STATS, osb->num_nodes, osb->s_clustersize,
- ocfs2_clusters_to_bytes(osb->sb, osb->num_clusters),
- atomic_read(&osb->journal->j_num_trans));
-
- ret = ocfs2_proc_calc_metrics(page, start, off, count, eof, len);
-
- mlog_exit(ret);
- return ret;
-}
-
-static int ocfs2_proc_device(char *page, char **start, off_t off,
- int count, int *eof, void *data)
-{
- int len;
- int ret;
- ocfs2_super *osb = data;
-
- mlog_entry_void();
-
- len = snprintf(page, sizeof(osb->dev_str), "%s\n", osb->dev_str);
- ret = ocfs2_proc_calc_metrics(page, start, off, count, eof, len);
-
- mlog_exit(ret);
- return ret;
-}
-
-static int ocfs2_proc_nodes(char *page, char **start, off_t off,
- int count, int *eof, void *data)
-{
- int len = 0;
- int i;
- int ret;
- ocfs2_super *osb = data;
- char mount;
-
- mlog_entry_void();
-
- if (osb) {
- for (i = 0; i < OCFS2_NODE_MAP_MAX_NODES; i++) {
- mount = ocfs2_node_map_test_bit(osb, &osb->mounted_map, i) ? 'M' : ' ';
- len += sprintf(page + len, "%2d %c\n", i, mount);
- }
- }
-
- ret = ocfs2_proc_calc_metrics(page, start, off, count, eof, len);
-
- mlog_exit(ret);
- return ret;
-}
-
-static int ocfs2_proc_label(char *page, char **start, off_t off,
- int count, int *eof, void *data)
-{
- int len;
- int ret;
- ocfs2_super *osb = data;
-
- mlog_entry_void();
-
- len = sprintf(page, "%s\n", osb->vol_label);
- ret = ocfs2_proc_calc_metrics(page, start, off, count, eof, len);
-
- mlog_exit(ret);
- return ret;
-}
-
Deleted: trunk/fs/ocfs2/proc.h
===================================================================
--- trunk/fs/ocfs2/proc.h 2005-09-22 20:45:54 UTC (rev 2608)
+++ trunk/fs/ocfs2/proc.h 2005-09-22 21:00:15 UTC (rev 2609)
@@ -1,34 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; -*-
- * vim: noexpandtab sw=8 ts=8 sts=0:
- *
- * proc.h
- *
- * Function prototypes
- *
- * Copyright (C) 2002, 2004 Oracle. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 021110-1307, USA.
- */
-
-#ifndef OCFS2_PROC_H
-#define OCFS2_PROC_H
-
-void ocfs2_proc_add_volume(ocfs2_super *osb);
-void ocfs2_proc_deinit(void);
-int ocfs2_proc_init(void);
-void ocfs2_proc_remove_volume(ocfs2_super *osb);
-
-#endif /* OCFS2_PROC_H */
Modified: trunk/fs/ocfs2/super.c
===================================================================
--- trunk/fs/ocfs2/super.c 2005-09-22 20:45:54 UTC (rev 2608)
+++ trunk/fs/ocfs2/super.c 2005-09-22 21:00:15 UTC (rev 2609)
@@ -59,7 +59,6 @@
#include "journal.h"
#include "localalloc.h"
#include "namei.h"
-#include "proc.h"
#include "slot_map.h"
#include "super.h"
#include "sysfile.h"
@@ -792,9 +791,6 @@
osb_id = 0;
spin_unlock(&ocfs2_globals_lock);
- /* Initialize the proc interface */
- ocfs2_proc_init();
-
leave:
if (status < 0) {
ocfs2_free_mem_caches();
@@ -821,9 +817,6 @@
ocfs2_free_mem_caches();
- /* Deinit the proc interface */
- ocfs2_proc_deinit();
-
unregister_filesystem(&ocfs2_fs_type);
exit_ocfs2_extent_maps();
@@ -1024,7 +1017,7 @@
mlog_entry_void();
if (ocfs2_is_hard_readonly(osb))
- goto out_add_proc;
+ goto leave;
status = ocfs2_fill_local_node_info(osb);
if (status < 0) {
@@ -1095,10 +1088,6 @@
if (status < 0)
mlog_errno(status);
-out_add_proc:
- /* Add proc entry for this volume */
- ocfs2_proc_add_volume(osb);
-
leave:
if (unlock_super)
ocfs2_super_unlock(osb, 1);
@@ -1149,9 +1138,6 @@
ocfs2_sync_blockdev(sb);
- /* Remove the proc element for this volume */
- ocfs2_proc_remove_volume(osb);
-
/* No dlm means we've failed during mount, so skip all the
* steps which depended on that to complete. */
if (osb->dlm) {
More information about the Ocfs2-commits
mailing list