[Ocfs2-commits] jlbec commits r1015 - branches/format-changes/src
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Sun Jun 6 04:50:00 CDT 2004
Author: jlbec
Date: 2004-06-06 03:49:58 -0500 (Sun, 06 Jun 2004)
New Revision: 1015
Added:
branches/format-changes/src/alloc.h
branches/format-changes/src/bitmap.h
branches/format-changes/src/dcache.h
branches/format-changes/src/dir.h
branches/format-changes/src/dlm.h
branches/format-changes/src/extmap.h
branches/format-changes/src/file.h
branches/format-changes/src/hash.h
branches/format-changes/src/heartbeat.h
branches/format-changes/src/inode.h
branches/format-changes/src/ioctl.h
branches/format-changes/src/journal.h
branches/format-changes/src/lockres.h
branches/format-changes/src/namei.h
branches/format-changes/src/nm.h
branches/format-changes/src/ocfs.h
branches/format-changes/src/ocfs_buffer_head.h
branches/format-changes/src/ocfs_compat.h
branches/format-changes/src/ocfs_journal.h
branches/format-changes/src/ocfs_log.h
branches/format-changes/src/proc.h
branches/format-changes/src/super.h
branches/format-changes/src/symlink.h
branches/format-changes/src/sysfile.h
branches/format-changes/src/util.h
branches/format-changes/src/ver.h
branches/format-changes/src/volcfg.h
branches/format-changes/src/vote.h
Removed:
branches/format-changes/src/inc/
Modified:
branches/format-changes/src/Makefile
branches/format-changes/src/alloc.c
branches/format-changes/src/bitmap.c
branches/format-changes/src/buffer_head_io.c
branches/format-changes/src/dcache.c
branches/format-changes/src/dir.c
branches/format-changes/src/dlm.c
branches/format-changes/src/extmap.c
branches/format-changes/src/file.c
branches/format-changes/src/hash.c
branches/format-changes/src/heartbeat.c
branches/format-changes/src/inode.c
branches/format-changes/src/ioctl.c
branches/format-changes/src/journal.c
branches/format-changes/src/lockres.c
branches/format-changes/src/namei.c
branches/format-changes/src/nm.c
branches/format-changes/src/proc.c
branches/format-changes/src/super.c
branches/format-changes/src/symlink.c
branches/format-changes/src/sysfile.c
branches/format-changes/src/util.c
branches/format-changes/src/ver.c
branches/format-changes/src/volcfg.c
branches/format-changes/src/vote.c
Log:
o Next header pass.
- proto.h split into per-file headers
- All headers moved into the main directory.
Modified: branches/format-changes/src/Makefile
===================================================================
--- branches/format-changes/src/Makefile 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/Makefile 2004-06-06 08:49:58 UTC (rev 1015)
@@ -146,12 +146,34 @@
vote.c
HFILES = \
- inc/ocfs.h \
- inc/ocfs_log.h \
- inc/ocfs_compat.h \
- inc/ocfs_journal.h \
- inc/ocfs_buffer_head.h \
- inc/proto.h
+ ocfs.h \
+ ocfs_log.h \
+ ocfs_compat.h \
+ ocfs_journal.h \
+ ocfs_buffer_head.h \
+ alloc.h \
+ bitmap.h \
+ dcache.h \
+ dir.h \
+ dlm.h \
+ extmap.h \
+ file.h \
+ hash.h \
+ heartbeat.h \
+ inode.h \
+ ioctl.h \
+ journal.h \
+ lockres.h \
+ namei.h \
+ nm.h \
+ proc.h \
+ super.h \
+ symlink.h \
+ sysfile.h \
+ util.h \
+ ver.h \
+ volcfg.h \
+ vote.h
OBJS = $(subst .c,.o,$(CFILES))
@@ -173,7 +195,7 @@
WARNINGS += -Wmissing-prototypes -Wmissing-declarations
endif
-INCLUDES = -Iinc -I$(KERNELINC) -I$(GCCINC)
+INCLUDES = -I. -I$(KERNELINC) -I$(GCCINC)
CFLAGS = $(OPTS) $(MACH_CFLAGS) -pipe -nostdinc -fno-strict-aliasing \
-fno-common -fomit-frame-pointer $(MODVERSIONS) $(WARNINGS)
@@ -201,12 +223,7 @@
clean-ocfs:
rm -f *.o *.p *.s
-DIST_RULES = dist-subdircreate
-dist-subdircreate:
- $(TOPDIR)/mkinstalldirs $(DIST_DIR)/inc
-
-
else # ifndef KERNEL_26
# The 2.6.x kernel makefile
Modified: branches/format-changes/src/alloc.c
===================================================================
--- branches/format-changes/src/alloc.c 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/alloc.c 2004-06-06 08:49:58 UTC (rev 1015)
@@ -24,18 +24,28 @@
* Manish Singh, Neeraj Goyal, Suchit Kaura
*/
-#include "inc/ocfs_compat.h"
+#include "ocfs_compat.h"
#include <linux/fs.h>
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/highmem.h>
-#include "inc/ocfs_log.h"
-#include "inc/ocfs.h"
-#include "inc/ocfs_journal.h"
-#include "inc/ocfs_buffer_head.h"
+#include "ocfs_log.h"
+#include "ocfs.h"
+#include "alloc.h"
+#include "bitmap.h"
+#include "dlm.h"
+#include "extmap.h"
+#include "hash.h"
+#include "inode.h"
+#include "util.h"
+#include "sysfile.h"
+
+#include "ocfs_journal.h"
+#include "ocfs_buffer_head.h"
+
#ifndef USERSPACE_TOOL
Copied: branches/format-changes/src/alloc.h (from rev 1014, branches/format-changes/src/inc/proto.h)
===================================================================
--- branches/format-changes/src/inc/proto.h 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/alloc.h 2004-06-06 08:49:58 UTC (rev 1015)
@@ -0,0 +1,75 @@
+/*
+ * alloc.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.
+ *
+ * Authors: Kurt Hackel, Mark Fasheh, Sunil Mushran, Wim Coekaerts,
+ * Manish Singh, Neeraj Goyal, Suchit Kaura
+ */
+
+#ifndef OCFS2_ALLOC_H
+#define OCFS2_ALLOC_H
+
+int ocfs_add_to_bitmap_free_head(ocfs_super *osb,
+ ocfs_bitmap_free_head *f,
+ __u32 len, __u32 fileoff,
+ __u32 nodenum, __u32 type);
+int ocfs_allocate_extent(ocfs_super *osb, struct buffer_head *fe_bh,
+ ocfs_journal_handle *handle,
+ u64 blkno, u32 new_clusters,
+ struct inode *inode);
+int ocfs_alloc_node_block(ocfs_super *osb, __u64 FileSize,
+ __u64 *DiskOffset, __u64 *file_off,
+ __u32 NodeNum, __u32 Type,
+ ocfs_journal_handle *handle);
+int ocfs_find_contiguous_space_from_bitmap(ocfs_super *osb,
+ ocfs_journal_handle *handle,
+ __u64 file_size,
+ __u64 *cluster_off,
+ __u64 *cluster_count,
+ int sysfile,
+ struct buffer_head *lock_bh,
+ struct inode *bitmap_inode);
+int ocfs_find_space(ocfs_super *osb, __u64 file_size,
+ __u64 *cluster_off, __u64 *cluster_count,
+ int sysfile, ocfs_journal_handle *handle);
+int ocfs_free_extents_for_truncate(ocfs_super *osb,
+ ocfs2_dinode *fe,
+ ocfs_journal_handle *handle,
+ struct inode *inode);
+int ocfs_free_file_extents(ocfs_super *osb, struct buffer_head *fe_bh,
+ ocfs_journal_handle *handle,
+ struct inode *inode);
+int ocfs_get_leaf_extent(ocfs_super *osb, ocfs2_dinode *fe,
+ __s64 Vbo, struct buffer_head **data_extent_bh,
+ struct inode *inode);
+int ocfs_load_local_alloc(ocfs_super *osb);
+int ocfs_lookup_file_allocation(ocfs_super *osb, __s64 Vbo,
+ __s64 *Lbo, __u32 sectors,
+ u32 *sector_count, struct inode *inode);
+int ocfs_process_bitmap_free_head(ocfs_super *osb,
+ ocfs_bitmap_free_head *f);
+int ocfs_recover_local_alloc(ocfs_super *osb, int node_num);
+void ocfs_shutdown_local_alloc(ocfs_super *osb,
+ struct buffer_head **local_alloc_bh,
+ int sync,
+ int in_recovery);
+
+#endif /* OCFS2_ALLOC_H */
Modified: branches/format-changes/src/bitmap.c
===================================================================
--- branches/format-changes/src/bitmap.c 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/bitmap.c 2004-06-06 08:49:58 UTC (rev 1015)
@@ -24,18 +24,24 @@
* Manish Singh, Neeraj Goyal, Suchit Kaura
*/
-#include "inc/ocfs_compat.h"
+#include "ocfs_compat.h"
#include <linux/fs.h>
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/highmem.h>
-#include "inc/ocfs_log.h"
-#include "inc/ocfs.h"
-#include "inc/ocfs_journal.h"
-#include "inc/ocfs_buffer_head.h"
+#include "ocfs_log.h"
+#include "ocfs.h"
+#include "alloc.h"
+#include "bitmap.h"
+#include "hash.h"
+#include "util.h"
+
+#include "ocfs_journal.h"
+#include "ocfs_buffer_head.h"
+
/* Tracing */
#define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_BITMAP
Copied: branches/format-changes/src/bitmap.h (from rev 1014, branches/format-changes/src/inc/proto.h)
===================================================================
--- branches/format-changes/src/inc/proto.h 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/bitmap.h 2004-06-06 08:49:58 UTC (rev 1015)
@@ -0,0 +1,44 @@
+/*
+ * bitmap.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.
+ *
+ * Authors: Kurt Hackel, Mark Fasheh, Sunil Mushran, Wim Coekaerts,
+ * Manish Singh, Neeraj Goyal, Suchit Kaura
+ */
+
+#ifndef OCFS2_BITMAP_H
+#define OCFS2_BITMAP_H
+
+int ocfs_count_bits(ocfs_alloc_bm *bitmap);
+void ocfs_clear_bits(ocfs_journal_handle *handle,
+ ocfs_alloc_bm *bitmap,
+ __u32 start, __u32 num);
+int ocfs_find_clear_bits(ocfs_super *osb, ocfs_alloc_bm *bitmap,
+ __u32 numBits, __u32 offset, __u32 sysonly);
+void ocfs_initialize_bitmap(ocfs_alloc_bm *bitmap, __u32 validbits,
+ __u32 allocbits);
+void ocfs_reinitialize_bitmap(ocfs_alloc_bm *bitmap, __u32 validbits,
+ __u32 allocbits);
+void ocfs_set_bits(ocfs_journal_handle *handle, ocfs_alloc_bm *bitmap,
+ __u32 start, __u32 num);
+void ocfs_uninitialize_bitmap(ocfs_alloc_bm *bitmap);
+
+#endif /* OCFS2_BITMAP_H */
Modified: branches/format-changes/src/buffer_head_io.c
===================================================================
--- branches/format-changes/src/buffer_head_io.c 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/buffer_head_io.c 2004-06-06 08:49:58 UTC (rev 1015)
@@ -24,18 +24,23 @@
* Manish Singh, Neeraj Goyal, Suchit Kaura
*/
-#include "inc/ocfs_compat.h"
+#include "ocfs_compat.h"
#include <linux/fs.h>
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/highmem.h>
-#include "inc/ocfs_log.h"
-#include "inc/ocfs.h"
-#include "inc/ocfs_journal.h"
-#include "inc/ocfs_buffer_head.h"
+#include "ocfs_log.h"
+#include "ocfs.h"
+#include "alloc.h"
+#include "hash.h"
+#include "util.h"
+
+#include "ocfs_journal.h"
+#include "ocfs_buffer_head.h"
+
#define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_IO
static void ocfs_end_buffer_io_sync(struct buffer_head *bh,
Modified: branches/format-changes/src/dcache.c
===================================================================
--- branches/format-changes/src/dcache.c 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/dcache.c 2004-06-06 08:49:58 UTC (rev 1015)
@@ -24,7 +24,7 @@
* Manish Singh, Neeraj Goyal, Suchit Kaura
*/
-#include "inc/ocfs_compat.h"
+#include "ocfs_compat.h"
#include <linux/fs.h>
#include <linux/types.h>
@@ -33,9 +33,12 @@
#include <linux/namei.h>
#endif
-#include "inc/ocfs_log.h"
-#include "inc/ocfs.h"
+#include "ocfs_log.h"
+#include "ocfs.h"
+#include "dcache.h"
+#include "vote.h"
+
#define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_DCACHE
Copied: branches/format-changes/src/dcache.h (from rev 1014, branches/format-changes/src/inc/proto.h)
===================================================================
--- branches/format-changes/src/inc/proto.h 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/dcache.h 2004-06-06 08:49:58 UTC (rev 1015)
@@ -0,0 +1,40 @@
+/*
+ * dcache.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.
+ *
+ * Authors: Kurt Hackel, Mark Fasheh, Sunil Mushran, Wim Coekaerts,
+ * Manish Singh, Neeraj Goyal, Suchit Kaura
+ */
+
+#ifndef OCFS2_DCACHE_H
+#define OCFS2_DCACHE_H
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+int ocfs_dentry_revalidate(struct dentry *dentry, struct nameidata *nd);
+#else
+int ocfs_dentry_revalidate(struct dentry *dentry, int flags);
+#endif
+int ocfs_empty(struct dentry *dentry);
+int ocfs_foreach_child(struct dentry *dentry,
+ int (*func)(struct dentry *, void *),
+ void *data);
+
+#endif /* OCFS2_DCACHE_H */
Modified: branches/format-changes/src/dir.c
===================================================================
--- branches/format-changes/src/dir.c 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/dir.c 2004-06-06 08:49:58 UTC (rev 1015)
@@ -24,17 +24,25 @@
* Manish Singh, Neeraj Goyal, Suchit Kaura
*/
-#include "inc/ocfs_compat.h"
+#include "ocfs_compat.h"
#include <linux/fs.h>
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/highmem.h>
-#include "inc/ocfs_log.h"
-#include "inc/ocfs.h"
-#include "inc/ocfs_buffer_head.h"
+#include "ocfs_log.h"
+#include "ocfs.h"
+#include "dir.h"
+#include "dlm.h"
+#include "hash.h"
+#include "inode.h"
+#include "namei.h"
+#include "util.h"
+
+#include "ocfs_buffer_head.h"
+
#define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_DIR
static unsigned char ocfs_filetype_table[] = {
Copied: branches/format-changes/src/dir.h (from rev 1014, branches/format-changes/src/inc/proto.h)
===================================================================
--- branches/format-changes/src/inc/proto.h 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/dir.h 2004-06-06 08:49:58 UTC (rev 1015)
@@ -0,0 +1,39 @@
+/*
+ * dir.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.
+ *
+ * Authors: Kurt Hackel, Mark Fasheh, Sunil Mushran, Wim Coekaerts,
+ * Manish Singh, Neeraj Goyal, Suchit Kaura
+ */
+
+#ifndef OCFS2_DIR_H
+#define OCFS2_DIR_H
+
+int empty_dir(struct inode *inode); /* FIXME: to namei.c */
+int ocfs_find_files_on_disk(ocfs_super *osb, const char *name, int namelen,
+ struct buffer_head **fe_bh,
+ struct inode *inode,
+ struct inode *file_inode, int take_lock,
+ struct buffer_head **dirent_bh,
+ struct ocfs2_dir_entry **dirent);
+int ocfs_readdir(struct file *filp, void *dirent, filldir_t filldir);
+
+#endif /* OCFS2_DIR_H */
Modified: branches/format-changes/src/dlm.c
===================================================================
--- branches/format-changes/src/dlm.c 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/dlm.c 2004-06-06 08:49:58 UTC (rev 1015)
@@ -24,7 +24,7 @@
* Manish Singh, Neeraj Goyal, Suchit Kaura
*/
-#include "inc/ocfs_compat.h"
+#include "ocfs_compat.h"
#include <linux/fs.h>
#include <linux/types.h>
@@ -32,11 +32,21 @@
#include <linux/highmem.h>
#include <linux/random.h>
-#include "inc/ocfs_log.h"
-#include "inc/ocfs.h"
-#include "inc/ocfs_journal.h"
-#include "inc/ocfs_buffer_head.h"
+#include "ocfs_log.h"
+#include "ocfs.h"
+#include "alloc.h"
+#include "dcache.h"
+#include "dlm.h"
+#include "hash.h"
+#include "lockres.h"
+#include "nm.h"
+#include "util.h"
+#include "vote.h"
+
+#include "ocfs_journal.h"
+#include "ocfs_buffer_head.h"
+
extern __u32 comm_voting;
#define WAIT_FOR_VOTE_INCREMENT 200
@@ -131,8 +141,8 @@
largestseqno = pubsect->publ_seq_num;
if (pubsect->dirty) {
OCFS_BH_PUT_DATA(bhs[i]);
- if (!IS_NODE_ALIVE (&osb->publ_map, i, numnodes) ||
- TEST_NODE_IN_RECOVERY(osb, i)) {
+ if (!ocfs_node_is_alive(&osb->publ_map, i) ||
+ ocfs_node_is_recovering(osb, i)) {
LOG_TRACE_STR("Node is in recovery, trying"
" again.");
} else {
@@ -250,7 +260,7 @@
goto got_it;
}
- if (!IS_NODE_ALIVE (&osb->publ_map, curr_master, osb->max_nodes)) {
+ if (!ocfs_node_is_alive(&osb->publ_map, curr_master)) {
/* Reset the lock as not owned and return success?? */
/* This needs to be under some sort of cluster wide lock */
fe = OCFS_BH_GET_DATA_WRITE(bh);
@@ -322,8 +332,8 @@
goto got_it;
}
- if ((!IS_NODE_ALIVE (&osb->publ_map, curr_master, osb->max_nodes)) &&
- (!TEST_NODE_IN_RECOVERY(osb, curr_master))) {
+ if ((!ocfs_node_is_alive(&osb->publ_map, curr_master)) &&
+ (!ocfs_node_is_recovering(osb, curr_master))) {
/* Reset the lock as not owned and return success?? */
/* This needs to be under some sort of cluster wide lock, */
fe = OCFS_BH_GET_DATA_WRITE(bh);
@@ -477,8 +487,8 @@
}
for (i = 0; i < numnodes; i++) {
- int node_alive = (IS_NODE_ALIVE (&osb->publ_map, i, numnodes));
- int node_in_map = (IS_NODE_ALIVE (vote_map, i, numnodes));
+ int node_alive = ocfs_node_is_alive(&osb->publ_map, i);
+ int node_in_map = ocfs_node_is_alive(vote_map, i);
status = 0;
vote = OCFS_BH_GET_DATA_READ(bhs[i]);
@@ -753,14 +763,15 @@
if (S_ISDIR (inode->i_mode) ||
lockres->master_node_num == OCFS_INVALID_NODE_NUM ||
(!(lockres->lock_state & FLAG_ALWAYS_UPDATE_OPEN) &&
- IS_NODE_ALIVE (&lockres->oin_openmap, osb->node_num, osb->max_nodes))) {
+ ocfs_node_is_alive(&lockres->oin_openmap,
+ osb->node_num))) {
status = 0;
goto bail;
}
while (status == -EAGAIN) {
- if (!IS_NODE_ALIVE (&osb->publ_map, lockres->master_node_num,
- osb->max_nodes)) {
+ if (!ocfs_node_is_alive(&osb->publ_map,
+ lockres->master_node_num)) {
LOG_TRACE_ARGS ("Master (%u) dead, lockid %llu\n",
lockres->master_node_num,
GET_INODE_FEOFF(inode));
@@ -916,9 +927,11 @@
goto finally;
}
- wait_on_recovery = TEST_NODE_IN_RECOVERY(osb, lockres->master_node_num);
- owner_dead = !(no_owner || IS_NODE_ALIVE(&osb->publ_map,
- lockres->master_node_num, osb->max_nodes));
+ wait_on_recovery =
+ ocfs_node_is_recovering(osb, lockres->master_node_num);
+ owner_dead = !(no_owner ||
+ ocfs_node_is_alive(&osb->publ_map,
+ lockres->master_node_num));
if ((owner_dead || wait_on_recovery) &&
lockres->readonly_node == lockres->master_node_num) {
// if owner is dead or in recovery and the lockres
@@ -1012,7 +1025,7 @@
lockres->master_node_num);
while (1) {
LOG_TRACE_ARGS("waitcnt = %d\n", waitcnt);
- if (!TEST_NODE_IN_RECOVERY(osb, lockres->master_node_num))
+ if (!ocfs_node_is_recovering(osb, lockres->master_node_num))
break;
ocfs_sleep(500);
}
Copied: branches/format-changes/src/dlm.h (from rev 1014, branches/format-changes/src/inc/proto.h)
===================================================================
--- branches/format-changes/src/inc/proto.h 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/dlm.h 2004-06-06 08:49:58 UTC (rev 1015)
@@ -0,0 +1,56 @@
+/*
+ * dlm.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.
+ *
+ * Authors: Kurt Hackel, Mark Fasheh, Sunil Mushran, Wim Coekaerts,
+ * Manish Singh, Neeraj Goyal, Suchit Kaura
+ */
+
+#ifndef OCFS2_DLM_H
+#define OCFS2_DLM_H
+
+int new_lock_function(ocfs_super *osb, __u32 requested_lock,
+ __u32 flags, struct buffer_head *bh,
+ int *disk_vote, struct inode *inode);
+int ocfs_acquire_lock(ocfs_super *osb, __u64 lock_id, __u32 lock_type,
+ __u32 flags, struct buffer_head **bh,
+ struct inode *inode);
+int ocfs_break_cache_lock_zap_buffers(ocfs_super *osb,
+ struct inode *inode);
+void ocfs_compute_dlm_stats(int status, int vote_status,
+ ocfs_dlm_stats *stats);
+int ocfs_release_lock(ocfs_super *osb, __u64 lock_id, __u32 lock_type,
+ __u32 flags, struct buffer_head *bh,
+ struct inode *inode);
+int ocfs_update_disk_lock(ocfs_super *osb, __u32 flags,
+ struct buffer_head **bh, struct inode *inode,
+ ocfs_journal_handle *handle);
+int ocfs_update_master_on_open(ocfs_super *osb, struct inode *inode,
+ ocfs_journal_handle *handle);
+int ocfs_wait_for_lock_release(ocfs_super *osb, __u64 offset,
+ __u32 time_to_wait, __u32 lock_type,
+ struct inode *inode);
+void ocfs_set_publish_vote_map(ocfs_super *osb, ocfs_publish *publish, ocfs_node_map *vote_map);
+void ocfs_get_publish_vote_map(ocfs_super *osb, ocfs_publish *publish, ocfs_node_map *vote_map);
+void ocfs_set_disk_lock_open_map(ocfs_super *osb, ocfs_disk_lock *lock, ocfs_node_map *open_map);
+void ocfs_get_disk_lock_open_map(ocfs_super *osb, ocfs_disk_lock *lock, ocfs_node_map *open_map);
+
+#endif /* OCFS2_DLM_H */
Modified: branches/format-changes/src/extmap.c
===================================================================
--- branches/format-changes/src/extmap.c 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/extmap.c 2004-06-06 08:49:58 UTC (rev 1015)
@@ -24,15 +24,17 @@
* Manish Singh, Neeraj Goyal, Suchit Kaura
*/
-#include "inc/ocfs_compat.h"
+#include "ocfs_compat.h"
#include <linux/fs.h>
#include <linux/types.h>
#include <linux/slab.h>
-#include "inc/ocfs_log.h"
-#include "inc/ocfs.h"
+#include "ocfs_log.h"
+#include "ocfs.h"
+#include "extmap.h"
+
#define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_EXTMAP
/* Crazy wacky extent map stuff */
Copied: branches/format-changes/src/extmap.h (from rev 1014, branches/format-changes/src/inc/proto.h)
===================================================================
--- branches/format-changes/src/inc/proto.h 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/extmap.h 2004-06-06 08:49:58 UTC (rev 1015)
@@ -0,0 +1,49 @@
+/*
+ * extmap.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.
+ *
+ * Authors: Kurt Hackel, Mark Fasheh, Sunil Mushran, Wim Coekaerts,
+ * Manish Singh, Neeraj Goyal, Suchit Kaura
+ */
+
+#ifndef OCFS2_EXTMAP_H
+#define OCFS2_EXTMAP_H
+
+int ocfs_add_extent_map_entry_from_rec(struct super_block *sb,
+ ocfs_extent_map *extmap,
+ ocfs_extent_rec *rec);
+int ocfs_add_extent_map_entry(ocfs_super *osb, ocfs_extent_map *Map,
+ __s64 Vbo, __s64 Lbo, __u64 ByteCount);
+void ocfs_delete_all_extent_maps(ocfs_super *osb, struct inode *oin);
+void ocfs_extent_map_destroy(ocfs_extent_map *map);
+void ocfs_extent_map_init(ocfs_extent_map *map);
+int ocfs_get_next_extent_map_entry(ocfs_super *osb,
+ ocfs_extent_map *Map, __u32 RunIndex,
+ __s64 *Vbo, __s64 *Lbo,
+ __u32 *SectorCount);
+int ocfs_lookup_extent_map_entry(ocfs_super *osb, ocfs_extent_map *Map,
+ __s64 Vbo, __s64 *Lbo,
+ __u64 *SectorCount, __u32 *Index);
+int ocfs_update_extent_map(ocfs_super *osb, ocfs_extent_map *Map,
+ void *Buffer, __s64 *localVbo,
+ __u64 *remainingLength, ocfs_ext_flag Flag);
+
+#endif /* OCFS2_EXTMAP_H */
Modified: branches/format-changes/src/file.c
===================================================================
--- branches/format-changes/src/file.c 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/file.c 2004-06-06 08:49:58 UTC (rev 1015)
@@ -24,18 +24,27 @@
* Manish Singh, Neeraj Goyal, Suchit Kaura
*/
-#include "inc/ocfs_compat.h"
+#include "ocfs_compat.h"
#include <linux/fs.h>
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/highmem.h>
-#include "inc/ocfs_log.h"
-#include "inc/ocfs.h"
-#include "inc/ocfs_journal.h"
-#include "inc/ocfs_buffer_head.h"
+#include "ocfs_log.h"
+#include "ocfs.h"
+#include "alloc.h"
+#include "dlm.h"
+#include "extmap.h"
+#include "file.h"
+#include "hash.h"
+#include "inode.h"
+#include "util.h"
+
+#include "ocfs_journal.h"
+#include "ocfs_buffer_head.h"
+
#define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_FILE
extern struct semaphore recovery_list_sem;
Copied: branches/format-changes/src/file.h (from rev 1014, branches/format-changes/src/inc/proto.h)
===================================================================
--- branches/format-changes/src/inc/proto.h 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/file.h 2004-06-06 08:49:58 UTC (rev 1015)
@@ -0,0 +1,54 @@
+/*
+ * file.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.
+ *
+ * Authors: Kurt Hackel, Mark Fasheh, Sunil Mushran, Wim Coekaerts,
+ * Manish Singh, Neeraj Goyal, Suchit Kaura
+ */
+
+#ifndef OCFS2_FILE_H
+#define OCFS2_FILE_H
+
+int ocfs_extend_file(ocfs_super *osb, __u64 file_size, __u64 file_off,
+ ocfs_journal_handle *passed_handle,
+ struct inode *inode, struct iattr *attr);
+int ocfs_file_open(struct inode *inode, struct file *file);
+ssize_t ocfs_file_read(struct file *filp, char *buf, size_t count,
+ loff_t * ppos);
+int ocfs_file_release(struct inode *inode, struct file *file);
+ssize_t ocfs_file_write(struct file *filp, const char *buf,
+ size_t count, loff_t *ppos);
+int ocfs_flush(struct file *file);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+int ocfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
+ struct kstat *stat);
+#else
+int ocfs_getattr(struct dentry *dentry, struct iattr *attr);
+#endif
+int ocfs_inode_fill_ext_map(ocfs_super *osb, struct buffer_head *fe_bh,
+ struct inode *inode);
+int ocfs_inode_notify_open(ocfs_super *osb, struct buffer_head *fe_bh,
+ ocfs_journal_handle *handle,
+ struct inode *inode);
+int ocfs_setattr(struct dentry *dentry, struct iattr *attr);
+int ocfs_sync_file(struct file *file, struct dentry *dentry, int datasync);
+
+#endif /* OCFS2_FILE_H */
Modified: branches/format-changes/src/hash.c
===================================================================
--- branches/format-changes/src/hash.c 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/hash.c 2004-06-06 08:49:58 UTC (rev 1015)
@@ -24,7 +24,7 @@
* Manish Singh, Neeraj Goyal, Suchit Kaura
*/
-#include "inc/ocfs_compat.h"
+#include "ocfs_compat.h"
#include <linux/fs.h>
#include <linux/types.h>
@@ -33,11 +33,15 @@
#include <linux/highmem.h>
#include <linux/random.h>
-#include "inc/ocfs_log.h"
-#include "inc/ocfs.h"
-#include "inc/ocfs_buffer_head.h"
+#include "ocfs_log.h"
+#include "ocfs.h"
+#include "hash.h"
+#include "util.h"
+#include "ocfs_buffer_head.h"
+
+
/* Tracing */
#define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_HASH
Copied: branches/format-changes/src/hash.h (from rev 1014, branches/format-changes/src/inc/proto.h)
===================================================================
--- branches/format-changes/src/inc/proto.h 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/hash.h 2004-06-06 08:49:58 UTC (rev 1015)
@@ -0,0 +1,70 @@
+/*
+ * hash.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.
+ *
+ * Authors: Kurt Hackel, Mark Fasheh, Sunil Mushran, Wim Coekaerts,
+ * Manish Singh, Neeraj Goyal, Suchit Kaura
+ */
+
+#ifndef OCFS2_HASH_H
+#define OCFS2_HASH_H
+
+int ocfs_bh_sem_hash_cleanup_pid(pid_t pid);
+int ocfs_bh_sem_hash_destroy(void);
+int ocfs_bh_sem_hash_init(void);
+int ocfs_bh_sem_hash_prune(void);
+int ocfs_bh_sem_hash_prune_all(void);
+int ocfs_bh_sem_lock(struct buffer_head *bh);
+int ocfs_bh_sem_unlock(struct buffer_head *bh);
+void ocfs_clear_buffer_modified(struct buffer_head *bh);
+void wait_on_buffer_modified(struct buffer_head *bh);
+#ifdef BH_SEM_DEBUG
+#define ocfs_bh_sem_lock_modify(bh) ({ \
+ ocfs_bh_sem *sem; \
+ int ret; \
+ sem = ocfs_bh_sem_lookup(bh); \
+ if (!sem) \
+ BUG(); \
+ ocfs_bh_sem_down(sem); \
+ ret = OCFS_BH_SEM_GOT_LOCK; \
+ if (buffer_modified(bh)) { \
+ if (sem->s_pid == 0) { \
+ sem->s_pid = current->pid; \
+ snprintf(sem->s_modifier, 40, "%s:%s:%d", __FUNCTION__, __FILE__, __LINE__); \
+ ocfs_bh_sem_get(sem); \
+ } else if (sem->s_pid != current->pid) { \
+ ret = OCFS_BH_SEM_WAIT_ON_MODIFY; \
+ } \
+ } else { \
+ if (sem->s_pid != 0) \
+ printk("first to modify, but pid is NOT 0!\n"); \
+ sem->s_pid = current->pid; \
+ snprintf(sem->s_modifier, 40, "%s:%s:%d", __FUNCTION__, __FILE__, __LINE__); \
+ ocfs_bh_sem_get(sem); \
+ set_buffer_modified(bh); \
+ } \
+ ret; \
+})
+#else
+int ocfs_bh_sem_lock_modify(struct buffer_head *bh);
+#endif
+
+#endif /* OCFS2_HASH_H */
Modified: branches/format-changes/src/heartbeat.c
===================================================================
--- branches/format-changes/src/heartbeat.c 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/heartbeat.c 2004-06-06 08:49:58 UTC (rev 1015)
@@ -24,18 +24,25 @@
* Manish Singh, Neeraj Goyal, Suchit Kaura
*/
-#include "inc/ocfs_compat.h"
+#include "ocfs_compat.h"
#include <linux/fs.h>
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/highmem.h>
-#include "inc/ocfs_log.h"
-#include "inc/ocfs.h"
-#include "inc/ocfs_journal.h"
-#include "inc/ocfs_buffer_head.h"
+#include "ocfs_log.h"
+#include "ocfs.h"
+#include "alloc.h"
+#include "hash.h"
+#include "heartbeat.h"
+#include "util.h"
+#include "vote.h"
+
+#include "ocfs_journal.h"
+#include "ocfs_buffer_head.h"
+
/* Tracing */
#define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_HEARTBEAT
@@ -155,9 +162,7 @@
MAJOR(osb->sb->s_dev),
MINOR(osb->sb->s_dev));
node_map[i].miss_cnt = 0;
- UPDATE_PUBLISH_MAP(&osb->publ_map, i,
- OCFS_PUBLISH_SET,
- num_nodes);
+ ocfs_publish_map_set(&osb->publ_map, i);
}
OCFS_BH_PUT_DATA(bhs[i]);
}
@@ -176,13 +181,11 @@
/* Check if the node is hung or not by comparing the disk */
/* and memory timestamp values */
if (node_map[i].time == publish->time) {
- if (IS_NODE_ALIVE(&osb->publ_map, i, num_nodes)) {
+ if (ocfs_node_is_alive(&osb->publ_map, i)) {
if (atomic_read (&(node_map[i].dismount))) {
node_map[i].miss_cnt = MISS_COUNT_VALUE;
atomic_set (&(node_map[i].dismount), 0);
- UPDATE_PUBLISH_MAP (&osb->publ_map, i,
- OCFS_PUBLISH_CLEAR,
- num_nodes);
+ ocfs_publish_map_clear(&osb->publ_map, i);
} else
(node_map[i].miss_cnt)++;
@@ -195,9 +198,8 @@
MINOR(osb->sb->s_dev));
#endif
- SET_NODE_IN_RECOVERY(osb, i);
- UPDATE_PUBLISH_MAP (&osb->publ_map, i,
- OCFS_PUBLISH_CLEAR, num_nodes);
+ ocfs_recovery_map_set(osb, i);
+ ocfs_publish_map_clear(&osb->publ_map, i);
/* Ok, we'd better recover him now...*/
ocfs_recovery_thread(osb, i);
@@ -205,15 +207,15 @@
}
} else {
#if !defined(USERSPACE_TOOL)
- if (!IS_NODE_ALIVE(&osb->publ_map, i, num_nodes) && osb->node_num != i)
+ if (!ocfs_node_is_alive(&osb->publ_map, i) &&
+ (osb->node_num != i))
printk ("ocfs2: Adding %s (node %d) to clustered device (%u,%u)\n",
osb->node_cfg_info[i]->node_name, i,
MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev));
#endif
node_map[i].miss_cnt = 0;
node_map[i].time = publish->time;
- UPDATE_PUBLISH_MAP (&osb->publ_map, i, OCFS_PUBLISH_SET,
- num_nodes);
+ ocfs_publish_map_set(&osb->publ_map, i);
}
OCFS_BH_PUT_DATA(bhs[i]);
Copied: branches/format-changes/src/heartbeat.h (from rev 1014, branches/format-changes/src/inc/proto.h)
===================================================================
--- branches/format-changes/src/inc/proto.h 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/heartbeat.h 2004-06-06 08:49:58 UTC (rev 1015)
@@ -0,0 +1,34 @@
+/*
+ * heartbeat.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.
+ *
+ * Authors: Kurt Hackel, Mark Fasheh, Sunil Mushran, Wim Coekaerts,
+ * Manish Singh, Neeraj Goyal, Suchit Kaura
+ */
+
+#ifndef OCFS2_HEARTBEAT_H
+#define OCFS2_HEARTBEAT_H
+
+int ocfs_nm_heart_beat(ocfs_super *osb, __u32 flag, int read_publish);
+void ocfs_update_publish_map(ocfs_super *osb, struct buffer_head *bhs[],
+ int first_time);
+
+#endif /* OCFS2_HEARTBEAT_H */
Modified: branches/format-changes/src/inode.c
===================================================================
--- branches/format-changes/src/inode.c 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/inode.c 2004-06-06 08:49:58 UTC (rev 1015)
@@ -24,7 +24,7 @@
* Manish Singh, Neeraj Goyal, Suchit Kaura
*/
-#include "inc/ocfs_compat.h"
+#include "ocfs_compat.h"
#include <linux/fs.h>
#include <linux/types.h>
@@ -34,11 +34,26 @@
#include <asm/byteorder.h>
-#include "inc/ocfs_log.h"
-#include "inc/ocfs.h"
-#include "inc/ocfs_journal.h"
-#include "inc/ocfs_buffer_head.h"
+#include "ocfs_log.h"
+#include "ocfs.h"
+#include "alloc.h"
+#include "dir.h"
+#include "extmap.h"
+#include "file.h"
+#include "hash.h"
+#include "inode.h"
+#include "ioctl.h"
+#include "lockres.h"
+#include "namei.h"
+#include "super.h"
+#include "symlink.h"
+#include "util.h"
+#include "vote.h"
+
+#include "ocfs_journal.h"
+#include "ocfs_buffer_head.h"
+
#define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_INODE
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
Copied: branches/format-changes/src/inode.h (from rev 1014, branches/format-changes/src/inc/proto.h)
===================================================================
--- branches/format-changes/src/inc/proto.h 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/inode.h 2004-06-06 08:49:58 UTC (rev 1015)
@@ -0,0 +1,51 @@
+/*
+ * inode.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.
+ *
+ * Authors: Kurt Hackel, Mark Fasheh, Sunil Mushran, Wim Coekaerts,
+ * Manish Singh, Neeraj Goyal, Suchit Kaura
+ */
+
+#ifndef OCFS2_INODE_H
+#define OCFS2_INODE_H
+
+int ocfs_block_symlink(struct inode *inode, const char *symname,
+ int len);
+struct buffer_head *ocfs_bread(ocfs_journal_handle *handle,
+ struct inode * inode, int block,
+ int create, int *err, int reada);
+void ocfs_clear_inode(struct inode *inode);
+struct inode *ocfs_iget(ocfs_super *osb, __u64 feoff,
+ struct buffer_head *fe_bh);
+int ocfs_inode_init_private(struct inode *inode);
+int ocfs_inode_revalidate(struct dentry *dentry);
+void ocfs_populate_inode(struct inode *inode, ocfs2_dinode *fe,
+ int create_ino);
+void ocfs_put_inode(struct inode *inode);
+void ocfs_read_inode(struct inode *inode);
+void ocfs_read_inode2(struct inode *inode, void *opaque);
+ssize_t ocfs_rw_direct(int rw, struct file *filp, char *buf,
+ size_t size, loff_t *offp);
+void ocfs_sync_blockdev(struct super_block *sb);
+int ocfs_verify_update_inode(ocfs_super *osb, struct inode *inode,
+ int *needs_trunc, int lockres_locked);
+
+#endif /* OCFS2_INODE_H */
Modified: branches/format-changes/src/ioctl.c
===================================================================
--- branches/format-changes/src/ioctl.c 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/ioctl.c 2004-06-06 08:49:58 UTC (rev 1015)
@@ -24,7 +24,7 @@
* Manish Singh, Neeraj Goyal, Suchit Kaura
*/
-#include "inc/ocfs_compat.h"
+#include "ocfs_compat.h"
#include <linux/fs.h>
#include <linux/types.h>
@@ -32,9 +32,11 @@
#include <asm/uaccess.h>
-#include "inc/ocfs_log.h"
-#include "inc/ocfs.h"
+#include "ocfs_log.h"
+#include "ocfs.h"
+#include "ioctl.h"
+
/* Tracing */
#define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_IOCTL
Copied: branches/format-changes/src/ioctl.h (from rev 1014, branches/format-changes/src/inc/proto.h)
===================================================================
--- branches/format-changes/src/inc/proto.h 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/ioctl.h 2004-06-06 08:49:58 UTC (rev 1015)
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ *
+ * Authors: Kurt Hackel, Mark Fasheh, Sunil Mushran, Wim Coekaerts,
+ * Manish Singh, Neeraj Goyal, Suchit Kaura
+ */
+
+#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: branches/format-changes/src/journal.c
===================================================================
--- branches/format-changes/src/journal.c 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/journal.c 2004-06-06 08:49:58 UTC (rev 1015)
@@ -24,18 +24,29 @@
* Manish Singh, Joel Becker
*/
-#include "inc/ocfs_compat.h"
+#include "ocfs_compat.h"
#include <linux/fs.h>
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/highmem.h>
-#include "inc/ocfs_log.h"
-#include "inc/ocfs.h"
-#include "inc/ocfs_journal.h"
-#include "inc/ocfs_buffer_head.h"
+#include "ocfs_log.h"
+#include "ocfs.h"
+#include "alloc.h"
+#include "dlm.h"
+#include "extmap.h"
+#include "hash.h"
+#include "inode.h"
+#include "nm.h"
+#include "super.h"
+#include "util.h"
+#include "vote.h"
+
+#include "ocfs_journal.h"
+#include "ocfs_buffer_head.h"
+
#define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_JOURNAL
typedef enum _release_locks_action {
@@ -1482,7 +1493,7 @@
status = 0;
clear_node:
- CLEAR_NODE_IN_RECOVERY(osb, node_num);
+ ocfs_recovery_map_clear(osb, node_num);
ocfs_recover_oin_locks(osb, node_num);
done:
if (recovery_lock)
Copied: branches/format-changes/src/journal.h (from rev 1014, branches/format-changes/src/inc/proto.h)
===================================================================
--- branches/format-changes/src/inc/proto.h 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/journal.h 2004-06-06 08:49:58 UTC (rev 1015)
@@ -0,0 +1,32 @@
+/*
+ * journal.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.
+ *
+ * Authors: Kurt Hackel, Mark Fasheh, Sunil Mushran, Wim Coekaerts,
+ * Manish Singh, Neeraj Goyal, Suchit Kaura
+ */
+
+#ifndef OCFS2_JOURNAL_H
+#define OCFS2_JOURNAL_H
+
+int ocfs_commit_thread(void *arg);
+
+#endif /* OCFS2_JOURNAL_H */
Modified: branches/format-changes/src/lockres.c
===================================================================
--- branches/format-changes/src/lockres.c 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/lockres.c 2004-06-06 08:49:58 UTC (rev 1015)
@@ -24,17 +24,24 @@
* Manish Singh, Neeraj Goyal, Suchit Kaura
*/
-#include "inc/ocfs_compat.h"
+#include "ocfs_compat.h"
#include <linux/fs.h>
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/highmem.h>
-#include "inc/ocfs_log.h"
-#include "inc/ocfs.h"
-#include "inc/ocfs_buffer_head.h"
+#include "ocfs_log.h"
+#include "ocfs.h"
+#include "dlm.h"
+#include "hash.h"
+#include "lockres.h"
+#include "util.h"
+#include "vote.h"
+
+#include "ocfs_buffer_head.h"
+
/* Tracing */
#define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_LOCKRES
Copied: branches/format-changes/src/lockres.h (from rev 1014, branches/format-changes/src/inc/proto.h)
===================================================================
--- branches/format-changes/src/inc/proto.h 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/lockres.h 2004-06-06 08:49:58 UTC (rev 1015)
@@ -0,0 +1,39 @@
+/*
+ * lockres.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.
+ *
+ * Authors: Kurt Hackel, Mark Fasheh, Sunil Mushran, Wim Coekaerts,
+ * Manish Singh, Neeraj Goyal, Suchit Kaura
+ */
+
+#ifndef OCFS2_LOCKRES_H
+#define OCFS2_LOCKRES_H
+
+/* lockres.c */
+int ocfs_acquire_lockres(ocfs_lock_res *lockres, __u32 timeout);
+void ocfs_init_lockres(ocfs_super *osb, struct inode *inode);
+void ocfs_release_lockres(ocfs_lock_res *lockres);
+int ocfs_update_lockres(ocfs_super *osb, __u64 lock_id,
+ struct buffer_head **bh, __u32 *updated,
+ __u32 timeout, struct inode *inode, int reread,
+ int locked);
+
+#endif /* OCFS2_LOCKRES_H */
Modified: branches/format-changes/src/namei.c
===================================================================
--- branches/format-changes/src/namei.c 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/namei.c 2004-06-06 08:49:58 UTC (rev 1015)
@@ -24,18 +24,31 @@
* Manish Singh, Neeraj Goyal, Suchit Kaura
*/
-#include "inc/ocfs_compat.h"
+#include "ocfs_compat.h"
#include <linux/fs.h>
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/highmem.h>
-#include "inc/ocfs_log.h"
-#include "inc/ocfs.h"
-#include "inc/ocfs_journal.h"
-#include "inc/ocfs_buffer_head.h"
+#include "ocfs_log.h"
+#include "ocfs.h"
+#include "alloc.h"
+#include "dcache.h"
+#include "dir.h"
+#include "dlm.h"
+#include "file.h"
+#include "hash.h"
+#include "inode.h"
+#include "lockres.h"
+#include "namei.h"
+#include "util.h"
+#include "vote.h"
+
+#include "ocfs_journal.h"
+#include "ocfs_buffer_head.h"
+
#define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_NAMEI
extern spinlock_t oin_num_ext_lock;
Copied: branches/format-changes/src/namei.h (from rev 1014, branches/format-changes/src/inc/proto.h)
===================================================================
--- branches/format-changes/src/inc/proto.h 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/namei.h 2004-06-06 08:49:58 UTC (rev 1015)
@@ -0,0 +1,61 @@
+/*
+ * namei.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.
+ *
+ * Authors: Kurt Hackel, Mark Fasheh, Sunil Mushran, Wim Coekaerts,
+ * Manish Singh, Neeraj Goyal, Suchit Kaura
+ */
+
+#ifndef OCFS2_NAMEI_H
+#define OCFS2_NAMEI_H
+
+int ocfs_check_dir_entry (struct inode *dir,
+ struct ocfs2_dir_entry *de,
+ struct buffer_head *bh, unsigned long offset);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+int ocfs_create (struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd);
+#else
+int ocfs_create (struct inode *dir, struct dentry *dentry, int mode);
+#endif
+struct buffer_head * ocfs_find_entry (const char *name, int namelen, struct inode *dir,
+ struct ocfs2_dir_entry ** res_dir);
+int ocfs_link(struct dentry *old_dentry, struct inode *dir,
+ struct dentry *dentry);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+struct dentry *ocfs_lookup(struct inode *dir, struct dentry *dentry,
+ struct nameidata *nd);
+#else
+struct dentry *ocfs_lookup(struct inode *dir, struct dentry *dentry);
+#endif
+int ocfs_mkdir(struct inode *dir, struct dentry *dentry, int mode);
+int ocfs_mknod(struct inode *dir, struct dentry *dentry, int mode,
+ ocfs_dev dev);
+int ocfs_rename(struct inode *old_dir, struct dentry *old_dentry,
+ struct inode *new_dir, struct dentry *new_dentry);
+int ocfs_symlink(struct inode *dir, struct dentry *dentry,
+ const char *symname);
+int ocfs_unlink(struct inode *dir, struct dentry *dentry);
+
+/* FIXME: only in namei.c */
+int ocfs_orphan_add(ocfs_journal_handle *handle, struct inode *inode);
+int ocfs_orphan_del(ocfs_journal_handle *handle, struct inode *inode);
+
+#endif /* OCFS2_NAMEI_H */
Modified: branches/format-changes/src/nm.c
===================================================================
--- branches/format-changes/src/nm.c 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/nm.c 2004-06-06 08:49:58 UTC (rev 1015)
@@ -24,7 +24,7 @@
* Manish Singh, Neeraj Goyal, Suchit Kaura
*/
-#include "inc/ocfs_compat.h"
+#include "ocfs_compat.h"
#include <linux/fs.h>
#include <linux/types.h>
@@ -33,11 +33,23 @@
#include <linux/bitops.h>
#include <linux/net.h>
-#include "inc/ocfs_log.h"
-#include "inc/ocfs.h"
-#include "inc/ocfs_journal.h"
-#include "inc/ocfs_buffer_head.h"
+#include "ocfs_log.h"
+#include "ocfs.h"
+#include "alloc.h"
+#include "dlm.h"
+#include "hash.h"
+#include "heartbeat.h"
+#include "inode.h"
+#include "lockres.h"
+#include "nm.h"
+#include "util.h"
+#include "volcfg.h"
+#include "vote.h"
+
+#include "ocfs_journal.h"
+#include "ocfs_buffer_head.h"
+
/* Tracing */
#define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_NM
@@ -386,8 +398,8 @@
highest_vote_node = i;
/* Check if the node is alive or not */
- if (IS_NODE_ALIVE (&osb->publ_map, highest_vote_node,
- num_nodes)) {
+ if (ocfs_node_is_alive(&osb->publ_map,
+ highest_vote_node)) {
vote_node = highest_vote_node;
} else {
OCFS_BH_PUT_DATA(osb->cfg_bhs[which]);
@@ -498,9 +510,11 @@
return INVALID_REQUEST;
}
} else if (lockres) {
- *master_alive = lockres->master_node_num != OCFS_INVALID_NODE_NUM &&
- IS_NODE_ALIVE(&osb->publ_map,
- lockres->master_node_num, osb->max_nodes);
+ *master_alive =
+ (lockres->master_node_num !=
+ OCFS_INVALID_NODE_NUM) &&
+ ocfs_node_is_alive(&osb->publ_map,
+ lockres->master_node_num);
// if an outstanding vote request is found on this lockid
// and this node number is higher, this node wins
Copied: branches/format-changes/src/nm.h (from rev 1014, branches/format-changes/src/inc/proto.h)
===================================================================
--- branches/format-changes/src/inc/proto.h 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/nm.h 2004-06-06 08:49:58 UTC (rev 1015)
@@ -0,0 +1,39 @@
+/*
+ * nm.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.
+ *
+ * Authors: Kurt Hackel, Mark Fasheh, Sunil Mushran, Wim Coekaerts,
+ * Manish Singh, Neeraj Goyal, Suchit Kaura
+ */
+
+#ifndef OCFS2_NM_H
+#define OCFS2_NM_H
+
+int ocfs_drop_readonly_cache_lock(ocfs_super *osb, struct inode *inode,
+ int yield);
+void ocfs_inc_inode_seq(ocfs_super *osb, struct inode *inode,
+ int sync_buffers);
+int ocfs_process_vote(ocfs_super *osb, ocfs_vote_request_ctxt *ctxt);
+int ocfs_recv_thread(void *unused);
+void ocfs_recover_oin_locks(ocfs_super *osb, __u32 node_num);
+int ocfs_volume_thread(void *arg);
+
+#endif /* OCFS2_NM_H */
Copied: branches/format-changes/src/ocfs.h (from rev 1014, branches/format-changes/src/inc/ocfs.h)
===================================================================
--- branches/format-changes/src/inc/ocfs.h 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/ocfs.h 2004-06-06 08:49:58 UTC (rev 1015)
@@ -0,0 +1,1892 @@
+/*
+ * ocfs.h
+ *
+ * Defines macros and structures used in ocfs
+ *
+ * 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.
+ *
+ * Authors: Kurt Hackel, Mark Fasheh, Sunil Mushran, Wim Coekaerts,
+ * Manish Singh, Neeraj Goyal, Suchit Kaura
+ */
+
+#ifndef OCFS_H
+#define OCFS_H
+
+/*
+** System header files
+*/
+#define __KERNEL_SYSCALLS__
+
+#include <linux/spinlock.h>
+#include <linux/sched.h>
+#include <linux/wait.h>
+#include <linux/list.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+# include <linux/workqueue.h>
+#else
+# include <linux/tqueue.h>
+#endif
+
+
+#define OCFS_BITMAP_CHUNK (512) /* size of a chunk, in bytes */
+#define OCFS_BITS_IN_CHUNK (OCFS_BITMAP_CHUNK * 8)
+/* Lovely convenience macros. If we move to a scheme where
+ * OCFS_BITS_IN_CHUNK is not constant, this'll
+ * be nice. */
+#define OCFS_CHUNK_TO_GLOBAL_OFF(index, localoffset) \
+ ((index) * OCFS_BITS_IN_CHUNK + (localoffset))
+#define OCFS_GLOBAL_OFF_TO_CHUNK(globaloffset) \
+ ((globaloffset) / OCFS_BITS_IN_CHUNK)
+#define OCFS_GLOBAL_OFF_TO_LOCAL(globaloffset) \
+ ((globaloffset) % OCFS_BITS_IN_CHUNK)
+#define OCFS_BITMAP_RANGE_BITS(startbh, startoff, endbh, endoff) \
+ (OCFS_CHUNK_TO_GLOBAL_OFF((endbh), (endoff)) - \
+ OCFS_CHUNK_TO_GLOBAL_OFF((startbh), (startoff)))
+
+typedef struct _ocfs_alloc_bm
+{
+ __u32 validbits; /* number of valid bits */
+ __u32 allocbits; /* number of allocated bits */
+ __u32 failed;
+ __u32 ok_retries;
+ /* 'numbh' is the number of buffer heads in chunk. We keep
+ * around enough buffer heads to cover the entire alloc'd size
+ * of the bitmap, even though we may only ever care about the
+ * valid size */
+ __u32 numbh;
+ struct buffer_head **chunk;
+}
+ocfs_alloc_bm;
+
+#define OCFS_ALIGN(val, align) \
+ ((__u64)val + \
+ (((__u64)val % align) ? (align - ((__u64)val % align)): 0))
+
+
+
+
+#define OCFS_POINTER_SIZE (sizeof(void *))
+
+enum
+{
+ OCFS_VOTE_REQUEST = 1,
+ OCFS_VOTE_REPLY,
+ OCFS_INFO_DISMOUNT
+};
+
+enum {
+ DISK_VOTE,
+ COMM_VOTE
+};
+
+enum {
+ INVALID_REQUEST, // reply with a NO vote
+ UPDATE_OIN_INODE, // update both oin and inode
+ DELETE_RENAME_ACQUIRE,// delete or rename acquire request
+ DELETE_RENAME_RELEASE,// delete or rename release request
+ RELEASE_CACHE, // release a cache lock I hold
+ CHANGE_MASTER, // request to change master to requestor
+ ADD_OIN_MAP, // add requestor into oin map
+ NOT_MASTER, // I am not master, retry
+ REMASTER_THIS, // remaster lock to me
+ REMASTER_REQUESTOR, // remaster lock to requestor
+ DROP_READONLY, // RO cachelock needs to convert to RW
+ READONLY // a RW or RO cachelock, requesting RO
+};
+
+#define OCFS_MAX_DLM_PKT_SIZE 256
+#define OCFS_DLM_MAX_MSG_SIZE 256
+#define OCFS_DLM_MSG_MAGIC 0x79677083
+
+enum {
+ OSB_DATA_LOCK,
+ OSB_MD_LOCK,
+ OSB_CFG_LOCK,
+ OSB_LOG_LOCK
+};
+
+
+/* convenience macro */
+#define ocfs_safefree(x) \
+do { \
+ if (x) \
+ kfree(x); \
+ (x) = NULL; \
+} while (0)
+
+#define OCFS_ASSERT(x) do { if (!(x)) BUG(); } while (0)
+
+
+#define BITCOUNT(x) (((BX_(x)+(BX_(x)>>4)) & 0x0F0F0F0F) % 255)
+#define BX_(x) ((x) - (((x)>>1)&0x77777777) \
+ - (((x)>>2)&0x33333333) \
+ - (((x)>>3)&0x11111111))
+
+
+#ifndef list_for_each_prev_safe
+#define list_for_each_prev_safe(pos, n, head) \
+ for (pos = (head)->prev, n = pos->prev; pos != (head); \
+ pos = n, n = pos->prev)
+#endif
+
+
+#define OCFS_CURRENT_TIME ocfs_get_seconds(CURRENT_TIME)
+#define OCFS_SET_INODE_TIME(i, x, y) (ocfs_get_seconds(i->x) = (y))
+
+
+#define ONE_MEGA_BYTE (1 * 1024 * 1024) /* in bytes */
+
+#define MISS_COUNT_VALUE 30
+
+#define OCFS_DEFAULT_DIR_NODE_SECTS (256)
+#define OCFS_DEFAULT_DIR_NODE_SIZE (512 * OCFS_DEFAULT_DIR_NODE_SECTS)
+#define OCFS_DEFAULT_FILE_NODE_SIZE (512)
+#define OCFS_DEFAULT_INODE_SIZE (512)
+
+/*
+** The following flag values reflect the operation to be performed
+** by ocfs_create_modify_file
+*/
+// FILEFLAG MASK
+#define FLAG_FILE_CREATE 0x00000001
+#define FLAG_FILE_EXTEND 0x00000002
+#define FLAG_FILE_DELETE 0x00000004
+#define FLAG_FILE_RENAME 0x00000008
+#define FLAG_FILE_UPDATE 0x00000010
+#define FLAG_FILE_RECOVERY 0x00000020
+#define FLAG_FILE_CREATE_DIR 0x00000040
+#define FLAG_FILE_UPDATE_OIN 0x00000080
+#define FLAG_FILE_RELEASE_MASTER 0x00000100
+#define FLAG_FILE_UNUSED2 0x00000200
+#define FLAG_CHANGE_MASTER 0x00000400
+#define FLAG_ADD_OIN_MAP 0x00000800
+#define FLAG_DIR 0x00001000
+#define FLAG_REMASTER 0x00002000
+#define FLAG_FAST_PATH_LOCK 0x00004000
+#define FLAG_FILE_UNUSED5 0x00008000
+#define FLAG_FILE_UNUSED6 0x00010000
+//#define FLAG_DEL_NAME 0x00020000
+//#define FLAG_DEL_INODE 0x00040000
+#define FLAG_FILE_UNUSED7 0x00080000
+#define FLAG_FILE_UNUSED8 0x00100000
+#define FLAG_FILE_UNUSED9 0x00200000
+#define FLAG_FILE_RELEASE_CACHE 0x00400000
+#define FLAG_FILE_UNUSED10 0x00800000
+#define FLAG_FILE_UNUSED11 0x01000000
+#define FLAG_FILE_UNUSED12 0x02000000
+#define FLAG_FILE_UNUSED13 0x04000000
+#define FLAG_FILE_TRUNCATE 0x08000000
+#define FLAG_DROP_READONLY 0x10000000
+#define FLAG_READDIR 0x20000000
+#define FLAG_ACQUIRE_LOCK 0x40000000
+#define FLAG_RELEASE_LOCK 0x80000000
+
+enum {
+ OCFS_INVALID_SYSFILE = -1,
+ OCFS_VOL_MD_SYSFILE = 0, // unused in version 2
+ OCFS_VOL_MD_LOG_SYSFILE, // unused in version 2
+ OCFS_DIR_SYSFILE, // unused in version 2
+ OCFS_DIR_BM_SYSFILE, // unused in version 2
+ OCFS_FILE_EXTENT_SYSFILE,
+ OCFS_FILE_EXTENT_BM_SYSFILE,
+ OCFS_RECOVER_LOG_SYSFILE, // unused in version 2
+ OCFS_CLEANUP_LOG_SYSFILE, // unused in version 2
+ OCFS_VOL_BM_SYSFILE, // this is the local alloc file
+ OCFS_ORPHAN_DIR_SYSFILE,
+ OCFS_JOURNAL_SYSFILE,
+ OCFS_INODE_SYSFILE,
+ OCFS_INODE_BM_SYSFILE,
+ OCFS_NUM_SYSFILES
+};
+
+#define OCFS_FILE_VOL_META_DATA (OCFS_VOL_MD_SYSFILE * OCFS_MAXIMUM_NODES) // unused in version 2
+#define OCFS_FILE_VOL_LOG_FILE (OCFS_VOL_MD_LOG_SYSFILE * OCFS_MAXIMUM_NODES) // unused in version 2
+#define OCFS_FILE_DIR_ALLOC (OCFS_DIR_SYSFILE * OCFS_MAXIMUM_NODES) // unused in version 2
+#define OCFS_FILE_DIR_ALLOC_BITMAP (OCFS_DIR_BM_SYSFILE * OCFS_MAXIMUM_NODES) // unused in version 2
+#define OCFS_FILE_FILE_ALLOC (OCFS_FILE_EXTENT_SYSFILE * OCFS_MAXIMUM_NODES)
+#define OCFS_FILE_FILE_ALLOC_BITMAP (OCFS_FILE_EXTENT_BM_SYSFILE * OCFS_MAXIMUM_NODES)
+#define LOG_FILE_BASE_ID (OCFS_RECOVER_LOG_SYSFILE * OCFS_MAXIMUM_NODES) // unused in version 2
+#define CLEANUP_FILE_BASE_ID (OCFS_CLEANUP_LOG_SYSFILE * OCFS_MAXIMUM_NODES) // unused in version 2
+#define OCFS_LOCAL_ALLOC_FILE (OCFS_VOL_BM_SYSFILE * OCFS_MAXIMUM_NODES) // was OCFS_VOL_BITMAP_FILE
+#define OCFS_JOURNAL_FILE (OCFS_JOURNAL_SYSFILE * OCFS_MAXIMUM_NODES)
+#define OCFS_INODE_FILE (OCFS_INODE_SYSFILE * OCFS_MAXIMUM_NODES)
+#define OCFS_INODE_BITMAP (OCFS_INODE_BM_SYSFILE * OCFS_MAXIMUM_NODES)
+
+
+/* FIXME: Left about for now */
+#define OCFS_SECTOR_SIZE 512
+
+#define OCFS_MAXIMUM_NODES 32
+#define OCFS_MAX_FILENAME_LENGTH 255
+#define OCFS_MAX_OSB_ID 65536
+
+
+#define HEARTBEAT_METHOD_DISK (1)
+#define HEARTBEAT_METHOD_IPC (2)
+
+
+enum
+{
+ LEFT_NO_OVERLAP,
+ LEFT_ADJACENT,
+ LEFT_OVERLAP,
+ FULLY_CONTAINED,
+ FULLY_CONTAINING,
+ RIGHT_OVERLAP,
+ RIGHT_ADJACENT,
+ RIGHT_NO_OVERLAP
+};
+
+
+/*
+** Extents Defines
+*/
+
+typedef enum _ocfs_ext_flag {
+ LOCAL_EXT = 1,
+ NONLOCAL_EXT = 2
+} ocfs_ext_flag;
+
+enum {
+ EXTENT_HEADER,
+ EXTENT_DATA
+};
+
+#define OCFS_EXTENT_DATA 1
+#define OCFS_EXTENT_HEADER 2
+
+#define OCFS_MAX_FILE_ENTRY_EXTENTS 3
+#define OCFS_MAX_DATA_EXTENTS 18
+#define NUM_SECTORS_IN_LEAF_NODE 1
+
+/*
+** Structure signatures
+*/
+#define OCFS_TYPE_OSB (0x05534643)
+#define OCFS_TYPE_GLOBAL_DATA (0x07534643)
+
+// LOCKTYPE ONE
+#define OCFS_DLM_NO_LOCK (0x0)
+#define OCFS_DLM_EXCLUSIVE_LOCK (0x2)
+#define OCFS_DLM_ENABLE_CACHE_LOCK (0x8)
+
+#define OCFS_INVALID_NODE_NUM UINT_MAX
+
+typedef enum _ocfs_rw_mode
+{
+ OCFS_READ,
+ OCFS_WRITE
+}
+ocfs_rw_mode;
+
+
+/* lockres->lock_state flags */
+#define FLAG_ALWAYS_UPDATE_OPEN 0x00000001
+#define LOCK_STATE_INIT 0x00000002
+#define LOCK_STATE_IN_VOTING 0x00000004
+#define FLAG_READONLY_DROPPING 0x00000008
+
+/* osb->osb_flags flags */
+#define OCFS_OSB_FLAGS_BEING_DISMOUNTED (0x00000004)
+#define OCFS_OSB_FLAGS_SHUTDOWN (0x00000008)
+#define OCFS_OSB_FLAGS_OSB_INITIALIZED (0x00000020)
+
+/* OcfsGlobalCtxt.flags flags */
+#define OCFS_FLAG_GLBL_CTXT_RESOURCE_INITIALIZED (0x00000001)
+#define OCFS_FLAG_MEM_LISTS_INITIALIZED (0x00000002)
+#define OCFS_FLAG_SHUTDOWN_VOL_THREAD (0x00000004)
+
+/*
+** Information on Publish sector of each node
+*/
+#define DISK_HBEAT_COMM_ON 20 /* in the order of 5 secs */
+#define DISK_HBEAT_NO_COMM 4 /* in the order of 1 sec */
+#define DISK_HBEAT_INVALID 0 /* in the order of 100ms */
+
+
+/*
+** Information on Vote sector of each node
+*/
+// VOTEFLAG MASK
+#define FLAG_VOTE_NODE 0x1
+#define FLAG_VOTE_OIN_UPDATED 0x2
+#define FLAG_VOTE_OIN_ALREADY_INUSE 0x4
+#define FLAG_VOTE_UPDATE_RETRY 0x8
+#define FLAG_VOTE_FILE_DEL 0x10
+
+/*
+** File Entry contains this information
+*/
+/* OCFS2 file flags */
+#define OCFS2_VALID_FL (0x1)
+#define OCFS2_CHANGE_FL (0x2)
+#define OCFS2_MARK_FOR_DELETION_FL (0x4)
+#define OCFS2_NAME_DELETED_FL (0x8)
+#define OCFS2_SYSTEM_FL (0x10)
+
+
+#define INVALID_NODE_POINTER -1
+#define OCFS_FILE_ENTRY_SIGNATURE "FIL"
+#define OCFS_EXTENT_HEADER_SIGNATURE "EXTHDR2"
+#define OCFS_EXTENT_DATA_SIGNATURE "EXTDAT1"
+#define OCFS_LOCAL_ALLOC_SIGNATURE "LCLBMP"
+
+#define MAX_IP_ADDR_LEN 32
+
+#define OCFS_IP_ADDR "ip_address"
+#define OCFS_IP_PORT "ip_port"
+#define OCFS_IP_MASK "subnet_mask"
+#define OCFS_COMM_TYPE "type"
+
+#define SHUTDOWN_SIGS (sigmask(SIGKILL) | sigmask(SIGHUP) | \
+ sigmask(SIGINT) | sigmask(SIGQUIT))
+
+#define EFAIL 999
+#define EWARNING 998
+
+#define OCFS_MAGIC 0xa156f7eb
+
+/* TODO: no hardcoding of this stuff!!! */
+/* TODO: these should be stored in the on-disk superblock */
+#define OCFS_VOLUME_LOCK_INODE_NUMBER 1 // unused !!!
+#define OCFS_BITMAP_LOCK_INODE_NUMBER 2
+#define OCFS_ROOT_INODE_NUMBER 3
+#define OCFS_SYS_ROOT_INODE_NUMBER 4
+#define OCFS_VOLUME_LOCK_OFFSET(osb) (OCFS_VOLUME_LOCK_INODE_NUMBER << osb->sb->s_blocksize_bits) // unused !!!
+#define OCFS_BITMAP_LOCK_OFFSET(osb) (OCFS_BITMAP_LOCK_INODE_NUMBER << osb->sb->s_blocksize_bits)
+#define OCFS_ROOT_INODE_FE_OFF(osb) (OCFS_ROOT_INODE_NUMBER << osb->sb->s_blocksize_bits)
+#define OCFS_SYS_ROOT_INODE_OFF(osb) (OCFS_SYS_ROOT_INODE_NUMBER << osb->sb->s_blocksize_bits)
+
+#define OCFS_LINUX_MAX_FILE_SIZE 9223372036854775807LL
+#define INITIAL_EXTENT_MAP_SIZE 10
+
+#define OCFS_UNUSED_INODE_NUMBER 1
+
+#define OCFS_VOLCFG_LOCK_ITERATE (HZ/10) /* in jiffies */
+#define OCFS_VOLCFG_LOCK_TIME 1000 /* in ms */
+#define OCFS_VOLCFG_HDR_SECTORS 2 /* in sectors */
+#define OCFS_VOLCFG_NEWCFG_SECTORS 4 /* in sectors */
+
+#define OCFS_PUBLISH_CLEAR 0
+#define OCFS_PUBLISH_SET 1
+
+#define OCFS_NM_HEARTBEAT_TIME 500 /* in ms */
+#define OCFS_HEARTBEAT_INIT 10 /* number of NM iterations to stabilize the publish map */
+
+
+#define OCFS_BH_SEM_HASH_PRUNE_TRIGGER 50 /* trigger nm to prune the hash when list size is > this */
+#define OCFS_BH_SEM_HASH_PRUNE_MAX 100 /* nm will prune at most this many in one cycle */
+
+
+#ifndef O_DIRECT
+#warning this depends on the architecture!
+#define O_DIRECT 040000
+#endif
+
+#define NOT_MOUNTED_EXCLUSIVE (-1)
+
+
+#define BLOCKS_PER_CLEAN_LIST ( ((PAGE_SIZE-sizeof(void *))/sizeof(unsigned long)) >> 3 )
+
+#define IORUN_ALLOC_SIZE (OCFS_MAX_DATA_EXTENTS * sizeof (ocfs_io_runs))
+
+#ifndef _OCFSDEF_H_
+#define _OCFSDEF_H_
+
+/* sm - ocfs 1.0 fails to set fe->sig for dirs */
+#define IS_VALID_FILE_ENTRY(ptr) \
+ (!strcmp((ptr)->i_signature, OCFS_FILE_ENTRY_SIGNATURE))
+#define IS_VALID_EXTENT_HEADER(ptr) \
+ (!strcmp((ptr)->signature, OCFS_EXTENT_HEADER_SIGNATURE))
+
+#define IS_VALID_EXTENT_DATA(ptr) \
+ (!strcmp((ptr)->signature, OCFS_EXTENT_DATA_SIGNATURE))
+
+#define IS_VALID_NODE_NUM(node) \
+ (((node) >= 0) && ((node) < OCFS_MAXIMUM_NODES))
+
+
+#define CHECK_FOR_LAST_EXTENT(fileentry, k) \
+ do { \
+ for((k) = 0; (k) < OCFS_MAX_FILE_ENTRY_EXTENTS; (k)++) { \
+ if((fileentry)->extents[(k)].disk_off == 0) \
+ break; \
+ } \
+ (k) = ((k) >= 1) ? ((k) - 1) : (k); \
+ } while(0)
+
+#define down_with_flag(_sem, _flg) \
+ do { \
+ if (!_flg) { \
+ down (_sem); \
+ _flg = 1; \
+ } \
+ } while (0)
+
+#define up_with_flag(_sem, _flg) \
+ do { \
+ if (_flg) { \
+ up (_sem); \
+ _flg = 0; \
+ } \
+ } while (0)
+
+#define ocfs_task_interruptible(_o) ((_o)->dlm_task != current && signal_pending(current))
+
+/*
+** Macros
+*/
+#define OCFS_SET_FLAG(flag, value) ((flag) |= (value))
+#define OCFS_CLEAR_FLAG(flag, value) ((flag) &= ~(value))
+
+#define OCFS_SECTOR_ALIGN(buf) \
+ ((__u64)buf + \
+ (((__u64)buf % OCFS_SECTOR_SIZE) ? \
+ (OCFS_SECTOR_SIZE - ((__u64)buf % OCFS_SECTOR_SIZE)):0))
+
+/*
+** Structures...
+*/
+
+
+#define ocfs_malloc(size) \
+({ \
+ void *__ptr = kmalloc((size_t)(size), GFP_KERNEL); \
+ if (__ptr) \
+ memset(__ptr, 0, size); \
+ __ptr; \
+})
+#define ocfs_vmalloc(size) \
+({ \
+ void *__ptr = vmalloc((size_t)(size)); \
+ if (__ptr) \
+ memset(__ptr, 0, size); \
+ __ptr; \
+})
+
+
+
+typedef enum _ocfs_protocol
+{
+ OCFS_TCP = 1,
+ OCFS_UDP
+}
+ocfs_protocol;
+
+
+#define OCFS_IS_VALID_EXTENT(__ext, __typ) ({ \
+ int __ret = 0; \
+ switch (__typ) { \
+ case EXTENT_HEADER: \
+ if (IS_VALID_EXTENT_HEADER(__ext)) \
+ __ret = 1; \
+ break; \
+ case EXTENT_DATA: \
+ if (IS_VALID_EXTENT_DATA(__ext)) \
+ __ret = 1; \
+ break; \
+ } \
+ __ret; \
+})
+
+#define ocfs_allocate_extent_entry() (ocfs_extent *)kmem_cache_alloc ( \
+ OcfsGlobalCtxt.extent_cache, GFP_NOFS)
+#define ocfs_free_extent_entry(ext) kmem_cache_free(OcfsGlobalCtxt.extent_cache, ext)
+
+
+#define ocfs_allocate_file_entry() ((ocfs2_dinode *)({ \
+ ocfs2_dinode *FileEntry = NULL; \
+ FileEntry = kmem_cache_alloc (OcfsGlobalCtxt.fe_cache, GFP_NOFS); \
+ if (FileEntry != NULL) \
+ memset (FileEntry, 0, OCFS_SECTOR_SIZE); \
+ FileEntry; }))
+
+#define ocfs_release_file_entry(fe) \
+ do { \
+ if (fe) { \
+ kmem_cache_free (OcfsGlobalCtxt.fe_cache, fe); \
+ fe = NULL; \
+ } \
+ } while (0)
+
+#define OCFS_NAME "OCFS"
+
+/* ioctl commands */
+#define OCFS_IOC_MAGIC 'O'
+#define OCFS_IOC_GETTYPE _IOR(OCFS_IOC_MAGIC, 1, struct ocfs_ioc)
+
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
+typedef long sector_t;
+#define map_bh(bh, sb, blk) \
+ ({ \
+ bh->b_dev = sb->s_dev; \
+ bh->b_blocknr = blk; \
+ bh->b_state |= (1UL << BH_Mapped); \
+ })
+#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+typedef struct block_device * ocfs_blockdev;
+typedef dev_t ocfs_dev;
+#define OCFS_NODEV 0
+#define OCFS_GET_BLOCKDEV(sb) ((sb)->s_bdev)
+#else /* 2.4 kernel */
+typedef kdev_t ocfs_blockdev;
+typedef int ocfs_dev;
+#define OCFS_NODEV NODEV
+#define OCFS_GET_BLOCKDEV(sb) ((sb)->s_dev)
+#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+/* No longer exists in 2.5 */
+#define fsync_inode_buffers(inode) sync_mapping_buffers(inode->i_mapping)
+#define getblk(dev, blk, sz) __getblk(dev, blk, sz)
+#endif /* >= 2.6.0 */
+
+#define OCFS_SB(sb) ((ocfs_super *)OCFS_GENERIC_SB_MEMBER(sb))
+
+
+#define OCFS_MINOR_VERSION (0)
+#define OCFS_MAJOR_VERSION (2)
+#define OCFS_MINOR_VER_STRING "0"
+#define OCFS_MAJOR_VER_STRING "2"
+
+#define OCFS_VOLUME_SIGNATURE "OracleCFS"
+#define MAX_VOL_SIGNATURE_LEN 128
+#define MAX_MOUNT_POINT_LEN 128
+
+#define DLOCK_FLAG_OPEN_MAP (0x1)
+#define DLOCK_FLAG_LOCK (0x2)
+#define DLOCK_FLAG_SEQ_NUM (0x4)
+#define DLOCK_FLAG_MASTER (0x8)
+#define DLOCK_FLAG_LAST_UPDATE (0x10)
+#define DLOCK_FLAG_ADD_SELF (0x20)
+#define DLOCK_FLAG_ALL (DLOCK_FLAG_OPEN_MAP | DLOCK_FLAG_LOCK | \
+ DLOCK_FLAG_SEQ_NUM | DLOCK_FLAG_MASTER | \
+ DLOCK_FLAG_LAST_UPDATE)
+
+
+#define MAX_VOL_ID_LENGTH 16
+#define MAX_VOL_LABEL_LEN 64
+#define MAX_CLUSTER_NAME_LEN 64
+
+
+#define OCFS_IPC_DEFAULT_PORT 7001
+
+
+#define OCFS_IPC_DLM_VERSION 0x0201
+
+#define GUID_LEN 32
+#define HOSTID_LEN 20
+#define MACID_LEN 12
+
+#define MAX_NODE_NAME_LENGTH 32
+
+
+#define NODE_CONFIG_HDR_SIGN "NODECFG"
+#define NODE_CONFIG_SIGN_LEN 8
+#define NODE_CONFIG_VER 2
+#define NODE_MIN_SUPPORTED_VER 2
+
+
+/* =========================================================== */
+
+enum {
+ OCFS_BH_SEM_GOT_LOCK,
+ OCFS_BH_SEM_WAIT_ON_MODIFY,
+};
+
+typedef struct _ocfs_bh_sem
+{
+ struct semaphore s_sem;
+ struct list_head s_list;
+ unsigned long s_blocknr;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+ dev_t s_dev;
+#else
+ kdev_t s_dev;
+#endif
+ atomic_t s_refcnt;
+ struct buffer_head *s_bh;
+ wait_queue_head_t s_wait;
+ pid_t s_pid;
+#ifdef BH_SEM_DEBUG
+ char s_modifier[40];
+#endif
+} ocfs_bh_sem;
+
+
+typedef struct _ocfs_vol_disk_hdr // CLASS
+{
+ __u32 minor_version; // NUMBER RANGE(0,UINT_MAX)
+ __u32 major_version; // NUMBER RANGE(0,UINT_MAX)
+ __u8 signature[MAX_VOL_SIGNATURE_LEN]; // CHAR[MAX_VOL_SIGNATURE_LEN]
+ __u8 mount_point[MAX_MOUNT_POINT_LEN]; // CHAR[MAX_MOUNT_POINT_LEN]
+ __u64 serial_num; // NUMBER RANGE(0,ULONG_LONG_MAX)
+ /* Size of the device in bytes */
+ __u64 device_size; // NUMBER RANGE(0,ULONG_LONG_MAX)
+ /* Start of the volume... typically 0 */
+ __u64 start_off; // NUMBER RANGE(0,ULONG_LONG_MAX)
+ /* Offset to Volume Bitmap... */
+ __u64 bitmap_off; // NUMBER RANGE(0,ULONG_LONG_MAX)
+ /* Offset to the Publish Sector */
+ __u64 publ_off; // NUMBER RANGE(0,ULONG_LONG_MAX)
+ /* Offset to the Vote Sector */
+ __u64 vote_off; // NUMBER RANGE(0,ULONG_LONG_MAX)
+ __u64 root_bitmap_off; // NUMBER RANGE(0,ULONG_LONG_MAX)
+ __u64 data_start_off; // NUMBER RANGE(0,ULONG_LONG_MAX)
+ __u64 root_bitmap_size; // NUMBER RANGE(0,ULONG_LONG_MAX)
+ __u64 root_off; // NUMBER RANGE(0,ULONG_LONG_MAX)
+ __u64 root_size; // NUMBER RANGE(0,ULONG_LONG_MAX)
+ /* Cluster size as specified during format */
+ __u64 cluster_size; // CLUSTERSIZE
+ /* Max number of nodes.... OCFS_MAXIMUM_NODES */
+ __u64 num_nodes; // NUMBER RANGE(0,32)
+ /* Number of free clusters at format */
+ __u64 num_clusters; // NUMBER RANGE(0,ULONG_LONG_MAX)
+ /* OCFS_DEFAULT_DIR_NODE_SIZE */
+ __u64 dir_node_size; // NUMBER RANGE(0,ULONG_LONG_MAX)
+ /* OCFS_DEFAULT_FILE_NODE_SIZE */
+ __u64 file_node_size; // NUMBER RANGE(0,ULONG_LONG_MAX)
+ __u64 internal_off; // NUMBER RANGE(0,ULONG_LONG_MAX)
+ /* Offset to Node Config */
+ __u64 node_cfg_off; // NUMBER RANGE(0,ULONG_LONG_MAX)
+ /* Size of Node Config */
+ __u64 node_cfg_size; // NUMBER RANGE(0,ULONG_LONG_MAX)
+ /* Offset to Node Config Lock */
+ __u64 new_cfg_off; // NUMBER RANGE(0,ULONG_LONG_MAX)
+ __u32 prot_bits; // PERMS
+ __s32 excl_mount; // NODENUM
+}
+ocfs_vol_disk_hdr; // END CLASS
+
+
+typedef struct _ocfs_disk_lock
+{
+/*00*/ __u32 curr_master; /* Node number of current master */
+ __u8 file_lock; /* Lock level */
+ __u8 odl_pad[3]; /* Pad to u64 */
+ __u64 dlock_seq_num; /* Lock transaction seqnum */
+/*10*/ __u32 oin_node_map[8]; /* Bitmap of interested nodes, was __u32 */
+/*30*/
+}
+ocfs_disk_lock;
+
+typedef struct _ocfs_vol_label // CLASS
+{
+ ocfs_disk_lock disk_lock; // DISKLOCK
+ __u8 label[MAX_VOL_LABEL_LEN]; // CHAR[MAX_VOL_LABEL_LEN]
+ __u16 label_len; // NUMBER RANGE(0,MAX_VOL_LABEL_LEN)
+ __u8 vol_id[MAX_VOL_ID_LENGTH]; // HEX[MAX_VOL_ID_LENGTH]
+ __u16 vol_id_len; // NUMBER RANGE(0,MAX_VOL_ID_LENGTH)
+ __u8 cluster_name[MAX_CLUSTER_NAME_LEN]; // CHAR[MAX_CLUSTER_NAME_LEN]
+ __u16 cluster_name_len; // NUMBER RANGE(0,MAX_CLUSTER_NAME_LEN)
+}
+ocfs_vol_label; // END CLASS
+
+typedef struct _ocfs_ipc_config_info // CLASS
+{
+ __u8 type; // NUMBER RANGE(0, 255)
+ __u8 ip_addr[MAX_IP_ADDR_LEN+1]; // CHAR[MAX_IP_ADDR_LEN+1]
+ __u32 ip_port; // NUMBER RANGE(0,ULONG_MAX)
+ __u8 ip_mask[MAX_IP_ADDR_LEN+1]; // CHAR[MAX_IP_ADDR_LEN+1]
+}
+ocfs_ipc_config_info; // END CLASS
+/* TODO this structure will break in 64-bit.... need to pack */
+typedef union _ocfs_guid // CLASS
+{
+ struct
+ {
+ char host_id[HOSTID_LEN];
+ char mac_id[MACID_LEN];
+ } id;
+ __u8 guid[GUID_LEN]; // CHAR[GUID_LEN]
+}
+ocfs_guid; // END CLASS
+
+typedef struct _ocfs_node_config_info // CLASS
+{
+ ocfs_disk_lock disk_lock; // DISKLOCK
+ __u8 node_name[MAX_NODE_NAME_LENGTH+1]; // CHAR[MAX_NODE_NAME_LENGTH+1]
+ ocfs_guid guid; // GUID
+ ocfs_ipc_config_info ipc_config; // IPCONFIG
+}
+ocfs_node_config_info; // END CLASS
+
+typedef struct _ocfs_node_config_hdr // CLASS
+{
+ ocfs_disk_lock disk_lock; // DISKLOCK
+ __u8 signature[NODE_CONFIG_SIGN_LEN]; // CHAR[NODE_CONFIG_SIGN_LEN]
+ __u32 version; // NUMBER RANGE(0,ULONG_MAX)
+ __u32 num_nodes; // NUMBER RANGE(0,32)
+ __u32 last_node; // NUMBER RANGE(0,32)
+ __u32 onch_pad; // UNUSED
+ __u64 cfg_seq_num; // NUMBER RANGE(0,ULONG_LONG_MAX)
+}
+ocfs_node_config_hdr; // END CLASS
+
+typedef struct _BARF_BARF_BARF
+{
+ char node_name[MAX_NODE_NAME_LENGTH];
+ ocfs_guid guid;
+ ocfs_ipc_config_info ipc_config;
+}
+BARF_BARF_BARF;
+
+typedef struct _ocfs_extent
+{
+ struct list_head list;
+ __s64 virtual;
+ __s64 physical;
+ __s64 sectors;
+}
+ocfs_extent;
+
+typedef struct _ocfs_extent_map
+{
+ spinlock_t lock;
+ __u32 count;
+ int initialized;
+ struct list_head head;
+ __u32 next_idx;
+ struct list_head *next_ptr;
+}
+ocfs_extent_map;
+
+typedef struct _alloc_item
+{
+ enum { SLAB_ITEM, KMALLOC_ITEM, VMALLOC_ITEM } type;
+ void *address;
+ union {
+ int length;
+ void *slab;
+ } u;
+ struct list_head list;
+ char tag[30];
+}
+alloc_item;
+
+typedef struct _ocfs_obj_id
+{
+ __u32 type; /* 4 byte signature to uniquely identify the struct */
+ __u32 size; /* sizeof the struct */
+}
+ocfs_obj_id;
+
+typedef struct _ocfs_filldir
+{
+ __u8 fname[OCFS_MAX_FILENAME_LENGTH];
+ loff_t pos;
+ __u32 ino;
+} ocfs_filldir;
+
+/**************************************************************************
+** Each file open instance is represented by a context control block.
+** For each successful create/open request; a file object and a ocfs_file will
+** be created.
+** For open operations performed internally by the FSD, there may not
+** exist file objects; but a ocfs_file will definitely be created.
+** This structure must be quad-word aligned because it is zone allocated.
+**************************************************************************/
+typedef struct _ocfs_file
+{
+ ocfs_obj_id obj_id;
+ __u64 curr_byte_off;
+ __s64 curr_dir_off;
+ struct buffer_head **curr_dir_buf;
+ ocfs_filldir filldir;
+}
+ocfs_file;
+
+typedef struct _ocfs_super ocfs_super;
+typedef struct _ocfs_io_runs ocfs_io_runs;
+typedef struct _ocfs_lock_res ocfs_lock_res;
+
+/* this limits us to 256 nodes
+ * if we need more, we can do a kmalloc for the map */
+#define OCFS_NODE_MAP_MAX_NODES 256
+typedef struct _ocfs_node_map
+{
+ __u32 num_nodes;
+ unsigned long map[BITS_TO_LONGS(OCFS_NODE_MAP_MAX_NODES)];
+} ocfs_node_map;
+
+
+
+/* XXX: fields that can go if we move this to the inode private */
+struct _ocfs_lock_res
+{
+ __u32 master_node_num; /* Master Node */
+ __u32 lock_state;
+ __u32 lock_holders;
+ __u8 in_use;
+ __u8 lock_type;
+ int thread_id; // XXX
+ atomic_t lr_ref_cnt; /* When 0, freed */ // XXX
+ spinlock_t lock_mutex; // XXX
+ __u32 readonly_node;
+ ocfs_node_map readonly_map;
+ ocfs_node_map oin_openmap;
+ __u64 last_upd_seq_num;
+};
+
+/* OCFS2 Inode Private Data
+ *
+ * feoff/voteoff can change during rename. Luckily, rename takes a ton
+ * of locks and does several checks, so you're safe reading these values
+ * if any of the following is true:
+ * 1) you have i_sem
+ * 2) you have priv_sem
+ * 3) open_hndl_cnt > 0
+ */
+typedef struct _ocfs_inode_private
+{
+ /* always valid, just a simple back pointer. */
+ struct inode *inode;
+
+ __u64 feoff;
+
+ /* These fields are protected by priv_sem */
+ struct semaphore priv_sem;
+ __u32 open_hndl_cnt;
+ int needs_verification;
+ __u64 chng_seq_num;
+ ocfs_extent_map map;
+ __s64 alloc_size;
+ __u32 oin_flags;
+
+ /* inode_extend_sem locks out extends on behalf of other nodes. */
+ struct semaphore inode_extend_sem;
+
+ struct list_head recovery_list; /* protected by recovery_list_sem */
+ __u32 num_extends; /* protected by oin_num_ext_lock */
+
+ atomic_t i_clean_buffer_seq;
+ __u32 flags; /* see below */
+
+ /* stolen right off of ocfs2_dinode */
+ union {
+ __u64 fe_private;
+ __u64 child_dirnode;
+ struct _ip_bitinfo {
+ __u32 used_bits;
+ __u32 total_bits;
+ } ip_bitinfo;
+ } u;
+
+ ocfs_lock_res i_lockres;
+ __u32 i_dir_start_lookup;
+
+ struct list_head handle_list;
+} ocfs_inode_private;
+
+/* Eventually, the 'flags' and 'oin_flags' fields need to be
+ * merged. */
+/* oin_flags flags */
+#define OCFS_OIN_DIRECTORY (0x00000002)
+#define OCFS_OIN_DELETE_ON_CLOSE (0x00000008)
+#define OCFS_OIN_NEEDS_DELETION (0x00000010)
+#define OCFS_OIN_OPEN_FOR_DIRECTIO (0x00000100)
+#define OCFS_OIN_OPEN_FOR_WRITE (0x00000200)
+
+/* 'flags' flags. */
+/* has this inode been deleted, either from this node or from another node. */
+#define OCFS_INODE_DELETED 0x00000001
+/* is this the journal inode? */
+#define OCFS_INODE_JOURNAL 0x00000002
+/* set on init_private, cleared on clear_inode */
+#define OCFS_INODE_INITIALIZED 0x00000004
+/* is this a system file? */
+#define OCFS_INODE_SYSTEM_FILE 0x00000008
+
+#define OCFS_I(i) ((ocfs_inode_private *)(i->u.generic_ip))
+
+#define DISK_LOCK(x) ((ocfs_disk_lock *)&(x)->disk_lock)
+
+#define GET_INODE_CLEAN_SEQ(i) (atomic_t *)(&(OCFS_I(i)->i_clean_buffer_seq))
+
+
+#define INODE_DELETED(i) (OCFS_I(i)->flags & OCFS_INODE_DELETED)
+#define SET_INODE_DELETED(i) (OCFS_I(i)->flags |= OCFS_INODE_DELETED)
+#define CLEAR_INODE_DELETED(i) (OCFS_I(i)->flags &= (~OCFS_INODE_DELETED))
+
+#define INODE_JOURNAL(i) (OCFS_I(i)->flags & OCFS_INODE_JOURNAL)
+#define SET_INODE_JOURNAL(i) (OCFS_I(i)->flags |= OCFS_INODE_JOURNAL)
+#define CLEAR_INODE_JOURNAL(i) (OCFS_I(i)->flags &= (~OCFS_INODE_JOURNAL))
+
+#define SET_INODE_FEOFF(i,o) \
+do { \
+ OCFS_I(i)->feoff = o; \
+} while (0)
+
+#define GET_INODE_FEOFF(i) OCFS_I(i)->feoff
+
+
+#warning take this out when all the lockres stuff checks out
+#define GET_INODE_LOCKRES(i) ({ if (i==NULL) BUG(); (&(OCFS_I(i)->i_lockres)); })
+
+typedef enum _ocfs_vol_state
+{
+ VOLUME_DISABLED,
+ VOLUME_INIT,
+ VOLUME_ENABLED,
+ VOLUME_LOCKED,
+ VOLUME_IN_RECOVERY,
+ VOLUME_MOUNTED,
+ VOLUME_BEING_DISMOUNTED,
+ VOLUME_DISMOUNTED
+}
+ocfs_vol_state;
+
+typedef struct _ocfs_vol_layout
+{
+ __u64 start_off;
+ __u32 num_nodes;
+ __u32 cluster_size;
+ __u8 mount_point[MAX_MOUNT_POINT_LEN];
+ __u8 vol_id[MAX_VOL_ID_LENGTH];
+ __u8 label[MAX_VOL_LABEL_LEN];
+ __u32 label_len;
+ __u64 size;
+ __u64 root_start_off;
+ __u64 serial_num;
+ __u64 root_size;
+ __u64 publ_sect_off;
+ __u64 vote_sect_off;
+ __u64 root_bitmap_off;
+ __u64 root_bitmap_size;
+ __u64 data_start_off;
+ __u64 num_clusters;
+ __u64 root_int_off;
+ __u64 dir_node_size;
+ __u64 file_node_size;
+ __u64 bitmap_off;
+ __u64 node_cfg_off;
+ __u64 node_cfg_size;
+ __u64 new_cfg_off;
+ __u32 prot_bits;
+}
+ocfs_vol_layout;
+
+typedef struct _ocfs_vol_node_map
+{
+ __u64 time;
+ __u32 miss_cnt;
+ atomic_t dismount;
+}
+ocfs_vol_node_map;
+
+struct _ocfs_bitmap_free_head;
+
+typedef struct _ocfs_inode_hash {
+ spinlock_t lock; /* protects the whole hash */
+ int size; /* number of lists in the hash */
+ unsigned int num_ents; /* global number of offsets in there */
+ struct list_head *hash;
+} ocfs_inode_hash;
+
+typedef struct _ocfs_inode_num {
+ enum {
+ INUM_UNBOUND = 0, /* unbound to an inode*/
+ INUM_BOUND /* we have an inode attached. */
+ } i_state;
+ struct list_head i_list;
+ unsigned long i_ino;
+ __u64 i_feoff; /* used only for directory inodes,
+ * points to parent fe of
+ * dirnode. for files i_voteoff == i_feoff,
+ * for root directory this is 0 */
+ struct inode *i_inode; /* may be null! */
+} ocfs_inode_num;
+
+typedef struct _ocfs_commit_task
+{
+ struct completion c_complete;
+ struct task_struct *c_task;
+ struct semaphore c_lock;
+ struct list_head c_list;
+} ocfs_commit_task;
+
+typedef struct _ocfs_dlm_stats
+{
+ atomic_t total;
+ atomic_t okay;
+ atomic_t etimedout;
+ atomic_t efail;
+ atomic_t eagain;
+ atomic_t enoent;
+ atomic_t def;
+}
+ocfs_dlm_stats;
+
+typedef struct _ocfs_alloc_stats
+{
+ atomic_t moves;
+ atomic_t local_data;
+ atomic_t bitmap_data;
+ atomic_t bitmap_meta;
+ atomic_t dir_allocs;
+ atomic_t dir_extends;
+ atomic_t ext_allocs;
+ atomic_t ext_extends;
+} ocfs_alloc_stats;
+
+enum {
+ GLOBAL_BITMAP_SYSTEM_INODE = 0,
+ GLOBAL_INODE_ALLOC_SYSTEM_INODE,
+ PUBLISH_SYSTEM_INODE,
+ VOTE_SYSTEM_INODE,
+ AUTOCONFIG_SYSTEM_INODE,
+ EXTENT_ALLOC_SYSTEM_INODE,
+ EXTENT_ALLOC_BITMAP_SYSTEM_INODE,
+ INODE_ALLOC_SYSTEM_INODE,
+ INODE_ALLOC_BITMAP_SYSTEM_INODE,
+ JOURNAL_SYSTEM_INODE,
+ NUM_SYSTEM_INODES
+};
+
+extern char *system_file_names[];
+
+
+struct _ocfs_journal;
+
+/*
+ * ocfs_super
+ *
+ * A mounted volume is represented using the following structure.
+ */
+struct _ocfs_super
+{
+ ocfs_obj_id obj_id;
+ struct semaphore osb_res; /* resource to protect the ocfs_super */
+ struct list_head osb_next; /* list of ocfs_super(s) */
+ __u32 osb_id; /* id used by the proc interface */
+ struct completion dlm_complete;
+ struct task_struct *dlm_task;
+ ocfs_commit_task *commit;
+ __u32 osb_flags;
+ __s64 file_open_cnt; /* num of open files/dirs. vol cannot be dismounted if > 0 */
+ ocfs_node_map publ_map;
+ struct list_head cache_lock_list;
+ struct super_block *sb;
+ struct inode *root_inode;
+ struct inode *sys_root_inode;
+ struct inode *system_inodes[NUM_SYSTEM_INODES];
+ ocfs_vol_layout vol_layout;
+ ocfs_vol_node_map *vol_node_map;
+ struct semaphore cfg_lock;
+ BARF_BARF_BARF **node_cfg_info;
+ __u64 cfg_seq_num;
+ int cfg_initialized;
+ __u32 max_nodes;
+ __u32 num_cfg_nodes;
+ __u32 node_num;
+ int reclaim_id; /* reclaim the original node number*/
+ __u32 hbt;
+ __u32 sect_size;
+ __u32 sect_size_bits;
+ unsigned long s_clustersize;
+ int s_clustersize_bits;
+ __u32 dir_alloc_bits;
+ __u32 file_alloc_bits;
+ __u32 inode_alloc_bits;
+ __u32 inode_size;
+ int needs_flush;
+
+ ocfs_alloc_bm cluster_bitmap;
+ __u32 max_dir_node_ent;
+ ocfs_vol_state vol_state;
+ struct semaphore recovery_lock;
+ spinlock_t recovery_map_lock;
+ ocfs_node_map recovery_map;
+ int disable_recovery;
+ atomic_t num_recovery_threads;
+ struct timer_list lock_timer;
+ atomic_t lock_stop;
+ wait_queue_head_t lock_event;
+ atomic_t lock_event_woken;
+ struct semaphore comm_lock; /* protects ocfs_comm_process_vote_reply */
+ atomic_t nm_init;
+ wait_queue_head_t nm_init_event;
+ __u32 prealloc_lock;
+ struct buffer_head **cfg_bhs;
+ __u32 cfg_len;
+ __u32 cfg_numblocks;
+ struct semaphore publish_lock; /* protects r/w to publish sector */
+ atomic_t node_req_vote; /* set when node's vote req pending */
+ struct semaphore trans_lock; /* serializes transactions */
+ int publish_dirty;
+ struct list_head needs_flush_head;
+ wait_queue_head_t flush_event;
+ atomic_t flush_event_woken;
+ struct _ocfs_journal *journal;
+ atomic_t clean_buffer_seq;
+ spinlock_t clean_buffer_lock;
+ struct list_head *lock_recovery_lists;
+ __u64 *last_publ_seq_num;
+ int have_local_alloc;
+ struct buffer_head *local_alloc_bh;
+ /* Protects local alloc */
+ struct semaphore local_alloc_sem;
+ ocfs_inode_hash inode_hash;
+ struct semaphore extend_sem;
+ __u8 check_mounted; /* tell nm to check mounted flag, protected by publish_lock*/
+ ocfs_dlm_stats net_reqst_stats; /* stats of netdlm vote requests */
+ ocfs_dlm_stats net_reply_stats; /* stats of netdlm vote reponses */
+ ocfs_dlm_stats dsk_reqst_stats; /* stats of diskdlm vote requests */
+ ocfs_dlm_stats dsk_reply_stats; /* stats of diskdlm vote reponses */
+ ocfs_alloc_stats alloc_stats;
+ char dev_str[20]; /* "major,minor" of the device */
+ struct semaphore vote_sem; /* protects calls to ocfs_process_vote */
+ struct list_head vote_obj_queue;
+ spinlock_t vote_obj_queue_lock;
+};
+
+typedef struct _ocfs_comm_info
+{
+ __u32 type;
+ char *ip_addr;
+ __u32 ip_port;
+ char *ip_mask;
+}
+ocfs_comm_info;
+
+typedef struct _ocfs_global_ctxt
+{
+ ocfs_obj_id obj_id;
+ struct semaphore global_res;
+ struct list_head osb_next; /* List of all volumes */
+ kmem_cache_t *inode_cache;
+ kmem_cache_t *fe_cache;
+ kmem_cache_t *extent_cache;
+ kmem_cache_t *bh_sem_cache;
+ __u32 flags;
+ __u32 pref_node_num; /* preferred... osb has the real one */
+ ocfs_guid guid; /* uniquely identifies a node */
+ char *node_name; /* human readable node identification */
+ char *cluster_name; /* unused */
+ ocfs_comm_info comm_info; /* ip address, etc for listener */
+ int comm_info_read; /* ipc info loaded from config file */
+ spinlock_t comm_seq_lock; /* protects comm_seq_num */
+ __u64 comm_seq_num; /* local node seq num used in ipcdlm */
+ struct list_head *bh_sem_hash;
+ spinlock_t bh_sem_hash_lock;
+ int bh_sem_hash_sz;
+ atomic_t bh_sem_hash_target_bucket;
+ atomic_t bh_sem_hash_num_iters;
+ ocfs_dlm_stats net_reqst_stats; /* stats of netdlm vote requests */
+ ocfs_dlm_stats net_reply_stats; /* stats of netdlm vote reponses */
+ ocfs_dlm_stats dsk_reqst_stats; /* stats of diskdlm vote requests */
+ ocfs_dlm_stats dsk_reply_stats; /* stats of diskdlm vote reponses */
+}
+ocfs_global_ctxt;
+
+struct _ocfs_io_runs
+{
+ __u64 disk_off;
+ __u32 offset;
+ __u32 byte_cnt;
+};
+
+typedef struct _ocfs_ipc_ctxt
+{
+ __u32 dlm_msg_size;
+ __u16 version;
+ int init;
+ struct socket *send_sock;
+ struct socket *recv_sock;
+ struct completion complete;
+ struct task_struct *task;
+}
+ocfs_ipc_ctxt;
+
+
+extern ocfs_ipc_ctxt OcfsIpcCtxt;
+
+typedef struct _ocfs_ipc_dlm_config
+{
+ __u16 version;
+ __u32 msg_size;
+ __u32 num_recv_threads;
+}
+ocfs_ipc_dlm_config;
+
+/*
+** Globals ...
+*/
+extern ocfs_global_ctxt OcfsGlobalCtxt;
+
+typedef struct _ocfs_extent_rec {
+/*00*/ __u32 e_cpos; /* Offset into the file, in clusters */
+ __u32 e_clusters; /* Clusters covered by this extent */
+ __u64 e_blkno; /* Physical disk offset, in blocks */
+/*10*/
+} ocfs_extent_rec;
+
+typedef struct _ocfs_publish // CLASS
+{
+ __u64 time; // NUMBER RANGE(0,ULONG_LONG_MAX)
+ __s32 vote; // BOOL
+ __u32 dirty; // BOOL
+ __u32 vote_type; // FILEFLAG
+ __u32 mounted; /* used for journaling */
+ __u32 reserved1[8]; // this is now used as the vote_map !!!!! was __u8[32]
+ __u64 vote_map; // NODEBITMAP this is now unused!!!!
+ __u64 publ_seq_num; // NUMBER RANGE(0,ULONG_LONG_MAX)
+ __u64 lock_id; // NUMBER RANGE(0,ULONG_LONG_MAX)
+ /* last seq num used in comm voting */
+ __u64 comm_seq_num; // NUMBER RANGE(0,ULONG_LONG_MAX)
+ __u64 fe_off; /* needed to create inodes. */
+} ocfs_publish; // END CLASS
+
+typedef struct _ocfs_vote // CLASS
+{
+ __u8 type;
+ __u8 node;
+ __u8 reserved1[30]; // used to be vote[32]
+ __u64 vote_seq_num; // NUMBER RANGE(0,ULONG_LONG_MAX)
+ __u64 lock_id; // NUMBER RANGE(0,ULONG_LONG_MAX)
+ __u8 open_handle; // BOOL
+ __u8 ov_pad[7]; // UNUSED
+} ocfs_vote; // END CLASS
+
+typedef struct _ocfs_local_alloc
+{
+ ocfs_disk_lock disk_lock;
+ __u8 signature[8]; /* "LCLBMP" */
+ __u32 alloc_size; /* num bits taken from main bitmap */
+ __u32 num_used; /* num bits used (is this needed?) */
+ __u32 bitmap_start; /* starting bit offset in main bitmap */
+ __u32 node_num; /* which node owns me */
+ __u64 this_sector; /* disk offset of this structure */
+ __u8 padding[176]; /* pad out to 256 */
+ __u8 bitmap[256];
+}
+ocfs_local_alloc;
+
+/*
+ * On disk file entry (inode) for OCFS v2
+ */
+typedef struct _ocfs2_dinode {
+/*00*/ __u8 i_signature[8]; /* Signature for validation */
+ __u32 i_generation; /* Generation number */
+ __u32 i_suballoc_node; /* Node suballocater this inode
+ belongs to */
+/*10*/ __u64 i_suballoc_blkno; /* Node suballocator offset
+ (in blocks) */
+/*18*/ ocfs_disk_lock disk_lock; /* Lock structure */
+/*38*/ __u32 i_uid; /* Owner UID */
+ __u32 i_gid; /* Owning GID */
+/*40*/ __u64 i_size; /* Size in bytes */
+ __u16 i_mode; /* File mode */
+ __u16 i_links_count; /* Links count */
+ __u32 i_flags; /* File flags */
+/*50*/ __u64 i_atime; /* Access time */
+ __u64 i_ctime; /* Creation time */
+/*60*/ __u64 i_mtime; /* Modification time */
+ __u64 i_dtime; /* Deletion time */
+/*70*/ __u64 i_blkno; /* Offset on disk, in blocks */
+ __u32 i_clusters; /* Cluster count */
+ __u32 i_reserved1;
+/*80*/ union {
+ __u64 fe_private;
+ __u64 i_rdev;
+ struct _bitinfo {
+ __u32 used_bits;
+ __u32 total_bits;
+ } bitinfo;
+ } u;
+/*98*/ __s16 i_tree_depth; /* Extent tree depth
+ * -1 means data extents hang
+ * directly off of the
+ * file_entry.
+ */
+ __u16 i_next_free_ext; /* Next unused extent slot */
+ __u32 i_reserved3;
+/*A0*/ __u64 last_ext_ptr; /* Pointer to last extdat */
+/*A8*/ ocfs_extent_rec extents[OCFS_MAX_FILE_ENTRY_EXTENTS]; // EXTENT[OCFS_MAX_FILE_ENTRY_EXTENTS]
+} ocfs2_dinode;
+
+typedef struct _ocfs_extent_group // CLASS
+{
+ __u8 signature[8]; // CHAR ARRAY[8]
+ /* 0 when init, -1 when full */
+ __s32 next_free_ext; // NUMBER RANGE(-1,LONG_MAX)
+ /* Currently available sector for use */
+ __u32 curr_sect; // NUMBER RANGE(0,ULONG_MAX)
+ /* Maximum Number of Sectors */
+ __u32 max_sects; // NUMBER RANGE(0,ULONG_MAX)
+ /* Type of this sector... either */
+ __u32 type; // EXTENTTYPE
+ /* Number of leaf levels */
+ __s32 granularity; // NUMBER RANGE(-1,LONG_MAX)
+ __u32 alloc_node; // NODENUM
+ __u64 this_ext; // DISKPTR
+ __u64 next_data_ext; // DISKPTR
+ __u64 alloc_file_off; // DISKPTR
+ __u64 last_ext_ptr; // DISKPTR
+ __u64 up_hdr_node_ptr; // DISKPTR
+ ocfs_extent_rec extents[OCFS_MAX_DATA_EXTENTS]; // EXTENT[OCFS_MAX_DATA_EXTENTS]
+}
+ocfs_extent_group; // END CLASS
+
+typedef struct _ocfs_dlm_msg_hdr
+{
+ __u64 lock_id;
+ __u64 lock_seq_num;
+ __u32 flags;
+ __u8 open_handle;
+ __u8 odmh_pad[3];
+} ocfs_dlm_msg_hdr;
+
+typedef ocfs_dlm_msg_hdr ocfs_dlm_req_master;
+typedef ocfs_dlm_msg_hdr ocfs_dlm_disk_vote_req;
+
+typedef struct _ocfs_dlm_reply_master
+{
+ ocfs_dlm_msg_hdr h;
+ __u32 status;
+}
+ocfs_dlm_reply_master;
+
+typedef struct _ocfs_dlm_disk_vote_reply
+{
+ ocfs_dlm_msg_hdr h;
+ __u32 status;
+}
+ocfs_dlm_disk_vote_reply;
+
+typedef struct _ocfs_dlm_msg
+{
+ __u32 magic;
+ __u32 msg_len;
+ __u8 vol_id[MAX_VOL_ID_LENGTH];
+ __u32 src_node;
+ __u32 dst_node;
+ __u32 msg_type;
+ __u32 check_sum;
+ __u8 msg_buf[0];
+} ocfs_dlm_msg;
+
+typedef struct _ocfs_vote_obj
+{
+ struct list_head list;
+ wait_queue_head_t voted_event;
+ atomic_t voted_event_woken;
+ atomic_t refcount;
+ spinlock_t lock;
+ __u32 vote_state;
+ __u32 req_lock_type;
+ __u32 vote_status;
+ ocfs_node_map req_vote_map;
+ ocfs_node_map got_vote_map;
+ ocfs_node_map tmp_openmap;
+ __u64 seq_num;
+ pid_t pid;
+ ocfs_dlm_msg m;
+} ocfs_vote_obj;
+
+enum {
+ VOTE_OBJ_STATE_UNSENT,
+ VOTE_OBJ_STATE_SENT,
+ VOTE_OBJ_STATE_PARTIAL_REPLY,
+ VOTE_OBJ_STATE_FULL_REPLY,
+ VOTE_OBJ_STATE_DESTROYING
+};
+
+
+
+typedef struct _ocfs_vote_obj_lookup_data ocfs_vote_obj_lookup_data;
+
+struct _ocfs_vote_obj_lookup_data
+{
+ union {
+ struct {
+ __u64 seq_num;
+ __u64 lock_id;
+ } s;
+ struct {
+ char *page;
+ int *len;
+ int max;
+ } proc;
+ } u;
+ int (*func) (ocfs_vote_obj *obj, struct _ocfs_vote_obj_lookup_data *data);
+ ocfs_vote_obj **ret;
+};
+
+
+
+
+typedef struct _ocfs_recv_ctxt
+{
+ __s32 msg_len;
+ __u8 msg[OCFS_MAX_DLM_PKT_SIZE];
+ int status;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+ struct work_struct ipc_wq;
+#else
+ struct tq_struct ipc_tq;
+#endif
+}
+ocfs_recv_ctxt;
+
+typedef struct _ocfs_cfg_task
+{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+ struct work_struct cfg_wq;
+#else
+ struct tq_struct cfg_tq;
+#endif
+ ocfs_super *osb;
+ __u64 lock_off;
+ __u8 *buffer;
+ struct buffer_head *bh;
+}
+ocfs_cfg_task;
+
+typedef enum _ocfs_volcfg_op
+{
+ OCFS_VOLCFG_ADD,
+ OCFS_VOLCFG_UPD
+}
+ocfs_volcfg_op;
+
+typedef struct _ocfs_vote_request_ctxt
+{
+ int request_method;
+ __u32 node_num;
+ int status;
+ union {
+ ocfs_dlm_msg *dlm_msg;
+ ocfs_publish *publish;
+ } u;
+} ocfs_vote_request_ctxt;
+
+typedef struct _ocfs_vote_reply_ctxt
+{
+ int reply_method;
+ int *status;
+ ocfs_node_map *got_vote_map;
+ ocfs_node_map *open_map;
+ __u32 flags;
+ union {
+ ocfs_dlm_reply_master *reply;
+ ocfs_vote *vote;
+ } u;
+} ocfs_vote_reply_ctxt;
+
+
+/* these three used as 'type' in ocfs_bitmap_update */
+#if 0
+#define DISK_ALLOC_DIR_NODE 1
+#endif
+#define DISK_ALLOC_EXTENT_NODE 2
+#define DISK_ALLOC_VOLUME 3
+#define DISK_ALLOC_INODE 4
+
+/* a bitmap update, currently used for freeing bits */
+typedef struct ocfs_bitmap_update
+{
+ __u64 length;
+ __u64 file_off;
+ __u32 type;
+ __u32 node_num;
+}
+ocfs_bitmap_update;
+
+#define FREE_LOG_SIZE 150
+
+typedef struct _ocfs_free_rec
+{
+ __u32 num_updates;
+ struct list_head log_list;
+ ocfs_bitmap_update update[FREE_LOG_SIZE];
+}
+ocfs_free_rec;
+
+typedef struct _ocfs_bitmap_free_head
+{
+ __u32 num_logs;
+ struct _ocfs_free_rec *tail;
+ struct list_head free_logs;
+}
+ocfs_bitmap_free_head;
+
+
+struct ocfs_ioc
+{
+ char name[255]; /* "OCFS" */
+ char version[255]; /* version */
+ __u16 nodenum; /* node number */
+ char nodename[255]; /* node name */
+};
+
+/*
+ * ocfs directory file types. Only the low 3 bits are used. The
+ * other bits are reserved for now.
+ */
+#define OCFS_FT_UNKNOWN 0
+#define OCFS_FT_REG_FILE 1
+#define OCFS_FT_DIR 2
+#define OCFS_FT_CHRDEV 3
+#define OCFS_FT_BLKDEV 4
+#define OCFS_FT_FIFO 5
+#define OCFS_FT_SOCK 6
+#define OCFS_FT_SYMLINK 7
+
+#define OCFS_FT_MAX 8
+
+/*
+ * OCFS_DIR_PAD defines the directory entries boundaries
+ *
+ * NOTE: It must be a multiple of 4
+ */
+#define OCFS_DIR_PAD 4
+#define OCFS_DIR_ROUND (OCFS_DIR_PAD - 1)
+#define OCFS_DIR_REC_LEN(name_len) (((name_len) + 12 + OCFS_DIR_ROUND) & \
+ ~OCFS_DIR_ROUND)
+#define OCFS_LINK_MAX 32000
+
+
+struct ocfs2_dir_entry {
+ __u64 inode; /* Inode number */
+ __u16 rec_len; /* Directory entry length */
+ __u8 name_len; /* Name length */
+ __u8 file_type;
+ char name[OCFS_MAX_FILENAME_LENGTH]; /* File name */
+};
+
+#define S_SHIFT 12
+static unsigned char ocfs_type_by_mode[S_IFMT >> S_SHIFT] = {
+ [S_IFREG >> S_SHIFT] OCFS_FT_REG_FILE,
+ [S_IFDIR >> S_SHIFT] OCFS_FT_DIR,
+ [S_IFCHR >> S_SHIFT] OCFS_FT_CHRDEV,
+ [S_IFBLK >> S_SHIFT] OCFS_FT_BLKDEV,
+ [S_IFIFO >> S_SHIFT] OCFS_FT_FIFO,
+ [S_IFSOCK >> S_SHIFT] OCFS_FT_SOCK,
+ [S_IFLNK >> S_SHIFT] OCFS_FT_SYMLINK,
+};
+
+
+typedef struct _ocfs_find_inode_args
+{
+ __u64 feoff;
+ struct buffer_head *fe_bh;
+ unsigned long ino;
+ __u32 flags;
+} ocfs_find_inode_args;
+
+#define OCFS_FIND_INODE_FLAG_SYSFILE 0x00000002
+
+/* timeout structure taken from Ben's aio.c */
+typedef struct _ocfs_timeout {
+ struct timer_list timer;
+ int timed_out;
+ wait_queue_head_t wait;
+} ocfs_timeout;
+
+#define NAMEI_RA_CHUNKS 2
+#define NAMEI_RA_BLOCKS 4
+#define NAMEI_RA_SIZE (NAMEI_RA_CHUNKS * NAMEI_RA_BLOCKS)
+#define NAMEI_RA_INDEX(c,b) (((c) * NAMEI_RA_BLOCKS) + (b))
+
+
+#define __ocfs_wait(wq, condition, timeo, ret) \
+do { \
+ ocfs_timeout __to; \
+ \
+ DECLARE_WAITQUEUE(__wait, current); \
+ DECLARE_WAITQUEUE(__to_wait, current); \
+ \
+ ocfs_init_timeout(&__to); \
+ \
+ if (timeo) { \
+ ocfs_set_timeout(&__to, timeo); \
+ if (__to.timed_out) { \
+ ocfs_clear_timeout(&__to); \
+ } \
+ } \
+ \
+ add_wait_queue(&wq, &__wait); \
+ add_wait_queue(&__to.wait, &__to_wait); \
+ do { \
+ ret = 0; \
+ set_current_state(TASK_INTERRUPTIBLE); \
+ if (condition) \
+ break; \
+ ret = -ETIMEDOUT; \
+ if (__to.timed_out) \
+ break; \
+ schedule(); \
+ if (signal_pending(current)) { \
+ ret = -EINTR; \
+ break; \
+ } \
+ } while (1); \
+ \
+ set_current_state(TASK_RUNNING); \
+ remove_wait_queue(&wq, &__wait); \
+ remove_wait_queue(&__to.wait, &__to_wait); \
+ \
+ if (timeo) \
+ ocfs_clear_timeout(&__to); \
+ \
+} while(0)
+
+#define ocfs_wait(wq, condition, timeout) \
+({ \
+ int __ret = 0; \
+ if (!(condition)) \
+ __ocfs_wait(wq, condition, timeout, __ret); \
+ __ret; \
+})
+#endif /* !USERSPACE_TOOL */
+
+
+
+static inline unsigned long ino_from_fe_off(struct inode *inode)
+{
+ __u64 block_off = GET_INODE_FEOFF(inode) >> inode->i_sb->s_blocksize_bits;
+
+ return (unsigned long)(block_off & (__u64)ULONG_MAX);
+}
+
+static inline unsigned long ino_from_off(struct super_block *sb,
+ __u64 off)
+{
+ __u64 block_off = off >> sb->s_blocksize_bits;
+
+ return (unsigned long)(block_off & (__u64)ULONG_MAX);
+}
+
+static inline void ocfs_set_de_type(struct super_block *sb,
+ struct ocfs2_dir_entry *de,
+ umode_t mode)
+{
+ de->file_type = ocfs_type_by_mode[(mode & S_IFMT)>>S_SHIFT];
+}
+
+static inline ocfs_bitmap_free_head * ocfs_alloc_bitmap_free_head(void)
+{
+ struct _ocfs_bitmap_free_head *f;
+
+ f = ocfs_malloc(sizeof(ocfs_bitmap_free_head));
+ if (f) {
+ f->num_logs = 0;
+ f->tail = NULL;
+ INIT_LIST_HEAD(&(f->free_logs));
+ }
+ return(f);
+}
+
+static inline void ocfs_free_bitmap_free_head(ocfs_bitmap_free_head *f)
+{
+ ocfs_free_rec *log;
+ struct list_head *p, *n;
+
+ if ((f) && ((f)->num_logs)) {
+ list_for_each_safe(p, n, &((f)->free_logs)) {
+ log = list_entry(p, ocfs_free_rec, log_list);
+ list_del(&(log->log_list));
+ kfree(log);
+ }
+ }
+ ocfs_safefree((f));
+ return;
+}
+
+static inline unsigned int ocfs_clusters_for_bytes(struct super_block *sb,
+ __u64 bytes)
+{
+ int cl_bits = OCFS_SB(sb)->s_clustersize_bits;
+ unsigned int clusters;
+
+ bytes += OCFS_SB(sb)->s_clustersize - 1;
+ /* OCFS2 just cannot have enough clusters to overflow this */
+ clusters = (unsigned int)(bytes >> cl_bits);
+
+ return clusters;
+}
+
+static inline __u64 ocfs_align_bytes_to_clusters(struct super_block *sb,
+ __u64 bytes)
+{
+ int cl_bits = OCFS_SB(sb)->s_clustersize_bits;
+ unsigned int clusters;
+
+ clusters = ocfs_clusters_for_bytes(sb, bytes);
+ return (__u64)clusters << cl_bits;
+}
+
+static inline int ocfs_inc_icount(struct inode *inode)
+{
+ if (atomic_read(&inode->i_count) >= 1 &&
+ !(inode->i_state & I_CLEAR)) {
+ atomic_inc(&inode->i_count);
+ return 0;
+ }
+
+ LOG_ERROR_ARGS("eek! i_count=%d, i_state=%lu, i_ino=%lu, no dentry\n",
+ atomic_read(&inode->i_count), inode->i_state,
+ inode->i_ino);
+
+ LOG_ERROR_ARGS("feoff=%llu, deleted=%u\n",
+ GET_INODE_FEOFF(inode),
+ INODE_DELETED(inode));
+
+ return -EINVAL;
+}
+
+#define ocfs_check_inode(inode) __ocfs_check_inode(inode, __LINE__)
+
+/* call this right before an atomic_dec or iput. */
+static inline void __ocfs_check_inode(struct inode *inode, unsigned int line)
+{
+ struct dentry *dentry = NULL;
+ struct list_head *iter;
+ int max_cnt = 1; /* one for the inode hash */
+ ocfs_super *osb = NULL;
+ int is_root = 0;
+
+ if (!inode)
+ return;
+
+ osb = OCFS_SB(inode->i_sb);
+ if (inode->i_ino == OCFS_ROOT_INODE_NUMBER)
+ is_root = 1;
+
+ if (INODE_DELETED(inode))
+ max_cnt--;
+
+ list_for_each (iter, &(inode->i_dentry)) {
+ dentry = list_entry (iter, struct dentry, d_alias);
+ // what the heck, take the first one ;-)
+ break;
+ }
+
+ /* add one for the dentrys ref... */
+ if (dentry)
+ max_cnt++;
+
+ /* +1 for the ref you're about to remove. */
+ if (atomic_read(&inode->i_count) >= (max_cnt+1))
+ return;
+
+
+ LOG_ERROR_ARGS("max_cnt = %d, line = %u, root=%u\n", max_cnt, line,
+ is_root);
+ if (dentry)
+ LOG_ERROR_ARGS("eek! i_count=%d, i_state=%lu, i_ino=%lu, name='%*s'\n",
+ atomic_read(&inode->i_count), inode->i_state, inode->i_ino,
+ dentry->d_name.len, dentry->d_name.name);
+ else
+ LOG_ERROR_ARGS("eek! i_count=%d, i_state=%lu, i_ino=%lu, no dentry\n",
+ atomic_read(&inode->i_count), inode->i_state, inode->i_ino);
+
+ LOG_ERROR_ARGS("feoff=%llu, deleted=%u\n",
+ GET_INODE_FEOFF(inode),
+ INODE_DELETED(inode));
+
+ BUG();
+}
+
+
+static inline int ocfs_is_local_cache_lock(ocfs_super *osb, struct inode *inode)
+{
+ ocfs_lock_res *lockres = GET_INODE_LOCKRES(inode);
+ if (lockres->lock_type == OCFS_DLM_ENABLE_CACHE_LOCK &&
+ lockres->master_node_num == osb->node_num)
+ return 1;
+ return 0;
+}
+
+static inline int ocfs_get_right_shift_bits(int num)
+{
+ int i, ret;
+
+ ret = 0;
+ for (i=0; i<32; i++) {
+ if (1 << i == num) {
+ ret = i;
+ break;
+ }
+ }
+ return ret;
+}
+
+static inline int ocfs_extent_for_offset(struct super_block *sb,
+ ocfs_extent_group *eh,
+ u64 vbo)
+{
+ int k;
+ ocfs_extent_rec *ext;
+ u32 cluster;
+ u64 byte_off;
+
+ for (k = 0; k < OCFS_MAX_DATA_EXTENTS; k++) {
+ ext = &eh->extents[k];
+
+ cluster = ext->e_cpos + ext->e_clusters;
+ byte_off = cluster << OCFS_SB(sb)->s_clustersize_bits;
+
+ if (byte_off >= vbo)
+ break;
+ }
+
+ return k;
+}
+
+static inline u64 ocfs_clusters_to_blocks(struct super_block *sb,
+ u32 clusters)
+{
+ int c_to_b_bits = OCFS_SB(sb)->s_clustersize_bits -
+ sb->s_blocksize_bits;
+
+ return (u64)clusters << c_to_b_bits;
+}
+
+static inline u32 ocfs_blocks_to_clusters(struct super_block *sb,
+ u64 blocks)
+{
+ int b_to_c_bits = OCFS_SB(sb)->s_clustersize_bits -
+ sb->s_blocksize_bits;
+
+ return (u32)(blocks >> b_to_c_bits);
+}
+
+
+/*
+ * Trans Lock:
+ * Right now OCFS2 only supports a single transaction at a
+ * time. Transactions are locked out by using trans_lock.
+ */
+static inline void ocfs_take_trans_lock(ocfs_super *osb)
+{
+ down(&osb->trans_lock);
+}
+
+static inline void ocfs_release_trans_lock(ocfs_super *osb)
+{
+ up(&osb->trans_lock);
+}
+
+typedef struct _ocfs_journal_handle ocfs_journal_handle;
+
+#endif /* !OCFS_H */
Copied: branches/format-changes/src/ocfs_buffer_head.h (from rev 1014, branches/format-changes/src/inc/ocfs_buffer_head.h)
Copied: branches/format-changes/src/ocfs_compat.h (from rev 1014, branches/format-changes/src/inc/ocfs_compat.h)
Copied: branches/format-changes/src/ocfs_journal.h (from rev 1014, branches/format-changes/src/inc/ocfs_journal.h)
Copied: branches/format-changes/src/ocfs_log.h (from rev 1014, branches/format-changes/src/inc/ocfs_log.h)
Modified: branches/format-changes/src/proc.c
===================================================================
--- branches/format-changes/src/proc.c 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/proc.c 2004-06-06 08:49:58 UTC (rev 1015)
@@ -26,15 +26,19 @@
#define OCFSPROC_PRIVATE_DECLS
-#include "inc/ocfs_compat.h"
+#include "ocfs_compat.h"
#include <linux/fs.h>
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/proc_fs.h>
-#include "inc/ocfs_log.h"
-#include "inc/ocfs.h"
+#include "ocfs_log.h"
+#include "ocfs.h"
+
+#include "proc.h"
+#include "vote.h"
+
extern __u32 comm_voting;
Copied: branches/format-changes/src/proc.h (from rev 1014, branches/format-changes/src/inc/proto.h)
===================================================================
--- branches/format-changes/src/inc/proto.h 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/proc.h 2004-06-06 08:49:58 UTC (rev 1015)
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ *
+ * Authors: Kurt Hackel, Mark Fasheh, Sunil Mushran, Wim Coekaerts,
+ * Manish Singh, Neeraj Goyal, Suchit Kaura
+ */
+
+#ifndef OCFS2_PROC_H
+#define OCFS2_PROC_H
+
+void ocfs_proc_add_volume(ocfs_super *osb);
+void ocfs_proc_deinit(void);
+int ocfs_proc_init(void);
+void ocfs_proc_remove_volume(ocfs_super *osb);
+
+#endif /* OCFS2_PROC_H */
Modified: branches/format-changes/src/super.c
===================================================================
--- branches/format-changes/src/super.c 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/super.c 2004-06-06 08:49:58 UTC (rev 1015)
@@ -24,7 +24,7 @@
* Manish Singh, Neeraj Goyal, Suchit Kaura
*/
-#include "inc/ocfs_compat.h"
+#include "ocfs_compat.h"
#include <linux/module.h>
#include <linux/fs.h>
@@ -39,11 +39,27 @@
#include <linux/moduleparam.h>
#endif
-#include "inc/ocfs_log.h"
-#include "inc/ocfs.h"
-#include "inc/ocfs_journal.h"
-#include "inc/ocfs_buffer_head.h"
+#include "ocfs_log.h"
+#include "ocfs.h"
+#include "alloc.h"
+#include "bitmap.h"
+#include "hash.h"
+#include "heartbeat.h"
+#include "inode.h"
+#include "journal.h"
+#include "nm.h"
+#include "proc.h"
+#include "super.h"
+#include "sysfile.h"
+#include "util.h"
+#include "ver.h"
+#include "volcfg.h"
+#include "vote.h"
+
+#include "ocfs_journal.h"
+#include "ocfs_buffer_head.h"
+
#define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_SUPER
/*
@@ -1504,7 +1520,7 @@
goto finally;
}
- ocfs_update_publish_map (osb, publish_bhs, 1);
+ ocfs_update_publish_map(osb, publish_bhs, 1);
for(i = 0; i < osb->max_nodes; i++)
osb->last_publ_seq_num[i] = (__u64) (-1);
Copied: branches/format-changes/src/super.h (from rev 1014, branches/format-changes/src/inc/proto.h)
===================================================================
--- branches/format-changes/src/inc/proto.h 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/super.h 2004-06-06 08:49:58 UTC (rev 1015)
@@ -0,0 +1,34 @@
+/*
+ * super.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.
+ *
+ * Authors: Kurt Hackel, Mark Fasheh, Sunil Mushran, Wim Coekaerts,
+ * Manish Singh, Neeraj Goyal, Suchit Kaura
+ */
+
+#ifndef OCFS2_SUPER_H
+#define OCFS2_SUPER_H
+
+void ocfs_delete_osb(ocfs_super *osb);
+int ocfs_dismount_volume(struct super_block *sb);
+int ocfs_publish_get_mount_state(ocfs_super *osb, int node_num);
+
+#endif /* OCFS2_SUPER_H */
Modified: branches/format-changes/src/symlink.c
===================================================================
--- branches/format-changes/src/symlink.c 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/symlink.c 2004-06-06 08:49:58 UTC (rev 1015)
@@ -30,7 +30,7 @@
* for CDSL support
*/
-#include "inc/ocfs_compat.h"
+#include "ocfs_compat.h"
#include <linux/fs.h>
#include <linux/types.h>
@@ -38,9 +38,11 @@
#include <linux/pagemap.h>
#include <linux/utsname.h>
-#include "inc/ocfs_log.h"
-#include "inc/ocfs.h"
+#include "ocfs_log.h"
+#include "ocfs.h"
+#include "symlink.h"
+
#define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_SYMLINK
struct ocfs_symlink_ops {
Copied: branches/format-changes/src/symlink.h (from rev 1014, branches/format-changes/src/inc/proto.h)
===================================================================
--- branches/format-changes/src/inc/proto.h 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/symlink.h 2004-06-06 08:49:58 UTC (rev 1015)
@@ -0,0 +1,32 @@
+/*
+ * symlink.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.
+ *
+ * Authors: Kurt Hackel, Mark Fasheh, Sunil Mushran, Wim Coekaerts,
+ * Manish Singh, Neeraj Goyal, Suchit Kaura
+ */
+
+#ifndef OCFS2_SYMLINK_H
+#define OCFS2_SYMLINK_H
+
+int ocfs_follow_link(struct dentry *dentry, struct nameidata *nd);
+
+#endif /* OCFS2_SYMLINK_H */
Modified: branches/format-changes/src/sysfile.c
===================================================================
--- branches/format-changes/src/sysfile.c 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/sysfile.c 2004-06-06 08:49:58 UTC (rev 1015)
@@ -24,7 +24,7 @@
* Manish Singh, Neeraj Goyal, Suchit Kaura
*/
-#include "inc/ocfs_compat.h"
+#include "ocfs_compat.h"
#include <linux/fs.h>
#include <linux/types.h>
@@ -33,11 +33,19 @@
#warning dont vmalloc
#include <linux/vmalloc.h>
-#include "inc/ocfs_log.h"
-#include "inc/ocfs.h"
-#include "inc/ocfs_journal.h"
-#include "inc/ocfs_buffer_head.h"
+#include "ocfs_log.h"
+#include "ocfs.h"
+#include "alloc.h"
+#include "dir.h"
+#include "hash.h"
+#include "inode.h"
+#include "sysfile.h"
+#include "util.h"
+
+#include "ocfs_journal.h"
+#include "ocfs_buffer_head.h"
+
/* Tracing */
#define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_SYSFILE
Copied: branches/format-changes/src/sysfile.h (from rev 1014, branches/format-changes/src/inc/proto.h)
===================================================================
--- branches/format-changes/src/inc/proto.h 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/sysfile.h 2004-06-06 08:49:58 UTC (rev 1015)
@@ -0,0 +1,42 @@
+/*
+ * sysfile.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.
+ *
+ * Authors: Kurt Hackel, Mark Fasheh, Sunil Mushran, Wim Coekaerts,
+ * Manish Singh, Neeraj Goyal, Suchit Kaura
+ */
+
+#ifndef OCFS2_SYSFILE_H
+#define OCFS2_SYSFILE_H
+
+struct inode * ocfs_get_system_file_inode(ocfs_super *osb, int file_type, __u32 node);
+int ocfs_extend_system_file(ocfs_super *osb, __u32 FileId,
+ __u64 FileSize, struct buffer_head *fe_bh,
+ ocfs_journal_handle *handle,int zero);
+__u64 ocfs_file_to_disk_off(ocfs_super *osb, __u32 FileId,
+ __u64 Offset);
+int ocfs_get_system_file_size(ocfs_super *osb, __u32 FileId,
+ __u64 *Length, __u64 *AllocSize);
+int ocfs_read_system_file (ocfs_super *osb, __u32 FileId,
+ struct buffer_head *bhs[], __u64 Length,
+ __u64 Offset);
+
+#endif /* OCFS2_SYSFILE_H */
Modified: branches/format-changes/src/util.c
===================================================================
--- branches/format-changes/src/util.c 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/util.c 2004-06-06 08:49:58 UTC (rev 1015)
@@ -24,16 +24,18 @@
* Manish Singh
*/
-#include "inc/ocfs_compat.h"
+#include "ocfs_compat.h"
#include <linux/fs.h>
#include <linux/types.h>
#include <linux/mm.h>
#include <linux/slab.h>
-#include "inc/ocfs_log.h"
-#include "inc/ocfs.h"
+#include "ocfs_log.h"
+#include "ocfs.h"
+#include "util.h"
+
/* Tracing */
#define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_UTIL
Copied: branches/format-changes/src/util.h (from rev 1014, branches/format-changes/src/inc/proto.h)
===================================================================
--- branches/format-changes/src/inc/proto.h 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/util.h 2004-06-06 08:49:58 UTC (rev 1015)
@@ -0,0 +1,44 @@
+/*
+ * util.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.
+ *
+ * Authors: Kurt Hackel, Mark Fasheh, Sunil Mushran, Wim Coekaerts,
+ * Manish Singh, Neeraj Goyal, Suchit Kaura
+ */
+
+#ifndef OCFS2_UTIL_H
+#define OCFS2_UTIL_H
+
+int ocfs_compare_qstr(struct qstr *s1, struct qstr *s2);
+void ocfs_clear_timeout(ocfs_timeout *to);
+void ocfs_daemonize(char *name, int len);
+void *ocfs_dbg_slab_alloc(kmem_cache_t *slab, char *file, int line);
+void ocfs_dbg_slab_free(kmem_cache_t *slab, void *m);
+void ocfs_init_timeout(ocfs_timeout *to);
+void *ocfs_linux_dbg_alloc(int Size, char *file, int line);
+void ocfs_linux_dbg_free(const void *Buffer);
+void ocfs_set_timeout(ocfs_timeout *to, __u32 timeout);
+void ocfs_show_stack(unsigned long *esp);
+void ocfs_show_trace(unsigned long *stack);
+int ocfs_sleep(__u32 ms);
+void ocfs_truncate_inode_pages(struct inode *inode, loff_t off);
+
+#endif /* OCFS2_UTIL_H */
Modified: branches/format-changes/src/ver.c
===================================================================
--- branches/format-changes/src/ver.c 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/ver.c 2004-06-06 08:49:58 UTC (rev 1015)
@@ -24,7 +24,7 @@
* Manish Singh
*/
-#include "inc/ocfs_compat.h"
+#include "ocfs_compat.h"
#include <linux/module.h>
#include <linux/fs.h>
@@ -32,10 +32,12 @@
#include <linux/slab.h>
#include <linux/kernel.h>
-#include "inc/ocfs_log.h"
-#include "inc/ocfs.h"
+#include "ocfs_log.h"
+#include "ocfs.h"
+#include "ver.h"
+
MODULE_DESCRIPTION("The Oracle Cluster Filesystem (version "
OCFS_BUILD_VERSION
")");
Copied: branches/format-changes/src/ver.h (from rev 1014, branches/format-changes/src/inc/proto.h)
===================================================================
--- branches/format-changes/src/inc/proto.h 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/ver.h 2004-06-06 08:49:58 UTC (rev 1015)
@@ -0,0 +1,32 @@
+/*
+ * ver.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.
+ *
+ * Authors: Kurt Hackel, Mark Fasheh, Sunil Mushran, Wim Coekaerts,
+ * Manish Singh, Neeraj Goyal, Suchit Kaura
+ */
+
+#ifndef OCFS2_VER_H
+#define OCFS2_VER_H
+
+void ocfs_version_print(void);
+
+#endif /* OCFS2_VER_H */
Modified: branches/format-changes/src/volcfg.c
===================================================================
--- branches/format-changes/src/volcfg.c 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/volcfg.c 2004-06-06 08:49:58 UTC (rev 1015)
@@ -24,17 +24,22 @@
* Manish Singh, Neeraj Goyal, Suchit Kaura
*/
-#include "inc/ocfs_compat.h"
+#include "ocfs_compat.h"
#include <linux/fs.h>
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/highmem.h>
-#include "inc/ocfs_log.h"
-#include "inc/ocfs.h"
-#include "inc/ocfs_buffer_head.h"
+#include "ocfs_log.h"
+#include "ocfs.h"
+#include "hash.h"
+#include "util.h"
+#include "volcfg.h"
+
+#include "ocfs_buffer_head.h"
+
/* Tracing */
#define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_VOLCFG
Copied: branches/format-changes/src/volcfg.h (from rev 1014, branches/format-changes/src/inc/proto.h)
===================================================================
--- branches/format-changes/src/inc/proto.h 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/volcfg.h 2004-06-06 08:49:58 UTC (rev 1015)
@@ -0,0 +1,33 @@
+/*
+ * volcfg.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.
+ *
+ * Authors: Kurt Hackel, Mark Fasheh, Sunil Mushran, Wim Coekaerts,
+ * Manish Singh, Neeraj Goyal, Suchit Kaura
+ */
+
+#ifndef OCFS2_VOLCFG_H
+#define OCFS2_VOLCFG_H
+
+int ocfs_chk_update_config(ocfs_super *osb);
+int ocfs_get_config(ocfs_super *osb);
+
+#endif /* OCFS2_VOLCFG_H */
Modified: branches/format-changes/src/vote.c
===================================================================
--- branches/format-changes/src/vote.c 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/vote.c 2004-06-06 08:49:58 UTC (rev 1015)
@@ -24,7 +24,7 @@
* Manish Singh
*/
-#include "inc/ocfs_compat.h"
+#include "ocfs_compat.h"
#include <linux/fs.h>
#include <linux/types.h>
@@ -35,9 +35,14 @@
#include <asm/uaccess.h>
-#include "inc/ocfs_log.h"
-#include "inc/ocfs.h"
+#include "ocfs_log.h"
+#include "ocfs.h"
+#include "dlm.h"
+#include "nm.h"
+#include "util.h"
+#include "vote.h"
+
/* Tracing */
#define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_VOTE
@@ -1137,3 +1142,47 @@
ret = ocfs_node_map_is_empty(&temp);
return ret;
}
+
+/*
+** All structures have a type, and a size associated with it.
+** The type serves to identify the structure. The size is used for
+** consistency checking ...
+*/
+void ocfs_publish_map_set(ocfs_node_map *pubmap, int num)
+{
+ ocfs_node_map_set_bit(pubmap, num);
+}
+
+void ocfs_publish_map_clear(ocfs_node_map *pubmap, int num)
+{
+ ocfs_node_map_clear_bit(pubmap, num);
+}
+
+/* update the recovery map here */
+void ocfs_recovery_map_set(ocfs_super *osb, int num)
+{
+ spin_lock(&osb->recovery_map_lock);
+ osb->vol_state = VOLUME_IN_RECOVERY;
+ ocfs_node_map_set_bit(&osb->recovery_map, num);
+ spin_unlock(&osb->recovery_map_lock);
+}
+
+void ocfs_recovery_map_clear(ocfs_super *osb, int num)
+{
+ spin_lock(&osb->recovery_map_lock);
+ ocfs_node_map_clear_bit(&osb->recovery_map, num);
+ if (ocfs_node_map_is_empty(&osb->recovery_map))
+ osb->vol_state = VOLUME_ENABLED;
+ spin_unlock(&osb->recovery_map_lock);
+}
+
+int ocfs_node_is_recovering(ocfs_super *osb, int num)
+{
+ return ocfs_node_map_test_bit(&osb->recovery_map, num);
+}
+
+int ocfs_node_is_alive(ocfs_node_map *pubmap, int index)
+{
+ return ocfs_node_map_test_bit(pubmap, index);
+}
+
Copied: branches/format-changes/src/vote.h (from rev 1014, branches/format-changes/src/inc/proto.h)
===================================================================
--- branches/format-changes/src/inc/proto.h 2004-06-05 00:52:29 UTC (rev 1014)
+++ branches/format-changes/src/vote.h 2004-06-06 08:49:58 UTC (rev 1015)
@@ -0,0 +1,81 @@
+/*
+ * vote.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.
+ *
+ * Authors: Kurt Hackel, Mark Fasheh, Sunil Mushran, Wim Coekaerts,
+ * Manish Singh, Neeraj Goyal, Suchit Kaura
+ */
+
+#ifndef OCFS2_VOTE_H
+#define OCFS2_VOTE_H
+
+void ocfs_get_vote_obj(ocfs_vote_obj *obj);
+int ocfs_init_udp_sock(struct socket **send_sock,
+ struct socket **recv_sock);
+int ocfs_lookup_obj_for_proc(ocfs_vote_obj *obj,
+ ocfs_vote_obj_lookup_data *data);
+int ocfs_lookup_obj_by_lockid(ocfs_vote_obj *obj,
+ ocfs_vote_obj_lookup_data *data);
+int ocfs_lookup_vote_request_obj(ocfs_super *osb,
+ ocfs_vote_obj_lookup_data *data);
+void ocfs_process_one_vote_reply(ocfs_super *osb,
+ ocfs_vote_reply_ctxt *ctxt,
+ __u32 node_num);
+int ocfs_recv_udp_msg(ocfs_recv_ctxt *recv_ctxt);
+int ocfs_send_dismount_msg(ocfs_super *osb);
+int ocfs_send_dlm_request_msg (ocfs_super * osb, __u64 lock_id,
+ __u32 lock_type, __u32 flags,
+ ocfs_node_map *votemap, ocfs_node_map *openmap,
+ struct inode *inode, int *vote_status);
+int ocfs_send_vote_reply(ocfs_super *osb, ocfs_dlm_msg *dlm_msg,
+ __u32 vote_status, int inode_open);
+int ocfs_lookup_vote_request_obj (ocfs_super *osb,
+ ocfs_vote_obj_lookup_data *data);
+
+void ocfs_node_map_init(ocfs_super *osb, ocfs_node_map *map);
+void ocfs_node_map_set_bit(ocfs_node_map *map, int bit);
+void ocfs_node_map_clear_bit(ocfs_node_map *map, int bit);
+// clear all the bits in "target" which are set in "mask"
+void ocfs_node_map_clear_bits(ocfs_node_map *target, ocfs_node_map *mask);
+// set all the bits in "target" which are set in "mask"
+void ocfs_node_map_set_bits(ocfs_node_map *target, ocfs_node_map *mask);
+int ocfs_node_map_test_bit(ocfs_node_map *map, int bit);
+int ocfs_node_map_stringify(ocfs_node_map *map, char **str);
+int ocfs_node_map_is_empty(ocfs_node_map *map);
+int ocfs_node_map_is_equal(ocfs_node_map *map1, ocfs_node_map *map2);
+void ocfs_node_map_and(ocfs_node_map *target, ocfs_node_map *mask);
+void ocfs_node_map_set(ocfs_node_map *target, ocfs_node_map *from);
+void ocfs_node_map_dup(ocfs_super *osb, ocfs_node_map *target, ocfs_node_map *from);
+// expects that "target" is already inited with correct
+// num_nodes, and that "from" is of course wide enough
+void ocfs_node_map_set_from_disk(ocfs_node_map *target, void *from);
+void ocfs_node_map_set_to_disk(void *target, ocfs_node_map *from);
+/* returns 1 if bit is the only bit set in target, 0 otherwise */
+int ocfs_node_map_is_only(ocfs_super *osb, ocfs_node_map *target, int bit);
+
+int ocfs_node_is_recovering(ocfs_super *osb, int num);
+int ocfs_node_is_alive(ocfs_node_map *pubmap, int index);
+void ocfs_publish_map_set(ocfs_node_map *pubmap, int num);
+void ocfs_publish_map_clear(ocfs_node_map *pubmap, int num);
+void ocfs_recovery_map_set(ocfs_super *osb, int num);
+void ocfs_recovery_map_clear(ocfs_super *osb, int num);
+
+#endif /* OCFS2_VOTE_H */
More information about the Ocfs2-commits
mailing list