projects
/
yaffs2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
yaffs: Don't do checkpoint for small partitions.
[yaffs2.git]
/
yaffs_guts.c
diff --git
a/yaffs_guts.c
b/yaffs_guts.c
index d77ee4745d79e29d1e18ceeafc57a2b591c38a66..d067d1d03d53552efbff6d9bd16e84f83a86f71d 100644
(file)
--- a/
yaffs_guts.c
+++ b/
yaffs_guts.c
@@
-33,8
+33,17
@@
/* Note YAFFS_GC_GOOD_ENOUGH must be <= YAFFS_GC_PASSIVE_THRESHOLD */
#define YAFFS_GC_GOOD_ENOUGH 2
#define YAFFS_GC_PASSIVE_THRESHOLD 4
/* Note YAFFS_GC_GOOD_ENOUGH must be <= YAFFS_GC_PASSIVE_THRESHOLD */
#define YAFFS_GC_GOOD_ENOUGH 2
#define YAFFS_GC_PASSIVE_THRESHOLD 4
+
#define YAFFS_SMALL_HOLE_THRESHOLD 3
#define YAFFS_SMALL_HOLE_THRESHOLD 3
+/*
+ * Checkpoints are really no benefit on very small partitions.
+ *
+ * To save space on small partitions don't bother with checkpoints unless
+ * the partition is at least this big.
+ */
+#define YAFFS_CHECKPOINT_MIN_BLOCKS 60
+
#include "yaffs_ecc.h"
#include "yaffs_ecc.h"
@@
-179,7
+188,7
@@
static __u32 ShiftsGE(__u32 x)
static __u32 Shifts(__u32 x)
{
static __u32 Shifts(__u32 x)
{
-
int
nShifts;
+
__u32
nShifts;
nShifts = 0;
nShifts = 0;
@@
-2952,10
+2961,17
@@
static int yaffs_FindBlockForAllocation(yaffs_Device *dev)
+static int yaffs_CheckpointRequired(yaffs_Device *dev)
+{
+ int nblocks = dev->internalEndBlock - dev->internalStartBlock + 1 ;
+ return dev->param.isYaffs2 &&
+ !dev->param.skipCheckpointWrite &&
+ (nblocks >= YAFFS_CHECKPOINT_MIN_BLOCKS);
+}
static int yaffs_CalcCheckpointBlocksRequired(yaffs_Device *dev)
{
if (!dev->nCheckpointBlocksRequired &&
static int yaffs_CalcCheckpointBlocksRequired(yaffs_Device *dev)
{
if (!dev->nCheckpointBlocksRequired &&
-
dev->param.isYaffs2)
{
+
yaffs_CheckpointRequired(dev))
{
/* Not a valid value so recalculate */
int nBytes = 0;
int nBlocks;
/* Not a valid value so recalculate */
int nBytes = 0;
int nBlocks;
@@
-4876,7
+4892,7
@@
static int yaffs_WriteCheckpointData(yaffs_Device *dev)
{
int ok = 1;
{
int ok = 1;
- if (
dev->param.skipCheckpointWrite || !dev->param.isYaffs2
) {
+ if (
!yaffs_CheckpointRequired(dev)
) {
T(YAFFS_TRACE_CHECKPOINT, (TSTR("skipping checkpoint write" TENDSTR)));
ok = 0;
}
T(YAFFS_TRACE_CHECKPOINT, (TSTR("skipping checkpoint write" TENDSTR)));
ok = 0;
}
@@
-5132,8
+5148,6
@@
int yaffs_DoWriteDataToFile(yaffs_Object *in, const __u8 *buffer, loff_t offset,
dev = in->myDev;
while (n > 0 && chunkWritten >= 0) {
dev = in->myDev;
while (n > 0 && chunkWritten >= 0) {
- /* chunk = offset / dev->nDataBytesPerChunk + 1; */
- /* start = offset % dev->nDataBytesPerChunk; */
yaffs_AddrToChunk(dev, offset, &chunk, &start);
if (chunk * dev->nDataBytesPerChunk + start != offset ||
yaffs_AddrToChunk(dev, offset, &chunk, &start);
if (chunk * dev->nDataBytesPerChunk + start != offset ||
@@
-5143,7
+5157,7
@@
int yaffs_DoWriteDataToFile(yaffs_Object *in, const __u8 *buffer, loff_t offset,
TENDSTR),
(int)offset, chunk, start));
}
TENDSTR),
(int)offset, chunk, start));
}
- chunk++;
+ chunk++;
/* File pos to chunk in file offset */
/* OK now check for the curveball where the start and end are in
* the same chunk.
/* OK now check for the curveball where the start and end are in
* the same chunk.