diff options
Diffstat (limited to 'fs/ubifs/gc.c')
-rw-r--r-- | fs/ubifs/gc.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c index 9832f9abe28e..a711d33b3d3e 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> |
@@ -381,7 +401,7 @@ int ubifs_garbage_collect_leb(struct ubifs_info *c, struct ubifs_lprops *lp) | |||
381 | 401 | ||
382 | /* | 402 | /* |
383 | * Don't release the LEB until after the next commit, because | 403 | * Don't release the LEB until after the next commit, because |
384 | * it may contain date which is needed for recovery. So | 404 | * it may contain data which is needed for recovery. So |
385 | * although we freed this LEB, it will become usable only after | 405 | * although we freed this LEB, it will become usable only after |
386 | * the commit. | 406 | * the commit. |
387 | */ | 407 | */ |
@@ -810,8 +830,9 @@ out: | |||
810 | * ubifs_destroy_idx_gc - destroy idx_gc list. | 830 | * ubifs_destroy_idx_gc - destroy idx_gc list. |
811 | * @c: UBIFS file-system description object | 831 | * @c: UBIFS file-system description object |
812 | * | 832 | * |
813 | * This function destroys the idx_gc list. It is called when unmounting or | 833 | * This function destroys the @c->idx_gc list. It is called when unmounting |
814 | * remounting read-only so locks are not needed. | 834 | * so locks are not needed. Returns zero in case of success and a negative |
835 | * error code in case of failure. | ||
815 | */ | 836 | */ |
816 | void ubifs_destroy_idx_gc(struct ubifs_info *c) | 837 | void ubifs_destroy_idx_gc(struct ubifs_info *c) |
817 | { | 838 | { |
@@ -824,7 +845,6 @@ void ubifs_destroy_idx_gc(struct ubifs_info *c) | |||
824 | list_del(&idx_gc->list); | 845 | list_del(&idx_gc->list); |
825 | kfree(idx_gc); | 846 | kfree(idx_gc); |
826 | } | 847 | } |
827 | |||
828 | } | 848 | } |
829 | 849 | ||
830 | /** | 850 | /** |