/fs/ubifs/ |
D | master.c | 35 static int scan_for_master(struct ubifs_info *c) in scan_for_master() argument 43 sleb = ubifs_scan(c, lnum, 0, c->sbuf); in scan_for_master() 52 memcpy(c->mst_node, snod->node, snod->len); in scan_for_master() 59 sleb = ubifs_scan(c, lnum, 0, c->sbuf); in scan_for_master() 71 if (memcmp((void *)c->mst_node + UBIFS_CH_SZ, in scan_for_master() 75 c->mst_offs = offs; in scan_for_master() 91 static int validate_master(const struct ubifs_info *c) in validate_master() argument 96 if (c->max_sqnum >= SQNUM_WATERMARK) { in validate_master() 101 if (c->cmt_no >= c->max_sqnum) { in validate_master() 106 if (c->highest_inum >= INUM_WATERMARK) { in validate_master() [all …]
|
D | super.c | 66 static int validate_inode(struct ubifs_info *c, const struct inode *inode) in validate_inode() argument 71 if (inode->i_size > c->max_inode_sz) { in validate_inode() 97 err = dbg_check_dir_size(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 dbg_dump_node(c, ino); in ubifs_iget() 250 dbg_dump_inode(c, inode); in ubifs_iget() [all …]
|
D | lpt_commit.c | 95 static int get_cnodes_to_commit(struct ubifs_info *c) in get_cnodes_to_commit() argument 100 if (!c->nroot) in get_cnodes_to_commit() 103 if (!test_bit(DIRTY_CNODE, &c->nroot->flags)) in get_cnodes_to_commit() 106 c->lpt_cnext = first_dirty_cnode(c->nroot); in get_cnodes_to_commit() 107 cnode = c->lpt_cnext; in get_cnodes_to_commit() 116 cnode->cnext = c->lpt_cnext; in get_cnodes_to_commit() 125 ubifs_assert(cnt == c->dirty_nn_cnt + c->dirty_pn_cnt); in get_cnodes_to_commit() 136 static void upd_ltab(struct ubifs_info *c, int lnum, int free, int dirty) in upd_ltab() argument 139 lnum, c->ltab[lnum - c->lpt_first].free, in upd_ltab() 140 c->ltab[lnum - c->lpt_first].dirty, free, dirty); in upd_ltab() [all …]
|
D | sb.c | 72 static int create_default_filesystem(struct ubifs_info *c) in create_default_filesystem() argument 88 c->key_len = UBIFS_SK_LEN; in create_default_filesystem() 94 if (c->leb_cnt < 0x7FFFFFFF / DEFAULT_JNL_PERCENT) in create_default_filesystem() 96 jnl_lebs = c->leb_cnt * DEFAULT_JNL_PERCENT / 100; in create_default_filesystem() 98 jnl_lebs = (c->leb_cnt / 100) * DEFAULT_JNL_PERCENT; in create_default_filesystem() 102 if (jnl_lebs * c->leb_size > DEFAULT_MAX_JNL) in create_default_filesystem() 103 jnl_lebs = DEFAULT_MAX_JNL / c->leb_size; in create_default_filesystem() 111 tmp = 2 * (c->ref_node_alsz * jnl_lebs) + c->leb_size - 1; in create_default_filesystem() 112 log_lebs = tmp / c->leb_size; in create_default_filesystem() 115 if (c->leb_cnt - min_leb_cnt > 8) { in create_default_filesystem() [all …]
|
D | budget.c | 65 static int shrink_liability(struct ubifs_info *c, int nr_to_write) in shrink_liability() argument 74 generic_sync_sb_inodes(c->vfs_sb, &wbc); in shrink_liability() 86 generic_sync_sb_inodes(c->vfs_sb, &wbc); in shrink_liability() 103 static int run_gc(struct ubifs_info *c) in run_gc() argument 108 down_read(&c->commit_sem); in run_gc() 109 lnum = ubifs_garbage_collect(c, 1); in run_gc() 110 up_read(&c->commit_sem); in run_gc() 116 err = ubifs_return_leb(c, lnum); in run_gc() 129 static long long get_liability(struct ubifs_info *c) in get_liability() argument 133 spin_lock(&c->space_lock); in get_liability() [all …]
|
D | commit.c | 58 static int do_commit(struct ubifs_info *c) in do_commit() argument 65 if (c->ro_media) { in do_commit() 71 for (i = 0; i < c->jhead_cnt; i++) { in do_commit() 72 err = ubifs_wbuf_sync(&c->jheads[i].wbuf); in do_commit() 77 c->cmt_no += 1; in do_commit() 78 err = ubifs_gc_start_commit(c); in do_commit() 81 err = dbg_check_lprops(c); in do_commit() 84 err = ubifs_log_start_commit(c, &new_ltail_lnum); in do_commit() 87 err = ubifs_tnc_start_commit(c, &zroot); in do_commit() 90 err = ubifs_lpt_start_commit(c); in do_commit() [all …]
|
D | log.c | 33 static int dbg_check_bud_bytes(struct ubifs_info *c); 35 #define dbg_check_bud_bytes(c) 0 argument 46 struct ubifs_bud *ubifs_search_bud(struct ubifs_info *c, int lnum) in ubifs_search_bud() argument 51 spin_lock(&c->buds_lock); in ubifs_search_bud() 52 p = c->buds.rb_node; in ubifs_search_bud() 60 spin_unlock(&c->buds_lock); in ubifs_search_bud() 64 spin_unlock(&c->buds_lock); in ubifs_search_bud() 75 struct ubifs_wbuf *ubifs_get_wbuf(struct ubifs_info *c, int lnum) in ubifs_get_wbuf() argument 81 if (!c->jheads) in ubifs_get_wbuf() 84 spin_lock(&c->buds_lock); in ubifs_get_wbuf() [all …]
|
D | lpt.c | 57 static void do_calc_lpt_geom(struct ubifs_info *c) in do_calc_lpt_geom() argument 62 n = c->main_lebs + c->max_leb_cnt - c->leb_cnt; in do_calc_lpt_geom() 65 c->lpt_hght = 1; in do_calc_lpt_geom() 68 c->lpt_hght += 1; in do_calc_lpt_geom() 72 c->pnode_cnt = DIV_ROUND_UP(c->main_lebs, UBIFS_LPT_FANOUT); in do_calc_lpt_geom() 74 n = DIV_ROUND_UP(c->pnode_cnt, UBIFS_LPT_FANOUT); in do_calc_lpt_geom() 75 c->nnode_cnt = n; in do_calc_lpt_geom() 76 for (i = 1; i < c->lpt_hght; i++) { in do_calc_lpt_geom() 78 c->nnode_cnt += n; in do_calc_lpt_geom() 81 c->space_bits = fls(c->leb_size) - 3; in do_calc_lpt_geom() [all …]
|
D | orphan.c | 56 static int dbg_check_orphans(struct ubifs_info *c); 58 #define dbg_check_orphans(c) 0 argument 69 int ubifs_add_orphan(struct ubifs_info *c, ino_t inum) in ubifs_add_orphan() argument 80 spin_lock(&c->orphan_lock); in ubifs_add_orphan() 81 if (c->tot_orphans >= c->max_orphans) { in ubifs_add_orphan() 82 spin_unlock(&c->orphan_lock); in ubifs_add_orphan() 86 p = &c->orph_tree.rb_node; in ubifs_add_orphan() 96 spin_unlock(&c->orphan_lock); in ubifs_add_orphan() 101 c->tot_orphans += 1; in ubifs_add_orphan() 102 c->new_orphans += 1; in ubifs_add_orphan() [all …]
|
D | tnc_commit.c | 36 static int make_idx_node(struct ubifs_info *c, struct ubifs_idx_node *idx, in make_idx_node() argument 47 struct ubifs_branch *br = ubifs_idx_branch(c, idx, i); in make_idx_node() 50 key_write_idx(c, &zbr->key, &br->key); in make_idx_node() 56 dbg_dump_znode(c, znode); in make_idx_node() 58 dbg_dump_znode(c, zbr->znode); in make_idx_node() 61 ubifs_prepare_node(c, idx, len, 0); in make_idx_node() 69 err = insert_old_idx_znode(c, znode); in make_idx_node() 81 c->zroot.lnum = lnum; in make_idx_node() 82 c->zroot.offs = offs; in make_idx_node() 83 c->zroot.len = len; in make_idx_node() [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 | replay.c | 106 static int set_bud_lprops(struct ubifs_info *c, struct replay_entry *r) in set_bud_lprops() argument 111 ubifs_get_lprops(c); in set_bud_lprops() 113 lp = ubifs_lpt_lookup_dirty(c, r->lnum); in set_bud_lprops() 120 if (r->offs == 0 && (lp->free != c->leb_size || lp->dirty != 0)) { in set_bud_lprops() 143 dirty -= c->leb_size - lp->free; in set_bud_lprops() 156 lp = ubifs_change_lp(c, lp, r->free, dirty + r->dirty, in set_bud_lprops() 163 ubifs_release_lprops(c); in set_bud_lprops() 172 static int trun_remove_range(struct ubifs_info *c, struct replay_entry *r) in trun_remove_range() argument 186 ino = key_inum(c, &r->key); in trun_remove_range() 188 data_key_init(c, &min_key, ino, min_blk); in trun_remove_range() [all …]
|
D | recovery.c | 72 static int get_master_node(const struct ubifs_info *c, int lnum, void **pbuf, in get_master_node() argument 75 const int sz = c->mst_node_alsz; in get_master_node() 79 sbuf = vmalloc(c->leb_size); in get_master_node() 83 err = ubi_read(c->ubi, lnum, sbuf, 0, c->leb_size); in get_master_node() 90 len = c->leb_size; in get_master_node() 91 while (offs + UBIFS_MST_NODE_SZ <= c->leb_size) { in get_master_node() 107 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1); in get_master_node() 113 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1); in get_master_node() 135 if (offs < c->leb_size) { in get_master_node() 145 if (offs < c->leb_size) in get_master_node() [all …]
|
D | tnc.c | 76 static int insert_old_idx(struct ubifs_info *c, int lnum, int offs) in insert_old_idx() argument 87 p = &c->old_idx.rb_node; in insert_old_idx() 106 rb_insert_color(&old_idx->rb, &c->old_idx); in insert_old_idx() 117 int insert_old_idx_znode(struct ubifs_info *c, struct ubifs_znode *znode) in insert_old_idx_znode() argument 124 return insert_old_idx(c, zbr->lnum, zbr->offs); in insert_old_idx_znode() 126 if (c->zroot.len) in insert_old_idx_znode() 127 return insert_old_idx(c, c->zroot.lnum, in insert_old_idx_znode() 128 c->zroot.offs); in insert_old_idx_znode() 139 static int ins_clr_old_idx_znode(struct ubifs_info *c, in ins_clr_old_idx_znode() argument 149 err = insert_old_idx(c, zbr->lnum, zbr->offs); in ins_clr_old_idx_znode() [all …]
|
D | debug.h | 92 #define ubifs_assert_cmt_locked(c) do { \ argument 93 if (unlikely(down_write_trylock(&(c)->commit_sem))) { \ 94 up_write(&(c)->commit_sem); \ 124 const char *dbg_key_str0(const struct ubifs_info *c, 126 const char *dbg_key_str1(const struct ubifs_info *c, 133 #define DBGKEY(key) dbg_key_str0(c, (key)) 134 #define DBGKEY1(key) dbg_key_str1(c, (key)) 268 int ubifs_debugging_init(struct ubifs_info *c); 269 void ubifs_debugging_exit(struct ubifs_info *c); 274 const char *dbg_get_key_dump(const struct ubifs_info *c, [all …]
|
D | gc.c | 87 static int switch_gc_head(struct ubifs_info *c) in switch_gc_head() argument 89 int err, gc_lnum = c->gc_lnum; in switch_gc_head() 90 struct ubifs_wbuf *wbuf = &c->jheads[GCHD].wbuf; in switch_gc_head() 95 c->leb_size - wbuf->offs - wbuf->used); in switch_gc_head() 105 err = ubifs_leb_unmap(c, gc_lnum); in switch_gc_head() 109 err = ubifs_add_bud_to_log(c, GCHD, gc_lnum, 0); in switch_gc_head() 113 c->gc_lnum = -1; in switch_gc_head() 131 static int joinup(struct ubifs_info *c, struct ubifs_scan_leb *sleb, ino_t inum, in joinup() argument 140 if (key_inum(c, key) == inum && in joinup() 141 key_type(c, key) == UBIFS_DATA_KEY && in joinup() [all …]
|
D | ubifs.h | 633 typedef int (*ubifs_lpt_scan_callback)(struct ubifs_info *c, 670 struct ubifs_info *c; member 678 int (*sync_callback)(struct ubifs_info *c, int lnum, int free, int pad); 1417 void ubifs_ro_mode(struct ubifs_info *c, int err); 1421 int ubifs_wbuf_init(struct ubifs_info *c, struct ubifs_wbuf *wbuf); 1422 int ubifs_read_node(const struct ubifs_info *c, void *buf, int type, int len, 1426 int ubifs_write_node(struct ubifs_info *c, void *node, int len, int lnum, 1428 int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum, 1430 void ubifs_prepare_node(struct ubifs_info *c, void *buf, int len, int pad); 1431 void ubifs_prep_grp_node(struct ubifs_info *c, void *node, int len, int last); [all …]
|
D | journal.c | 115 static int reserve_space(struct ubifs_info *c, int jhead, int len) in reserve_space() argument 118 struct ubifs_wbuf *wbuf = &c->jheads[jhead].wbuf; in reserve_space() 129 if (c->ro_media) { in reserve_space() 134 avail = c->leb_size - wbuf->offs - wbuf->used; in reserve_space() 142 lnum = ubifs_find_free_space(c, len, &free, squeeze); in reserve_space() 145 offs = c->leb_size - free; in reserve_space() 146 err = ubifs_add_bud_to_log(c, jhead, lnum, offs); in reserve_space() 165 lnum = ubifs_garbage_collect(c, 0); in reserve_space() 189 avail = c->leb_size - wbuf->offs - wbuf->used; in reserve_space() 199 err = ubifs_return_leb(c, lnum); in reserve_space() [all …]
|
/fs/jffs2/ |
D | wbuf.c | 32 #define PAGE_DIV(x) ( ((unsigned long)(x) / (unsigned long)(c->wbuf_pagesize)) * (unsigned long)(c-… 33 #define PAGE_MOD(x) ( (unsigned long)(x) % (unsigned long)(c->wbuf_pagesize) ) 45 static int jffs2_wbuf_pending_for_ino(struct jffs2_sb_info *c, uint32_t ino) in jffs2_wbuf_pending_for_ino() argument 47 struct jffs2_inodirty *this = c->wbuf_inodes; in jffs2_wbuf_pending_for_ino() 66 static void jffs2_clear_wbuf_ino_list(struct jffs2_sb_info *c) in jffs2_clear_wbuf_ino_list() argument 70 this = c->wbuf_inodes; in jffs2_clear_wbuf_ino_list() 79 c->wbuf_inodes = NULL; in jffs2_clear_wbuf_ino_list() 82 static void jffs2_wbuf_dirties_inode(struct jffs2_sb_info *c, uint32_t ino) in jffs2_wbuf_dirties_inode() argument 87 jffs2_erase_pending_trigger(c); in jffs2_wbuf_dirties_inode() 89 if (jffs2_wbuf_pending_for_ino(c, ino)) in jffs2_wbuf_dirties_inode() [all …]
|
D | nodemgmt.c | 39 static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, 42 int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, in jffs2_reserve_space() argument 46 int blocksneeded = c->resv_blocks_write; in jffs2_reserve_space() 51 mutex_lock(&c->alloc_sem); in jffs2_reserve_space() 55 spin_lock(&c->erase_completion_lock); in jffs2_reserve_space() 59 while(c->nr_free_blocks + c->nr_erasing_blocks < blocksneeded) { in jffs2_reserve_space() 74 …dirty = c->dirty_size + c->erasing_size - c->nr_erasing_blocks * c->sector_size + c->unchecked_siz… in jffs2_reserve_space() 75 if (dirty < c->nospc_dirty_size) { in jffs2_reserve_space() 76 …if (prio == ALLOC_DELETION && c->nr_free_blocks + c->nr_erasing_blocks >= c->resv_blocks_deletion)… in jffs2_reserve_space() 81 dirty, c->unchecked_size, c->sector_size)); in jffs2_reserve_space() [all …]
|
D | build.c | 23 first_inode_chain(int *i, struct jffs2_sb_info *c) in first_inode_chain() argument 26 if (c->inocache_list[*i]) in first_inode_chain() 27 return c->inocache_list[*i]; in first_inode_chain() 33 next_inode(int *i, struct jffs2_inode_cache *ic, struct jffs2_sb_info *c) in next_inode() argument 39 return first_inode_chain(i, c); in next_inode() 42 #define for_each_inode(i, c, ic) \ argument 43 for (i = 0, ic = first_inode_chain(&i, (c)); \ 45 ic = next_inode(&i, ic, (c))) 48 static void jffs2_build_inode_pass1(struct jffs2_sb_info *c, in jffs2_build_inode_pass1() argument 63 child_ic = jffs2_get_ino_cache(c, fd->ino); in jffs2_build_inode_pass1() [all …]
|
D | erase.c | 23 struct jffs2_sb_info *c; member 29 static void jffs2_erase_failed(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, uint32_t bad_… 30 static void jffs2_erase_succeeded(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb); 31 static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb); 33 static void jffs2_erase_block(struct jffs2_sb_info *c, in jffs2_erase_block() argument 39 ret = jffs2_flash_erase(c, jeb); in jffs2_erase_block() 41 jffs2_erase_succeeded(c, jeb); in jffs2_erase_block() 49 jeb->offset, jeb->offset, jeb->offset + c->sector_size)); in jffs2_erase_block() 53 mutex_lock(&c->erase_free_sem); in jffs2_erase_block() 54 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 66 #define jffs2_is_readonly(c) (OFNI_BS_2SFFJ(c)->s_flags & MS_RDONLY) argument 68 #define SECTOR_ADDR(x) ( (((unsigned long)(x) / c->sector_size) * c->sector_size) ) 73 #define jffs2_can_mark_obsolete(c) (0) argument 75 #define jffs2_can_mark_obsolete(c) (1) argument 78 #define jffs2_is_writebuffered(c) (0) argument 79 #define jffs2_cleanmarker_oob(c) (0) argument 80 #define jffs2_write_nand_cleanmarker(c,jeb) (-EIO) argument 82 #define jffs2_flash_write(c, ofs, len, retlen, buf) jffs2_flash_direct_write(c, ofs, len, retlen, b… argument 83 #define jffs2_flash_read(c, ofs, len, retlen, buf) ((c)->mtd->read((c)->mtd, ofs, len, retlen, buf)) argument [all …]
|
D | scan.c | 37 static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, 44 static int jffs2_scan_inode_node(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, 46 static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, 49 static inline int min_free(struct jffs2_sb_info *c) in min_free() argument 53 if (!jffs2_can_mark_obsolete(c) && min < c->wbuf_pagesize) in min_free() 54 return c->wbuf_pagesize; in min_free() 67 static int file_dirty(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb) in file_dirty() argument 71 if ((ret = jffs2_prealloc_raw_node_refs(c, jeb, 1))) in file_dirty() 73 if ((ret = jffs2_scan_dirty_space(c, jeb, jeb->free_size))) in file_dirty() 78 c->dirty_size += jeb->wasted_size; in file_dirty() [all …]
|