[Ocfs2-tools-commits] zab commits r415 - in trunk/libocfs2: .
include
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Thu Nov 18 17:08:25 CST 2004
Author: zab
Date: 2004-11-18 17:08:23 -0600 (Thu, 18 Nov 2004)
New Revision: 415
Modified:
trunk/libocfs2/extents.c
trunk/libocfs2/include/ocfs2.h
trunk/libocfs2/openfs.c
Log:
o cache first_cluster_group in ocfs2_filesys
o add an extent block reader that doesn't check fields
Modified: trunk/libocfs2/extents.c
===================================================================
--- trunk/libocfs2/extents.c 2004-11-18 22:58:32 UTC (rev 414)
+++ trunk/libocfs2/extents.c 2004-11-18 23:08:23 UTC (rev 415)
@@ -34,9 +34,8 @@
#include "ocfs2.h"
-
-errcode_t ocfs2_read_extent_block(ocfs2_filesys *fs, uint64_t blkno,
- char *eb_buf)
+errcode_t ocfs2_read_extent_block_nocheck(ocfs2_filesys *fs, uint64_t blkno,
+ char *eb_buf)
{
errcode_t ret;
char *blk;
@@ -56,26 +55,36 @@
eb = (ocfs2_extent_block *)blk;
- ret = OCFS2_ET_BAD_EXTENT_BLOCK_MAGIC;
if (memcmp(eb->h_signature, OCFS2_EXTENT_BLOCK_SIGNATURE,
- strlen(OCFS2_EXTENT_BLOCK_SIGNATURE)))
+ strlen(OCFS2_EXTENT_BLOCK_SIGNATURE))) {
+ ret = OCFS2_ET_BAD_EXTENT_BLOCK_MAGIC;
goto out;
+ }
/* FIXME swap block */
memcpy(eb_buf, blk, fs->fs_blocksize);
- ret = OCFS2_ET_CORRUPT_EXTENT_BLOCK;
- if (eb->h_list.l_next_free_rec > eb->h_list.l_count)
- goto out;
-
- ret = 0;
out:
ocfs2_free(&blk);
return ret;
}
+errcode_t ocfs2_read_extent_block(ocfs2_filesys *fs, uint64_t blkno,
+ char *eb_buf)
+{
+ errcode_t ret;
+ ocfs2_extent_block *eb = (ocfs2_extent_block *)eb_buf;
+
+ ret = ocfs2_read_extent_block_nocheck(fs, blkno, eb_buf);
+
+ if (ret == 0 && eb->h_list.l_next_free_rec > eb->h_list.l_count)
+ ret = OCFS2_ET_CORRUPT_EXTENT_BLOCK;
+
+ return ret;
+}
+
errcode_t ocfs2_write_extent_block(ocfs2_filesys *fs, uint64_t blkno,
char *eb_buf)
{
Modified: trunk/libocfs2/include/ocfs2.h
===================================================================
--- trunk/libocfs2/include/ocfs2.h 2004-11-18 22:58:32 UTC (rev 414)
+++ trunk/libocfs2/include/ocfs2.h 2004-11-18 23:08:23 UTC (rev 415)
@@ -1,7 +1,7 @@
/* -*- mode: c; c-basic-offset: 8; -*-
* vim: noexpandtab sw=8 ts=8 sts=0:
*
- * filesys.h
+ * ocfs2.h
*
* Filesystem object routines for the OCFS2 userspace library.
*
@@ -179,7 +179,7 @@
uint32_t fs_umask;
uint64_t fs_root_blkno;
uint64_t fs_sysdir_blkno;
- uint64_t fs_bm_blkno;
+ uint64_t fs_first_cg_blkno;
/* Allocators */
ocfs2_cached_inode *fs_cluster_alloc;
@@ -294,6 +294,8 @@
errcode_t ocfs2_read_extent_block(ocfs2_filesys *fs, uint64_t blkno,
char *eb_buf);
+errcode_t ocfs2_read_extent_block_nocheck(ocfs2_filesys *fs, uint64_t blkno,
+ char *eb_buf);
errcode_t ocfs2_write_extent_block(ocfs2_filesys *fs, uint64_t blkno,
char *eb_buf);
errcode_t ocfs2_extent_iterate(ocfs2_filesys *fs,
Modified: trunk/libocfs2/openfs.c
===================================================================
--- trunk/libocfs2/openfs.c 2004-11-18 22:58:32 UTC (rev 414)
+++ trunk/libocfs2/openfs.c 2004-11-18 23:08:23 UTC (rev 415)
@@ -259,6 +259,8 @@
fs->fs_clusters = fs->fs_super->i_clusters;
fs->fs_blocks = ocfs2_clusters_to_blocks(fs, fs->fs_clusters);
+ fs->fs_first_cg_blkno =
+ OCFS2_RAW_SB(fs->fs_super)->s_first_cluster_group;
*ret_fs = fs;
return 0;
More information about the Ocfs2-tools-commits
mailing list