From 24ab1dd9b77664d9e10a78f858c6365641c34148 Mon Sep 17 00:00:00 2001 From: "S.J.R. van Schaik" Date: Thu, 18 May 2017 15:01:39 +0200 Subject: [PATCH] ftl: trim last sector by writing an empty page descriptor --- source/ftl/ftl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/ftl/ftl.c b/source/ftl/ftl.c index 27e23e9..68fdca4 100644 --- a/source/ftl/ftl.c +++ b/source/ftl/ftl.c @@ -650,9 +650,11 @@ int ftl_trim(struct ftl_journal *j, uint32_t va) if (i == 32) { j->root = UINT32_MAX; - /* TODO: how do we clean the FTL? */ - return 0; + memset(&page_desc, 0xff, sizeof page_desc); + page_desc.nused_pages = 0; + + return ftl_write_upage(j, NULL, &page_desc); } if (read_page_desc(j, &alt_page_desc, alt_va) < 0)