[Ocfs2-commits] khackel commits r866 - in trunk/src: . inc
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Fri Apr 23 20:07:47 CDT 2004
Author: khackel
Date: 2004-04-23 19:07:46 -0500 (Fri, 23 Apr 2004)
New Revision: 866
Modified:
trunk/src/hash.c
trunk/src/inc/journal.h
trunk/src/inc/ocfs.h
trunk/src/inc/proto.h
trunk/src/inode.c
trunk/src/journal.c
trunk/src/oin.c
trunk/src/osb.c
trunk/src/proc.c
trunk/src/super.c
trunk/src/sysfile.c
trunk/src/volcfg.c
trunk/src/vote.c
Log:
made some substantial changes to go along with the mkfs.ocfs
changes. removed a lot of code for first-time node setup
that is now done in mkfs.ocfs2.
journals should now be fully created outside of the kernel,
so if you need to add a new one, there will soon be a tuneocfs
that will allow you to add additional journals. also we don't
depend on the autoconfig->journal_version anymore, since I moved
the journal over to its own system file (instead of living on
top of the old cleanup log).
Modified: trunk/src/hash.c
===================================================================
--- trunk/src/hash.c 2004-04-23 20:48:22 UTC (rev 865)
+++ trunk/src/hash.c 2004-04-24 00:07:46 UTC (rev 866)
@@ -1813,10 +1813,10 @@
if (osb->vol_layout.root_start_off == 0
|| feoff < osb->vol_layout.root_start_off) {
/* OHMYGODTHISISTHEUGLIESTIFEVER */
- if (feoff < (JOURNAL_FILE_BASE_ID * osb->sect_size
+ if (feoff < (OCFS_JOURNAL_FILE * osb->sect_size
+ osb->vol_layout.root_int_off)
||
- feoff >= ((JOURNAL_FILE_BASE_ID + OCFS_MAXIMUM_NODES)
+ feoff >= ((OCFS_JOURNAL_FILE + OCFS_MAXIMUM_NODES)
* osb->sect_size
+ osb->vol_layout.root_int_off)) {
printk("ocfs2: skipping inode create for %u.%u\n",
Modified: trunk/src/inc/journal.h
===================================================================
--- trunk/src/inc/journal.h 2004-04-23 20:48:22 UTC (rev 865)
+++ trunk/src/inc/journal.h 2004-04-24 00:07:46 UTC (rev 866)
@@ -47,7 +47,6 @@
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 */
@@ -85,11 +84,6 @@
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;
@@ -232,12 +226,9 @@
* 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);
@@ -250,14 +241,12 @@
* 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);
Modified: trunk/src/inc/ocfs.h
===================================================================
--- trunk/src/inc/ocfs.h 2004-04-23 20:48:22 UTC (rev 865)
+++ trunk/src/inc/ocfs.h 2004-04-24 00:07:46 UTC (rev 866)
@@ -259,6 +259,7 @@
#define OCFS_RECOVER_LOG_FILENAME "RecoverLogFile"
#define OCFS_CLEANUP_LOG_FILENAME "CleanUpLogFile"
#define OCFS_ORPHAN_DIR_FILENAME "OrphanDir"
+#define OCFS_JOURNAL_FILENAME "JournalFile"
#define ONE_SECOND (10 * 1000 * 1000) /* 100 nanosec unit */
#define ONE_MILLI_SEC (10 * 1000) /* 100 nanosec unit */
@@ -316,10 +317,11 @@
OCFS_DIR_BM_SYSFILE,
OCFS_FILE_EXTENT_SYSFILE,
OCFS_FILE_EXTENT_BM_SYSFILE,
- OCFS_RECOVER_LOG_SYSFILE,
- OCFS_CLEANUP_LOG_SYSFILE,
+ OCFS_RECOVER_LOG_SYSFILE, // unused in version 2
+ OCFS_CLEANUP_LOG_SYSFILE, // unused in version 2
OCFS_VOL_BM_SYSFILE,
OCFS_ORPHAN_DIR_SYSFILE,
+ OCFS_JOURNAL_SYSFILE,
OCFS_NUM_SYSFILES
};
#define OCFS_FILE_VOL_META_DATA (OCFS_VOL_MD_SYSFILE * OCFS_MAXIMUM_NODES)
@@ -330,13 +332,11 @@
#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)
#define OCFS_ORPHAN_DIR (OCFS_ORPHAN_DIR_SYSFILE * OCFS_MAXIMUM_NODES)
+#define OCFS_JOURNAL_FILE (OCFS_JOURNAL_SYSFILE * OCFS_MAXIMUM_NODES)
-
-
#define SECTOR_BITS 9
#define SECTOR_SIZE (1U << SECTOR_BITS)
#define SECTOR_MASK (SECTOR_SIZE - 1)
@@ -1556,15 +1556,14 @@
}
ocfs_guid; // END CLASS
-typedef struct _ocfs_disk_node_config_info // CLASS
+typedef struct _ocfs_node_config_info // CLASS
{
ocfs_disk_lock disk_lock; // DISKLOCK
__u8 node_name[MAX_NODE_NAME_LENGTH+1]; // CHAR[MAX_NODE_NAME_LENGTH+1]
ocfs_guid guid; // GUID
ocfs_ipc_config_info ipc_config; // IPCONFIG
- __u8 journal_version;
}
-ocfs_disk_node_config_info; // END CLASS
+ocfs_node_config_info; // END CLASS
typedef struct _ocfs_node_config_hdr // CLASS
{
@@ -1578,14 +1577,13 @@
OCFS_GCC_ATTR_PACKALGN
ocfs_node_config_hdr; // END CLASS
-typedef struct _ocfs_node_config_info
+typedef struct _BARF_BARF_BARF
{
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;
+BARF_BARF_BARF;
#define OCFS_BITMAP_CHUNK (512) /* size of a chunk, in bytes */
@@ -1916,7 +1914,7 @@
ocfs_vol_layout vol_layout;
ocfs_vol_node_map vol_node_map;
struct semaphore cfg_lock;
- ocfs_node_config_info *node_cfg_info[OCFS_MAXIMUM_NODES];
+ BARF_BARF_BARF *node_cfg_info[OCFS_MAXIMUM_NODES];
__u64 cfg_seq_num;
bool cfg_initialized;
__u32 num_cfg_nodes;
Modified: trunk/src/inc/proto.h
===================================================================
--- trunk/src/inc/proto.h 2004-04-23 20:48:22 UTC (rev 865)
+++ trunk/src/inc/proto.h 2004-04-24 00:07:46 UTC (rev 866)
@@ -182,7 +182,6 @@
int ocfs_inode_fill_ext_map(ocfs_super * osb, struct buffer_head * fe_bh, struct inode *inode);
int ocfs_inode_open(ocfs_super *osb, struct buffer_head *fe_bh,
ocfs_journal_handle *handle, struct inode *inode);
-int ocfs_create_root_oin (ocfs_super * osb, struct inode *root);
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);
@@ -220,19 +219,17 @@
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);
+void ocfs_volcfg_gblctxt_to_disknode(ocfs_node_config_info *disk);
+void ocfs_volcfg_gblctxt_to_node(BARF_BARF_BARF *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_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);
-int ocfs_init_orphan_dir(ocfs_super *osb, int node_num, char *filename);
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);
Modified: trunk/src/inode.c
===================================================================
--- trunk/src/inode.c 2004-04-23 20:48:22 UTC (rev 865)
+++ trunk/src/inode.c 2004-04-24 00:07:46 UTC (rev 866)
@@ -1104,20 +1104,6 @@
goto bail;
}
- /* To understand this block, see ocfs_journal_create */
- if (osb->journal.state == OCFS_JOURNAL_CREATE) {
- if (osb->journal.bmaps >= OCFS_JOURNAL_CREATE_MAX_BMAPS) {
- LOG_TRACE_ARGS("%d iterations in journal_create, "
- "yielding\n",
- OCFS_JOURNAL_CREATE_MAX_BMAPS);
- osb->journal.bmaps = 0;
-
- yield();
- } else {
- osb->journal.bmaps++;
- }
- }
-
vbo = (__s64) block << inode->i_sb->s_blocksize_bits;
len = 1;
err = ocfs_lookup_file_allocation(osb, vbo, &lbo, len, NULL, inode);
Modified: trunk/src/journal.c
===================================================================
--- trunk/src/journal.c 2004-04-23 20:48:22 UTC (rev 865)
+++ trunk/src/journal.c 2004-04-24 00:07:46 UTC (rev 866)
@@ -38,9 +38,6 @@
struct inode *inode);
static int ocfs_recover_vol(struct _ocfs_super *osb, int node_num);
static int __ocfs_recovery_thread(void *arg);
-#ifdef USE_JOURNAL_CREATE_REPLACEMENT
-static int ocfs_replacement_journal_create(journal_t *journal);
-#endif
static int ocfs_commit_cache (ocfs_super * osb, bool data_flush);
/* DO NOT EVER CALL THIS FUNCTION WITH A LOCKED BUFFER HEAD! */
@@ -819,56 +816,8 @@
return;
}
-/*
- * ocfs_journal_update_config()
- * yes, this is just like ocfs_refresh_node_config.
- */
-int ocfs_journal_update_config (ocfs_super * osb, int new_version)
-{
- ocfs_node_config_info *node;
- ocfs_disk_node_config_info *disk;
- __u64 offset;
- __u8 *buffer = NULL;
- int status = 0;
-
- LOG_ENTRY();
-
- buffer = ocfs_malloc (osb->sect_size);
- if (buffer == NULL) {
- LOG_ERROR_STATUS (status = -ENOMEM);
- goto bail;
- }
-
- memset ((void *) buffer, 0, osb->sect_size);
- disk = (ocfs_disk_node_config_info *) buffer;
- disk->journal_version = new_version;
-
- /* populate the nodecfg info in disk from global context */
- ocfs_volcfg_gblctxt_to_disknode (disk);
-
- /* populate the nodecfg info in mem from global context */
- node = osb->node_cfg_info[osb->node_num];
- ocfs_volcfg_gblctxt_to_node (node);
- node->journal_version = new_version;
-
- /* Update the nodecfg on disk with the new info */
- offset = osb->vol_layout.new_cfg_off;
- status = ocfs_config_with_disk_lock (osb, offset, (__u8 *) disk,
- osb->node_num, OCFS_VOLCFG_UPD);
- if (status < 0) {
- LOG_ERROR_STATUS (status);
- goto bail;
- }
-
-bail:
- ocfs_safefree(buffer);
- LOG_EXIT_STATUS(status);
- return status;
-} /* ocfs_journal_update_config */
-
/*
- * Ok, what used to be our "cleanup log" becomes our journal.
- * TODO: Concatenate the cleanup and recover logs to make a larger journal.
+ * Setup the journal using the journal system file
*/
int ocfs_journal_init(ocfs_super *osb)
{
@@ -877,7 +826,7 @@
journal_t * k_journal = NULL;
ocfs_file_entry *fe = NULL;
ocfs_lock_res *lockres = NULL;
- __u32 cleanup_file_id = 0;
+ __u32 journal_file_id = 0;
__u64 lock_id = 0;
struct buffer_head *bh = NULL;
__u64 alloc_size;
@@ -893,8 +842,8 @@
INIT_LIST_HEAD(&(osb->journal.commited));
init_MUTEX(&(osb->journal.commit_sem));
- cleanup_file_id = (__u32) (JOURNAL_FILE_BASE_ID + osb->node_num);
- lock_id = ((JOURNAL_FILE_BASE_ID + osb->node_num) * osb->sect_size) +
+ journal_file_id = (__u32) (OCFS_JOURNAL_FILE + osb->node_num);
+ lock_id = ((OCFS_JOURNAL_FILE + osb->node_num) * osb->sect_size) +
osb->vol_layout.root_int_off;
/* Ok, look up the inode for our journal */
@@ -923,20 +872,29 @@
}
fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_READ(bh); /* read */
- /* extend the system file if we need to - it should be exactly
- * eight megs. */
+ /* for version 2.0, must be "JournalFile###" */
+ if (strncmp(fe->filename, OCFS_JOURNAL_FILENAME,
+ strlen(OCFS_JOURNAL_FILENAME))) {
+ LOG_ERROR_ARGS("Incorrect journal version! (%*s)\n",
+ OCFS_MAX_FILENAME_LENGTH-1,
+ fe->filename);
+ status = -EINVAL;
+ }
+
+ /* should be exactly eight megs. need to run tuneocfs otherwise. */
if (fe->file_size != OCFS_JOURNAL_DEFAULT_SIZE) {
+ LOG_ERROR_ARGS("Journal file size (%u) is not the default (%u). "
+ "You must run tuneocfs to add a journal for this node.\n",
+ LO(fe->file_size), OCFS_JOURNAL_DEFAULT_SIZE);
+ status = -EINVAL;
+ }
+
+ if (status < 0) {
OCFS_BH_PUT_DATA(bh);
fe = NULL;
- status = ocfs_extend_system_file(osb, cleanup_file_id,
- OCFS_JOURNAL_DEFAULT_SIZE,
- bh, NULL, false);
- if (status < 0) {
- LOG_ERROR_STR("Could not extend journal file!");
- goto done;
- }
- fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_READ(bh); /* read */
+ goto done;
}
+
LOG_TRACE_ARGS("fe->file_size = %u.%u\n", HI(fe->file_size),
LO(fe->file_size));
LOG_TRACE_ARGS("fe->alloc_size = %u.%u\n", HI(fe->alloc_size),
@@ -1086,64 +1044,6 @@
return;
}
-/*
- * journal is formatted and loaded - so no need to call journal_load.
- * obviously, you MUST call this *after* ocfs_journal_init
- */
-int ocfs_journal_create(ocfs_journal *journal)
-{
- int status = 0;
- ocfs_super * osb = NULL;
- struct super_block *sb = NULL;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
- struct buffer_head *bh;
-#endif
-
- LOG_ENTRY();
-
- if (!journal)
- BUG();
-
- osb = journal->osb;
- sb = osb->sb;
-
- /* The call to journal create will NOT result in our process
- * going to sleep after the 1st bmap. On *really* slow, single
- * CPU machines this can monopolize the CPU and prevent the
- * heartbeat thread from timestamping our publish
- * sector. Other nodes might think we're dead, and then try to
- * recover us which could cause Very Bad Things. The
- * (hackiferous) solution is to set our state, and in
- * ocfs_bmap, call "yield" every 1000 times to give the
- * heartbeat a chance. */
- journal->state = OCFS_JOURNAL_CREATE;
- journal->bmaps = 0;
-
-#ifdef USE_JOURNAL_CREATE_REPLACEMENT
- status = ocfs_replacement_journal_create(journal->k_journal);
-#else
- status = journal_create(journal->k_journal);
-#endif
- if (status < 0) {
- LOG_ERROR_STR("Failed to create new journal!");
- goto done;
- }
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
- /* work around a bug in journal_update_superblock() */
- bh = journal->k_journal->j_sb_buffer;
- mark_buffer_dirty(bh);
- sync_dirty_buffer(bh);
-#endif
-
- journal->state = OCFS_JOURNAL_LOADED;
- journal->bmaps = 0;
-
-done:
- LOG_EXIT_STATUS(status);
- return(status);
-}
-
int ocfs_journal_load(ocfs_journal *journal)
{
int status = 0;
@@ -1481,7 +1381,7 @@
{
int status = -1;
__u64 lock_id = 0;
- __u32 cleanup_file_id = 0;
+ __u32 journal_file_id = 0;
ocfs_lock_res *lockres = NULL;
ocfs_file_entry *fe = NULL;
struct inode *inode = NULL;
@@ -1489,8 +1389,6 @@
struct buffer_head *bh = NULL;
ocfs_journal * journal = NULL;
bool recovery_lock = false;
- struct buffer_head *config_bh = NULL;
- ocfs_disk_node_config_info *config = NULL;
__u64 alloc_size;
LOG_ENTRY_ARGS("(node_num=%d, osb->node_num = %d)\n", node_num,
@@ -1512,9 +1410,9 @@
goto done;
}
- /* get the cleanup file fe and lock */
- cleanup_file_id = (__u32) (JOURNAL_FILE_BASE_ID + node_num);
- lock_id = ((JOURNAL_FILE_BASE_ID + node_num) * osb->sect_size)
+ /* get the journal file fe and lock */
+ journal_file_id = (__u32) (OCFS_JOURNAL_FILE + node_num);
+ lock_id = ((OCFS_JOURNAL_FILE + node_num) * osb->sect_size)
+ osb->vol_layout.root_int_off;
/* Ok, look up the inode for our journal */
@@ -1561,26 +1459,6 @@
printk("ocfs2: Recovering node %d from device (%u,%u)\n", node_num,
MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev));
- /* Absolutely need to make sure that the node is using the
- * correct journal version here! Otherwise VERY BAD THINGS
- * WILL HAPPEN. */
- status = ocfs_read_bh(osb,
- (osb->vol_layout.node_cfg_off + 1024 +
- node_num * osb->sect_size), &config_bh, 0,NULL);
- if (status < 0) {
- LOG_ERROR_STATUS(status);
- goto done;
- }
-
- config = (ocfs_disk_node_config_info *) OCFS_BH_GET_DATA_READ(config_bh); /* read */
- if (config->journal_version < OCFS_JOURNAL_CURRENT_VERSION) {
- OCFS_BH_PUT_DATA(config_bh);
- LOG_ERROR_ARGS("Cannot recover node %d, it has an old journal"\
- " configuration!\n", node_num);
- goto done;
- }
- OCFS_BH_PUT_DATA(config_bh);
-
fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_READ(bh); /* read */
/* gonna need this later */
alloc_size = fe->alloc_size;
@@ -1666,9 +1544,6 @@
if (bh)
brelse(bh);
- if (config_bh)
- brelse(config_bh);
-
if (lockres)
ocfs_put_lockres (lockres);
@@ -1932,120 +1807,3 @@
LOG_EXIT_STATUS (status);
return status;
} /* ocfs_commit_cache */
-
-#ifdef USE_JOURNAL_CREATE_REPLACEMENT
-/*
- * This code is here because a bug in journal_create exists which will
- * cause us to hang at mount time. This bug exists in all 2.4 kernels
- * before 2.4.22. RHEL3 and RHAS 2.1 (update 3 and later) do not
- * exhibit this bug either.
- *
- * The fix is a one liner, and including this file is a hack which
- * should be removed at the first convenient moment.
- *
- * Unfortunately, we *must* be able to call journal_create at mount
- * time, so we have to keep this here for those unpatched kernels.
- *
- * Taken from the JBD implimentation in 2.4.23
- */
-
-#warning "using replacement code for journal_create"
-
-static void journal_fail_superblock (journal_t *journal)
-{
- struct buffer_head *bh = journal->j_sb_buffer;
- brelse(bh);
- journal->j_sb_buffer = NULL;
-}
-
-static int ocfs_replacement_journal_create(journal_t *journal)
-{
- unsigned long blocknr;
- struct buffer_head *bh;
- journal_superblock_t *sb;
- int i, err = 0;
- unsigned int first, last;
-
- LOG_ENTRY();
-
- if (journal->j_maxlen < JFS_MIN_JOURNAL_BLOCKS) {
- printk (KERN_ERR "Journal length (%d blocks) too short.\n",
- journal->j_maxlen);
- journal_fail_superblock(journal);
- err = -EINVAL;
- goto bail;
- }
-
- if (journal->j_inode == NULL) {
- /*
- * We don't know what block to start at!
- */
- printk(KERN_EMERG "%s: creation of journal on external "
- "device!\n", __FUNCTION__);
- BUG();
- }
-
- /* Zero out the entire journal on disk. We cannot afford to
- have any blocks on disk beginning with JFS_MAGIC_NUMBER. */
- jbd_debug(1, "JBD: Zeroing out journal blocks...\n");
- for (i = 0; i < journal->j_maxlen; i++) {
- err = journal_bmap(journal, i, &blocknr);
- if (err)
- goto bail;
- bh = getblk(journal->j_dev, blocknr, journal->j_blocksize);
- wait_on_buffer(bh);
- memset (bh->b_data, 0, journal->j_blocksize);
- BUFFER_TRACE(bh, "marking dirty");
- mark_buffer_dirty(bh);
- BUFFER_TRACE(bh, "marking uptodate");
- set_buffer_uptodate(bh);
- brelse(bh);
- }
-
- fsync_no_super(journal->j_dev);
- jbd_debug(1, "JBD: journal cleared.\n");
-
- /* OK, fill in the initial static fields in the new superblock */
- sb = journal->j_superblock;
-
- sb->s_header.h_magic = htonl(JFS_MAGIC_NUMBER);
- sb->s_header.h_blocktype = htonl(JFS_SUPERBLOCK_V2);
-
- sb->s_blocksize = htonl(journal->j_blocksize);
- sb->s_maxlen = htonl(journal->j_maxlen);
- sb->s_first = htonl(1);
-
- journal->j_transaction_sequence = 1;
-
- journal->j_flags &= ~JFS_ABORT;
- journal->j_format_version = 2;
-
- /* copied out of journal_reset */
- first = ntohl(sb->s_first);
- last = ntohl(sb->s_maxlen);
-
- journal->j_first = first;
- journal->j_last = last;
-
- journal->j_head = first;
- journal->j_tail = first;
- journal->j_free = last - first;
-
- journal->j_tail_sequence = journal->j_transaction_sequence;
- journal->j_commit_sequence = journal->j_transaction_sequence - 1;
- journal->j_commit_request = journal->j_commit_sequence;
-
- journal->j_max_transaction_buffers = journal->j_maxlen / 4;
-
- /* Add the dynamic fields and write it to disk. */
- journal_update_superblock(journal, 1);
-
-bail:
- if (!err) {
- LOG_TRACE_STR("Calling journal_load...");
- err = journal_load(journal);
- }
- LOG_EXIT_STATUS(err);
- return(err);
-}
-#endif
Modified: trunk/src/oin.c
===================================================================
--- trunk/src/oin.c 2004-04-23 20:48:22 UTC (rev 865)
+++ trunk/src/oin.c 2004-04-24 00:07:46 UTC (rev 866)
@@ -448,87 +448,3 @@
LOG_EXIT_STATUS (status);
return status;
} /* ocfs_create_oin_from_entry */
-
-/* ocfs_create_root_oin()
- *
- */
-int ocfs_create_root_oin (ocfs_super * osb, struct inode *root)
-{
- int status = 0;
- int tmpstat;
- ocfs_vol_disk_hdr *volDiskHdr = NULL;
- struct buffer_head *hdr_bh = NULL;
- ocfs_lock_res *lockres = NULL;
- struct buffer_head *bh = NULL;
- __u64 root_off, int_off;
-
- LOG_ENTRY ();
-
- if (osb->vol_layout.root_start_off == 0) {
- status = ocfs_wait_for_disk_lock_release (osb, OCFS_VOLUME_LOCK_OFFSET,
- 10000, OCFS_DLM_NO_LOCK);
- if (status < 0) {
- LOG_ERROR_STATUS (status);
- goto finally;
- }
-
- status = ocfs_acquire_lock (osb, OCFS_VOLUME_LOCK_OFFSET,
- OCFS_DLM_EXCLUSIVE_LOCK, FLAG_FILE_CREATE,
- &lockres, &bh, NULL);
- if (status >= 0) {
- status = ocfs_read_bh(osb, 0, &hdr_bh, 0, NULL);
- if (status < 0)
- LOG_ERROR_STATUS (status);
-
- tmpstat = ocfs_release_lock (osb, OCFS_VOLUME_LOCK_OFFSET, OCFS_DLM_EXCLUSIVE_LOCK, 0, lockres, bh, NULL);
-
- if (bh)
- brelse(bh);
-
- if (tmpstat < 0) {
- LOG_ERROR_STATUS (tmpstat);
- osb->vol_state = VOLUME_DISABLED;
- if (status >= 0)
- status = tmpstat;
- }
- }
- if (status < 0) {
- if (status != -EINTR)
- LOG_ERROR_STATUS (status);
- goto finally;
- }
-
- volDiskHdr = (ocfs_vol_disk_hdr *) OCFS_BH_GET_DATA_READ(hdr_bh); /* read */
- root_off = volDiskHdr->root_off;
- int_off = volDiskHdr->internal_off;
- OCFS_BH_PUT_DATA(hdr_bh);
-
- if (root_off != 0) {
- ocfs_wait_for_disk_lock_release (osb,
- OCFS_VOLUME_LOCK_OFFSET,
- 30000, OCFS_DLM_NO_LOCK);
- osb->vol_layout.root_start_off = root_off;
- osb->vol_layout.root_int_off = int_off;
- }
-
- status = ocfs_create_root_dir_node (osb);
- if (status < 0) {
- LOG_ERROR_STATUS (status);
- goto finally;
- }
- /* if it fails, Release the memory for the OFile we allocated above */
- }
-
-finally:
-
- if (hdr_bh) {
- lock_buffer(hdr_bh);
- clear_buffer_uptodate(hdr_bh);
- unlock_buffer(hdr_bh);
- brelse(hdr_bh);
- }
-
- ocfs_put_lockres (lockres);
- LOG_EXIT_STATUS (status);
- return status;
-} /* ocfs_create_root_oin */
Modified: trunk/src/osb.c
===================================================================
--- trunk/src/osb.c 2004-04-23 20:48:22 UTC (rev 865)
+++ trunk/src/osb.c 2004-04-24 00:07:46 UTC (rev 866)
@@ -28,6 +28,8 @@
#define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_OSB
+extern spinlock_t osb_id_lock;
+extern __u32 osb_id;
/*
* ocfs_initialize_osb()
@@ -235,6 +237,19 @@
/* Mark the fact that this osb structure is initialized. */
OCFS_SET_FLAG (osb->osb_flags, OCFS_OSB_FLAGS_OSB_INITIALIZED);
+ spin_lock (&osb_id_lock);
+ osb->osb_id = osb_id;
+ if (osb_id < OCFS_MAX_OSB_ID)
+ osb_id++;
+ else {
+ spin_unlock (&osb_id_lock);
+ LOG_ERROR_STR ("Too many volumes mounted");
+ status = -ENOMEM;
+ goto bail;
+ }
+ spin_unlock (&osb_id_lock);
+
+
/* skip the frees which happen on error only */
goto finally;
@@ -304,11 +319,11 @@
goto bail;
}
- /* Verify if mount point and volume size are valid */
- /* Read the root directory and make sure it is valid */
- /* Check to see who else is alive. */
- /* Kick in the NM i/f to start writing time stamps to the disk */
-
+ if (vdh->root_off == 0) {
+ LOG_ERROR_STR("No OCFS version 2 root directory found");
+ status = -EINVAL;
+ goto bail;
+ }
bail:
LOG_EXIT_STATUS (status);
return status;
@@ -324,9 +339,8 @@
__u64 offset = 0;
ocfs_publish *publish = NULL;
int node_num = osb->node_num;
- ocfs_node_config_info *config = osb->node_cfg_info[node_num];
struct buffer_head * publish_bh = NULL;
- bool dirty, mounted;
+ bool mounted;
LOG_ENTRY ();
@@ -340,15 +354,12 @@
}
publish = (ocfs_publish *) OCFS_BH_GET_DATA_READ(publish_bh); /* read */
- /* we copy these two flags out of the publish sector and then unlock
+ /* we copy this out of the publish sector and then unlock
* the bh as other functions will need to modify it. */
- dirty = publish->dirty;
mounted = publish->mounted;
-
OCFS_BH_PUT_DATA(publish_bh);
publish = NULL;
-
/* Init our journal object. */
status = ocfs_journal_init(osb);
if (status < 0) {
@@ -356,49 +367,6 @@
goto finally;
}
- /* Need to check if we have never had a journal here
- * before. If not, we have to create the journal structures .*/
- LOG_TRACE_ARGS("Node config states a journal version of %d\n", \
- (int) config->journal_version);
- if (config->journal_version < OCFS_JOURNAL_CURRENT_VERSION) {
- if (dirty) {
- LOG_ERROR_STR("Volume is dirty, please remount with " \
- "ocfs version 1 before upgrading.");
- status = -1;
- goto finally;
- }
-
- printk("ocfs2: Old journal type found, converting to new " \
- "style. You will no longer be able to mount with " \
- "ocfs version 1.\n");
-
- /* do our "journal_create" */
- status = ocfs_journal_create(&osb->journal);
- if (status < 0) {
- LOG_ERROR_STR("Could not create journal!");
- goto finally;
- }
-
- /* increment the journal version number in the autoconfig */
- status = ocfs_journal_update_config(osb,
- OCFS_JOURNAL_CURRENT_VERSION);
- if (status < 0) {
- LOG_ERROR_STR("Could not update node config!");
- goto finally;
- }
-
- /* Ok, piggy-back local alloc file creation here. If
- * this is also a 1st mount of the filesystem, then
- * the worst that'll happen is we stamp the new local
- * alloc twice -- not really a big deal :) */
- status = ocfs_create_new_local_alloc(osb, osb->node_num);
- if (status < 0) {
- LOG_ERROR_STATUS(status);
- goto finally;
- }
- goto skip_load;
- }
-
/* If the journal was unmounted cleanly then we don't want to
* recover anything. Otherwise, journal_load will do that
* dirty work for us :) */
@@ -482,175 +450,3 @@
LOG_EXIT ();
return;
} /* ocfs_delete_osb */
-
-/* ocfs_create_root_dir_node()
- *
- */
-int ocfs_create_root_dir_node (ocfs_super * osb)
-{
- int status = 0, tempstat;
- __u64 bitmapOffset, numClustersAlloc, fileOffset = 0;
- ocfs_vol_disk_hdr *volDiskHdr = NULL;
- ocfs_lock_res *lockres = NULL;
- bool lock_acq = false;
- char *buf = NULL, *sect;
- struct buffer_head *lock_bh = NULL;
- struct buffer_head **dirnode_bhs = NULL;
- struct buffer_head *hdr_bh = NULL;
- ocfs_dir_node *NewDirNode = NULL;
- int size, i;
-
- LOG_ENTRY ();
-
- size = (__u32) ( OCFS_DEFAULT_DIR_NODE_SIZE / osb->sect_size)
- * sizeof(struct buffer_head *);
- //NewDirNode = ocfs_malloc (size);
- dirnode_bhs = ocfs_malloc (size);
- if (dirnode_bhs == NULL) {
- LOG_ERROR_STATUS (status = -ENOMEM);
- goto bail;
- }
-
- memset (dirnode_bhs, 0, size);
-
- if ((buf = ocfs_malloc (OCFS_MAX_FILENAME_LENGTH)) == NULL) {
- LOG_ERROR_STATUS (status = -ENOMEM);
- goto bail;
- }
-
- /* Acquire volume Lock ... */
- status = ocfs_acquire_lock (osb, OCFS_VOLUME_LOCK_OFFSET,
- OCFS_DLM_EXCLUSIVE_LOCK, FLAG_FILE_CREATE,
- &lockres, &lock_bh, NULL);
- if (status < 0) {
- if (status != -EINTR)
- LOG_ERROR_STATUS (status);
- goto bail;
- } else
- lock_acq = true;
-
-
- size = (ONE_MEGA_BYTE > osb->vol_layout.cluster_size) ?
- ONE_MEGA_BYTE : osb->vol_layout.cluster_size;
-
- status = ocfs_find_contiguous_space_from_bitmap (osb, size,
- &bitmapOffset, &numClustersAlloc,
- false, NULL);
- if (status < 0) {
- LOG_ERROR_STATUS (status);
- goto bail;
- }
-
- osb->vol_layout.root_int_off = (bitmapOffset * 512) + osb->vol_layout.data_start_off;
-
- /* Create Files in root for directory, file node allocations */
- /* Create the dir alloc file now that we have a internal */
- for (i = 0; i < OCFS_MAXIMUM_NODES; i++) {
- ocfs_init_system_file (osb, OCFS_FILE_VOL_META_DATA + i, buf);
- ocfs_init_system_file (osb, OCFS_FILE_VOL_LOG_FILE + i, buf);
- ocfs_init_system_file (osb, OCFS_FILE_DIR_ALLOC + i, buf);
- ocfs_init_system_file (osb, OCFS_FILE_DIR_ALLOC_BITMAP + i, buf);
- ocfs_init_system_file (osb, OCFS_FILE_FILE_ALLOC + i, buf);
- ocfs_init_system_file (osb, OCFS_FILE_FILE_ALLOC_BITMAP + i, buf);
- ocfs_init_system_file (osb, LOG_FILE_BASE_ID + i, buf);
- ocfs_init_system_file (osb, CLEANUP_FILE_BASE_ID + i, buf);
- status = ocfs_create_new_local_alloc(osb, i);
- }
-
- status = ocfs_alloc_node_block (osb, osb->vol_layout.dir_node_size,
- &bitmapOffset, &fileOffset,
- osb->node_num, DISK_ALLOC_DIR_NODE, NULL);
- if (status < 0) {
- LOG_ERROR_STATUS (status = -EFAIL);
- goto bail;
- }
-
- status = ocfs_read_bhs(osb, bitmapOffset, osb->vol_layout.dir_node_size,
- dirnode_bhs, 0, NULL);
- if (status < 0) {
- LOG_ERROR_STATUS(status);
- goto bail;
- }
-
- for (i = 0; i < OCFS_DEFAULT_DIR_NODE_SECTS; i++) {
- sect = OCFS_BH_GET_DATA_WRITE(dirnode_bhs[i]); /* write */
- memset(sect, 0, osb->sect_size);
- OCFS_BH_PUT_DATA(dirnode_bhs[i]);
- }
-
- NewDirNode = (ocfs_dir_node *) OCFS_BH_GET_DATA_WRITE(dirnode_bhs[0]); /* write */
- osb->vol_layout.root_start_off = bitmapOffset;
- ocfs_initialize_dir_node (osb, NewDirNode, bitmapOffset, fileOffset, osb->node_num);
- NewDirNode->dir_node_flags |= DIR_NODE_FLAG_ROOT;
- OCFS_BH_PUT_DATA(dirnode_bhs[0]);
-
- //status = ocfs_write_dir_node (osb, NewDirNode, -1);
- status = ocfs_write_bhs(osb, dirnode_bhs, OCFS_DEFAULT_DIR_NODE_SECTS, 0, NULL);
- if (status < 0) {
- LOG_ERROR_STATUS (status);
- goto bail;
- }
-
- /* Read the first sector bytes from the target device */
- size = osb->sect_size;
- status = ocfs_read_bh(osb, 0, &hdr_bh, 0, NULL);
- if (status < 0) {
- LOG_ERROR_STATUS (status);
- goto bail;
- }
-
- volDiskHdr = (ocfs_vol_disk_hdr *) OCFS_BH_GET_DATA_WRITE(hdr_bh); /* write */
- volDiskHdr->root_off = osb->vol_layout.root_start_off;
- volDiskHdr->internal_off = osb->vol_layout.root_int_off;
- OCFS_BH_PUT_DATA(hdr_bh);
- volDiskHdr = NULL;
-
- status = ocfs_write_bh(osb, hdr_bh, 0, NULL);
- if (status < 0) {
- LOG_ERROR_STATUS (status);
- goto bail;
- }
-
- /* Init the orphan directories. Do this *after* the root
- * dirnode as we want the space allocated for the dirnodes to
- * be later on in the volume. */
- for(i = 0; i < OCFS_MAXIMUM_NODES; i++) {
- status = ocfs_init_orphan_dir(osb, i, buf);
- if (status < 0) {
- LOG_ERROR_STATUS (status);
- goto bail;
- }
- }
-
-bail:
- if (hdr_bh)
- brelse(hdr_bh);
-
- if (status < 0) {
- LOG_ERROR_STR ("Disabling Volume");
- osb->vol_state = VOLUME_DISABLED;
- }
-
- /* Release Volume Lock */
- if (lock_acq) {
- tempstat = ocfs_release_lock (osb, OCFS_VOLUME_LOCK_OFFSET,
- OCFS_DLM_EXCLUSIVE_LOCK, 0, lockres, lock_bh, NULL);
- if (tempstat < 0) {
- LOG_ERROR_STATUS (tempstat);
- osb->vol_state = VOLUME_DISABLED;
- }
- }
- if (lock_bh)
- brelse(lock_bh);
-
- if (dirnode_bhs && dirnode_bhs[0])
- for(i = 0; i < OCFS_DEFAULT_DIR_NODE_SECTS; i++)
- if (dirnode_bhs[i])
- brelse(dirnode_bhs[i]);
-
- ocfs_safefree(dirnode_bhs);
- ocfs_safefree (buf);
- ocfs_put_lockres (lockres);
- LOG_EXIT_STATUS (status);
- return status;
-} /* ocfs_create_root_dir_node */
Modified: trunk/src/proc.c
===================================================================
--- trunk/src/proc.c 2004-04-23 20:48:22 UTC (rev 865)
+++ trunk/src/proc.c 2004-04-24 00:07:46 UTC (rev 866)
@@ -627,7 +627,7 @@
int i;
int ret;
ocfs_super *osb;
- ocfs_node_config_info *node;
+ BARF_BARF_BARF *node;
__u32 publ_map;
char mount;
Modified: trunk/src/super.c
===================================================================
--- trunk/src/super.c 2004-04-23 20:48:22 UTC (rev 865)
+++ trunk/src/super.c 2004-04-24 00:07:46 UTC (rev 866)
@@ -814,21 +814,6 @@
goto leave;
}
- /* Check if the cluster name on the disk matches the one in the registry */
-#ifdef ENABLE_CLUSTER_NAME_CHECK /* TODO */
- if (OcfsGlobalCtxt.ClusterName == NULL ||
- vol_label->ClusterNameLength < 1 ||
- vol_label->ClusterName[0] == '\0' ||
- memcmp (OcfsGlobalCtxt.ClusterName, vol_label->ClusterName,
- vol_label->ClusterNameLength) != 0) {
- LOG_ERROR_ARGS
- ("expected cluster name: '%s' volume cluster name: '%s'",
- OcfsGlobalCtxt.ClusterName, vol_label->ClusterName);
- status = -EINVAL;
- goto leave;
- }
-#endif
-
if ((osb = ocfs_malloc (sizeof (ocfs_super))) == NULL) {
LOG_ERROR_STATUS (status = -ENOMEM);
goto leave;
@@ -851,28 +836,7 @@
vol_header = NULL;
OCFS_BH_PUT_DATA(bhs[1]);
vol_label = NULL;
-
- if (osb->vol_layout.root_start_off == 0 && osb->node_num != 0) {
- LOG_ERROR_ARGS("The volume must be mounted by node 0 before it can "
- "be used and you are node %u", osb->node_num);
- status = -EINVAL;
- goto leave;
- }
- osb->sect_size = 512;
-
- spin_lock (&osb_id_lock);
- osb->osb_id = osb_id;
- if (osb_id < OCFS_MAX_OSB_ID)
- osb_id++;
- else {
- spin_unlock (&osb_id_lock);
- LOG_ERROR_STR ("Too many volumes mounted");
- status = -ENOMEM;
- goto leave;
- }
- spin_unlock (&osb_id_lock);
-
down(&(osb->osb_res));
/* Launch the NM thread for the mounted volume */
@@ -951,8 +915,6 @@
/* wait for nm thread to be init */
ocfs_wait (osb->nm_init_event, (atomic_read (&osb->nm_init) >= OCFS_HEARTBEAT_INIT ), 0);
- /* Join or Form the cluster... */
- LOG_TRACE_STR ("ocfs_vol_member_reconfig...");
down(&(osb->osb_res));
osb->hbm = DISK_HBEAT_COMM_ON;
@@ -961,15 +923,8 @@
up (&(osb->publish_lock));
osb->publ_map |= (1 << osb->node_num);
- osb->vol_state = VOLUME_INIT;
- status = ocfs_create_root_oin (osb, NULL);
- if (status >= 0)
- osb->vol_state = VOLUME_ENABLED;
+ osb->vol_state = VOLUME_ENABLED;
up (&(osb->osb_res));
- if (status < 0) {
- LOG_ERROR_STATUS (status);
- goto leave;
- }
/* Initialize the root inode. */
ocfs_inode_hash_insert(osb, osb->vol_layout.root_start_off, 0ULL);
@@ -1158,7 +1113,7 @@
/* Free all nodecfgs */
for (i = 0; i < OCFS_MAXIMUM_NODES; ++i) {
- ocfs_node_config_info *p;
+ BARF_BARF_BARF *p;
p = osb->node_cfg_info[i];
ocfs_safefree (p);
Modified: trunk/src/sysfile.c
===================================================================
--- trunk/src/sysfile.c 2004-04-23 20:48:22 UTC (rev 865)
+++ trunk/src/sysfile.c 2004-04-24 00:07:46 UTC (rev 866)
@@ -36,220 +36,7 @@
static int ocfs_find_extents_of_system_file (ocfs_super * osb, __u64 file_off, __u64 Length, ocfs_file_entry * fe, void **Buffer, __u32 * NumEntries);
-/*
- * ocfs_init_system_file()
- *
- */
-int ocfs_init_system_file (ocfs_super * osb, __u32 file_id, char *filename)
-{
- int status = 0;
- __u64 offset = 0;
- ocfs_file_entry *fe = NULL;
- struct buffer_head *fe_bh = NULL;
- LOG_ENTRY_ARGS ("(file_id = %u)\n", file_id);
-
- memset (filename, 0, OCFS_MAX_FILENAME_LENGTH);
-
- if ((file_id >= OCFS_FILE_DIR_ALLOC) &&
- (file_id < (OCFS_FILE_DIR_ALLOC + 32))) {
- sprintf (filename, "%s%d", OCFS_DIR_FILENAME, file_id);
- } else if ((file_id >= OCFS_FILE_DIR_ALLOC_BITMAP) &&
- (file_id < (OCFS_FILE_DIR_ALLOC_BITMAP + 32))) {
- sprintf (filename, "%s%d", OCFS_DIR_BITMAP_FILENAME, file_id);
- } else if ((file_id >= OCFS_FILE_FILE_ALLOC) &&
- (file_id < (OCFS_FILE_FILE_ALLOC + 32))) {
- sprintf (filename, "%s%d", OCFS_FILE_EXTENT_FILENAME, file_id);
- } else if ((file_id >= OCFS_FILE_FILE_ALLOC_BITMAP) &&
- (file_id < (OCFS_FILE_FILE_ALLOC_BITMAP + 32))) {
- sprintf (filename, "%s%d", OCFS_FILE_EXTENT_BITMAP_FILENAME,
- file_id);
- } else if ((file_id >= LOG_FILE_BASE_ID)
- && (file_id < (LOG_FILE_BASE_ID + 32))) {
- sprintf (filename, "%s%d", OCFS_RECOVER_LOG_FILENAME, file_id);
- } else if ((file_id >= CLEANUP_FILE_BASE_ID) &&
- (file_id < (CLEANUP_FILE_BASE_ID + 32))) {
- sprintf (filename, "%s%d", OCFS_CLEANUP_LOG_FILENAME, file_id);
- } else if ((file_id >= OCFS_FILE_VOL_META_DATA) &&
- (file_id < (OCFS_FILE_VOL_META_DATA + 32))) {
- sprintf (filename, "%s", "VolMetaDataFile");
- } else if ((file_id >= OCFS_FILE_VOL_LOG_FILE) &&
- (file_id < (OCFS_FILE_VOL_LOG_FILE + 32))) {
- sprintf (filename, "%s", "VolMetaDataLogFile");
- } else if ((file_id >= OCFS_VOL_BITMAP_FILE) &&
- (file_id < (OCFS_VOL_BITMAP_FILE + 32))) {
- /* do nothing! should use create_new_local_alloc! */
- return(0);
- } else {
- sprintf (filename, "%s", "UKNOWNSysFile");
- }
-
- offset = (file_id * osb->sect_size) + osb->vol_layout.root_int_off;
- status = ocfs_read_bh(osb, offset, &fe_bh, OCFS_BH_CACHED, NULL);
- if (status < 0) {
- LOG_ERROR_STATUS(status);
- goto leave;
- }
- fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_WRITE(fe_bh); /* write */
-
- memset (fe, 0, osb->sect_size);
- /* Set the Flag to use the Local Extents */
- fe->local_ext = true;
- fe->granularity = -1;
-
- strcpy (fe->signature, OCFS_FILE_ENTRY_SIGNATURE);
- fe->next_free_ext = 0;
-
- /* Add a file Name */
- memcpy (fe->filename, filename, strlen (filename));
- (fe->filename)[strlen (filename)] = '\0';
-
- /* Set the Valid bit here */
- SET_VALID_BIT (fe->sync_flags);
- fe->sync_flags &= ~(OCFS_SYNC_FLAG_CHANGE);
- fe->this_sector = offset;
- fe->last_ext_ptr = 0;
-
- OCFS_BH_PUT_DATA(fe_bh);
- status = ocfs_write_bh(osb, fe_bh, 0, NULL);
- if (status < 0) {
- LOG_ERROR_STATUS (status);
- goto leave;
- }
-
-leave:
- if (fe_bh)
- brelse(fe_bh);
- LOG_EXIT_STATUS (status);
- return status;
-} /* ocfs_init_system_file */
-
-/* Create the 32 orphaned inode directories. This is only called
- * during 1st mount. */
-int ocfs_init_orphan_dir(ocfs_super *osb, int node_num, char *filename)
-{
- int i, status = 0;
- /* OCFS_ORPHAN_DIR */
- __u64 offset = 0;
- ocfs_file_entry *fe = NULL;
- struct buffer_head *fe_bh = NULL;
- __u32 file_id;
- __u64 bitmap_off;
- __u64 file_off = 0;
- ocfs_dir_node *new_dir = NULL;
- struct buffer_head **dirnode_bhs = NULL;
- int numblks, bufsize;
- char *sect;
- unsigned long blk;
-
- LOG_ENTRY_ARGS ("(node_num = %u)\n", node_num);
-
- memset(filename, 0, OCFS_MAX_FILENAME_LENGTH);
-
- /* I prefer to just use node_num, but we should prolly be consistent
- * with the rest of the system files. */
- file_id = OCFS_ORPHAN_DIR + node_num;
- offset = (file_id * osb->sect_size) + osb->vol_layout.root_int_off;
- sprintf(filename, "%s%d", OCFS_ORPHAN_DIR_FILENAME, file_id);
-
- /* Alright, allocate and create the dirnode */
- numblks = OCFS_DEFAULT_DIR_NODE_SIZE >> 9;
- bufsize = numblks * sizeof(struct buffer_head *);
- dirnode_bhs = ocfs_malloc(bufsize);
- if (dirnode_bhs == NULL) {
- LOG_ERROR_STATUS (status = -ENOMEM);
- goto leave;
- }
- memset(dirnode_bhs, 0, bufsize);
-
- status = ocfs_alloc_node_block (osb, OCFS_DEFAULT_DIR_NODE_SIZE,
- &bitmap_off, &file_off, osb->node_num,
- DISK_ALLOC_DIR_NODE, NULL);
- if (status < 0) {
- LOG_ERROR_STATUS (status);
- goto leave;
- }
-
- blk = (unsigned long)(bitmap_off >> 9);
- for (i = 0; i < OCFS_DEFAULT_DIR_NODE_SECTS; i++) {
- dirnode_bhs[i] = getblk (OCFS_GET_BLOCKDEV(osb->sb),
- blk++, osb->sb->s_blocksize);
-
- sect = OCFS_BH_GET_DATA_WRITE(dirnode_bhs[i]); /* write */
- memset(sect, 0, osb->sect_size);
- OCFS_BH_PUT_DATA(dirnode_bhs[i]);
- }
-
- new_dir = (ocfs_dir_node *) OCFS_BH_GET_DATA_WRITE(dirnode_bhs[0]);
- ocfs_initialize_dir_node (osb, new_dir, bitmap_off, file_off,
- osb->node_num);
- DISK_LOCK_CURRENT_MASTER (new_dir) = node_num;
- DISK_LOCK_FILE_LOCK (new_dir) = OCFS_DLM_ENABLE_CACHE_LOCK;
- new_dir->dir_node_flags |= DIR_NODE_FLAG_ORPHAN;
- OCFS_BH_PUT_DATA(dirnode_bhs[0]);
-
- status = ocfs_write_bhs(osb, dirnode_bhs, OCFS_DEFAULT_DIR_NODE_SECTS,
- 0, NULL);
- if (status < 0) {
- LOG_ERROR_STATUS (status);
- goto leave;
- }
-
- /* Alright, now setup the file entry. */
- status = ocfs_read_bh(osb, offset, &fe_bh, OCFS_BH_CACHED, NULL);
- if (status < 0) {
- LOG_ERROR_STATUS(status);
- goto leave;
- }
- fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_WRITE(fe_bh); /* write */
-
- memset (fe, 0, osb->sect_size);
-
- fe->local_ext = true;
- fe->granularity = -1;
- strcpy (fe->signature, OCFS_FILE_ENTRY_SIGNATURE);
- fe->next_free_ext = 0;
- memcpy (fe->filename, filename, strlen (filename));
- (fe->filename)[strlen (filename)] = '\0';
- SET_VALID_BIT (fe->sync_flags);
- fe->sync_flags &= ~(OCFS_SYNC_FLAG_CHANGE);
- fe->this_sector = offset;
- fe->last_ext_ptr = 0;
-
- /* do we do this or leave it like all the other sysfiles (0) */
- fe->attribs = OCFS_ATTRIB_DIRECTORY;
-
- fe->alloc_size = osb->vol_layout.dir_node_size;
- fe->extents[0].disk_off = bitmap_off;
- fe->file_size = osb->vol_layout.dir_node_size;
- fe->next_del = INVALID_DIR_NODE_INDEX;
-
- OCFS_BH_PUT_DATA(fe_bh);
-
- status = ocfs_write_bh(osb, fe_bh, 0, NULL);
- if (status < 0) {
- LOG_ERROR_STATUS (status);
- goto leave;
- }
-
-leave:
- if (fe_bh)
- brelse(fe_bh);
-
- if (dirnode_bhs) {
- for(i = 0; i < OCFS_DEFAULT_DIR_NODE_SECTS; i++)
- if (dirnode_bhs[i])
- brelse(dirnode_bhs[i]);
- ocfs_free(dirnode_bhs);
-
- }
-
- LOG_EXIT_STATUS(status);
- return(status);
-
-}
-
-
/*
* ocfs_read_system_file()
*
Modified: trunk/src/volcfg.c
===================================================================
--- trunk/src/volcfg.c 2004-04-23 20:48:22 UTC (rev 865)
+++ trunk/src/volcfg.c 2004-04-24 00:07:46 UTC (rev 866)
@@ -31,15 +31,15 @@
static void ocfs_worker (void *arg);
static void ocfs_assert_lock_owned (unsigned long arg);
-static int ocfs_add_to_disk_config (ocfs_super * osb, __u32 pref_node_num, ocfs_disk_node_config_info * new_disk_node);
+static int ocfs_add_to_disk_config (ocfs_super * osb, __u32 pref_node_num, ocfs_node_config_info * new_disk_node);
static int ocfs_write_volcfg_header (ocfs_super * osb, ocfs_volcfg_op op);
-static int ocfs_update_disk_config (ocfs_super * osb, __u32 node_num, ocfs_disk_node_config_info * disk);
+static int ocfs_update_disk_config (ocfs_super * osb, __u32 node_num, ocfs_node_config_info * disk);
static int ocfs_release_disk_lock (ocfs_super * osb, __u64 lock_off);
static int ocfs_add_node_to_config (ocfs_super * osb);
static bool ocfs_has_node_config_changed (ocfs_super * osb);
static int ocfs_refresh_node_config (ocfs_super * osb);
static void ocfs_show_all_node_cfgs (ocfs_super * osb);
-static int ocfs_disknode_to_node (ocfs_node_config_info ** node, ocfs_disk_node_config_info * disk);
+static int ocfs_disknode_to_node (BARF_BARF_BARF ** node, ocfs_node_config_info * disk);
/*
* ocfs_worker()
@@ -119,12 +119,12 @@
* ocfs_add_to_disk_config()
*
*/
-static int ocfs_add_to_disk_config (ocfs_super * osb, __u32 pref_node_num, ocfs_disk_node_config_info * new_disk_node)
+static int ocfs_add_to_disk_config (ocfs_super * osb, __u32 pref_node_num, ocfs_node_config_info * new_disk_node)
{
int status = 0;
__u64 offset;
int i;
- ocfs_disk_node_config_info *disk_node = NULL;
+ ocfs_node_config_info *disk_node = NULL;
__u8 *p;
__u32 node_num;
__u32 sect_size;
@@ -153,7 +153,7 @@
node_num = OCFS_INVALID_NODE_NUM;
if (pref_node_num >= 0 && pref_node_num < OCFS_MAXIMUM_NODES) {
p = OCFS_BH_GET_DATA_READ(cfg_bhs[pref_node_num]); /* read */
- disk_node = (ocfs_disk_node_config_info *)p;
+ disk_node = (ocfs_node_config_info *)p;
if (disk_node->node_name[0] == '\0')
node_num = pref_node_num;
OCFS_BH_PUT_DATA(cfg_bhs[pref_node_num]);
@@ -163,7 +163,7 @@
if (node_num == OCFS_INVALID_NODE_NUM) {
for (node_num = 0; node_num < OCFS_MAXIMUM_NODES; node_num++) {
p = OCFS_BH_GET_DATA_READ(cfg_bhs[node_num]); /* read */
- disk_node = (ocfs_disk_node_config_info *) p;
+ disk_node = (ocfs_node_config_info *) p;
if (disk_node->node_name[0] == '\0')
done = true;
OCFS_BH_PUT_DATA(cfg_bhs[node_num]);
@@ -416,10 +416,10 @@
if (op == OCFS_VOLCFG_ADD)
status = ocfs_add_to_disk_config (osb, node_num,
- (ocfs_disk_node_config_info *) cfg_buf);
+ (ocfs_node_config_info *) cfg_buf);
else if (op == OCFS_VOLCFG_UPD)
status = ocfs_update_disk_config(osb, node_num,
- (ocfs_disk_node_config_info *) cfg_buf);
+ (ocfs_node_config_info *) cfg_buf);
else
status = -EFAIL;
if (status < 0) {
@@ -534,7 +534,7 @@
static int ocfs_add_node_to_config (ocfs_super * osb)
{
int status = 0;
- ocfs_disk_node_config_info *disk;
+ ocfs_node_config_info *disk;
void *buffer = NULL;
__u64 offset;
__u32 sect_size = osb->sect_size;
@@ -548,7 +548,7 @@
}
memset (buffer, 0, sect_size);
- disk = (ocfs_disk_node_config_info *) buffer;
+ disk = (ocfs_node_config_info *) buffer;
/* populate the disknodecfg info from global context */
ocfs_volcfg_gblctxt_to_disknode (disk);
@@ -580,19 +580,19 @@
* ocfs_disknode_to_node()
*
*/
-static int ocfs_disknode_to_node (ocfs_node_config_info ** node, ocfs_disk_node_config_info * disk)
+static int ocfs_disknode_to_node (BARF_BARF_BARF ** node, ocfs_node_config_info * disk)
{
int status = 0;
LOG_ENTRY ();
if (*node == NULL) {
- if ((*node = (ocfs_node_config_info *)
- ocfs_malloc (sizeof (ocfs_node_config_info))) == NULL) {
+ if ((*node = (BARF_BARF_BARF *)
+ ocfs_malloc (sizeof (BARF_BARF_BARF))) == NULL) {
LOG_ERROR_STATUS (status = -ENOMEM);
goto bail;
}
- memset (*node, 0, sizeof (ocfs_node_config_info));
+ memset (*node, 0, sizeof (BARF_BARF_BARF));
}
strncpy ((*node)->node_name, disk->node_name, MAX_NODE_NAME_LENGTH);
@@ -606,8 +606,6 @@
strncpy((*node)->ipc_config.ip_mask, disk->ipc_config.ip_mask,
MAX_IP_ADDR_LEN);
- (*node)->journal_version = disk->journal_version;
-
bail:
LOG_EXIT_STATUS (status);
return status;
@@ -617,7 +615,7 @@
* ocfs_update_disk_config()
*
*/
-static int ocfs_update_disk_config (ocfs_super * osb, __u32 node_num, ocfs_disk_node_config_info * disk)
+static int ocfs_update_disk_config (ocfs_super * osb, __u32 node_num, ocfs_node_config_info * disk)
{
int status = 0;
__u64 offset;
@@ -669,7 +667,7 @@
* ocfs_volcfg_gblctxt_to_disknode()
*
*/
-void ocfs_volcfg_gblctxt_to_disknode(ocfs_disk_node_config_info *disk)
+void ocfs_volcfg_gblctxt_to_disknode(ocfs_node_config_info *disk)
{
ocfs_ipc_config_info *ipc;
ocfs_comm_info *g_ipc;
@@ -700,7 +698,7 @@
* ocfs_volcfg_gblctxt_to_node()
*
*/
-void ocfs_volcfg_gblctxt_to_node(ocfs_node_config_info *node)
+void ocfs_volcfg_gblctxt_to_node(BARF_BARF_BARF *node)
{
ocfs_ipc_config_info *ipc;
ocfs_comm_info *g_ipc;
@@ -735,7 +733,7 @@
{
int status = 0;
ocfs_node_config_hdr *hdr = NULL;
- ocfs_disk_node_config_info *disk = NULL;
+ ocfs_node_config_info *disk = NULL;
__u64 offset;
__s32 i;
__u32 numblocks = 0;
@@ -793,7 +791,7 @@
for (i = 0; i < OCFS_MAXIMUM_NODES; i++) {//, p += sect_size) {
int which;
which = i + OCFS_VOLCFG_HDR_SECTORS;
- disk = (ocfs_disk_node_config_info *)
+ disk = (ocfs_node_config_info *)
OCFS_BH_GET_DATA_READ(cfg_bhs[which]); /* read */
if (disk->node_name[0] == '\0')
@@ -925,7 +923,7 @@
*/
static bool ocfs_has_node_config_changed (ocfs_super * osb)
{
- ocfs_node_config_info *node;
+ BARF_BARF_BARF *node;
ocfs_ipc_config_info *ipc;
ocfs_comm_info *g_ipc;
bool chg = false;
@@ -965,8 +963,8 @@
*/
static int ocfs_refresh_node_config (ocfs_super * osb)
{
- ocfs_node_config_info *node;
- ocfs_disk_node_config_info *disk;
+ BARF_BARF_BARF *node;
+ ocfs_node_config_info *disk;
__u64 offset;
__u8 *buffer = NULL;
int status = 0;
@@ -980,7 +978,7 @@
}
memset ((void *) buffer, 0, osb->sect_size);
- disk = (ocfs_disk_node_config_info *) buffer;
+ disk = (ocfs_node_config_info *) buffer;
/* populate the nodecfg info in disk from global context */
ocfs_volcfg_gblctxt_to_disknode (disk);
@@ -1010,7 +1008,7 @@
*/
static void ocfs_show_all_node_cfgs (ocfs_super * osb)
{
- ocfs_node_config_info *node;
+ BARF_BARF_BARF *node;
__u32 i;
for (i = 0; i < OCFS_MAXIMUM_NODES; i++) {
Modified: trunk/src/vote.c
===================================================================
--- trunk/src/vote.c 2004-04-23 20:48:22 UTC (rev 865)
+++ trunk/src/vote.c 2004-04-24 00:07:46 UTC (rev 866)
@@ -138,7 +138,7 @@
{
int status = 0, error;
__u32 map, num;
- ocfs_node_config_info *node;
+ BARF_BARF_BARF *node;
struct sockaddr_in sin;
mm_segment_t oldfs;
More information about the Ocfs2-commits
mailing list