[Ocfs2-tools-commits] manish commits r884 - in trunk:
libo2cb/include libocfs2
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Tue May 10 23:02:28 CDT 2005
Author: manish
Signed-off-by: mfasheh
Date: 2005-05-10 23:02:25 -0500 (Tue, 10 May 2005)
New Revision: 884
Modified:
trunk/libo2cb/include/ocfs2_nodemanager.h
trunk/libocfs2/heartbeat.c
trunk/libocfs2/ocfs2_err.et
Log:
Calculate hearbeat region parameters in userspace, and always make the
heartbeat block size the same as the hardware sector size.
Signed-off-by: mfasheh
Modified: trunk/libo2cb/include/ocfs2_nodemanager.h
===================================================================
--- trunk/libo2cb/include/ocfs2_nodemanager.h 2005-05-09 18:58:46 UTC (rev 883)
+++ trunk/libo2cb/include/ocfs2_nodemanager.h 2005-05-11 04:02:25 UTC (rev 884)
@@ -28,7 +28,7 @@
#ifndef _OCFS2_NODEMANAGER_H
#define _OCFS2_NODEMANAGER_H
-#define NM_API_VERSION 1
+#define NM_API_VERSION 2
#define NM_MAX_NODES 255
#define NM_INVALID_SLOT_NUM 255
Modified: trunk/libocfs2/heartbeat.c
===================================================================
--- trunk/libocfs2/heartbeat.c 2005-05-09 18:58:46 UTC (rev 883)
+++ trunk/libocfs2/heartbeat.c 2005-05-11 04:02:25 UTC (rev 884)
@@ -25,10 +25,6 @@
* Authors: Mark Fasheh, Zach Brown
*/
-#define _XOPEN_SOURCE 600 /* Triggers magic in features.h */
-#define _LARGEFILE64_SOURCE
-
-#define __USE_MISC
#include <string.h>
#include <inttypes.h>
@@ -40,11 +36,18 @@
errcode_t ret;
char *filename;
char *buf = NULL;
- uint64_t blkno, blocks;
+ uint64_t blkno, blocks, start_block;
uint32_t block_bits, cluster_bits;
+ int sectsize, sectsize_bits;
ocfs2_dinode *di;
ocfs2_extent_rec *rec;
+ ret = ocfs2_get_device_sectsize(fs->fs_devname, §size);
+ if (ret)
+ goto leave;
+
+ sectsize_bits = ffs(sectsize) - 1;
+
filename = ocfs2_system_inodes[HEARTBEAT_SYSTEM_INODE].si_name;
ret = ocfs2_lookup(fs, fs->fs_sysdir_blkno, filename,
@@ -71,17 +74,26 @@
block_bits = OCFS2_RAW_SB(fs->fs_super)->s_blocksize_bits;
cluster_bits = OCFS2_RAW_SB(fs->fs_super)->s_clustersize_bits;
+ if (block_bits < sectsize_bits) {
+ ret = OCFS2_ET_BLOCK_SIZE_TOO_SMALL_FOR_HARDWARE;
+ goto leave;
+ }
+
blocks = rec->e_clusters << cluster_bits;
blocks >>= block_bits;
/* clamp to NM_MAX_NODES */
+ /* XXX: hmmbo, NM_MAX_NODES is 255 */
if (blocks > 254)
blocks = 254;
+ start_block = rec->e_blkno << block_bits;
+ start_block >>= sectsize_bits;
+
desc->r_name = fs->uuid_str;
desc->r_device_name = fs->fs_devname;
- desc->r_block_bytes = 1 << block_bits;
- desc->r_start_block = rec->e_blkno;
+ desc->r_block_bytes = sectsize;
+ desc->r_start_block = start_block;
desc->r_blocks = blocks;
leave:
Modified: trunk/libocfs2/ocfs2_err.et
===================================================================
--- trunk/libocfs2/ocfs2_err.et 2005-05-09 18:58:46 UTC (rev 883)
+++ trunk/libocfs2/ocfs2_err.et 2005-05-11 04:02:25 UTC (rev 884)
@@ -153,4 +153,7 @@
ec OCFS2_ET_UNKNOWN_FILESYSTEM,
"Unknown filesystem"
+ec OCFS2_ET_BLOCK_SIZE_TOO_SMALL_FOR_HARDWARE,
+ "The block size is smaller than the sector size on this device"
+
end
More information about the Ocfs2-tools-commits
mailing list