[Ocfs2-tools-commits] manish commits r771 - in trunk: libocfs2
libocfs2/include mkfs.ocfs2 tunefs.ocfs2
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Wed Mar 30 19:16:08 CST 2005
Author: manish
Date: 2005-03-30 19:16:06 -0600 (Wed, 30 Mar 2005)
New Revision: 771
Modified:
trunk/libocfs2/dlm.c
trunk/libocfs2/include/ocfs2.h
trunk/libocfs2/include/ocfs2_fs.h
trunk/libocfs2/openfs.c
trunk/libocfs2/sysfile.c
trunk/mkfs.ocfs2/mkfs.c
trunk/mkfs.ocfs2/mkfs.h
trunk/tunefs.ocfs2/tunefs.c
Log:
New ocfs2_fs.h, with new constant names
Modified: trunk/libocfs2/dlm.c
===================================================================
--- trunk/libocfs2/dlm.c 2005-03-30 23:29:52 UTC (rev 770)
+++ trunk/libocfs2/dlm.c 2005-03-31 01:16:06 UTC (rev 771)
@@ -63,7 +63,7 @@
static errcode_t ocfs2_get_journal_blkno(ocfs2_filesys *fs, uint64_t *jrnl_blkno)
{
ocfs2_super_block *sb = OCFS2_RAW_SB(fs->fs_super);
- char sysfile[OCFS2_MAX_FILENAME_LENGTH];
+ char sysfile[OCFS2_MAX_FILENAME_LEN];
int i;
errcode_t ret = 0;
Modified: trunk/libocfs2/include/ocfs2.h
===================================================================
--- trunk/libocfs2/include/ocfs2.h 2005-03-30 23:29:52 UTC (rev 770)
+++ trunk/libocfs2/include/ocfs2.h 2005-03-31 01:16:06 UTC (rev 771)
@@ -187,7 +187,7 @@
uint64_t fs_root_blkno;
uint64_t fs_sysdir_blkno;
uint64_t fs_first_cg_blkno;
- char uuid_str[MAX_VOL_ID_LENGTH * 2 + 1];
+ char uuid_str[OCFS2_VOL_UUID_LEN * 2 + 1];
/* Allocators */
ocfs2_cached_inode *fs_cluster_alloc;
Modified: trunk/libocfs2/include/ocfs2_fs.h
===================================================================
--- trunk/libocfs2/include/ocfs2_fs.h 2005-03-30 23:29:52 UTC (rev 770)
+++ trunk/libocfs2/include/ocfs2_fs.h 2005-03-31 01:16:06 UTC (rev 771)
@@ -43,12 +43,22 @@
#define OCFS2_SUPER_BLOCK_BLKNO 2
/*
- * As OCFS2 has a minimum clustersize of 4K, it has a maximum blocksize
- * of 4K
+ * Cluster size limits. The maximum is kept arbitrarily at 1 MB, and could
+ * grow if needed.
*/
+#define OCFS2_MIN_CLUSTERSIZE 4096
+#define OCFS2_MAX_CLUSTERSIZE 1048576
+
+/*
+ * Blocks cannot be bigger than clusters, so the maximum blocksize is the
+ * minimum cluster size.
+ */
#define OCFS2_MIN_BLOCKSIZE 512
-#define OCFS2_MAX_BLOCKSIZE 4096
+#define OCFS2_MAX_BLOCKSIZE OCFS2_MIN_CLUSTERSIZE
+/* Filesystem magic number */
+#define OCFS2_SUPER_MAGIC 0xa156f7eb
+
/* Object signatures */
#define OCFS2_SUPER_BLOCK_SIGNATURE "OCFSV2"
#define OCFS2_INODE_SIGNATURE "INODE01"
@@ -107,20 +117,21 @@
#define OCFS2_ERROR_FS (0x00000001) /* FS saw errors */
/* Limit of space in ocfs2_dir_entry */
-#define OCFS2_MAX_FILENAME_LENGTH 255
+#define OCFS2_MAX_FILENAME_LEN 255
/* Limit of node map bits in ocfs2_disk_lock */
#define OCFS2_MAX_NODES 255
-#define MAX_VOL_ID_LENGTH 16
-#define MAX_VOL_LABEL_LEN 64
-#define MAX_CLUSTER_NAME_LEN 64
+#define OCFS2_VOL_UUID_LEN 16
+#define OCFS2_MAX_VOL_LABEL_LEN 64
+#define OCFS2_MAX_CLUSTER_NAME_LEN 64
-#define ONE_MEGA_BYTE (1 * 1024 * 1024) /* in bytes */
-#define OCFS2_DEFAULT_JOURNAL_SIZE (8 * ONE_MEGA_BYTE)
-#define OCFS2_MIN_JOURNAL_SIZE (4 * ONE_MEGA_BYTE)
+/* Journal limits (in bytes) */
+#define OCFS2_MIN_JOURNAL_SIZE (4 * 1024 * 1024)
+#define OCFS2_MAX_JOURNAL_SIZE (500 * 1024 * 1024)
+
struct ocfs2_system_inode_info {
char *si_name;
int si_iflags;
@@ -208,8 +219,8 @@
/*
* Convenience casts
*/
-#define OCFS2_RAW_SB(dinode) (&((dinode)->id2.i_super))
-#define LOCAL_ALLOC(dinode) (&((dinode)->id2.i_lab))
+#define OCFS2_RAW_SB(dinode) (&((dinode)->id2.i_super))
+#define OCFS2_LOCAL_ALLOC(dinode) (&((dinode)->id2.i_lab))
/*
@@ -313,8 +324,8 @@
__u32 s_reserved2;
__u64 s_first_cluster_group; /* Block offset of 1st cluster
* group header */
-/*50*/ __u8 s_label[64]; /* Label for mounting, etc. */
-/*90*/ __u8 s_uuid[16]; /* Was vol_id */
+/*50*/ __u8 s_label[OCFS2_MAX_VOL_LABEL_LEN]; /* Label for mounting, etc. */
+/*90*/ __u8 s_uuid[OCFS2_VOL_UUID_LEN]; /* 128-bit uuid */
/*A0*/
} ocfs2_super_block;
@@ -396,7 +407,7 @@
__u16 rec_len; /* Directory entry length */
__u8 name_len; /* Name length */
__u8 file_type;
-/*0C*/ char name[OCFS2_MAX_FILENAME_LENGTH]; /* File name */
+/*0C*/ char name[OCFS2_MAX_FILENAME_LEN]; /* File name */
/* Actual on-disk length specified by rec_len */
};
Modified: trunk/libocfs2/openfs.c
===================================================================
--- trunk/libocfs2/openfs.c 2005-03-30 23:29:52 UTC (rev 770)
+++ trunk/libocfs2/openfs.c 2005-03-31 01:16:06 UTC (rev 771)
@@ -323,7 +323,7 @@
OCFS2_RAW_SB(fs->fs_super)->s_first_cluster_group;
raw_uuid = OCFS2_RAW_SB(fs->fs_super)->s_uuid;
- for (i = 0, ptr = fs->uuid_str; i < MAX_VOL_ID_LENGTH; i++) {
+ for (i = 0, ptr = fs->uuid_str; i < OCFS2_VOL_UUID_LEN; i++) {
/* print with null */
len = snprintf(ptr, 3, "%02X", raw_uuid[i]);
if (len != 2) {
Modified: trunk/libocfs2/sysfile.c
===================================================================
--- trunk/libocfs2/sysfile.c 2005-03-30 23:29:52 UTC (rev 770)
+++ trunk/libocfs2/sysfile.c 2005-03-31 01:16:06 UTC (rev 771)
@@ -35,12 +35,11 @@
errcode_t ret;
char *buf;
- ret = ocfs2_malloc0(sizeof(char) *
- (OCFS2_MAX_FILENAME_LENGTH + 1), &buf);
+ ret = ocfs2_malloc0(sizeof(char) * (OCFS2_MAX_FILENAME_LEN + 1), &buf);
if (ret)
return ret;
- ocfs2_sprintf_system_inode_name(buf, OCFS2_MAX_FILENAME_LENGTH,
+ ocfs2_sprintf_system_inode_name(buf, OCFS2_MAX_FILENAME_LEN,
type, node_num);
ret = ocfs2_lookup(fs, fs->fs_sysdir_blkno, buf,
Modified: trunk/mkfs.ocfs2/mkfs.c
===================================================================
--- trunk/mkfs.ocfs2/mkfs.c 2005-03-30 23:29:52 UTC (rev 770)
+++ trunk/mkfs.ocfs2/mkfs.c 2005-03-31 01:16:06 UTC (rev 771)
@@ -410,14 +410,14 @@
ret = get_number(optarg, &val);
if (ret ||
- val < MIN_CLUSTER_SIZE ||
- val > MAX_CLUSTER_SIZE) {
+ val < OCFS2_MIN_CLUSTERSIZE ||
+ val > OCFS2_MAX_CLUSTERSIZE) {
com_err(progname, 0,
"Invalid cluster size %s: "
"must be between %d and %d bytes",
optarg,
- MIN_CLUSTER_SIZE,
- MAX_CLUSTER_SIZE);
+ OCFS2_MIN_CLUSTERSIZE,
+ OCFS2_MAX_CLUSTERSIZE);
exit(1);
}
@@ -427,11 +427,11 @@
case 'L':
vol_label = strdup(optarg);
- if (strlen(vol_label) >= MAX_VOL_LABEL_LEN) {
+ if (strlen(vol_label) >= OCFS2_MAX_VOL_LABEL_LEN) {
com_err(progname, 0,
"Volume label too long: must be less "
"than %d characters",
- MAX_VOL_LABEL_LEN);
+ OCFS2_MAX_VOL_LABEL_LEN);
exit(1);
}
@@ -590,7 +590,6 @@
char *options, *token, *next, *p, *arg;
int ret, journal_usage = 0;
uint64_t val;
- uint64_t max_journal_size = 500 * ONE_MEGA_BYTE;
options = strdup(opts);
@@ -620,13 +619,13 @@
if (ret ||
val < OCFS2_MIN_JOURNAL_SIZE ||
- val > max_journal_size) {
+ val > OCFS2_MAX_JOURNAL_SIZE) {
com_err(progname, 0,
"Invalid journal size: %s\nSize must "
- "be between %d and %"PRIu64" bytes",
+ "be between %d and %d bytes",
arg,
OCFS2_MIN_JOURNAL_SIZE,
- max_journal_size);
+ OCFS2_MAX_JOURNAL_SIZE);
exit(1);
}
@@ -756,8 +755,8 @@
if (!s->cluster_size) {
uint32_t volume_size, cluster_size, cluster_size_bits, need;
- for (cluster_size = MIN_CLUSTER_SIZE;
- cluster_size < AUTO_CLUSTER_SIZE;
+ for (cluster_size = OCFS2_MIN_CLUSTERSIZE;
+ cluster_size < AUTO_CLUSTERSIZE;
cluster_size <<= 1) {
cluster_size_bits = get_bits(s, cluster_size);
@@ -1385,23 +1384,23 @@
static int
ocfs2_clusters_per_group(int block_size, int cluster_size_bits)
{
- int bytes;
+ int megabytes;
switch (block_size) {
- case (4096):
- case (2048):
- bytes = 4 * ONE_MEGA_BYTE;
+ case 4096:
+ case 2048:
+ megabytes = 4;
break;
- case (1024):
- bytes = 2 * ONE_MEGA_BYTE;
+ case 1024:
+ megabytes = 2;
break;
- case (512):
+ case 512:
default:
- bytes = ONE_MEGA_BYTE;
+ megabytes = 1;
break;
}
- return(bytes >> cluster_size_bits);
+ return (megabytes << ONE_MB_SHIFT) >> cluster_size_bits;
}
static void
@@ -1701,10 +1700,11 @@
exit(1);
}
- s->uuid = do_malloc(s, MAX_VOL_ID_LENGTH);
+ s->uuid = do_malloc(s, OCFS2_VOL_UUID_LEN);
- while (readlen < MAX_VOL_ID_LENGTH) {
- if ((len = read(randfd, s->uuid + readlen, MAX_VOL_ID_LENGTH - readlen)) == -1) {
+ while (readlen < OCFS2_VOL_UUID_LEN) {
+ if ((len = read(randfd, s->uuid + readlen,
+ OCFS2_VOL_UUID_LEN - readlen)) == -1) {
com_err(s->progname, 0,
"Error reading from /dev/urandom: %s",
strerror(errno));
Modified: trunk/mkfs.ocfs2/mkfs.h
===================================================================
--- trunk/mkfs.ocfs2/mkfs.h 2005-03-30 23:29:52 UTC (rev 770)
+++ trunk/mkfs.ocfs2/mkfs.h 2005-03-31 01:16:06 UTC (rev 771)
@@ -84,14 +84,13 @@
#define SYSTEM_FILE_NAME_MAX 40
+#define ONE_MB_SHIFT 20
#define ONE_GB_SHIFT 30
#define BITMAP_WARNING_LEN 1572864
#define BITMAP_AUTO_MAX 786432
-#define MAX_CLUSTER_SIZE 1048576
-#define MIN_CLUSTER_SIZE 4096
-#define AUTO_CLUSTER_SIZE 65536
+#define AUTO_CLUSTERSIZE 65536
enum {
Modified: trunk/tunefs.ocfs2/tunefs.c
===================================================================
--- trunk/tunefs.ocfs2/tunefs.c 2005-03-30 23:29:52 UTC (rev 770)
+++ trunk/tunefs.ocfs2/tunefs.c 2005-03-31 01:16:06 UTC (rev 771)
@@ -144,7 +144,6 @@
char *options, *token, *next, *p, *arg;
int ret, journal_usage = 0;
uint64_t val;
- uint64_t max_journal_size = 500 * ONE_MEGA_BYTE;
options = strdup(opts);
@@ -174,13 +173,13 @@
if (ret ||
val < OCFS2_MIN_JOURNAL_SIZE ||
- val > max_journal_size) {
+ val > OCFS2_MAX_JOURNAL_SIZE) {
com_err(progname, 0,
"Invalid journal size: %s\nSize must "
- "be between %d and %"PRIu64" bytes",
+ "be between %d and %d bytes",
arg,
OCFS2_MIN_JOURNAL_SIZE,
- max_journal_size);
+ OCFS2_MAX_JOURNAL_SIZE);
exit(1);
}
@@ -241,11 +240,11 @@
case 'L':
opts.vol_label = strdup(optarg);
- if (strlen(opts.vol_label) >= MAX_VOL_LABEL_LEN) {
+ if (strlen(opts.vol_label) >= OCFS2_MAX_VOL_LABEL_LEN) {
com_err(opts.progname, 0,
"Volume label too long: must be less "
"than %d characters",
- MAX_VOL_LABEL_LEN);
+ OCFS2_MAX_VOL_LABEL_LEN);
exit(1);
}
break;
@@ -427,8 +426,10 @@
*/
static void update_volume_label(ocfs2_filesys *fs, int *changed)
{
+ memset (OCFS2_RAW_SB(fs->fs_super)->s_label, 0,
+ OCFS2_MAX_VOL_LABEL_LEN);
strncpy (OCFS2_RAW_SB(fs->fs_super)->s_label, opts.vol_label,
- MAX_VOL_LABEL_LEN);
+ OCFS2_MAX_VOL_LABEL_LEN);
*changed = 1;
More information about the Ocfs2-tools-commits
mailing list