/linux-6.1.9/drivers/mtd/ubi/ |
D | eba.c | 107 void ubi_eba_get_ldesc(struct ubi_volume *vol, int lnum, in ubi_eba_get_ldesc() argument 110 ldesc->lnum = lnum; in ubi_eba_get_ldesc() 111 ldesc->pnum = vol->eba_tbl->entries[lnum].pnum; in ubi_eba_get_ldesc() 211 int lnum) in ltree_lookup() argument 226 if (lnum < le->lnum) in ltree_lookup() 228 else if (lnum > le->lnum) in ltree_lookup() 250 int vol_id, int lnum) in ltree_add_entry() argument 261 le->lnum = lnum; in ltree_add_entry() 264 le1 = ltree_lookup(ubi, vol_id, lnum); in ltree_add_entry() 292 ubi_assert(lnum != le1->lnum); in ltree_add_entry() [all …]
|
D | kapi.c | 368 static int leb_read_sanity_check(struct ubi_volume_desc *desc, int lnum, in leb_read_sanity_check() argument 375 if (vol_id < 0 || vol_id >= ubi->vtbl_slots || lnum < 0 || in leb_read_sanity_check() 376 lnum >= vol->used_ebs || offset < 0 || len < 0 || in leb_read_sanity_check() 384 if (lnum == vol->used_ebs - 1 && in leb_read_sanity_check() 422 int ubi_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset, in ubi_leb_read() argument 429 dbg_gen("read %d bytes from LEB %d:%d:%d", len, vol_id, lnum, offset); in ubi_leb_read() 431 err = leb_read_sanity_check(desc, lnum, offset, len); in ubi_leb_read() 438 err = ubi_eba_read_leb(ubi, vol, lnum, buf, offset, len, check); in ubi_leb_read() 462 int ubi_leb_read_sg(struct ubi_volume_desc *desc, int lnum, struct ubi_sgl *sgl, in ubi_leb_read_sg() argument 469 dbg_gen("read %d bytes from LEB %d:%d:%d", len, vol_id, lnum, offset); in ubi_leb_read_sg() [all …]
|
D | upd.c | 174 vol->vol_id, req->lnum, req->bytes); in ubi_start_leb_change() 176 return ubi_eba_atomic_leb_change(ubi, vol, req->lnum, NULL, 0); in ubi_start_leb_change() 181 vol->ch_lnum = req->lnum; in ubi_start_leb_change() 219 static int write_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum, in write_leb() argument 234 err = ubi_eba_write_leb(ubi, vol, lnum, buf, 0, len); in write_leb() 246 err = ubi_eba_write_leb_st(ubi, vol, lnum, buf, len, used_ebs); in write_leb() 268 int lnum, offs, err = 0, len, to_write = count; in ubi_more_update_data() local 276 lnum = div_u64_rem(vol->upd_received, vol->usable_leb_size, &offs); in ubi_more_update_data() 309 err = write_leb(ubi, vol, lnum, vol->upd_buf, flush_len, in ubi_more_update_data() 318 lnum += 1; in ubi_more_update_data() [all …]
|
D | gluebi.c | 156 int err = 0, lnum, offs, bytes_left; in gluebi_read() local 160 lnum = div_u64_rem(from, mtd->erasesize, &offs); in gluebi_read() 168 err = ubi_read(gluebi->desc, lnum, buf, offs, to_read); in gluebi_read() 172 lnum += 1; in gluebi_read() 196 int err = 0, lnum, offs, bytes_left; in gluebi_write() local 200 lnum = div_u64_rem(to, mtd->erasesize, &offs); in gluebi_write() 212 err = ubi_leb_write(gluebi->desc, lnum, buf, offs, to_write); in gluebi_write() 216 lnum += 1; in gluebi_write() 236 int err, i, lnum, count; in gluebi_erase() local 242 lnum = mtd_div_by_eb(instr->addr, mtd); in gluebi_erase() [all …]
|
D | attach.c | 190 aeb->lnum = UBI_UNKNOWN; in ubi_alloc_aeb() 230 int lnum, int ec, int to_head, struct list_head *list) in add_to_list() argument 249 aeb->lnum = lnum; in add_to_list() 566 int err, vol_id, lnum; in ubi_add_to_av() local 573 lnum = be32_to_cpu(vid_hdr->lnum); in ubi_add_to_av() 577 pnum, vol_id, lnum, ec, sqnum, bitflips); in ubi_add_to_av() 596 if (lnum != aeb->lnum) { in ubi_add_to_av() 597 if (lnum < aeb->lnum) in ubi_add_to_av() 651 aeb->lnum, aeb->ec, cmp_res & 4, in ubi_add_to_av() 659 aeb->lnum = lnum; in ubi_add_to_av() [all …]
|
/linux-6.1.9/fs/ubifs/ |
D | log.c | 30 struct ubifs_bud *ubifs_search_bud(struct ubifs_info *c, int lnum) in ubifs_search_bud() argument 39 if (lnum < bud->lnum) in ubifs_search_bud() 41 else if (lnum > bud->lnum) in ubifs_search_bud() 59 struct ubifs_wbuf *ubifs_get_wbuf(struct ubifs_info *c, int lnum) in ubifs_get_wbuf() argument 72 if (lnum < bud->lnum) in ubifs_get_wbuf() 74 else if (lnum > bud->lnum) in ubifs_get_wbuf() 123 ubifs_assert(c, bud->lnum != b->lnum); in ubifs_add_bud() 124 if (bud->lnum < b->lnum) in ubifs_add_bud() 146 dbg_log("LEB %d:%d, jhead %s, bud_bytes %lld", bud->lnum, in ubifs_add_bud() 164 int ubifs_add_bud_to_log(struct ubifs_info *c, int jhead, int lnum, int offs) in ubifs_add_bud_to_log() argument [all …]
|
D | lpt_commit.c | 129 static void upd_ltab(struct ubifs_info *c, int lnum, int free, int dirty) in upd_ltab() argument 132 lnum, c->ltab[lnum - c->lpt_first].free, in upd_ltab() 133 c->ltab[lnum - c->lpt_first].dirty, free, dirty); in upd_ltab() 134 ubifs_assert(c, lnum >= c->lpt_first && lnum <= c->lpt_last); in upd_ltab() 135 c->ltab[lnum - c->lpt_first].free = free; in upd_ltab() 136 c->ltab[lnum - c->lpt_first].dirty += dirty; in upd_ltab() 149 static int alloc_lpt_leb(struct ubifs_info *c, int *lnum) in alloc_lpt_leb() argument 153 n = *lnum - c->lpt_first + 1; in alloc_lpt_leb() 159 *lnum = i + c->lpt_first; in alloc_lpt_leb() 169 *lnum = i + c->lpt_first; in alloc_lpt_leb() [all …]
|
D | tnc_commit.c | 26 struct ubifs_znode *znode, int lnum, int offs, int len) in make_idx_node() argument 41 br->lnum = cpu_to_le32(zbr->lnum); in make_idx_node() 45 if (!zbr->lnum || !zbr->len) { in make_idx_node() 57 znode->lnum = lnum; in make_idx_node() 69 zbr->lnum = lnum; in make_idx_node() 74 c->zroot.lnum = lnum; in make_idx_node() 106 static int fill_gap(struct ubifs_info *c, int lnum, int gap_start, int gap_end, in fill_gap() argument 129 lnum, gap_pos, len); in fill_gap() 149 lnum, gap_start, gap_end, gap_end - gap_start, written, pad_len); in fill_gap() 163 static int find_old_idx(struct ubifs_info *c, int lnum, int offs) in find_old_idx() argument [all …]
|
D | find.c | 30 int lnum; member 109 data->lnum = lprops->lnum; in scan_for_dirty_cb() 167 data.lnum = -1; in scan_for_dirty() 174 ubifs_assert(c, data.lnum >= c->main_first && data.lnum < c->leb_cnt); in scan_for_dirty() 175 c->lscan_lnum = data.lnum; in scan_for_dirty() 176 lprops = ubifs_lpt_lookup_dirty(c, data.lnum); in scan_for_dirty() 179 ubifs_assert(c, lprops->lnum == data.lnum); in scan_for_dirty() 322 lp->lnum, lp->free, lp->dirty, lp->flags); in ubifs_find_dirty_leb() 380 data->lnum = lprops->lnum; in scan_for_free_cb() 447 data.lnum = -1; in do_find_free_space() [all …]
|
D | scan.c | 57 int ubifs_scan_a_node(const struct ubifs_info *c, void *buf, int len, int lnum, in ubifs_scan_a_node() argument 66 dbg_scan("hit empty space at LEB %d:%d", lnum, offs); in ubifs_scan_a_node() 77 dbg_ntype(ch->node_type), lnum, offs); in ubifs_scan_a_node() 79 if (ubifs_check_node(c, buf, len, lnum, offs, quiet, 1)) in ubifs_scan_a_node() 92 lnum, offs); in ubifs_scan_a_node() 107 lnum, offs, ALIGN(offs + node_len + pad_len, 8)); in ubifs_scan_a_node() 125 struct ubifs_scan_leb *ubifs_start_scan(const struct ubifs_info *c, int lnum, in ubifs_start_scan() argument 131 dbg_scan("scan LEB %d:%d", lnum, offs); in ubifs_start_scan() 137 sleb->lnum = lnum; in ubifs_start_scan() 141 err = ubifs_leb_read(c, lnum, sbuf + offs, offs, c->leb_size - offs, 0); in ubifs_start_scan() [all …]
|
D | recovery.c | 97 static int get_master_node(const struct ubifs_info *c, int lnum, void **pbuf, in get_master_node() argument 108 err = ubifs_leb_read(c, lnum, sbuf, 0, c->leb_size, 0); in get_master_node() 132 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1); in get_master_node() 138 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1); in get_master_node() 152 dbg_rcvry("found a master node at %d:%d", lnum, offs); in get_master_node() 163 dbg_rcvry("found corruption at %d:%d", lnum, offs); in get_master_node() 195 int err = 0, lnum = UBIFS_MST_LNUM, sz = c->mst_node_alsz; in write_rcvrd_mst_node() local 207 err = ubifs_leb_change(c, lnum, mst, sz); in write_rcvrd_mst_node() 210 err = ubifs_leb_change(c, lnum + 1, mst, sz); in write_rcvrd_mst_node() 429 static void clean_buf(const struct ubifs_info *c, void **buf, int lnum, in clean_buf() argument [all …]
|
D | io.c | 87 int ubifs_leb_read(const struct ubifs_info *c, int lnum, void *buf, int offs, in ubifs_leb_read() argument 92 err = ubi_read(c->ubi, lnum, buf, offs, len); in ubifs_leb_read() 99 len, lnum, offs, err); in ubifs_leb_read() 105 int ubifs_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs, in ubifs_leb_write() argument 114 err = ubi_leb_write(c->ubi, lnum, buf, offs, len); in ubifs_leb_write() 116 err = dbg_leb_write(c, lnum, buf, offs, len); in ubifs_leb_write() 119 len, lnum, offs, err); in ubifs_leb_write() 126 int ubifs_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len) in ubifs_leb_change() argument 134 err = ubi_leb_change(c->ubi, lnum, buf, len); in ubifs_leb_change() 136 err = dbg_leb_change(c, lnum, buf, len); in ubifs_leb_change() [all …]
|
D | gc.c | 72 wbuf->lnum, wbuf->offs + wbuf->used, gc_lnum, in switch_gc_head() 260 err = ubifs_tnc_has_node(c, &snod->key, 0, sleb->lnum, in sort_nodes() 306 int err, new_lnum = wbuf->lnum, new_offs = wbuf->offs + wbuf->used; in move_node() 313 err = ubifs_tnc_replace(c, &snod->key, sleb->lnum, in move_node() 337 if (wbuf->lnum == -1) { in move_nodes() 433 ubifs_add_dirt(c, wbuf->lnum, ubifs_auth_node_sz(c)); in move_nodes() 496 int err = 0, lnum = lp->lnum; in ubifs_garbage_collect_leb() local 500 ubifs_assert(c, c->gc_lnum != lnum); in ubifs_garbage_collect_leb() 501 ubifs_assert(c, wbuf->lnum != lnum); in ubifs_garbage_collect_leb() 505 dbg_gc("LEB %d is free, return it", lp->lnum); in ubifs_garbage_collect_leb() [all …]
|
D | replay.c | 46 int lnum; member 95 lp = ubifs_lpt_lookup_dirty(c, b->bud->lnum); in set_bud_lprops() 122 dbg_mnt("bud LEB %d was GC'd (%d free, %d dirty)", b->bud->lnum, in set_bud_lprops() 124 dbg_gc("bud LEB %d was GC'd (%d free, %d dirty)", b->bud->lnum, in set_bud_lprops() 136 b->bud->lnum, lp->free, lp->dirty, b->free, in set_bud_lprops() 148 b->bud->lnum, c->leb_size - b->free); in set_bud_lprops() 248 r->lnum, r->offs, r->len, r->deletion, r->sqnum); in apply_replay_entry() 254 err = ubifs_tnc_add_nm(c, &r->key, r->lnum, r->offs, in apply_replay_entry() 279 err = ubifs_tnc_add(c, &r->key, r->lnum, r->offs, in apply_replay_entry() 383 static int insert_node(struct ubifs_info *c, int lnum, int offs, int len, in insert_node() argument [all …]
|
D | tnc.c | 70 static int insert_old_idx(struct ubifs_info *c, int lnum, int offs) in insert_old_idx() argument 78 old_idx->lnum = lnum; in insert_old_idx() 85 if (lnum < o->lnum) in insert_old_idx() 87 else if (lnum > o->lnum) in insert_old_idx() 118 return insert_old_idx(c, zbr->lnum, zbr->offs); in insert_old_idx_znode() 121 return insert_old_idx(c, c->zroot.lnum, in insert_old_idx_znode() 143 err = insert_old_idx(c, zbr->lnum, zbr->offs); in ins_clr_old_idx_znode() 146 zbr->lnum = 0; in ins_clr_old_idx_znode() 152 err = insert_old_idx(c, c->zroot.lnum, c->zroot.offs); in ins_clr_old_idx_znode() 155 c->zroot.lnum = 0; in ins_clr_old_idx_znode() [all …]
|
D | lpt.c | 384 int lnum = nnode->nbranch[i].lnum; in ubifs_pack_nnode() local 386 if (lnum == 0) in ubifs_pack_nnode() 387 lnum = c->lpt_last + 1; in ubifs_pack_nnode() 388 pack_bits(c, &addr, &pos, lnum - c->lpt_first, c->lpt_lnum_bits); in ubifs_pack_nnode() 452 void ubifs_add_lpt_dirt(struct ubifs_info *c, int lnum, int dirty) in ubifs_add_lpt_dirt() argument 454 if (!dirty || !lnum) in ubifs_add_lpt_dirt() 457 lnum, dirty, c->ltab[lnum - c->lpt_first].dirty); in ubifs_add_lpt_dirt() 458 ubifs_assert(c, lnum >= c->lpt_first && lnum <= c->lpt_last); in ubifs_add_lpt_dirt() 459 c->ltab[lnum - c->lpt_first].dirty += dirty; in ubifs_add_lpt_dirt() 469 static void set_ltab(struct ubifs_info *c, int lnum, int free, int dirty) in set_ltab() argument [all …]
|
D | ubifs.h | 288 int lnum; member 329 int lnum; member 348 int lnum; member 445 int lnum; member 491 int lnum; member 598 int lnum; member 695 int lnum; member 701 int (*sync_callback)(struct ubifs_info *c, int lnum, int free, int pad); 721 int lnum; member 760 int lnum; member [all …]
|
D | journal.c | 81 static void ubifs_add_auth_dirt(struct ubifs_info *c, int lnum) in ubifs_add_auth_dirt() argument 84 ubifs_add_dirt(c, lnum, ubifs_auth_node_sz(c)); in ubifs_add_auth_dirt() 100 int err = 0, err1, retries = 0, avail, lnum, offs, squeeze; in reserve_space() local 119 if (wbuf->lnum != -1 && avail >= len) in reserve_space() 126 lnum = ubifs_find_free_space(c, len, &offs, squeeze); in reserve_space() 127 if (lnum >= 0) in reserve_space() 130 err = lnum; in reserve_space() 142 lnum = ubifs_garbage_collect(c, 0); in reserve_space() 143 if (lnum < 0) { in reserve_space() 144 err = lnum; in reserve_space() [all …]
|
D | misc.h | 161 static inline int ubifs_add_dirt(struct ubifs_info *c, int lnum, int dirty) in ubifs_add_dirt() argument 163 return ubifs_update_one_lp(c, lnum, LPROPS_NC, dirty, 0, 0); in ubifs_add_dirt() 175 static inline int ubifs_return_leb(struct ubifs_info *c, int lnum) in ubifs_return_leb() argument 177 return ubifs_change_one_lp(c, lnum, LPROPS_NC, LPROPS_NC, 0, in ubifs_return_leb() 270 static inline int ubifs_next_log_lnum(const struct ubifs_info *c, int lnum) in ubifs_next_log_lnum() argument 272 lnum += 1; in ubifs_next_log_lnum() 273 if (lnum > c->log_last) in ubifs_next_log_lnum() 274 lnum = UBIFS_LOG_LNUM; in ubifs_next_log_lnum() 276 return lnum; in ubifs_next_log_lnum()
|
D | debug.c | 433 pr_err("\tlnum %u\n", le32_to_cpu(ref->lnum)); in ubifs_dump_node() 546 i, le32_to_cpu(br->lnum), le32_to_cpu(br->offs), in ubifs_dump_node() 656 c->jheads[i].wbuf.lnum); in ubifs_dump_budg() 659 pr_err("\tbud LEB %d\n", bud->lnum); in ubifs_dump_budg() 662 pr_err("\told bud LEB %d\n", bud->lnum); in ubifs_dump_budg() 665 idx_gc->lnum, idx_gc->unmap); in ubifs_dump_budg() 694 lp->lnum, lp->free, lp->dirty, c->leb_size - spc, spc, in ubifs_dump_lprop() 698 lp->lnum, lp->free, lp->dirty, c->leb_size - spc, spc, in ubifs_dump_lprop() 747 if (bud->lnum == lp->lnum) { in ubifs_dump_lprop() 756 lp->lnum == c->jheads[i].wbuf.lnum) { in ubifs_dump_lprop() [all …]
|
D | sb.c | 284 br->lnum = cpu_to_le32(main_first + DEFAULT_DATA_LEB); in create_default_filesystem() 795 static int fixup_leb(struct ubifs_info *c, int lnum, int len) in fixup_leb() argument 804 dbg_mnt("unmap empty LEB %d", lnum); in fixup_leb() 805 return ubifs_leb_unmap(c, lnum); in fixup_leb() 808 dbg_mnt("fixup LEB %d, data len %d", lnum, len); in fixup_leb() 809 err = ubifs_leb_read(c, lnum, c->sbuf, 0, len, 1); in fixup_leb() 813 return ubifs_leb_change(c, lnum, c->sbuf, len); in fixup_leb() 825 int lnum, err = 0; in fixup_free_space() local 831 for (lnum = UBIFS_MST_LNUM; lnum < UBIFS_LOG_LNUM; lnum++) { in fixup_free_space() 832 err = fixup_leb(c, lnum, c->mst_offs + c->mst_node_alsz); in fixup_free_space() [all …]
|
D | tnc_misc.c | 268 int lnum = zzbr->lnum; in read_znode() local 278 err = ubifs_read_node(c, idx, UBIFS_IDX_NODE, len, lnum, offs); in read_znode() 286 ubifs_bad_hash(c, idx, zzbr->hash, lnum, offs); in read_znode() 295 lnum, offs, znode->level, znode->child_cnt); in read_znode() 311 zbr->lnum = le32_to_cpu(br->lnum); in read_znode() 319 if (zbr->lnum < c->main_first || in read_znode() 320 zbr->lnum >= c->leb_cnt || zbr->offs < 0 || in read_znode() 392 ubifs_err(c, "bad indexing node at LEB %d:%d, error %d", lnum, offs, err); in read_znode() 471 wbuf = ubifs_get_wbuf(c, zbr->lnum); in ubifs_tnc_read_node() 474 zbr->lnum, zbr->offs); in ubifs_tnc_read_node() [all …]
|
D | lprops.c | 495 pos = (lprops->lnum - c->main_first) & (UBIFS_LPT_FANOUT - 1); in is_lprops_dirty() 532 lprops->lnum, free, dirty, flags); in ubifs_change_lp() 548 lprops = ubifs_lpt_lookup_dirty(c, lprops->lnum); in ubifs_change_lp() 552 ubifs_assert(c, lprops == ubifs_lpt_lookup_dirty(c, lprops->lnum)); in ubifs_change_lp() 649 int ubifs_change_one_lp(struct ubifs_info *c, int lnum, int free, int dirty, in ubifs_change_one_lp() argument 657 lp = ubifs_lpt_lookup_dirty(c, lnum); in ubifs_change_one_lp() 672 lnum, err); in ubifs_change_one_lp() 688 int ubifs_update_one_lp(struct ubifs_info *c, int lnum, int free, int dirty, in ubifs_update_one_lp() argument 696 lp = ubifs_lpt_lookup_dirty(c, lnum); in ubifs_update_one_lp() 711 lnum, err); in ubifs_update_one_lp() [all …]
|
D | orphan.c | 416 int lnum; in write_orph_nodes() local 419 for (lnum = c->ohead_lnum + 1; lnum <= c->orph_last; lnum++) { in write_orph_nodes() 420 err = ubifs_leb_unmap(c, lnum); in write_orph_nodes() 561 int lnum, err; in ubifs_clear_orphans() local 563 for (lnum = c->orph_first; lnum <= c->orph_last; lnum++) { in ubifs_clear_orphans() 564 err = ubifs_leb_unmap(c, lnum); in ubifs_clear_orphans() 648 snod->type, sleb->lnum, snod->offs); in do_kill_orphans() 677 cmt_no, sleb->lnum, snod->offs); in do_kill_orphans() 683 dbg_rcvry("out of date LEB %d", sleb->lnum); in do_kill_orphans() 727 cmt_no, sleb->lnum, snod->offs); in do_kill_orphans() [all …]
|
/linux-6.1.9/include/linux/mtd/ |
D | ubi.h | 237 int ubi_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset, 239 int ubi_leb_read_sg(struct ubi_volume_desc *desc, int lnum, struct ubi_sgl *sgl, 241 int ubi_leb_write(struct ubi_volume_desc *desc, int lnum, const void *buf, 243 int ubi_leb_change(struct ubi_volume_desc *desc, int lnum, const void *buf, 245 int ubi_leb_erase(struct ubi_volume_desc *desc, int lnum); 246 int ubi_leb_unmap(struct ubi_volume_desc *desc, int lnum); 247 int ubi_leb_map(struct ubi_volume_desc *desc, int lnum); 248 int ubi_is_mapped(struct ubi_volume_desc *desc, int lnum); 250 int ubi_flush(int ubi_num, int vol_id, int lnum); 256 static inline int ubi_read(struct ubi_volume_desc *desc, int lnum, char *buf, in ubi_read() argument [all …]
|