[Ocfs2-commits] zab commits r2013 - trunk/fs/ocfs2

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Fri Mar 18 17:55:56 CST 2005


Author: zab
Signed-off-by: mfasheh
Date: 2005-03-18 17:55:55 -0600 (Fri, 18 Mar 2005)
New Revision: 2013

Removed:
   trunk/fs/ocfs2/ioctl.c
   trunk/fs/ocfs2/ioctl.h
Modified:
   trunk/fs/ocfs2/Makefile
   trunk/fs/ocfs2/aio.c
   trunk/fs/ocfs2/file.c
   trunk/fs/ocfs2/ocfs.h
   trunk/fs/ocfs2/proc.c
   trunk/fs/ocfs2/super.c
Log:
o don't store a hostname on insmod
o look for our node num on mount to make sure the cluster is configed
o get rid of unused ocfs_ioctl

Signed-off-by: mfasheh


Modified: trunk/fs/ocfs2/Makefile
===================================================================
--- trunk/fs/ocfs2/Makefile	2005-03-18 23:39:23 UTC (rev 2012)
+++ trunk/fs/ocfs2/Makefile	2005-03-18 23:55:55 UTC (rev 2013)
@@ -70,7 +70,6 @@
 	file.c 			\
 	heartbeat.c 		\
 	inode.c 		\
-	ioctl.c 		\
 	journal.c 		\
 	localalloc.c 		\
 	mmap.c 			\
@@ -104,7 +103,6 @@
 	file.h			\
 	heartbeat.h		\
 	inode.h			\
-	ioctl.h			\
 	journal.h		\
 	localalloc.h		\
 	mmap.h			\

Modified: trunk/fs/ocfs2/aio.c
===================================================================
--- trunk/fs/ocfs2/aio.c	2005-03-18 23:39:23 UTC (rev 2012)
+++ trunk/fs/ocfs2/aio.c	2005-03-18 23:55:55 UTC (rev 2013)
@@ -45,7 +45,6 @@
 #include "file.h"
 #include "sysfile.h"
 #include "inode.h"
-#include "ioctl.h"
 #include "mmap.h"
 #include "suballoc.h"
 #include "util.h"

Modified: trunk/fs/ocfs2/file.c
===================================================================
--- trunk/fs/ocfs2/file.c	2005-03-18 23:39:23 UTC (rev 2012)
+++ trunk/fs/ocfs2/file.c	2005-03-18 23:55:55 UTC (rev 2013)
@@ -46,7 +46,6 @@
 #include "file.h"
 #include "sysfile.h"
 #include "inode.h"
-#include "ioctl.h"
 #include "mmap.h"
 #include "suballoc.h"
 #include "util.h"
@@ -400,7 +399,6 @@
 	.fsync = ocfs_sync_file,
 	.release = ocfs_file_release,
 	.open = ocfs_file_open,
-	.ioctl = ocfs_ioctl,
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 	.aio_read = ocfs2_file_aio_read,
 	.aio_write = ocfs2_file_aio_write,
@@ -414,7 +412,6 @@
 	.read = generic_read_dir,
 	.readdir = ocfs_readdir,
 	.fsync = ocfs_sync_file,
-	.ioctl = ocfs_ioctl
 };
 
 int ocfs_set_inode_size(ocfs_journal_handle *handle,

Deleted: trunk/fs/ocfs2/ioctl.c
===================================================================
--- trunk/fs/ocfs2/ioctl.c	2005-03-18 23:39:23 UTC (rev 2012)
+++ trunk/fs/ocfs2/ioctl.c	2005-03-18 23:55:55 UTC (rev 2013)
@@ -1,83 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; -*-
- * vim: noexpandtab sw=8 ts=8 sts=0:
- *
- * ioctl.c
- *
- * ioctl 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 "ocfs_compat.h"
-
-#include <linux/fs.h>
-#include <linux/types.h>
-#include <linux/slab.h>
-
-#include <asm/uaccess.h>
-
-#include "ocfs_log.h"
-#include "ocfs.h"
-
-#include "ioctl.h"
-
-/* Tracing */
-#define OCFS_DEBUG_CONTEXT      OCFS_DEBUG_CONTEXT_IOCTL
-
-/*
- * ocfs_ioctl()
- *
- * To be fixed.
- */
-int ocfs_ioctl (struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg)
-{
-	struct ocfs_ioc data;
-	extern char *ocfs_version;
-	int ret = 0;
-
-	LOG_SET_CONTEXT(IOCTL);
-
-	LOG_ENTRY_ARGS ("(0x%p, 0x%p, %u, %lu)\n", inode, filp, cmd, arg);
-
-	if (_IOC_TYPE (cmd) != OCFS_IOC_MAGIC) {
-		ret = -ENOTTY;
-		goto exit_ioctl;
-	}
-
-	switch (cmd) {
-	    case OCFS_IOC_GETTYPE:
-		    strncpy (data.name, OCFS_NAME, sizeof (data.name) - 1);
-		    strncpy (data.version, ocfs_version,
-			     sizeof (data.version) - 1);
-		    strncpy (data.nodename, OcfsGlobalCtxt.node_name,
-			     sizeof (data.nodename) - 1);
-		    data.nodenum = 999;	/* TODO */
-		    ret = copy_to_user ((struct ocfs_ioc *) arg, &data,
-					sizeof (struct ocfs_ioc));
-		    break;
-	    default:
-		    ret = -ENOTTY;
-		    break;
-	}
-
-exit_ioctl:
-	LOG_EXIT_INT (ret);
-
-	LOG_CLEAR_CONTEXT();
-	return ret;
-}				/* ocfs_ioctl */

Deleted: trunk/fs/ocfs2/ioctl.h
===================================================================
--- trunk/fs/ocfs2/ioctl.h	2005-03-18 23:39:23 UTC (rev 2012)
+++ trunk/fs/ocfs2/ioctl.h	2005-03-18 23:55:55 UTC (rev 2013)
@@ -1,32 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; -*-
- * vim: noexpandtab sw=8 ts=8 sts=0:
- *
- * ioctl.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_IOCTL_H
-#define OCFS2_IOCTL_H
-
-int ocfs_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
-	       unsigned long arg);
-
-#endif /* OCFS2_IOCTL_H */

