FTK change. Added flag to prevent misaligned I/O operations to occur when a file has been opened in directio mode. This will allow us to find and fix sub-optimal I/O operations.

git-svn-id: https://svn.code.sf.net/p/flaim/code/trunk@671 0109f412-320b-0410-ab79-c3e0c5ffbbe6
This commit is contained in:
ahodgkinson
2006-07-14 22:30:23 +00:00
parent cbc0f955f5
commit 95bb5a0a88
9 changed files with 98 additions and 22 deletions

View File

@@ -2757,6 +2757,7 @@ void F_FileHdl::initCommonData( void)
m_bOpenedReadOnly = FALSE;
m_bOpenedExclusive = FALSE;
m_bOpenedInAsyncMode = FALSE;
m_bRequireAlignedIO = FALSE;
m_bDoDirectIO = FALSE;
m_numAsyncPending = 0;
}
@@ -3353,6 +3354,12 @@ RCODE F_FileHdl::directRead(
(((FLMUINT64)pucDestBuffer) & m_ui64NotOnSectorBoundMask) ||
(((FLMUINT64)uiBytesToRead & m_ui64NotOnSectorBoundMask)))
{
if( m_bRequireAlignedIO)
{
rc = RC_SET_AND_ASSERT( NE_FLM_MISALIGNED_IO);
goto Exit;
}
pucReadBuffer = m_pucAlignedBuff;
// Must read enough bytes to cover all of the sectors that
@@ -3399,7 +3406,7 @@ RCODE F_FileHdl::directRead(
// bytes read by the difference between the start of the
// sector and the actual read offset.
if( uiCurrentBytesRead && ui64ReadOffset & m_ui64NotOnSectorBoundMask)
if( uiCurrentBytesRead && (ui64ReadOffset & m_ui64NotOnSectorBoundMask))
{
pucReadBuffer += (ui64ReadOffset & m_ui64NotOnSectorBoundMask);
f_assert( uiCurrentBytesRead >= m_uiBytesPerSector);
@@ -3523,6 +3530,12 @@ RCODE F_FileHdl::directWrite(
!bBufferOnSectorBound ||
!bSizeIsSectorMultiple)
{
if( m_bRequireAlignedIO)
{
rc = RC_SET_AND_ASSERT( NE_FLM_MISALIGNED_IO);
goto Exit;
}
bWaitForWrite = TRUE;
pucWriteBuffer = m_pucAlignedBuff;