Lines Matching refs:av
186 struct ubi_ainf_volume *av; in add_vol() local
191 av = rb_entry(parent, struct ubi_ainf_volume, rb); in add_vol()
193 if (vol_id > av->vol_id) in add_vol()
195 else if (vol_id < av->vol_id) in add_vol()
201 av = kmalloc(sizeof(struct ubi_ainf_volume), GFP_KERNEL); in add_vol()
202 if (!av) in add_vol()
205 av->highest_lnum = av->leb_count = av->used_ebs = 0; in add_vol()
206 av->vol_id = vol_id; in add_vol()
207 av->data_pad = data_pad; in add_vol()
208 av->last_data_size = last_eb_bytes; in add_vol()
209 av->compat = 0; in add_vol()
210 av->vol_type = vol_type; in add_vol()
211 av->root = RB_ROOT; in add_vol()
212 if (av->vol_type == UBI_STATIC_VOLUME) in add_vol()
213 av->used_ebs = used_ebs; in add_vol()
217 rb_link_node(&av->rb, parent, p); in add_vol()
218 rb_insert_color(&av->rb, &ai->volumes); in add_vol()
221 return av; in add_vol()
233 struct ubi_ainf_volume *av) in assign_aeb_to_av() argument
238 p = &av->root.rb_node; in assign_aeb_to_av()
255 av->leb_count++; in assign_aeb_to_av()
258 rb_insert_color(&aeb->u.rb, &av->root); in assign_aeb_to_av()
272 struct ubi_ainf_volume *av, struct ubi_vid_hdr *new_vh, in update_vol() argument
275 struct rb_node **p = &av->root.rb_node, *parent = NULL; in update_vol()
318 if (av->highest_lnum == be32_to_cpu(new_vh->lnum)) in update_vol()
319 av->last_data_size = in update_vol()
323 av->vol_id, aeb->lnum, new_aeb->pnum); in update_vol()
334 av->vol_id, aeb->lnum, new_aeb->pnum); in update_vol()
342 if (av->highest_lnum <= be32_to_cpu(new_vh->lnum)) { in update_vol()
343 av->highest_lnum = be32_to_cpu(new_vh->lnum); in update_vol()
344 av->last_data_size = be32_to_cpu(new_vh->data_size); in update_vol()
347 if (av->vol_type == UBI_STATIC_VOLUME) in update_vol()
348 av->used_ebs = be32_to_cpu(new_vh->used_ebs); in update_vol()
350 av->leb_count++; in update_vol()
353 rb_insert_color(&new_aeb->u.rb, &av->root); in update_vol()
371 struct ubi_ainf_volume *av, *tmp_av = NULL; in process_pool_aeb() local
398 av = tmp_av; in process_pool_aeb()
405 ubi_assert(be32_to_cpu(new_vh->vol_id) == av->vol_id); in process_pool_aeb()
407 return update_vol(ubi, ai, av, new_vh, new_aeb); in process_pool_aeb()
420 struct ubi_ainf_volume *av; in unmap_peb() local
425 av = rb_entry(node, struct ubi_ainf_volume, rb); in unmap_peb()
427 for (node2 = rb_first(&av->root); node2; in unmap_peb()
431 rb_erase(&aeb->u.rb, &av->root); in unmap_peb()
432 av->leb_count--; in unmap_peb()
571 struct ubi_ainf_volume *av; in count_fastmap_pebs() local
581 ubi_rb_for_each_entry(rb1, av, &ai->volumes, rb) in count_fastmap_pebs()
582 ubi_rb_for_each_entry(rb2, aeb, &av->root, u.rb) in count_fastmap_pebs()
602 struct ubi_ainf_volume *av; in ubi_attach_fastmap() local
745 av = add_vol(ai, be32_to_cpu(fmvhdr->vol_id), in ubi_attach_fastmap()
751 if (!av) in ubi_attach_fastmap()
753 if (PTR_ERR(av) == -EINVAL) { in ubi_attach_fastmap()
796 if (av->highest_lnum <= aeb->lnum) in ubi_attach_fastmap()
797 av->highest_lnum = aeb->lnum; in ubi_attach_fastmap()
799 assign_aeb_to_av(ai, aeb, av); in ubi_attach_fastmap()
802 aeb->pnum, aeb->lnum, av->vol_id); in ubi_attach_fastmap()