Home
last modified time | relevance | path

Searched refs:c (Results 1 – 25 of 159) sorted by relevance

1234567

/fs/ubifs/
Dsuper.c55 static int validate_inode(struct ubifs_info *c, const struct inode *inode) in validate_inode() argument
60 if (inode->i_size > c->max_inode_sz) { in validate_inode()
61 ubifs_err(c, "inode is too large (%lld)", in validate_inode()
67 ubifs_err(c, "unknown compression type %d", ui->compr_type); in validate_inode()
80 if (!ubifs_compr_present(c, ui->compr_type)) { in validate_inode()
81 ubifs_warn(c, "inode %lu uses '%s' compression, but it was not compiled in", in validate_inode()
82 inode->i_ino, ubifs_compr_name(c, ui->compr_type)); in validate_inode()
85 err = dbg_check_dir(c, inode); in validate_inode()
94 struct ubifs_info *c = sb->s_fs_info; in ubifs_iget() local
113 ino_key_init(c, &key, inode->i_ino); in ubifs_iget()
[all …]
Dmaster.c24 int ubifs_compare_master_node(struct ubifs_info *c, void *m1, void *m2) in ubifs_compare_master_node() argument
64 static int mst_node_check_hash(const struct ubifs_info *c, in mst_node_check_hash() argument
71 SHASH_DESC_ON_STACK(shash, c->hash_tfm); in mst_node_check_hash()
73 shash->tfm = c->hash_tfm; in mst_node_check_hash()
78 if (ubifs_check_hash(c, expected, calc)) in mst_node_check_hash()
93 static int scan_for_master(struct ubifs_info *c) in scan_for_master() argument
101 sleb = ubifs_scan(c, lnum, 0, c->sbuf, 1); in scan_for_master()
110 memcpy(c->mst_node, snod->node, snod->len); in scan_for_master()
117 sleb = ubifs_scan(c, lnum, 0, c->sbuf, 1); in scan_for_master()
129 if (ubifs_compare_master_node(c, c->mst_node, snod->node)) in scan_for_master()
[all …]
Dlpt_commit.c21 static int dbg_populate_lsave(struct ubifs_info *c);
30 static struct ubifs_cnode *first_dirty_cnode(const struct ubifs_info *c, struct ubifs_nnode *nnode) in first_dirty_cnode() argument
32 ubifs_assert(c, nnode); in first_dirty_cnode()
61 static struct ubifs_cnode *next_dirty_cnode(const struct ubifs_info *c, struct ubifs_cnode *cnode) in next_dirty_cnode() argument
66 ubifs_assert(c, cnode); in next_dirty_cnode()
76 return first_dirty_cnode(c, (struct ubifs_nnode *)cnode); in next_dirty_cnode()
88 static int get_cnodes_to_commit(struct ubifs_info *c) in get_cnodes_to_commit() argument
93 if (!c->nroot) in get_cnodes_to_commit()
96 if (!test_bit(DIRTY_CNODE, &c->nroot->flags)) in get_cnodes_to_commit()
99 c->lpt_cnext = first_dirty_cnode(c, c->nroot); in get_cnodes_to_commit()
[all …]
Dsb.c54 static int get_default_compressor(struct ubifs_info *c) in get_default_compressor() argument
56 if (ubifs_compr_present(c, UBIFS_COMPR_LZO)) in get_default_compressor()
59 if (ubifs_compr_present(c, UBIFS_COMPR_ZLIB)) in get_default_compressor()
72 static int create_default_filesystem(struct ubifs_info *c) in create_default_filesystem() argument
93 c->key_len = UBIFS_SK_LEN; in create_default_filesystem()
99 if (c->leb_cnt < 0x7FFFFFFF / DEFAULT_JNL_PERCENT) in create_default_filesystem()
101 jnl_lebs = c->leb_cnt * DEFAULT_JNL_PERCENT / 100; in create_default_filesystem()
103 jnl_lebs = (c->leb_cnt / 100) * DEFAULT_JNL_PERCENT; in create_default_filesystem()
107 if (jnl_lebs * c->leb_size > DEFAULT_MAX_JNL) in create_default_filesystem()
108 jnl_lebs = DEFAULT_MAX_JNL / c->leb_size; in create_default_filesystem()
[all …]
Dbudget.c51 static void shrink_liability(struct ubifs_info *c, int nr_to_write) in shrink_liability() argument
53 down_read(&c->vfs_sb->s_umount); in shrink_liability()
54 writeback_inodes_sb_nr(c->vfs_sb, nr_to_write, WB_REASON_FS_FREE_SPACE); in shrink_liability()
55 up_read(&c->vfs_sb->s_umount); in shrink_liability()
66 static int run_gc(struct ubifs_info *c) in run_gc() argument
71 down_read(&c->commit_sem); in run_gc()
72 lnum = ubifs_garbage_collect(c, 1); in run_gc()
73 up_read(&c->commit_sem); in run_gc()
79 err = ubifs_return_leb(c, lnum); in run_gc()
92 static long long get_liability(struct ubifs_info *c) in get_liability() argument
[all …]
Dlog.c20 static int dbg_check_bud_bytes(struct ubifs_info *c);
30 struct ubifs_bud *ubifs_search_bud(struct ubifs_info *c, int lnum) in ubifs_search_bud() argument
35 spin_lock(&c->buds_lock); in ubifs_search_bud()
36 p = c->buds.rb_node; in ubifs_search_bud()
44 spin_unlock(&c->buds_lock); in ubifs_search_bud()
48 spin_unlock(&c->buds_lock); in ubifs_search_bud()
59 struct ubifs_wbuf *ubifs_get_wbuf(struct ubifs_info *c, int lnum) in ubifs_get_wbuf() argument
65 if (!c->jheads) in ubifs_get_wbuf()
68 spin_lock(&c->buds_lock); in ubifs_get_wbuf()
69 p = c->buds.rb_node; in ubifs_get_wbuf()
[all …]
Dcommit.c56 static int nothing_to_commit(struct ubifs_info *c) in nothing_to_commit() argument
62 if (c->mounting || c->remounting_rw) in nothing_to_commit()
69 if (c->zroot.znode && ubifs_zn_dirty(c->zroot.znode)) in nothing_to_commit()
79 if (c->nroot && test_bit(DIRTY_CNODE, &c->nroot->flags)) in nothing_to_commit()
82 ubifs_assert(c, atomic_long_read(&c->dirty_zn_cnt) == 0); in nothing_to_commit()
83 ubifs_assert(c, c->dirty_pn_cnt == 0); in nothing_to_commit()
84 ubifs_assert(c, c->dirty_nn_cnt == 0); in nothing_to_commit()
97 static int do_commit(struct ubifs_info *c) in do_commit() argument
104 ubifs_assert(c, !c->ro_media && !c->ro_mount); in do_commit()
106 if (c->ro_error) { in do_commit()
[all …]
Dlpt.c46 static void do_calc_lpt_geom(struct ubifs_info *c) in do_calc_lpt_geom() argument
51 n = c->main_lebs + c->max_leb_cnt - c->leb_cnt; in do_calc_lpt_geom()
54 c->lpt_hght = 1; in do_calc_lpt_geom()
57 c->lpt_hght += 1; in do_calc_lpt_geom()
61 c->pnode_cnt = DIV_ROUND_UP(c->main_lebs, UBIFS_LPT_FANOUT); in do_calc_lpt_geom()
63 n = DIV_ROUND_UP(c->pnode_cnt, UBIFS_LPT_FANOUT); in do_calc_lpt_geom()
64 c->nnode_cnt = n; in do_calc_lpt_geom()
65 for (i = 1; i < c->lpt_hght; i++) { in do_calc_lpt_geom()
67 c->nnode_cnt += n; in do_calc_lpt_geom()
70 c->space_bits = fls(c->leb_size) - 3; in do_calc_lpt_geom()
[all …]
Dtnc_commit.c25 static int make_idx_node(struct ubifs_info *c, struct ubifs_idx_node *idx, in make_idx_node() argument
37 struct ubifs_branch *br = ubifs_idx_branch(c, idx, i); in make_idx_node()
40 key_write_idx(c, &zbr->key, &br->key); in make_idx_node()
44 ubifs_copy_hash(c, zbr->hash, ubifs_branch_hash(c, br)); in make_idx_node()
46 ubifs_err(c, "bad ref in znode"); in make_idx_node()
47 ubifs_dump_znode(c, znode); in make_idx_node()
49 ubifs_dump_znode(c, zbr->znode); in make_idx_node()
54 ubifs_prepare_node(c, idx, len, 0); in make_idx_node()
55 ubifs_node_calc_hash(c, idx, hash); in make_idx_node()
61 err = insert_old_idx_znode(c, znode); in make_idx_node()
[all …]
Dorphan.c43 static int dbg_check_orphans(struct ubifs_info *c);
45 static struct ubifs_orphan *orphan_add(struct ubifs_info *c, ino_t inum, in orphan_add() argument
58 spin_lock(&c->orphan_lock); in orphan_add()
59 if (c->tot_orphans >= c->max_orphans) { in orphan_add()
60 spin_unlock(&c->orphan_lock); in orphan_add()
64 p = &c->orph_tree.rb_node; in orphan_add()
73 ubifs_err(c, "orphaned twice"); in orphan_add()
74 spin_unlock(&c->orphan_lock); in orphan_add()
79 c->tot_orphans += 1; in orphan_add()
80 c->new_orphans += 1; in orphan_add()
[all …]
Dfind.c42 static int valuable(struct ubifs_info *c, const struct ubifs_lprops *lprops) in valuable() argument
51 heap = &c->lpt_heap[cat - 1]; in valuable()
54 if (lprops->free + lprops->dirty >= c->dark_wm) in valuable()
58 n = c->lst.empty_lebs + c->freeable_cnt - in valuable()
59 c->lst.taken_empty_lebs; in valuable()
60 if (n < c->lsave_cnt) in valuable()
83 static int scan_for_dirty_cb(struct ubifs_info *c, in scan_for_dirty_cb() argument
93 if (!in_tree && valuable(c, lprops)) in scan_for_dirty_cb()
102 if (lprops->free + lprops->dirty == c->leb_size) { in scan_for_dirty_cb()
106 } else if (lprops->dirty < c->dead_wm) in scan_for_dirty_cb()
[all …]
Dio.c70 void ubifs_ro_mode(struct ubifs_info *c, int err) in ubifs_ro_mode() argument
72 if (!c->ro_error) { in ubifs_ro_mode()
73 c->ro_error = 1; in ubifs_ro_mode()
74 c->no_chk_data_crc = 0; in ubifs_ro_mode()
75 c->vfs_sb->s_flags |= SB_RDONLY; in ubifs_ro_mode()
76 ubifs_warn(c, "switched to read-only mode, error %d", err); in ubifs_ro_mode()
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()
98 ubifs_err(c, "reading %d bytes from LEB %d:%d failed, error %d", 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
[all …]
Dlprops.c50 static void move_up_lpt_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, in move_up_lpt_heap() argument
87 static void adjust_lpt_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, in adjust_lpt_heap() argument
166 static int add_to_lpt_heap(struct ubifs_info *c, struct ubifs_lprops *lprops, in add_to_lpt_heap() argument
169 struct ubifs_lpt_heap *heap = &c->lpt_heap[cat - 1]; in add_to_lpt_heap()
178 ubifs_assert(c, cpos >= b); in add_to_lpt_heap()
179 ubifs_assert(c, cpos < LPT_HEAP_SZ); in add_to_lpt_heap()
180 ubifs_assert(c, cpos < heap->cnt); in add_to_lpt_heap()
190 list_add(&lp->list, &c->uncat_list); in add_to_lpt_heap()
193 move_up_lpt_heap(c, heap, lprops, cat); in add_to_lpt_heap()
194 dbg_check_heap(c, heap, cat, lprops->hpos); in add_to_lpt_heap()
[all …]
Dgc.c69 static int switch_gc_head(struct ubifs_info *c) in switch_gc_head() argument
71 int err, gc_lnum = c->gc_lnum; in switch_gc_head()
72 struct ubifs_wbuf *wbuf = &c->jheads[GCHD].wbuf; in switch_gc_head()
74 ubifs_assert(c, gc_lnum != -1); in switch_gc_head()
77 c->leb_size - wbuf->offs - wbuf->used); in switch_gc_head()
87 err = ubifs_leb_unmap(c, gc_lnum); in switch_gc_head()
91 err = ubifs_add_bud_to_log(c, GCHD, gc_lnum, 0); in switch_gc_head()
95 c->gc_lnum = -1; in switch_gc_head()
112 struct ubifs_info *c = priv; in data_nodes_cmp() local
122 ubifs_assert(c, key_type(c, &sa->key) == UBIFS_DATA_KEY); in data_nodes_cmp()
[all …]
Dreplay.c88 static int set_bud_lprops(struct ubifs_info *c, struct bud_entry *b) in set_bud_lprops() argument
93 ubifs_get_lprops(c); in set_bud_lprops()
95 lp = ubifs_lpt_lookup_dirty(c, b->bud->lnum); in set_bud_lprops()
102 if (b->bud->start == 0 && (lp->free != c->leb_size || lp->dirty != 0)) { in set_bud_lprops()
126 dirty -= c->leb_size - lp->free; in set_bud_lprops()
139 lp = ubifs_change_lp(c, lp, b->free, dirty + b->dirty, in set_bud_lprops()
147 err = ubifs_wbuf_seek_nolock(&c->jheads[b->bud->jhead].wbuf, in set_bud_lprops()
148 b->bud->lnum, c->leb_size - b->free); in set_bud_lprops()
151 ubifs_release_lprops(c); in set_bud_lprops()
162 static int set_buds_lprops(struct ubifs_info *c) in set_buds_lprops() argument
[all …]
Dtnc.c25 static int try_read_node(const struct ubifs_info *c, void *buf, int type,
27 static int fallible_read_node(struct ubifs_info *c, const union ubifs_key *key,
70 static int insert_old_idx(struct ubifs_info *c, int lnum, int offs) in insert_old_idx() argument
81 p = &c->old_idx.rb_node; in insert_old_idx()
94 ubifs_err(c, "old idx added twice!"); in insert_old_idx()
100 rb_insert_color(&old_idx->rb, &c->old_idx); in insert_old_idx()
111 int insert_old_idx_znode(struct ubifs_info *c, struct ubifs_znode *znode) in insert_old_idx_znode() argument
118 return insert_old_idx(c, zbr->lnum, zbr->offs); in insert_old_idx_znode()
120 if (c->zroot.len) in insert_old_idx_znode()
121 return insert_old_idx(c, c->zroot.lnum, in insert_old_idx_znode()
[all …]
Dauth.c30 int __ubifs_node_calc_hash(const struct ubifs_info *c, const void *node, in __ubifs_node_calc_hash() argument
34 SHASH_DESC_ON_STACK(shash, c->hash_tfm); in __ubifs_node_calc_hash()
37 shash->tfm = c->hash_tfm; in __ubifs_node_calc_hash()
53 static int ubifs_hash_calc_hmac(const struct ubifs_info *c, const u8 *hash, in ubifs_hash_calc_hmac() argument
56 SHASH_DESC_ON_STACK(shash, c->hmac_tfm); in ubifs_hash_calc_hmac()
59 shash->tfm = c->hmac_tfm; in ubifs_hash_calc_hmac()
61 err = crypto_shash_digest(shash, hash, c->hash_len, hmac); in ubifs_hash_calc_hmac()
78 int ubifs_prepare_auth_node(struct ubifs_info *c, void *node, in ubifs_prepare_auth_node() argument
85 hash = kmalloc(crypto_shash_descsize(c->hash_tfm), GFP_NOFS); in ubifs_prepare_auth_node()
90 SHASH_DESC_ON_STACK(hash_desc, c->hash_tfm); in ubifs_prepare_auth_node()
[all …]
Djournal.c81 static void ubifs_add_auth_dirt(struct ubifs_info *c, int lnum) in ubifs_add_auth_dirt() argument
83 if (ubifs_authenticated(c)) in ubifs_add_auth_dirt()
84 ubifs_add_dirt(c, lnum, ubifs_auth_node_sz(c)); in ubifs_add_auth_dirt()
98 static int reserve_space(struct ubifs_info *c, int jhead, int len) in reserve_space() argument
101 struct ubifs_wbuf *wbuf = &c->jheads[jhead].wbuf; in reserve_space()
108 ubifs_assert(c, !c->ro_media && !c->ro_mount); in reserve_space()
113 if (c->ro_error) { in reserve_space()
118 avail = c->leb_size - wbuf->offs - wbuf->used; in reserve_space()
126 lnum = ubifs_find_free_space(c, len, &offs, squeeze); in reserve_space()
142 lnum = ubifs_garbage_collect(c, 0); in reserve_space()
[all …]
Dubifs.h646 typedef int (*ubifs_lpt_scan_callback)(struct ubifs_info *c,
682 struct ubifs_info *c; member
690 int (*sync_callback)(struct ubifs_info *c, int lnum, int free, int pad);
1509 static inline int ubifs_authenticated(const struct ubifs_info *c) in ubifs_authenticated() argument
1511 return (IS_ENABLED(CONFIG_UBIFS_FS_AUTHENTICATION)) && c->authenticated; in ubifs_authenticated()
1514 struct shash_desc *__ubifs_hash_get_desc(const struct ubifs_info *c);
1515 static inline struct shash_desc *ubifs_hash_get_desc(const struct ubifs_info *c) in ubifs_hash_get_desc() argument
1517 return ubifs_authenticated(c) ? __ubifs_hash_get_desc(c) : NULL; in ubifs_hash_get_desc()
1520 static inline int ubifs_shash_init(const struct ubifs_info *c, in ubifs_shash_init() argument
1523 if (ubifs_authenticated(c)) in ubifs_shash_init()
[all …]
Drecovery.c97 static int get_master_node(const struct ubifs_info *c, int lnum, void **pbuf, in get_master_node() argument
100 const int sz = c->mst_node_alsz; in get_master_node()
104 sbuf = vmalloc(c->leb_size); in get_master_node()
108 err = ubifs_leb_read(c, lnum, sbuf, 0, c->leb_size, 0); in get_master_node()
115 len = c->leb_size; in get_master_node()
116 while (offs + UBIFS_MST_NODE_SZ <= c->leb_size) { 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()
160 if (offs < c->leb_size) { in get_master_node()
170 if (offs < c->leb_size) in get_master_node()
[all …]
/fs/jffs2/
Dwbuf.c35 #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 …]
Dnodemgmt.c24 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 …]
Derase.c24 static void jffs2_erase_failed(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, uint32_t bad_…
25 static void jffs2_erase_succeeded(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb);
26 static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb);
28 static void jffs2_erase_block(struct jffs2_sb_info *c, in jffs2_erase_block() argument
34 ret = jffs2_flash_erase(c, jeb); in jffs2_erase_block()
36 jffs2_erase_succeeded(c, jeb); in jffs2_erase_block()
45 jeb->offset, jeb->offset, jeb->offset + c->sector_size); in jffs2_erase_block()
49 mutex_lock(&c->erase_free_sem); in jffs2_erase_block()
50 spin_lock(&c->erase_completion_lock); in jffs2_erase_block()
51 list_move(&jeb->list, &c->erase_pending_list); in jffs2_erase_block()
[all …]
Dbuild.c27 first_inode_chain(int *i, struct jffs2_sb_info *c) in first_inode_chain() argument
29 for (; *i < c->inocache_hashsize; (*i)++) { in first_inode_chain()
30 if (c->inocache_list[*i]) in first_inode_chain()
31 return c->inocache_list[*i]; in first_inode_chain()
37 next_inode(int *i, struct jffs2_inode_cache *ic, struct jffs2_sb_info *c) in next_inode() argument
43 return first_inode_chain(i, c); in next_inode()
46 #define for_each_inode(i, c, ic) \ argument
47 for (i = 0, ic = first_inode_chain(&i, (c)); \
49 ic = next_inode(&i, ic, (c)))
52 static void jffs2_build_inode_pass1(struct jffs2_sb_info *c, in jffs2_build_inode_pass1() argument
[all …]
Dos-linux.h25 #define OFNI_BS_2SFFJ(c) ((struct super_block *)c->os_priv) argument
63 #define jffs2_is_readonly(c) (OFNI_BS_2SFFJ(c)->s_flags & SB_RDONLY) argument
65 #define SECTOR_ADDR(x) ( (((unsigned long)(x) / c->sector_size) * c->sector_size) )
70 #define jffs2_can_mark_obsolete(c) (0) argument
72 #define jffs2_can_mark_obsolete(c) (1) argument
75 #define jffs2_is_writebuffered(c) (0) argument
76 #define jffs2_cleanmarker_oob(c) (0) argument
77 #define jffs2_write_nand_cleanmarker(c,jeb) (-EIO) argument
79 #define jffs2_flash_write(c, ofs, len, retlen, buf) jffs2_flash_direct_write(c, ofs, len, retlen, b… argument
80 #define jffs2_flash_read(c, ofs, len, retlen, buf) (mtd_read((c)->mtd, ofs, len, retlen, buf)) argument
[all …]

1234567