annotate yaffs_packedtags2.h @ 403:205fa93db422

yaffs New background garbage collector and related tweaks This commit - introduces the yaffs background garbage collection feature - tweaks the foregound garbage collection to do less work - changes the way auto-checkpointing works - tweaks the block refreshing logic. The aim of the background garbage collector is to do at least some of the garbage collection in the background so that writing operations will not have to do as much garbage collection which should make writes faster. The amount of background garbage collection is controlled by the ratio between the amount of erased space vs the amount of free space: * If less than quarter of free space is erased, then background gc is frequent. * Else if less than a half of the free space is erased, then background gc is still done reasonably frequently. * else (at least half of the free space is erased) the background gc is done infrequently. Background gc is not attempted if the partition is checkpointed since that would invalidate the checkpoint. The auto-checkpointing feature has changed slightly. If the yaffs_auto_checkpoint value is set to 1 or 2 then the auto checkpointing will be blocked if the erased space is less than half the free space (ie. the auto-checkpointing is blocked to allow background gc to progress). Oring in 4 into the yaffs_auto_checkpoint will do a one-shot override, forcing a checkpoint and suspending background gc until the partition is dirtied by a write, erase etc. The block refreshing control has been changed. The dev->param.refreshPeriod now controls how many blocks are garbage collected before another refresh is performed. Values around 1000 probably make the best sense. Signed-off-by: Charles Manning <cdhmanning@gmail.com>
author Charles Manning <cdhmanning@gmail.com>
date Fri, 16 Apr 2010 15:39:16 +1200
parents 1d1b453d8b57
children b5309c9b6d7f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
168
b8f20fdc3a58 normalise licence headers and attributions
wookey <wookey>
parents: 77
diff changeset
1 /*
198
b7f785925166 Cleanup patch - Remove all trailing whitespace and fix a few typos.
wookey <wookey>
parents: 168
diff changeset
2 * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
168
b8f20fdc3a58 normalise licence headers and attributions
wookey <wookey>
parents: 77
diff changeset
3 *
b8f20fdc3a58 normalise licence headers and attributions
wookey <wookey>
parents: 77
diff changeset
4 * Copyright (C) 2002-2007 Aleph One Ltd.
b8f20fdc3a58 normalise licence headers and attributions
wookey <wookey>
parents: 77
diff changeset
5 * for Toby Churchill Ltd and Brightstar Engineering
b8f20fdc3a58 normalise licence headers and attributions
wookey <wookey>
parents: 77
diff changeset
6 *
b8f20fdc3a58 normalise licence headers and attributions
wookey <wookey>
parents: 77
diff changeset
7 * Created by Charles Manning <charles@aleph1.co.uk>
b8f20fdc3a58 normalise licence headers and attributions
wookey <wookey>
parents: 77
diff changeset
8 *
b8f20fdc3a58 normalise licence headers and attributions
wookey <wookey>
parents: 77
diff changeset
9 * This program is free software; you can redistribute it and/or modify
b8f20fdc3a58 normalise licence headers and attributions
wookey <wookey>
parents: 77
diff changeset
10 * it under the terms of the GNU Lesser General Public License version 2.1 as
b8f20fdc3a58 normalise licence headers and attributions
wookey <wookey>
parents: 77
diff changeset
11 * published by the Free Software Foundation.
b8f20fdc3a58 normalise licence headers and attributions
wookey <wookey>
parents: 77
diff changeset
12 *
b8f20fdc3a58 normalise licence headers and attributions
wookey <wookey>
parents: 77
diff changeset
13 * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL.
b8f20fdc3a58 normalise licence headers and attributions
wookey <wookey>
parents: 77
diff changeset
14 */
b8f20fdc3a58 normalise licence headers and attributions
wookey <wookey>
parents: 77
diff changeset
15
77
794fd064bd36 lindent
marty <marty>
parents: 14
diff changeset
16 /* This is used to pack YAFFS2 tags, not YAFFS1tags. */
6
c31b20a2342e *** empty log message ***
charles <charles>
parents:
diff changeset
17
c31b20a2342e *** empty log message ***
charles <charles>
parents:
diff changeset
18 #ifndef __YAFFS_PACKEDTAGS2_H__
c31b20a2342e *** empty log message ***
charles <charles>
parents:
diff changeset
19 #define __YAFFS_PACKEDTAGS2_H__
c31b20a2342e *** empty log message ***
charles <charles>
parents:
diff changeset
20
c31b20a2342e *** empty log message ***
charles <charles>
parents:
diff changeset
21 #include "yaffs_guts.h"
c31b20a2342e *** empty log message ***
charles <charles>
parents:
diff changeset
22 #include "yaffs_ecc.h"
c31b20a2342e *** empty log message ***
charles <charles>
parents:
diff changeset
23
77
794fd064bd36 lindent
marty <marty>
parents: 14
diff changeset
24 typedef struct {
794fd064bd36 lindent
marty <marty>
parents: 14
diff changeset
25 unsigned sequenceNumber;
794fd064bd36 lindent
marty <marty>
parents: 14
diff changeset
26 unsigned objectId;
794fd064bd36 lindent
marty <marty>
parents: 14
diff changeset
27 unsigned chunkId;
794fd064bd36 lindent
marty <marty>
parents: 14
diff changeset
28 unsigned byteCount;
6
c31b20a2342e *** empty log message ***
charles <charles>
parents:
diff changeset
29 } yaffs_PackedTags2TagsPart;
c31b20a2342e *** empty log message ***
charles <charles>
parents:
diff changeset
30
77
794fd064bd36 lindent
marty <marty>
parents: 14
diff changeset
31 typedef struct {
794fd064bd36 lindent
marty <marty>
parents: 14
diff changeset
32 yaffs_PackedTags2TagsPart t;
794fd064bd36 lindent
marty <marty>
parents: 14
diff changeset
33 yaffs_ECCOther ecc;
6
c31b20a2342e *** empty log message ***
charles <charles>
parents:
diff changeset
34 } yaffs_PackedTags2;
c31b20a2342e *** empty log message ***
charles <charles>
parents:
diff changeset
35
204
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
36 /* Full packed tags with ECC, used for oob tags */
343
1d1b453d8b57 Change parameters to packing/unpacking to fix mkyaffs2image compilation issue
charles <charles>
parents: 300
diff changeset
37 void yaffs_PackTags2(yaffs_PackedTags2 *pt, const yaffs_ExtendedTags *t, int tagsECC);
1d1b453d8b57 Change parameters to packing/unpacking to fix mkyaffs2image compilation issue
charles <charles>
parents: 300
diff changeset
38 void yaffs_UnpackTags2(yaffs_ExtendedTags *t, yaffs_PackedTags2 *pt, int tagsECC);
204
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
39
0f70320a2274 Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents: 198
diff changeset
40 /* Only the tags part (no ECC for use with inband tags */
271
c0dfae9e8073 Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents: 204
diff changeset
41 void yaffs_PackTags2TagsPart(yaffs_PackedTags2TagsPart *pt, const yaffs_ExtendedTags *t);
c0dfae9e8073 Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents: 204
diff changeset
42 void yaffs_UnpackTags2TagsPart(yaffs_ExtendedTags *t, yaffs_PackedTags2TagsPart *pt);
6
c31b20a2342e *** empty log message ***
charles <charles>
parents:
diff changeset
43 #endif