Modified: trunk/fs/ocfs2/ocfs.h
===================================================================
--- trunk/fs/ocfs2/ocfs.h	2005-03-18 23:39:23 UTC (rev 2012)
+++ trunk/fs/ocfs2/ocfs.h	2005-03-18 23:55:55 UTC (rev 2013)
@@ -406,7 +406,6 @@
 	kmem_cache_t *inode_cache;
 	kmem_cache_t *lock_cache;
 	u32 flags;
-	char *node_name;		/* human readable node identification */
 	struct proc_dir_entry *proc_root_dir; /* points to /proc/fs/ocfs2 */
 }
 ocfs_global_ctxt;

Modified: trunk/fs/ocfs2/proc.c
===================================================================
--- trunk/fs/ocfs2/proc.c	2005-03-18 23:39:23 UTC (rev 2012)
+++ trunk/fs/ocfs2/proc.c	2005-03-18 23:55:55 UTC (rev 2013)
@@ -276,16 +276,20 @@
 static int ocfs_proc_nodename (char *page, char **start, off_t off,
 			       int count, int *eof, void *data)
 {
-	int len;
 	int ret;
+	struct nm_node *node;
 
 	LOG_ENTRY ();
 
-	strcpy (page, OcfsGlobalCtxt.node_name);
-	strcat (page, "\n");
-	len = strlen (page);
+	node = nm_get_node_by_num(nm_this_node());
+	if (node) {
+		sprintf(page, "%s\n", node->nd_name);
+		nm_node_put(node);
+	} else 
+		strcat (page, "(unknown)\n");
 
-	ret = ocfs_proc_calc_metrics (page, start, off, count, eof, len);
+	ret = ocfs_proc_calc_metrics (page, start, off, count, eof, 
+				      strlen(page));
 
 	LOG_EXIT_INT (ret);
 	return ret;

Modified: trunk/fs/ocfs2/super.c
===================================================================
--- trunk/fs/ocfs2/super.c	2005-03-18 23:39:23 UTC (rev 2012)
+++ trunk/fs/ocfs2/super.c	2005-03-18 23:55:55 UTC (rev 2013)
@@ -129,8 +129,6 @@
 
 
 static int ocfs_parse_options (char *options, u32 * uid, u32 * gid, int * reclaim_id);
-static int __init ocfs_driver_entry (void);
-static void __exit ocfs_driver_exit (void);
 static void ocfs_put_super (struct super_block *sb);
 static int ocfs_mount_volume (struct super_block *sb, int reclaim_id,
 			      struct inode *root);
@@ -307,6 +305,29 @@
 	return status;
 } /* ocfs_release_system_inodes */
 
