From dc256a92515659a4e96c13bf080e31101cd52a9d Mon Sep 17 00:00:00 2001 From: batt Date: Mon, 17 Dec 2007 14:24:06 +0000 Subject: [PATCH] Optimize. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1038 38d2e660-2303-0410-9eaa-f027e97ec537 --- fs/battfs.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/fs/battfs.c b/fs/battfs.c index 8d02d94f..752ec3c6 100644 --- a/fs/battfs.c +++ b/fs/battfs.c @@ -379,16 +379,15 @@ bool battfs_init(struct BattFsSuper *disk) else { /* Check if putting mark to MARK_PAGE_VALID makes fcs correct */ - mark_t old_mark = hdr.mark; + mark_t mark = hdr.mark; hdr.mark = MARK_PAGE_VALID; rotating_init(&cks); rotating_update(&hdr, sizeof(BattFsPageHeader) - sizeof(rotating_t), &cks); - if (cks == hdr.fcs) - /* Page is a valid marked page, insert in free list in correct order */ - insertFreePage(disk, filelen_table, old_mark, page); - else + if (cks != hdr.fcs) /* Page is not a valid marked page, insert at the end of list */ - insertFreePage(disk, filelen_table, ++disk->max_free, page); + mark = ++disk->max_free; + + insertFreePage(disk, filelen_table, mark, page); } } -- 2.25.1