From fa3f7801d2054bbce3e64e198a6e9a2170bddeab Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sun, 17 Mar 2019 23:16:41 -0500 Subject: [PATCH] [ox/fs] Remove inode on decLinks if links is 0 --- deps/ox/src/ox/fs/filestore/filestoretemplate.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/deps/ox/src/ox/fs/filestore/filestoretemplate.hpp b/deps/ox/src/ox/fs/filestore/filestoretemplate.hpp index 74dcdae18..f817051c5 100644 --- a/deps/ox/src/ox/fs/filestore/filestoretemplate.hpp +++ b/deps/ox/src/ox/fs/filestore/filestoretemplate.hpp @@ -232,7 +232,9 @@ Error FileStoreTemplate::decLinks(InodeId_t id) { auto item = find(id); if (item.valid()) { item->links--; - // TODO: remove item if links is 0 + if (item->links == 0) { + remove(item); + } return OxError(0); } return OxError(1);