[Ocfs2-commits] rev 12 - in trunk: inc src src/inc
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Thu Dec 18 23:24:31 CST 2003
Author: manish
Date: 2003-12-18 17:24:27 -0600 (Thu, 18 Dec 2003)
New Revision: 12
Added:
trunk/src/inc/
trunk/src/inc/journal.h
trunk/src/inc/ocfs.h
trunk/src/inc/ocfsio.h
trunk/src/inc/proto.h
Removed:
trunk/inc/journal.h
trunk/inc/ocfs.h
trunk/inc/ocfsio.h
trunk/inc/proto.h
Log:
moved inc dir
Deleted: trunk/inc/journal.h
===================================================================
--- trunk/inc/journal.h 2003-12-18 23:17:02 UTC (rev 11)
+++ trunk/inc/journal.h 2003-12-18 23:24:27 UTC (rev 12)
@@ -1,317 +0,0 @@
-/*
- * ocfsjournal.h
- *
- * Defines journalling api and structures.
- *
- * Copyright (C) 2003 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, Sunil Mushran,
- * Manish Singh, Wim Coekaerts, Mark Fasheh
- */
-
-#ifndef _OCFSJOURNAL_H_
-#define _OCFSJOURNAL_H_
-
-#define OCFS_JOURNAL_CURRENT_VERSION 1
-#define OCFS_DEFAULT_COMMIT_INTERVAL (HZ * 5)
-#define OCFS_JOURNAL_DEFAULT_SIZE (8 * ONE_MEGA_BYTE)
-
-#undef OCFS_JOURNAL_USE_CB
-
-struct _ocfs_lock_res;
-struct _ocfs_super;
-struct _ocfs_file_entry;
-struct _ocfs_lock_res;
-struct _ocfs_journal_handle;
-
-/* most of the ocfs_journal structure is protected by the
- * trans_lock. BEWARE. */
-typedef struct _ocfs_journal ocfs_journal;
-struct _ocfs_journal {
- enum {
- OCFS_JOURNAL_FREE = 0,
- OCFS_JOURNAL_LOADED,
- OCFS_JOURNAL_IN_SHUTDOWN,
- OCFS_JOURNAL_CREATE /* only used during journal_create */
- } state; /* Journals current state */
-
- journal_t *k_journal; /* The kernels journal type */
- struct inode *k_inode; /* Kernel inode pointing to
- * this journal */
- __u8 version; /* Journal version */
- __u64 lock_id; /* Lock id for journal file */
- struct _ocfs_super *osb; /* pointer to the super
- * block for the node
- * we're currently
- * running on -- not
- * necessarily the super
- * block from the node
- * which we usually run
- * from (recovery,
- * etc) */
- __u32 node_num; /* Whose journal are we? */
- struct _ocfs_lock_res *lock_res; /* Journal file lock */
- struct buffer_head *lockbh; /* Journal disk lock, used
- to access file entry */
- atomic_t num_trans; /* Number of transactions
- * currently in the system. */
- struct _ocfs_journal_handle *curr; /* pointer to currently
- * running handle. In
- * the future when we do
- * multiple concurrent
- * transactions this may
- * become a list.*/
- /* locking order: trans_lock -> commit_sem -> journal.curr.list_lock */
- struct semaphore commit_sem; /* protects *everything*
- * in the commited list
- * and also protects
- * 'curr' from
- * removal/creation. */
- struct list_head commited; /* doubly linked list of all
- * commited handles awaiting
- * checkpointing. */
-#define OCFS_JOURNAL_CREATE_MAX_BMAPS 600
- __u32 bmaps; /* only used during
- * journal_create. see
- * ocfs_journal_create
- * for an explanation */
-};
-
-typedef struct _ocfs_journal_lock ocfs_journal_lock;
-struct _ocfs_journal_lock {
- __u64 id;
- __u32 type;
- __u32 flags;
- struct _ocfs_lock_res * res;
- struct buffer_head *bh;
- struct list_head lock_list;
-};
-
-typedef struct _ocfs_journal_handle ocfs_journal_handle;
-struct _ocfs_journal_handle {
- handle_t *k_handle; /* kernel handle. */
- ocfs_journal *journal;
- struct _ocfs_super *osb; /* what super block we belong to */
- __u32 flags; /* see flags below. */
- struct list_head h_list; /* points to whatever list we're
- * on. */
- int max_buffs; /* Buffs reserved by this handle */
-
- /* We know how many buffers (max) we'll have for this
- * transaction so we can just allocate an array of pointers at
- * the same time as the creation of this handle. */
- int num_buffs;
- struct buffer_head **buffs;
-
- /* The following three fields are for ocfs_journal_add_lock */
- spinlock_t list_lock; /* Used to protect the 'locks'
- * list. Only used if the
- * handle is the same as
- * journal->curr. otherwise, we
- * should be in the commited
- * list in which case we're
- * protected by commit_sem */
- int num_locks;
- struct list_head locks; /* A bunch of locks to
- * release on commit/abort. This
- * should be a list_head */
-};
-
-/* should we checkpoint this handle on commit? */
-#define OCFS_HANDLE_CHECKPOINT 1
-/* should we sync-commit this handle? */
-#define OCFS_HANDLE_SYNC 2
-#define ocfs_handle_set_checkpoint(handle, val) \
-do { \
- if (val) \
- (handle)->flags |= OCFS_HANDLE_CHECKPOINT; \
- else \
- (handle)->flags &= ~OCFS_HANDLE_CHECKPOINT; \
-} while(0)
-#define ocfs_handle_set_sync(handle, val) \
-do { \
- if (val) \
- (handle)->flags |= OCFS_HANDLE_SYNC; \
- else \
- (handle)->flags &= ~OCFS_HANDLE_SYNC; \
-} while(0)
-
-/*
- * Journal Configuration Management:
- * These are normally called at mount and unmount time.
- *
- * ocfs_journal_update_config - updates the journal version flags in the
- * current nodes nodeconfig.
- * ocfs_journal_set_mounted - set the mounted flag for the current node.
- * ocfs_journal_set_unmounted - unset the mounted flag for the current node.
- */
-int ocfs_journal_update_config (struct _ocfs_super *osb, int new_version);
-int ocfs_journal_set_mounted(struct _ocfs_super *osb, int node_num);
-int ocfs_journal_set_unmounted(struct _ocfs_super *osb, int node_num);
-
-/*
- * Journal Control:
- * Initialize, Load, Shutdown, Wipe, Create a journal.
- *
- * ocfs_journal_init - Initialize journal structures in the OSB.
- * ocfs_journal_load - Load the given journal off disk. Replay it if
- * there's transactions still in there.
- * ocfs_journal_shutdown - Shutdown a journal, this will flush all
- * uncommited, uncheckpointed transactions.
- * ocfs_journal_create - Format a new journal.
- * ocfs_journal_wipe - Wipe transactions from a journal. Optionally
- * zero out each block.
- * ocfs_recovery_thread - Perform recovery on a node. osb is our own osb.
- */
-int ocfs_journal_init(struct _ocfs_super *osb);
-void ocfs_journal_shutdown(struct _ocfs_super *osb);
-int ocfs_journal_create(ocfs_journal *journal);
-int ocfs_journal_wipe(ocfs_journal *journal, int full);
-int ocfs_journal_load(ocfs_journal *journal);
-void ocfs_recovery_thread(struct _ocfs_super *osb, int node_num);
-
-/*
- * Transaction Handling:
- * Manage the lifetime of a transaction handle.
- *
- * ocfs_start_trans - Begin a transaction. Give it an upper estimate of
- * the number of blocks that will be changed during
- * this handle.
- * ocfs_commit_trans - Complete a handle.
- * ocfs_abort_trans - Abort a running handle.
- * ocfs_journal_access - Notify the handle that we want to journal this
- * buffer. Will have to call ocfs_journal_dirty once
- * we've actually dirtied it. Type is one of . or .
- * ocfs_journal_dirty - Mark a journalled buffer as having dirty data.
- * ocfs_journal_add_lock - Sometimes we need to delay lock release
- * until after a transaction has been completed. Use
- * ocfs_journal_add_lock to indicate that a lock needs
- * to be released at the end of that handle. Locks
- * will be released in the order that they are added,
- * and afterwards the lockres will be passed to
- * ocfs_put_lockres.
- *
- * TODO:
- * ocfs_restart_trans - Some transactions will have to be split up between
- * two or more handles. (delete, truncate are good
- * examples.) Use ocfs_restart_trans to commit what
- * you have so far and get a new handle for the rest.
- * ocfs_journal_forget - Remove a buffer from a handle.
- */
-/* You must always start_trans with a number of buffs > 0, but it's
- * perfectly legal to go through an entire transaction without having
- * dirtied any buffers. */
-ocfs_journal_handle *ocfs_start_trans(struct _ocfs_super *osb, int max_buffs);
-int ocfs_commit_trans(ocfs_journal_handle *handle);
-void ocfs_abort_trans(ocfs_journal_handle *handle);
-/*
- * Create access is for when we get a newly created buffer and we're
- * not gonna read it off disk, but rather fill it ourselves. The
- * buffer should already be locked.
- *
- * Write access is for when we read a block off disk and are going to
- * modify it. This way the journalling layer knows it may need to make
- * a copy of that block (if it's part of another, uncommited
- * transaction) before we do so.
- */
-#define OCFS_JOURNAL_ACCESS_CREATE 0
-#define OCFS_JOURNAL_ACCESS_WRITE 1
-int ocfs_journal_access(ocfs_journal_handle *handle,
- struct buffer_head *bh, int type);
-/*
- * A word about the journal_access/journal_dirty "dance". It is
- * entirely legal to journal_access a buffer more than once (as long
- * as the access type is the same -- I'm not sure what will happen if
- * access type is different but this should never happen anyway) It is
- * also legal to journal_dirty a buffer more than once. In fact, you
- * can even journal_access a buffer after you've done a
- * journal_access/journal_dirty pair. The only thing you cannot do
- * however, is journal_dirty a buffer which you haven't yet passed to
- * journal_access at least once.
- *
- * That said, 99% of the time this doesn't matter and this is what the
- * path looks like:
- *
- * <read a bh>
- * ocfs_journal_access(handle, bh, OCFS_JOURNAL_ACCESS_WRITE);
- * <modify the bh>
- * ocfs_journal_dirty(handle, bh);
- */
-int ocfs_journal_dirty(ocfs_journal_handle *handle,
- struct buffer_head *bh);
-void ocfs_journal_add_lock(ocfs_journal_handle *handle,
- __u64 id, __u32 type, __u32 flags,
- struct _ocfs_lock_res *res,
- struct buffer_head *bh);
-
-#define ocfs_take_trans_lock(osb) \
- do { \
- down(&osb->trans_lock); \
- osb->trans_in_progress = true; \
- } while (0)
-
-#define ocfs_release_trans_lock(osb) \
- do { \
- osb->trans_in_progress = false; \
- up (&osb->trans_lock); \
- } while (0)
-
-/*
- * Credit Macros:
- * Convenience macros to calculate number of credits needed.
- *
- * For convenience sake, I have a set of macros here which calculate
- * the *maximum* number of sectors which will be changed for various
- * metadata updates. I also have a completely arbitrary 'fuzz' value
- * which I'll add to some of these in case of a miscalculation. The
- * journal is large enough, and we don't journal as much metadata
- * that I'm not worried about the 'fuzz' taking up potential credits.
- */
-#define OCFS_JOURNAL_FUZZ_CREDITS (5)
-#define OCFS_SINGLE_FILE_EXTEND_CREDITS (10)
-
-/* locknode + new fe + dirnode head + new dirnode for parent directory
- * + extending (diralloc, filealloc, dirallocbitmap, fileallocbitmap)
- * and some fuzz. */
-#define OCFS_MKNOD_CREDITS (1 + 1 + OCFS_DEFAULT_DIR_NODE_SECTS + \
- (OCFS_SINGLE_FILE_EXTEND_CREDITS * 4) + \
- OCFS_JOURNAL_FUZZ_CREDITS)
-
-/* single file metadata updates * 3 because we might have to extend
- * the file alloc and file alloc bitmap files + possible update to
- * local bitmap. */
-#define OCFS_FILE_EXTEND_CREDITS (OCFS_SINGLE_FILE_EXTEND_CREDITS * 3 \
- + 1 + OCFS_JOURNAL_FUZZ_CREDITS)
-
-/* fe, anything along new 'edge' of tree + fuzz*/
-#define OCFS_FILE_TRUNCATE_CREDITS (1 + 4 + OCFS_JOURNAL_FUZZ_CREDITS)
-
-/* the file entry + the locknode + possibily the parent dirnode + fuzz */
-#define OCFS_FILE_DELETE_CREDITS (1 + 1 + 1 + OCFS_JOURNAL_FUZZ_CREDITS)
-
-/* need to create a new file and extend it to hold the info for the
- * symlink. we wind up with twice the fuzz because we reuse some
- * macros so we subtract one.*/
-#define OCFS_SYMLINK_CREDITS (OCFS_MKNOD_CREDITS + OCFS_FILE_EXTEND_CREDITS \
- - OCFS_JOURNAL_FUZZ_CREDITS)
-
-/* fe change, locknode change, dirnode head, times two plus a possible
- * delete, and fuzz */
-#define OCFS_FILE_RENAME_CREDITS (2 * (1 + 1 + 1) + OCFS_FILE_DELETE_CREDITS \
- + OCFS_JOURNAL_FUZZ_CREDITS)
-#endif /* _OCFSJOURNAL_H_ */
Deleted: trunk/inc/ocfs.h
===================================================================
--- trunk/inc/ocfs.h 2003-12-18 23:17:02 UTC (rev 11)
+++ trunk/inc/ocfs.h 2003-12-18 23:24:27 UTC (rev 12)
@@ -1,2507 +0,0 @@
-#ifndef OCFS_H
-#define OCFS_H
-
-/* XXX Hack to avoid warning */
-struct mem_dqinfo;
-extern inline void mark_info_dirty(struct mem_dqinfo *info);
-
-#ifndef LINUX_2_5
-#ifdef __ia64__
-extern inline void prefetch(const void *x);
-extern inline void prefetchw(const void *x);
-#else
-static inline void prefetch(const void *x);
-static inline void prefetchw(const void *x);
-#endif
-extern inline int generic_fls(int x);
-extern inline int get_bitmask_order(unsigned int count);
-#endif /* !LINUX_2_5 */
-
-
-/*
-** System header files
-*/
-#define __KERNEL_SYSCALLS__
-#include <linux/version.h>
-#include <linux/types.h>
-#include <linux/config.h>
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <asm/byteorder.h>
-#include <linux/spinlock.h>
-#include <linux/slab.h>
-#include <linux/slab.h>
-#include <linux/sched.h>
-#include <linux/delay.h>
-#include <linux/wait.h>
-#include <linux/list.h>
-#include <linux/fs.h>
-#include <linux/pagemap.h>
-#include <linux/random.h>
-#include <linux/string.h>
-#include <linux/jbd.h>
-#ifdef LINUX_2_5
-#include <linux/writeback.h>
-#else
-#include <linux/locks.h>
-#endif
-#include <linux/hdreg.h>
-#include <linux/file.h>
-#include <linux/raw.h>
-#include <linux/vmalloc.h>
-#include <linux/proc_fs.h>
-#include <linux/unistd.h>
-#include <asm/uaccess.h>
-#include <linux/net.h>
-#include <net/sock.h>
-#include <linux/ctype.h>
-#ifdef LINUX_2_5
-#include <linux/workqueue.h>
-#else
-#include <linux/tqueue.h>
-#endif
-#include <linux/inet.h>
-#ifdef LINUX_2_5
-#include <asm/statfs.h>
-#include <linux/blkdev.h>
-#include <linux/in.h>
-#include <linux/buffer_head.h>
-#endif
-
-#include "journal.h"
-
-
-
-typedef enum { false = 0, true = 1 } ocfs_bool;
-
-/* This should be removed and all old code fixed to just use ocfs_bool */
-typedef ocfs_bool bool;
-
-#define OCFS_POINTER_SIZE (sizeof(void *))
-
-#ifdef __LP64__
-#define OCFS_GCC_ATTR_PACKED __attribute__ ((packed))
-#define OCFS_GCC_ATTR_ALIGNED __attribute__ ((aligned(4)))
-#define OCFS_GCC_ATTR_PACKALGN __attribute__ ((aligned(4), packed))
-#endif
-#ifdef __i386__
-#define OCFS_GCC_ATTR_PACKED
-#define OCFS_GCC_ATTR_ALIGNED
-#define OCFS_GCC_ATTR_PACKALGN
-#endif
-
-
-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
- UPDATE_INODE, // no oin, so only update inode
- DELETE_RENAME, // delete or rename request (EX)
- 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
-};
-
-
-enum {
- NOT_VOTING = 0,
- DOING_HEARTBEAT,
- SKIPPED_HEARTBEAT
-};
-
-
-#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
-};
-
-#define OSB_PREALLOC_LOCK_TEST(osb, l) (osb->prealloc_lock & (1<<l))
-#define OSB_PREALLOC_LOCK_SET(osb, l) (osb->prealloc_lock |= (1<<l))
-#define OSB_PREALLOC_LOCK_CLEAR(osb, l) (osb->prealloc_lock &= ~(1<<l))
-
-
-/* convenience macro */
-#define ocfs_safefree(x) \
-do { \
- if (x) \
- ocfs_free(x); \
- (x) = NULL; \
-} while (0)
-
-#define ocfs_safevfree(x) \
-do { \
- if (x) \
- vfree(x); \
- (x) = NULL; \
-} while (0)
-
-#define OCFS_ASSERT(x) do { if (!(x)) BUG(); } while (0)
-#define OCFS_BREAKPOINT() printk("DEBUG BREAKPOINT! %s, %d\n", \
- __FILE__, __LINE__)
-
-
-#define BITCOUNT(x) (((BX_(x)+(BX_(x)>>4)) & 0x0F0F0F0F) % 255)
-#define BX_(x) ((x) - (((x)>>1)&0x77777777) \
- - (((x)>>2)&0x33333333) \
- - (((x)>>3)&0x11111111))
-
-
-#ifdef USERSPACE_TOOL
-#define list_for_each_safe(pos, n, head) \
- for (pos = (head)->next, n = pos->next; pos != (head); pos = n, n = pos->next)
-#endif
-
-
-#ifdef LINUX_2_5
-#define OcfsQuerySystemTime(t) \
- do { \
- *t = (__u64)(CURRENT_TIME.tv_sec) * (__u64) 10000000; \
- *t += (__u64)(CURRENT_TIME.tv_nsec) / (__u64) 100; \
- } while (0)
-#define OCFS_CURRENT_TIME (CURRENT_TIME.tv_sec)
-#define OCFS_SET_INODE_TIME(i, x, y) i->##x.tv_sec = (y)
-#else
-/* time is in 0.1 microsecs */
-#define OcfsQuerySystemTime(t) \
- do { \
- (*t) = (__u64)((__u64)CURRENT_TIME * (__u64)10000000); \
- (*t) += (__u64)((__u64)xtime.tv_usec * (__u64)10); \
- } while (0)
-#define OCFS_CURRENT_TIME (CURRENT_TIME)
-#define OCFS_SET_INODE_TIME(i, x, y) i->x = (y)
-#endif
-
-#ifdef __KERNEL__
-#define ocfs_getpid() current->pid
-#endif
-#ifndef __KERNEL__
-#define ocfs_getpid() getpid()
-#endif
-
-
-
-typedef struct _ocfs_inode_private
-{
- void * generic_ip;
- __u8 pad[8];
-// struct list_head i_clean_buffers;
- atomic_t i_clean_buffer_seq;
-} ocfs_inode_private;
-
-#define CLEAN_SEQ_OFF ((unsigned long)(&((ocfs_inode_private *)0)->i_clean_buffer_seq))
-#define INODE_PRIVATE_OFF ((unsigned long)(&((struct inode *)0)->u.generic_ip))
-#define GET_INODE_CLEAN_SEQ(i) (atomic_t *)(((unsigned long)i) + INODE_PRIVATE_OFF + CLEAN_SEQ_OFF)
-
-/* i_flags flag - heh yeah i know it's evil! */
-#define S_OCFS_OIN_VALID 256
-
-#define inode_data_is_oin(i) (i->i_flags & S_OCFS_OIN_VALID)
-
-#define OCFS_GENERIC_IP(i) ((ocfs_inode_private *)(&(i->u.generic_ip)))
-
-//#define GET_INODE_CLEAN_LIST(i) (OCFS_GENERIC_IP(i)->i_clean_buffers)
-//#define EVIL_LIST_HEAD(_inode) (&(GET_INODE_CLEAN_LIST(_inode)))
-
-//#define GET_INODE_CLEAN_SEQ(i) (&(OCFS_GENERIC_IP(i)->i_clean_buffer_seq))
-
-
-#define GET_INODE_OIN(i) ((ocfs_inode *)(OCFS_GENERIC_IP(i)->generic_ip))
-
-#define SET_INODE_OFFSET(i,o) do { \
- i->i_flags &= ~S_OCFS_OIN_VALID; \
- GET_INODE_OIN(i)= (void *)HI(o); \
- i->i_ino = LO(o); \
- } while (0)
-
-#define GET_INODE_OFFSET(i) (__u64)((((__u64)((unsigned long)i->u.generic_ip))<<32) + \
- ((__u64)i->i_ino))
-
-#define SET_INODE_OIN(i,o) do { \
- i->i_flags |= S_OCFS_OIN_VALID; \
- GET_INODE_OIN(i)= (void *)o; \
- } while (0)
-
-#define FIRST_FILE_ENTRY(dir) ((char *) ((char *)dir)+OCFS_SECTOR_SIZE)
-#define FILEENT(dir,idx) (ocfs_file_entry *) ( ((char *)dir) + \
- ((dir->index[idx]+1) * OCFS_SECTOR_SIZE))
-#define FILEENT_GETBH(dir,bhs,idx) ({ \
- int _i = dir->index[idx]+1; \
- ocfs_file_entry *_ret = NULL; \
- if (!buffer_locked(bhs[_i])) \
- _ret = (ocfs_file_entry *)OCFS_BH_GET_DATA(bhs[_i]); \
- _ret; \
- })
-#define FILEENT_PUTBH(dir,bhs,idx) OCFS_BH_PUT_DATA(bhs[(dir->index[idx]+1)])
-
-
-#define OCFS_DIR_FILENAME "DirFile"
-#define OCFS_DIR_BITMAP_FILENAME "DirBitMapFile"
-#define OCFS_FILE_EXTENT_FILENAME "ExtentFile"
-#define OCFS_FILE_EXTENT_BITMAP_FILENAME "ExtentBitMapFile"
-#define OCFS_RECOVER_LOG_FILENAME "RecoverLogFile"
-#define OCFS_CLEANUP_LOG_FILENAME "CleanUpLogFile"
-
-#define ONE_SECOND (10 * 1000 * 1000) /* 100 nanosec unit */
-#define ONE_MILLI_SEC (10 * 1000) /* 100 nanosec unit */
-#define ONE_MEGA_BYTE (1 * 1024 * 1024) /* in bytes */
-
-#define MISS_COUNT_VALUE 20
-
-#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)
-
-/*
-** 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_FILE_UNUSED3 0x00002000
-#define FLAG_FILE_UNUSED4 0x00004000
-#define FLAG_FILE_UNUSED5 0x00008000
-#define FLAG_FILE_UNUSED6 0x00010000
-#define FLAG_DEL_NAME 0x00020000
-#define FLAG_RESET_VALID 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_FILE_UNUSED14 0x10000000
-#define FLAG_FILE_UNUSED15 0x20000000
-#define FLAG_ACQUIRE_LOCK 0x40000000
-#define FLAG_RELEASE_LOCK 0x80000000
-
-enum {
- OCFS_INVALID_SYSFILE = -1,
- OCFS_VOL_MD_SYSFILE = 0,
- OCFS_VOL_MD_LOG_SYSFILE,
- OCFS_DIR_SYSFILE,
- OCFS_DIR_BM_SYSFILE,
- OCFS_FILE_EXTENT_SYSFILE,
- OCFS_FILE_EXTENT_BM_SYSFILE,
- OCFS_RECOVER_LOG_SYSFILE,
- OCFS_CLEANUP_LOG_SYSFILE,
- OCFS_VOL_BM_SYSFILE,
- OCFS_VOL_BM,
- OCFS_NUM_SYSFILES
-};
-#define OCFS_FILE_VOL_META_DATA (OCFS_VOL_MD_SYSFILE * OCFS_MAXIMUM_NODES)
-#define OCFS_FILE_VOL_LOG_FILE (OCFS_VOL_MD_LOG_SYSFILE * OCFS_MAXIMUM_NODES)
-#define OCFS_FILE_DIR_ALLOC (OCFS_DIR_SYSFILE * OCFS_MAXIMUM_NODES)
-#define OCFS_FILE_DIR_ALLOC_BITMAP (OCFS_DIR_BM_SYSFILE * OCFS_MAXIMUM_NODES)
-#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)
-#define CLEANUP_FILE_BASE_ID (OCFS_CLEANUP_LOG_SYSFILE * OCFS_MAXIMUM_NODES)
-#define JOURNAL_FILE_BASE_ID (CLEANUP_FILE_BASE_ID)
-#define OCFS_VOL_BITMAP_FILE (OCFS_VOL_BM_SYSFILE * OCFS_MAXIMUM_NODES)
-/* ocfs_vol_bitmap is unused. */
-#define OCFS_VOL_BITMAP (OCFS_VOL_BM * OCFS_MAXIMUM_NODES)
-
-
-
-
-#define SECTOR_BITS 9
-#define SECTOR_SIZE (1U << SECTOR_BITS)
-#define SECTOR_MASK (SECTOR_SIZE - 1)
-
-
-#define OCFS_LOG_SECTOR_SIZE 9
-#define OCFS_SECTOR_SIZE (1<<OCFS_LOG_SECTOR_SIZE)
-#define OCFS_MOD_SECTOR_SIZE (OCFS_SECTOR_SIZE - 1)
-#define OCFS_MAXIMUM_NODES 32
-#define OCFS_MAX_FILENAME_LENGTH 255
-
-#define OCFS_VOLUME_LOCK_OFFSET (OCFS_SECTOR_SIZE)
-/* change this to some other sector, change format TODO */
-#define OCFS_BITMAP_LOCK_OFFSET (OCFS_SECTOR_SIZE * 2)
-
-#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_OFILE (0x02534643)
-#define OCFS_TYPE_OIN (0x03534643)
-#define OCFS_TYPE_OSB (0x05534643)
-#define OCFS_TYPE_GLOBAL_DATA (0x07534643)
-
-#define CACHE_LOCK_SLOT_TIME (ONE_SECOND * 10)
-
-// LOCKTYPE ONE
-#define OCFS_DLM_NO_LOCK (0x0)
-#define OCFS_DLM_SHARED_LOCK (0x1)
-#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;
-
-#define FLAG_ALWAYS_UPDATE_OPEN 0x1
-#define LOCK_STATE_INIT 0x2
-#define LOCK_STATE_IN_VOTING 0x4
-
-#define OCFS_OIN_IN_TEARDOWN (0x00000002)
-#define OCFS_OIN_DIRECTORY (0x00000008)
-#define OCFS_OIN_ROOT_DIRECTORY (0x00000010)
-#define OCFS_OIN_CACHE_UPDATE (0x00000100)
-#define OCFS_OIN_DELETE_ON_CLOSE (0x00000200)
-#define OCFS_OIN_NEEDS_DELETION (0x00000400)
-#define OCFS_INITIALIZED_MAIN_RESOURCE (0x00002000)
-#define OCFS_INITIALIZED_PAGING_IO_RESOURCE (0x00004000)
-#define OCFS_OIN_INVALID (0x00008000)
-#define OCFS_OIN_IN_USE (0x00020000)
-#define OCFS_OIN_OPEN_FOR_DIRECTIO (0x00100000)
-#define OCFS_OIN_OPEN_FOR_WRITE (0x00200000)
-#define OCFS_OIN_IN_RECOVER_LIST (0x00400000)
-
-
-#define OCFS_OSB_FLAGS_BEING_DISMOUNTED (0x00000004)
-#define OCFS_OSB_FLAGS_SHUTDOWN (0x00000008)
-#define OCFS_OSB_FLAGS_OSB_INITIALIZED (0x00000020)
-
-#define OCFS_FLAG_GLBL_CTXT_RESOURCE_INITIALIZED (0x00000001)
-#define OCFS_FLAG_MEM_LISTS_INITIALIZED (0x00000002)
-#define OCFS_FLAG_SHUTDOWN_VOL_THREAD (0x00000004)
-
-// DIRFLAG MASK
-#define DIR_NODE_FLAG_ROOT 0x1
-
-/*
-** 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 */
-
-#define OCFS_X_FOR_DEL_RETRIES 25
-
-#define OCFS_TRANS_FLUSH_LIMIT (8 * ONE_MEGA_BYTE)
-
-/*
-** 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
-*/
-// SYNCFLAG MASK
-#define OCFS_SYNC_FLAG_DELETED (0)
-#define OCFS_SYNC_FLAG_VALID (0x1)
-#define OCFS_SYNC_FLAG_CHANGE (0x2)
-#define OCFS_SYNC_FLAG_MARK_FOR_DELETION (0x4)
-#define OCFS_SYNC_FLAG_NAME_DELETED (0x8)
-
-// ATTRIBS MASK
-#define OCFS_ATTRIB_DIRECTORY (0x1)
-#define OCFS_ATTRIB_CHAR (0x10)
-#define OCFS_ATTRIB_BLOCK (0x20)
-#define OCFS_ATTRIB_REG (0x40)
-#define OCFS_ATTRIB_FIFO (0x80)
-#define OCFS_ATTRIB_SYMLINK (0x100)
-#define OCFS_ATTRIB_SOCKET (0x200)
-
-#define INVALID_DIR_NODE_INDEX -1
-#define INVALID_NODE_POINTER -1
-#define OCFS_DIR_NODE_SIGNATURE "DIRNV20"
-#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 OCFS_SEM_MAGIC 0xAFABFACE
-#define OCFS_SEM_DELETED 0x0D0D0D0D
-
-#define SHUTDOWN_SIGS (sigmask(SIGKILL) | sigmask(SIGHUP) | \
- sigmask(SIGINT) | sigmask(SIGQUIT))
-
-#define EFAIL 999
-#define EWARNING 998
-
-#define OCFS_MAGIC 0xa156f7eb
-#define OCFS_ROOT_INODE_NUMBER 2
-#define OCFS_LINUX_MAX_FILE_SIZE 9223372036854775807LL
-#define INITIAL_EXTENT_MAP_SIZE 10
-
-#define OCFS_VOLCFG_LOCK_ITERATE 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 */
-
-#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_
-
-#define OIN_NEEDS_VERIFICATION(a) ((a)->needs_verification)
-#define OIN_UPDATED(a) ((a)->needs_verification = false)
-
-#define IS_VALID_DIR_NODE(ptr) \
- (!strncmp((ptr)->signature, OCFS_DIR_NODE_SIGNATURE, \
- strlen(OCFS_DIR_NODE_SIGNATURE)))
-
-/* sm - ocfs 1.0 fails to set fe->sig for dirs */
-#define IS_VALID_FILE_ENTRY(ptr) \
- (((ptr)->attribs & OCFS_ATTRIB_DIRECTORY) || \
- (!strcmp((ptr)->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 OCFS_GET_EXTENT(vbo, extent, k) \
- do { \
- for ((k) = 0; (k) < OCFS_MAX_DATA_EXTENTS; (k)++) { \
- if((__s64)((extent)->extents[(k)].file_off + \
- (extent)->extents[(k)].num_bytes) > (vbo)) \
- break; \
- } \
- } while(0)
-
-#define OCFS_GET_FILE_ENTRY_EXTENT(vbo, fileentry, k) \
- do { \
- for ((k) = 0; (k) < OCFS_MAX_FILE_ENTRY_EXTENTS; (k)++) { \
- if((__s64)((fileentry)->extents[(k)].file_off + \
- (fileentry)->extents[(k)].length) > (vbo)) \
- break; \
- } \
- } while(0)
-
-#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)
-
-#ifdef LOCAL_ALLOC
-#define OCFS_FILE_NUM_TO_SYSFILE_TYPE(num) ( (num >= 0 && num < OCFS_VOL_BITMAP_FILE + OCFS_MAXIMUM_NODES) ? \
- num/OCFS_MAXIMUM_NODES : OCFS_INVALID_SYSFILE )
-#define OCFS_SYSFILE_TYPE_TO_FILE_NUM(type,node) ( (type > OCFS_INVALID_SYSFILE && type <= OCFS_VOL_BM_SYSFILE && \
- node >=0 && node < OCFS_MAXIMUM_NODES) ? \
- (type * OCFS_MAXIMUM_NODES) + node : -1 )
-#else
-#define OCFS_FILE_NUM_TO_SYSFILE_TYPE(num) ( (num >= 0 && num < CLEANUP_FILE_BASE_ID + OCFS_MAXIMUM_NODES) ? \
- num/OCFS_MAXIMUM_NODES : OCFS_INVALID_SYSFILE )
-#define OCFS_SYSFILE_TYPE_TO_FILE_NUM(type,node) ( (type > OCFS_INVALID_SYSFILE && type <= CLEANUP_FILE_BASE_ID && \
- node >=0 && node < OCFS_MAXIMUM_NODES) ? \
- (type * OCFS_MAXIMUM_NODES) + node : -1 )
-#endif
-
-#define down_with_flag(_sem, _flg) \
- do { \
- if (!_flg) { \
- down (_sem); \
- _flg = true; \
- } \
- } while (0)
-
-#define up_with_flag(_sem, _flg) \
- do { \
- if (_flg) { \
- up (_sem); \
- _flg = false; \
- } \
- } while (0)
-
-#define ocfs_task_interruptible(_o) ((_o)->dlm_task != current && signal_pending(current))
-
-#define ocfs_trans_in_progress(_o) \
-do { \
- int _i = 0; \
- while (((_o)->trans_in_progress) && (_i < 10)) {\
- ocfs_sleep (100); \
- _i++; \
- } \
-} while (0)
-
-
-
-/*
-** 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))
-
-#define OCFS_ALIGN(val, align) \
- ((__u64)val + \
- (((__u64)val % align) ? (align - ((__u64)val % align)): 0))
-
-/*
-** Structures...
-*/
-
-#define IS_NODE_ALIVE(pubmap, i, numnodes) \
- (((pubmap) >> ((i) % (numnodes))) & 0x1)
-
-#define NODE_NEEDS_RECOVERY(osb,i) (((i)!=OCFS_INVALID_NODE_NUM) && (i)!=(osb)->node_num && \
- !IS_NODE_ALIVE((osb)->publ_map,i,OCFS_MAXIMUM_NODES))
-
-#define IS_VALIDBIT_SET(flags) ((flags) & 0x1)
-
-#define SET_VALID_BIT(flags) ((flags) |= 0x1)
-
-/*
-** 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 ...
-*/
-#define UPDATE_PUBLISH_MAP(pubmap, num, flag, numnodes) \
- do { \
- __u64 var = 0x1; \
- if((flag) == OCFS_PUBLISH_CLEAR) \
- (pubmap) &= (~(var << ((num) % (numnodes)))); \
- else \
- (pubmap) |= (var << ((num) % (numnodes))); \
- } while(0)
-
-/* update the recovery map here */
-#define SET_NODE_IN_RECOVERY(osb, num) \
- do { \
- spin_lock(&osb->recovery_map_lock); \
- (osb->vol_state) = VOLUME_IN_RECOVERY; \
- (osb->recovery_map) |= (0x1 << (num)); \
- spin_unlock(&osb->recovery_map_lock); \
- } while(0);
-
-#define CLEAR_NODE_IN_RECOVERY(osb, num) \
- do { \
- spin_lock(&osb->recovery_map_lock); \
- (osb->recovery_map) &= (~(0x1 << (num))); \
- if ((osb->recovery_map) == 0) \
- (osb->vol_state) = VOLUME_ENABLED; \
- spin_unlock(&osb->recovery_map_lock); \
- } while(0);
-
-#define TEST_NODE_IN_RECOVERY(osb, num) ((osb->recovery_map) & (0x1 << (num)))
-
-#if defined(OCFS_LINUX_MEM_DEBUG)
-# define ocfs_malloc(_s) \
-({ \
- void *m = ocfs_linux_dbg_alloc(_s, __FILE__, __LINE__); \
- if (debug_level & OCFS_DEBUG_LEVEL_MALLOC) \
- printk("malloc(%s,%d) = %p\n", __FILE__, \
- __LINE__, m); \
- m; \
-})
-
-# define ocfs_free(x)\
-do { \
- if (debug_level & OCFS_DEBUG_LEVEL_MALLOC) \
- printk("free(%s,%d) = %p\n", __FILE__, \
- __LINE__, x); \
- ocfs_linux_dbg_free(x); \
-} while (0)
-
-# define ocfs_vmalloc(size) ({ void *p = vmalloc(size); \
- if (!p) printk("ERROR: unable to allocate %u bytes of memory\n", (size)); \
- p; \
- })
-# define ocfs_vfree vfree
-#elif !defined(OCFS_LINUX_MEM_DEBUG)
-# define ocfs_malloc(size) kmalloc((size_t)(size), GFP_KERNEL)
-# define ocfs_free kfree
-# define ocfs_vmalloc(size) vmalloc(size)
-# define ocfs_vfree vfree
-#endif /* ! defined(OCFS_MEM_DBG) */
-
-
-
-typedef enum _ocfs_protocol
-{
- OCFS_TCP = 1,
- OCFS_UDP
-}
-ocfs_protocol;
-
-
-#define OCFS_EXTENT_MERGEABLE(ext, off) \
- (((ext)->disk_off + (ext)->num_bytes) == (off))
-
-#define OCFS_IS_VALID_EXTENT(__ext, __typ) ({ \
- bool __ret = false; \
- switch (__typ) { \
- case EXTENT_HEADER: \
- if (IS_VALID_EXTENT_HEADER(__ext)) \
- __ret = true; \
- break; \
- case EXTENT_DATA: \
- if (IS_VALID_EXTENT_DATA(__ext)) \
- __ret = true; \
- break; \
- } \
- __ret; \
-})
-
-/* sorry about all the macros, but file and line are important */
-
-/* lockres macros */
-#ifdef OCFS_MEM_DBG
-#define ocfs_allocate_clean_buffer_list() (ocfs_extent *)ocfs_dbg_slab_alloc( \
- OcfsGlobalCtxt.ocfs_clean_buffer_list, \
- __FILE__, __LINE__)
-#define ocfs_free_clean_buffer_list(cbl) ocfs_dbg_slab_free( \
- OcfsGlobalCtxt.ocfs_clean_buffer_list, cbl)
-
-
-#define ocfs_allocate_extent_entry() (ocfs_extent *)ocfs_dbg_slab_alloc( \
- OcfsGlobalCtxt.extent_cache, \
- __FILE__, __LINE__)
-#define ocfs_free_extent_entry(ext) ocfs_dbg_slab_free( \
- OcfsGlobalCtxt.extent_cache, ext)
-
-#define ocfs_allocate_lockres() \
-({ \
- ocfs_lock_res *_l = NULL; \
- _l = (ocfs_lock_res *)ocfs_dbg_slab_alloc \
- (OcfsGlobalCtxt.lockres_cache, __FILE__, __LINE__); \
- if (_l) atomic_inc (&(OcfsGlobalCtxt.cnt_lockres)); \
- _l; \
-})
-
-#define ocfs_free_lockres(_r) \
-do { \
- ocfs_dbg_slab_free (OcfsGlobalCtxt.lockres_cache, _r); \
- atomic_dec (&(OcfsGlobalCtxt.cnt_lockres)); \
-} while (0)
-
-#else /* !OCFS_MEM_DBG */
-
-#define ocfs_allocate_clean_buffer_list() (ocfs_extent *)kmem_cache_alloc( \
- OcfsGlobalCtxt.ocfs_clean_buffer_list, GFP_NOFS)
-#define ocfs_free_clean_buffer_list(cbl) kmem_cache_free(OcfsGlobalCtxt.ocfs_clean_buffer_list, cbl)
-
-#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_lockres() \
-({ \
- ocfs_lock_res *_l = NULL; \
- _l = (ocfs_lock_res *)kmem_cache_alloc \
- (OcfsGlobalCtxt.lockres_cache, GFP_NOFS); \
- if (_l) atomic_inc (&(OcfsGlobalCtxt.cnt_lockres)); \
- _l; \
-})
-
-#define ocfs_free_lockres(_r) \
-do { \
- kmem_cache_free (OcfsGlobalCtxt.lockres_cache, _r); \
- atomic_dec (&(OcfsGlobalCtxt.cnt_lockres)); \
-} while (0)
-
-#endif
-
-#define _ocfs_get_lockres(_r) \
-do { \
- if (_r) \
- atomic_inc(&((_r)->lr_ref_cnt)); \
-} while (0)
-
-#define _ocfs_put_lockres(_r) \
-do { \
- if (_r) { \
- if (atomic_dec_and_test(&((_r)->lr_ref_cnt))) \
- ocfs_free_lockres(_r); \
- } \
-} while (0)
-
-#ifdef OCFS_DBG_LOCKRES
-#define ocfs_get_lockres(_r) \
-do { \
- if (_r) { \
- printk("(%d) get: 0x%08x, %d, %s, %d\n", \
- ocfs_getpid(), (_r), \
- atomic_read(&((_r)->lr_ref_cnt)) + 1, \
- __FUNCTION__, __LINE__); \
- _ocfs_get_lockres(_r); \
- } else \
- printk("(%d) get: null, -1, %s, %d\n", \
- ocfs_getpid(), __FUNCTION__, __LINE__); \
-} while (0)
-
-#define ocfs_put_lockres(_r) \
-do { \
- if (_r) { \
- printk("(%d) put: 0x%08x, %d, %s, %d\n", \
- ocfs_getpid(), (_r), \
- atomic_read(&((_r)->lr_ref_cnt)) - 1, \
- __FUNCTION__, __LINE__); \
- _ocfs_put_lockres(_r); \
- } else \
- printk("(%d) put: null, -1, %s, %d\n", \
- ocfs_getpid(), __FUNCTION__, __LINE__); \
-} while (0)
-#else /* !OCFS_DBG_LOCKRES */
-#define ocfs_get_lockres(_r) _ocfs_get_lockres(_r)
-#define ocfs_put_lockres(_r) _ocfs_put_lockres(_r)
-#endif
-
-/* ofile macros */
-#ifdef OCFS_MEM_DBG
-#define ocfs_allocate_ofile(flag) ((ocfs_file *)({ \
- ocfs_file *of = NULL; \
- of = ocfs_dbg_slab_alloc(OcfsGlobalCtxt.ofile_cache, __FILE__, __LINE__); \
- if (of != NULL) { \
- memset (of, 0, sizeof (ocfs_file)); \
- of->obj_id.type = OCFS_TYPE_OFILE; \
- of->obj_id.size = sizeof (ocfs_file); \
- if (flag==OCFS_ATTRIB_DIRECTORY) { \
- int sz = OCFS_DEFAULT_DIR_NODE_SECTS * sizeof(struct buffer_head *); \
- of->curr_dir_buf = ocfs_malloc(sz); \
- if (of->curr_dir_buf == NULL) { \
- ocfs_safefree(of); \
- of = NULL; \
- } else \
- memset(of->curr_dir_buf, 0, sz); \
- } \
- } \
- of; }))
-
-#define ocfs_release_ofile(of) ({ \
- OCFS_ASSERT (of); \
- ocfs_safefree (of->curr_dir_buf); \
- ocfs_dbg_slab_free (OcfsGlobalCtxt.ofile_cache, of); })
-#else /* !OCFS_MEM_DBG */
-#define ocfs_allocate_ofile(flag) ((ocfs_file *)({ \
- ocfs_file *of = NULL; \
- of = kmem_cache_alloc (OcfsGlobalCtxt.ofile_cache, GFP_NOFS); \
- if (of != NULL) { \
- memset (of, 0, sizeof (ocfs_file)); \
- of->obj_id.type = OCFS_TYPE_OFILE; \
- of->obj_id.size = sizeof (ocfs_file); \
- if (flag==OCFS_ATTRIB_DIRECTORY) { \
- int sz = OCFS_DEFAULT_DIR_NODE_SECTS * sizeof(struct buffer_head *); \
- of->curr_dir_buf = ocfs_malloc(sz); \
- if (of->curr_dir_buf == NULL) { \
- ocfs_safefree(of); \
- of = NULL; \
- } else \
- memset(of->curr_dir_buf, 0, sz); \
- } \
- } \
- of; }))
-
-#define ocfs_release_ofile(of) ({ \
- OCFS_ASSERT (of); \
- ocfs_safefree (of->curr_dir_buf); \
- kmem_cache_free (OcfsGlobalCtxt.ofile_cache, of); })
-#endif
-
-
-/* file entry macros */
-#ifdef OCFS_MEM_DBG
-#define ocfs_allocate_file_entry() ((ocfs_file_entry *)({ \
- ocfs_file_entry *FileEntry = NULL; \
- FileEntry = ocfs_dbg_slab_alloc (OcfsGlobalCtxt.fe_cache, __FILE__, __LINE__); \
- if (FileEntry != NULL) \
- memset (FileEntry, 0, OCFS_SECTOR_SIZE); \
- FileEntry; }))
-
-#define ocfs_release_file_entry(fe) \
- do { \
- if (fe) { \
- ocfs_dbg_slab_free (OcfsGlobalCtxt.fe_cache, fe); \
- fe = NULL; \
- } \
- } while (0)
-#else /* !OCFS_MEM_DBG */
-#define ocfs_allocate_file_entry() ((ocfs_file_entry *)({ \
- ocfs_file_entry *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)
-#endif
-
-/* oin macros - currently the release is handled separately */
-#ifdef OCFS_MEM_DBG
-#define ocfs_allocate_oin() ((ocfs_inode *)({ \
- ocfs_inode *oin = NULL; \
- oin = ocfs_dbg_slab_alloc (OcfsGlobalCtxt.oin_cache, __FILE__, __LINE__); \
- if (oin != NULL) { \
- memset (oin, 0, sizeof (ocfs_inode)); \
- oin->obj_id.type = OCFS_TYPE_OIN; \
- oin->obj_id.size = sizeof (ocfs_inode); \
- } \
- oin; }))
-#else /* !OCFS_MEM_DBG */
-#define ocfs_allocate_oin() ((ocfs_inode *)({ \
- ocfs_inode *oin = NULL; \
- oin = kmem_cache_alloc (OcfsGlobalCtxt.oin_cache, GFP_NOFS); \
- if (oin != NULL) { \
- memset (oin, 0, sizeof (ocfs_inode)); \
- oin->obj_id.type = OCFS_TYPE_OIN; \
- oin->obj_id.size = sizeof (ocfs_inode); \
- } \
- oin; }))
-#endif
-
-
-#define hashsize(n) ((__u32)1<<(n))
-#define hashmask(n) (hashsize(n)-1)
-
-#define HASHTABLE_DESTROYED(h) (((HASHTABLE *)h)->buckets==NULL)
-
-/*
- * --------------------------------------------------------------------
- * mix -- mix 3 32-bit values reversibly.
- * For every delta with one or two bits set, and the deltas of all three
- * high bits or all three low bits, whether the original value of a,b,c
- * is almost all zero or is uniformly distributed.
- * If mix() is run forward or backward, at least 32 bits in a,b,c
- * have at least 1/4 probability of changing.
- * If mix() is run forward, every bit of c will change between 1/3 and
- * 2/3 of the time. (Well, 22/100 and 78/100 for some 2-bit deltas.)
- * mix() takes 36 machine instructions, but only 18 cycles on a superscalar
- * machine (like a Pentium or a Sparc). No faster mixer seems to work,
- * that's the result of my brute-force search. There were about 2^^68
- * hashes to choose from. I only tested about a billion of those.
- * --------------------------------------------------------------------
- * */
-#define mix(a,b,c) \
-{ \
- a -= b; a -= c; a ^= (c>>13); \
- b -= c; b -= a; b ^= (a<<8); \
- c -= a; c -= b; c ^= (b>>13); \
- a -= b; a -= c; a ^= (c>>12); \
- b -= c; b -= a; b ^= (a<<16); \
- c -= a; c -= b; c ^= (b>>5); \
- a -= b; a -= c; a ^= (c>>3); \
- b -= c; b -= a; b ^= (a<<10); \
- c -= a; c -= b; c ^= (b>>15); \
-}
-
-/*
- * --------------------------------------------------------------------
- * hash() -- hash a variable-length key into a 32-bit value
- * k : the key (the unaligned variable-length array of bytes)
- * len : the length of the key, counting by bytes
- * initval : can be any 4-byte value
- *
- * Returns a 32-bit value. Every bit of the key affects every bit of
- * the return value. Every 1-bit and 2-bit delta achieves avalanche.
- * About 6*len+35 instructions.
- *
- * The best hash table sizes are powers of 2. There is no need to do
- * mod a prime (mod is sooo slow!). If you need less than 32 bits,
- * use a bitmask. For example, if you need only 10 bits, do
- * h = (h & hashmask(10));
- * In which case, the hash table should have hashsize(10) elements.
- *
- * If you are hashing n strings (__u8 **)k, do it like this:
- * for (i=0, h=0; i<n; ++i) h = hash( k[i], len[i], h);
- *
- * By Bob Jenkins, 1996. bob_jenkins at burtleburtle.net. You may use this
- * code any way you wish, private, educational, or commercial. It's free.
- *
- * See http://burtleburtle.net/bob/hash/evahash.html
- * Use for hash table lookup, or anything where one collision in 2^^32 is
- * acceptable. Do NOT use for cryptographic purposes.
- * --------------------------------------------------------------------
- * */
-__u32 hash (__u8 * k, __u32 length, __u32 initval);
-
-#define OCFS_NAME "OCFS"
-
-/* ioctl commands */
-#define OCFS_IOC_MAGIC 'O'
-#define OCFS_IOC_GETTYPE _IOR(OCFS_IOC_MAGIC, 1, struct ocfs_ioc)
-
-
-#ifndef LINUX_2_5
-typedef long sector_t;
-#define map_bh(bh, sb, blk) \
- ({ \
- bh->b_dev = OCFS_SB_GET_KDEV(sb); \
- bh->b_blocknr = blk; \
- bh->b_state |= (1UL << BH_Mapped); \
- })
-#endif
-
-#ifndef LINUX_2_5
-#include <linux/iobuf.h>
-#endif /* for 2.5 - no more kiovec, kiobuf structures - vfs handles
- * this for us (direct i/o) */
-#include <linux/sysctl.h>
-#ifdef LINUX_2_5
-#include <linux/moduleparam.h>
-#endif
-
-/* Module versioning */
-#define LinuxVersionCode(v, p, s) (((v)<<16)+((p)<<8)+(s))
-
-
-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,4,18)
-#define free_kiovec_sz(nr, buf, bh) free_kiovec(nr, buf)
-#define alloc_kiovec_sz(nr, buf, bh) alloc_kiovec(nr, buf)
-#endif
-
-/* Operates on a struct super_block * */
-#ifdef LINUX_2_5
-#define OCFS_SB_GET_KDEV(sb) (to_kdev_t(sb->s_dev))
-#define OCFS_SET_INODE_DEV(sb, inode) (inode->i_rdev = OCFS_SB_GET_KDEV(sb))
-typedef struct block_device * ocfs_blockdev;
-typedef dev_t ocfs_dev;
-#define OCFS_NODEV NODEV.value
-#define OCFS_GET_BLOCKDEV(sb) ((sb)->s_bdev)
-#else
-#define OCFS_SB_GET_KDEV(sb) (sb->s_dev)
-#define OCFS_SET_INODE_DEV(sb, inode) (inode->i_dev = OCFS_SB_GET_KDEV(sb))
-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 >= LinuxVersionCode(2,5,0)
-
-//#ifndef LINUX_2_5
-//#define LINUX_2_5
-//#endif
-
-//#endif
-
-#if LINUX_2_5
-/* 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)
-#define MOD_INC_USE_COUNT do { } while(0)
-#define MOD_DEC_USE_COUNT do { } while(0)
-#endif /* LINUX_2_5 */
-
-#ifdef LINUX_2_5
-#define OCFS_GENERIC_SB_P(sb) ((ocfs_super *)(sb->s_fs_info))
-#else
-#define OCFS_GENERIC_SB_P(sb) ((ocfs_super *)(sb->u.generic_sbp))
-#endif
-
-
-extern __u32 debug_context;
-extern __u32 debug_level;
-extern __u32 debug_exclude;
-
-#define HI(val) ((unsigned long)(((val) >> 16) >> 16))
-#define LO(val) ((unsigned long)((val) & 0x00000000FFFFFFFFUL))
-
-#define HILO(val) HI(val), LO(val)
-
-/* Tracing Levels */
-#define OCFS_DEBUG_LEVEL_ERROR 0x00000001
-#define OCFS_DEBUG_LEVEL_TRACE 0x00000002
-
-#define OCFS_DEBUG_LEVEL_ENTRY 0x00000010
-#define OCFS_DEBUG_LEVEL_EXIT 0x00000020
-
-#define OCFS_DEBUG_LEVEL_TIMING 0x00000100
-#define OCFS_DEBUG_LEVEL_STACK 0x00000200
-
-#define OCFS_DEBUG_LEVEL_PRINTK 0x00001000
-
-/* Tracing Contexts */
-#define OCFS_DEBUG_CONTEXT_INIT 0x00000001 /* ocfsgeninit.c,ocfsmain.c */
-#define OCFS_DEBUG_CONTEXT_MEM 0x00000002 /* ocfs_memcheck() in ocfsmain.c */
-
-#define OCFS_DEBUG_CONTEXT_NM 0x00000010 /* ocfsgennm.c */
-#define OCFS_DEBUG_CONTEXT_DLM 0x00000020 /* ocfsgendlm.c */
-#define OCFS_DEBUG_CONTEXT_VOTE 0x00000040 /* ocfsgenvote.c */
-#define OCFS_DEBUG_CONTEXT_IPC 0x00000080 /* ocfsipc.c */
-
-#define OCFS_DEBUG_CONTEXT_VOLCFG 0x00000100 /* ocfsgenvolcfg.c */
-#define OCFS_DEBUG_CONTEXT_HEARTBEAT 0x00000200 /* ocfsgenheartbeat.c */
-
-#define OCFS_DEBUG_CONTEXT_MOUNT 0x00001000 /* ocfsmount.c */
-#define OCFS_DEBUG_CONTEXT_SHUTDOWN 0x00002000 /* ocfsgenshutdn.c */
-#define OCFS_DEBUG_CONTEXT_SUPER 0x00004000 /* super.c */
-#define OCFS_DEBUG_CONTEXT_CLOSE 0x00008000 /* genclose.c, ocfsclose.c */
-
-#define OCFS_DEBUG_CONTEXT_EXTENT 0x00010000 /* ocfsgenalloc.c */
-#define OCFS_DEBUG_CONTEXT_DIRINFO 0x00020000 /* ocfsgendirnode.c */
-#define OCFS_DEBUG_CONTEXT_FILEINFO 0x00040000 /* ocfsfile.c */
-#define OCFS_DEBUG_CONTEXT_TRANS 0x00080000 /* ocfsgentrans.c */
-
-#define OCFS_DEBUG_CONTEXT_DISKIO 0x00100000 /* ocfsgenio.c */
-#define OCFS_DEBUG_CONTEXT_MISC 0x00200000 /* ocfsgenmisc.c */
-
-#define OCFS_DEBUG_CONTEXT_UTIL 0x01000000 /* ocfsgenutil.c */
-#define OCFS_DEBUG_CONTEXT_HASH 0x02000000 /* ocfshash.h */
-#define OCFS_DEBUG_CONTEXT_PORT 0x08000000 /* ocfsport.c */
-
-#define OCFS_DEBUG_CONTEXT_IOCTL 0x10000000 /* ocfsioctl.c */
-#define OCFS_DEBUG_CONTEXT_PROC 0x20000000 /* proc.c */
-#define OCFS_DEBUG_CONTEXT_IOSUP 0x40000000 /* iosup.c */
-#define OCFS_DEBUG_CONTEXT_JOURNAL 0x80000000 /* journal.c */
-
-
-#ifdef OCFS_DBG_TIMING
-typedef union _my_timing_t
-{
- __u64 q;
- __u32 lohi[2];
-} my_timing_t;
-
-#define IO_FUNC_TIMING_DECL my_timing_t begin, end; \
- rdtsc (begin.lohi[0], begin.lohi[1]);
-#define IO_FUNC_TIMING_PRINT(_fn,_ret) rdtsc (end.lohi[0], end.lohi[1]); \
- IF_LEVEL_NO_CONTEXT(OCFS_DEBUG_LEVEL_TIMING) \
- printk("(%d) EXIT : %s() = %d => [%u.%u]\n",\
- ocfs_getpid(), _fn, \
- _ret, HILO(end.q-begin.q));
-#else
-#define IO_FUNC_TIMING_DECL
-#define IO_FUNC_TIMING_PRINT(_fn,_ret)
-#endif
-
-
-#ifndef OCFS_DBG_TIMING
-#define DECL_U8_ARRAY(__t, __s)
-#define INIT_U8_ARRAY(__s)
-#define PRINT_STRING(__t) printk("\n");
-#define PRINT_ENTRY(__t) printk("(%d) ENTRY: %s", ocfs_getpid (), __FUNCTION__)
-#else
-#define DECL_U8_ARRAY(__t, __s) __u8 (__t)[(__s)]
-#define INIT_U8_ARRAY(__s) *(__s) = '\0'
-#define PRINT_STRING(__t) printk("%s\n", (__t))
-#define PRINT_ENTRY(__t) printk("(%d) %sENTRY: %s", ocfs_getpid (), (__t), __FUNCTION__)
-#endif
-
-
-#ifndef OCFS_DBG_TIMING
-# define GET_STACK(s)
-#else
-# define GET_STACK(s) \
- IF_LEVEL(OCFS_DEBUG_LEVEL_STACK) { \
- __s32 esp; \
- __asm__ __volatile__("andl %%esp,%0" : "=r" (esp) : \
- "0" (8191)); \
- esp -= sizeof(struct task_struct); \
- sprintf((s), "[%ld] ", esp); \
- }
-#endif
-
-/* privately used macros */
-# define IF_LEVEL(level) \
- if ((debug_context & OCFS_DEBUG_CONTEXT) && (debug_level & level) && \
- ocfs_getpid()!=debug_exclude)
-# define IF_LEVEL_NO_CONTEXT(level) \
- if ((debug_level & level) && ocfs_getpid()!=debug_exclude)
-
-#ifndef OCFS_DBG_TIMING
-# define ENTRY_TIMING_DECLS
-# define GET_TIMING(s, hi, lo)
-#else
-# define ENTRY_TIMING_DECLS __u32 _HI = 0, _LO = 0
-# define GET_TIMING(s, hi, lo) \
- do { \
- IF_LEVEL(OCFS_DEBUG_LEVEL_TIMING) { \
- __u32 _lo, _hi; \
- rdtsc (_lo, _hi); \
- if ((s) == NULL) { \
- (hi) = _hi; (lo) = _lo; \
- } else { \
- __u64 _b, _e; \
- _b = hi; _b <<= 32; _b |= lo; \
- _e = _hi; _e <<= 32; _e |= _lo; \
- _e -= _b; \
- sprintf((s), " => [%u.%u]", \
- HI(_e), LO(_e)); \
- } \
- } \
- } while (0)
-#endif
-
-/* IF macro */
-#define IF_TRACE(func) \
- do { \
- if ((debug_context & OCFS_DEBUG_CONTEXT) && \
- (debug_level & OCFS_DEBUG_LEVEL_TRACE)) \
- func; \
- } while (0)
-
-#define IF_LEVEL_PID() \
- if ((debug_level & OCFS_DEBUG_LEVEL_PRINTK) && \
- (ocfs_getpid()!=debug_exclude))
-
-static inline void eat_value_int(int val)
-{
- return;
-}
-
-static inline void eat_value_long(long val)
-{
- return;
-}
-
-static inline void eat_value_ulong(unsigned long val)
-{
- return;
-}
-
-static inline void eat_value_ptr(void *val)
-{
- return;
-}
-
-/* TRACE disabled. ERROR macros are never disabled. */
-#if !defined(TRACE)
-# define LOG_ENTRY()
-# define LOG_EXIT()
-# define LOG_EXIT_STATUS(val) eat_value_int(val)
-# define LOG_EXIT_LONG(val) eat_value_long(val)
-# define LOG_EXIT_ULONG(val) eat_value_ulong(val)
-# define LOG_EXIT_PTR(val) eat_value_ptr(val)
-# define LOG_TRACE_STR(str)
-# define LOG_TRACE_STATUS(val) eat_value_int(val)
-# define LOG_ENTRY_ARGS(fmt, arg...)
-# define LOG_EXIT_ARGS(fmt, arg...)
-# define LOG_TRACE_ARGS(fmt, arg...)
-# define LOG_PID_PRINTK(fmt, arg...)
-# define LOG_PID_STR(str)
-#endif /* !defined(TRACE) */
-
-
-
-/* TRACE enabled */
-#if defined(TRACE)
-
-#define LOG_PID_PRINTK(fmt, arg...) \
- do { \
- IF_LEVEL_PID() { \
- printk("(%d) %s(): ", ocfs_getpid(), \
- __FUNCTION__); \
- printk(fmt, ## arg); \
- } \
- } while (0)
-
-#define LOG_PID_STR(str) LOG_PID_PRINTK("%s\n", str)
-
-/* ENTRY macros */
-/* LOG_ENTRY_ARGS()
- *
- * Note: The macro expects the args to be terminated by a newline.
- */
-#define LOG_ENTRY_ARGS(fmt, arg...) \
- ENTRY_TIMING_DECLS; \
- do { \
- DECL_U8_ARRAY(_t, 16); \
- INIT_U8_ARRAY(_t); \
- GET_STACK(_t); \
- GET_TIMING(NULL, _HI, _LO); \
- IF_LEVEL(OCFS_DEBUG_LEVEL_ENTRY) { \
- PRINT_ENTRY(_t); \
- if (fmt==NULL) \
- printk("() \n"); \
- else \
- printk(fmt, ##arg); \
- } \
- } while (0)
-
-#define LOG_ENTRY() LOG_ENTRY_ARGS(NULL)
-
-
-
-/* EXIT macros */
-/* LOG_EXIT_ARGS()
- *
- */
-#define LOG_EXIT_ARGS(fmt, arg...) \
- do { \
- IF_LEVEL(OCFS_DEBUG_LEVEL_EXIT) { \
- DECL_U8_ARRAY(_t, 50); \
- INIT_U8_ARRAY(_t); \
- GET_TIMING(_t, _HI, _LO); \
- printk("(%d) EXIT : %s() %s", \
- ocfs_getpid (), __FUNCTION__, \
- (fmt==NULL ? "" : "= ")); \
- if (fmt!=NULL) \
- printk(fmt, ## arg); \
- PRINT_STRING(_t); \
- } \
- } while (0)
-
-#define LOG_EXIT() LOG_EXIT_ARGS(NULL)
-#define LOG_EXIT_STATUS(val) LOG_EXIT_ARGS("%d ", val)
-#define LOG_EXIT_LONG(val) LOG_EXIT_ARGS("%d ", val)
-#define LOG_EXIT_ULONG(val) LOG_EXIT_ARGS("%u ", val)
-#define LOG_EXIT_PTR(val) LOG_EXIT_ARGS("0x%08x ", val)
-
-
-/* TRACE macros */
-/* LOG_TRACE_ARGS()
- *
- * Note: The macro expects the args to be terminated by a newline.
- */
-#define LOG_TRACE_ARGS(fmt, arg...) \
- do { \
- IF_LEVEL(OCFS_DEBUG_LEVEL_TRACE) { \
- printk("(%d) TRACE: %s() ", ocfs_getpid (), \
- __FUNCTION__); \
- printk(fmt, ## arg); \
- } \
- } while (0)
-
-#define LOG_TRACE_STR(str) LOG_TRACE_ARGS("%s\n", str)
-#define LOG_TRACE_STATUS(val) LOG_TRACE_ARGS("%d\n", val);
-
-#endif /* TRACE */
-
-
-
-/* ERROR macros are not compiled out */
-/* LOG_ERROR_ARGS()
- *
- * Note: The macro expects the args to be terminated by a newline.
- */
-#define LOG_ERROR_ARGS(fmt, arg...) \
- do { \
- printk(KERN_ERR "(%d) ERROR: ", ocfs_getpid ()); \
- printk(fmt, ## arg); \
- printk(", %s, %d\n", __FILE__, __LINE__); \
- } while (0)
-
-#define LOG_ERROR_STR(str) LOG_ERROR_ARGS("%s", str)
-#define LOG_ERROR_STATUS(st) LOG_ERROR_ARGS("status = %d", st)
-
-#define LOG_TYPE_DISK_ALLOC 1
-#define LOG_TYPE_RECOVERY 3
-#define LOG_DELETE_ENTRY 8
-#define LOG_MARK_DELETE_ENTRY 9
-#define LOG_FREE_BITMAP 10
-#define LOG_DELETE_NEW_ENTRY 12
-
-
-#define LOG_RECOVER 1
-#define LOG_CLEANUP 2
-
-#define OCFS_MINOR_VERSION (2)
-#define OCFS_MAJOR_VERSION (1)
-#define OCFS_MINOR_VER_STRING "2"
-#define OCFS_MAJOR_VER_STRING "1"
-
-#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_ALL (DLOCK_FLAG_OPEN_MAP | DLOCK_FLAG_LOCK | \
- DLOCK_FLAG_SEQ_NUM | DLOCK_FLAG_MASTER | \
- DLOCK_FLAG_LAST_UPDATE)
-
-
-#define DISK_LOCK_CURRENT_MASTER(x) ( ((ocfs_disk_lock *)x)->curr_master )
-#define DISK_LOCK_OIN_MAP(x) ( ((ocfs_disk_lock *)x)->oin_node_map )
-#define DISK_LOCK_FILE_LOCK(x) ( ((ocfs_disk_lock *)x)->file_lock )
-#define DISK_LOCK_LAST_READ(x) ( ((ocfs_disk_lock *)x)->last_read_time )
-#define DISK_LOCK_LAST_WRITE(x) ( ((ocfs_disk_lock *)x)->last_write_time )
-#define DISK_LOCK_READER_NODE(x) ( ((ocfs_disk_lock *)x)->reader_node_num )
-#define DISK_LOCK_SEQNUM(x) ( ((ocfs_disk_lock *)x)->dlock_seq_num )
-#define DISK_LOCK_WRITER_NODE(x) ( ((ocfs_disk_lock *)x)->writer_node_num )
-
-#define MAX_VOL_ID_LENGTH 16
-#define MAX_VOL_LABEL_LEN 64
-#define MAX_CLUSTER_NAME_LEN 64
-
-
-#define OCFS_IPC_DEFAULT_PORT 7000
-
-
-#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
-
-
-/* =========================================================== */
-
-typedef struct _ocfs_clean_buffer_list ocfs_clean_buffer_list;
-
-struct _ocfs_clean_buffer_list
-{
- unsigned long blocknr[BLOCKS_PER_CLEAN_LIST-1];
- struct _ocfs_clean_buffer_list *next;
-};
-
-
-typedef struct _ocfs_sem
-{
- long magic; /* OCFS_SEM_MAGIC */
- pid_t pid;
- long count;
- struct semaphore sem;
-}
-ocfs_sem;
-
-typedef struct _HASHBUCKET
-{
- __u32 keylen;
- __u32 vallen;
- void *key;
- void *val;
- struct _HASHBUCKET *next;
-}
-HASHBUCKET;
-
-typedef struct
-{
- __u32 size;
- __u32 mask;
- __u32 entries;
- __u32 inithash;
- __u32 newbuckets; /* Used for statistics */
- __u32 reusedbuckets; /* Used for statistics */
- ocfs_sem hashlock;
- HASHBUCKET *lastfree;
- HASHBUCKET *freelist;
- HASHBUCKET *buckets;
-}
-HASHTABLE;
-
-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
- __u32 uid; // UID
- __u32 gid; // GID
- __s32 excl_mount; // NODENUM
-}
-ocfs_vol_disk_hdr; // END CLASS
-
-typedef struct _ocfs_disk_lock // CLASS
-{
- __u32 curr_master; // NODENUM
- __u8 file_lock; // LOCKLEVEL
- __u64 last_write_time; // NUMBER RANGE(0,ULONG_LONG_MAX
- __u64 last_read_time; // NUMBER RANGE(0,ULONG_LONG_MAX
- __u32 writer_node_num; // NODENUM
- __u32 reader_node_num; // NODENUM
- __u64 oin_node_map; // NODEBITMAP
- __u64 dlock_seq_num; // NUMBER RANGE(0,ULONG_LONG_MAX)
-}
-ocfs_disk_lock; // END CLASS
-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_disk_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
- __u8 journal_version;
-}
-ocfs_disk_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)
- __u64 cfg_seq_num; // NUMBER RANGE(0,ULONG_LONG_MAX)
-}
-OCFS_GCC_ATTR_PACKALGN
-ocfs_node_config_hdr; // END CLASS
-
-typedef struct _ocfs_node_config_info
-{
- char node_name[MAX_NODE_NAME_LENGTH];
- ocfs_guid guid;
- ocfs_ipc_config_info ipc_config;
- __u8 journal_version; /* 0 is old style, 1 is new style */
-}
-ocfs_node_config_info;
-
-
-#define OCFS_BITMAP_CHUNK (512) /* size of a chunk, in bytes */
-#define OCFS_BITS_IN_CHUNK (OCFS_BITMAP_CHUNK * 8)
-//#define OCFS_BITMAP_NUM_BH (ONE_MEGA_BYTE / OCFS_BITMAP_CHUNK)
-/* Lovely convenience macros. If we move to a scheme where
- * OCFS_BITS_IN_CHUNK or OCFS_BITMAP_NUM_BH are 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;
-
-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;
- bool 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;
- struct _ocfs_inode *oin; /* ptr to the assoc. ocfs_inode */
- __u64 curr_byte_off;
- __s64 curr_dir_off;
- struct buffer_head **curr_dir_buf;
- ocfs_filldir filldir;
-}
-ocfs_file;
-
-typedef struct _ocfs_inode ocfs_inode;
-typedef struct _ocfs_super ocfs_super;
-typedef struct _ocfs_io_runs ocfs_io_runs;
-typedef struct _ocfs_lock_res ocfs_lock_res;
-
-struct _ocfs_lock_res
-{
- __u32 signature;
- __u8 lock_type; /* Support only Exclusive & Shared */
- atomic_t lr_share_cnt; /* Used in case of Shared resources */
- atomic_t lr_ref_cnt; /* When 0, freed */
- __u32 master_node_num; /* Master Node */
- __u64 last_upd_seq_num;
- __u64 last_lock_upd;
- __u64 sector_num;
- __u64 oin_openmap;
- __u64 tmp_openmap; /* oin_openmap collected over the comm */
- __u8 in_use;
- int thread_id;
- struct list_head cache_list;
- bool in_cache_list;
- bool cache_lock_held;
- __u32 lock_state;
- __u32 vote_state; /* Is the lockres being voted on over ipcdlm */
- ocfs_inode *oin;
- spinlock_t lock_mutex;
- wait_queue_head_t voted_event;
- atomic_t voted_event_woken;
- __u64 req_vote_map;
- __u64 got_vote_map;
- __u32 vote_status;
- __u64 last_write_time;
- __u64 last_read_time;
- __u32 writer_node_num;
- __u32 reader_node_num;
- __u32 lock_holders;
-};
-
-struct _ocfs_inode
-{
- ocfs_obj_id obj_id;
- __s64 alloc_size;
- struct inode *inode;
- ocfs_sem main_res;
- ocfs_sem paging_io_res;
- ocfs_lock_res *lock_res;
- __u64 file_disk_off; /* file location on the volume */
- __u64 dir_disk_off; /* for dirs, offset to dirnode structure */
- __u64 chng_seq_num;
- __u64 parent_dirnode_off; /* from the start of vol */
- ocfs_extent_map map;
- struct _ocfs_super *osb; /* ocfs_inode belongs to this volume */
- __u32 oin_flags;
- struct list_head next_ofile; /* list of all ofile(s) */
- __u32 open_hndl_cnt;
- bool needs_verification;
- bool cache_enabled;
- struct list_head needs_flush_list;
- bool in_needs_flush_list;
- bool journal_inode; /* is this the journal oin? */
- struct list_head recovery_list;
-};
-
-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;
- __u32 uid;
- __u32 gid;
-}
-ocfs_vol_layout;
-
-typedef struct _ocfs_vol_node_map
-{
- __u64 time[OCFS_MAXIMUM_NODES];
- __u64 scan_time[OCFS_MAXIMUM_NODES];
- __u8 scan_rate[OCFS_MAXIMUM_NODES];
-#ifdef UNUSED
- __u8 exp_scan_rate[OCFS_MAXIMUM_NODES];
- __u64 exp_rate_chng_time[OCFS_MAXIMUM_NODES];
-#endif
- __u32 miss_cnt[OCFS_MAXIMUM_NODES];
- atomic_t dismount[OCFS_MAXIMUM_NODES];
- __u64 largest_seq_num;
-}
-ocfs_vol_node_map;
-
-struct _ocfs_bitmap_free_head;
-
-/*
- * ocfs_super
- *
- * A mounted volume is represented using the following structure.
- */
-struct _ocfs_super
-{
- ocfs_obj_id obj_id;
- ocfs_sem 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 complete;
- struct task_struct *dlm_task;
- __u32 osb_flags;
- __s64 file_open_cnt; /* num of open files/dirs. vol cannot be dismounted if > 0 */
- __u64 publ_map; /* each bit represents state of node */
- HASHTABLE root_sect_node; /* lockres->sector_num hash */
- struct list_head cache_lock_list;
- struct super_block *sb;
- ocfs_inode *oin_root_dir; /* ptr to the root dir ocfs_inode */
- ocfs_vol_layout vol_layout;
- ocfs_vol_node_map vol_node_map;
- ocfs_node_config_info *node_cfg_info[OCFS_MAXIMUM_NODES];
- __u64 cfg_seq_num;
- bool cfg_initialized;
- __u32 num_cfg_nodes;
- __u32 node_num;
- bool reclaim_id; /* reclaim the original node number*/
- __u8 hbm;
- __u32 hbt;
- __u64 log_disk_off;
- __u64 log_meta_disk_off;
- __u64 log_file_size;
- __u32 sect_size;
- bool needs_flush;
- ocfs_sem map_lock;
- ocfs_extent_map metadata_map;
- ocfs_extent_map trans_map;
-
- ocfs_alloc_bm cluster_bitmap;
-#if 0
- /* eventually we should want to "cache" these too */
- ocfs_alloc_bm file_alloc_bitmap;
- ocfs_alloc_bm dir_alloc_bitmap;
-#endif
- __u32 max_dir_node_ent;
- ocfs_vol_state vol_state;
- __s64 curr_trans_id;
- bool trans_in_progress;
- ocfs_sem log_lock;
- ocfs_sem recovery_lock;
- spinlock_t recovery_map_lock;
- __u32 recovery_map;
- ocfs_sem dir_alloc_lock;
- ocfs_sem file_alloc_lock;
- ocfs_sem vol_alloc_lock;
- 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;
- ocfs_io_runs *data_prealloc;
- ocfs_io_runs *md_prealloc;
-// __u8 *cfg_prealloc;
- 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 */
- bool publish_dirty;
- __u32 in_voting;
- ocfs_sem voting_lock;
- struct list_head needs_flush_head;
- ocfs_sem vol_lock_res;
- 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[OCFS_MAXIMUM_NODES];
- __u64 last_publ_seq_num[OCFS_MAXIMUM_NODES];
- bool have_local_alloc;
- /* These two are protected by the trans_lock. */
- struct buffer_head *local_alloc_bh;
- struct _ocfs_bitmap_free_head *alloc_free_head;
-};
-
-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;
- ocfs_sem res;
- struct list_head osb_next; /* List of all volumes */
- kmem_cache_t *oin_cache;
- kmem_cache_t *ofile_cache;
- kmem_cache_t *fe_cache;
- kmem_cache_t *lockres_cache;
- kmem_cache_t *extent_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 */
- bool comm_info_read; /* ipc info loaded from config file */
- __u8 hbm;
- spinlock_t comm_seq_lock; /* protects comm_seq_num */
- __u64 comm_seq_num; /* local node seq num used in ipcdlm */
-#ifdef OCFS_LINUX_MEM_DEBUG
- struct list_head item_list;
-#endif
- atomic_t cnt_lockres; /* count of allocated lockres */
-}
-ocfs_global_ctxt;
-
-struct _ocfs_io_runs
-{
- __u64 disk_off;
- __u32 offset;
- __u32 byte_cnt;
-};
-
-typedef struct _ocfs_ipc_ctxt
-{
- ocfs_sem ipc_ctxt_res;
- __u32 dlm_msg_size;
- __u16 version;
- bool init;
- bool re_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_alloc_ext // CLASS
-{
- /* Starting offset within the file */
- __u64 file_off; // DISKPTR
- /* Number of bytes used by this alloc */
- /* WARNING!: should never be greater than LONG_MAX! */
- __u64 num_bytes; // NUMBER RANGE(0,LONG_MAX)
- /* Physical Disk Offset */
- __u64 disk_off; // DISKPTR
-}
-ocfs_alloc_ext; // END CLASS
-
-typedef struct _ocfs_publish // CLASS
-{
- __u64 time; // NUMBER RANGE(0,ULONG_LONG_MAX)
- __s32 vote; // BOOL
- bool dirty; // BOOL
- __u32 vote_type; // FILEFLAG
- __u64 vote_map; // NODEBITMAP
- __u64 publ_seq_num; // NUMBER RANGE(0,ULONG_LONG_MAX)
- __u64 dir_ent; // NUMBER RANGE(0,ULONG_LONG_MAX)
- __u8 hbm[OCFS_MAXIMUM_NODES]; // UNUSED
- /* last seq num used in comm voting */
- __u64 comm_seq_num; // NUMBER RANGE(0,ULONG_LONG_MAX)
- bool mounted; /* used for journaling */
-}
-OCFS_GCC_ATTR_PACKALGN
-ocfs_publish; // END CLASS
-
-typedef struct _ocfs_vote // CLASS
-{
- __u8 vote[OCFS_MAXIMUM_NODES]; // VOTEFLAG[OCFS_MAXIMUM_NODES]
- __u64 vote_seq_num; // NUMBER RANGE(0,ULONG_LONG_MAX)
- __u64 dir_ent; // NUMBER RANGE(0,ULONG_LONG_MAX)
- __u8 open_handle; // BOOL
-}
-OCFS_GCC_ATTR_PACKALGN
-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;
-
-typedef struct _ocfs_file_entry // CLASS
-{
- ocfs_disk_lock disk_lock; // DISKLOCK
- __u8 signature[8]; // CHAR[8]
- bool local_ext; // BOOL
- __u8 next_free_ext; // NUMBER RANGE(0,OCFS_MAX_FILE_ENTRY_EXTENTS)
- __s8 next_del; // DIRNODEINDEX
- __s32 granularity; // NUMBER RANGE(-1,3)
- __u8 filename[OCFS_MAX_FILENAME_LENGTH]; // CHAR[OCFS_MAX_FILENAME_LENGTH]
- __u16 filename_len; // NUMBER RANGE(0,OCFS_MAX_FILENAME_LENGTH)
- __u64 file_size; // NUMBER RANGE(0,ULONG_LONG_MAX)
- __u64 alloc_size; // NUMBER RANGE(0,ULONG_LONG_MAX)
- __u64 create_time; // DATE
- __u64 modify_time; // DATE
- ocfs_alloc_ext extents[OCFS_MAX_FILE_ENTRY_EXTENTS]; // EXTENT[OCFS_MAX_FILE_ENTRY_EXTENTS]
- __u64 dir_node_ptr; // NUMBER RANGE(0,ULONG_LONG_MAX)
- __u64 this_sector; // NUMBER RANGE(0,ULONG_LONG_MAX)
- __u64 last_ext_ptr; /* NUMBER RANGE(0,ULONG_LONG_MAX)
- Points to the last
- allocated extent */
- __u32 sync_flags; // NUMBER RANGE(0,0)
- __u32 link_cnt; // NUMBER RANGE(0,UINT_MAX)
- __u32 attribs; // ATTRIBS
- __u32 prot_bits; // PERMS
- __u32 uid; // UID
- __u32 gid; // GID
- __u16 dev_major; // NUMBER RANGE(0,65535)
- __u16 dev_minor; // NUMBER RANGE(0,65535)
-/* 32-bit: sizeof(fe) = 484 bytes */
-/* 64-bit: sizeof(fe) = 488 bytes */
-/* Need to account for that fact when the struct is extended. */
-}
-ocfs_file_entry; // END CLASS
-
-/* not sizeof-safe across platforms */
-typedef struct _ocfs_index_node
-{
- __u64 down_ptr;
- __u64 file_ent_ptr;
- __u8 name_len;
- __u8 name[1];
-}
-OCFS_GCC_ATTR_PACKALGN
-ocfs_index_node;
-
-typedef struct _ocfs_index_hdr
-{
- ocfs_disk_lock disk_lock;
- __u64 signature;
- __s64 up_tree_ptr; /* Pointer to parent of this dnode */
- __u64 node_disk_off;
- __u8 state; /* In recovery, needs recovery etc */
- __u64 down_ptr OCFS_GCC_ATTR_ALIGNED;
- __u8 num_ents;; /* Number of extents in this Node */
- __u8 depth; /* Depth of this Node from root of the btree */
- __u8 num_ent_used; /* Num of entries in the dir blk used up. */
- __u8 dir_node_flags; /* Flags */
- __u8 sync_flags; /* Flags */
- __u8 index[256];
- __u8 reserved[161];
- __u8 file_ent[1]; /* 63 entries here with 32K DIR_NODE size */
-}
-OCFS_GCC_ATTR_PACKED
-ocfs_index_hdr;
-
-/* not sizeof-safe across platforms */
-typedef struct _ocfs_dir_node // CLASS
-{
- ocfs_disk_lock disk_lock; // DISKLOCK
- __u8 signature[8]; // CHAR[8]
- __u64 alloc_file_off; // NUMBER RANGE(0,ULONG_LONG_MAX)
- __u32 alloc_node; // NUMBER RANGE(0,31)
- __u64 free_node_ptr; /* Used in topmost dirnode,
- * points to last dirnode in
- * chain, or -1 if only
- * one. */
- __u64 node_disk_off; // DISKPTR
- __s64 next_node_ptr; // DISKPTR
- __s64 indx_node_ptr; // DISKPTR
-
- __s64 next_del_ent_node; /* Used in non-topmost
- * dirnodes, continues the
- * chain of dirnodes which
- * have had fe's deleted
- * from. -1 means end of list. */
- __s64 head_del_ent_node; /* Used in topmost dirnode,
- * points to head of a list
- * of dirnodes which we've
- * deleted from. -1 if never
- * deleted, or we've only
- * got one dirnode. */
- __u8 first_del; // DIRNODEINDEX
- __u8 num_del; // NUMBER RANGE(0,254)
- __u8 num_ents; // NUMBER RANGE(0,254)
- __u8 depth; // UNUSED
- __u8 num_ent_used; // NUMBER RANGE(0,254)
- __u8 dir_node_flags; // DIRFLAG
- __u8 sync_flags; // SYNCFLAG
- __u8 index[256]; // DIRINDEX
- __u8 index_dirty; // NUMBER RANGE(0,1)
- __u8 bad_off; // NUMBER RANGE(0,254)
- __u8 reserved[127]; // UNUSED
- __u8 file_ent[1]; // UNUSED
-}
-OCFS_GCC_ATTR_PACKALGN
-ocfs_dir_node; // END CLASS
-
-
-
-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_alloc_ext extents[OCFS_MAX_DATA_EXTENTS]; // EXTENT[OCFS_MAX_DATA_EXTENTS]
-}
-ocfs_extent_group; // END CLASS
-
-typedef struct _ocfs_bitmap_lock
-{
- ocfs_disk_lock disk_lock;
- __u32 used_bits;
-}
-OCFS_GCC_ATTR_PACKALGN
-ocfs_bitmap_lock;
-
-typedef struct _ocfs_dlm_msg_hdr
-{
- __u64 lock_id;
- __u32 flags;
- __u64 lock_seq_num;
- __u8 open_handle;
-}
-OCFS_GCC_ATTR_PACKALGN
-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[1];
-}
-ocfs_dlm_msg;
-
-typedef struct _ocfs_recv_ctxt
-{
- __s32 msg_len;
- __u8 msg[OCFS_MAX_DLM_PKT_SIZE];
- int status;
-#ifdef LINUX_2_5
- struct work_struct ipc_wq;
-#else
- struct tq_struct ipc_tq;
-#endif
-}
-ocfs_recv_ctxt;
-
-typedef struct _ocfs_offset_map
-{
- __u32 length;
- __u64 log_disk_off;
- __u64 actual_disk_off;
-}
-OCFS_GCC_ATTR_PACKALGN
-ocfs_offset_map;
-
-typedef struct _ocfs_cfg_task
-{
-#ifdef LINUX_2_5
- 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;
- __u64 *got_vote_map;
- __u64 *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 */
-#define DISK_ALLOC_DIR_NODE 1
-#define DISK_ALLOC_EXTENT_NODE 2
-#define DISK_ALLOC_VOLUME 3
-
-/* 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;
-
-#define alloc_bitmap_free_head() \
- ({ \
- 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)); \
- } \
- f; \
- })
-
-#define free_bitmap_free_head(f) \
- do { \
- 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)); \
- } \
- } \
- ocfs_safefree((f)); \
- } while(0)
-
-
-struct ocfs_ioc
-{
- char name[255]; /* "OCFS" */
- char version[255]; /* version */
- __u16 nodenum; /* node number */
- char nodename[255]; /* node name */
-};
-
-
-
-
-typedef struct _ocfs_find_inode_args
-{
- __u64 offset;
-// ocfs_file_entry *entry;
- struct buffer_head *fe_bh;
-}
-ocfs_find_inode_args;
-/* 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 ocfs_acquire_lockres(a) ocfs_acquire_lockres_ex(a, 0)
-
-static void ocfs_timeout_func(unsigned long data)
-{
- ocfs_timeout *to = (ocfs_timeout *)data;
-
- to->timed_out = 1;
- wake_up(&to->wait);
-}
-
-static inline void ocfs_init_timeout(ocfs_timeout *to)
-{
- init_timer(&to->timer);
- to->timer.data = (unsigned long)to;
- to->timer.function = ocfs_timeout_func;
- to->timed_out = 0;
- init_waitqueue_head(&to->wait);
-}
-
-static inline void ocfs_set_timeout(ocfs_timeout *to, __u32 timeout)
-{
- __u32 how_long;
-
- if (!timeout) {
- to->timed_out = 1;
- return ;
- }
-
- how_long = (timeout * HZ / 1000);
- if (how_long < 1)
- how_long = 1;
-
- to->timer.expires = jiffies + how_long;
- add_timer(&to->timer);
-}
-
-static inline void ocfs_clear_timeout(ocfs_timeout *to)
-{
- del_timer_sync(&to->timer);
-}
-
-#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 */
-
-
-#include "ocfsio.h"
-
-#define OCFS_FE_CACHE_FLAGS(__osb, __fe) \
-({ \
- int __ret = 0; \
- if ((DISK_LOCK_FILE_LOCK(__fe) == OCFS_DLM_ENABLE_CACHE_LOCK) && \
- (DISK_LOCK_CURRENT_MASTER(__fe) == osb->node_num) && \
- (__fe->this_sector >= __osb->vol_layout.bitmap_off)) \
- __ret = OCFS_BH_CACHED; \
- __ret; \
-})
-
-#include "proto.h"
-
-#endif /* !OCFS_H */
Deleted: trunk/inc/ocfsio.h
===================================================================
--- trunk/inc/ocfsio.h 2003-12-18 23:17:02 UTC (rev 11)
+++ trunk/inc/ocfsio.h 2003-12-18 23:24:27 UTC (rev 12)
@@ -1,421 +0,0 @@
-#ifndef OCFSIO_H
-#define OCFSIO_H
-
-#include <linux/fs.h>
-#include <linux/compiler.h>
-
-static inline int ocfs_write_bh (ocfs_super * osb, struct buffer_head *bh, int flags, struct inode *inode);
-static inline int ocfs_write_bhs (ocfs_super * osb, struct buffer_head *bh[], int nr, int flags, struct inode *inode);
-static inline int ocfs_read_bh (ocfs_super * osb, __u64 off, struct buffer_head **bh, int flags, struct inode *inode);
-static inline int ocfs_read_bhs (ocfs_super * osb, __u64 off, __u64 len, struct buffer_head *bhs[], int flags, struct inode *inode);
-
-#define OCFS_BH_CACHED 1
-#define OCFS_BH_COND_CACHED 4
-/* This should only be used by ocfs_checkpoint_handle! */
-#define OCFS_BH_IGNORE_JBD 8
-
-#define OCFS_NONCACHED(osb,off) ((off) < (osb)->vol_layout.data_start_off)
-
-#ifdef DEBUG_LOCK_BUFFER
-#define LOCK_BUFFER_STR(bh) if (buffer_locked(bh)) \
- printk("ocfs: (%d) BUFFER LOCKED! blocknr=%u\n", \
- current->pid, (bh)->b_blocknr)
-#else
-#define LOCK_BUFFER_STR(bh)
-#endif
-
-#ifdef VERBOSE_DEBUG_LOCK_BUFFER
-#define VERBOSE_LOCK_BUFFER_STR(bh) printk("ocfs: (%d) locking buffer %u\n", \
- current->pid, (bh)->b_blocknr)
-#define VERBOSE_UNLOCK_BUFFER_STR(bh) printk("ocfs: (%d) unlocking buffer %u\n", \
- current->pid, (bh)->b_blocknr)
-#else
-#define VERBOSE_LOCK_BUFFER_STR(bh)
-#define VERBOSE_UNLOCK_BUFFER_STR(bh)
-#endif
-
-
-#define OCFS_BH_GET_DATA(bh) ({ \
- char *kaddr; \
- LOCK_BUFFER_STR(bh); \
- VERBOSE_LOCK_BUFFER_STR(bh); \
- lock_buffer(bh); \
- kaddr = kmap((bh)->b_page); \
- if (kaddr) \
- kaddr += ((unsigned long)(bh)->b_data & ~PAGE_MASK); \
- else \
- unlock_buffer(bh); \
- kaddr; \
- })
-
-#define OCFS_BH_PUT_DATA(bh) ({ \
- kunmap((bh)->b_page); \
- VERBOSE_UNLOCK_BUFFER_STR(bh); \
- unlock_buffer(bh); \
- })
-
-#define STATE_BIT_MAX (1 << 13)
-#define STATE_BIT_MAX_MASK ((1 << 13)-1)
-#define STATE_BIT_MASK ((~0UL)<<19)
-
-
-static inline void SET_BH_SEQNUM(struct inode *inode, struct buffer_head *bh)
-{
- unsigned int prev = bh->b_state & STATE_BIT_MASK;
- unsigned int seq = (atomic_read(GET_INODE_CLEAN_SEQ(inode)) & STATE_BIT_MAX_MASK) << 19;
- bh->b_state &= ~prev;
- bh->b_state |= seq;
-}
-
-static inline int TEST_BH_SEQNUM(struct inode *inode, struct buffer_head *bh)
-{
- int ret;
- unsigned int seq = (bh->b_state & STATE_BIT_MASK) >> 19;
- ret = (seq == atomic_read(GET_INODE_CLEAN_SEQ(inode)));
- return ret;
-}
-
-static inline int check_block_zero_write(struct buffer_head *bh)
-{
- if (unlikely(bh->b_blocknr == 0)) {
- ocfs_vol_disk_hdr *hdr = (ocfs_vol_disk_hdr *)OCFS_BH_GET_DATA(bh);
- if (hdr == NULL) {
- printk ("ocfs: failed to map bh page!!!\n");
- return -EIO;
- }
- printk ("ocfs: Blocknum is zero!!!\n");
- if (memcmp(hdr->signature, OCFS_VOLUME_SIGNATURE, strlen(OCFS_VOLUME_SIGNATURE)) != 0) {
- printk("ocfs: WARNING! attempting to write non volume header to block 0\n");
- OCFS_BH_PUT_DATA(bh);
- return -EIO;
- }
- OCFS_BH_PUT_DATA(bh);
- }
- return 0;
-}
-
-
-static inline int ocfs_write_bh (ocfs_super * osb, struct buffer_head *bh, int flags, struct inode *inode)
-{
- int ret;
-
- IO_FUNC_TIMING_DECL
-
- ret = ocfs_write_bhs (osb, &bh, 1, flags, inode);
-
- IO_FUNC_TIMING_PRINT("ocfs_write_bh", ret)
-
- return ret;
-}
-
-static inline int ocfs_write_bhs (ocfs_super * osb, struct buffer_head *bhs[], int nr, int flags, struct inode *inode)
-{
- int status = 0;
- int i;
- struct super_block *sb;
- ocfs_blockdev dev;
- struct buffer_head *bh;
- int jbd_managed_buffers = 0;
-
- IO_FUNC_TIMING_DECL
-
- if (osb == NULL || osb->sb == NULL || bhs == NULL) {
- printk("ocfs: osb == NULL || osb->sb == NULL || bhs == NULL\n");
- status = -EINVAL;
- goto bail;
- }
-
- if (nr > 256)
- printk ("ocfs: Getting write for %d blocks\n", nr);
-
- sb = osb->sb;
- dev = OCFS_GET_BLOCKDEV(sb);
-
- if (OCFS_NONCACHED(osb, bhs[0]->b_blocknr << 9)) {
- if (flags & OCFS_BH_CACHED)
- printk("ocfs: hey bozo you are trying to write a system thingy cached!\n");
- flags &= ~OCFS_BH_CACHED;
- }
-
- if (nr > 1 && flags & OCFS_BH_CACHED) {
- printk("ocfs: hey bozo you are trying to write multiple blocks cached!\n");
- flags &= ~OCFS_BH_CACHED;
- }
-
- for (i = 0 ; i < nr ; i++) {
- bh = bhs[i];
- if (bh == NULL) {
- printk("ocfs: bh == NULL\n");
- status = -EIO;
- goto bail;
- }
-
- if (check_block_zero_write(bh) < 0)
- goto bail;
-
- if (!(flags & OCFS_BH_IGNORE_JBD) && buffer_jbd(bh)) {
-#ifdef VERBOSE_BH_JBD_TRACE
- printk("ocfs: trying to write a jbd managed bh "
- "(blocknr = %u), nr=%d\n", bh->b_blocknr, nr);
-#endif
- /* they should not have dirty bit set... */
- jbd_managed_buffers++;
- continue;
- }
-
- LOCK_BUFFER_STR(bh);
- VERBOSE_LOCK_BUFFER_STR(bh);
- lock_buffer(bh);
-#ifdef LINUX_2_5
- set_buffer_uptodate(bh);
-#else
- mark_buffer_uptodate(bh, true);
-#endif
- mark_buffer_dirty(bh);
- if (flags & OCFS_BH_CACHED && inode && !TEST_BH_SEQNUM(inode,bh)) {
-#ifdef VERBOSE_BH_SEQNUM_TRACE
- printk("(write) bh (%u) seqnum (%u) does not match inode (%u)\n",
- bh->b_blocknr, (bh->b_state & STATE_BIT_MASK) >> 19,
- atomic_read(GET_INODE_CLEAN_SEQ(inode)));
-#endif
- flags &= ~OCFS_BH_CACHED;
- }
- unlock_buffer(bh);
- VERBOSE_UNLOCK_BUFFER_STR(bh);
- }
-
- /* if *every* buffer submitted is already jbd managed, fully cached */
- if (jbd_managed_buffers == nr)
- flags |= OCFS_BH_CACHED;
-
- if (!(flags & OCFS_BH_CACHED))
- ll_rw_block (WRITE, nr, bhs);
-
- for (i = (nr-1) ; i >= 0; i--) {
- bh = bhs[i];
- if (!(flags & OCFS_BH_CACHED))
- wait_on_buffer(bh);
- if (inode)
- SET_BH_SEQNUM(inode, bh);
- //buffer_insert_inode_clean_queue(bh, inode);
- }
-
-bail:
-
- IO_FUNC_TIMING_PRINT("ocfs_write_bhs", status)
-
- return status;
-}
-
-static inline int ocfs_read_bh (ocfs_super * osb, __u64 off, struct buffer_head **bh, int flags, struct inode *inode)
-{
- int status = 0;
- struct super_block *sb;
- int nr;
- __u64 blocknum;
- ocfs_blockdev dev;
-
- IO_FUNC_TIMING_DECL
-
- if (osb == NULL || osb->sb == NULL || bh == NULL) {
- printk("ocfs: osb == NULL || osb->sb == NULL || bh == NULL\n");
- status = -EINVAL;
- goto error;
- }
-
- if ((flags & OCFS_BH_COND_CACHED) &&
- (off >= osb->vol_layout.bitmap_off))
- flags |= OCFS_BH_CACHED;
-
- if (OCFS_NONCACHED(osb, off)) {
- if (flags & OCFS_BH_CACHED)
- printk("ocfs: hey bozo you are trying to read a system thingy cached!\n");
- flags &= ~OCFS_BH_CACHED;
- }
-
- sb = osb->sb;
- dev = OCFS_GET_BLOCKDEV(sb);
- nr = 1;
- blocknum = off >> sb->s_blocksize_bits;
-
- if (*bh == NULL) {
- *bh = getblk (dev, blocknum, sb->s_blocksize);
- if (*bh == NULL) {
- printk("ocfs: *bh == NULL\n");
- status = -EIO;
- goto error;
- }
- }
- else if ((*bh)->b_blocknr != blocknum)
- printk("ocfs: Asking me to read blocknum = %u even though "
- "bh->blocknr == %u\n", blocknum, (*bh)->b_blocknr);
-
- if (flags & OCFS_BH_CACHED && inode && !TEST_BH_SEQNUM(inode, *bh)) {
-#ifdef VERBOSE_BH_SEQNUM_TRACE
- printk("(read) bh (%u) seqnum (%u) does not match inode (%u)\n",
- (*bh)->b_blocknr, ((*bh)->b_state & STATE_BIT_MASK) >> 19,
- atomic_read(GET_INODE_CLEAN_SEQ(inode)));
-#endif
- flags &= ~OCFS_BH_CACHED;
- }
-
- if (!(flags & OCFS_BH_CACHED) && buffer_jbd(*bh)) {
-#ifdef VERBOSE_BH_JBD_TRACE
- printk("ocfs: trying to sync read a jbd managed bh "
- "(blocknr = %u)\n", (*bh)->b_blocknr);
-#endif
- goto error;
- }
-
- if (!(flags & OCFS_BH_CACHED)) {
- LOCK_BUFFER_STR(*bh);
- VERBOSE_LOCK_BUFFER_STR(*bh);
- lock_buffer(*bh);
- if (!buffer_dirty(*bh))
-#ifdef LINUX_2_5
- clear_buffer_uptodate(*bh);
-#else
- mark_buffer_uptodate(*bh, false);
-#endif
- unlock_buffer(*bh);
- VERBOSE_UNLOCK_BUFFER_STR(*bh);
- }
-
- status = 0;
- ll_rw_block(READ, nr, bh);
-
- wait_on_buffer(*bh);
- if (inode)
- SET_BH_SEQNUM(inode, *bh);
- //buffer_insert_inode_clean_queue(*bh, inode);
-
-error:
-
- IO_FUNC_TIMING_PRINT("ocfs_read_bh", status)
-
- return status;
-
-}
-
-/*
- * ocfs_read_bhs()
- *
- */
-static inline int ocfs_read_bhs (ocfs_super * osb, __u64 off, __u64 len, struct buffer_head *bhs[], int flags, struct inode *inode)
-{
- int status = 0;
- struct super_block *sb;
- int nr, i, ignore_cache;
- __u64 blocknum;
- ocfs_blockdev dev;
- struct buffer_head *bh;
-
- IO_FUNC_TIMING_DECL
-
- if (len % 512) {
- printk("ocfs: len %% 512 (len=%u)\n", len);
- status = -EINVAL;
- goto done;
- }
-
- if (osb == NULL || osb->sb == NULL || bhs == NULL) {
- printk("ocfs: osb == NULL || osb->sb == NULL || bhs == NULL || num == NULL\n");
- status = -EINVAL;
- goto done;
- }
-
- if ((flags & OCFS_BH_COND_CACHED) &&
- (off >= osb->vol_layout.bitmap_off))
- flags |= OCFS_BH_CACHED;
-
- if (OCFS_NONCACHED(osb, off)) {
- if (flags & OCFS_BH_CACHED)
- printk("ocfs: hey bozo you are trying to write a system thingy cached!\n");
- flags &= ~OCFS_BH_CACHED;
- }
-
- sb = osb->sb;
- dev = OCFS_GET_BLOCKDEV(sb);
- blocknum = off >> sb->s_blocksize_bits;
-
- nr = (len + 511) >> 9;
- if (nr == 0) {
- printk("ocfs: No buffers will be read!!!\n");
- printk("ocfs: Len=%u Off=%u.%u numbuffers=%u blocknum=%u.%u\n", len,
- HI (off), LO (off), nr, HI (blocknum), LO (blocknum));
- status = 0;
- goto done;
- }
-
- for (i = 0 ; i < nr ; i++) {
- if (bhs[i] == NULL) {
- bhs[i] = getblk (dev, blocknum++, sb->s_blocksize);
- if (bhs[i] == NULL) {
- printk("ocfs: bh == NULL\n");
- status = -EIO;
- goto done;
- }
- }
- bh = bhs[i];
-
- ignore_cache = 0;
-
- if (flags & OCFS_BH_CACHED && inode && !TEST_BH_SEQNUM(inode,bh)) {
-#ifdef VERBOSE_BH_SEQNUM_TRACE
- printk("(read) bh (%u) seqnum (%u) does not match inode (%u)\n",
- bh->b_blocknr, (bh->b_state & STATE_BIT_MASK) >> 19,
- atomic_read(GET_INODE_CLEAN_SEQ(inode)));
-#endif
- ignore_cache = 1;
- }
-
- if (!(flags & OCFS_BH_CACHED) || ignore_cache) {
- if (buffer_jbd(bh)) {
-#ifdef VERBOSE_BH_JBD_TRACE
- printk("ocfs: trying to sync read a jbd "
- "managed bh (blocknr = %u)\n",
- bh->b_blocknr);
-#endif
- if (!buffer_uptodate(bh)) {
- printk("ocfs: jbd buffer is not "
- "uptodate!\n");
- status = -EINVAL;
- goto done;
- }
- continue;
- }
-
- LOCK_BUFFER_STR(bh);
- VERBOSE_LOCK_BUFFER_STR(bh);
- lock_buffer(bh);
- if (!buffer_dirty(bh))
-#ifdef LINUX_2_5
- clear_buffer_uptodate(bh);
-#else
- mark_buffer_uptodate(bh, false);
-#endif
- unlock_buffer(bh);
- VERBOSE_UNLOCK_BUFFER_STR(bh);
- }
- }
-
- status = 0;
- ll_rw_block(READ, nr, bhs);
-
- for (i = (nr-1); i >= 0; i--) {
- bh = bhs[i];
- wait_on_buffer(bh);
- if (inode)
- SET_BH_SEQNUM(inode, bh);
- //buffer_insert_inode_clean_queue(bh, inode);
- }
-
-done:
-
- IO_FUNC_TIMING_PRINT("ocfs_read_bh", status)
-
- return status;
-}
-
-
-#endif /* OCFSIO_H */
Deleted: trunk/inc/proto.h
===================================================================
--- trunk/inc/proto.h 2003-12-18 23:17:02 UTC (rev 11)
+++ trunk/inc/proto.h 2003-12-18 23:24:27 UTC (rev 12)
@@ -1,206 +0,0 @@
-int ocfs_allocate_extent (ocfs_super * osb, ocfs_inode * oin, struct buffer_head *fe_bh, ocfs_journal_handle *handle,__u64 actualDiskOffset, __u64 actualLength, struct inode *inode);
-int ocfs_kill_this_tree(ocfs_super *osb, struct buffer_head *extent_grp_bh, ocfs_bitmap_free_head *free_head, struct inode *inode);
-int ocfs_free_extents_for_truncate (ocfs_super * osb, ocfs_file_entry * FileEntry, ocfs_journal_handle *handle, ocfs_bitmap_free_head *free_head, struct inode *inode);
-int ocfs_lookup_file_allocation (ocfs_super * osb, ocfs_inode * oin, __s64 Vbo, __s64 * Lbo, __u32 sectors, u32 *sector_count, struct inode *inode);
-int ocfs_get_leaf_extent (ocfs_super * osb, ocfs_file_entry * FileEntry, __s64 Vbo, struct buffer_head **data_extent_bh, struct inode *inode);
-int ocfs_find_contiguous_space_from_bitmap (ocfs_super * osb, __u64 file_size, __u64 * cluster_off, __u64 * cluster_count, bool sysfile, struct buffer_head *lock_bh);
-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_free_directory_block (ocfs_super * osb, ocfs_file_entry * fe, ocfs_bitmap_free_head *free_head, struct inode *inode);
-int ocfs_free_file_extents (ocfs_super * osb, struct buffer_head *fe_bh, ocfs_bitmap_free_head *free_head);
-
-
-int ocfs_wait_for_disk_lock_release (ocfs_super * osb, __u64 offset, __u32 time_to_wait, __u32 lock_type);
-int ocfs_disk_reset_voting (ocfs_super * osb, __u64 lock_id, __u32 lock_type);
-void ocfs_init_dlm_msg (ocfs_super * osb, ocfs_dlm_msg * dlm_msg, __u32 msg_len);
-int ocfs_acquire_lockres_ex (ocfs_lock_res * lockres, __u32 timeout);
-void ocfs_release_lockres (ocfs_lock_res * lockres);
-void ocfs_init_lockres (ocfs_super * osb, ocfs_lock_res * lockres, __u64 lock_id);
-int ocfs_create_update_lock (ocfs_super * osb, ocfs_inode * oin, __u64 lock_id, __u32 flags, bool new_file, struct inode *inode);
-int ocfs_acquire_lock (ocfs_super * osb, __u64 lock_id, __u32 lock_type,
- __u32 flags, ocfs_lock_res ** lr, struct buffer_head **bh, struct inode *inode);
-int ocfs_release_lock (ocfs_super * osb, __u64 lock_id, __u32 lock_type, __u32 flags, ocfs_lock_res * lockres, struct buffer_head *bh, struct inode *inode);
-int ocfs_init_dlm (void);
-void ocfs_process_one_vote_reply(ocfs_super *osb, ocfs_vote_reply_ctxt *ctxt, __u32 node_num);
-
-
-int ocfs_create_log_extent_map (ocfs_super * osb, __u64 diskOffset, __u64 ByteCount);
-int ocfs_write_map_file (ocfs_super * osb);
-int ocfs_extend_system_file (ocfs_super * osb, __u32 FileId, __u64 FileSize, struct buffer_head *fe_bh, ocfs_journal_handle *handle);
-
-
-void ocfs_extent_map_init (ocfs_extent_map * map);
-void ocfs_extent_map_destroy (ocfs_extent_map * map);
-void ocfs_delete_all_extent_maps (ocfs_inode * oin);
-void ocfs_remove_extent_map_entry (ocfs_super * osb, ocfs_extent_map * Map, __s64 Vbo, __u32 ByteCount);
-bool ocfs_get_next_extent_map_entry (ocfs_super * osb, ocfs_extent_map * Map, __u32 RunIndex, __s64 * Vbo, __s64 * Lbo, __u32 * SectorCount);
-bool 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);
-bool ocfs_add_extent_map_entry (ocfs_super * osb, ocfs_extent_map * Map, __s64 Vbo, __s64 Lbo, __u64 ByteCount);
-
-
-int ocfs_insert_sector_node (ocfs_super * osb, ocfs_lock_res * lock_res, ocfs_lock_res ** found_lock_res);
-int ocfs_lookup_sector_node (ocfs_super * osb, __u64 lock_id, ocfs_lock_res ** lock_res);
-void ocfs_remove_sector_node (ocfs_super * osb, ocfs_lock_res * lock_res);
-
-
-int ocfs_file_open (struct inode *inode, struct file *file);
-int ocfs_file_release (struct inode *inode, struct file *file);
-int ocfs_flush (struct file *file);
-int ocfs_sync_file (struct file *file, struct dentry *dentry, int datasync);
-ssize_t ocfs_file_write (struct file *filp, const char *buf, size_t count, loff_t * ppos);
-ssize_t ocfs_file_read (struct file *filp, char *buf, size_t count, loff_t * ppos);
-int ocfs_extend_file (ocfs_super * osb, __u64 parent_off, ocfs_inode * oin, __u64 file_size, __u64 * file_off, ocfs_journal_handle *passed_handle, struct inode *inode, struct iattr *attr);
-int ocfs_setattr (struct dentry *dentry, struct iattr *attr);
-int ocfs_getattr (struct dentry *dentry, struct iattr *attr);
-
-
-int ocfs_find_inode (struct inode *inode, unsigned long ino, void *opaque);
-void ocfs_populate_inode (struct inode *inode, ocfs_file_entry *fe, umode_t mode, void *genptr);
-void ocfs_read_locked_inode (struct inode *inode, ocfs_file_entry *entry);
-void ocfs_read_inode2 (struct inode *inode, void *opaque);
-void ocfs_read_inode (struct inode *inode);
-struct inode * ocfs_iget(struct super_block *sb, ocfs_find_inode_args *args);
-void ocfs_put_inode (struct inode *inode);
-void ocfs_clear_inode (struct inode *inode);
-int ocfs_block_symlink (struct inode *inode, const char *symname, int len);
-ssize_t ocfs_rw_direct (int rw, struct file *filp, char *buf, size_t size, loff_t * offp);
-
-
-int ocfs_submit_vol_metadata(ocfs_super *osb, ocfs_offset_map *map_buf, __u32 num);
-int ocfs_commit_cache (ocfs_super * osb, bool data_flush);
-
-void ocfs_init_sem (ocfs_sem * res);
-bool ocfs_down_sem (ocfs_sem * res, bool wait);
-void ocfs_up_sem (ocfs_sem * res);
-int ocfs_del_sem (ocfs_sem * res);
-
-
-int ocfs_hash_create (HASHTABLE *ht, __u32 noofbits);
-void ocfs_hash_destroy (HASHTABLE *ht, void (*freefn) (const void *p));
-int ocfs_hash_del (HASHTABLE * ht, void *key, __u32 keylen);
-int ocfs_hash_get (HASHTABLE * ht, void *key, __u32 keylen, void **val, __u32 * vallen);
-int ocfs_hash_add (HASHTABLE * ht, void *key, __u32 keylen, void *val, __u32 vallen, void **found, __u32 *foundlen);
-void ocfs_hash_stat (HASHTABLE * ht, char *data, __u32 datalen);
-
-
-void ocfs_version_print (void);
-
-
-void ocfs_daemonize (char *name, int len);
-int ocfs_sleep (__u32 ms);
-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_linux_dbg_alloc (int Size, char *file, int line);
-void ocfs_linux_dbg_free (const void *Buffer);
-
-
-int ocfs_verify_update_oin (ocfs_super * osb, ocfs_inode * oin);
-int ocfs_create_oin_from_entry (ocfs_super * osb, struct buffer_head * fe_bh, ocfs_inode ** new_oin, __u64 parent_dir_off, struct inode *inode);
-int ocfs_initialize_oin (ocfs_inode * oin, ocfs_super * osb, __u32 flags, __u64 file_off, __u64 lock_id, bool new_file, struct inode *inode);
-int ocfs_create_new_oin (ocfs_inode ** Returnedoin, __u64 alloc_size, ocfs_super * osb);
-int ocfs_create_root_oin (ocfs_super * osb, struct inode *root);
-void ocfs_release_oin (ocfs_inode * oin, bool FreeMemory);
-void ocfs_release_cached_oin (ocfs_super * osb, ocfs_inode * oin);
-
-
-int ocfs_initialize_osb (ocfs_super * osb, ocfs_vol_disk_hdr * vdh, ocfs_vol_label * vol_label, __u32 sect_size);
-int ocfs_verify_volume (ocfs_vol_disk_hdr * vdh);
-int ocfs_check_volume (ocfs_super * osb);
-void ocfs_delete_osb (ocfs_super * osb);
-int ocfs_create_root_dir_node (ocfs_super * osb);
-int ocfs_dismount_volume (struct super_block *sb);
-
-int ocfs_proc_init (void);
-void ocfs_proc_deinit (void);
-void ocfs_proc_add_volume (ocfs_super * osb);
-void ocfs_proc_remove_volume (ocfs_super * osb);
-
-void ocfs_sync_blockdev(struct super_block *sb);
-int ocfs_ioctl (struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);
-int ocfs_nm_heart_beat (ocfs_super * osb, __u32 flag, bool read_publish);
-void ocfs_update_publish_map (ocfs_super * osb, struct buffer_head *bhs[], bool first_time);
-
-
-struct inode * ocfs_get_inode_from_bh(ocfs_super * osb, struct buffer_head *bh);
-int ocfs_recv_thread (void *unused);
-int ocfs_volume_thread (void *arg);
-int ocfs_init_udp_sock (struct socket **send_sock, struct socket **recv_sock);
-int ocfs_recv_udp_msg (ocfs_recv_ctxt * recv_ctxt);
-int ocfs_send_dismount_msg (ocfs_super * osb, __u64 vote_map);
-int ocfs_send_vote_reply (ocfs_super * osb, ocfs_dlm_msg * dlm_msg, __u32 vote_status, bool inode_open);
-
-
-void ocfs_initialize_bitmap (ocfs_alloc_bm * bitmap, __u32 validbits, __u32 allocbits);
-void ocfs_uninitialize_bitmap(ocfs_alloc_bm * bitmap);
-void ocfs_reinitialize_bitmap(ocfs_alloc_bm *bitmap, __u32 validbits, __u32 allocbits);
-int ocfs_find_clear_bits (ocfs_super *osb, ocfs_alloc_bm * bitmap, __u32 numBits, __u32 offset, __u32 sysonly);
-int ocfs_count_bits (ocfs_alloc_bm * bitmap);
-void ocfs_set_bits (ocfs_alloc_bm * bitmap, __u32 start, __u32 num);
-void ocfs_clear_bits (ocfs_alloc_bm * bitmap, __u32 start, __u32 num);
-
-void ocfs_volcfg_gblctxt_to_disknode(ocfs_disk_node_config_info *disk);
-void ocfs_volcfg_gblctxt_to_node(ocfs_node_config_info *node);
-
-int ocfs_config_with_disk_lock (ocfs_super * osb, __u64 lock_off, __u8 * cfg_buf, __u32 node_num, ocfs_volcfg_op op);
-
-int ocfs_get_config (ocfs_super * osb);
-int ocfs_chk_update_config (ocfs_super * osb);
-
-int ocfs_init_system_file (ocfs_super * osb, __u32 file_id, char *filename);
-int ocfs_read_system_file (ocfs_super * osb, __u32 FileId, struct buffer_head *bhs[], __u64 Length, __u64 Offset);
-int ocfs_write_system_file (ocfs_super * osb, __u64 FileId, struct buffer_head *bhs[], __u64 Length, __u64 Offset);
-int ocfs_get_system_file_size (ocfs_super * osb, __u32 FileId, __u64 * Length, __u64 * AllocSize);
-__u64 ocfs_file_to_disk_off (ocfs_super * osb, __u32 FileId, __u64 Offset);
-
-void ocfs_initialize_dir_node (ocfs_super * osb, ocfs_dir_node * dir_node, __u64 bitmap_off, __u64 file_off, __u32 node);
-int ocfs_write_dir_node (ocfs_super * osb, struct buffer_head *bhs[], __s32 idx, struct inode *dir_inode, struct inode *file_inode);
-bool ocfs_linux_get_inode_offset (struct inode * inode, __u64 * off, ocfs_inode ** oin);
-bool ocfs_linux_get_dir_entry_offset (ocfs_super * osb, __u64 * off, __u64 parentOff, struct qstr * fileName, struct buffer_head ** fe_bh, struct inode *parent_inode);
-inline void prefetch (const void *x);
-int ocfs_compare_qstr (struct qstr * s1, struct qstr * s2);
-void ocfs_truncate_inode_pages(struct inode *inode, loff_t off);
-
-
-int ocfs_process_bitmap_free_head(ocfs_super *osb, ocfs_bitmap_free_head *f);
-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_empty (struct dentry *dentry);
-int ocfs_dentry_revalidate (struct dentry *dentry, int flags);
-
-int ocfs_readdir (struct file *filp, void *dirent, filldir_t filldir);
-struct dentry *ocfs_lookup (struct inode *dir, struct dentry *dentry);
-int ocfs_mknod (struct inode *dir, struct dentry *dentry, int mode, ocfs_dev dev);
-int ocfs_mkdir (struct inode *dir, struct dentry *dentry, int mode);
-int ocfs_create (struct inode *dir, struct dentry *dentry, int mode);
-int ocfs_link (struct dentry *old_dentry, struct inode *dir, struct dentry *dentry);
-int ocfs_unlink (struct inode *dir, struct dentry *dentry);
-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_find_files_on_disk (ocfs_super * osb, __u64 parent_off, struct qstr * file_name, struct buffer_head ** fe_bh, ocfs_file * ofile, struct inode *inode);
-int ocfs_write_force_dir_node (ocfs_super * osb, struct buffer_head *bhs[], __s32 idx);
-int ocfs_insert_file (ocfs_super * osb, ocfs_file_entry * InsertEntry, struct buffer_head *lock_bh, struct buffer_head **insert_bh, ocfs_journal_handle * handle, struct inode *dir_inode, struct inode *file_inode);
-int ocfs_reindex_dir_node (ocfs_super * osb, __u64 DirNodeOffset, struct buffer_head *bhs[], ocfs_journal_handle *handle, struct inode *dir_inode);
-int ocfs_recover_dir_node (ocfs_super * osb, __u64 OrigDirNodeOffset, __u64 SavedDirNodeOffset);
-int ocfs_remove_file (ocfs_super * osb, struct buffer_head *febh, struct buffer_head *lockbh, ocfs_journal_handle *handle, struct inode *dir_inode, struct inode *file_inode);
-
-int ocfs_send_bcast (ocfs_super * osb, __u64 votemap, ocfs_dlm_msg * dlm_msg);
-int ocfs_process_update_inode_request (ocfs_super * osb, __u64 lock_id, ocfs_lock_res * lockres, __u32 node_num);
-
-
-void ocfs_recover_oin_locks(ocfs_super *osb, __u32 node_num);
-int ocfs_process_vote (ocfs_super * osb, ocfs_vote_request_ctxt *ctxt);
-int ocfs_find_update_res (ocfs_super * osb, __u64 lock_id, ocfs_lock_res ** lockres, struct buffer_head **bh, __u32 * updated, __u32 timeout, struct inode *inode);
-
-
-int ocfs_follow_link(struct dentry *dentry, struct nameidata *nd);
-
-int ocfs_create_new_local_alloc(ocfs_super *osb, int node_num);
-int ocfs_load_local_alloc(ocfs_super *osb);
-void ocfs_shutdown_local_alloc(ocfs_super *osb,
- struct buffer_head **local_alloc_bh, bool sync);
-int ocfs_find_space(ocfs_super * osb, __u64 file_size, __u64 * cluster_off, __u64 * cluster_count, bool sysfile, ocfs_journal_handle *handle);
-int ocfs_recover_local_alloc(ocfs_super *osb, int node_num);
Copied: trunk/src/inc/journal.h (from rev 10, trunk/inc/journal.h)
Copied: trunk/src/inc/ocfs.h (from rev 10, trunk/inc/ocfs.h)
Copied: trunk/src/inc/ocfsio.h (from rev 10, trunk/inc/ocfsio.h)
Copied: trunk/src/inc/proto.h (from rev 10, trunk/inc/proto.h)
More information about the Ocfs2-commits
mailing list