From 1743c76ca9271a280b5c7682f2b84c4ffd7d4b9e Mon Sep 17 00:00:00 2001 From: Rusty Bird Date: Mon, 12 Mar 2018 16:38:56 +0000 Subject: [PATCH] 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. --- qubes/storage/reflink.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qubes/storage/reflink.py b/qubes/storage/reflink.py index 7660dedd..9132be3f 100644 --- a/qubes/storage/reflink.py +++ b/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)