[Ocfs2-commits] mfasheh commits r2137 - trunk/fs/ocfs2
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Tue Apr 12 15:45:37 CDT 2005
Author: mfasheh
Signed-off-by: jlbec
Date: 2005-04-12 15:45:35 -0500 (Tue, 12 Apr 2005)
New Revision: 2137
Modified:
trunk/fs/ocfs2/inode.c
trunk/fs/ocfs2/inode.h
trunk/fs/ocfs2/journal.c
trunk/fs/ocfs2/journal.h
trunk/fs/ocfs2/ocfs.h
trunk/fs/ocfs2/proc.c
trunk/fs/ocfs2/super.c
Log:
* remove the mount option parsing stuff. We don't take any of the ones it
looked for.
* get rid of global context, move the parts that are actually used into
super.c
Signed-off-by: jlbec
Modified: trunk/fs/ocfs2/inode.c
===================================================================
--- trunk/fs/ocfs2/inode.c 2005-04-12 06:09:15 UTC (rev 2136)
+++ trunk/fs/ocfs2/inode.c 2005-04-12 20:45:35 UTC (rev 2137)
@@ -293,8 +293,7 @@
if (!inode)
BUG();
- inode->u.generic_ip = kmem_cache_alloc(OcfsGlobalCtxt.inode_cache,
- GFP_NOFS);
+ inode->u.generic_ip = kmem_cache_alloc(ocfs2_inode_cache, GFP_NOFS);
if (!inode->u.generic_ip)
return -ENOMEM;
@@ -862,8 +861,7 @@
bail:
if (inode && inode->u.generic_ip) {
- kmem_cache_free(OcfsGlobalCtxt.inode_cache,
- inode->u.generic_ip);
+ kmem_cache_free(ocfs2_inode_cache, inode->u.generic_ip);
inode->u.generic_ip = NULL;
}
Modified: trunk/fs/ocfs2/inode.h
===================================================================
--- trunk/fs/ocfs2/inode.h 2005-04-12 06:09:15 UTC (rev 2136)
+++ trunk/fs/ocfs2/inode.h 2005-04-12 20:45:35 UTC (rev 2137)
@@ -26,6 +26,8 @@
#ifndef OCFS2_INODE_H
#define OCFS2_INODE_H
+extern kmem_cache_t *ocfs2_inode_cache;
+
struct buffer_head *ocfs_bread(struct inode * inode, int block,
int *err, int reada);
void ocfs_clear_inode(struct inode *inode);
Modified: trunk/fs/ocfs2/journal.c
===================================================================
--- trunk/fs/ocfs2/journal.c 2005-04-12 06:09:15 UTC (rev 2136)
+++ trunk/fs/ocfs2/journal.c 2005-04-12 20:45:35 UTC (rev 2137)
@@ -555,7 +555,7 @@
ocfs_journal_lock *lock;
OCFS_ASSERT(inode);
- lock = kmem_cache_alloc(OcfsGlobalCtxt.lock_cache, GFP_NOFS);
+ lock = kmem_cache_alloc(ocfs2_lock_cache, GFP_NOFS);
if (!lock) {
status = -ENOMEM;
LOG_ERROR_STATUS(-ENOMEM);
@@ -596,7 +596,7 @@
LOG_ERROR_ARGS("Inode %llu, I'm doing a last iput "
"for!", OCFS_I(inode)->ip_blkno);
iput(inode);
- kmem_cache_free(OcfsGlobalCtxt.lock_cache, lock);
+ kmem_cache_free(ocfs2_lock_cache, lock);
}
}
Modified: trunk/fs/ocfs2/journal.h
===================================================================
--- trunk/fs/ocfs2/journal.h 2005-04-12 06:09:15 UTC (rev 2136)
+++ trunk/fs/ocfs2/journal.h 2005-04-12 20:45:35 UTC (rev 2137)
@@ -137,6 +137,8 @@
spin_unlock(&trans_inc_lock);
}
+extern kmem_cache_t *ocfs2_lock_cache;
+
typedef struct _ocfs_journal_lock ocfs_journal_lock;
struct _ocfs_journal_lock {
struct inode *jl_inode;
Modified: trunk/fs/ocfs2/ocfs.h
===================================================================
--- trunk/fs/ocfs2/ocfs.h 2005-04-12 06:09:15 UTC (rev 2136)
+++ trunk/fs/ocfs2/ocfs.h 2005-04-12 20:45:35 UTC (rev 2137)
@@ -67,11 +67,6 @@
#define OCFS_INVALID_NODE_NUM -1
-/* OcfsGlobalCtxt.flags flags */
-#define OCFS_FLAG_GLBL_CTXT_RESOURCE_INITIALIZED (0x00000001)
-#define OCFS_FLAG_MEM_LISTS_INITIALIZED (0x00000002)
-
-
#define IS_VALID_FILE_ENTRY(ptr) \
(!strcmp((ptr)->i_signature, OCFS2_INODE_SIGNATURE))
#define IS_VALID_EXTENT_BLOCK(ptr) \
@@ -156,7 +151,6 @@
unsigned long fc_data;
};
-
typedef struct _ocfs2_lock_res {
void *l_priv;
struct ocfs2_lock_res_ops *l_ops;
@@ -289,7 +283,6 @@
*/
struct _ocfs_super
{
- struct list_head osb_next; /* list of ocfs_super(s) */
u32 osb_id; /* id used by the proc interface */
struct task_struct *commit_task;
struct super_block *sb;
@@ -304,7 +297,6 @@
ocfs_node_map recovery_map;
ocfs_node_map umount_map;
- /* new */
u32 num_clusters;
u64 root_blkno;
u64 system_dir_blkno;
@@ -327,7 +319,6 @@
u16 num_nodes;
s16 node_num;
s16 slot_num;
- int reclaim_id; /* reclaim the original node number*/
int s_sectsize_bits;
int s_clustersize;
int s_clustersize_bits;
@@ -390,22 +381,6 @@
wait_queue_head_t osb_okp_pending_wq;
};
-typedef struct _ocfs_global_ctxt
-{
- struct semaphore global_res;
- struct list_head osb_next; /* List of all volumes */
- kmem_cache_t *inode_cache;
- kmem_cache_t *lock_cache;
- u32 flags;
- struct proc_dir_entry *proc_root_dir; /* points to /proc/fs/ocfs2 */
-}
-ocfs_global_ctxt;
-
-/*
-** Globals ...
-*/
-extern ocfs_global_ctxt OcfsGlobalCtxt;
-
#define NAMEI_RA_CHUNKS 2
#define NAMEI_RA_BLOCKS 4
#define NAMEI_RA_SIZE (NAMEI_RA_CHUNKS * NAMEI_RA_BLOCKS)
Modified: trunk/fs/ocfs2/proc.c
===================================================================
--- trunk/fs/ocfs2/proc.c 2005-04-12 06:09:15 UTC (rev 2136)
+++ trunk/fs/ocfs2/proc.c 2005-04-12 20:45:35 UTC (rev 2137)
@@ -47,6 +47,8 @@
#define OCFS2_PROC_BASENAME "fs/ocfs2"
+static struct proc_dir_entry *ocfs2_proc_root_dir = NULL; /* points to /proc/fs/ocfs2 */
+
static int ocfs_proc_version (char *page, char **start, off_t off, int count, int *eof, void *data);
static int ocfs_proc_nodenum (char *page, char **start, off_t off, int count, int *eof, void *data);
static int ocfs_proc_slotnum (char *page, char **start, off_t off, int count, int *eof, void *data);
@@ -99,7 +101,7 @@
parent = proc_mkdir (OCFS2_PROC_BASENAME, 0);
if (parent) {
- OcfsGlobalCtxt.proc_root_dir = 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,
@@ -123,7 +125,7 @@
*/
void ocfs_proc_deinit (void)
{
- struct proc_dir_entry *parent = OcfsGlobalCtxt.proc_root_dir;
+ struct proc_dir_entry *parent = ocfs2_proc_root_dir;
ocfs_proc_list *p;
LOG_ENTRY ();
@@ -310,7 +312,7 @@
snprintf(newdir, sizeof(newdir), "%u_%u", MAJOR(osb->sb->s_dev),
MINOR(osb->sb->s_dev));
- parent = proc_mkdir(newdir, OcfsGlobalCtxt.proc_root_dir);
+ parent = proc_mkdir(newdir, ocfs2_proc_root_dir);
osb->proc_sub_dir = parent;
if (!parent) {
@@ -352,7 +354,7 @@
snprintf (dir, sizeof(dir), "%u_%u", MAJOR(osb->sb->s_dev),
MINOR(osb->sb->s_dev));
- remove_proc_entry (dir, OcfsGlobalCtxt.proc_root_dir);
+ remove_proc_entry (dir, ocfs2_proc_root_dir);
}
LOG_EXIT ();
Modified: trunk/fs/ocfs2/super.c
===================================================================
--- trunk/fs/ocfs2/super.c 2005-04-12 06:09:15 UTC (rev 2136)
+++ trunk/fs/ocfs2/super.c 2005-04-12 20:45:35 UTC (rev 2137)
@@ -71,12 +71,14 @@
#define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_SUPER
/*
-** Globals
-*/
-ocfs_global_ctxt OcfsGlobalCtxt;
-spinlock_t osb_id_lock;
+ * Globals
+ */
+spinlock_t ocfs2_globals_lock = SPIN_LOCK_UNLOCKED;
u32 osb_id; /* Keeps track of next available OSB Id */
+kmem_cache_t *ocfs2_inode_cache = NULL;
+kmem_cache_t *ocfs2_lock_cache = NULL;
+
u32 debug_context = 0;
u32 debug_level = 0;
u32 debug_exclude = 0;
@@ -173,17 +175,14 @@
MODULE_PARM_DESC(debug_level, "Debug level");
MODULE_PARM_DESC(debug_exclude, "Process ID to exclude from tracing");
-
-static int ocfs_parse_options (char *options, u32 * uid, u32 * gid, int * reclaim_id);
-static void ocfs_put_super (struct super_block *sb);
-static int ocfs_mount_volume (struct super_block *sb, int reclaim_id,
- struct inode *root);
+static void ocfs_put_super(struct super_block *sb);
+static int ocfs_mount_volume(struct super_block *sb);
static void ocfs_dismount_volume(struct super_block *sb);
-static int ocfs_initialize_mem_lists (void);
-static void ocfs_free_mem_lists (void);
-static void ocfs_delete_osb (ocfs_super * osb);
+static int ocfs_initialize_mem_caches(void);
+static void ocfs_free_mem_caches(void);
+static void ocfs_delete_osb(ocfs_super * osb);
-static int ocfs_statfs (struct super_block *sb, struct kstatfs *buf);
+static int ocfs_statfs(struct super_block *sb, struct kstatfs *buf);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
static int ocfs_sync_fs(struct super_block *sb, int wait);
@@ -201,7 +200,7 @@
u32 sectsize);
static int ocfs_initialize_osb(ocfs_super *osb, struct buffer_head *bh);
static int ocfs2_get_sector(struct super_block *sb, struct buffer_head **bh, int block, int sect_size);
-static void ocfs_write_super (struct super_block * sb);
+static void ocfs_write_super(struct super_block * sb);
static unsigned long long ocfs2_max_file_offset(unsigned int blockshift);
@@ -398,9 +397,6 @@
struct dentry *root;
int status;
struct inode *inode = NULL;
- u32 uid = current->fsuid;
- u32 gid = current->fsgid;
- int reclaim_id;
ocfs_super *osb = NULL;
/* for now we only have one cluster/node, make sure we see it
@@ -412,18 +408,12 @@
LOG_ENTRY_ARGS ("%p, %p, %i", sb, data, silent);
- if (ocfs_parse_options (data, &uid, &gid, &reclaim_id) != 0) {
- status = -EINVAL;
- LOG_ERROR_STR ("ocfs_read_super: bad mount option");
- goto read_super_error;
- }
-
sb->s_magic = OCFS2_SUPER_MAGIC;
sb->s_op = &ocfs_sops;
sb->s_export_op = &ocfs_export_ops;
sb->s_flags |= MS_NOATIME;
- status = ocfs_mount_volume (sb, reclaim_id, NULL);
+ status = ocfs_mount_volume(sb);
if (status < 0)
goto read_super_error;
@@ -511,68 +501,6 @@
static DECLARE_FSTYPE (ocfs_fs_type, "ocfs2", ocfs_read_super, FS_REQUIRES_DEV);
#endif
-/*
- * ocfs_parse_options()
- *
- * e.g., gid=9999,uid=9999,[no]cache,reclaimid
- */
-static int ocfs_parse_options (char *options, u32 * uid, u32 * gid, int * reclaim_id)
-{
- char *c;
- char *value;
- int ret = 1;
-
- LOG_ENTRY ();
-
- *reclaim_id = 0;
- if (!options) {
- ret = 0;
- goto bail;
- }
-
- LOG_TRACE_ARGS("strlen(options) = %u, options = \"%s\"\n", (unsigned int)strlen(options), options);
-
- while ((c = strsep(&options, ",")) != NULL) {
- if (*c == '\0')
- continue;
- if ((value = strchr (c, '=')) != NULL)
- *value++ = 0;
- if (!strcmp (c, "gid")) {
- if (!value || !*value) {
- LOG_ERROR_STR
- ("gid option requires an argument");
- goto bail;
- }
- *gid = simple_strtoul (value, &value, 0);
- if (*value) {
- LOG_ERROR_ARGS ("Invalid gid option: %s", value);
- goto bail;
- }
- } else if (!strcmp (c, "uid")) {
- if (!value || !*value) {
- LOG_ERROR_STR
- ("ERROR: uid option requires an argument");
- goto bail;
- }
- *uid = simple_strtoul (value, &value, 0);
- if (*value) {
- LOG_ERROR_ARGS ("Invalid uid option: %s", value);
- goto bail;
- }
- } else if (!strcmp (c, "reclaimid")) {
- *reclaim_id = 1;
- } else {
- LOG_ERROR_ARGS ("Invalid mount option: %s", c);
- goto bail;
- }
- }
- ret = 0;
-
-bail:
- LOG_EXIT_INT (ret);
- return ret;
-} /* ocfs_parse_options */
-
static int __init ocfs2_init(void)
{
int status;
@@ -590,38 +518,24 @@
goto leave;
}
- memset (&OcfsGlobalCtxt, 0, sizeof (ocfs_global_ctxt));
- INIT_LIST_HEAD (&(OcfsGlobalCtxt.osb_next));
-
- /* Initialize the global data resource */
- init_MUTEX (&(OcfsGlobalCtxt.global_res));
- OcfsGlobalCtxt.flags |= OCFS_FLAG_GLBL_CTXT_RESOURCE_INITIALIZED;
-
/* Initialize the memory slabs for oin and file entry */
- status = ocfs_initialize_mem_lists ();
+ status = ocfs_initialize_mem_caches();
if (status < 0) {
LOG_ERROR_STATUS (status);
goto leave;
}
- spin_lock_init (&osb_id_lock);
- spin_lock (&osb_id_lock);
+ spin_lock (&ocfs2_globals_lock);
osb_id = 0;
- spin_unlock (&osb_id_lock);
+ spin_unlock (&ocfs2_globals_lock);
/* Initialize the proc interface */
ocfs_proc_init();
leave:
if (status < 0) {
- /* Free up lookaside lists */
- if (OcfsGlobalCtxt.flags & OCFS_FLAG_MEM_LISTS_INITIALIZED)
- ocfs_free_mem_lists ();
+ ocfs_free_mem_caches();
- /* Delete the global context resource */
- if (OcfsGlobalCtxt.flags & OCFS_FLAG_GLBL_CTXT_RESOURCE_INITIALIZED)
- OcfsGlobalCtxt.flags &= ~OCFS_FLAG_GLBL_CTXT_RESOURCE_INITIALIZED;
-
if (ocfs_table_header)
unregister_sysctl_table(ocfs_table_header);
@@ -644,14 +558,8 @@
if (ocfs_table_header)
unregister_sysctl_table(ocfs_table_header);
- /* Signal DLM thread to exit */
- down (&(OcfsGlobalCtxt.global_res));
+ ocfs_free_mem_caches();
- if (OcfsGlobalCtxt.flags & OCFS_FLAG_MEM_LISTS_INITIALIZED)
- ocfs_free_mem_lists ();
-
- up (&(OcfsGlobalCtxt.global_res));
-
/* Deinit the proc interface */
ocfs_proc_deinit ();
@@ -749,37 +657,43 @@
return status;
} /* ocfs_statfs */
-
/*
- * ocfs_initialize_mem_lists()
+ * ocfs_initialize_mem_caches()
*
*/
-static int ocfs_initialize_mem_lists (void)
+static int ocfs_initialize_mem_caches(void)
{
- OcfsGlobalCtxt.inode_cache = kmem_cache_create("ocfs2_inode",
- sizeof(ocfs_inode_private), 0, SLAB_NO_REAP | SLAB_HWCACHE_ALIGN,
- NULL, NULL);
+ ocfs2_inode_cache = kmem_cache_create("ocfs2_inode",
+ sizeof(ocfs_inode_private), 0,
+ SLAB_NO_REAP|SLAB_HWCACHE_ALIGN,
+ NULL, NULL);
+ if (!ocfs2_inode_cache)
+ return -ENOMEM;
- OcfsGlobalCtxt.lock_cache = kmem_cache_create ("ocfs2_lock",
- sizeof(ocfs_journal_lock), 0, SLAB_NO_REAP | SLAB_HWCACHE_ALIGN,
- NULL, NULL);
+ ocfs2_lock_cache = kmem_cache_create("ocfs2_lock",
+ sizeof(ocfs_journal_lock), 0,
+ SLAB_NO_REAP|SLAB_HWCACHE_ALIGN,
+ NULL, NULL);
+ if (!ocfs2_lock_cache)
+ return -ENOMEM;
- OcfsGlobalCtxt.flags |= OCFS_FLAG_MEM_LISTS_INITIALIZED;
-
return 0;
-} /* ocfs_initialize_mem_lists */
+} /* ocfs_initialize_mem_caches */
/*
- * ocfs_free_mem_lists()
+ * ocfs_free_mem_caches()
*
*/
-static void ocfs_free_mem_lists (void)
+static void ocfs_free_mem_caches(void)
{
- kmem_cache_destroy (OcfsGlobalCtxt.inode_cache);
- kmem_cache_destroy (OcfsGlobalCtxt.lock_cache);
- OcfsGlobalCtxt.flags &= ~OCFS_FLAG_MEM_LISTS_INITIALIZED;
-} /* ocfs_free_mem_lists */
+ if (ocfs2_inode_cache)
+ kmem_cache_destroy(ocfs2_inode_cache);
+ if (ocfs2_lock_cache)
+ kmem_cache_destroy(ocfs2_lock_cache);
+ ocfs2_inode_cache = ocfs2_lock_cache = NULL;
+} /* ocfs_free_mem_caches */
+
static int ocfs2_sb_probe(struct super_block *sb,
struct buffer_head **bh,
int *sector_size)
@@ -903,8 +817,7 @@
* ocfs_mount_volume()
*
*/
-static int ocfs_mount_volume (struct super_block *sb, int reclaim_id,
- struct inode *root)
+static int ocfs_mount_volume (struct super_block *sb)
{
int status, sector_size;
int unlock_super = 0;
@@ -935,8 +848,6 @@
if (!osb->s_sectsize_bits)
BUG();
- osb->reclaim_id = reclaim_id;
-
/* s_blocksize was set in the probe */
status = ocfs_initialize_osb(osb, bh);
if (status < 0) {
@@ -1239,8 +1150,6 @@
ocfs2_init_node_maps(osb);
- INIT_LIST_HEAD (&(osb->osb_next));
-
snprintf(osb->dev_str, sizeof(osb->dev_str), "%u,%u",
MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev));
@@ -1355,21 +1264,17 @@
/* Link this osb onto the global linked list of all osb structures. */
/* The Global Link List is mainted for the whole driver . */
- down (&(OcfsGlobalCtxt.global_res));
- list_add_tail (&(osb->osb_next), &(OcfsGlobalCtxt.osb_next));
- up (&(OcfsGlobalCtxt.global_res));
-
- spin_lock (&osb_id_lock);
+ spin_lock(&ocfs2_globals_lock);
osb->osb_id = osb_id;
if (osb_id < OCFS_MAX_OSB_ID)
osb_id++;
else {
- spin_unlock (&osb_id_lock);
+ spin_unlock (&ocfs2_globals_lock);
LOG_ERROR_STR ("Too many volumes mounted");
status = -ENOMEM;
goto bail;
}
- spin_unlock (&osb_id_lock);
+ spin_unlock (&ocfs2_globals_lock);
bail:
LOG_EXIT_STATUS (status);
@@ -1561,13 +1466,6 @@
/* This function assumes that the caller has the main osb resource */
- /* Remove the osb from the global linked list of all osb structures. */
- /* The Global Link List is mainted for the whole driver */
- down (&(OcfsGlobalCtxt.global_res));
- if (!list_empty(&(osb->osb_next)))
- list_del (&(osb->osb_next));
- up (&(OcfsGlobalCtxt.global_res));
-
if (osb->slot_info)
ocfs2_free_slot_info(osb->slot_info);
More information about the Ocfs2-commits
mailing list