storage/file: refactor is_dirty()
This commit is contained in:
parent
d3d6b9de2b
commit
796e6f5096
@ -214,11 +214,10 @@ class FileVolume(qubes.storage.Volume):
|
|||||||
_remove_if_exists(self.path_cow)
|
_remove_if_exists(self.path_cow)
|
||||||
|
|
||||||
def is_dirty(self):
|
def is_dirty(self):
|
||||||
if not self.save_on_stop:
|
if self.save_on_stop:
|
||||||
return False
|
with suppress(FileNotFoundError), open(self.path_cow, 'rb') as cow:
|
||||||
if os.path.exists(self.path_cow):
|
cow_used = os.fstat(cow.fileno()).st_blocks * BLKSIZE
|
||||||
stat = os.stat(self.path_cow)
|
return cow_used > 0
|
||||||
return stat.st_blocks > 0
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def resize(self, size):
|
def resize(self, size):
|
||||||
|
Loading…
Reference in New Issue
Block a user