summaryrefslogtreecommitdiff
path: root/src/MultiDiskAdaptor.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2011-07-16 13:57:31 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2011-07-16 13:57:31 +0900
commit5bbfa742fcd43011c04fd053703d7c8835283d01 (patch)
tree734b73502ea2b126e108c0bc9703e40a2f22ba4f /src/MultiDiskAdaptor.cc
parent5c4a52ad741c66b4aa263a542da2c1e5546ca6bf (diff)
Removed use of O_DIRECT because it performs bad.
Diffstat (limited to 'src/MultiDiskAdaptor.cc')
-rw-r--r--src/MultiDiskAdaptor.cc42
1 files changed, 0 insertions, 42 deletions
diff --git a/src/MultiDiskAdaptor.cc b/src/MultiDiskAdaptor.cc
index 0c37c0df..f3672836 100644
--- a/src/MultiDiskAdaptor.cc
+++ b/src/MultiDiskAdaptor.cc
@@ -56,7 +56,6 @@ namespace aria2 {
DiskWriterEntry::DiskWriterEntry(const SharedHandle<FileEntry>& fileEntry)
: fileEntry_(fileEntry),
open_(false),
- directIO_(false),
needsFileAllocation_(false)
{}
@@ -69,9 +68,6 @@ void DiskWriterEntry::initAndOpenFile()
{
if(diskWriter_) {
diskWriter_->initAndOpenFile(fileEntry_->getLength());
- if(directIO_) {
- diskWriter_->enableDirectIO();
- }
open_ = true;
}
}
@@ -80,9 +76,6 @@ void DiskWriterEntry::openFile()
{
if(diskWriter_) {
diskWriter_->openFile(fileEntry_->getLength());
- if(directIO_) {
- diskWriter_->enableDirectIO();
- }
open_ = true;
}
}
@@ -91,9 +84,6 @@ void DiskWriterEntry::openExistingFile()
{
if(diskWriter_) {
diskWriter_->openExistingFile(fileEntry_->getLength());
- if(directIO_) {
- diskWriter_->enableDirectIO();
- }
open_ = true;
}
}
@@ -126,26 +116,9 @@ bool DiskWriterEntry::operator<(const DiskWriterEntry& entry) const
return *fileEntry_ < *entry.fileEntry_;
}
-void DiskWriterEntry::enableDirectIO()
-{
- if(open_) {
- diskWriter_->enableDirectIO();
- }
- directIO_ = true;
-}
-
-void DiskWriterEntry::disableDirectIO()
-{
- if(open_) {
- diskWriter_->disableDirectIO();
- }
- directIO_ = false;
-}
-
MultiDiskAdaptor::MultiDiskAdaptor()
: pieceLength_(0),
maxOpenFiles_(DEFAULT_MAX_OPEN_FILES),
- directIOAllowed_(false),
readOnly_(false)
{}
@@ -253,9 +226,6 @@ void MultiDiskAdaptor::resetDiskWriterEntries()
A2_LOG_DEBUG(fmt("Creating DiskWriter for filename=%s",
(*i)->getFilePath().c_str()));
(*i)->setDiskWriter(dwFactory.newDiskWriter((*i)->getFilePath()));
- if(directIOAllowed_) {
- (*i)->getDiskWriter()->allowDirectIO();
- }
if(readOnly_) {
(*i)->getDiskWriter()->enableReadOnly();
}
@@ -474,18 +444,6 @@ SharedHandle<FileAllocationIterator> MultiDiskAdaptor::fileAllocationIterator()
(new MultiFileAllocationIterator(this));
}
-void MultiDiskAdaptor::enableDirectIO()
-{
- std::for_each(diskWriterEntries_.begin(), diskWriterEntries_.end(),
- mem_fun_sh(&DiskWriterEntry::enableDirectIO));
-}
-
-void MultiDiskAdaptor::disableDirectIO()
-{
- std::for_each(diskWriterEntries_.begin(), diskWriterEntries_.end(),
- mem_fun_sh(&DiskWriterEntry::disableDirectIO));
-}
-
void MultiDiskAdaptor::enableReadOnly()
{
readOnly_ = true;