Commit fbd0107f authored by Artem Bityutskiy's avatar Artem Bityutskiy

UBI: amend comments after all the renamings

This patch amends commentaries in scan.[ch] to match the new logic. Reminder -
we did the restructuring to prepare the code for adding the fastmap. This patch
also renames a couple of functions - it was too difficult to separate out that
change and I decided that it is not too bad to have it in the same patch with
commentaries changes.
Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
parent 1fc2e3e5
...@@ -27,10 +27,6 @@ ...@@ -27,10 +27,6 @@
* module load parameters or the kernel boot parameters. If MTD devices were * module load parameters or the kernel boot parameters. If MTD devices were
* specified, UBI does not attach any MTD device, but it is possible to do * specified, UBI does not attach any MTD device, but it is possible to do
* later using the "UBI control device". * later using the "UBI control device".
*
* At the moment we only attach UBI devices by scanning, which will become a
* bottleneck when flashes reach certain large size. Then one may improve UBI
* and add other methods, although it does not seem to be easy to do.
*/ */
#include <linux/err.h> #include <linux/err.h>
...@@ -790,11 +786,11 @@ static int io_init(struct ubi_device *ubi) ...@@ -790,11 +786,11 @@ static int io_init(struct ubi_device *ubi)
ubi_msg("data offset: %d", ubi->leb_start); ubi_msg("data offset: %d", ubi->leb_start);
/* /*
* Note, ideally, we have to initialize ubi->bad_peb_count here. But * Note, ideally, we have to initialize @ubi->bad_peb_count here. But
* unfortunately, MTD does not provide this information. We should loop * unfortunately, MTD does not provide this information. We should loop
* over all physical eraseblocks and invoke mtd->block_is_bad() for * over all physical eraseblocks and invoke mtd->block_is_bad() for
* each physical eraseblock. So, we skip ubi->bad_peb_count * each physical eraseblock. So, we leave @ubi->bad_peb_count
* uninitialized and initialize it after scanning. * uninitialized so far.
*/ */
return 0; return 0;
...@@ -805,7 +801,7 @@ static int io_init(struct ubi_device *ubi) ...@@ -805,7 +801,7 @@ static int io_init(struct ubi_device *ubi)
* @ubi: UBI device description object * @ubi: UBI device description object
* @vol_id: ID of the volume to re-size * @vol_id: ID of the volume to re-size
* *
* This function re-sizes the volume marked by the @UBI_VTBL_AUTORESIZE_FLG in * This function re-sizes the volume marked by the %UBI_VTBL_AUTORESIZE_FLG in
* the volume table to the largest possible size. See comments in ubi-header.h * the volume table to the largest possible size. See comments in ubi-header.h
* for more description of the flag. Returns zero in case of success and a * for more description of the flag. Returns zero in case of success and a
* negative error code in case of failure. * negative error code in case of failure.
......
...@@ -513,8 +513,7 @@ static int nor_erase_prepare(struct ubi_device *ubi, int pnum) ...@@ -513,8 +513,7 @@ static int nor_erase_prepare(struct ubi_device *ubi, int pnum)
* It is important to first invalidate the EC header, and then the VID * It is important to first invalidate the EC header, and then the VID
* header. Otherwise a power cut may lead to valid EC header and * header. Otherwise a power cut may lead to valid EC header and
* invalid VID header, in which case UBI will treat this PEB as * invalid VID header, in which case UBI will treat this PEB as
* corrupted and will try to preserve it, and print scary warnings (see * corrupted and will try to preserve it, and print scary warnings.
* the header comment in scan.c for more information).
*/ */
addr = (loff_t)pnum * ubi->peb_size; addr = (loff_t)pnum * ubi->peb_size;
err = mtd_write(ubi->mtd, addr, 4, &written, (void *)&data); err = mtd_write(ubi->mtd, addr, 4, &written, (void *)&data);
......
This diff is collapsed.
...@@ -146,7 +146,7 @@ struct ubi_vid_hdr; ...@@ -146,7 +146,7 @@ struct ubi_vid_hdr;
* ubi_move_aeb_to_list - move a PEB from the volume tree to a list. * ubi_move_aeb_to_list - move a PEB from the volume tree to a list.
* *
* @av: volume attaching information * @av: volume attaching information
* @aeb: scanning eraseblock information * @aeb: attaching eraseblock information
* @list: the list to move to * @list: the list to move to
*/ */
static inline void ubi_move_aeb_to_list(struct ubi_ainf_volume *av, static inline void ubi_move_aeb_to_list(struct ubi_ainf_volume *av,
......
...@@ -149,10 +149,10 @@ enum { ...@@ -149,10 +149,10 @@ enum {
* The @image_seq field is used to validate a UBI image that has been prepared * The @image_seq field is used to validate a UBI image that has been prepared
* for a UBI device. The @image_seq value can be any value, but it must be the * for a UBI device. The @image_seq value can be any value, but it must be the
* same on all eraseblocks. UBI will ensure that all new erase counter headers * same on all eraseblocks. UBI will ensure that all new erase counter headers
* also contain this value, and will check the value when scanning at start-up. * also contain this value, and will check the value when attaching the flash.
* One way to make use of @image_seq is to increase its value by one every time * One way to make use of @image_seq is to increase its value by one every time
* an image is flashed over an existing image, then, if the flashing does not * an image is flashed over an existing image, then, if the flashing does not
* complete, UBI will detect the error when scanning. * complete, UBI will detect the error when attaching the media.
*/ */
struct ubi_ec_hdr { struct ubi_ec_hdr {
__be32 magic; __be32 magic;
......
...@@ -37,16 +37,15 @@ ...@@ -37,16 +37,15 @@
* LEB 1. This scheme guarantees recoverability from unclean reboots. * LEB 1. This scheme guarantees recoverability from unclean reboots.
* *
* In this UBI implementation the on-flash volume table does not contain any * In this UBI implementation the on-flash volume table does not contain any
* information about how many data static volumes contain. This information may * information about how much data static volumes contain.
* be found from the scanning data.
* *
* But it would still be beneficial to store this information in the volume * But it would still be beneficial to store this information in the volume
* table. For example, suppose we have a static volume X, and all its physical * table. For example, suppose we have a static volume X, and all its physical
* eraseblocks became bad for some reasons. Suppose we are attaching the * eraseblocks became bad for some reasons. Suppose we are attaching the
* corresponding MTD device, the scanning has found no logical eraseblocks * corresponding MTD device, for some reason we find no logical eraseblocks
* corresponding to the volume X. According to the volume table volume X does * corresponding to the volume X. According to the volume table volume X does
* exist. So we don't know whether it is just empty or all its physical * exist. So we don't know whether it is just empty or all its physical
* eraseblocks went bad. So we cannot alarm the user about this corruption. * eraseblocks went bad. So we cannot alarm the user properly.
* *
* The volume table also stores so-called "update marker", which is used for * The volume table also stores so-called "update marker", which is used for
* volume updates. Before updating the volume, the update marker is set, and * volume updates. Before updating the volume, the update marker is set, and
...@@ -702,16 +701,16 @@ static int check_av(const struct ubi_volume *vol, ...@@ -702,16 +701,16 @@ static int check_av(const struct ubi_volume *vol,
} }
/** /**
* check_scanning_info - check that attaching information. * check_attaching_info - check that attaching information.
* @ubi: UBI device description object * @ubi: UBI device description object
* @ai: attaching information * @ai: attaching information
* *
* Even though we protect on-flash data by CRC checksums, we still don't trust * Even though we protect on-flash data by CRC checksums, we still don't trust
* the media. This function ensures that attaching information is consistent to * the media. This function ensures that attaching information is consistent to
* the information read from the volume table. Returns zero if the scanning * the information read from the volume table. Returns zero if the attaching
* information is OK and %-EINVAL if it is not. * information is OK and %-EINVAL if it is not.
*/ */
static int check_scanning_info(const struct ubi_device *ubi, static int check_attaching_info(const struct ubi_device *ubi,
struct ubi_attach_info *ai) struct ubi_attach_info *ai)
{ {
int err, i; int err, i;
...@@ -719,15 +718,14 @@ static int check_scanning_info(const struct ubi_device *ubi, ...@@ -719,15 +718,14 @@ static int check_scanning_info(const struct ubi_device *ubi,
struct ubi_volume *vol; struct ubi_volume *vol;
if (ai->vols_found > UBI_INT_VOL_COUNT + ubi->vtbl_slots) { if (ai->vols_found > UBI_INT_VOL_COUNT + ubi->vtbl_slots) {
ubi_err("scanning found %d volumes, maximum is %d + %d", ubi_err("found %d volumes while attaching, maximum is %d + %d",
ai->vols_found, UBI_INT_VOL_COUNT, ubi->vtbl_slots); ai->vols_found, UBI_INT_VOL_COUNT, ubi->vtbl_slots);
return -EINVAL; return -EINVAL;
} }
if (ai->highest_vol_id >= ubi->vtbl_slots + UBI_INT_VOL_COUNT && if (ai->highest_vol_id >= ubi->vtbl_slots + UBI_INT_VOL_COUNT &&
ai->highest_vol_id < UBI_INTERNAL_VOL_START) { ai->highest_vol_id < UBI_INTERNAL_VOL_START) {
ubi_err("too large volume ID %d found by scanning", ubi_err("too large volume ID %d found", ai->highest_vol_id);
ai->highest_vol_id);
return -EINVAL; return -EINVAL;
} }
...@@ -749,7 +747,7 @@ static int check_scanning_info(const struct ubi_device *ubi, ...@@ -749,7 +747,7 @@ static int check_scanning_info(const struct ubi_device *ubi,
continue; continue;
/* /*
* During scanning we found a volume which does not * During attaching we found a volume which does not
* exist according to the information in the volume * exist according to the information in the volume
* table. This must have happened due to an unclean * table. This must have happened due to an unclean
* reboot while the volume was being removed. Discard * reboot while the volume was being removed. Discard
...@@ -839,7 +837,7 @@ int ubi_read_volume_table(struct ubi_device *ubi, struct ubi_attach_info *ai) ...@@ -839,7 +837,7 @@ int ubi_read_volume_table(struct ubi_device *ubi, struct ubi_attach_info *ai)
* Make sure that the attaching information is consistent to the * Make sure that the attaching information is consistent to the
* information stored in the volume table. * information stored in the volume table.
*/ */
err = check_scanning_info(ubi, ai); err = check_attaching_info(ubi, ai);
if (err) if (err)
goto out_free; goto out_free;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment