[Ocfs2-tools-commits] zab commits r345 - trunk/mkfs.ocfs2
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Tue Oct 26 14:14:07 CDT 2004
Author: zab
Date: 2004-10-26 14:14:05 -0500 (Tue, 26 Oct 2004)
New Revision: 345
Modified:
trunk/mkfs.ocfs2/mkfs.c
Log:
o have mkfs fail if it sees more blocks than will fit in 32 bits.
Modified: trunk/mkfs.ocfs2/mkfs.c
===================================================================
--- trunk/mkfs.ocfs2/mkfs.c 2004-10-25 22:43:41 UTC (rev 344)
+++ trunk/mkfs.ocfs2/mkfs.c 2004-10-26 19:14:05 UTC (rev 345)
@@ -250,6 +250,7 @@
static uint32_t blocks_needed(State *s);
static uint32_t system_dir_blocks_needed(State *s);
static void adjust_volume_size(State *s);
+static void check_32bit_blocks(State *s);
static void format_superblock(State *s, SystemFileDiskRecord *rec,
SystemFileDiskRecord *root_rec,
SystemFileDiskRecord *sys_rec);
@@ -327,6 +328,8 @@
print_state (s);
+ check_32bit_blocks (s);
+
init_record(s, &global_alloc_rec, SFI_OTHER, 0);
global_alloc_rec.extent_off = 0;
global_alloc_rec.extent_len = s->volume_size_in_bytes;
@@ -1297,7 +1300,25 @@
s->volume_size_in_bytes = vsize;
}
+/* this will go away once we have patches to jbd to support 64bit blocks.
+ * ocfs2 will only fail mounts when it finds itself asked to mount a large
+ * device in a kernel that doesn't have a smarter jbd. */
static void
+check_32bit_blocks(State *s)
+{
+ uint64_t max = UINT32_MAX;
+
+ if (s->volume_size_in_blocks <= max)
+ return;
+
+ fprintf(stderr, "ERROR: jbd can only store block numbers in 32 bits. "
+ "%s can hold %"PRIu64" blocks which overflows this limit. "
+ "Consider increasing the block size or decreasing the device "
+ "size.\n", s->device_name, s->volume_size_in_blocks);
+ exit(1);
+}
+
+static void
format_superblock(State *s, SystemFileDiskRecord *rec,
SystemFileDiskRecord *root_rec, SystemFileDiskRecord *sys_rec)
{
@@ -1690,8 +1711,8 @@
printf("Filesystem label=%s\n", s->vol_label);
printf("Block size=%u (bits=%u)\n", s->blocksize, s->blocksize_bits);
printf("Cluster size=%u (bits=%u)\n", s->cluster_size, s->cluster_size_bits);
- printf("Volume size=%llu (%u clusters)\n",
+ printf("Volume size=%llu (%u clusters) (%"PRIu64" blocks)\n",
(unsigned long long) s->volume_size_in_bytes,
- s->volume_size_in_clusters);
+ s->volume_size_in_clusters, s->volume_size_in_blocks);
printf("Initial number of nodes: %u\n", s->initial_nodes);
}
More information about the Ocfs2-tools-commits
mailing list