Optimize.
authorbatt <batt@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 17 Dec 2007 14:24:06 +0000 (14:24 +0000)
committerbatt <batt@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 17 Dec 2007 14:24:06 +0000 (14:24 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1038 38d2e660-2303-0410-9eaa-f027e97ec537

fs/battfs.c

index 8d02d94f5fcbfacf38ef9fafdaa17e64107c442a..752ec3c61981a582e581b0ea8a7ecdd1ab33bcb0 100644 (file)
@@ -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);
                }
        }