diff options
| -rw-r--r-- | drivers/mtd/ubi/build.c | 2 | ||||
| -rw-r--r-- | drivers/mtd/ubi/debug.h | 6 | ||||
| -rw-r--r-- | drivers/mtd/ubi/eba.c | 22 | ||||
| -rw-r--r-- | drivers/mtd/ubi/io.c | 22 | ||||
| -rw-r--r-- | drivers/mtd/ubi/scan.c | 28 | ||||
| -rw-r--r-- | drivers/mtd/ubi/scan.h | 19 | ||||
| -rw-r--r-- | drivers/mtd/ubi/ubi-media.h | 23 | ||||
| -rw-r--r-- | drivers/mtd/ubi/ubi.h | 37 | ||||
| -rw-r--r-- | drivers/mtd/ubi/wl.c | 94 | ||||
| -rw-r--r-- | include/linux/mtd/ubi.h | 4 |
10 files changed, 129 insertions, 128 deletions
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index a5b19944eca8..27271fe32e02 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c | |||
| @@ -524,7 +524,7 @@ out_si: | |||
| 524 | } | 524 | } |
| 525 | 525 | ||
| 526 | /** | 526 | /** |
| 527 | * io_init - initialize I/O unit for a given UBI device. | 527 | * io_init - initialize I/O sub-system for a given UBI device. |
| 528 | * @ubi: UBI device description object | 528 | * @ubi: UBI device description object |
| 529 | * | 529 | * |
| 530 | * If @ubi->vid_hdr_offset or @ubi->leb_start is zero, default offsets are | 530 | * If @ubi->vid_hdr_offset or @ubi->leb_start is zero, default offsets are |
diff --git a/drivers/mtd/ubi/debug.h b/drivers/mtd/ubi/debug.h index 8ea99d8c9e1f..7d8d77c31dfe 100644 --- a/drivers/mtd/ubi/debug.h +++ b/drivers/mtd/ubi/debug.h | |||
| @@ -76,21 +76,21 @@ void ubi_dbg_dump_mkvol_req(const struct ubi_mkvol_req *req); | |||
| 76 | #endif /* CONFIG_MTD_UBI_DEBUG_MSG */ | 76 | #endif /* CONFIG_MTD_UBI_DEBUG_MSG */ |
| 77 | 77 | ||
| 78 | #ifdef CONFIG_MTD_UBI_DEBUG_MSG_EBA | 78 | #ifdef CONFIG_MTD_UBI_DEBUG_MSG_EBA |
| 79 | /* Messages from the eraseblock association unit */ | 79 | /* Messages from the eraseblock association sub-system */ |
| 80 | #define dbg_eba(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) | 80 | #define dbg_eba(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) |
| 81 | #else | 81 | #else |
| 82 | #define dbg_eba(fmt, ...) ({}) | 82 | #define dbg_eba(fmt, ...) ({}) |
| 83 | #endif | 83 | #endif |
| 84 | 84 | ||
| 85 | #ifdef CONFIG_MTD_UBI_DEBUG_MSG_WL | 85 | #ifdef CONFIG_MTD_UBI_DEBUG_MSG_WL |
| 86 | /* Messages from the wear-leveling unit */ | 86 | /* Messages from the wear-leveling sub-system */ |
| 87 | #define dbg_wl(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) | 87 | #define dbg_wl(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) |
| 88 | #else | 88 | #else |
| 89 | #define dbg_wl(fmt, ...) ({}) | 89 | #define dbg_wl(fmt, ...) ({}) |
| 90 | #endif | 90 | #endif |
| 91 | 91 | ||
| 92 | #ifdef CONFIG_MTD_UBI_DEBUG_MSG_IO | 92 | #ifdef CONFIG_MTD_UBI_DEBUG_MSG_IO |
| 93 | /* Messages from the input/output unit */ | 93 | /* Messages from the input/output sub-system */ |
| 94 | #define dbg_io(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) | 94 | #define dbg_io(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) |
| 95 | #else | 95 | #else |
| 96 | #define dbg_io(fmt, ...) ({}) | 96 | #define dbg_io(fmt, ...) ({}) |
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c index 8dc488fc0cdf..613cd1e51648 100644 --- a/drivers/mtd/ubi/eba.c +++ b/drivers/mtd/ubi/eba.c | |||
| @@ -19,20 +19,20 @@ | |||
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | /* | 21 | /* |
| 22 | * The UBI Eraseblock Association (EBA) unit. | 22 | * The UBI Eraseblock Association (EBA) sub-system. |
| 23 | * | 23 | * |
| 24 | * This unit is responsible for I/O to/from logical eraseblock. | 24 | * This sub-system is responsible for I/O to/from logical eraseblock. |
| 25 | * | 25 | * |
| 26 | * Although in this implementation the EBA table is fully kept and managed in | 26 | * Although in this implementation the EBA table is fully kept and managed in |
| 27 | * RAM, which assumes poor scalability, it might be (partially) maintained on | 27 | * RAM, which assumes poor scalability, it might be (partially) maintained on |
| 28 | * flash in future implementations. | 28 | * flash in future implementations. |
| 29 | * | 29 | * |
| 30 | * The EBA unit implements per-logical eraseblock locking. Before accessing a | 30 | * The EBA sub-system implements per-logical eraseblock locking. Before |
| 31 | * logical eraseblock it is locked for reading or writing. The per-logical | 31 | * accessing a logical eraseblock it is locked for reading or writing. The |
| 32 | * eraseblock locking is implemented by means of the lock tree. The lock tree | 32 | * per-logical eraseblock locking is implemented by means of the lock tree. The |
| 33 | * is an RB-tree which refers all the currently locked logical eraseblocks. The | 33 | * lock tree is an RB-tree which refers all the currently locked logical |
| 34 | * lock tree elements are &struct ubi_ltree_entry objects. They are indexed by | 34 | * eraseblocks. The lock tree elements are &struct ubi_ltree_entry objects. |
| 35 | * (@vol_id, @lnum) pairs. | 35 | * They are indexed by (@vol_id, @lnum) pairs. |
| 36 | * | 36 | * |
| 37 | * EBA also maintains the global sequence counter which is incremented each | 37 | * EBA also maintains the global sequence counter which is incremented each |
| 38 | * time a logical eraseblock is mapped to a physical eraseblock and it is | 38 | * time a logical eraseblock is mapped to a physical eraseblock and it is |
| @@ -1128,7 +1128,7 @@ out_unlock_leb: | |||
| 1128 | } | 1128 | } |
| 1129 | 1129 | ||
| 1130 | /** | 1130 | /** |
| 1131 | * ubi_eba_init_scan - initialize the EBA unit using scanning information. | 1131 | * ubi_eba_init_scan - initialize the EBA sub-system using scanning information. |
| 1132 | * @ubi: UBI device description object | 1132 | * @ubi: UBI device description object |
| 1133 | * @si: scanning information | 1133 | * @si: scanning information |
| 1134 | * | 1134 | * |
| @@ -1143,7 +1143,7 @@ int ubi_eba_init_scan(struct ubi_device *ubi, struct ubi_scan_info *si) | |||
| 1143 | struct ubi_scan_leb *seb; | 1143 | struct ubi_scan_leb *seb; |
| 1144 | struct rb_node *rb; | 1144 | struct rb_node *rb; |
| 1145 | 1145 | ||
| 1146 | dbg_eba("initialize EBA unit"); | 1146 | dbg_eba("initialize EBA sub-system"); |
| 1147 | 1147 | ||
| 1148 | spin_lock_init(&ubi->ltree_lock); | 1148 | spin_lock_init(&ubi->ltree_lock); |
| 1149 | mutex_init(&ubi->alc_mutex); | 1149 | mutex_init(&ubi->alc_mutex); |
| @@ -1209,7 +1209,7 @@ int ubi_eba_init_scan(struct ubi_device *ubi, struct ubi_scan_info *si) | |||
| 1209 | ubi->rsvd_pebs += ubi->beb_rsvd_pebs; | 1209 | ubi->rsvd_pebs += ubi->beb_rsvd_pebs; |
| 1210 | } | 1210 | } |
| 1211 | 1211 | ||
| 1212 | dbg_eba("EBA unit is initialized"); | 1212 | dbg_eba("EBA sub-system is initialized"); |
| 1213 | return 0; | 1213 | return 0; |
| 1214 | 1214 | ||
| 1215 | out_free: | 1215 | out_free: |
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c index 4ac11df7b048..561e7b2f96cb 100644 --- a/drivers/mtd/ubi/io.c +++ b/drivers/mtd/ubi/io.c | |||
| @@ -20,15 +20,15 @@ | |||
| 20 | */ | 20 | */ |
| 21 | 21 | ||
| 22 | /* | 22 | /* |
| 23 | * UBI input/output unit. | 23 | * UBI input/output sub-system. |
| 24 | * | 24 | * |
| 25 | * This unit provides a uniform way to work with all kinds of the underlying | 25 | * This sub-system provides a uniform way to work with all kinds of the |
| 26 | * MTD devices. It also implements handy functions for reading and writing UBI | 26 | * underlying MTD devices. It also implements handy functions for reading and |
| 27 | * headers. | 27 | * writing UBI headers. |
| 28 | * | 28 | * |
| 29 | * We are trying to have a paranoid mindset and not to trust to what we read | 29 | * We are trying to have a paranoid mindset and not to trust to what we read |
| 30 | * from the flash media in order to be more secure and robust. So this unit | 30 | * from the flash media in order to be more secure and robust. So this |
| 31 | * validates every single header it reads from the flash media. | 31 | * sub-system validates every single header it reads from the flash media. |
| 32 | * | 32 | * |
| 33 | * Some words about how the eraseblock headers are stored. | 33 | * Some words about how the eraseblock headers are stored. |
| 34 | * | 34 | * |
| @@ -79,11 +79,11 @@ | |||
| 79 | * 512-byte chunks, we have to allocate one more buffer and copy our VID header | 79 | * 512-byte chunks, we have to allocate one more buffer and copy our VID header |
| 80 | * to offset 448 of this buffer. | 80 | * to offset 448 of this buffer. |
| 81 | * | 81 | * |
| 82 | * The I/O unit does the following trick in order to avoid this extra copy. | 82 | * The I/O sub-system does the following trick in order to avoid this extra |
| 83 | * It always allocates a @ubi->vid_hdr_alsize bytes buffer for the VID header | 83 | * copy. It always allocates a @ubi->vid_hdr_alsize bytes buffer for the VID |
| 84 | * and returns a pointer to offset @ubi->vid_hdr_shift of this buffer. When the | 84 | * header and returns a pointer to offset @ubi->vid_hdr_shift of this buffer. |
| 85 | * VID header is being written out, it shifts the VID header pointer back and | 85 | * When the VID header is being written out, it shifts the VID header pointer |
| 86 | * writes the whole sub-page. | 86 | * back and writes the whole sub-page. |
| 87 | */ | 87 | */ |
| 88 | 88 | ||
| 89 | #include <linux/crc32.h> | 89 | #include <linux/crc32.h> |
diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c index 96d410e106ab..892c2ba49777 100644 --- a/drivers/mtd/ubi/scan.c +++ b/drivers/mtd/ubi/scan.c | |||
| @@ -19,9 +19,9 @@ | |||
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | /* | 21 | /* |
| 22 | * UBI scanning unit. | 22 | * UBI scanning sub-system. |
| 23 | * | 23 | * |
| 24 | * This unit is responsible for scanning the flash media, checking UBI | 24 | * This sub-system is responsible for scanning the flash media, checking UBI |
| 25 | * headers and providing complete information about the UBI flash image. | 25 | * headers and providing complete information about the UBI flash image. |
| 26 | * | 26 | * |
| 27 | * The scanning information is represented by a &struct ubi_scan_info' object. | 27 | * The scanning information is represented by a &struct ubi_scan_info' object. |
| @@ -103,7 +103,7 @@ static int add_to_list(struct ubi_scan_info *si, int pnum, int ec, | |||
| 103 | * non-zero if an inconsistency was found and zero if not. | 103 | * non-zero if an inconsistency was found and zero if not. |
| 104 | * | 104 | * |
| 105 | * Note, UBI does sanity check of everything it reads from the flash media. | 105 | * Note, UBI does sanity check of everything it reads from the flash media. |
| 106 | * Most of the checks are done in the I/O unit. Here we check that the | 106 | * Most of the checks are done in the I/O sub-system. Here we check that the |
| 107 | * information in the VID header is consistent to the information in other VID | 107 | * information in the VID header is consistent to the information in other VID |
| 108 | * headers of the same volume. | 108 | * headers of the same volume. |
| 109 | */ | 109 | */ |
| @@ -256,8 +256,8 @@ static int compare_lebs(struct ubi_device *ubi, const struct ubi_scan_leb *seb, | |||
| 256 | * that versions that are close to %0xFFFFFFFF are less then | 256 | * that versions that are close to %0xFFFFFFFF are less then |
| 257 | * versions that are close to %0. | 257 | * versions that are close to %0. |
| 258 | * | 258 | * |
| 259 | * The UBI WL unit guarantees that the number of pending tasks | 259 | * The UBI WL sub-system guarantees that the number of pending |
| 260 | * is not greater then %0x7FFFFFFF. So, if the difference | 260 | * tasks is not greater then %0x7FFFFFFF. So, if the difference |
| 261 | * between any two versions is greater or equivalent to | 261 | * between any two versions is greater or equivalent to |
| 262 | * %0x7FFFFFFF, there was an overflow and the logical | 262 | * %0x7FFFFFFF, there was an overflow and the logical |
| 263 | * eraseblock with lower version is actually newer then the one | 263 | * eraseblock with lower version is actually newer then the one |
| @@ -645,9 +645,9 @@ void ubi_scan_rm_volume(struct ubi_scan_info *si, struct ubi_scan_volume *sv) | |||
| 645 | * | 645 | * |
| 646 | * This function erases physical eraseblock 'pnum', and writes the erase | 646 | * This function erases physical eraseblock 'pnum', and writes the erase |
| 647 | * counter header to it. This function should only be used on UBI device | 647 | * counter header to it. This function should only be used on UBI device |
| 648 | * initialization stages, when the EBA unit had not been yet initialized. This | 648 | * initialization stages, when the EBA sub-system had not been yet initialized. |
| 649 | * function returns zero in case of success and a negative error code in case | 649 | * This function returns zero in case of success and a negative error code in |
| 650 | * of failure. | 650 | * case of failure. |
| 651 | */ | 651 | */ |
| 652 | int ubi_scan_erase_peb(struct ubi_device *ubi, const struct ubi_scan_info *si, | 652 | int ubi_scan_erase_peb(struct ubi_device *ubi, const struct ubi_scan_info *si, |
| 653 | int pnum, int ec) | 653 | int pnum, int ec) |
| @@ -687,9 +687,10 @@ out_free: | |||
| 687 | * @si: scanning information | 687 | * @si: scanning information |
| 688 | * | 688 | * |
| 689 | * This function returns a free physical eraseblock. It is supposed to be | 689 | * This function returns a free physical eraseblock. It is supposed to be |
| 690 | * called on the UBI initialization stages when the wear-leveling unit is not | 690 | * called on the UBI initialization stages when the wear-leveling sub-system is |
| 691 | * initialized yet. This function picks a physical eraseblocks from one of the | 691 | * not initialized yet. This function picks a physical eraseblocks from one of |
| 692 | * lists, writes the EC header if it is needed, and removes it from the list. | 692 | * the lists, writes the EC header if it is needed, and removes it from the |
| 693 | * list. | ||
| 693 | * | 694 | * |
| 694 | * This function returns scanning physical eraseblock information in case of | 695 | * This function returns scanning physical eraseblock information in case of |
| 695 | * success and an error code in case of failure. | 696 | * success and an error code in case of failure. |
| @@ -764,8 +765,9 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si, int pnum | |||
| 764 | return err; | 765 | return err; |
| 765 | else if (err) { | 766 | else if (err) { |
| 766 | /* | 767 | /* |
| 767 | * FIXME: this is actually duty of the I/O unit to initialize | 768 | * FIXME: this is actually duty of the I/O sub-system to |
| 768 | * this, but MTD does not provide enough information. | 769 | * initialize this, but MTD does not provide enough |
| 770 | * information. | ||
| 769 | */ | 771 | */ |
| 770 | si->bad_peb_count += 1; | 772 | si->bad_peb_count += 1; |
| 771 | return 0; | 773 | return 0; |
diff --git a/drivers/mtd/ubi/scan.h b/drivers/mtd/ubi/scan.h index 966b9b682a42..4e2e3cc0becd 100644 --- a/drivers/mtd/ubi/scan.h +++ b/drivers/mtd/ubi/scan.h | |||
| @@ -59,16 +59,16 @@ struct ubi_scan_leb { | |||
| 59 | * @leb_count: number of logical eraseblocks in this volume | 59 | * @leb_count: number of logical eraseblocks in this volume |
| 60 | * @vol_type: volume type | 60 | * @vol_type: volume type |
| 61 | * @used_ebs: number of used logical eraseblocks in this volume (only for | 61 | * @used_ebs: number of used logical eraseblocks in this volume (only for |
| 62 | * static volumes) | 62 | * static volumes) |
| 63 | * @last_data_size: amount of data in the last logical eraseblock of this | 63 | * @last_data_size: amount of data in the last logical eraseblock of this |
| 64 | * volume (always equivalent to the usable logical eraseblock size in case of | 64 | * volume (always equivalent to the usable logical eraseblock |
| 65 | * dynamic volumes) | 65 | * size in case of dynamic volumes) |
| 66 | * @data_pad: how many bytes at the end of logical eraseblocks of this volume | 66 | * @data_pad: how many bytes at the end of logical eraseblocks of this volume |
| 67 | * are not used (due to volume alignment) | 67 | * are not used (due to volume alignment) |
| 68 | * @compat: compatibility flags of this volume | 68 | * @compat: compatibility flags of this volume |
| 69 | * @rb: link in the volume RB-tree | 69 | * @rb: link in the volume RB-tree |
| 70 | * @root: root of the RB-tree containing all the eraseblock belonging to this | 70 | * @root: root of the RB-tree containing all the eraseblock belonging to this |
| 71 | * volume (&struct ubi_scan_leb objects) | 71 | * volume (&struct ubi_scan_leb objects) |
| 72 | * | 72 | * |
| 73 | * One object of this type is allocated for each volume during scanning. | 73 | * One object of this type is allocated for each volume during scanning. |
| 74 | */ | 74 | */ |
| @@ -92,8 +92,8 @@ struct ubi_scan_volume { | |||
| 92 | * @free: list of free physical eraseblocks | 92 | * @free: list of free physical eraseblocks |
| 93 | * @erase: list of physical eraseblocks which have to be erased | 93 | * @erase: list of physical eraseblocks which have to be erased |
| 94 | * @alien: list of physical eraseblocks which should not be used by UBI (e.g., | 94 | * @alien: list of physical eraseblocks which should not be used by UBI (e.g., |
| 95 | * those belonging to "preserve"-compatible internal volumes) | ||
| 95 | * @bad_peb_count: count of bad physical eraseblocks | 96 | * @bad_peb_count: count of bad physical eraseblocks |
| 96 | * those belonging to "preserve"-compatible internal volumes) | ||
| 97 | * @vols_found: number of volumes found during scanning | 97 | * @vols_found: number of volumes found during scanning |
| 98 | * @highest_vol_id: highest volume ID | 98 | * @highest_vol_id: highest volume ID |
| 99 | * @alien_peb_count: count of physical eraseblocks in the @alien list | 99 | * @alien_peb_count: count of physical eraseblocks in the @alien list |
| @@ -106,8 +106,8 @@ struct ubi_scan_volume { | |||
| 106 | * @ec_count: a temporary variable used when calculating @mean_ec | 106 | * @ec_count: a temporary variable used when calculating @mean_ec |
| 107 | * | 107 | * |
| 108 | * This data structure contains the result of scanning and may be used by other | 108 | * This data structure contains the result of scanning and may be used by other |
| 109 | * UBI units to build final UBI data structures, further error-recovery and so | 109 | * UBI sub-systems to build final UBI data structures, further error-recovery |
| 110 | * on. | 110 | * and so on. |
| 111 | */ | 111 | */ |
| 112 | struct ubi_scan_info { | 112 | struct ubi_scan_info { |
| 113 | struct rb_root volumes; | 113 | struct rb_root volumes; |
| @@ -132,8 +132,7 @@ struct ubi_device; | |||
| 132 | struct ubi_vid_hdr; | 132 | struct ubi_vid_hdr; |
| 133 | 133 | ||
| 134 | /* | 134 | /* |
| 135 | * ubi_scan_move_to_list - move a physical eraseblock from the volume tree to a | 135 | * ubi_scan_move_to_list - move a PEB from the volume tree to a list. |
| 136 | * list. | ||
| 137 | * | 136 | * |
| 138 | * @sv: volume scanning information | 137 | * @sv: volume scanning information |
| 139 | * @seb: scanning eraseblock infprmation | 138 | * @seb: scanning eraseblock infprmation |
diff --git a/drivers/mtd/ubi/ubi-media.h b/drivers/mtd/ubi/ubi-media.h index c3185d9fd048..26bb7af9787a 100644 --- a/drivers/mtd/ubi/ubi-media.h +++ b/drivers/mtd/ubi/ubi-media.h | |||
| @@ -98,10 +98,11 @@ enum { | |||
| 98 | * Compatibility constants used by internal volumes. | 98 | * Compatibility constants used by internal volumes. |
| 99 | * | 99 | * |
| 100 | * @UBI_COMPAT_DELETE: delete this internal volume before anything is written | 100 | * @UBI_COMPAT_DELETE: delete this internal volume before anything is written |
| 101 | * to the flash | 101 | * to the flash |
| 102 | * @UBI_COMPAT_RO: attach this device in read-only mode | 102 | * @UBI_COMPAT_RO: attach this device in read-only mode |
| 103 | * @UBI_COMPAT_PRESERVE: preserve this internal volume - do not touch its | 103 | * @UBI_COMPAT_PRESERVE: preserve this internal volume - do not touch its |
| 104 | * physical eraseblocks, don't allow the wear-leveling unit to move them | 104 | * physical eraseblocks, don't allow the wear-leveling |
| 105 | * sub-system to move them | ||
| 105 | * @UBI_COMPAT_REJECT: reject this UBI image | 106 | * @UBI_COMPAT_REJECT: reject this UBI image |
| 106 | */ | 107 | */ |
| 107 | enum { | 108 | enum { |
| @@ -123,7 +124,7 @@ enum { | |||
| 123 | * struct ubi_ec_hdr - UBI erase counter header. | 124 | * struct ubi_ec_hdr - UBI erase counter header. |
| 124 | * @magic: erase counter header magic number (%UBI_EC_HDR_MAGIC) | 125 | * @magic: erase counter header magic number (%UBI_EC_HDR_MAGIC) |
| 125 | * @version: version of UBI implementation which is supposed to accept this | 126 | * @version: version of UBI implementation which is supposed to accept this |
| 126 | * UBI image | 127 | * UBI image |
| 127 | * @padding1: reserved for future, zeroes | 128 | * @padding1: reserved for future, zeroes |
| 128 | * @ec: the erase counter | 129 | * @ec: the erase counter |
| 129 | * @vid_hdr_offset: where the VID header starts | 130 | * @vid_hdr_offset: where the VID header starts |
| @@ -159,20 +160,20 @@ struct ubi_ec_hdr { | |||
| 159 | * struct ubi_vid_hdr - on-flash UBI volume identifier header. | 160 | * struct ubi_vid_hdr - on-flash UBI volume identifier header. |
| 160 | * @magic: volume identifier header magic number (%UBI_VID_HDR_MAGIC) | 161 | * @magic: volume identifier header magic number (%UBI_VID_HDR_MAGIC) |
| 161 | * @version: UBI implementation version which is supposed to accept this UBI | 162 | * @version: UBI implementation version which is supposed to accept this UBI |
| 162 | * image (%UBI_VERSION) | 163 | * image (%UBI_VERSION) |
| 163 | * @vol_type: volume type (%UBI_VID_DYNAMIC or %UBI_VID_STATIC) | 164 | * @vol_type: volume type (%UBI_VID_DYNAMIC or %UBI_VID_STATIC) |
| 164 | * @copy_flag: if this logical eraseblock was copied from another physical | 165 | * @copy_flag: if this logical eraseblock was copied from another physical |
| 165 | * eraseblock (for wear-leveling reasons) | 166 | * eraseblock (for wear-leveling reasons) |
| 166 | * @compat: compatibility of this volume (%0, %UBI_COMPAT_DELETE, | 167 | * @compat: compatibility of this volume (%0, %UBI_COMPAT_DELETE, |
| 167 | * %UBI_COMPAT_IGNORE, %UBI_COMPAT_PRESERVE, or %UBI_COMPAT_REJECT) | 168 | * %UBI_COMPAT_IGNORE, %UBI_COMPAT_PRESERVE, or %UBI_COMPAT_REJECT) |
| 168 | * @vol_id: ID of this volume | 169 | * @vol_id: ID of this volume |
| 169 | * @lnum: logical eraseblock number | 170 | * @lnum: logical eraseblock number |
| 170 | * @leb_ver: version of this logical eraseblock (IMPORTANT: obsolete, to be | 171 | * @leb_ver: version of this logical eraseblock (IMPORTANT: obsolete, to be |
| 171 | * removed, kept only for not breaking older UBI users) | 172 | * removed, kept only for not breaking older UBI users) |
| 172 | * @data_size: how many bytes of data this logical eraseblock contains | 173 | * @data_size: how many bytes of data this logical eraseblock contains |
| 173 | * @used_ebs: total number of used logical eraseblocks in this volume | 174 | * @used_ebs: total number of used logical eraseblocks in this volume |
| 174 | * @data_pad: how many bytes at the end of this physical eraseblock are not | 175 | * @data_pad: how many bytes at the end of this physical eraseblock are not |
| 175 | * used | 176 | * used |
| 176 | * @data_crc: CRC checksum of the data stored in this logical eraseblock | 177 | * @data_crc: CRC checksum of the data stored in this logical eraseblock |
| 177 | * @padding1: reserved for future, zeroes | 178 | * @padding1: reserved for future, zeroes |
| 178 | * @sqnum: sequence number | 179 | * @sqnum: sequence number |
| @@ -248,9 +249,9 @@ struct ubi_ec_hdr { | |||
| 248 | * The @data_crc field contains the CRC checksum of the contents of the logical | 249 | * The @data_crc field contains the CRC checksum of the contents of the logical |
| 249 | * eraseblock if this is a static volume. In case of dynamic volumes, it does | 250 | * eraseblock if this is a static volume. In case of dynamic volumes, it does |
| 250 | * not contain the CRC checksum as a rule. The only exception is when the | 251 | * not contain the CRC checksum as a rule. The only exception is when the |
| 251 | * data of the physical eraseblock was moved by the wear-leveling unit, then | 252 | * data of the physical eraseblock was moved by the wear-leveling sub-system, |
| 252 | * the wear-leveling unit calculates the data CRC and stores it in the | 253 | * then the wear-leveling sub-system calculates the data CRC and stores it in |
| 253 | * @data_crc field. And of course, the @copy_flag is %in this case. | 254 | * the @data_crc field. And of course, the @copy_flag is %in this case. |
| 254 | * | 255 | * |
| 255 | * The @data_size field is used only for static volumes because UBI has to know | 256 | * The @data_size field is used only for static volumes because UBI has to know |
| 256 | * how many bytes of data are stored in this eraseblock. For dynamic volumes, | 257 | * how many bytes of data are stored in this eraseblock. For dynamic volumes, |
diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h index 940f6b7deec3..1fc32c863b78 100644 --- a/drivers/mtd/ubi/ubi.h +++ b/drivers/mtd/ubi/ubi.h | |||
| @@ -74,15 +74,15 @@ | |||
| 74 | #define UBI_IO_RETRIES 3 | 74 | #define UBI_IO_RETRIES 3 |
| 75 | 75 | ||
| 76 | /* | 76 | /* |
| 77 | * Error codes returned by the I/O unit. | 77 | * Error codes returned by the I/O sub-system. |
| 78 | * | 78 | * |
| 79 | * UBI_IO_PEB_EMPTY: the physical eraseblock is empty, i.e. it contains only | 79 | * UBI_IO_PEB_EMPTY: the physical eraseblock is empty, i.e. it contains only |
| 80 | * 0xFF bytes | 80 | * %0xFF bytes |
| 81 | * UBI_IO_PEB_FREE: the physical eraseblock is free, i.e. it contains only a | 81 | * UBI_IO_PEB_FREE: the physical eraseblock is free, i.e. it contains only a |
| 82 | * valid erase counter header, and the rest are %0xFF bytes | 82 | * valid erase counter header, and the rest are %0xFF bytes |
| 83 | * UBI_IO_BAD_EC_HDR: the erase counter header is corrupted (bad magic or CRC) | 83 | * UBI_IO_BAD_EC_HDR: the erase counter header is corrupted (bad magic or CRC) |
| 84 | * UBI_IO_BAD_VID_HDR: the volume identifier header is corrupted (bad magic or | 84 | * UBI_IO_BAD_VID_HDR: the volume identifier header is corrupted (bad magic or |
| 85 | * CRC) | 85 | * CRC) |
| 86 | * UBI_IO_BITFLIPS: bit-flips were detected and corrected | 86 | * UBI_IO_BITFLIPS: bit-flips were detected and corrected |
| 87 | */ | 87 | */ |
| 88 | enum { | 88 | enum { |
| @@ -99,9 +99,9 @@ enum { | |||
| 99 | * @ec: erase counter | 99 | * @ec: erase counter |
| 100 | * @pnum: physical eraseblock number | 100 | * @pnum: physical eraseblock number |
| 101 | * | 101 | * |
| 102 | * This data structure is used in the WL unit. Each physical eraseblock has a | 102 | * This data structure is used in the WL sub-system. Each physical eraseblock |
| 103 | * corresponding &struct wl_entry object which may be kept in different | 103 | * has a corresponding &struct wl_entry object which may be kept in different |
| 104 | * RB-trees. See WL unit for details. | 104 | * RB-trees. See WL sub-system for details. |
| 105 | */ | 105 | */ |
| 106 | struct ubi_wl_entry { | 106 | struct ubi_wl_entry { |
| 107 | struct rb_node rb; | 107 | struct rb_node rb; |
| @@ -118,10 +118,10 @@ struct ubi_wl_entry { | |||
| 118 | * @mutex: read/write mutex to implement read/write access serialization to | 118 | * @mutex: read/write mutex to implement read/write access serialization to |
| 119 | * the (@vol_id, @lnum) logical eraseblock | 119 | * the (@vol_id, @lnum) logical eraseblock |
| 120 | * | 120 | * |
| 121 | * This data structure is used in the EBA unit to implement per-LEB locking. | 121 | * This data structure is used in the EBA sub-system to implement per-LEB |
| 122 | * When a logical eraseblock is being locked - corresponding | 122 | * locking. When a logical eraseblock is being locked - corresponding |
| 123 | * &struct ubi_ltree_entry object is inserted to the lock tree (@ubi->ltree). | 123 | * &struct ubi_ltree_entry object is inserted to the lock tree (@ubi->ltree). |
| 124 | * See EBA unit for details. | 124 | * See EBA sub-system for details. |
| 125 | */ | 125 | */ |
| 126 | struct ubi_ltree_entry { | 126 | struct ubi_ltree_entry { |
| 127 | struct rb_node rb; | 127 | struct rb_node rb; |
| @@ -225,7 +225,7 @@ struct ubi_volume { | |||
| 225 | #ifdef CONFIG_MTD_UBI_GLUEBI | 225 | #ifdef CONFIG_MTD_UBI_GLUEBI |
| 226 | /* | 226 | /* |
| 227 | * Gluebi-related stuff may be compiled out. | 227 | * Gluebi-related stuff may be compiled out. |
| 228 | * TODO: this should not be built into UBI but should be a separate | 228 | * Note: this should not be built into UBI but should be a separate |
| 229 | * ubimtd driver which works on top of UBI and emulates MTD devices. | 229 | * ubimtd driver which works on top of UBI and emulates MTD devices. |
| 230 | */ | 230 | */ |
| 231 | struct ubi_volume_desc *gluebi_desc; | 231 | struct ubi_volume_desc *gluebi_desc; |
| @@ -235,8 +235,7 @@ struct ubi_volume { | |||
| 235 | }; | 235 | }; |
| 236 | 236 | ||
| 237 | /** | 237 | /** |
| 238 | * struct ubi_volume_desc - descriptor of the UBI volume returned when it is | 238 | * struct ubi_volume_desc - UBI volume descriptor returned when it is opened. |
| 239 | * opened. | ||
| 240 | * @vol: reference to the corresponding volume description object | 239 | * @vol: reference to the corresponding volume description object |
| 241 | * @mode: open mode (%UBI_READONLY, %UBI_READWRITE, or %UBI_EXCLUSIVE) | 240 | * @mode: open mode (%UBI_READONLY, %UBI_READWRITE, or %UBI_EXCLUSIVE) |
| 242 | */ | 241 | */ |
| @@ -316,11 +315,11 @@ struct ubi_wl_entry; | |||
| 316 | * @ro_mode: if the UBI device is in read-only mode | 315 | * @ro_mode: if the UBI device is in read-only mode |
| 317 | * @leb_size: logical eraseblock size | 316 | * @leb_size: logical eraseblock size |
| 318 | * @leb_start: starting offset of logical eraseblocks within physical | 317 | * @leb_start: starting offset of logical eraseblocks within physical |
| 319 | * eraseblocks | 318 | * eraseblocks |
| 320 | * @ec_hdr_alsize: size of the EC header aligned to @hdrs_min_io_size | 319 | * @ec_hdr_alsize: size of the EC header aligned to @hdrs_min_io_size |
| 321 | * @vid_hdr_alsize: size of the VID header aligned to @hdrs_min_io_size | 320 | * @vid_hdr_alsize: size of the VID header aligned to @hdrs_min_io_size |
| 322 | * @vid_hdr_offset: starting offset of the volume identifier header (might be | 321 | * @vid_hdr_offset: starting offset of the volume identifier header (might be |
| 323 | * unaligned) | 322 | * unaligned) |
| 324 | * @vid_hdr_aloffset: starting offset of the VID header aligned to | 323 | * @vid_hdr_aloffset: starting offset of the VID header aligned to |
| 325 | * @hdrs_min_io_size | 324 | * @hdrs_min_io_size |
| 326 | * @vid_hdr_shift: contains @vid_hdr_offset - @vid_hdr_aloffset | 325 | * @vid_hdr_shift: contains @vid_hdr_offset - @vid_hdr_aloffset |
| @@ -356,16 +355,16 @@ struct ubi_device { | |||
| 356 | struct mutex volumes_mutex; | 355 | struct mutex volumes_mutex; |
| 357 | 356 | ||
| 358 | int max_ec; | 357 | int max_ec; |
| 359 | /* TODO: mean_ec is not updated run-time, fix */ | 358 | /* Note, mean_ec is not updated run-time - should be fixed */ |
| 360 | int mean_ec; | 359 | int mean_ec; |
| 361 | 360 | ||
| 362 | /* EBA unit's stuff */ | 361 | /* EBA sub-system's stuff */ |
| 363 | unsigned long long global_sqnum; | 362 | unsigned long long global_sqnum; |
| 364 | spinlock_t ltree_lock; | 363 | spinlock_t ltree_lock; |
| 365 | struct rb_root ltree; | 364 | struct rb_root ltree; |
| 366 | struct mutex alc_mutex; | 365 | struct mutex alc_mutex; |
| 367 | 366 | ||
| 368 | /* Wear-leveling unit's stuff */ | 367 | /* Wear-leveling sub-system's stuff */ |
| 369 | struct rb_root used; | 368 | struct rb_root used; |
| 370 | struct rb_root free; | 369 | struct rb_root free; |
| 371 | struct rb_root scrub; | 370 | struct rb_root scrub; |
| @@ -388,7 +387,7 @@ struct ubi_device { | |||
| 388 | int thread_enabled; | 387 | int thread_enabled; |
| 389 | char bgt_name[sizeof(UBI_BGT_NAME_PATTERN)+2]; | 388 | char bgt_name[sizeof(UBI_BGT_NAME_PATTERN)+2]; |
| 390 | 389 | ||
| 391 | /* I/O unit's stuff */ | 390 | /* I/O sub-system's stuff */ |
| 392 | long long flash_size; | 391 | long long flash_size; |
| 393 | int peb_count; | 392 | int peb_count; |
| 394 | int peb_size; | 393 | int peb_size; |
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c index cc8fe2934d2b..761952ba125b 100644 --- a/drivers/mtd/ubi/wl.c +++ b/drivers/mtd/ubi/wl.c | |||
| @@ -19,22 +19,22 @@ | |||
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | /* | 21 | /* |
| 22 | * UBI wear-leveling unit. | 22 | * UBI wear-leveling sub-system. |
| 23 | * | 23 | * |
| 24 | * This unit is responsible for wear-leveling. It works in terms of physical | 24 | * This sub-system is responsible for wear-leveling. It works in terms of |
| 25 | * eraseblocks and erase counters and knows nothing about logical eraseblocks, | 25 | * physical* eraseblocks and erase counters and knows nothing about logical |
| 26 | * volumes, etc. From this unit's perspective all physical eraseblocks are of | 26 | * eraseblocks, volumes, etc. From this sub-system's perspective all physical |
| 27 | * two types - used and free. Used physical eraseblocks are those that were | 27 | * eraseblocks are of two types - used and free. Used physical eraseblocks are |
| 28 | * "get" by the 'ubi_wl_get_peb()' function, and free physical eraseblocks are | 28 | * those that were "get" by the 'ubi_wl_get_peb()' function, and free physical |
| 29 | * those that were put by the 'ubi_wl_put_peb()' function. | 29 | * eraseblocks are those that were put by the 'ubi_wl_put_peb()' function. |
| 30 | * | 30 | * |
| 31 | * Physical eraseblocks returned by 'ubi_wl_get_peb()' have only erase counter | 31 | * Physical eraseblocks returned by 'ubi_wl_get_peb()' have only erase counter |
| 32 | * header. The rest of the physical eraseblock contains only 0xFF bytes. | 32 | * header. The rest of the physical eraseblock contains only %0xFF bytes. |
| 33 | * | 33 | * |
| 34 | * When physical eraseblocks are returned to the WL unit by means of the | 34 | * When physical eraseblocks are returned to the WL sub-system by means of the |
| 35 | * 'ubi_wl_put_peb()' function, they are scheduled for erasure. The erasure is | 35 | * 'ubi_wl_put_peb()' function, they are scheduled for erasure. The erasure is |
| 36 | * done asynchronously in context of the per-UBI device background thread, | 36 | * done asynchronously in context of the per-UBI device background thread, |
| 37 | * which is also managed by the WL unit. | 37 | * which is also managed by the WL sub-system. |
| 38 | * | 38 | * |
| 39 | * The wear-leveling is ensured by means of moving the contents of used | 39 | * The wear-leveling is ensured by means of moving the contents of used |
| 40 | * physical eraseblocks with low erase counter to free physical eraseblocks | 40 | * physical eraseblocks with low erase counter to free physical eraseblocks |
| @@ -43,34 +43,36 @@ | |||
| 43 | * The 'ubi_wl_get_peb()' function accepts data type hints which help to pick | 43 | * The 'ubi_wl_get_peb()' function accepts data type hints which help to pick |
| 44 | * an "optimal" physical eraseblock. For example, when it is known that the | 44 | * an "optimal" physical eraseblock. For example, when it is known that the |
| 45 | * physical eraseblock will be "put" soon because it contains short-term data, | 45 | * physical eraseblock will be "put" soon because it contains short-term data, |
| 46 | * the WL unit may pick a free physical eraseblock with low erase counter, and | 46 | * the WL sub-system may pick a free physical eraseblock with low erase |
| 47 | * so forth. | 47 | * counter, and so forth. |
| 48 | * | 48 | * |
| 49 | * If the WL unit fails to erase a physical eraseblock, it marks it as bad. | 49 | * If the WL sub-system fails to erase a physical eraseblock, it marks it as |
| 50 | * bad. | ||
| 50 | * | 51 | * |
| 51 | * This unit is also responsible for scrubbing. If a bit-flip is detected in a | 52 | * This sub-system is also responsible for scrubbing. If a bit-flip is detected |
| 52 | * physical eraseblock, it has to be moved. Technically this is the same as | 53 | * in a physical eraseblock, it has to be moved. Technically this is the same |
| 53 | * moving it for wear-leveling reasons. | 54 | * as moving it for wear-leveling reasons. |
| 54 | * | 55 | * |
| 55 | * As it was said, for the UBI unit all physical eraseblocks are either "free" | 56 | * As it was said, for the UBI sub-system all physical eraseblocks are either |
| 56 | * or "used". Free eraseblock are kept in the @wl->free RB-tree, while used | 57 | * "free" or "used". Free eraseblock are kept in the @wl->free RB-tree, while |
| 57 | * eraseblocks are kept in a set of different RB-trees: @wl->used, | 58 | * used eraseblocks are kept in a set of different RB-trees: @wl->used, |
| 58 | * @wl->prot.pnum, @wl->prot.aec, and @wl->scrub. | 59 | * @wl->prot.pnum, @wl->prot.aec, and @wl->scrub. |
| 59 | * | 60 | * |
| 60 | * Note, in this implementation, we keep a small in-RAM object for each physical | 61 | * Note, in this implementation, we keep a small in-RAM object for each physical |
| 61 | * eraseblock. This is surely not a scalable solution. But it appears to be good | 62 | * eraseblock. This is surely not a scalable solution. But it appears to be good |
| 62 | * enough for moderately large flashes and it is simple. In future, one may | 63 | * enough for moderately large flashes and it is simple. In future, one may |
| 63 | * re-work this unit and make it more scalable. | 64 | * re-work this sub-system and make it more scalable. |
| 64 | * | 65 | * |
| 65 | * At the moment this unit does not utilize the sequence number, which was | 66 | * At the moment this sub-system does not utilize the sequence number, which |
| 66 | * introduced relatively recently. But it would be wise to do this because the | 67 | * was introduced relatively recently. But it would be wise to do this because |
| 67 | * sequence number of a logical eraseblock characterizes how old is it. For | 68 | * the sequence number of a logical eraseblock characterizes how old is it. For |
| 68 | * example, when we move a PEB with low erase counter, and we need to pick the | 69 | * example, when we move a PEB with low erase counter, and we need to pick the |
| 69 | * target PEB, we pick a PEB with the highest EC if our PEB is "old" and we | 70 | * target PEB, we pick a PEB with the highest EC if our PEB is "old" and we |
| 70 | * pick target PEB with an average EC if our PEB is not very "old". This is a | 71 | * pick target PEB with an average EC if our PEB is not very "old". This is a |
| 71 | * room for future re-works of the WL unit. | 72 | * room for future re-works of the WL sub-system. |
| 72 | * | 73 | * |
| 73 | * FIXME: looks too complex, should be simplified (later). | 74 | * Note: the stuff with protection trees looks too complex and is difficult to |
| 75 | * understand. Should be fixed. | ||
| 74 | */ | 76 | */ |
| 75 | 77 | ||
| 76 | #include <linux/slab.h> | 78 | #include <linux/slab.h> |
| @@ -92,20 +94,21 @@ | |||
| 92 | 94 | ||
| 93 | /* | 95 | /* |
| 94 | * Maximum difference between two erase counters. If this threshold is | 96 | * Maximum difference between two erase counters. If this threshold is |
| 95 | * exceeded, the WL unit starts moving data from used physical eraseblocks with | 97 | * exceeded, the WL sub-system starts moving data from used physical |
| 96 | * low erase counter to free physical eraseblocks with high erase counter. | 98 | * eraseblocks with low erase counter to free physical eraseblocks with high |
| 99 | * erase counter. | ||
| 97 | */ | 100 | */ |
| 98 | #define UBI_WL_THRESHOLD CONFIG_MTD_UBI_WL_THRESHOLD | 101 | #define UBI_WL_THRESHOLD CONFIG_MTD_UBI_WL_THRESHOLD |
| 99 | 102 | ||
| 100 | /* | 103 | /* |
| 101 | * When a physical eraseblock is moved, the WL unit has to pick the target | 104 | * When a physical eraseblock is moved, the WL sub-system has to pick the target |
| 102 | * physical eraseblock to move to. The simplest way would be just to pick the | 105 | * physical eraseblock to move to. The simplest way would be just to pick the |
| 103 | * one with the highest erase counter. But in certain workloads this could lead | 106 | * one with the highest erase counter. But in certain workloads this could lead |
| 104 | * to an unlimited wear of one or few physical eraseblock. Indeed, imagine a | 107 | * to an unlimited wear of one or few physical eraseblock. Indeed, imagine a |
| 105 | * situation when the picked physical eraseblock is constantly erased after the | 108 | * situation when the picked physical eraseblock is constantly erased after the |
| 106 | * data is written to it. So, we have a constant which limits the highest erase | 109 | * data is written to it. So, we have a constant which limits the highest erase |
| 107 | * counter of the free physical eraseblock to pick. Namely, the WL unit does | 110 | * counter of the free physical eraseblock to pick. Namely, the WL sub-system |
| 108 | * not pick eraseblocks with erase counter greater then the lowest erase | 111 | * does not pick eraseblocks with erase counter greater then the lowest erase |
| 109 | * counter plus %WL_FREE_MAX_DIFF. | 112 | * counter plus %WL_FREE_MAX_DIFF. |
| 110 | */ | 113 | */ |
| 111 | #define WL_FREE_MAX_DIFF (2*UBI_WL_THRESHOLD) | 114 | #define WL_FREE_MAX_DIFF (2*UBI_WL_THRESHOLD) |
| @@ -123,11 +126,11 @@ | |||
| 123 | * @abs_ec: the absolute erase counter value when the protection ends | 126 | * @abs_ec: the absolute erase counter value when the protection ends |
| 124 | * @e: the wear-leveling entry of the physical eraseblock under protection | 127 | * @e: the wear-leveling entry of the physical eraseblock under protection |
| 125 | * | 128 | * |
| 126 | * When the WL unit returns a physical eraseblock, the physical eraseblock is | 129 | * When the WL sub-system returns a physical eraseblock, the physical |
| 127 | * protected from being moved for some "time". For this reason, the physical | 130 | * eraseblock is protected from being moved for some "time". For this reason, |
| 128 | * eraseblock is not directly moved from the @wl->free tree to the @wl->used | 131 | * the physical eraseblock is not directly moved from the @wl->free tree to the |
| 129 | * tree. There is one more tree in between where this physical eraseblock is | 132 | * @wl->used tree. There is one more tree in between where this physical |
| 130 | * temporarily stored (@wl->prot). | 133 | * eraseblock is temporarily stored (@wl->prot). |
| 131 | * | 134 | * |
| 132 | * All this protection stuff is needed because: | 135 | * All this protection stuff is needed because: |
| 133 | * o we don't want to move physical eraseblocks just after we have given them | 136 | * o we don't want to move physical eraseblocks just after we have given them |
| @@ -175,7 +178,6 @@ struct ubi_wl_prot_entry { | |||
| 175 | * @list: a link in the list of pending works | 178 | * @list: a link in the list of pending works |
| 176 | * @func: worker function | 179 | * @func: worker function |
| 177 | * @priv: private data of the worker function | 180 | * @priv: private data of the worker function |
| 178 | * | ||
| 179 | * @e: physical eraseblock to erase | 181 | * @e: physical eraseblock to erase |
| 180 | * @torture: if the physical eraseblock has to be tortured | 182 | * @torture: if the physical eraseblock has to be tortured |
| 181 | * | 183 | * |
| @@ -1136,7 +1138,7 @@ out_ro: | |||
| 1136 | } | 1138 | } |
| 1137 | 1139 | ||
| 1138 | /** | 1140 | /** |
| 1139 | * ubi_wl_put_peb - return a physical eraseblock to the wear-leveling unit. | 1141 | * ubi_wl_put_peb - return a PEB to the wear-leveling sub-system. |
| 1140 | * @ubi: UBI device description object | 1142 | * @ubi: UBI device description object |
| 1141 | * @pnum: physical eraseblock to return | 1143 | * @pnum: physical eraseblock to return |
| 1142 | * @torture: if this physical eraseblock has to be tortured | 1144 | * @torture: if this physical eraseblock has to be tortured |
| @@ -1175,11 +1177,11 @@ retry: | |||
| 1175 | /* | 1177 | /* |
| 1176 | * User is putting the physical eraseblock which was selected | 1178 | * User is putting the physical eraseblock which was selected |
| 1177 | * as the target the data is moved to. It may happen if the EBA | 1179 | * as the target the data is moved to. It may happen if the EBA |
| 1178 | * unit already re-mapped the LEB in 'ubi_eba_copy_leb()' but | 1180 | * sub-system already re-mapped the LEB in 'ubi_eba_copy_leb()' |
| 1179 | * the WL unit has not put the PEB to the "used" tree yet, but | 1181 | * but the WL sub-system has not put the PEB to the "used" tree |
| 1180 | * it is about to do this. So we just set a flag which will | 1182 | * yet, but it is about to do this. So we just set a flag which |
| 1181 | * tell the WL worker that the PEB is not needed anymore and | 1183 | * will tell the WL worker that the PEB is not needed anymore |
| 1182 | * should be scheduled for erasure. | 1184 | * and should be scheduled for erasure. |
| 1183 | */ | 1185 | */ |
| 1184 | dbg_wl("PEB %d is the target of data moving", pnum); | 1186 | dbg_wl("PEB %d is the target of data moving", pnum); |
| 1185 | ubi_assert(!ubi->move_to_put); | 1187 | ubi_assert(!ubi->move_to_put); |
| @@ -1425,8 +1427,7 @@ static void cancel_pending(struct ubi_device *ubi) | |||
| 1425 | } | 1427 | } |
| 1426 | 1428 | ||
| 1427 | /** | 1429 | /** |
| 1428 | * ubi_wl_init_scan - initialize the wear-leveling unit using scanning | 1430 | * ubi_wl_init_scan - initialize the WL sub-system using scanning information. |
| 1429 | * information. | ||
| 1430 | * @ubi: UBI device description object | 1431 | * @ubi: UBI device description object |
| 1431 | * @si: scanning information | 1432 | * @si: scanning information |
| 1432 | * | 1433 | * |
| @@ -1583,13 +1584,12 @@ static void protection_trees_destroy(struct ubi_device *ubi) | |||
| 1583 | } | 1584 | } |
| 1584 | 1585 | ||
| 1585 | /** | 1586 | /** |
| 1586 | * ubi_wl_close - close the wear-leveling unit. | 1587 | * ubi_wl_close - close the wear-leveling sub-system. |
| 1587 | * @ubi: UBI device description object | 1588 | * @ubi: UBI device description object |
| 1588 | */ | 1589 | */ |
| 1589 | void ubi_wl_close(struct ubi_device *ubi) | 1590 | void ubi_wl_close(struct ubi_device *ubi) |
| 1590 | { | 1591 | { |
| 1591 | dbg_wl("close the UBI wear-leveling unit"); | 1592 | dbg_wl("close the WL sub-system"); |
| 1592 | |||
| 1593 | cancel_pending(ubi); | 1593 | cancel_pending(ubi); |
| 1594 | protection_trees_destroy(ubi); | 1594 | protection_trees_destroy(ubi); |
| 1595 | tree_destroy(&ubi->used); | 1595 | tree_destroy(&ubi->used); |
diff --git a/include/linux/mtd/ubi.h b/include/linux/mtd/ubi.h index 83302bbbddb4..6316fafe5c2a 100644 --- a/include/linux/mtd/ubi.h +++ b/include/linux/mtd/ubi.h | |||
| @@ -45,13 +45,13 @@ enum { | |||
| 45 | * @size: how many physical eraseblocks are reserved for this volume | 45 | * @size: how many physical eraseblocks are reserved for this volume |
| 46 | * @used_bytes: how many bytes of data this volume contains | 46 | * @used_bytes: how many bytes of data this volume contains |
| 47 | * @used_ebs: how many physical eraseblocks of this volume actually contain any | 47 | * @used_ebs: how many physical eraseblocks of this volume actually contain any |
| 48 | * data | 48 | * data |
| 49 | * @vol_type: volume type (%UBI_DYNAMIC_VOLUME or %UBI_STATIC_VOLUME) | 49 | * @vol_type: volume type (%UBI_DYNAMIC_VOLUME or %UBI_STATIC_VOLUME) |
| 50 | * @corrupted: non-zero if the volume is corrupted (static volumes only) | 50 | * @corrupted: non-zero if the volume is corrupted (static volumes only) |
| 51 | * @upd_marker: non-zero if the volume has update marker set | 51 | * @upd_marker: non-zero if the volume has update marker set |
| 52 | * @alignment: volume alignment | 52 | * @alignment: volume alignment |
| 53 | * @usable_leb_size: how many bytes are available in logical eraseblocks of | 53 | * @usable_leb_size: how many bytes are available in logical eraseblocks of |
| 54 | * this volume | 54 | * this volume |
| 55 | * @name_len: volume name length | 55 | * @name_len: volume name length |
| 56 | * @name: volume name | 56 | * @name: volume name |
| 57 | * @cdev: UBI volume character device major and minor numbers | 57 | * @cdev: UBI volume character device major and minor numbers |
