[Ocfs2-commits] mfasheh commits r1154 - trunk/src
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Fri Jun 18 21:18:50 CDT 2004
Author: mfasheh
Date: 2004-06-18 20:18:48 -0500 (Fri, 18 Jun 2004)
New Revision: 1154
Modified:
trunk/src/sysfile.c
Log:
* fix a bug in read_system_file for unaligned reads.
Modified: trunk/src/sysfile.c
===================================================================
--- trunk/src/sysfile.c 2004-06-19 00:40:36 UTC (rev 1153)
+++ trunk/src/sysfile.c 2004-06-19 01:18:48 UTC (rev 1154)
@@ -140,12 +140,14 @@
LOG_ENTRY_ARGS ("type=%d, node=%u, Length = %llu\n", type, node, Length);
+ OCFS_ASSERT(!(Length & (osb->sb->s_blocksize - 1)));
+
inode = ocfs_get_system_file_inode(osb, type, node);
if (!inode) {
LOG_ERROR_STATUS(status=-EINVAL);
goto leave;
}
-
+
off = 0;
i = 0;
blocks = Length >> osb->sb->s_blocksize_bits;
@@ -163,6 +165,10 @@
LOG_ERROR_STATUS(status=-EINVAL);
goto leave;
}
+ if (contig_blocks > blocks) {
+ contig_blocks = blocks;
+ contig_bytes = blocks << osb->sb->s_blocksize_bits;
+ }
if (status == 0) {
// found all remaining
} else if (status == -EFAIL && contig_blocks > 0) {
@@ -172,7 +178,7 @@
LOG_ERROR_STATUS(status = -EIO);
goto leave;
}
- status = ocfs_read_bhs(osb, ret, contig_bytes, &(bhs[i]), OCFS_BH_CACHED, inode);
+ status = ocfs_read_bhs(osb, ret, contig_blocks << osb->sb->s_blocksize_bits, &(bhs[i]), OCFS_BH_CACHED, inode);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto leave;
More information about the Ocfs2-commits
mailing list