Lines Matching refs:c
31 static int check_node_data(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info *tn) in check_node_data() argument
46 if (jffs2_is_writebuffered(c)) { in check_node_data()
47 int adj = ofs % c->wbuf_pagesize; in check_node_data()
49 adj = c->wbuf_pagesize - adj; in check_node_data()
67 err = mtd_point(c->mtd, ofs, len, &retlen, (void **)&buffer, NULL); in check_node_data()
70 mtd_unpoint(c->mtd, ofs, retlen); in check_node_data()
85 err = jffs2_flash_read(c, ofs, len, &retlen, buffer); in check_node_data()
104 mtd_unpoint(c->mtd, ofs, len); in check_node_data()
114 jeb = &c->blocks[ref->flash_offset / c->sector_size]; in check_node_data()
115 len = ref_totlen(c, jeb, ref); in check_node_data()
125 spin_lock(&c->erase_completion_lock); in check_node_data()
128 c->used_size += len; in check_node_data()
129 c->unchecked_size -= len; in check_node_data()
130 jffs2_dbg_acct_paranoia_check_nolock(c, jeb); in check_node_data()
131 spin_unlock(&c->erase_completion_lock); in check_node_data()
140 mtd_unpoint(c->mtd, ofs, len); in check_node_data()
150 static int check_tn_node(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info *tn) in check_tn_node() argument
163 ret = check_node_data(c, tn); in check_tn_node()
169 jffs2_mark_node_obsolete(c, tn->fn->raw); in check_tn_node()
199 static void jffs2_kill_tn(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info *tn) in jffs2_kill_tn() argument
201 jffs2_mark_node_obsolete(c, tn->fn->raw); in jffs2_kill_tn()
218 static int jffs2_add_tn_to_tree(struct jffs2_sb_info *c, in jffs2_add_tn_to_tree() argument
236 jffs2_kill_tn(c, rii->mdata_tn); in jffs2_add_tn_to_tree()
240 jffs2_kill_tn(c, tn); in jffs2_add_tn_to_tree()
278 if (!check_tn_node(c, this)) { in jffs2_add_tn_to_tree()
281 jffs2_kill_tn(c, tn); in jffs2_add_tn_to_tree()
287 jffs2_kill_tn(c, this); in jffs2_add_tn_to_tree()
296 if (check_tn_node(c, tn)) { in jffs2_add_tn_to_tree()
298 jffs2_kill_tn(c, tn); in jffs2_add_tn_to_tree()
309 jffs2_kill_tn(c, this); in jffs2_add_tn_to_tree()
320 if (!check_tn_node(c, this)) { in jffs2_add_tn_to_tree()
322 jffs2_kill_tn(c, tn); in jffs2_add_tn_to_tree()
328 jffs2_kill_tn(c, this); in jffs2_add_tn_to_tree()
451 static int jffs2_build_inode_fragtree(struct jffs2_sb_info *c, in jffs2_build_inode_fragtree() argument
500 if (check_tn_node(c, this)) { in jffs2_build_inode_fragtree()
504 jffs2_kill_tn(c, this); in jffs2_build_inode_fragtree()
518 ret = jffs2_add_full_dnode_to_inode(c, f, this->fn); in jffs2_build_inode_fragtree()
525 if (check_tn_node(c, this)) in jffs2_build_inode_fragtree()
526 jffs2_mark_node_obsolete(c, this->fn->raw); in jffs2_build_inode_fragtree()
586 static inline int read_direntry(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *ref, in read_direntry() argument
600 jffs2_mark_node_obsolete(c, ref); in read_direntry()
613 jffs2_mark_node_obsolete(c, ref); in read_direntry()
617 jeb = &c->blocks[ref->flash_offset / c->sector_size]; in read_direntry()
618 len = ref_totlen(c, jeb, ref); in read_direntry()
620 spin_lock(&c->erase_completion_lock); in read_direntry()
623 c->used_size += len; in read_direntry()
624 c->unchecked_size -= len; in read_direntry()
626 spin_unlock(&c->erase_completion_lock); in read_direntry()
661 err = jffs2_flash_read(c, (ref_offset(ref)) + read, in read_direntry()
685 jffs2_add_fd_to_list(c, fd, &rii->fds); in read_direntry()
697 static inline int read_dnode(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *ref, in read_dnode() argument
713 jffs2_mark_node_obsolete(c, ref); in read_dnode()
733 jffs2_dbg_dump_node(c, ref_offset(ref)); in read_dnode()
734 jffs2_mark_node_obsolete(c, ref); in read_dnode()
738 if (jffs2_is_writebuffered(c) && csize != 0) { in read_dnode()
789 jffs2_mark_node_obsolete(c, ref); in read_dnode()
803 jeb = &c->blocks[ref->flash_offset / c->sector_size]; in read_dnode()
804 len = ref_totlen(c, jeb, ref); in read_dnode()
806 spin_lock(&c->erase_completion_lock); in read_dnode()
809 c->used_size += len; in read_dnode()
810 c->unchecked_size -= len; in read_dnode()
812 spin_unlock(&c->erase_completion_lock); in read_dnode()
844 ret = jffs2_add_tn_to_tree(c, rii, tn); in read_dnode()
872 static inline int read_unknown(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *ref, struct jffs… in read_unknown() argument
881 jffs2_mark_node_obsolete(c, ref); in read_unknown()
899 BUG_ON(!(c->flags & JFFS2_SB_FLAG_RO)); in read_unknown()
910 jffs2_mark_node_obsolete(c, ref); in read_unknown()
924 static int read_more(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *ref, in read_more() argument
931 if (jffs2_is_writebuffered(c)) { in read_more()
932 int rem = to_read % c->wbuf_pagesize; in read_more()
935 to_read += c->wbuf_pagesize - rem; in read_more()
943 err = jffs2_flash_read(c, offs, to_read, &retlen, buf + *rdlen); in read_more()
965 static int jffs2_get_inode_nodes(struct jffs2_sb_info *c, struct jffs2_inode_info *f, in jffs2_get_inode_nodes() argument
980 len = sizeof(union jffs2_node_union) + c->wbuf_pagesize; in jffs2_get_inode_nodes()
985 spin_lock(&c->erase_completion_lock); in jffs2_get_inode_nodes()
998 spin_unlock(&c->erase_completion_lock); in jffs2_get_inode_nodes()
1009 if (jffs2_is_writebuffered(c)) { in jffs2_get_inode_nodes()
1020 rem = end % c->wbuf_pagesize; in jffs2_get_inode_nodes()
1022 end += c->wbuf_pagesize - rem; in jffs2_get_inode_nodes()
1029 err = jffs2_flash_read(c, ref_offset(ref), len, &retlen, buf); in jffs2_get_inode_nodes()
1050 jffs2_dbg_dump_node(c, ref_offset(ref)); in jffs2_get_inode_nodes()
1051 jffs2_mark_node_obsolete(c, ref); in jffs2_get_inode_nodes()
1058 jffs2_mark_node_obsolete(c, ref); in jffs2_get_inode_nodes()
1068 err = read_more(c, ref, sizeof(struct jffs2_raw_dirent), &len, buf); in jffs2_get_inode_nodes()
1073 err = read_direntry(c, ref, &node->d, retlen, rii); in jffs2_get_inode_nodes()
1083 err = read_more(c, ref, sizeof(struct jffs2_raw_inode), &len, buf); in jffs2_get_inode_nodes()
1088 err = read_dnode(c, ref, &node->i, len, rii); in jffs2_get_inode_nodes()
1097 err = read_more(c, ref, sizeof(struct jffs2_unknown_node), &len, buf); in jffs2_get_inode_nodes()
1102 err = read_unknown(c, ref, &node->u); in jffs2_get_inode_nodes()
1108 spin_lock(&c->erase_completion_lock); in jffs2_get_inode_nodes()
1111 spin_unlock(&c->erase_completion_lock); in jffs2_get_inode_nodes()
1129 static int jffs2_do_read_inode_internal(struct jffs2_sb_info *c, in jffs2_do_read_inode_internal() argument
1144 ret = jffs2_get_inode_nodes(c, f, &rii); in jffs2_do_read_inode_internal()
1149 jffs2_set_inocache_state(c, f->inocache, INO_STATE_CHECKEDABSENT); in jffs2_do_read_inode_internal()
1153 ret = jffs2_build_inode_fragtree(c, f, &rii); in jffs2_do_read_inode_internal()
1158 jffs2_set_inocache_state(c, f->inocache, INO_STATE_CHECKEDABSENT); in jffs2_do_read_inode_internal()
1174 jffs2_kill_tn(c, rii.mdata_tn); in jffs2_do_read_inode_internal()
1189 jffs2_set_inocache_state(c, f->inocache, INO_STATE_CHECKEDABSENT); in jffs2_do_read_inode_internal()
1201 jffs2_set_inocache_state(c, f->inocache, INO_STATE_PRESENT); in jffs2_do_read_inode_internal()
1205 …ret = jffs2_flash_read(c, ref_offset(rii.latest_ref), sizeof(*latest_node), &retlen, (void *)lates… in jffs2_do_read_inode_internal()
1232 new_size = jffs2_truncate_fragtree(c, &f->fragtree, je32_to_cpu(latest_node->isize)); in jffs2_do_read_inode_internal()
1261 ret = jffs2_flash_read(c, ref_offset(rii.latest_ref) + sizeof(*latest_node), in jffs2_do_read_inode_internal()
1306 jffs2_set_inocache_state(c, f->inocache, INO_STATE_PRESENT); in jffs2_do_read_inode_internal()
1312 int jffs2_do_read_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, in jffs2_do_read_inode() argument
1318 spin_lock(&c->inocache_lock); in jffs2_do_read_inode()
1319 f->inocache = jffs2_get_ino_cache(c, ino); in jffs2_do_read_inode()
1335 sleep_on_spinunlock(&c->inocache_wq, &c->inocache_lock); in jffs2_do_read_inode()
1352 spin_unlock(&c->inocache_lock); in jffs2_do_read_inode()
1366 jffs2_add_ino_cache(c, f->inocache); in jffs2_do_read_inode()
1373 return jffs2_do_read_inode_internal(c, f, latest_node); in jffs2_do_read_inode()
1376 int jffs2_do_crccheck_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic) in jffs2_do_crccheck_inode() argument
1389 ret = jffs2_do_read_inode_internal(c, f, &n); in jffs2_do_crccheck_inode()
1391 jffs2_do_clear_inode(c, f); in jffs2_do_crccheck_inode()
1392 jffs2_xattr_do_crccheck_inode(c, ic); in jffs2_do_crccheck_inode()
1397 void jffs2_do_clear_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f) in jffs2_do_clear_inode() argument
1402 jffs2_xattr_delete_inode(c, f->inocache); in jffs2_do_clear_inode()
1407 jffs2_set_inocache_state(c, f->inocache, INO_STATE_CLEARING); in jffs2_do_clear_inode()
1411 jffs2_mark_node_obsolete(c, f->metadata->raw); in jffs2_do_clear_inode()
1415 jffs2_kill_fragtree(&f->fragtree, deleted?c:NULL); in jffs2_do_clear_inode()
1430 jffs2_set_inocache_state(c, f->inocache, INO_STATE_CHECKEDABSENT); in jffs2_do_clear_inode()
1432 jffs2_del_ino_cache(c, f->inocache); in jffs2_do_clear_inode()