SmartFS: Backout last change. It alters the behavior when it should not. Obviously there is something that I do not understand
This commit is contained in:
parent
f86ca94798
commit
2ff1b173f2
2
arch
2
arch
@ -1 +1 @@
|
||||
Subproject commit fb42257296843a19a50cbca004324f1c88a00b8f
|
||||
Subproject commit 6a3129092ce8ef63c608fa932185873850621aa2
|
2
configs
2
configs
@ -1 +1 @@
|
||||
Subproject commit e62ee658d540523e2a8b5ecdd1832e65e9713dc9
|
||||
Subproject commit d5c2d3699b337a11ef0e5f204537873e719a97ae
|
@ -220,8 +220,7 @@ struct smart_struct_s
|
||||
uint32_t unusedsectors; /* Count of unused sectors (i.e. free when erased) */
|
||||
uint32_t blockerases; /* Count of unused sectors (i.e. free when erased) */
|
||||
#endif
|
||||
uint32_t neraseblocks; /* Number of erase blocks or sub-sectors */
|
||||
uint32_t erasesize; /* Size of an erase block */
|
||||
uint16_t neraseblocks; /* Number of erase blocks or sub-sectors */
|
||||
uint16_t lastallocblock; /* Last block we allocated a sector from */
|
||||
uint16_t freesectors; /* Total number of free sectors */
|
||||
uint16_t releasesectors; /* Total number of released sectors */
|
||||
@ -229,6 +228,7 @@ struct smart_struct_s
|
||||
uint16_t sectorsPerBlk; /* Number of sectors per erase block */
|
||||
uint16_t sectorsize; /* Sector size on device */
|
||||
uint16_t totalsectors; /* Total number of sectors on device */
|
||||
uint32_t erasesize; /* Size of an erase block */
|
||||
FAR uint8_t *releasecount; /* Count of released sectors per erase block */
|
||||
FAR uint8_t *freecount; /* Count of free sectors per erase block */
|
||||
FAR char *rwbuffer; /* Our sector read/write buffer */
|
||||
@ -925,6 +925,11 @@ static int smart_geometry(FAR struct inode *inode, struct geometry *geometry)
|
||||
#endif
|
||||
|
||||
erasesize = dev->geo.erasesize;
|
||||
if (erasesize == 0)
|
||||
{
|
||||
erasesize = 262144;
|
||||
}
|
||||
|
||||
geometry->geo_nsectors = dev->geo.neraseblocks * erasesize /
|
||||
dev->sectorsize;
|
||||
geometry->geo_sectorsize = dev->sectorsize;
|
||||
@ -968,10 +973,19 @@ static int smart_setsectorsize(FAR struct smart_struct_s *dev, uint16_t size)
|
||||
|
||||
erasesize = dev->geo.erasesize;
|
||||
dev->neraseblocks = dev->geo.neraseblocks;
|
||||
|
||||
/* Most FLASH devices have erase size of 64K, but geo.erasesize is only
|
||||
* 16 bits, so it will be zero
|
||||
*/
|
||||
|
||||
if (erasesize == 0)
|
||||
{
|
||||
erasesize = 262144;
|
||||
}
|
||||
|
||||
dev->erasesize = erasesize;
|
||||
dev->sectorsize = size;
|
||||
dev->mtdBlksPerSector = dev->sectorsize / dev->geo.blocksize;
|
||||
|
||||
if (erasesize / dev->sectorsize > 256)
|
||||
{
|
||||
/* We can't throw a dbg message here becasue it is too early.
|
||||
|
Loading…
Reference in New Issue
Block a user