+static int ocfs2_hb_is_ok(void)
+{
+	unsigned long testing_map[BITS_TO_LONGS(NM_MAX_NODES)];
+	u8 node_num;
+
+	/* if this node was set then we have networking */
+	node_num = nm_this_node();
+	if (node_num == NM_MAX_NODES) {
+		LOG_ERROR_STR("ocfs2: this node has not been configured.");
+		return 0;
+	}
+
+	hb_fill_node_map(testing_map, sizeof(testing_map));
+
+	if (!test_bit(node_num, testing_map)) {
+		LOG_ERROR_ARGS("ocfs2: this node (%u) does not have "
+			      "heartbeating enabled.", node_num);
+		return 0;
+	}
+
+	return 1;
+}
+
 static int ocfs_fill_super(struct super_block *sb, void *data, int silent)
 {
 	struct dentry *root;
@@ -317,6 +338,13 @@
 	int reclaim_id;
 	ocfs_super *osb = NULL;
 
+	/* for now we only have one cluster/node, make sure we see it
+	 * in the heartbeat universe */
+	if (!ocfs2_hb_is_ok()) {
+		status = -EINVAL;
+		goto read_super_error;
+	}
+
 	LOG_ENTRY_ARGS ("%p, %p, %i", sb, data, silent);
 
 	if (ocfs_parse_options (data, &uid, &gid, &reclaim_id) != 0) {
@@ -360,9 +388,9 @@
 
 	sb->s_root = root;
 
-	printk ("ocfs2: Mounting device (%u,%u) on %s (node %d, slot %d)\n",
-		MAJOR(sb->s_dev), MINOR(sb->s_dev),
-		OcfsGlobalCtxt.node_name, osb->node_num, osb->slot_num);
+	printk ("ocfs2: Mounting device (%u,%u) on (node %d, slot %d)\n",
+		MAJOR(sb->s_dev), MINOR(sb->s_dev), osb->node_num,
+		osb->slot_num);
 
 	atomic_set(&osb->vol_state, VOLUME_MOUNTED);
 
@@ -479,12 +507,7 @@
 	return ret;
 }				/* ocfs_parse_options */
 
-/*
- * ocfs_driver_entry()
- *
- * Driver entry point. Called on insmod.
- */
-static int __init ocfs_driver_entry (void)
+static int __init ocfs2_init(void)
 {
 	int status;
 
@@ -506,21 +529,6 @@
 	INIT_LIST_HEAD (&(OcfsGlobalCtxt.osb_next));
 	INIT_LIST_HEAD (&(OcfsGlobalCtxt.osb_next));
 
-	/* Ok, just use utsname for now. Eventually we need to
-	 * get this from the node config subsystem. */
-	OcfsGlobalCtxt.node_name = kmalloc(OCFS2_MAX_NODE_NAME_LENGTH,
-					   GFP_KERNEL);
-	if (!OcfsGlobalCtxt.node_name) {
-		status = -ENOMEM;
-		LOG_ERROR_STATUS(status);
-		goto leave;
-	}
-	memset(OcfsGlobalCtxt.node_name, 0, OCFS2_MAX_NODE_NAME_LENGTH);
-	strncpy(OcfsGlobalCtxt.node_name, system_utsname.nodename,
-		OCFS2_MAX_NODE_NAME_LENGTH - 1);
-
-	printk("ocfs2: node name is %s\n", OcfsGlobalCtxt.node_name);
-
 	/* Initialize the global data resource */
 	init_MUTEX (&(OcfsGlobalCtxt.global_res));
 	OcfsGlobalCtxt.flags |= OCFS_FLAG_GLBL_CTXT_RESOURCE_INITIALIZED;
@@ -562,14 +570,9 @@
 		return register_filesystem (&ocfs_fs_type);
 	} else
 		return -1;
-}				/* ocfs_driver_entry */
+}
 
-/*
- * ocfs_driver_exit()
- *
- * Called on rmmod
- */
-static void __exit ocfs_driver_exit (void)
+static void __exit ocfs2_exit(void)
 {
 
 	LOG_ENTRY ();
@@ -592,15 +595,11 @@
 
 	exit_ocfs2_extent_maps();
 
-	if (OcfsGlobalCtxt.node_name)
-		kfree(OcfsGlobalCtxt.node_name);
-
-	printk("Unloaded OCFS Driver module\n");
+	printk("Unloaded OCFS2\n");
 	LOG_EXIT ();
-}				/* ocfs_driver_exit */
+}
 
 
-
 /*
  * ocfs_put_super()
  *
@@ -1023,9 +1022,8 @@
 
 	atomic_set(&osb->vol_state, VOLUME_DISMOUNTED);
 
-	printk ("ocfs2: Unmounting device (%u,%u) on %s (node %d)\n",
-		MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev),
-		OcfsGlobalCtxt.node_name, osb->node_num);
+	printk ("ocfs2: Unmounting device (%u,%u) on (node %d)\n",
+		MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev), osb->node_num);
 
 	ocfs_delete_osb (osb);
 	kfree(osb);
@@ -1494,5 +1492,6 @@
 }				/* ocfs_delete_osb */
 
 
-module_init (ocfs_driver_entry);
-module_exit (ocfs_driver_exit);
+MODULE_LICENSE("GPL");
+module_init(ocfs2_init);
+module_exit(ocfs2_exit);



More information about the Ocfs2-commits mailing list