wl.c (3d7a96f5a485b7d06c2379f343d7312af89ec9e2) | wl.c (025dfdafe77f20b3890981a394774baab7b9c827) |
---|---|
1/* 2 * Copyright (c) International Business Machines Corp., 2006 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * --- 114 unchanged lines hidden (view full) --- 123/* 124 * When a physical eraseblock is moved, the WL sub-system has to pick the target 125 * physical eraseblock to move to. The simplest way would be just to pick the 126 * one with the highest erase counter. But in certain workloads this could lead 127 * to an unlimited wear of one or few physical eraseblock. Indeed, imagine a 128 * situation when the picked physical eraseblock is constantly erased after the 129 * data is written to it. So, we have a constant which limits the highest erase 130 * counter of the free physical eraseblock to pick. Namely, the WL sub-system | 1/* 2 * Copyright (c) International Business Machines Corp., 2006 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * --- 114 unchanged lines hidden (view full) --- 123/* 124 * When a physical eraseblock is moved, the WL sub-system has to pick the target 125 * physical eraseblock to move to. The simplest way would be just to pick the 126 * one with the highest erase counter. But in certain workloads this could lead 127 * to an unlimited wear of one or few physical eraseblock. Indeed, imagine a 128 * situation when the picked physical eraseblock is constantly erased after the 129 * data is written to it. So, we have a constant which limits the highest erase 130 * counter of the free physical eraseblock to pick. Namely, the WL sub-system |
131 * does not pick eraseblocks with erase counter greater then the lowest erase | 131 * does not pick eraseblocks with erase counter greater than the lowest erase |
132 * counter plus %WL_FREE_MAX_DIFF. 133 */ 134#define WL_FREE_MAX_DIFF (2*UBI_WL_THRESHOLD) 135 136/* 137 * Maximum number of consecutive background thread failures which is enough to 138 * switch to read-only mode. 139 */ --- 772 unchanged lines hidden (view full) --- 912 if (!ubi->scrub.rb_node) { 913 if (!ubi->used.rb_node || !ubi->free.rb_node) 914 /* No physical eraseblocks - no deal */ 915 goto out_unlock; 916 917 /* 918 * We schedule wear-leveling only if the difference between the 919 * lowest erase counter of used physical eraseblocks and a high | 132 * counter plus %WL_FREE_MAX_DIFF. 133 */ 134#define WL_FREE_MAX_DIFF (2*UBI_WL_THRESHOLD) 135 136/* 137 * Maximum number of consecutive background thread failures which is enough to 138 * switch to read-only mode. 139 */ --- 772 unchanged lines hidden (view full) --- 912 if (!ubi->scrub.rb_node) { 913 if (!ubi->used.rb_node || !ubi->free.rb_node) 914 /* No physical eraseblocks - no deal */ 915 goto out_unlock; 916 917 /* 918 * We schedule wear-leveling only if the difference between the 919 * lowest erase counter of used physical eraseblocks and a high |
920 * erase counter of free physical eraseblocks is greater then | 920 * erase counter of free physical eraseblocks is greater than |
921 * %UBI_WL_THRESHOLD. 922 */ 923 e1 = rb_entry(rb_first(&ubi->used), struct ubi_wl_entry, u.rb); 924 e2 = find_wl_entry(&ubi->free, WL_FREE_MAX_DIFF); 925 926 if (!(e2->ec - e1->ec >= UBI_WL_THRESHOLD)) 927 goto out_unlock; 928 dbg_wl("schedule wear-leveling"); --- 677 unchanged lines hidden --- | 921 * %UBI_WL_THRESHOLD. 922 */ 923 e1 = rb_entry(rb_first(&ubi->used), struct ubi_wl_entry, u.rb); 924 e2 = find_wl_entry(&ubi->free, WL_FREE_MAX_DIFF); 925 926 if (!(e2->ec - e1->ec >= UBI_WL_THRESHOLD)) 927 goto out_unlock; 928 dbg_wl("schedule wear-leveling"); --- 677 unchanged lines hidden --- |