/fs/ubifs/ |
D | master.c | 36 static int scan_for_master(struct ubifs_info *c) in scan_for_master() argument 44 sleb = ubifs_scan(c, lnum, 0, c->sbuf, 1); in scan_for_master() 53 memcpy(c->mst_node, snod->node, snod->len); in scan_for_master() 60 sleb = ubifs_scan(c, lnum, 0, c->sbuf, 1); in scan_for_master() 72 if (memcmp((void *)c->mst_node + UBIFS_CH_SZ, in scan_for_master() 76 c->mst_offs = offs; in scan_for_master() 98 static int validate_master(const struct ubifs_info *c) in validate_master() argument 103 if (c->max_sqnum >= SQNUM_WATERMARK) { in validate_master() 108 if (c->cmt_no >= c->max_sqnum) { in validate_master() 113 if (c->highest_inum >= INUM_WATERMARK) { in validate_master() [all …]
|
D | super.c | 67 static int validate_inode(struct ubifs_info *c, const struct inode *inode) in validate_inode() argument 72 if (inode->i_size > c->max_inode_sz) { in validate_inode() 97 err = dbg_check_dir(c, inode); in validate_inode() 106 struct ubifs_info *c = sb->s_fs_info; in ubifs_iget() local 125 ino_key_init(c, &key, inode->i_ino); in ubifs_iget() 127 err = ubifs_tnc_lookup(c, &key, ino); in ubifs_iget() 155 err = validate_inode(c, inode); in ubifs_iget() 160 inode->i_mapping->backing_dev_info = &c->bdi; in ubifs_iget() 249 ubifs_dump_node(c, ino); in ubifs_iget() 250 ubifs_dump_inode(c, inode); in ubifs_iget() [all …]
|
D | lpt_commit.c | 33 static int dbg_populate_lsave(struct ubifs_info *c); 99 static int get_cnodes_to_commit(struct ubifs_info *c) in get_cnodes_to_commit() argument 104 if (!c->nroot) in get_cnodes_to_commit() 107 if (!test_bit(DIRTY_CNODE, &c->nroot->flags)) in get_cnodes_to_commit() 110 c->lpt_cnext = first_dirty_cnode(c->nroot); in get_cnodes_to_commit() 111 cnode = c->lpt_cnext; in get_cnodes_to_commit() 120 cnode->cnext = c->lpt_cnext; in get_cnodes_to_commit() 129 ubifs_assert(cnt == c->dirty_nn_cnt + c->dirty_pn_cnt); in get_cnodes_to_commit() 140 static void upd_ltab(struct ubifs_info *c, int lnum, int free, int dirty) in upd_ltab() argument 143 lnum, c->ltab[lnum - c->lpt_first].free, in upd_ltab() [all …]
|
D | sb.c | 73 static int create_default_filesystem(struct ubifs_info *c) in create_default_filesystem() argument 89 c->key_len = UBIFS_SK_LEN; in create_default_filesystem() 95 if (c->leb_cnt < 0x7FFFFFFF / DEFAULT_JNL_PERCENT) in create_default_filesystem() 97 jnl_lebs = c->leb_cnt * DEFAULT_JNL_PERCENT / 100; in create_default_filesystem() 99 jnl_lebs = (c->leb_cnt / 100) * DEFAULT_JNL_PERCENT; in create_default_filesystem() 103 if (jnl_lebs * c->leb_size > DEFAULT_MAX_JNL) in create_default_filesystem() 104 jnl_lebs = DEFAULT_MAX_JNL / c->leb_size; in create_default_filesystem() 112 tmp = 2 * (c->ref_node_alsz * jnl_lebs) + c->leb_size - 1; in create_default_filesystem() 113 log_lebs = tmp / c->leb_size; in create_default_filesystem() 116 if (c->leb_cnt - min_leb_cnt > 8) { in create_default_filesystem() [all …]
|
D | commit.c | 68 static int nothing_to_commit(struct ubifs_info *c) in nothing_to_commit() argument 74 if (c->mounting || c->remounting_rw) in nothing_to_commit() 81 if (c->zroot.znode && ubifs_zn_dirty(c->zroot.znode)) in nothing_to_commit() 91 if (c->nroot && test_bit(DIRTY_CNODE, &c->nroot->flags)) in nothing_to_commit() 94 ubifs_assert(atomic_long_read(&c->dirty_zn_cnt) == 0); in nothing_to_commit() 95 ubifs_assert(c->dirty_pn_cnt == 0); in nothing_to_commit() 96 ubifs_assert(c->dirty_nn_cnt == 0); in nothing_to_commit() 109 static int do_commit(struct ubifs_info *c) in do_commit() argument 116 ubifs_assert(!c->ro_media && !c->ro_mount); in do_commit() 118 if (c->ro_error) { in do_commit() [all …]
|
D | log.c | 32 static int dbg_check_bud_bytes(struct ubifs_info *c); 42 struct ubifs_bud *ubifs_search_bud(struct ubifs_info *c, int lnum) in ubifs_search_bud() argument 47 spin_lock(&c->buds_lock); in ubifs_search_bud() 48 p = c->buds.rb_node; in ubifs_search_bud() 56 spin_unlock(&c->buds_lock); in ubifs_search_bud() 60 spin_unlock(&c->buds_lock); in ubifs_search_bud() 71 struct ubifs_wbuf *ubifs_get_wbuf(struct ubifs_info *c, int lnum) in ubifs_get_wbuf() argument 77 if (!c->jheads) in ubifs_get_wbuf() 80 spin_lock(&c->buds_lock); in ubifs_get_wbuf() 81 p = c->buds.rb_node; in ubifs_get_wbuf() [all …]
|
D | budget.c | 63 static void shrink_liability(struct ubifs_info *c, int nr_to_write) in shrink_liability() argument 65 down_read(&c->vfs_sb->s_umount); in shrink_liability() 66 writeback_inodes_sb(c->vfs_sb, WB_REASON_FS_FREE_SPACE); in shrink_liability() 67 up_read(&c->vfs_sb->s_umount); in shrink_liability() 78 static int run_gc(struct ubifs_info *c) in run_gc() argument 83 down_read(&c->commit_sem); in run_gc() 84 lnum = ubifs_garbage_collect(c, 1); in run_gc() 85 up_read(&c->commit_sem); in run_gc() 91 err = ubifs_return_leb(c, lnum); in run_gc() 104 static long long get_liability(struct ubifs_info *c) in get_liability() argument [all …]
|
D | lpt.c | 58 static void do_calc_lpt_geom(struct ubifs_info *c) in do_calc_lpt_geom() argument 63 n = c->main_lebs + c->max_leb_cnt - c->leb_cnt; in do_calc_lpt_geom() 66 c->lpt_hght = 1; in do_calc_lpt_geom() 69 c->lpt_hght += 1; in do_calc_lpt_geom() 73 c->pnode_cnt = DIV_ROUND_UP(c->main_lebs, UBIFS_LPT_FANOUT); in do_calc_lpt_geom() 75 n = DIV_ROUND_UP(c->pnode_cnt, UBIFS_LPT_FANOUT); in do_calc_lpt_geom() 76 c->nnode_cnt = n; in do_calc_lpt_geom() 77 for (i = 1; i < c->lpt_hght; i++) { in do_calc_lpt_geom() 79 c->nnode_cnt += n; in do_calc_lpt_geom() 82 c->space_bits = fls(c->leb_size) - 3; in do_calc_lpt_geom() [all …]
|
D | tnc_commit.c | 37 static int make_idx_node(struct ubifs_info *c, struct ubifs_idx_node *idx, in make_idx_node() argument 48 struct ubifs_branch *br = ubifs_idx_branch(c, idx, i); in make_idx_node() 51 key_write_idx(c, &zbr->key, &br->key); in make_idx_node() 57 ubifs_dump_znode(c, znode); in make_idx_node() 59 ubifs_dump_znode(c, zbr->znode); in make_idx_node() 62 ubifs_prepare_node(c, idx, len, 0); in make_idx_node() 68 err = insert_old_idx_znode(c, znode); in make_idx_node() 80 c->zroot.lnum = lnum; in make_idx_node() 81 c->zroot.offs = offs; in make_idx_node() 82 c->zroot.len = len; in make_idx_node() [all …]
|
D | orphan.c | 55 static int dbg_check_orphans(struct ubifs_info *c); 65 int ubifs_add_orphan(struct ubifs_info *c, ino_t inum) in ubifs_add_orphan() argument 76 spin_lock(&c->orphan_lock); in ubifs_add_orphan() 77 if (c->tot_orphans >= c->max_orphans) { in ubifs_add_orphan() 78 spin_unlock(&c->orphan_lock); in ubifs_add_orphan() 82 p = &c->orph_tree.rb_node; in ubifs_add_orphan() 92 spin_unlock(&c->orphan_lock); in ubifs_add_orphan() 97 c->tot_orphans += 1; in ubifs_add_orphan() 98 c->new_orphans += 1; in ubifs_add_orphan() 100 rb_insert_color(&orphan->rb, &c->orph_tree); in ubifs_add_orphan() [all …]
|
D | find.c | 54 static int valuable(struct ubifs_info *c, const struct ubifs_lprops *lprops) in valuable() argument 63 heap = &c->lpt_heap[cat - 1]; in valuable() 66 if (lprops->free + lprops->dirty >= c->dark_wm) in valuable() 70 n = c->lst.empty_lebs + c->freeable_cnt - in valuable() 71 c->lst.taken_empty_lebs; in valuable() 72 if (n < c->lsave_cnt) in valuable() 95 static int scan_for_dirty_cb(struct ubifs_info *c, in scan_for_dirty_cb() argument 105 if (!in_tree && valuable(c, lprops)) in scan_for_dirty_cb() 114 if (lprops->free + lprops->dirty == c->leb_size) { in scan_for_dirty_cb() 118 } else if (lprops->dirty < c->dead_wm) in scan_for_dirty_cb() [all …]
|
D | lprops.c | 62 static void move_up_lpt_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, in move_up_lpt_heap() argument 99 static void adjust_lpt_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, in adjust_lpt_heap() argument 178 static int add_to_lpt_heap(struct ubifs_info *c, struct ubifs_lprops *lprops, in add_to_lpt_heap() argument 181 struct ubifs_lpt_heap *heap = &c->lpt_heap[cat - 1]; in add_to_lpt_heap() 202 list_add(&lp->list, &c->uncat_list); in add_to_lpt_heap() 205 move_up_lpt_heap(c, heap, lprops, cat); in add_to_lpt_heap() 206 dbg_check_heap(c, heap, cat, lprops->hpos); in add_to_lpt_heap() 209 dbg_check_heap(c, heap, cat, -1); in add_to_lpt_heap() 214 move_up_lpt_heap(c, heap, lprops, cat); in add_to_lpt_heap() 215 dbg_check_heap(c, heap, cat, lprops->hpos); in add_to_lpt_heap() [all …]
|
D | io.c | 82 void ubifs_ro_mode(struct ubifs_info *c, int err) in ubifs_ro_mode() argument 84 if (!c->ro_error) { in ubifs_ro_mode() 85 c->ro_error = 1; in ubifs_ro_mode() 86 c->no_chk_data_crc = 0; in ubifs_ro_mode() 87 c->vfs_sb->s_flags |= MS_RDONLY; in ubifs_ro_mode() 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() 117 int ubifs_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs, in ubifs_leb_write() argument 122 ubifs_assert(!c->ro_media && !c->ro_mount); in ubifs_leb_write() 123 if (c->ro_error) in ubifs_leb_write() [all …]
|
D | replay.c | 97 static int set_bud_lprops(struct ubifs_info *c, struct bud_entry *b) in set_bud_lprops() argument 102 ubifs_get_lprops(c); in set_bud_lprops() 104 lp = ubifs_lpt_lookup_dirty(c, b->bud->lnum); in set_bud_lprops() 111 if (b->bud->start == 0 && (lp->free != c->leb_size || lp->dirty != 0)) { in set_bud_lprops() 135 dirty -= c->leb_size - lp->free; in set_bud_lprops() 148 lp = ubifs_change_lp(c, lp, b->free, dirty + b->dirty, in set_bud_lprops() 156 err = ubifs_wbuf_seek_nolock(&c->jheads[b->bud->jhead].wbuf, in set_bud_lprops() 157 b->bud->lnum, c->leb_size - b->free); in set_bud_lprops() 160 ubifs_release_lprops(c); in set_bud_lprops() 171 static int set_buds_lprops(struct ubifs_info *c) in set_buds_lprops() argument [all …]
|
D | tnc.c | 77 static int insert_old_idx(struct ubifs_info *c, int lnum, int offs) in insert_old_idx() argument 88 p = &c->old_idx.rb_node; in insert_old_idx() 107 rb_insert_color(&old_idx->rb, &c->old_idx); in insert_old_idx() 118 int insert_old_idx_znode(struct ubifs_info *c, struct ubifs_znode *znode) in insert_old_idx_znode() argument 125 return insert_old_idx(c, zbr->lnum, zbr->offs); in insert_old_idx_znode() 127 if (c->zroot.len) in insert_old_idx_znode() 128 return insert_old_idx(c, c->zroot.lnum, in insert_old_idx_znode() 129 c->zroot.offs); in insert_old_idx_znode() 140 static int ins_clr_old_idx_znode(struct ubifs_info *c, in ins_clr_old_idx_znode() argument 150 err = insert_old_idx(c, zbr->lnum, zbr->offs); in ins_clr_old_idx_znode() [all …]
|
D | gc.c | 81 static int switch_gc_head(struct ubifs_info *c) in switch_gc_head() argument 83 int err, gc_lnum = c->gc_lnum; in switch_gc_head() 84 struct ubifs_wbuf *wbuf = &c->jheads[GCHD].wbuf; in switch_gc_head() 89 c->leb_size - wbuf->offs - wbuf->used); in switch_gc_head() 99 err = ubifs_leb_unmap(c, gc_lnum); in switch_gc_head() 107 err = ubifs_add_bud_to_log(c, GCHD, gc_lnum, 0); in switch_gc_head() 111 c->gc_lnum = -1; in switch_gc_head() 128 struct ubifs_info *c = priv; in data_nodes_cmp() local 138 ubifs_assert(key_type(c, &sa->key) == UBIFS_DATA_KEY); in data_nodes_cmp() 139 ubifs_assert(key_type(c, &sb->key) == UBIFS_DATA_KEY); in data_nodes_cmp() [all …]
|
D | recovery.c | 109 static int get_master_node(const struct ubifs_info *c, int lnum, void **pbuf, in get_master_node() argument 112 const int sz = c->mst_node_alsz; in get_master_node() 116 sbuf = vmalloc(c->leb_size); in get_master_node() 120 err = ubifs_leb_read(c, lnum, sbuf, 0, c->leb_size, 0); in get_master_node() 127 len = c->leb_size; in get_master_node() 128 while (offs + UBIFS_MST_NODE_SZ <= c->leb_size) { 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() 172 if (offs < c->leb_size) { in get_master_node() 182 if (offs < c->leb_size) in get_master_node() [all …]
|
D | ubifs.h | 58 #define ubifs_errc(c, fmt, ...) \ argument 60 if (!(c)->probing) \ 646 typedef int (*ubifs_lpt_scan_callback)(struct ubifs_info *c, 685 struct ubifs_info *c; member 693 int (*sync_callback)(struct ubifs_info *c, int lnum, int free, int pad); 1478 void ubifs_ro_mode(struct ubifs_info *c, int err); 1479 int ubifs_leb_read(const struct ubifs_info *c, int lnum, void *buf, int offs, 1481 int ubifs_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs, 1483 int ubifs_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len); 1484 int ubifs_leb_unmap(struct ubifs_info *c, int lnum); [all …]
|
D | debug.h | 27 typedef int (*dbg_leaf_callback)(struct ubifs_info *c, 29 typedef int (*dbg_znode_callback)(struct ubifs_info *c, 159 #define ubifs_assert_cmt_locked(c) do { \ argument 160 if (unlikely(down_write_trylock(&(c)->commit_sem))) { \ 161 up_write(&(c)->commit_sem); \ 176 dbg_snprintf_key(c, key, __tmp_key_buf, DBG_KEY_BUF_LEN)); \ 214 static inline int dbg_is_chk_gen(const struct ubifs_info *c) in dbg_is_chk_gen() argument 216 return !!(ubifs_dbg.chk_gen || c->dbg->chk_gen); in dbg_is_chk_gen() 218 static inline int dbg_is_chk_index(const struct ubifs_info *c) in dbg_is_chk_index() argument 220 return !!(ubifs_dbg.chk_index || c->dbg->chk_index); in dbg_is_chk_index() [all …]
|
/fs/jffs2/ |
D | wbuf.c | 35 #define PAGE_DIV(x) ( ((unsigned long)(x) / (unsigned long)(c->wbuf_pagesize)) * (unsigned long)(c-… 36 #define PAGE_MOD(x) ( (unsigned long)(x) % (unsigned long)(c->wbuf_pagesize) ) 48 static int jffs2_wbuf_pending_for_ino(struct jffs2_sb_info *c, uint32_t ino) in jffs2_wbuf_pending_for_ino() argument 50 struct jffs2_inodirty *this = c->wbuf_inodes; in jffs2_wbuf_pending_for_ino() 69 static void jffs2_clear_wbuf_ino_list(struct jffs2_sb_info *c) in jffs2_clear_wbuf_ino_list() argument 73 this = c->wbuf_inodes; in jffs2_clear_wbuf_ino_list() 82 c->wbuf_inodes = NULL; in jffs2_clear_wbuf_ino_list() 85 static void jffs2_wbuf_dirties_inode(struct jffs2_sb_info *c, uint32_t ino) in jffs2_wbuf_dirties_inode() argument 90 jffs2_dirty_trigger(c); in jffs2_wbuf_dirties_inode() 92 if (jffs2_wbuf_pending_for_ino(c, ino)) in jffs2_wbuf_dirties_inode() [all …]
|
D | nodemgmt.c | 24 static int jffs2_rp_can_write(struct jffs2_sb_info *c) in jffs2_rp_can_write() argument 27 struct jffs2_mount_opts *opts = &c->mount_opts; in jffs2_rp_can_write() 29 avail = c->dirty_size + c->free_size + c->unchecked_size + in jffs2_rp_can_write() 30 c->erasing_size - c->resv_blocks_write * c->sector_size in jffs2_rp_can_write() 31 - c->nospc_dirty_size; in jffs2_rp_can_write() 37 opts->rp_size, c->dirty_size, c->free_size, in jffs2_rp_can_write() 38 c->erasing_size, c->unchecked_size, in jffs2_rp_can_write() 39 c->nr_erasing_blocks, avail, c->nospc_dirty_size); in jffs2_rp_can_write() 71 static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, 74 int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, in jffs2_reserve_space() argument [all …]
|
D | build.c | 26 first_inode_chain(int *i, struct jffs2_sb_info *c) in first_inode_chain() argument 28 for (; *i < c->inocache_hashsize; (*i)++) { in first_inode_chain() 29 if (c->inocache_list[*i]) in first_inode_chain() 30 return c->inocache_list[*i]; in first_inode_chain() 36 next_inode(int *i, struct jffs2_inode_cache *ic, struct jffs2_sb_info *c) in next_inode() argument 42 return first_inode_chain(i, c); in next_inode() 45 #define for_each_inode(i, c, ic) \ argument 46 for (i = 0, ic = first_inode_chain(&i, (c)); \ 48 ic = next_inode(&i, ic, (c))) 51 static void jffs2_build_inode_pass1(struct jffs2_sb_info *c, in jffs2_build_inode_pass1() argument [all …]
|
D | erase.c | 26 struct jffs2_sb_info *c; member 32 static void jffs2_erase_failed(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, uint32_t bad_… 33 static void jffs2_erase_succeeded(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb); 34 static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb); 36 static void jffs2_erase_block(struct jffs2_sb_info *c, in jffs2_erase_block() argument 42 ret = jffs2_flash_erase(c, jeb); in jffs2_erase_block() 44 jffs2_erase_succeeded(c, jeb); in jffs2_erase_block() 53 jeb->offset, jeb->offset, jeb->offset + c->sector_size); in jffs2_erase_block() 57 mutex_lock(&c->erase_free_sem); in jffs2_erase_block() 58 spin_lock(&c->erase_completion_lock); in jffs2_erase_block() [all …]
|
D | os-linux.h | 25 #define OFNI_BS_2SFFJ(c) ((struct super_block *)c->os_priv) argument 62 #define jffs2_is_readonly(c) (OFNI_BS_2SFFJ(c)->s_flags & MS_RDONLY) argument 64 #define SECTOR_ADDR(x) ( (((unsigned long)(x) / c->sector_size) * c->sector_size) ) 69 #define jffs2_can_mark_obsolete(c) (0) argument 71 #define jffs2_can_mark_obsolete(c) (1) argument 74 #define jffs2_is_writebuffered(c) (0) argument 75 #define jffs2_cleanmarker_oob(c) (0) argument 76 #define jffs2_write_nand_cleanmarker(c,jeb) (-EIO) argument 78 #define jffs2_flash_write(c, ofs, len, retlen, buf) jffs2_flash_direct_write(c, ofs, len, retlen, b… argument 79 #define jffs2_flash_read(c, ofs, len, retlen, buf) (mtd_read((c)->mtd, ofs, len, retlen, buf)) argument [all …]
|
D | scan.c | 39 static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, 46 static int jffs2_scan_inode_node(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, 48 static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, 51 static inline int min_free(struct jffs2_sb_info *c) in min_free() argument 55 if (!jffs2_can_mark_obsolete(c) && min < c->wbuf_pagesize) in min_free() 56 return c->wbuf_pagesize; in min_free() 69 static int file_dirty(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb) in file_dirty() argument 73 if ((ret = jffs2_prealloc_raw_node_refs(c, jeb, 1))) in file_dirty() 75 if ((ret = jffs2_scan_dirty_space(c, jeb, jeb->free_size))) in file_dirty() 80 c->dirty_size += jeb->wasted_size; in file_dirty() [all …]
|