From: Jocelyn Turcotte Date: Mon, 13 Feb 2017 14:57:28 +0000 (+0100) Subject: Replace WaitForFinishedInParentDirectory with WaitForFinished for directory moves X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~804 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=0b098045f1d548d147962a7e1d6bbd62ccffcbd7;p=nextcloud-desktop.git Replace WaitForFinishedInParentDirectory with WaitForFinished for directory moves In preparation for the PropagateDirectory refactoring, simplify things by removing WaitForFinishedInParentDirectory, which is currently implemented as a one-level check. This value is important for directory items, but is however never used since a directory CSYNC_INSTRUCTION_RENAME item will always be in PropagateDirectory::_firstJob, which will have to pass through its own PropagateDirectory job's parallelism() before reaching the parent's _subJobs optimization. Since PropagateDirectory::parallelism can only return WaitForFinished or FullParallelism, that value is lost. So this commit doesn't change the behavior for directories, and allow file renames to be scheduled in parallel across directories (which isn't a problem). --- diff --git a/src/libsync/owncloudpropagator.cpp b/src/libsync/owncloudpropagator.cpp index f54d57a33..c7468bb08 100644 --- a/src/libsync/owncloudpropagator.cpp +++ b/src/libsync/owncloudpropagator.cpp @@ -621,16 +621,11 @@ bool PropagateDirectory::scheduleNextJob() return false; } - bool stopAtDirectory = false; for (int i = 0; i < _subJobs.size(); ++i) { if (_subJobs.at(i)->_state == Finished) { continue; } - if (stopAtDirectory && qobject_cast(_subJobs.at(i))) { - return false; - } - if (possiblyRunNextJob(_subJobs.at(i))) { return true; } @@ -641,9 +636,6 @@ bool PropagateDirectory::scheduleNextJob() if (paral == WaitForFinished) { return false; } - if (paral == WaitForFinishedInParentDirectory) { - stopAtDirectory = true; - } } return false; } diff --git a/src/libsync/owncloudpropagator.h b/src/libsync/owncloudpropagator.h index 5a3763d49..07328939c 100644 --- a/src/libsync/owncloudpropagator.h +++ b/src/libsync/owncloudpropagator.h @@ -76,12 +76,6 @@ public: So this job is guaranteed to finish before any jobs below it are executed. */ WaitForFinished, - - /** A job with this parallelism will allow later jobs to start and - run in parallel as long as they aren't PropagateDirectory jobs. - When the first directory job is encountered, no further jobs - will be started until this one is finished. */ - WaitForFinishedInParentDirectory }; virtual JobParallelism parallelism() { return FullParallelism; } diff --git a/src/libsync/propagateremotemove.h b/src/libsync/propagateremotemove.h index 8d213e430..afda27b2f 100644 --- a/src/libsync/propagateremotemove.h +++ b/src/libsync/propagateremotemove.h @@ -54,7 +54,7 @@ public: : PropagateItemJob(propagator, item) {} void start() Q_DECL_OVERRIDE; void abort() Q_DECL_OVERRIDE; - JobParallelism parallelism() Q_DECL_OVERRIDE { return OCC::PropagatorJob::WaitForFinishedInParentDirectory; } + JobParallelism parallelism() Q_DECL_OVERRIDE { return _item->_isDirectory ? WaitForFinished : FullParallelism; } /** * Rename the directory in the selective sync list diff --git a/src/libsync/propagatorjobs.h b/src/libsync/propagatorjobs.h index c3898db48..88413d34e 100644 --- a/src/libsync/propagatorjobs.h +++ b/src/libsync/propagatorjobs.h @@ -79,7 +79,7 @@ class PropagateLocalRename : public PropagateItemJob { public: PropagateLocalRename (OwncloudPropagator* propagator,const SyncFileItemPtr& item) : PropagateItemJob(propagator, item) {} void start() Q_DECL_OVERRIDE; - JobParallelism parallelism() Q_DECL_OVERRIDE { return WaitForFinishedInParentDirectory; } + JobParallelism parallelism() Q_DECL_OVERRIDE { return _item->_isDirectory ? WaitForFinished : FullParallelism; } }; }