mkiiskila commented on a change in pull request #2052: FCB Rotate Notification
URL: https://github.com/apache/mynewt-core/pull/2052#discussion_r336412030
 
 

 ##########
 File path: fs/fcb/src/fcb_append.c
 ##########
 @@ -36,7 +57,7 @@ fcb_new_area(struct fcb *fcb, int cnt)
         if (!rfa) {
             rfa = fa;
         }
-        if (fa == fcb->f_oldest) {
+        if (fcb->f_oldest == fcb_area_past_newest(fcb)) {
 
 Review comment:
   This change here would break things for FCB user(s) which rely on 
f_scratch_cnt keeping a scratch sector around (i.e. config).
   
   I believe you're trying to make sure that log rotate notify gets called when 
there is still one 'scratch' area left empty. You should do that by setting 
f_scratch_cnt to value 1 or greater before calling fcb_init().
   
   The intent is to create new log entries from data which exists within the 
flash area about to get erased by a call to fcb_rotate(). The way to achieve 
would be to:
   1) set f_scratch_cnt to 1 before calling fcb_init()
   2) in the log_rotate callback call fcb_append_to_scratch() to 'activate' the 
scratch area as a possible area for writes
   3) then you can write log entries to this scratch area.
   
   There's an example of this process in conf_fcb_compress_internal()

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to