[Ocfs2-commits] jlbec commits r1071 - branches/format-changes/src
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Sat Jun 12 20:57:18 CDT 2004
Author: jlbec
Date: 2004-06-12 19:57:16 -0500 (Sat, 12 Jun 2004)
New Revision: 1071
Modified:
branches/format-changes/src/ocfs1.h
branches/format-changes/src/super.c
Log:
o Cleaned up ocfs1.h. It doesn't need field comments, and it now
has structure offset comments.
o Fixed ocfs_sb_probe() to do 2.6 hardsect_size.
Modified: branches/format-changes/src/ocfs1.h
===================================================================
--- branches/format-changes/src/ocfs1.h 2004-06-12 21:33:11 UTC (rev 1070)
+++ branches/format-changes/src/ocfs1.h 2004-06-13 00:57:16 UTC (rev 1071)
@@ -1,6 +1,34 @@
-#ifndef OCFS1_H
-#define OCFS1_H
+/*
+ * ocfs1_fs_compat.h
+ *
+ * OCFS1 volume header definitions. OCFS2 creates valid but unmountable
+ * OCFS1 volume headers on the first two sectors of an OCFS2 volume.
+ * This allows an OCFS1 volume to see the partition and cleanly fail to
+ * mount it.
+ *
+ * Copyright (C) 2002, 2004 Oracle. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License, version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ *
+ * Authors: Kurt Hackel, Mark Fasheh, Sunil Mushran, Wim Coekaerts,
+ * Manish Singh, Neeraj Goyal, Suchit Kaura, Joel Becker
+ */
+#ifndef _OCFS1_FS_COMPAT_H
+#define _OCFS1_FS_COMPAT_H
+
#define MAX_VOL_SIGNATURE_LEN_V1 128
#define MAX_MOUNT_POINT_LEN_V1 128
#define MAX_VOL_ID_LENGTH_V1 16
@@ -11,73 +39,72 @@
#define OCFS1_MINOR_VERSION (0)
#define OCFS1_VOLUME_SIGNATURE "OracleCFS"
-typedef struct _ocfs_vol_disk_hdr_v1 // CLASS
+/*
+ * OCFS1 superblock. Lives at sector 0.
+ */
+typedef struct _ocfs_vol_disk_hdr_v1
{
- __u32 minor_version; // NUMBER RANGE(0,UINT_MAX)
- __u32 major_version; // NUMBER RANGE(0,UINT_MAX)
- __u8 signature[MAX_VOL_SIGNATURE_LEN_V1]; // CHAR[MAX_VOL_SIGNATURE_LEN]
- __u8 mount_point[MAX_MOUNT_POINT_LEN_V1]; // CHAR[MAX_MOUNT_POINT_LEN]
- __u64 serial_num; // NUMBER RANGE(0,ULONG_LONG_MAX)
- /* Size of the device in bytes */
- __u64 device_size; // NUMBER RANGE(0,ULONG_LONG_MAX)
- /* Start of the volume... typically 0 */
- __u64 start_off; // NUMBER RANGE(0,ULONG_LONG_MAX)
- /* Offset to Volume Bitmap... */
- __u64 bitmap_off; // NUMBER RANGE(0,ULONG_LONG_MAX)
- /* Offset to the Publish Sector */
- __u64 publ_off; // NUMBER RANGE(0,ULONG_LONG_MAX)
- /* Offset to the Vote Sector */
- __u64 vote_off; // NUMBER RANGE(0,ULONG_LONG_MAX)
- __u64 root_bitmap_off; // NUMBER RANGE(0,ULONG_LONG_MAX)
- __u64 data_start_off; // NUMBER RANGE(0,ULONG_LONG_MAX)
- __u64 root_bitmap_size; // NUMBER RANGE(0,ULONG_LONG_MAX)
- __u64 root_off; // NUMBER RANGE(0,ULONG_LONG_MAX)
- __u64 root_size; // NUMBER RANGE(0,ULONG_LONG_MAX)
- /* Cluster size as specified during format */
- __u64 cluster_size; // CLUSTERSIZE
- /* Max number of nodes.... OCFS_MAXIMUM_NODES */
- __u64 num_nodes; // NUMBER RANGE(0,32)
- /* Number of free clusters at format */
- __u64 num_clusters; // NUMBER RANGE(0,ULONG_LONG_MAX)
- /* OCFS_DEFAULT_DIR_NODE_SIZE */
- __u64 dir_node_size; // NUMBER RANGE(0,ULONG_LONG_MAX)
- /* OCFS_DEFAULT_FILE_NODE_SIZE */
- __u64 file_node_size; // NUMBER RANGE(0,ULONG_LONG_MAX)
- __u64 internal_off; // NUMBER RANGE(0,ULONG_LONG_MAX)
- /* Offset to Node Config */
- __u64 node_cfg_off; // NUMBER RANGE(0,ULONG_LONG_MAX)
- /* Size of Node Config */
- __u64 node_cfg_size; // NUMBER RANGE(0,ULONG_LONG_MAX)
- /* Offset to Node Config Lock */
- __u64 new_cfg_off; // NUMBER RANGE(0,ULONG_LONG_MAX)
- __u32 prot_bits; // PERMS
- __s32 excl_mount; // NODENUM
-}
-ocfs_vol_disk_hdr_v1; // END CLASS
+/*00*/ __u32 minor_version;
+ __u32 major_version;
+/*08*/ __u8 signature[MAX_VOL_SIGNATURE_LEN_V1];
+/*88*/ __u8 mount_point[MAX_MOUNT_POINT_LEN_V1];
+/*108*/ __u64 serial_num;
+/*110*/ __u64 device_size;
+ __u64 start_off;
+/*120*/ __u64 bitmap_off;
+ __u64 publ_off;
+/*130*/ __u64 vote_off;
+ __u64 root_bitmap_off;
+/*140*/ __u64 data_start_off;
+ __u64 root_bitmap_size;
+/*150*/ __u64 root_off;
+ __u64 root_size;
+/*160*/ __u64 cluster_size;
+ __u64 num_nodes;
+/*170*/ __u64 num_clusters;
+ __u64 dir_node_size;
+/*180*/ __u64 file_node_size;
+ __u64 internal_off;
+/*190*/ __u64 node_cfg_off;
+ __u64 node_cfg_size;
+/*1A0*/ __u64 new_cfg_off;
+ __u32 prot_bits;
+ __s32 excl_mount;
+/*1B0*/
+} ocfs_vol_disk_hdr_v1;
typedef struct _ocfs_disk_lock_v1
{
-/*00*/ __u32 curr_master; /* Node number of current master */
- __u8 file_lock; /* Lock level */
- __u8 odl_pad[3]; /* Pad to u64 */
- __u64 dlock_seq_num; /* Lock transaction seqnum */
-/*10*/ __u32 oin_node_map[8]; /* Bitmap of interested nodes, was __u32 */
+/*00*/ __u32 curr_master;
+ __u8 file_lock;
+ __u8 compat_pad[3]; /* Not in orignal definition. Used to
+ make the already existing alignment
+ explicit */
+ __u64 last_write_time;
+/*10*/ __u64 last_read_time;
+ __u32 writer_node_num;
+ __u32 reader_node_num;
+/*20*/ __u64 oin_node_map;
+ __u64 dlock_seq_num;
/*30*/
-}
-ocfs_disk_lock_v1;
+} ocfs_disk_lock_v1;
-typedef struct _ocfs_vol_label_v1 // CLASS
+/*
+ * OCFS1 volume label. Lives at sector 1.
+ */
+typedef struct _ocfs_vol_label_v1
{
- ocfs_disk_lock_v1 disk_lock; // DISKLOCK
- __u8 label[MAX_VOL_LABEL_LEN_V1]; // CHAR[MAX_VOL_LABEL_LEN]
- __u16 label_len; // NUMBER RANGE(0,MAX_VOL_LABEL_LEN)
- __u8 vol_id[MAX_VOL_ID_LENGTH_V1]; // HEX[MAX_VOL_ID_LENGTH]
- __u16 vol_id_len; // NUMBER RANGE(0,MAX_VOL_ID_LENGTH)
- __u8 cluster_name[MAX_CLUSTER_NAME_LEN_V1]; // CHAR[MAX_CLUSTER_NAME_LEN]
- __u16 cluster_name_len; // NUMBER RANGE(0,MAX_CLUSTER_NAME_LEN)
-}
-ocfs_vol_label_v1; // END CLASS
+/*00*/ ocfs_disk_lock_v1 disk_lock;
+/*30*/ __u8 label[MAX_VOL_LABEL_LEN_V1];
+/*70*/ __u16 label_len;
+/*72*/ __u8 vol_id[MAX_VOL_ID_LENGTH_V1];
+/*82*/ __u16 vol_id_len;
+/*84*/ __u8 cluster_name[MAX_CLUSTER_NAME_LEN_V1];
+/*A4*/ __u16 cluster_name_len;
+/*A6*/
+} ocfs_vol_label_v1;
-#endif /* OCFS1_H */
+#endif /* _OCFS1_FS_COMPAT_H */
+
Modified: branches/format-changes/src/super.c
===================================================================
--- branches/format-changes/src/super.c 2004-06-12 21:33:11 UTC (rev 1070)
+++ branches/format-changes/src/super.c 2004-06-13 00:57:16 UTC (rev 1071)
@@ -43,7 +43,7 @@
#include "ocfs_log.h"
#include "ocfs.h"
-// this should be the only file to include a version 1 header
+/* this should be the only file to include a version 1 header */
#include "ocfs1.h"
#include "alloc.h"
@@ -819,6 +819,18 @@
#define MAGIC_SUPERBLOCK_BLOCK_NUMBER 2
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+static inline int ocfs_hardsect_size(struct block_device *bdev)
+{
+ return bdev_hardsect_size(bdev);
+}
+#else
+static inline int ocfs_hardsect_size(dev_t dev)
+{
+ return get_hardsect_size(dev);
+}
+#endif /* 2.6.0 */
+
static int ocfs2_sb_probe(struct super_block *sb, struct buffer_head **bh)
{
int status = 0, tmpstat;
@@ -829,7 +841,7 @@
*bh = NULL;
/* may be > 512 */
- hardsect = get_hardsect_size(sb->s_dev);
+ hardsect = ocfs_hardsect_size(OCFS_GET_BLOCKDEV(sb));
if (hardsect > 4096) {
LOG_ERROR_ARGS("hardsect size too large: %d (max=4096)\n", hardsect);
status = -EINVAL;
More information about the Ocfs2-commits
mailing list