summaryrefslogtreecommitdiff
path: root/nuttx/fs/nxffs/nxffs_initialize.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-05-03 13:46:14 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-05-03 13:46:14 +0000
commit77ddf4fe79c737c9005b879298dbb5c96fca56e2 (patch)
treef1d4d770e34fa779f4365d50318f51f123ef2d99 /nuttx/fs/nxffs/nxffs_initialize.c
parent337053d3d948beb9523352bc7fc682b201becab2 (diff)
downloadpx4-nuttx-77ddf4fe79c737c9005b879298dbb5c96fca56e2.tar.gz
px4-nuttx-77ddf4fe79c737c9005b879298dbb5c96fca56e2.tar.bz2
px4-nuttx-77ddf4fe79c737c9005b879298dbb5c96fca56e2.zip
Swap size of cache and pack buffers
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3554 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/fs/nxffs/nxffs_initialize.c')
-rw-r--r--nuttx/fs/nxffs/nxffs_initialize.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/nuttx/fs/nxffs/nxffs_initialize.c b/nuttx/fs/nxffs/nxffs_initialize.c
index 2d1f61e4c..6cfd68b5e 100644
--- a/nuttx/fs/nxffs/nxffs_initialize.c
+++ b/nuttx/fs/nxffs/nxffs_initialize.c
@@ -181,7 +181,8 @@ int nxffs_initialize(FAR struct mtd_dev_s *mtd)
/* Initialize the NXFFS volume structure */
- volume->mtd = mtd;
+ volume->mtd = mtd;
+ volume->cblock = (off_t)-1;
sem_init(&volume->exclsem, 0, 1);
sem_init(&volume->wrsem, 0, 1);
@@ -197,9 +198,9 @@ int nxffs_initialize(FAR struct mtd_dev_s *mtd)
goto errout_with_volume;
}
- /* Allocate one, in-memory erase block buffer */
+ /* Allocate one I/O block buffer to general files system access */
- volume->cache = (FAR uint8_t *)kmalloc(volume->geo.erasesize);
+ volume->cache = (FAR uint8_t *)kmalloc(volume->geo.blocksize);
if (!volume->cache)
{
fdbg("Failed to allocate an erase block buffer\n");
@@ -207,12 +208,12 @@ int nxffs_initialize(FAR struct mtd_dev_s *mtd)
goto errout_with_volume;
}
- /* Pre-allocate one additional I/O block buffer to support filesystem
- * packing. This buffer is not needed often, but is best to have pre-
- * allocated and in-place.
+ /* Pre-allocate one, full, in-memory erase block. This is needed for filesystem
+ * packing (but is useful in other places as well). This buffer is not needed
+ * often, but is best to have pre-allocated and in-place.
*/
- volume->pack = (FAR uint8_t *)kmalloc(volume->geo.blocksize);
+ volume->pack = (FAR uint8_t *)kmalloc(volume->geo.erasesize);
if (!volume->pack)
{
fdbg("Failed to allocate an I/O block buffer\n");