projects
/
yaffs2.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
f67d10d
)
Use vmalloc for large memory allocations
author
charles
<charles>
Sun, 9 Oct 2005 07:55:00 +0000
(07:55 +0000)
committer
charles
<charles>
Sun, 9 Oct 2005 07:55:00 +0000
(07:55 +0000)
yaffs_guts.c
patch
|
blob
|
history
yaffs_guts.h
patch
|
blob
|
history
diff --git
a/yaffs_guts.c
b/yaffs_guts.c
index eafbaa996e57054305f4104fa6c8003a00d26f9d..4783f85e92fbed109d200c401714735d83d26f80 100644
(file)
--- a/
yaffs_guts.c
+++ b/
yaffs_guts.c
@@
-13,7
+13,7
@@
*/
const char *yaffs_guts_c_version =
*/
const char *yaffs_guts_c_version =
- "$Id: yaffs_guts.c,v 1.2
0 2005-10-07 02:46:49
charles Exp $";
+ "$Id: yaffs_guts.c,v 1.2
1 2005-10-09 07:55:00
charles Exp $";
#include "yportenv.h"
#include "yportenv.h"
@@
-1757,6
+1757,13
@@
static int yaffs_InitialiseBlocks(yaffs_Device * dev, int nBlocks)
/* Set up dynamic blockinfo stuff. */
dev->chunkBitmapStride = (dev->nChunksPerBlock + 7) / 8;
dev->chunkBits = YMALLOC(dev->chunkBitmapStride * nBlocks);
/* Set up dynamic blockinfo stuff. */
dev->chunkBitmapStride = (dev->nChunksPerBlock + 7) / 8;
dev->chunkBits = YMALLOC(dev->chunkBitmapStride * nBlocks);
+ if(!dev->chunkBits){
+ dev->chunkBits = YMALLOC_ALT(dev->chunkBitmapStride * nBlocks);
+ dev->chunkBitsAlt = 1;
+ }
+ else
+ dev->chunkBitsAlt = 0;
+
if (dev->blockInfo && dev->chunkBits) {
memset(dev->blockInfo, 0, nBlocks * sizeof(yaffs_BlockInfo));
memset(dev->chunkBits, 0, dev->chunkBitmapStride * nBlocks);
if (dev->blockInfo && dev->chunkBits) {
memset(dev->blockInfo, 0, nBlocks * sizeof(yaffs_BlockInfo));
memset(dev->chunkBits, 0, dev->chunkBitmapStride * nBlocks);
@@
-1776,7
+1783,12
@@
static void yaffs_DeinitialiseBlocks(yaffs_Device * dev)
dev->blockInfoAlt = 0;
dev->blockInfo = NULL;
dev->blockInfoAlt = 0;
dev->blockInfo = NULL;
- YFREE(dev->chunkBits);
+
+ if(dev->chunkBitsAlt)
+ YFREE_ALT(dev->chunkBits);
+ else
+ YFREE(dev->chunkBits);
+ dev->chunkBitsAlt = 0;
dev->chunkBits = NULL;
}
dev->chunkBits = NULL;
}
diff --git
a/yaffs_guts.h
b/yaffs_guts.h
index c5eee97309a3d0ed6d8f4b90781bf5479fde676d..73375cc3f8fbbe8adf36e22fef73daa50f729d07 100644
(file)
--- a/
yaffs_guts.h
+++ b/
yaffs_guts.h
@@
-14,7
+14,7
@@
*
* Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL.
*
*
* Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL.
*
- * $Id: yaffs_guts.h,v 1.1
5 2005-10-07 02:46:5
0 charles Exp $
+ * $Id: yaffs_guts.h,v 1.1
6 2005-10-09 07:55:0
0 charles Exp $
*/
#ifndef __YAFFS_GUTS_H__
*/
#ifndef __YAFFS_GUTS_H__
@@
-561,8
+561,9
@@
struct yaffs_DeviceStruct {
/* Block Info */
yaffs_BlockInfo *blockInfo;
/* Block Info */
yaffs_BlockInfo *blockInfo;
- int blockInfoAlt; /* was allocated using alternative strategy */
__u8 *chunkBits; /* bitmap of chunks in use */
__u8 *chunkBits; /* bitmap of chunks in use */
+ unsigned blockInfoAlt:1; /* was allocated using alternative strategy */
+ unsigned chunkBitsAlt:1; /* was allocated using alternative strategy */
int chunkBitmapStride; /* Number of bytes of chunkBits per block.
* Must be consistent with nChunksPerBlock.
*/
int chunkBitmapStride; /* Number of bytes of chunkBits per block.
* Must be consistent with nChunksPerBlock.
*/