From 2850c16f8aff7637b3a2b602f98805c2e704ddc5 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 5 Dec 2007 17:11:22 +0000 Subject: 2007-12-06 Tatsuhiro Tsujikawa Rewritten direct I/O support routine * src/SingleFileAllocationIterator.cc * src/MultiDiskAdaptor.{h, cc} * src/ByteArrayDiskWriter.h * src/AbstractSingleDiskAdaptor.h * src/AbstractDiskWriter.cc * src/DefaultPieceStorage.cc * src/DiskWriter.h * src/BinaryStream.h * src/IteratableChunkChecksumValidator.cc * src/IteratableChecksumValidator.cc * src/CheckIntegrityEntry.cc * src/FileAllocationEntry.cc --- src/SingleFileAllocationIterator.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/SingleFileAllocationIterator.cc') diff --git a/src/SingleFileAllocationIterator.cc b/src/SingleFileAllocationIterator.cc index 620410fa..ae6d513e 100644 --- a/src/SingleFileAllocationIterator.cc +++ b/src/SingleFileAllocationIterator.cc @@ -40,11 +40,16 @@ #define BUFSIZE (256*1024) SingleFileAllocationIterator::SingleFileAllocationIterator(BinaryStream* stream, int64_t offset, int64_t totalLength):_stream(stream), _offset(offset), _totalLength(totalLength), _buffer(0) -{} +{ + if(_offset%512 == 0) { + _stream->enableDirectIO(); + } +} SingleFileAllocationIterator::~SingleFileAllocationIterator() { delete [] _buffer; + _stream->disableDirectIO(); } void SingleFileAllocationIterator::init() -- cgit