Prechádzať zdrojové kódy

storage/reflink: reorder start() to be more readable

This also makes slightly more sense in the exotic (and currently unused)
case of restarting a crashed snap_on_start *and* save_on_stop volume.
Rusty Bird 6 rokov pred
rodič
commit
1743c76ca9
1 zmenil súbory, kde vykonal 3 pridanie a 3 odobranie
  1. 3 3
      qubes/storage/reflink.py

+ 3 - 3
qubes/storage/reflink.py

@@ -151,12 +151,12 @@ class ReflinkVolume(qubes.storage.Volume):
         return self.save_on_stop and os.path.exists(self._path_dirty)
 
     def start(self):
+        if self.is_dirty():  # implies self.save_on_stop
+            return self
         if self.snap_on_start:
             # pylint: disable=protected-access
             _copy_file(self.source._path_clean, self._path_clean)
-        if self.is_dirty():  # implies self.save_on_stop
-            return self
-        if self.save_on_stop or self.snap_on_start:
+        if self.snap_on_start or self.save_on_stop:
             _copy_file(self._path_clean, self._path_dirty)
         else:
             _create_sparse_file(self._path_dirty, self.size)