From: batt Date: Mon, 17 Dec 2007 14:24:06 +0000 (+0000) Subject: Optimize. X-Git-Tag: 1.0.0~204 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=dc256a92515659a4e96c13bf080e31101cd52a9d;p=bertos.git Optimize. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1038 38d2e660-2303-0410-9eaa-f027e97ec537 --- 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); } }