/Linux-v4.19/fs/ubifs/ |
D | log.c | 42 struct ubifs_bud *ubifs_search_bud(struct ubifs_info *c, int lnum) in ubifs_search_bud() argument 51 if (lnum < bud->lnum) in ubifs_search_bud() 53 else if (lnum > bud->lnum) in ubifs_search_bud() 71 struct ubifs_wbuf *ubifs_get_wbuf(struct ubifs_info *c, int lnum) in ubifs_get_wbuf() argument 84 if (lnum < bud->lnum) in ubifs_get_wbuf() 86 else if (lnum > bud->lnum) in ubifs_get_wbuf() 135 ubifs_assert(c, bud->lnum != b->lnum); in ubifs_add_bud() 136 if (bud->lnum < b->lnum) in ubifs_add_bud() 158 dbg_log("LEB %d:%d, jhead %s, bud_bytes %lld", bud->lnum, in ubifs_add_bud() 176 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 | tnc_commit.c | 38 struct ubifs_znode *znode, int lnum, int offs, int len) in make_idx_node() argument 52 br->lnum = cpu_to_le32(zbr->lnum); in make_idx_node() 55 if (!zbr->lnum || !zbr->len) { in make_idx_node() 66 znode->lnum = lnum; in make_idx_node() 78 zbr->lnum = lnum; in make_idx_node() 82 c->zroot.lnum = lnum; in make_idx_node() 113 static int fill_gap(struct ubifs_info *c, int lnum, int gap_start, int gap_end, in fill_gap() argument 136 lnum, gap_pos, len); in fill_gap() 156 lnum, gap_start, gap_end, gap_end - gap_start, written, pad_len); in fill_gap() 170 static int find_old_idx(struct ubifs_info *c, int lnum, int offs) in find_old_idx() argument [all …]
|
D | lpt_commit.c | 141 static void upd_ltab(struct ubifs_info *c, int lnum, int free, int dirty) in upd_ltab() argument 144 lnum, c->ltab[lnum - c->lpt_first].free, in upd_ltab() 145 c->ltab[lnum - c->lpt_first].dirty, free, dirty); in upd_ltab() 146 ubifs_assert(c, lnum >= c->lpt_first && lnum <= c->lpt_last); in upd_ltab() 147 c->ltab[lnum - c->lpt_first].free = free; in upd_ltab() 148 c->ltab[lnum - c->lpt_first].dirty += dirty; in upd_ltab() 161 static int alloc_lpt_leb(struct ubifs_info *c, int *lnum) in alloc_lpt_leb() argument 165 n = *lnum - c->lpt_first + 1; in alloc_lpt_leb() 171 *lnum = i + c->lpt_first; in alloc_lpt_leb() 181 *lnum = i + c->lpt_first; in alloc_lpt_leb() [all …]
|
D | find.c | 42 int lnum; member 121 data->lnum = lprops->lnum; in scan_for_dirty_cb() 179 data.lnum = -1; in scan_for_dirty() 186 ubifs_assert(c, data.lnum >= c->main_first && data.lnum < c->leb_cnt); in scan_for_dirty() 187 c->lscan_lnum = data.lnum; in scan_for_dirty() 188 lprops = ubifs_lpt_lookup_dirty(c, data.lnum); in scan_for_dirty() 191 ubifs_assert(c, lprops->lnum == data.lnum); in scan_for_dirty() 334 lp->lnum, lp->free, lp->dirty, lp->flags); in ubifs_find_dirty_leb() 392 data->lnum = lprops->lnum; in scan_for_free_cb() 459 data.lnum = -1; in do_find_free_space() [all …]
|
D | scan.c | 69 int ubifs_scan_a_node(const struct ubifs_info *c, void *buf, int len, int lnum, in ubifs_scan_a_node() argument 78 dbg_scan("hit empty space at LEB %d:%d", lnum, offs); in ubifs_scan_a_node() 89 dbg_ntype(ch->node_type), lnum, offs); in ubifs_scan_a_node() 91 if (ubifs_check_node(c, buf, lnum, offs, quiet, 1)) in ubifs_scan_a_node() 104 lnum, offs); in ubifs_scan_a_node() 119 lnum, offs, ALIGN(offs + node_len + pad_len, 8)); in ubifs_scan_a_node() 137 struct ubifs_scan_leb *ubifs_start_scan(const struct ubifs_info *c, int lnum, in ubifs_start_scan() argument 143 dbg_scan("scan LEB %d:%d", lnum, offs); in ubifs_start_scan() 149 sleb->lnum = lnum; in ubifs_start_scan() 153 err = ubifs_leb_read(c, lnum, sbuf + offs, offs, c->leb_size - offs, 0); in ubifs_start_scan() [all …]
|
D | replay.c | 56 int lnum; member 104 lp = ubifs_lpt_lookup_dirty(c, b->bud->lnum); in set_bud_lprops() 131 dbg_mnt("bud LEB %d was GC'd (%d free, %d dirty)", b->bud->lnum, in set_bud_lprops() 133 dbg_gc("bud LEB %d was GC'd (%d free, %d dirty)", b->bud->lnum, in set_bud_lprops() 145 b->bud->lnum, lp->free, lp->dirty, b->free, in set_bud_lprops() 157 b->bud->lnum, c->leb_size - b->free); in set_bud_lprops() 224 r->lnum, r->offs, r->len, r->deletion, r->sqnum); in apply_replay_entry() 230 err = ubifs_tnc_add_nm(c, &r->key, r->lnum, r->offs, in apply_replay_entry() 250 err = ubifs_tnc_add(c, &r->key, r->lnum, r->offs, in apply_replay_entry() 354 static int insert_node(struct ubifs_info *c, int lnum, int offs, int len, in insert_node() argument [all …]
|
D | recovery.c | 109 static int get_master_node(const struct ubifs_info *c, int lnum, void **pbuf, in get_master_node() argument 120 err = ubifs_leb_read(c, lnum, sbuf, 0, c->leb_size, 0); in get_master_node() 144 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1); in get_master_node() 150 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1); in get_master_node() 164 dbg_rcvry("found a master node at %d:%d", lnum, offs); in get_master_node() 175 dbg_rcvry("found corruption at %d:%d", lnum, offs); in get_master_node() 207 int err = 0, lnum = UBIFS_MST_LNUM, sz = c->mst_node_alsz; in write_rcvrd_mst_node() local 216 err = ubifs_leb_change(c, lnum, mst, sz); in write_rcvrd_mst_node() 219 err = ubifs_leb_change(c, lnum + 1, mst, sz); in write_rcvrd_mst_node() 440 static void clean_buf(const struct ubifs_info *c, void **buf, int lnum, in clean_buf() argument [all …]
|
D | io.c | 99 int ubifs_leb_read(const struct ubifs_info *c, int lnum, void *buf, int offs, in ubifs_leb_read() argument 104 err = ubi_read(c->ubi, lnum, buf, offs, len); in ubifs_leb_read() 111 len, lnum, offs, err); in ubifs_leb_read() 117 int ubifs_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs, in ubifs_leb_write() argument 126 err = ubi_leb_write(c->ubi, lnum, buf, offs, len); in ubifs_leb_write() 128 err = dbg_leb_write(c, lnum, buf, offs, len); in ubifs_leb_write() 131 len, lnum, offs, err); in ubifs_leb_write() 138 int ubifs_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len) in ubifs_leb_change() argument 146 err = ubi_leb_change(c->ubi, lnum, buf, len); in ubifs_leb_change() 148 err = dbg_leb_change(c, lnum, buf, len); in ubifs_leb_change() [all …]
|
D | gc.c | 88 wbuf->lnum, wbuf->offs + wbuf->used, gc_lnum, in switch_gc_head() 274 err = ubifs_tnc_has_node(c, &snod->key, 0, sleb->lnum, in sort_nodes() 320 int err, new_lnum = wbuf->lnum, new_offs = wbuf->offs + wbuf->used; in move_node() 327 err = ubifs_tnc_replace(c, &snod->key, sleb->lnum, in move_node() 351 if (wbuf->lnum == -1) { in move_nodes() 470 int err = 0, lnum = lp->lnum; in ubifs_garbage_collect_leb() local 474 ubifs_assert(c, c->gc_lnum != lnum); in ubifs_garbage_collect_leb() 475 ubifs_assert(c, wbuf->lnum != lnum); in ubifs_garbage_collect_leb() 479 dbg_gc("LEB %d is free, return it", lp->lnum); in ubifs_garbage_collect_leb() 491 err = ubifs_change_one_lp(c, lp->lnum, c->leb_size, in ubifs_garbage_collect_leb() [all …]
|
D | lpt.c | 396 int lnum = nnode->nbranch[i].lnum; in ubifs_pack_nnode() local 398 if (lnum == 0) in ubifs_pack_nnode() 399 lnum = c->lpt_last + 1; in ubifs_pack_nnode() 400 pack_bits(c, &addr, &pos, lnum - c->lpt_first, c->lpt_lnum_bits); in ubifs_pack_nnode() 464 void ubifs_add_lpt_dirt(struct ubifs_info *c, int lnum, int dirty) in ubifs_add_lpt_dirt() argument 466 if (!dirty || !lnum) in ubifs_add_lpt_dirt() 469 lnum, dirty, c->ltab[lnum - c->lpt_first].dirty); in ubifs_add_lpt_dirt() 470 ubifs_assert(c, lnum >= c->lpt_first && lnum <= c->lpt_last); in ubifs_add_lpt_dirt() 471 c->ltab[lnum - c->lpt_first].dirty += dirty; in ubifs_add_lpt_dirt() 481 static void set_ltab(struct ubifs_info *c, int lnum, int free, int dirty) in set_ltab() argument [all …]
|
D | tnc.c | 38 int len, int lnum, int offs); 82 static int insert_old_idx(struct ubifs_info *c, int lnum, int offs) in insert_old_idx() argument 90 old_idx->lnum = lnum; in insert_old_idx() 97 if (lnum < o->lnum) in insert_old_idx() 99 else if (lnum > o->lnum) in insert_old_idx() 130 return insert_old_idx(c, zbr->lnum, zbr->offs); in insert_old_idx_znode() 133 return insert_old_idx(c, c->zroot.lnum, in insert_old_idx_znode() 155 err = insert_old_idx(c, zbr->lnum, zbr->offs); in ins_clr_old_idx_znode() 158 zbr->lnum = 0; in ins_clr_old_idx_znode() 164 err = insert_old_idx(c, c->zroot.lnum, c->zroot.offs); in ins_clr_old_idx_znode() [all …]
|
D | journal.c | 106 int err = 0, err1, retries = 0, avail, lnum, offs, squeeze; in reserve_space() local 125 if (wbuf->lnum != -1 && avail >= len) in reserve_space() 132 lnum = ubifs_find_free_space(c, len, &offs, squeeze); in reserve_space() 133 if (lnum >= 0) in reserve_space() 136 err = lnum; in reserve_space() 148 lnum = ubifs_garbage_collect(c, 0); in reserve_space() 149 if (lnum < 0) { in reserve_space() 150 err = lnum; in reserve_space() 172 dbg_jnl("got LEB %d for jhead %s", lnum, dbg_jhead(jhead)); in reserve_space() 175 if (wbuf->lnum != -1 && avail >= len) { in reserve_space() [all …]
|
D | ubifs.h | 281 int lnum; member 322 int lnum; member 341 int lnum; member 436 int lnum; member 482 int lnum; member 589 int lnum; member 686 int lnum; member 692 int (*sync_callback)(struct ubifs_info *c, int lnum, int free, int pad); 711 int lnum; member 746 int lnum; member [all …]
|
D | misc.h | 173 static inline int ubifs_add_dirt(struct ubifs_info *c, int lnum, int dirty) in ubifs_add_dirt() argument 175 return ubifs_update_one_lp(c, lnum, LPROPS_NC, dirty, 0, 0); in ubifs_add_dirt() 187 static inline int ubifs_return_leb(struct ubifs_info *c, int lnum) in ubifs_return_leb() argument 189 return ubifs_change_one_lp(c, lnum, LPROPS_NC, LPROPS_NC, 0, in ubifs_return_leb() 281 static inline int ubifs_next_log_lnum(const struct ubifs_info *c, int lnum) in ubifs_next_log_lnum() argument 283 lnum += 1; in ubifs_next_log_lnum() 284 if (lnum > c->log_last) in ubifs_next_log_lnum() 285 lnum = UBIFS_LOG_LNUM; in ubifs_next_log_lnum() 287 return lnum; in ubifs_next_log_lnum()
|
D | sb.c | 283 br->lnum = cpu_to_le32(main_first + DEFAULT_DATA_LEB); in create_default_filesystem() 704 static int fixup_leb(struct ubifs_info *c, int lnum, int len) in fixup_leb() argument 713 dbg_mnt("unmap empty LEB %d", lnum); in fixup_leb() 714 return ubifs_leb_unmap(c, lnum); in fixup_leb() 717 dbg_mnt("fixup LEB %d, data len %d", lnum, len); in fixup_leb() 718 err = ubifs_leb_read(c, lnum, c->sbuf, 0, len, 1); in fixup_leb() 722 return ubifs_leb_change(c, lnum, c->sbuf, len); in fixup_leb() 734 int lnum, err = 0; in fixup_free_space() local 740 for (lnum = UBIFS_MST_LNUM; lnum < UBIFS_LOG_LNUM; lnum++) { in fixup_free_space() 741 err = fixup_leb(c, lnum, c->mst_offs + c->mst_node_alsz); in fixup_free_space() [all …]
|
D | debug.c | 413 pr_err("\tlnum %u\n", le32_to_cpu(ref->lnum)); in ubifs_dump_node() 520 i, le32_to_cpu(br->lnum), le32_to_cpu(br->offs), in ubifs_dump_node() 625 c->jheads[i].wbuf.lnum); in ubifs_dump_budg() 628 pr_err("\tbud LEB %d\n", bud->lnum); in ubifs_dump_budg() 631 pr_err("\told bud LEB %d\n", bud->lnum); in ubifs_dump_budg() 634 idx_gc->lnum, idx_gc->unmap); in ubifs_dump_budg() 663 lp->lnum, lp->free, lp->dirty, c->leb_size - spc, spc, in ubifs_dump_lprop() 667 lp->lnum, lp->free, lp->dirty, c->leb_size - spc, spc, in ubifs_dump_lprop() 716 if (bud->lnum == lp->lnum) { in ubifs_dump_lprop() 725 lp->lnum == c->jheads[i].wbuf.lnum) { in ubifs_dump_lprop() [all …]
|
D | orphan.c | 346 int lnum; in write_orph_nodes() local 349 for (lnum = c->ohead_lnum + 1; lnum <= c->orph_last; lnum++) { in write_orph_nodes() 350 err = ubifs_leb_unmap(c, lnum); in write_orph_nodes() 491 int lnum, err; in ubifs_clear_orphans() local 493 for (lnum = c->orph_first; lnum <= c->orph_last; lnum++) { in ubifs_clear_orphans() 494 err = ubifs_leb_unmap(c, lnum); in ubifs_clear_orphans() 573 snod->type, sleb->lnum, snod->offs); in do_kill_orphans() 600 cmt_no, sleb->lnum, snod->offs); in do_kill_orphans() 604 dbg_rcvry("out of date LEB %d", sleb->lnum); in do_kill_orphans() 628 cmt_no, sleb->lnum, snod->offs); in do_kill_orphans() [all …]
|
D | master.c | 40 int lnum, offs = 0, nodes_cnt; in scan_for_master() local 42 lnum = UBIFS_MST_LNUM; in scan_for_master() 44 sleb = ubifs_scan(c, lnum, 0, c->sbuf, 1); in scan_for_master() 58 lnum += 1; in scan_for_master() 60 sleb = ubifs_scan(c, lnum, 0, c->sbuf, 1); in scan_for_master() 86 snod->type, lnum, snod->offs); in scan_for_master() 126 if (c->zroot.lnum >= c->leb_cnt || c->zroot.lnum < c->main_first || in validate_master() 282 c->zroot.lnum = le32_to_cpu(c->mst_node->root_lnum); in ubifs_read_master() 361 int err, lnum, offs, len; in ubifs_write_master() local 367 lnum = UBIFS_MST_LNUM; in ubifs_write_master() [all …]
|
D | lprops.c | 507 pos = (lprops->lnum - c->main_first) & (UBIFS_LPT_FANOUT - 1); in is_lprops_dirty() 544 lprops->lnum, free, dirty, flags); in ubifs_change_lp() 560 lprops = ubifs_lpt_lookup_dirty(c, lprops->lnum); in ubifs_change_lp() 564 ubifs_assert(c, lprops == ubifs_lpt_lookup_dirty(c, lprops->lnum)); in ubifs_change_lp() 661 int ubifs_change_one_lp(struct ubifs_info *c, int lnum, int free, int dirty, in ubifs_change_one_lp() argument 669 lp = ubifs_lpt_lookup_dirty(c, lnum); in ubifs_change_one_lp() 684 lnum, err); in ubifs_change_one_lp() 700 int ubifs_update_one_lp(struct ubifs_info *c, int lnum, int free, int dirty, in ubifs_update_one_lp() argument 708 lp = ubifs_lpt_lookup_dirty(c, lnum); in ubifs_update_one_lp() 723 lnum, err); in ubifs_update_one_lp() [all …]
|
D | tnc_misc.c | 279 static int read_znode(struct ubifs_info *c, int lnum, int offs, int len, in read_znode() argument 289 err = ubifs_read_node(c, idx, UBIFS_IDX_NODE, len, lnum, offs); in read_znode() 299 lnum, offs, znode->level, znode->child_cnt); in read_znode() 315 zbr->lnum = le32_to_cpu(br->lnum); in read_znode() 322 if (zbr->lnum < c->main_first || in read_znode() 323 zbr->lnum >= c->leb_cnt || zbr->offs < 0 || in read_znode() 395 ubifs_err(c, "bad indexing node at LEB %d:%d, error %d", lnum, offs, err); in read_znode() 428 err = read_znode(c, zbr->lnum, zbr->offs, zbr->len, znode); in ubifs_load_znode() 475 wbuf = ubifs_get_wbuf(c, zbr->lnum); in ubifs_tnc_read_node() 478 zbr->lnum, zbr->offs); in ubifs_tnc_read_node() [all …]
|
/Linux-v4.19/drivers/mtd/ubi/ |
D | eba.c | 120 void ubi_eba_get_ldesc(struct ubi_volume *vol, int lnum, in ubi_eba_get_ldesc() argument 123 ldesc->lnum = lnum; in ubi_eba_get_ldesc() 124 ldesc->pnum = vol->eba_tbl->entries[lnum].pnum; in ubi_eba_get_ldesc() 225 int lnum) in ltree_lookup() argument 240 if (lnum < le->lnum) in ltree_lookup() 242 else if (lnum > le->lnum) in ltree_lookup() 264 int vol_id, int lnum) in ltree_add_entry() argument 275 le->lnum = lnum; in ltree_add_entry() 278 le1 = ltree_lookup(ubi, vol_id, lnum); in ltree_add_entry() 306 ubi_assert(lnum != le1->lnum); in ltree_add_entry() [all …]
|
D | kapi.c | 381 static int leb_read_sanity_check(struct ubi_volume_desc *desc, int lnum, in leb_read_sanity_check() argument 388 if (vol_id < 0 || vol_id >= ubi->vtbl_slots || lnum < 0 || in leb_read_sanity_check() 389 lnum >= vol->used_ebs || offset < 0 || len < 0 || in leb_read_sanity_check() 397 if (lnum == vol->used_ebs - 1 && in leb_read_sanity_check() 435 int ubi_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset, in ubi_leb_read() argument 442 dbg_gen("read %d bytes from LEB %d:%d:%d", len, vol_id, lnum, offset); in ubi_leb_read() 444 err = leb_read_sanity_check(desc, lnum, offset, len); in ubi_leb_read() 451 err = ubi_eba_read_leb(ubi, vol, lnum, buf, offset, len, check); in ubi_leb_read() 475 int ubi_leb_read_sg(struct ubi_volume_desc *desc, int lnum, struct ubi_sgl *sgl, in ubi_leb_read_sg() argument 482 dbg_gen("read %d bytes from LEB %d:%d:%d", len, vol_id, lnum, offset); in ubi_leb_read_sg() [all …]
|
D | upd.c | 187 vol->vol_id, req->lnum, req->bytes); in ubi_start_leb_change() 189 return ubi_eba_atomic_leb_change(ubi, vol, req->lnum, NULL, 0); in ubi_start_leb_change() 194 vol->ch_lnum = req->lnum; in ubi_start_leb_change() 232 static int write_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum, in write_leb() argument 247 err = ubi_eba_write_leb(ubi, vol, lnum, buf, 0, len); in write_leb() 259 err = ubi_eba_write_leb_st(ubi, vol, lnum, buf, len, used_ebs); in write_leb() 281 int lnum, offs, err = 0, len, to_write = count; in ubi_more_update_data() local 289 lnum = div_u64_rem(vol->upd_received, vol->usable_leb_size, &offs); in ubi_more_update_data() 322 err = write_leb(ubi, vol, lnum, vol->upd_buf, flush_len, in ubi_more_update_data() 331 lnum += 1; in ubi_more_update_data() [all …]
|
D | gluebi.c | 169 int err = 0, lnum, offs, bytes_left; in gluebi_read() local 173 lnum = div_u64_rem(from, mtd->erasesize, &offs); in gluebi_read() 181 err = ubi_read(gluebi->desc, lnum, buf, offs, to_read); in gluebi_read() 185 lnum += 1; in gluebi_read() 209 int err = 0, lnum, offs, bytes_left; in gluebi_write() local 213 lnum = div_u64_rem(to, mtd->erasesize, &offs); in gluebi_write() 225 err = ubi_leb_write(gluebi->desc, lnum, buf, offs, to_write); in gluebi_write() 229 lnum += 1; in gluebi_write() 249 int err, i, lnum, count; in gluebi_erase() local 255 lnum = mtd_div_by_eb(instr->addr, mtd); in gluebi_erase() [all …]
|
/Linux-v4.19/include/linux/mtd/ |
D | ubi.h | 250 int ubi_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset, 252 int ubi_leb_read_sg(struct ubi_volume_desc *desc, int lnum, struct ubi_sgl *sgl, 254 int ubi_leb_write(struct ubi_volume_desc *desc, int lnum, const void *buf, 256 int ubi_leb_change(struct ubi_volume_desc *desc, int lnum, const void *buf, 258 int ubi_leb_erase(struct ubi_volume_desc *desc, int lnum); 259 int ubi_leb_unmap(struct ubi_volume_desc *desc, int lnum); 260 int ubi_leb_map(struct ubi_volume_desc *desc, int lnum); 261 int ubi_is_mapped(struct ubi_volume_desc *desc, int lnum); 263 int ubi_flush(int ubi_num, int vol_id, int lnum); 269 static inline int ubi_read(struct ubi_volume_desc *desc, int lnum, char *buf, in ubi_read() argument [all …]
|