Commit a4e6042f authored by Artem Bityutskiy's avatar Artem Bityutskiy Committed by Artem Bityutskiy

UBI: rename si to ai

After re-naming the 'struct ubi_scan_info' we should adjust all variables
named 'si' to something else, because 'si' stands for "scanning info".
Let's rename it to 'ai' which stands for "attaching info" which is
a bit more consistent and has the same length, which makes re-naming easy.
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
parent 2c5ec5ce
......@@ -583,32 +583,32 @@ static void free_internal_volumes(struct ubi_device *ubi)
static int attach_by_scanning(struct ubi_device *ubi)
{
int err;
struct ubi_attach_info *si;
struct ubi_attach_info *ai;
si = ubi_scan(ubi);
if (IS_ERR(si))
return PTR_ERR(si);
ai = ubi_scan(ubi);
if (IS_ERR(ai))
return PTR_ERR(ai);
ubi->bad_peb_count = si->bad_peb_count;
ubi->bad_peb_count = ai->bad_peb_count;
ubi->good_peb_count = ubi->peb_count - ubi->bad_peb_count;
ubi->corr_peb_count = si->corr_peb_count;
ubi->max_ec = si->max_ec;
ubi->mean_ec = si->mean_ec;
ubi_msg("max. sequence number: %llu", si->max_sqnum);
ubi->corr_peb_count = ai->corr_peb_count;
ubi->max_ec = ai->max_ec;
ubi->mean_ec = ai->mean_ec;
ubi_msg("max. sequence number: %llu", ai->max_sqnum);
err = ubi_read_volume_table(ubi, si);
err = ubi_read_volume_table(ubi, ai);
if (err)
goto out_si;
goto out_ai;
err = ubi_wl_init_scan(ubi, si);
err = ubi_wl_init_scan(ubi, ai);
if (err)
goto out_vtbl;
err = ubi_eba_init_scan(ubi, si);
err = ubi_eba_init_scan(ubi, ai);
if (err)
goto out_wl;
ubi_scan_destroy_si(si);
ubi_scan_destroy_ai(ai);
return 0;
out_wl:
......@@ -616,8 +616,8 @@ static int attach_by_scanning(struct ubi_device *ubi)
out_vtbl:
free_internal_volumes(ubi);
vfree(ubi->vtbl);
out_si:
ubi_scan_destroy_si(si);
out_ai:
ubi_scan_destroy_ai(ai);
return err;
}
......
......@@ -176,7 +176,7 @@ void ubi_dump_vtbl_record(const struct ubi_vtbl_record *r, int idx)
*/
void ubi_dump_sv(const struct ubi_ainf_volume *sv)
{
printk(KERN_DEBUG "Volume scanning information dump:\n");
printk(KERN_DEBUG "Volume attaching information dump:\n");
printk(KERN_DEBUG "\tvol_id %d\n", sv->vol_id);
printk(KERN_DEBUG "\thighest_lnum %d\n", sv->highest_lnum);
printk(KERN_DEBUG "\tleb_count %d\n", sv->leb_count);
......@@ -194,7 +194,7 @@ void ubi_dump_sv(const struct ubi_ainf_volume *sv)
*/
void ubi_dump_aeb(const struct ubi_ainf_peb *aeb, int type)
{
printk(KERN_DEBUG "eraseblock scanning information dump:\n");
printk(KERN_DEBUG "eraseblock attaching information dump:\n");
printk(KERN_DEBUG "\tec %d\n", aeb->ec);
printk(KERN_DEBUG "\tpnum %d\n", aeb->pnum);
if (type == 0) {
......
......@@ -1182,13 +1182,13 @@ int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to,
* reported by real users.
*/
static void print_rsvd_warning(struct ubi_device *ubi,
struct ubi_attach_info *si)
struct ubi_attach_info *ai)
{
/*
* The 1 << 18 (256KiB) number is picked randomly, just a reasonably
* large number to distinguish between newly flashed and used images.
*/
if (si->max_sqnum > (1 << 18)) {
if (ai->max_sqnum > (1 << 18)) {
int min = ubi->beb_rsvd_level / 10;
if (!min)
......@@ -1205,14 +1205,14 @@ static void print_rsvd_warning(struct ubi_device *ubi,
}
/**
* ubi_eba_init_scan - initialize the EBA sub-system using scanning information.
* ubi_eba_init_scan - initialize the EBA sub-system using attaching information.
* @ubi: UBI device description object
* @si: scanning information
* @ai: attaching information
*
* This function returns zero in case of success and a negative error code in
* case of failure.
*/
int ubi_eba_init_scan(struct ubi_device *ubi, struct ubi_attach_info *si)
int ubi_eba_init_scan(struct ubi_device *ubi, struct ubi_attach_info *ai)
{
int i, j, err, num_volumes;
struct ubi_ainf_volume *sv;
......@@ -1226,7 +1226,7 @@ int ubi_eba_init_scan(struct ubi_device *ubi, struct ubi_attach_info *si)
mutex_init(&ubi->alc_mutex);
ubi->ltree = RB_ROOT;
ubi->global_sqnum = si->max_sqnum + 1;
ubi->global_sqnum = ai->max_sqnum + 1;
num_volumes = ubi->vtbl_slots + UBI_INT_VOL_COUNT;
for (i = 0; i < num_volumes; i++) {
......@@ -1246,7 +1246,7 @@ int ubi_eba_init_scan(struct ubi_device *ubi, struct ubi_attach_info *si)
for (j = 0; j < vol->reserved_pebs; j++)
vol->eba_tbl[j] = UBI_LEB_UNMAPPED;
sv = ubi_scan_find_sv(si, idx2vol_id(ubi, i));
sv = ubi_scan_find_sv(ai, idx2vol_id(ubi, i));
if (!sv)
continue;
......@@ -1256,7 +1256,7 @@ int ubi_eba_init_scan(struct ubi_device *ubi, struct ubi_attach_info *si)
* This may happen in case of an unclean reboot
* during re-size.
*/
ubi_scan_move_to_list(sv, aeb, &si->erase);
ubi_scan_move_to_list(sv, aeb, &ai->erase);
vol->eba_tbl[aeb->lnum] = aeb->pnum;
}
}
......@@ -1279,7 +1279,7 @@ int ubi_eba_init_scan(struct ubi_device *ubi, struct ubi_attach_info *si)
if (ubi->avail_pebs < ubi->beb_rsvd_level) {
/* No enough free physical eraseblocks */
ubi->beb_rsvd_pebs = ubi->avail_pebs;
print_rsvd_warning(ubi, si);
print_rsvd_warning(ubi, ai);
} else
ubi->beb_rsvd_pebs = ubi->beb_rsvd_level;
......
This diff is collapsed.
......@@ -145,7 +145,7 @@ struct ubi_vid_hdr;
/*
* ubi_scan_move_to_list - move a PEB from the volume tree to a list.
*
* @sv: volume scanning information
* @sv: volume attaching information
* @aeb: scanning eraseblock information
* @list: the list to move to
*/
......@@ -157,19 +157,19 @@ static inline void ubi_scan_move_to_list(struct ubi_ainf_volume *sv,
list_add_tail(&aeb->u.list, list);
}
int ubi_scan_add_used(struct ubi_device *ubi, struct ubi_attach_info *si,
int ubi_scan_add_used(struct ubi_device *ubi, struct ubi_attach_info *ai,
int pnum, int ec, const struct ubi_vid_hdr *vid_hdr,
int bitflips);
struct ubi_ainf_volume *ubi_scan_find_sv(const struct ubi_attach_info *si,
struct ubi_ainf_volume *ubi_scan_find_sv(const struct ubi_attach_info *ai,
int vol_id);
struct ubi_ainf_peb *ubi_scan_find_aeb(const struct ubi_ainf_volume *sv,
int lnum);
void ubi_scan_rm_volume(struct ubi_attach_info *si, struct ubi_ainf_volume *sv);
void ubi_scan_rm_volume(struct ubi_attach_info *ai, struct ubi_ainf_volume *sv);
struct ubi_ainf_peb *ubi_scan_get_free_peb(struct ubi_device *ubi,
struct ubi_attach_info *si);
int ubi_scan_erase_peb(struct ubi_device *ubi, const struct ubi_attach_info *si,
struct ubi_attach_info *ai);
int ubi_scan_erase_peb(struct ubi_device *ubi, const struct ubi_attach_info *ai,
int pnum, int ec);
struct ubi_attach_info *ubi_scan(struct ubi_device *ubi);
void ubi_scan_destroy_si(struct ubi_attach_info *si);
void ubi_scan_destroy_ai(struct ubi_attach_info *ai);
#endif /* !__UBI_SCAN_H__ */
......@@ -489,7 +489,7 @@ int ubi_change_vtbl_record(struct ubi_device *ubi, int idx,
struct ubi_vtbl_record *vtbl_rec);
int ubi_vtbl_rename_volumes(struct ubi_device *ubi,
struct list_head *rename_list);
int ubi_read_volume_table(struct ubi_device *ubi, struct ubi_attach_info *si);
int ubi_read_volume_table(struct ubi_device *ubi, struct ubi_attach_info *ai);
/* vmt.c */
int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req);
......@@ -529,14 +529,14 @@ int ubi_eba_atomic_leb_change(struct ubi_device *ubi, struct ubi_volume *vol,
int lnum, const void *buf, int len);
int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to,
struct ubi_vid_hdr *vid_hdr);
int ubi_eba_init_scan(struct ubi_device *ubi, struct ubi_attach_info *si);
int ubi_eba_init_scan(struct ubi_device *ubi, struct ubi_attach_info *ai);
/* wl.c */
int ubi_wl_get_peb(struct ubi_device *ubi);
int ubi_wl_put_peb(struct ubi_device *ubi, int pnum, int torture);
int ubi_wl_flush(struct ubi_device *ubi);
int ubi_wl_scrub_peb(struct ubi_device *ubi, int pnum);
int ubi_wl_init_scan(struct ubi_device *ubi, struct ubi_attach_info *si);
int ubi_wl_init_scan(struct ubi_device *ubi, struct ubi_attach_info *ai);
void ubi_wl_close(struct ubi_device *ubi);
int ubi_thread(void *u);
......
This diff is collapsed.
......@@ -1373,14 +1373,14 @@ static void cancel_pending(struct ubi_device *ubi)
}
/**
* ubi_wl_init_scan - initialize the WL sub-system using scanning information.
* ubi_wl_init_scan - initialize the WL sub-system using attaching information.
* @ubi: UBI device description object
* @si: scanning information
* @ai: attaching information
*
* This function returns zero in case of success, and a negative error code in
* case of failure.
*/
int ubi_wl_init_scan(struct ubi_device *ubi, struct ubi_attach_info *si)
int ubi_wl_init_scan(struct ubi_device *ubi, struct ubi_attach_info *ai)
{
int err, i;
struct rb_node *rb1, *rb2;
......@@ -1392,7 +1392,7 @@ int ubi_wl_init_scan(struct ubi_device *ubi, struct ubi_attach_info *si)
spin_lock_init(&ubi->wl_lock);
mutex_init(&ubi->move_mutex);
init_rwsem(&ubi->work_sem);
ubi->max_ec = si->max_ec;
ubi->max_ec = ai->max_ec;
INIT_LIST_HEAD(&ubi->works);
sprintf(ubi->bgt_name, UBI_BGT_NAME_PATTERN, ubi->ubi_num);
......@@ -1406,7 +1406,7 @@ int ubi_wl_init_scan(struct ubi_device *ubi, struct ubi_attach_info *si)
INIT_LIST_HEAD(&ubi->pq[i]);
ubi->pq_head = 0;
list_for_each_entry_safe(aeb, tmp, &si->erase, u.list) {
list_for_each_entry_safe(aeb, tmp, &ai->erase, u.list) {
cond_resched();
e = kmem_cache_alloc(ubi_wl_entry_slab, GFP_KERNEL);
......@@ -1422,7 +1422,7 @@ int ubi_wl_init_scan(struct ubi_device *ubi, struct ubi_attach_info *si)
}
}
list_for_each_entry(aeb, &si->free, u.list) {
list_for_each_entry(aeb, &ai->free, u.list) {
cond_resched();
e = kmem_cache_alloc(ubi_wl_entry_slab, GFP_KERNEL);
......@@ -1436,7 +1436,7 @@ int ubi_wl_init_scan(struct ubi_device *ubi, struct ubi_attach_info *si)
ubi->lookuptbl[e->pnum] = e;
}
ubi_rb_for_each_entry(rb1, sv, &si->volumes, rb) {
ubi_rb_for_each_entry(rb1, sv, &ai->volumes, rb) {
ubi_rb_for_each_entry(rb2, aeb, &sv->root, u.rb) {
cond_resched();
......
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