You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
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: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
This commit is contained in:
+11
-11
@@ -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.
|
||||
* @sv: the object to dump
|
||||
* ubi_dump_av - dump a &struct ubi_ainf_volume object.
|
||||
* @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 "\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);
|
||||
printk(KERN_DEBUG "\tcompat %d\n", sv->compat);
|
||||
printk(KERN_DEBUG "\tvol_type %d\n", sv->vol_type);
|
||||
printk(KERN_DEBUG "\tused_ebs %d\n", sv->used_ebs);
|
||||
printk(KERN_DEBUG "\tlast_data_size %d\n", sv->last_data_size);
|
||||
printk(KERN_DEBUG "\tdata_pad %d\n", sv->data_pad);
|
||||
printk(KERN_DEBUG "\tvol_id %d\n", av->vol_id);
|
||||
printk(KERN_DEBUG "\thighest_lnum %d\n", av->highest_lnum);
|
||||
printk(KERN_DEBUG "\tleb_count %d\n", av->leb_count);
|
||||
printk(KERN_DEBUG "\tcompat %d\n", av->compat);
|
||||
printk(KERN_DEBUG "\tvol_type %d\n", av->vol_type);
|
||||
printk(KERN_DEBUG "\tused_ebs %d\n", av->used_ebs);
|
||||
printk(KERN_DEBUG "\tlast_data_size %d\n", av->last_data_size);
|
||||
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);
|
||||
|
||||
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_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_mkvol_req(const struct ubi_mkvol_req *req);
|
||||
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,
|
||||
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;
|
||||
struct ubi_ainf_volume *av;
|
||||
struct ubi_volume *vol;
|
||||
struct ubi_ainf_peb *aeb;
|
||||
struct rb_node *rb;
|
||||
@@ -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++)
|
||||
vol->eba_tbl[j] = UBI_LEB_UNMAPPED;
|
||||
|
||||
sv = ubi_scan_find_sv(ai, idx2vol_id(ubi, i));
|
||||
if (!sv)
|
||||
av = ubi_scan_find_av(ai, idx2vol_id(ubi, i));
|
||||
if (!av)
|
||||
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)
|
||||
/*
|
||||
* This may happen in case of an unclean reboot
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
|
||||
+120
-120
File diff suppressed because it is too large
Load Diff
@@ -145,26 +145,26 @@ struct ubi_vid_hdr;
|
||||
/*
|
||||
* 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
|
||||
* @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 list_head *list)
|
||||
{
|
||||
rb_erase(&aeb->u.rb, &sv->root);
|
||||
rb_erase(&aeb->u.rb, &av->root);
|
||||
list_add_tail(&aeb->u.list, list);
|
||||
}
|
||||
|
||||
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 *ai,
|
||||
struct ubi_ainf_volume *ubi_scan_find_av(const struct ubi_attach_info *ai,
|
||||
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);
|
||||
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_attach_info *ai);
|
||||
int ubi_scan_erase_peb(struct ubi_device *ubi, const struct ubi_attach_info *ai,
|
||||
|
||||
+36
-36
@@ -366,7 +366,7 @@ out_free:
|
||||
* process_lvol - process the layout volume.
|
||||
* @ubi: UBI device description object
|
||||
* @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
|
||||
* not corrupted, and recovering from corruptions if needed. Returns volume
|
||||
@@ -374,7 +374,7 @@ out_free:
|
||||
*/
|
||||
static struct ubi_vtbl_record *process_lvol(struct ubi_device *ubi,
|
||||
struct ubi_attach_info *ai,
|
||||
struct ubi_ainf_volume *sv)
|
||||
struct ubi_ainf_volume *av)
|
||||
{
|
||||
int err;
|
||||
struct rb_node *rb;
|
||||
@@ -410,7 +410,7 @@ static struct ubi_vtbl_record *process_lvol(struct ubi_device *ubi,
|
||||
dbg_gen("check layout volume");
|
||||
|
||||
/* 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);
|
||||
if (!leb[aeb->lnum]) {
|
||||
err = -ENOMEM;
|
||||
@@ -536,7 +536,7 @@ static int init_volumes(struct ubi_device *ubi,
|
||||
const struct ubi_vtbl_record *vtbl)
|
||||
{
|
||||
int i, reserved_pebs = 0;
|
||||
struct ubi_ainf_volume *sv;
|
||||
struct ubi_ainf_volume *av;
|
||||
struct ubi_volume *vol;
|
||||
|
||||
for (i = 0; i < ubi->vtbl_slots; i++) {
|
||||
@@ -592,8 +592,8 @@ static int init_volumes(struct ubi_device *ubi,
|
||||
}
|
||||
|
||||
/* Static volumes only */
|
||||
sv = ubi_scan_find_sv(ai, i);
|
||||
if (!sv) {
|
||||
av = ubi_scan_find_av(ai, i);
|
||||
if (!av) {
|
||||
/*
|
||||
* No eraseblocks belonging to this volume found. We
|
||||
* don't actually know whether this static volume is
|
||||
@@ -605,22 +605,22 @@ static int init_volumes(struct ubi_device *ubi,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (sv->leb_count != sv->used_ebs) {
|
||||
if (av->leb_count != av->used_ebs) {
|
||||
/*
|
||||
* We found a static volume which misses several
|
||||
* eraseblocks. Treat it as 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;
|
||||
continue;
|
||||
}
|
||||
|
||||
vol->used_ebs = sv->used_ebs;
|
||||
vol->used_ebs = av->used_ebs;
|
||||
vol->used_bytes =
|
||||
(long long)(vol->used_ebs - 1) * vol->usable_leb_size;
|
||||
vol->used_bytes += sv->last_data_size;
|
||||
vol->last_eb_bytes = sv->last_data_size;
|
||||
vol->used_bytes += av->last_data_size;
|
||||
vol->last_eb_bytes = av->last_data_size;
|
||||
}
|
||||
|
||||
/* And add the layout volume */
|
||||
@@ -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
|
||||
* @sv: volume attaching information
|
||||
* @av: volume attaching information
|
||||
*
|
||||
* This function returns zero if the volume attaching information is consistent
|
||||
* to the data read from the volume tabla, and %-EINVAL if not.
|
||||
*/
|
||||
static int check_sv(const struct ubi_volume *vol,
|
||||
const struct ubi_ainf_volume *sv)
|
||||
static int check_av(const struct ubi_volume *vol,
|
||||
const struct ubi_ainf_volume *av)
|
||||
{
|
||||
int err;
|
||||
|
||||
if (sv->highest_lnum >= vol->reserved_pebs) {
|
||||
if (av->highest_lnum >= vol->reserved_pebs) {
|
||||
err = 1;
|
||||
goto bad;
|
||||
}
|
||||
if (sv->leb_count > vol->reserved_pebs) {
|
||||
if (av->leb_count > vol->reserved_pebs) {
|
||||
err = 2;
|
||||
goto bad;
|
||||
}
|
||||
if (sv->vol_type != vol->vol_type) {
|
||||
if (av->vol_type != vol->vol_type) {
|
||||
err = 3;
|
||||
goto bad;
|
||||
}
|
||||
if (sv->used_ebs > vol->reserved_pebs) {
|
||||
if (av->used_ebs > vol->reserved_pebs) {
|
||||
err = 4;
|
||||
goto bad;
|
||||
}
|
||||
if (sv->data_pad != vol->data_pad) {
|
||||
if (av->data_pad != vol->data_pad) {
|
||||
err = 5;
|
||||
goto bad;
|
||||
}
|
||||
@@ -697,7 +697,7 @@ static int check_sv(const struct ubi_volume *vol,
|
||||
|
||||
bad:
|
||||
ubi_err("bad attaching information, error %d", err);
|
||||
ubi_dump_sv(sv);
|
||||
ubi_dump_av(av);
|
||||
ubi_dump_vol_info(vol);
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -716,7 +716,7 @@ static int check_scanning_info(const struct ubi_device *ubi,
|
||||
struct ubi_attach_info *ai)
|
||||
{
|
||||
int err, i;
|
||||
struct ubi_ainf_volume *sv;
|
||||
struct ubi_ainf_volume *av;
|
||||
struct ubi_volume *vol;
|
||||
|
||||
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,
|
||||
for (i = 0; i < ubi->vtbl_slots + UBI_INT_VOL_COUNT; i++) {
|
||||
cond_resched();
|
||||
|
||||
sv = ubi_scan_find_sv(ai, i);
|
||||
av = ubi_scan_find_av(ai, i);
|
||||
vol = ubi->volumes[i];
|
||||
if (!vol) {
|
||||
if (sv)
|
||||
ubi_scan_rm_volume(ai, sv);
|
||||
if (av)
|
||||
ubi_scan_rm_volume(ai, av);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (vol->reserved_pebs == 0) {
|
||||
ubi_assert(i < ubi->vtbl_slots);
|
||||
|
||||
if (!sv)
|
||||
if (!av)
|
||||
continue;
|
||||
|
||||
/*
|
||||
@@ -756,10 +756,10 @@ static int check_scanning_info(const struct ubi_device *ubi,
|
||||
* reboot while the volume was being removed. Discard
|
||||
* these eraseblocks.
|
||||
*/
|
||||
ubi_msg("finish volume %d removal", sv->vol_id);
|
||||
ubi_scan_rm_volume(ai, sv);
|
||||
} else if (sv) {
|
||||
err = check_sv(vol, sv);
|
||||
ubi_msg("finish volume %d removal", av->vol_id);
|
||||
ubi_scan_rm_volume(ai, av);
|
||||
} else if (av) {
|
||||
err = check_av(vol, av);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
@@ -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 i, err;
|
||||
struct ubi_ainf_volume *sv;
|
||||
struct ubi_ainf_volume *av;
|
||||
|
||||
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)
|
||||
ubi->vtbl_size = ubi->vtbl_slots * UBI_VTBL_RECORD_SIZE;
|
||||
ubi->vtbl_size = ALIGN(ubi->vtbl_size, ubi->min_io_size);
|
||||
|
||||
sv = ubi_scan_find_sv(ai, UBI_LAYOUT_VOLUME_ID);
|
||||
if (!sv) {
|
||||
av = ubi_scan_find_av(ai, UBI_LAYOUT_VOLUME_ID);
|
||||
if (!av) {
|
||||
/*
|
||||
* No logical eraseblocks belonging to the layout volume were
|
||||
* 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)
|
||||
return -EINVAL;
|
||||
}
|
||||
} 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 */
|
||||
ubi_err("too many LEBs (%d) in layout volume",
|
||||
sv->leb_count);
|
||||
av->leb_count);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ubi->vtbl = process_lvol(ubi, ai, sv);
|
||||
ubi->vtbl = process_lvol(ubi, ai, av);
|
||||
if (IS_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)
|
||||
{
|
||||
int err, i;
|
||||
struct rb_node *rb1, *rb2;
|
||||
struct ubi_ainf_volume *sv;
|
||||
struct ubi_ainf_volume *av;
|
||||
struct ubi_ainf_peb *aeb, *tmp;
|
||||
struct ubi_wl_entry *e;
|
||||
|
||||
@@ -1436,8 +1436,8 @@ int ubi_wl_init_scan(struct ubi_device *ubi, struct ubi_attach_info *ai)
|
||||
ubi->lookuptbl[e->pnum] = e;
|
||||
}
|
||||
|
||||
ubi_rb_for_each_entry(rb1, sv, &ai->volumes, rb) {
|
||||
ubi_rb_for_each_entry(rb2, aeb, &sv->root, u.rb) {
|
||||
ubi_rb_for_each_entry(rb1, av, &ai->volumes, rb) {
|
||||
ubi_rb_for_each_entry(rb2, aeb, &av->root, u.rb) {
|
||||
cond_resched();
|
||||
|
||||
e = kmem_cache_alloc(ubi_wl_entry_slab, GFP_KERNEL);
|
||||
|
||||
Reference in New Issue
Block a user