[Ocfs-tools-commits] manish commits r210 - trunk/format
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Mon Aug 30 21:12:08 CDT 2004
Author: manish
Date: 2004-08-30 21:12:06 -0500 (Mon, 30 Aug 2004)
New Revision: 210
Modified:
trunk/format/format.c
trunk/format/system.c
trunk/format/tune.c
Log:
Remove ancient ocfs2 support
Modified: trunk/format/format.c
===================================================================
--- trunk/format/format.c 2004-08-31 02:09:46 UTC (rev 209)
+++ trunk/format/format.c 2004-08-31 02:12:06 UTC (rev 210)
@@ -52,9 +52,6 @@
.device_size = 0
};
-#define OCFS_MKFS_V2 "mkfs.ocfs2"
-int major_version = OCFS_MAJOR_VERSION;
-int minor_version = OCFS_MINOR_VERSION;
__u64 sect_count = 0;
__u64 format_size = 0;
int rawminor = 0;
@@ -94,8 +91,6 @@
bool ocfs_vol = false;
__u32 nodemap = 0;
char *node_names[OCFS_MAXIMUM_NODES];
- char *base;
- char *progname = NULL;
#define INSTALL_SIGNAL(sig) \
do { \
@@ -115,19 +110,6 @@
else
memset(volhdr, 0, sect_size);
- progname = strdup(argv[0]);
- if (!progname)
- goto bail;
- base = basename(progname);
- if (!base)
- goto bail;
-
- if (strcmp(base, OCFS_MKFS_V2) == 0) {
- major_version = OCFS2_MAJOR_VERSION;
- minor_version = OCFS2_MINOR_VERSION;
- }
- free (progname);
-
/* Read the options */
if (!ReadOptions(argc, argv))
goto bail;
@@ -871,8 +853,8 @@
memset(volhdr, 0, sizeof(ocfs_vol_disk_hdr));
- volhdr->minor_version = minor_version;
- volhdr->major_version = major_version;
+ volhdr->minor_version = OCFS_MINOR_VERSION;
+ volhdr->major_version = OCFS_MAJOR_VERSION;
memcpy(volhdr->signature, OCFS_VOLUME_SIGNATURE,
strlen(OCFS_VOLUME_SIGNATURE));
Modified: trunk/format/system.c
===================================================================
--- trunk/format/system.c 2004-08-31 02:09:46 UTC (rev 209)
+++ trunk/format/system.c 2004-08-31 02:12:06 UTC (rev 210)
@@ -32,12 +32,7 @@
extern ocfs_alloc_bm global_bm;
extern char *bm_buf;
extern int bm_size;
-extern int major_version;
-extern int minor_version;
-static int ocfs_create_root_file_entry(int file, ocfs_vol_disk_hdr *volhdr);
-static int ocfs_create_bitmap_file_entry(int file, ocfs_vol_disk_hdr *volhdr);
-
typedef struct _ocfs_file_entry_v2
{
ocfs_disk_lock disk_lock; // DISKLOCK
@@ -117,14 +112,9 @@
if (!Read(file, OCFS_SECTOR_SIZE, buf))
goto bail;
- if (major_version == OCFS_MAJOR_VERSION) {
- ocfs_bitmap_lock *bm_lock = (ocfs_bitmap_lock *) buf;
- memset(buf, 0, OCFS_SECTOR_SIZE); // why?
- bm_lock->used_bits = ocfs_count_bits(&global_bm);
- } else if (major_version == OCFS2_MAJOR_VERSION) {
- ocfs_file_entry_v2 *fe = (ocfs_file_entry_v2 *) buf;
- fe->u.bitinfo.used_bits = ocfs_count_bits(&global_bm);
- }
+ ocfs_bitmap_lock *bm_lock = (ocfs_bitmap_lock *) buf;
+ memset(buf, 0, OCFS_SECTOR_SIZE); // why?
+ bm_lock->used_bits = ocfs_count_bits(&global_bm);
if (SetSeek(file, OCFS_BITMAP_LOCK_OFFSET)) {
if (Write(file, OCFS_SECTOR_SIZE, buf)) {
@@ -156,8 +146,6 @@
int status = 0;
__u64 orphan_off = 0ULL, journal_off = 0ULL;
__u32 i, j, fileid, bit, root_bit;
- __u32 max = (major_version == OCFS2_MAJOR_VERSION) ?
- OCFS_JOURNAL_SYSFILE : OCFS_CLEANUP_LOG_SYSFILE;
ocfs_dir_node *dir = NULL;
ocfs_file_entry *fe = NULL;
__u64 data_off;
@@ -192,23 +180,10 @@
goto bail;
fsync(file);
- /* for v2, need to reserve space for orphan dirs: 32 x 128k */
- /* and space for first 4 journals: 4 x 8mb */
- if (major_version == OCFS2_MAJOR_VERSION) {
- bit = ocfs_alloc_from_global_bitmap (32*OCFS_DEFAULT_DIR_NODE_SIZE, volhdr);
- if (bit == (__u32)-1)
- goto bail;
- orphan_off = (bit * volhdr->cluster_size) + volhdr->data_start_off;
- bit = ocfs_alloc_from_global_bitmap (4*OCFS_JOURNAL_DEFAULT_SIZE, volhdr);
- if (bit == (__u32)-1)
- goto bail;
- journal_off = (bit * volhdr->cluster_size) + volhdr->data_start_off;
- }
-
/* create all appropriate system file types for this ocfs version */
/* v2 will create orphan, journal, and local alloc + v1 types */
for (i = 0; i < OCFS_MAXIMUM_NODES; i++) {
- for (j = OCFS_VOL_MD_SYSFILE; j <= max; j++) {
+ for (j = OCFS_VOL_MD_SYSFILE; j <= OCFS_CLEANUP_LOG_SYSFILE; j++) {
fileid = (j*OCFS_MAXIMUM_NODES) + i;
data_off = 0ULL;
@@ -227,13 +202,6 @@
journal_off += OCFS_JOURNAL_DEFAULT_SIZE;
}
- if (major_version == OCFS2_MAJOR_VERSION) {
- if (!ocfs_create_root_file_entry(file, volhdr))
- goto bail;
- if (!ocfs_create_bitmap_file_entry(file, volhdr))
- goto bail;
- }
-
status = 1;
bail:
@@ -242,94 +210,6 @@
return status;
}
-#define OCFS_ROOT_FILE_ENTRY_OFF (3 * OCFS_SECTOR_SIZE)
-
-static int ocfs_create_root_file_entry(int file, ocfs_vol_disk_hdr *volhdr)
-{
- int ret = 0;
- ocfs_file_entry_v2 *fe;
-
- fe = MemAlloc(OCFS_SECTOR_SIZE);
- if (fe == NULL)
- goto bail;
-
- memset(fe, 0, OCFS_SECTOR_SIZE);
- strcpy(&fe->filename[0], "root");
- fe->filename_len = strlen(fe->filename);
- fe->local_ext = true;
- fe->granularity = -1;
- strcpy (fe->signature, OCFS_FILE_ENTRY_SIGNATURE);
- SET_VALID_BIT (fe->sync_flags);
- fe->sync_flags &= ~(OCFS_SYNC_FLAG_CHANGE);
- fe->last_ext_ptr = 0;
- fe->next_del = INVALID_DIR_NODE_INDEX;
- fe->this_sector = OCFS_ROOT_FILE_ENTRY_OFF;
- fe->alloc_size = 0ULL;
- fe->file_size = 0ULL;
- fe->next_free_ext = 0;
- fe->uid = volhdr->uid;
- fe->gid = volhdr->gid;
- fe->prot_bits = volhdr->prot_bits;
- fe->attribs = OCFS_ATTRIB_DIRECTORY;
- fe->u.child_dirnode = volhdr->root_off;
-
- if (!SetSeek(file, OCFS_ROOT_FILE_ENTRY_OFF))
- goto bail;
- if (!Write(file, OCFS_SECTOR_SIZE, (void *) fe))
- goto bail;
- fsync(file);
- ret = 1;
-bail:
- safefree (fe);
- return ret;
-}
-
-static int ocfs_create_bitmap_file_entry(int file, ocfs_vol_disk_hdr *volhdr)
-{
- int ret = 0;
- ocfs_file_entry_v2 *fe;
-
- fe = MemAlloc(OCFS_SECTOR_SIZE);
- if (fe == NULL)
- goto bail;
-
- memset(fe, 0, OCFS_SECTOR_SIZE);
- strcpy(&fe->filename[0], "global-bitmap");
- fe->filename_len = strlen(fe->filename);
- fe->local_ext = true;
- fe->granularity = -1;
- strcpy (fe->signature, OCFS_FILE_ENTRY_SIGNATURE);
- SET_VALID_BIT (fe->sync_flags);
- fe->sync_flags &= ~(OCFS_SYNC_FLAG_CHANGE);
- fe->last_ext_ptr = 0;
- fe->next_del = INVALID_DIR_NODE_INDEX;
- fe->this_sector = OCFS_BITMAP_LOCK_OFFSET;
- fe->alloc_size = OCFS_MAX_BITMAP_SIZE; // max possible bytes in bitmap
- fe->file_size = (volhdr->num_clusters + 7) / 8; // valid bytes in actual bitmap
- fe->next_free_ext = 0;
- fe->uid = volhdr->uid;
- fe->gid = volhdr->gid;
- fe->prot_bits = volhdr->prot_bits;
- fe->u.bitinfo.used_bits = 0; // used bits in bitmap
- fe->u.bitinfo.total_bits = volhdr->num_clusters;// total valid bits in bitmap
-
- fe->extents[0].disk_off = volhdr->bitmap_off;
- fe->extents[0].file_off = 0ULL;
- fe->extents[0].num_bytes = OCFS_MAX_BITMAP_SIZE;
- fe->next_free_ext = 1;
-
- if (!SetSeek(file, OCFS_BITMAP_LOCK_OFFSET))
- goto bail;
- if (!Write(file, OCFS_SECTOR_SIZE, (void *) fe))
- goto bail;
- fsync(file);
- ret = 1;
-bail:
- safefree (fe);
- return ret;
-}
-
-
void ocfs_init_dirnode(ocfs_dir_node *dir, __u64 disk_off)
{
memset(dir, 0, OCFS_DEFAULT_DIR_NODE_SIZE);
Modified: trunk/format/tune.c
===================================================================
--- trunk/format/tune.c 2004-08-31 02:09:46 UTC (rev 209)
+++ trunk/format/tune.c 2004-08-31 02:12:06 UTC (rev 210)
@@ -56,7 +56,6 @@
.slot_num = OCFS_INVALID_NODE_NUM,
.device_size = 0,
.list_nodes = false,
- .convert = -1,
.disk_hb = 0,
.hb_timeo = 0
};
@@ -81,7 +80,6 @@
" -S Volume size, e.g., 50G (M for mega, G for giga, T for tera)\n"
" -t heartbeat timeout in ms\n"
" -u User ID for the root directory\n"
-" -c Convert filesystem versions\n"
" -V Print version and exit\n";
/*
@@ -197,7 +195,7 @@
/* Update volume disk header */
if (opts.gid != -1 || opts.uid != -1 || opts.perms != -1 ||
- opts.device_size || opts.convert != -1 || opts.disk_hb || opts.hb_timeo) {
+ opts.device_size || opts.disk_hb || opts.hb_timeo) {
if (!(update_volume_header(file, volhdr, sect_size, vol_size,
&update)))
goto bail;
@@ -252,17 +250,9 @@
goto bail;
}
- /* Make orphaned inode dirs for version 2 upgrade. Do this
- * before the header is updated as libocfs is looking for a
- * 1.2 versioned filesystem! */
- if (opts.convert == OCFS2_MAJOR_VERSION) {
- if (create_orphan_dirs(volhdr, &update, file))
- goto bail;
- }
-
/* Write volume disk header */
if (opts.gid != -1 || opts.uid != -1 || opts.perms != -1 ||
- opts.device_size || opts.convert != -1 || opts.disk_hb || opts.hb_timeo) {
+ opts.device_size || opts.disk_hb || opts.hb_timeo) {
offset = volhdr->start_off;
if (!write_sectors(file, offset, 1, sect_size, (void *)volhdr))
goto bail;
@@ -379,17 +369,6 @@
opts.print_progress = true;
break;
- case 'c': /* convert */
- opts.convert = atoi(optarg);
- if (opts.convert == OCFS_MAJOR_VERSION) {
- fprintf(stderr, "Conversion to V1 ocfs not yet supported.\nAborting.\n");
- ret = 0;
- } else if (opts.convert < OCFS_MAJOR_VERSION || opts.convert > OCFS2_MAJOR_VERSION) {
- fprintf(stderr, "Invalid version.\nAborting.\n");
- ret = 0;
- }
- break;
-
default:
break;
}
@@ -514,22 +493,6 @@
*update = true;
}
- if (opts.convert != -1) {
- if (opts.convert == OCFS_MAJOR_VERSION) {
- volhdr->minor_version = OCFS_MINOR_VERSION;
- volhdr->major_version = OCFS_MAJOR_VERSION;
- } else if (opts.convert == OCFS2_MAJOR_VERSION) {
- volhdr->minor_version = OCFS2_MINOR_VERSION;
- volhdr->major_version = OCFS2_MAJOR_VERSION;
- } else {
- fprintf (stderr, "Error: Invalid version %d\n",
- opts.convert);
- ret = 0;
- goto bail;
- }
- *update = true;
- }
-
if (opts.disk_hb) {
printf("Changing disk heartbeat from %u ms to %u ms\n",
volhdr->disk_hb, opts.disk_hb);
More information about the Ocfs-tools-commits
mailing list