MFS Cache Bug

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

MFS Cache Bug

1,172 次查看
leifzars
Contributor IV

Provide MFS_sector_cache_invalidate with args first_sector = X and sectors = 1. Insure cache includes sector X.

The cache_record will not be invalidated!

Check the current code out...

last_sector = first_sector + sectors - 1; // so last_sector now equals X

....
if ((cache_record->SECTOR_NUM >= first_sector) && (cache_record->SECTOR_NUM < last_sector))
{

   //Do invalidation

}

The above evaluates to false, but the intent was for it to be true. Changing the second condition from < to <= fixes the issue.

标签 (1)
标记 (2)
0 项奖励
6 回复数

799 次查看
danielchen
NXP TechSupport
NXP TechSupport

Hi Leif:

Minimum number of sectors which MFS is able to keep in cache at a time is 2 sectors. There is a macro in mfs_cnfg.h.

#define MFSCFG_SECTOR_CACHE_SIZE 2

You also can refer to the section 2.5 in MQX_MFS_User_Guide.pdf for more details.

I will forward your solution to the develop team.  Thanks for your feedback.

Regards

Daniel

0 项奖励

799 次查看
leifzars
Contributor IV

Daniel,

I am not sure that the sector cache size has anything to do with the invalidate function failing to invalidate a cached sector? A cached record is comprised of one sector, no matter the number of records (MFSCFG_SECTOR_CACHE_SIZE ). 

MFSCFG_SECTOR_CACHE_SIZE defines the number of cache records, one sector per record.

The MFS_sector_cache_invalidate function allows you to request 1 or a region of sectors to be invalidated. In the case of trying to invalidate 1, it fails. 

Thanks Leif

0 项奖励

799 次查看
leifzars
Contributor IV

Daniel,

What do you think?

0 项奖励

799 次查看
danielchen
NXP TechSupport
NXP TechSupport

Hi Leif:

Yes , you are right.   from function MFS_sector_cache_invalidate_record we can see  it is one sector per record. This is an issue we need to fix.

Regards

Daniel

0 项奖励

799 次查看
leifzars
Contributor IV

Good deal, thanks

0 项奖励

799 次查看
leifzars
Contributor IV

Found same issue in MFS_sector_cache_flush.

0 项奖励