fp.write(data)
fp.close()
+ def delete(self, filename):
+ os.unlink(os.path.join(self.path, filename))
+
def loc_to_name(self, location):
return "log-%08d-%08d" % (location)
print
print "Segment utilizations:"
for (s, u) in sorted(util.segments.items()):
- #if u[1] > 0:
print "%s: %s %s" % (s, u, float(u[1]) / u[0])
+ if u[1] == 0:
+ print "Deleting..."
+ backend.delete(s)
self.inodes = inodes
self.util = util
# Determine which segments are poorly utilized and should be cleaned. We
# need better heuristics here.
for (s, u) in sorted(inode_map.util.segments.items()):
- if float(u[1]) / u[0] < 0.95 and u[1] > 0:
+ if float(u[1]) / u[0] < 0.6 and u[1] > 0:
print "Should clean segment", s
loc = backend.name_to_loc(s)
if s: inode_map.obsolete_segments.add(loc)
imap.build(backend, chkpt)
print chkpt
- log_dir = LogDirectory(backend, 1)
+ log_dir = LogDirectory(backend, 0)
run_cleaner(backend, imap, log_dir)
imap.write(backend, log_dir)
log_dir.close_all()