Commit 517af48c authored by Artem Bityutskiy's avatar Artem Bityutskiy

UBI: rename sv to av

After re-naming the 'struct ubi_scan_volume' we should adjust all variables
named 'sv' to something else, because 'sv' stands for "scanning volume".
Let's rename it to 'av' which stands for "attaching volume" 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 a4e6042f
...@@ -171,20 +171,20 @@ void ubi_dump_vtbl_record(const struct ubi_vtbl_record *r, int idx) ...@@ -171,20 +171,20 @@ void ubi_dump_vtbl_record(const struct ubi_vtbl_record *r, int idx)
} }
/** /**
* ubi_dump_sv - dump a &struct ubi_ainf_volume object. * ubi_dump_av - dump a &struct ubi_ainf_volume object.
* @sv: the object to dump * @av: the object to dump
*/ */
void ubi_dump_sv(const struct ubi_ainf_volume *sv) void ubi_dump_av(const struct ubi_ainf_volume *av)
{ {
printk(KERN_DEBUG "Volume attaching information dump:\n"); printk(KERN_DEBUG "Volume attaching information dump:\n");
printk(KERN_DEBUG "\tvol_id %d\n", sv->vol_id); printk(KERN_DEBUG "\tvol_id %d\n", av->vol_id);
printk(KERN_DEBUG "\thighest_lnum %d\n", sv->highest_lnum); printk(KERN_DEBUG "\thighest_lnum %d\n", av->highest_lnum);
printk(KERN_DEBUG "\tleb_count %d\n", sv->leb_count); printk(KERN_DEBUG "\tleb_count %d\n", av->leb_count);
printk(KERN_DEBUG "\tcompat %d\n", sv->compat); printk(KERN_DEBUG "\tcompat %d\n", av->compat);
printk(KERN_DEBUG "\tvol_type %d\n", sv->vol_type); printk(KERN_DEBUG "\tvol_type %d\n", av->vol_type);
printk(KERN_DEBUG "\tused_ebs %d\n", sv->used_ebs); printk(KERN_DEBUG "\tused_ebs %d\n", av->used_ebs);
printk(KERN_DEBUG "\tlast_data_size %d\n", sv->last_data_size); printk(KERN_DEBUG "\tlast_data_size %d\n", av->last_data_size);
printk(KERN_DEBUG "\tdata_pad %d\n", sv->data_pad); printk(KERN_DEBUG "\tdata_pad %d\n", av->data_pad);
} }
/** /**
......
...@@ -59,7 +59,7 @@ void ubi_dump_vid_hdr(const struct ubi_vid_hdr *vid_hdr); ...@@ -59,7 +59,7 @@ void ubi_dump_vid_hdr(const struct ubi_vid_hdr *vid_hdr);
void ubi_dump_vol_info(const struct ubi_volume *vol); void ubi_dump_vol_info(const struct ubi_volume *vol);
void ubi_dump_vtbl_record(const struct ubi_vtbl_record *r, int idx); void ubi_dump_vtbl_record(const struct ubi_vtbl_record *r, int idx);
void ubi_dump_sv(const struct ubi_ainf_volume *sv); void ubi_dump_av(const struct ubi_ainf_volume *av);
void ubi_dump_aeb(const struct ubi_ainf_peb *aeb, int type); void ubi_dump_aeb(const struct ubi_ainf_peb *aeb, int type);
void ubi_dump_mkvol_req(const struct ubi_mkvol_req *req); void ubi_dump_mkvol_req(const struct ubi_mkvol_req *req);
int ubi_self_check_all_ff(struct ubi_device *ubi, int pnum, int offset, int ubi_self_check_all_ff(struct ubi_device *ubi, int pnum, int offset,
......
...@@ -1215,7 +1215,7 @@ static void print_rsvd_warning(struct ubi_device *ubi, ...@@ -1215,7 +1215,7 @@ static void print_rsvd_warning(struct ubi_device *ubi,
int ubi_eba_init_scan(struct ubi_device *ubi, struct ubi_attach_info *ai) int ubi_eba_init_scan(struct ubi_device *ubi, struct ubi_attach_info *ai)
{ {
int i, j, err, num_volumes; int i, j, err, num_volumes;
struct ubi_ainf_volume *sv; struct ubi_ainf_volume *av;
struct ubi_volume *vol; struct ubi_volume *vol;
struct ubi_ainf_peb *aeb; struct ubi_ainf_peb *aeb;
struct rb_node *rb; struct rb_node *rb;
...@@ -1246,17 +1246,17 @@ int ubi_eba_init_scan(struct ubi_device *ubi, struct ubi_attach_info *ai) ...@@ -1246,17 +1246,17 @@ int ubi_eba_init_scan(struct ubi_device *ubi, struct ubi_attach_info *ai)
for (j = 0; j < vol->reserved_pebs; j++) for (j = 0; j < vol->reserved_pebs; j++)
vol->eba_tbl[j] = UBI_LEB_UNMAPPED; vol->eba_tbl[j] = UBI_LEB_UNMAPPED;
sv = ubi_scan_find_sv(ai, idx2vol_id(ubi, i)); av = ubi_scan_find_av(ai, idx2vol_id(ubi, i));
if (!sv) if (!av)
continue; continue;
ubi_rb_for_each_entry(rb, aeb, &sv->root, u.rb) { ubi_rb_for_each_entry(rb, aeb, &av->root, u.rb) {
if (aeb->lnum >= vol->reserved_pebs) if (aeb->lnum >= vol->reserved_pebs)
/* /*
* This may happen in case of an unclean reboot * This may happen in case of an unclean reboot
* during re-size. * during re-size.
*/ */
ubi_scan_move_to_list(sv, aeb, &ai->erase); ubi_scan_move_to_list(av, aeb, &ai->erase);
vol->eba_tbl[aeb->lnum] = aeb->pnum; vol->eba_tbl[aeb->lnum] = aeb->pnum;
} }
} }
......
This diff is collapsed.
...@@ -145,26 +145,26 @@ struct ubi_vid_hdr; ...@@ -145,26 +145,26 @@ struct ubi_vid_hdr;
/* /*
* ubi_scan_move_to_list - move a PEB from the volume tree to a list. * ubi_scan_move_to_list - move a PEB from the volume tree to a list.
* *
* @sv: volume attaching information * @av: volume attaching information
* @aeb: scanning eraseblock information * @aeb: scanning eraseblock information
* @list: the list to move to * @list: the list to move to
*/ */
static inline void ubi_scan_move_to_list(struct ubi_ainf_volume *sv, static inline void ubi_scan_move_to_list(struct ubi_ainf_volume *av,
struct ubi_ainf_peb *aeb, struct ubi_ainf_peb *aeb,
struct list_head *list) struct list_head *list)
{ {
rb_erase(&aeb->u.rb, &sv->root); rb_erase(&aeb->u.rb, &av->root);
list_add_tail(&aeb->u.list, list); list_add_tail(&aeb->u.list, list);
} }
int ubi_scan_add_used(struct ubi_device *ubi, struct ubi_attach_info *ai, 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 pnum, int ec, const struct ubi_vid_hdr *vid_hdr,
int bitflips); int bitflips);
struct ubi_ainf_volume *ubi_scan_find_sv(const struct ubi_attach_info *ai, struct ubi_ainf_volume *ubi_scan_find_av(const struct ubi_attach_info *ai,
int vol_id); int vol_id);
struct ubi_ainf_peb *ubi_scan_find_aeb(const struct ubi_ainf_volume *sv, struct ubi_ainf_peb *ubi_scan_find_aeb(const struct ubi_ainf_volume *av,
int lnum); int lnum);
void ubi_scan_rm_volume(struct ubi_attach_info *ai, struct ubi_ainf_volume *sv); void ubi_scan_rm_volume(struct ubi_attach_info *ai, struct ubi_ainf_volume *av);
struct ubi_ainf_peb *ubi_scan_get_free_peb(struct ubi_device *ubi, struct ubi_ainf_peb *ubi_scan_get_free_peb(struct ubi_device *ubi,
struct ubi_attach_info *ai); struct ubi_attach_info *ai);
int ubi_scan_erase_peb(struct ubi_device *ubi, const struct ubi_attach_info *ai, int ubi_scan_erase_peb(struct ubi_device *ubi, const struct ubi_attach_info *ai,
......
...@@ -366,7 +366,7 @@ static int create_vtbl(struct ubi_device *ubi, struct ubi_attach_info *ai, ...@@ -366,7 +366,7 @@ static int create_vtbl(struct ubi_device *ubi, struct ubi_attach_info *ai,
* process_lvol - process the layout volume. * process_lvol - process the layout volume.
* @ubi: UBI device description object * @ubi: UBI device description object
* @ai: attaching information * @ai: attaching information
* @sv: layout volume attaching information * @av: layout volume attaching information
* *
* This function is responsible for reading the layout volume, ensuring it is * This function is responsible for reading the layout volume, ensuring it is
* not corrupted, and recovering from corruptions if needed. Returns volume * not corrupted, and recovering from corruptions if needed. Returns volume
...@@ -374,7 +374,7 @@ static int create_vtbl(struct ubi_device *ubi, struct ubi_attach_info *ai, ...@@ -374,7 +374,7 @@ static int create_vtbl(struct ubi_device *ubi, struct ubi_attach_info *ai,
*/ */
static struct ubi_vtbl_record *process_lvol(struct ubi_device *ubi, static struct ubi_vtbl_record *process_lvol(struct ubi_device *ubi,
struct ubi_attach_info *ai, struct ubi_attach_info *ai,
struct ubi_ainf_volume *sv) struct ubi_ainf_volume *av)
{ {
int err; int err;
struct rb_node *rb; struct rb_node *rb;
...@@ -410,7 +410,7 @@ static struct ubi_vtbl_record *process_lvol(struct ubi_device *ubi, ...@@ -410,7 +410,7 @@ static struct ubi_vtbl_record *process_lvol(struct ubi_device *ubi,
dbg_gen("check layout volume"); dbg_gen("check layout volume");
/* Read both LEB 0 and LEB 1 into memory */ /* Read both LEB 0 and LEB 1 into memory */
ubi_rb_for_each_entry(rb, aeb, &sv->root, u.rb) { ubi_rb_for_each_entry(rb, aeb, &av->root, u.rb) {
leb[aeb->lnum] = vzalloc(ubi->vtbl_size); leb[aeb->lnum] = vzalloc(ubi->vtbl_size);
if (!leb[aeb->lnum]) { if (!leb[aeb->lnum]) {
err = -ENOMEM; err = -ENOMEM;
...@@ -536,7 +536,7 @@ static int init_volumes(struct ubi_device *ubi, ...@@ -536,7 +536,7 @@ static int init_volumes(struct ubi_device *ubi,
const struct ubi_vtbl_record *vtbl) const struct ubi_vtbl_record *vtbl)
{ {
int i, reserved_pebs = 0; int i, reserved_pebs = 0;
struct ubi_ainf_volume *sv; struct ubi_ainf_volume *av;
struct ubi_volume *vol; struct ubi_volume *vol;
for (i = 0; i < ubi->vtbl_slots; i++) { for (i = 0; i < ubi->vtbl_slots; i++) {
...@@ -592,8 +592,8 @@ static int init_volumes(struct ubi_device *ubi, ...@@ -592,8 +592,8 @@ static int init_volumes(struct ubi_device *ubi,
} }
/* Static volumes only */ /* Static volumes only */
sv = ubi_scan_find_sv(ai, i); av = ubi_scan_find_av(ai, i);
if (!sv) { if (!av) {
/* /*
* No eraseblocks belonging to this volume found. We * No eraseblocks belonging to this volume found. We
* don't actually know whether this static volume is * don't actually know whether this static volume is
...@@ -605,22 +605,22 @@ static int init_volumes(struct ubi_device *ubi, ...@@ -605,22 +605,22 @@ static int init_volumes(struct ubi_device *ubi,
continue; continue;
} }
if (sv->leb_count != sv->used_ebs) { if (av->leb_count != av->used_ebs) {
/* /*
* We found a static volume which misses several * We found a static volume which misses several
* eraseblocks. Treat it as corrupted. * eraseblocks. Treat it as corrupted.
*/ */
ubi_warn("static volume %d misses %d LEBs - corrupted", ubi_warn("static volume %d misses %d LEBs - corrupted",
sv->vol_id, sv->used_ebs - sv->leb_count); av->vol_id, av->used_ebs - av->leb_count);
vol->corrupted = 1; vol->corrupted = 1;
continue; continue;
} }
vol->used_ebs = sv->used_ebs; vol->used_ebs = av->used_ebs;
vol->used_bytes = vol->used_bytes =
(long long)(vol->used_ebs - 1) * vol->usable_leb_size; (long long)(vol->used_ebs - 1) * vol->usable_leb_size;
vol->used_bytes += sv->last_data_size; vol->used_bytes += av->last_data_size;
vol->last_eb_bytes = sv->last_data_size; vol->last_eb_bytes = av->last_data_size;
} }
/* And add the layout volume */ /* And add the layout volume */
...@@ -661,35 +661,35 @@ static int init_volumes(struct ubi_device *ubi, ...@@ -661,35 +661,35 @@ static int init_volumes(struct ubi_device *ubi,
} }
/** /**
* check_sv - check volume attaching information. * check_av - check volume attaching information.
* @vol: UBI volume description object * @vol: UBI volume description object
* @sv: volume attaching information * @av: volume attaching information
* *
* This function returns zero if the volume attaching information is consistent * This function returns zero if the volume attaching information is consistent
* to the data read from the volume tabla, and %-EINVAL if not. * to the data read from the volume tabla, and %-EINVAL if not.
*/ */
static int check_sv(const struct ubi_volume *vol, static int check_av(const struct ubi_volume *vol,
const struct ubi_ainf_volume *sv) const struct ubi_ainf_volume *av)
{ {
int err; int err;
if (sv->highest_lnum >= vol->reserved_pebs) { if (av->highest_lnum >= vol->reserved_pebs) {
err = 1; err = 1;
goto bad; goto bad;
} }
if (sv->leb_count > vol->reserved_pebs) { if (av->leb_count > vol->reserved_pebs) {
err = 2; err = 2;
goto bad; goto bad;
} }
if (sv->vol_type != vol->vol_type) { if (av->vol_type != vol->vol_type) {
err = 3; err = 3;
goto bad; goto bad;
} }
if (sv->used_ebs > vol->reserved_pebs) { if (av->used_ebs > vol->reserved_pebs) {
err = 4; err = 4;
goto bad; goto bad;
} }
if (sv->data_pad != vol->data_pad) { if (av->data_pad != vol->data_pad) {
err = 5; err = 5;
goto bad; goto bad;
} }
...@@ -697,7 +697,7 @@ static int check_sv(const struct ubi_volume *vol, ...@@ -697,7 +697,7 @@ static int check_sv(const struct ubi_volume *vol,
bad: bad:
ubi_err("bad attaching information, error %d", err); ubi_err("bad attaching information, error %d", err);
ubi_dump_sv(sv); ubi_dump_av(av);
ubi_dump_vol_info(vol); ubi_dump_vol_info(vol);
return -EINVAL; return -EINVAL;
} }
...@@ -716,7 +716,7 @@ static int check_scanning_info(const struct ubi_device *ubi, ...@@ -716,7 +716,7 @@ static int check_scanning_info(const struct ubi_device *ubi,
struct ubi_attach_info *ai) struct ubi_attach_info *ai)
{ {
int err, i; int err, i;
struct ubi_ainf_volume *sv; struct ubi_ainf_volume *av;
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) {
...@@ -735,18 +735,18 @@ static int check_scanning_info(const struct ubi_device *ubi, ...@@ -735,18 +735,18 @@ static int check_scanning_info(const struct ubi_device *ubi,
for (i = 0; i < ubi->vtbl_slots + UBI_INT_VOL_COUNT; i++) { for (i = 0; i < ubi->vtbl_slots + UBI_INT_VOL_COUNT; i++) {
cond_resched(); cond_resched();
sv = ubi_scan_find_sv(ai, i); av = ubi_scan_find_av(ai, i);
vol = ubi->volumes[i]; vol = ubi->volumes[i];
if (!vol) { if (!vol) {
if (sv) if (av)
ubi_scan_rm_volume(ai, sv); ubi_scan_rm_volume(ai, av);
continue; continue;
} }
if (vol->reserved_pebs == 0) { if (vol->reserved_pebs == 0) {
ubi_assert(i < ubi->vtbl_slots); ubi_assert(i < ubi->vtbl_slots);
if (!sv) if (!av)
continue; continue;
/* /*
...@@ -756,10 +756,10 @@ static int check_scanning_info(const struct ubi_device *ubi, ...@@ -756,10 +756,10 @@ static int check_scanning_info(const struct ubi_device *ubi,
* reboot while the volume was being removed. Discard * reboot while the volume was being removed. Discard
* these eraseblocks. * these eraseblocks.
*/ */
ubi_msg("finish volume %d removal", sv->vol_id); ubi_msg("finish volume %d removal", av->vol_id);
ubi_scan_rm_volume(ai, sv); ubi_scan_rm_volume(ai, av);
} else if (sv) { } else if (av) {
err = check_sv(vol, sv); err = check_av(vol, av);
if (err) if (err)
return err; return err;
} }
...@@ -780,7 +780,7 @@ static int check_scanning_info(const struct ubi_device *ubi, ...@@ -780,7 +780,7 @@ static int check_scanning_info(const struct ubi_device *ubi,
int ubi_read_volume_table(struct ubi_device *ubi, struct ubi_attach_info *ai) int ubi_read_volume_table(struct ubi_device *ubi, struct ubi_attach_info *ai)
{ {
int i, err; int i, err;
struct ubi_ainf_volume *sv; struct ubi_ainf_volume *av;
empty_vtbl_record.crc = cpu_to_be32(0xf116c36b); empty_vtbl_record.crc = cpu_to_be32(0xf116c36b);
...@@ -795,8 +795,8 @@ int ubi_read_volume_table(struct ubi_device *ubi, struct ubi_attach_info *ai) ...@@ -795,8 +795,8 @@ int ubi_read_volume_table(struct ubi_device *ubi, struct ubi_attach_info *ai)
ubi->vtbl_size = ubi->vtbl_slots * UBI_VTBL_RECORD_SIZE; ubi->vtbl_size = ubi->vtbl_slots * UBI_VTBL_RECORD_SIZE;
ubi->vtbl_size = ALIGN(ubi->vtbl_size, ubi->min_io_size); ubi->vtbl_size = ALIGN(ubi->vtbl_size, ubi->min_io_size);
sv = ubi_scan_find_sv(ai, UBI_LAYOUT_VOLUME_ID); av = ubi_scan_find_av(ai, UBI_LAYOUT_VOLUME_ID);
if (!sv) { if (!av) {
/* /*
* No logical eraseblocks belonging to the layout volume were * No logical eraseblocks belonging to the layout volume were
* found. This could mean that the flash is just empty. In * found. This could mean that the flash is just empty. In
...@@ -814,14 +814,14 @@ int ubi_read_volume_table(struct ubi_device *ubi, struct ubi_attach_info *ai) ...@@ -814,14 +814,14 @@ int ubi_read_volume_table(struct ubi_device *ubi, struct ubi_attach_info *ai)
return -EINVAL; return -EINVAL;
} }
} else { } else {
if (sv->leb_count > UBI_LAYOUT_VOLUME_EBS) { if (av->leb_count > UBI_LAYOUT_VOLUME_EBS) {
/* This must not happen with proper UBI images */ /* This must not happen with proper UBI images */
ubi_err("too many LEBs (%d) in layout volume", ubi_err("too many LEBs (%d) in layout volume",
sv->leb_count); av->leb_count);
return -EINVAL; return -EINVAL;
} }
ubi->vtbl = process_lvol(ubi, ai, sv); ubi->vtbl = process_lvol(ubi, ai, av);
if (IS_ERR(ubi->vtbl)) if (IS_ERR(ubi->vtbl))
return PTR_ERR(ubi->vtbl); return PTR_ERR(ubi->vtbl);
} }
......
...@@ -1384,7 +1384,7 @@ int ubi_wl_init_scan(struct ubi_device *ubi, struct ubi_attach_info *ai) ...@@ -1384,7 +1384,7 @@ int ubi_wl_init_scan(struct ubi_device *ubi, struct ubi_attach_info *ai)
{ {
int err, i; int err, i;
struct rb_node *rb1, *rb2; struct rb_node *rb1, *rb2;
struct ubi_ainf_volume *sv; struct ubi_ainf_volume *av;
struct ubi_ainf_peb *aeb, *tmp; struct ubi_ainf_peb *aeb, *tmp;
struct ubi_wl_entry *e; struct ubi_wl_entry *e;
...@@ -1436,8 +1436,8 @@ int ubi_wl_init_scan(struct ubi_device *ubi, struct ubi_attach_info *ai) ...@@ -1436,8 +1436,8 @@ int ubi_wl_init_scan(struct ubi_device *ubi, struct ubi_attach_info *ai)
ubi->lookuptbl[e->pnum] = e; ubi->lookuptbl[e->pnum] = e;
} }
ubi_rb_for_each_entry(rb1, sv, &ai->volumes, rb) { ubi_rb_for_each_entry(rb1, av, &ai->volumes, rb) {
ubi_rb_for_each_entry(rb2, aeb, &sv->root, u.rb) { ubi_rb_for_each_entry(rb2, aeb, &av->root, u.rb) {
cond_resched(); cond_resched();
e = kmem_cache_alloc(ubi_wl_entry_slab, GFP_KERNEL); e = kmem_cache_alloc(ubi_wl_entry_slab, GFP_KERNEL);
......
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