diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2009-01-19 12:57:27 -0500 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2009-01-20 03:10:47 -0500 |
commit | 7078202e55b565582fcbd831a8dd3069bdc72610 (patch) | |
tree | 0f8cabaa23a05210cc1b95a97d7cab490f38ebca /fs/ubifs | |
parent | a50412e3f8ce95d7ed558370d7dde5171fd04283 (diff) |
UBIFS: document dark_wm and dead_wm better
Just add more commentaries. Also some commentary fixes for
lprops flags.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs')
-rw-r--r-- | fs/ubifs/gc.c | 20 | ||||
-rw-r--r-- | fs/ubifs/super.c | 11 | ||||
-rw-r--r-- | fs/ubifs/ubifs.h | 4 |
3 files changed, 24 insertions, 11 deletions
diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c index 9832f9abe28e..b2e5f1133377 100644 --- a/fs/ubifs/gc.c +++ b/fs/ubifs/gc.c | |||
@@ -31,6 +31,26 @@ | |||
31 | * to be reused. Garbage collection will cause the number of dirty index nodes | 31 | * to be reused. Garbage collection will cause the number of dirty index nodes |
32 | * to grow, however sufficient space is reserved for the index to ensure the | 32 | * to grow, however sufficient space is reserved for the index to ensure the |
33 | * commit will never run out of space. | 33 | * commit will never run out of space. |
34 | * | ||
35 | * Notes about dead watermark. At current UBIFS implementation we assume that | ||
36 | * LEBs which have less than @c->dead_wm bytes of free + dirty space are full | ||
37 | * and not worth garbage-collecting. The dead watermark is one min. I/O unit | ||
38 | * size, or min. UBIFS node size, depending on what is greater. Indeed, UBIFS | ||
39 | * Garbage Collector has to synchronize the GC head's write buffer before | ||
40 | * returning, so this is about wasting one min. I/O unit. However, UBIFS GC can | ||
41 | * actually reclaim even very small pieces of dirty space by garbage collecting | ||
42 | * enough dirty LEBs, but we do not bother doing this at this implementation. | ||
43 | * | ||
44 | * Notes about dark watermark. The results of GC work depends on how big are | ||
45 | * the UBIFS nodes GC deals with. Large nodes make GC waste more space. Indeed, | ||
46 | * if GC move data from LEB A to LEB B and nodes in LEB A are large, GC would | ||
47 | * have to waste large pieces of free space at the end of LEB B, because nodes | ||
48 | * from LEB A would not fit. And the worst situation is when all nodes are of | ||
49 | * maximum size. So dark watermark is the amount of free + dirty space in LEB | ||
50 | * which are guaranteed to be reclaimable. If LEB has less space, the GC migh | ||
51 | * be unable to reclaim it. So, LEBs with free + dirty greater than dark | ||
52 | * watermark are "good" LEBs from GC's point of few. The other LEBs are not so | ||
53 | * good, and GC takes extra care when moving them. | ||
34 | */ | 54 | */ |
35 | 55 | ||
36 | #include <linux/pagemap.h> | 56 | #include <linux/pagemap.h> |
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 53811e567a69..da99da098efd 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
@@ -573,15 +573,8 @@ static int init_constants_early(struct ubifs_info *c) | |||
573 | c->ranges[UBIFS_IDX_NODE].max_len = INT_MAX; | 573 | c->ranges[UBIFS_IDX_NODE].max_len = INT_MAX; |
574 | 574 | ||
575 | /* | 575 | /* |
576 | * Initialize dead and dark LEB space watermarks. | 576 | * Initialize dead and dark LEB space watermarks. See gc.c for comments |
577 | * | 577 | * about these values. |
578 | * Dead space is the space which cannot be used. Its watermark is | ||
579 | * equivalent to min. I/O unit or minimum node size if it is greater | ||
580 | * then min. I/O unit. | ||
581 | * | ||
582 | * Dark space is the space which might be used, or might not, depending | ||
583 | * on which node should be written to the LEB. Its watermark is | ||
584 | * equivalent to maximum UBIFS node size. | ||
585 | */ | 578 | */ |
586 | c->dead_wm = ALIGN(MIN_WRITE_SZ, c->min_io_size); | 579 | c->dead_wm = ALIGN(MIN_WRITE_SZ, c->min_io_size); |
587 | c->dark_wm = ALIGN(UBIFS_MAX_NODE_SZ, c->min_io_size); | 580 | c->dark_wm = ALIGN(UBIFS_MAX_NODE_SZ, c->min_io_size); |
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index 0881897a4208..2e78d6ac007e 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h | |||
@@ -426,9 +426,9 @@ struct ubifs_unclean_leb { | |||
426 | * LEB properties flags. | 426 | * LEB properties flags. |
427 | * | 427 | * |
428 | * LPROPS_UNCAT: not categorized | 428 | * LPROPS_UNCAT: not categorized |
429 | * LPROPS_DIRTY: dirty > 0, not index | 429 | * LPROPS_DIRTY: dirty > free, dirty >= @c->dead_wm, not index |
430 | * LPROPS_DIRTY_IDX: dirty + free > @c->min_idx_node_sze and index | 430 | * LPROPS_DIRTY_IDX: dirty + free > @c->min_idx_node_sze and index |
431 | * LPROPS_FREE: free > 0, not empty, not index | 431 | * LPROPS_FREE: free > 0, dirty < @c->dead_wm, not empty, not index |
432 | * LPROPS_HEAP_CNT: number of heaps used for storing categorized LEBs | 432 | * LPROPS_HEAP_CNT: number of heaps used for storing categorized LEBs |
433 | * LPROPS_EMPTY: LEB is empty, not taken | 433 | * LPROPS_EMPTY: LEB is empty, not taken |
434 | * LPROPS_FREEABLE: free + dirty == leb_size, not index, not taken | 434 | * LPROPS_FREEABLE: free + dirty == leb_size, not index, not taken |