summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2012-11-23 08:29:24 +0000
committerLars Wirzenius <liw@liw.fi>2012-11-23 08:29:24 +0000
commita4e91cc2398c67dbafe0ef6bdc9923c46ca646b7 (patch)
treefa095b6af4faa97bf2b9a6f10547ccf8b7db27f3
parent7ae3886f48c31ee95957cf984accaa955af2831c (diff)
parent242960096014adcc7823e98ff14b9b752848cc38 (diff)
downloadlarch-a4e91cc2398c67dbafe0ef6bdc9923c46ca646b7.tar.gz
Make fsck progress reporting be a bit more fine grained
-rw-r--r--NEWS5
-rwxr-xr-xfsck-larch6
-rwxr-xr-xlarch/fsck.py11
3 files changed, 13 insertions, 9 deletions
diff --git a/NEWS b/NEWS
index b6af004..f7ceb9f 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,11 @@ NEWS for larch
These are the release notes for larch, a Python implementation of a
copy-on-write B-tree, designed by Ohad Rodeh.
+Version UNRELEASED
+------------------
+
+* Make fsck progress reporting be a bit more fine grained.
+
Version 1.20121006
------------------
diff --git a/fsck-larch b/fsck-larch
index 9afe00d..aef6647 100755
--- a/fsck-larch
+++ b/fsck-larch
@@ -51,11 +51,11 @@ class Fsck(cliapp.Application):
forest = larch.open_forest(dirname=dirname)
fsck = larch.fsck.Fsck(forest, self.warning, self.error,
self.settings['fix'])
- fsck.find_work()
+ all_work = list(fsck.find_work())
- self.ts['checks'] = len(fsck.work)
+ self.ts['checks'] = len(all_work)
self.ts['check'] = 0
- for work in fsck.work:
+ for work in all_work:
self.ts['check'] += 1
self.ts['checkname'] = str(work)
work.do()
diff --git a/larch/fsck.py b/larch/fsck.py
index 3a633fb..3554d95 100755
--- a/larch/fsck.py
+++ b/larch/fsck.py
@@ -220,18 +220,17 @@ class Fsck(object):
self.warning = warning
self.error = error
self.fix = fix
- self.work = []
def find_work(self):
for node_id in self.forest.node_store.list_nodes():
tracing.trace('found node %s' % node_id)
- self.work.append(CheckNode(self, node_id))
+ yield CheckNode(self, node_id)
for tree in self.forest.trees:
- self.work.append(CheckRoot(self, tree.root.id))
+ yield CheckRoot(self, tree.root.id)
extra = CheckExtraNodes(self)
for tree in self.forest.trees:
- self.work.append(CheckRecursively(self, tree.root.id, extra.seen))
- self.work.append(extra)
+ yield CheckRecursively(self, tree.root.id, extra.seen)
+ yield extra
if self.fix:
- self.work.append(CommitForest(self))
+ yield CommitForest(self)