From 5a2f398eca68b2b0330ddcec2b222bf76875f82f Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 28 Nov 2007 14:22:28 +0000 Subject: 2007-11-28 Tatsuhiro Tsujikawa Added direct I/O support. The current implementation uses O_DIRECT, which is not posix standard and is tested on linux 2.6.21. Currently only file allocation uses direct I/O. * src/SingleFileAllocationIterator.{h, cc} * test/SingleFileAllocationIteratorTest.cc * src/MultiFileAllocationIterator.{h, cc} * test/MultiFileAllocationIteratorTest.cc * src/BinaryStream.h * src/DiskWriter.h * src/AbstractDiskWriter.{h, cc} * src/ByteArrayDiskWriter.h * src/DiskAdaptor.h * src/AbstractSingleDiskAdaptor.{h, cc} * src/MultiDiskAdaptor.{h, cc} * src/FileAllocationEntry.cc * src/Util.{h, cc} * src/OptionHandlerFactory.cc * src/prefs.h * src/version_usage.cc * src/option_processing.cc Moved FileAllocationMan::markCurrentFileAllocationEntryDone() to handleException. * src/MultiFileAllocationIterator.cc Added EINTR handling * src/SocketCore.cc --- src/SingleFileAllocationIterator.h | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src/SingleFileAllocationIterator.h') diff --git a/src/SingleFileAllocationIterator.h b/src/SingleFileAllocationIterator.h index 4b401f13..3690df88 100644 --- a/src/SingleFileAllocationIterator.h +++ b/src/SingleFileAllocationIterator.h @@ -37,15 +37,20 @@ #include "FileAllocationIterator.h" -class AbstractSingleDiskAdaptor; +class BinaryStream; class SingleFileAllocationIterator:public FileAllocationIterator { private: - AbstractSingleDiskAdaptor* _diskAdaptor; + BinaryStream* _stream; + int64_t _offset; + + int64_t _totalLength; + + unsigned char* _buffer; public: - SingleFileAllocationIterator(AbstractSingleDiskAdaptor* diskAdaptor); + SingleFileAllocationIterator(BinaryStream* stream, int64_t offset, int64_t totalLength); virtual ~SingleFileAllocationIterator(); @@ -58,7 +63,15 @@ public: return _offset; } - virtual int64_t getTotalLength(); + virtual int64_t getTotalLength() + { + return _totalLength; + } + + /** + * Must be called only once, before calling allocateChunk() + */ + void init(); }; typedef SharedHandle SingleFileAllocationIteratorHandle; -- cgit