Lines Matching refs:pnode
353 struct ubifs_pnode *pnode) in ubifs_pack_pnode() argument
361 pack_bits(c, &addr, &pos, pnode->num, c->pcnt_bits); in ubifs_pack_pnode()
363 pack_bits(c, &addr, &pos, pnode->lprops[i].free >> 3, in ubifs_pack_pnode()
365 pack_bits(c, &addr, &pos, pnode->lprops[i].dirty >> 3, in ubifs_pack_pnode()
367 if (pnode->lprops[i].flags & LPROPS_INDEX) in ubifs_pack_pnode()
517 static void add_pnode_dirt(struct ubifs_info *c, struct ubifs_pnode *pnode) in add_pnode_dirt() argument
519 ubifs_add_lpt_dirt(c, pnode->parent->nbranch[pnode->iip].lnum, in add_pnode_dirt()
615 struct ubifs_pnode *pnode = NULL; in ubifs_create_dflt_lpt() local
634 pnode = kzalloc(sizeof(struct ubifs_pnode), GFP_KERNEL); in ubifs_create_dflt_lpt()
639 if (!pnode || !nnode || !buf || !ltab || !lsave) { in ubifs_create_dflt_lpt()
666 pnode->lprops[0].free = c->leb_size - iopos; in ubifs_create_dflt_lpt()
667 pnode->lprops[0].dirty = iopos - node_sz; in ubifs_create_dflt_lpt()
668 pnode->lprops[0].flags = LPROPS_INDEX; in ubifs_create_dflt_lpt()
672 pnode->lprops[1].free = c->leb_size - iopos; in ubifs_create_dflt_lpt()
673 pnode->lprops[1].dirty = iopos - node_sz; in ubifs_create_dflt_lpt()
676 pnode->lprops[i].free = c->leb_size; in ubifs_create_dflt_lpt()
679 ubifs_pack_pnode(c, p, pnode); in ubifs_create_dflt_lpt()
682 pnode->num += 1; in ubifs_create_dflt_lpt()
685 pnode->lprops[0].free = c->leb_size; in ubifs_create_dflt_lpt()
686 pnode->lprops[0].dirty = 0; in ubifs_create_dflt_lpt()
687 pnode->lprops[0].flags = 0; in ubifs_create_dflt_lpt()
689 pnode->lprops[1].free = c->leb_size; in ubifs_create_dflt_lpt()
690 pnode->lprops[1].dirty = 0; in ubifs_create_dflt_lpt()
713 ubifs_pack_pnode(c, p, pnode); in ubifs_create_dflt_lpt()
721 pnode->num += 1; in ubifs_create_dflt_lpt()
860 kfree(pnode); in ubifs_create_dflt_lpt()
872 static void update_cats(struct ubifs_info *c, struct ubifs_pnode *pnode) in update_cats() argument
877 int cat = pnode->lprops[i].flags & LPROPS_CAT_MASK; in update_cats()
878 int lnum = pnode->lprops[i].lnum; in update_cats()
882 ubifs_add_to_cat(c, &pnode->lprops[i], cat); in update_cats()
968 struct ubifs_pnode *pnode) in unpack_pnode() argument
977 pnode->num = ubifs_unpack_bits(c, &addr, &pos, c->pcnt_bits); in unpack_pnode()
979 struct ubifs_lprops * const lprops = &pnode->lprops[i]; in unpack_pnode()
1141 static int validate_pnode(const struct ubifs_info *c, struct ubifs_pnode *pnode, in validate_pnode() argument
1149 if (pnode->num != num) in validate_pnode()
1153 int free = pnode->lprops[i].free; in validate_pnode()
1154 int dirty = pnode->lprops[i].dirty; in validate_pnode()
1176 struct ubifs_pnode *pnode) in set_pnode_lnum() argument
1180 lnum = (pnode->num << UBIFS_LPT_FANOUT_SHIFT) + c->main_first; in set_pnode_lnum()
1184 pnode->lprops[i].lnum = lnum++; in set_pnode_lnum()
1267 struct ubifs_pnode *pnode = NULL; in read_pnode() local
1274 pnode = kzalloc(sizeof(struct ubifs_pnode), GFP_NOFS); in read_pnode()
1275 if (!pnode) in read_pnode()
1287 pnode->num = calc_pnode_num_from_parent(c, parent, iip); in read_pnode()
1289 struct ubifs_lprops * const lprops = &pnode->lprops[i]; in read_pnode()
1298 err = unpack_pnode(c, buf, pnode); in read_pnode()
1302 err = validate_pnode(c, pnode, parent, iip); in read_pnode()
1306 pnode->num = calc_pnode_num_from_parent(c, parent, iip); in read_pnode()
1307 branch->pnode = pnode; in read_pnode()
1308 pnode->parent = parent; in read_pnode()
1309 pnode->iip = iip; in read_pnode()
1310 set_pnode_lnum(c, pnode); in read_pnode()
1316 ubifs_dump_pnode(c, pnode, parent, iip); in read_pnode()
1319 kfree(pnode); in read_pnode()
1427 struct ubifs_pnode *pnode; in ubifs_get_pnode() local
1431 pnode = branch->pnode; in ubifs_get_pnode()
1432 if (pnode) in ubifs_get_pnode()
1433 return pnode; in ubifs_get_pnode()
1437 update_cats(c, branch->pnode); in ubifs_get_pnode()
1438 return branch->pnode; in ubifs_get_pnode()
1453 struct ubifs_pnode *pnode; in ubifs_lpt_lookup() local
1471 pnode = ubifs_get_pnode(c, nnode, iip); in ubifs_lpt_lookup()
1472 if (IS_ERR(pnode)) in ubifs_lpt_lookup()
1473 return ERR_CAST(pnode); in ubifs_lpt_lookup()
1476 pnode->lprops[iip].free, pnode->lprops[iip].dirty, in ubifs_lpt_lookup()
1477 pnode->lprops[iip].flags); in ubifs_lpt_lookup()
1478 return &pnode->lprops[iip]; in ubifs_lpt_lookup()
1540 struct ubifs_pnode *pnode) in dirty_cow_pnode() argument
1544 if (!test_bit(COW_CNODE, &pnode->flags)) { in dirty_cow_pnode()
1546 if (!test_and_set_bit(DIRTY_CNODE, &pnode->flags)) { in dirty_cow_pnode()
1548 add_pnode_dirt(c, pnode); in dirty_cow_pnode()
1550 return pnode; in dirty_cow_pnode()
1554 p = kmemdup(pnode, sizeof(struct ubifs_pnode), GFP_NOFS); in dirty_cow_pnode()
1561 replace_cats(c, pnode, p); in dirty_cow_pnode()
1563 ubifs_assert(c, !test_bit(OBSOLETE_CNODE, &pnode->flags)); in dirty_cow_pnode()
1564 __set_bit(OBSOLETE_CNODE, &pnode->flags); in dirty_cow_pnode()
1567 add_pnode_dirt(c, pnode); in dirty_cow_pnode()
1568 pnode->parent->nbranch[p->iip].pnode = p; in dirty_cow_pnode()
1584 struct ubifs_pnode *pnode; in ubifs_lpt_lookup_dirty() local
1608 pnode = ubifs_get_pnode(c, nnode, iip); in ubifs_lpt_lookup_dirty()
1609 if (IS_ERR(pnode)) in ubifs_lpt_lookup_dirty()
1610 return ERR_CAST(pnode); in ubifs_lpt_lookup_dirty()
1611 pnode = dirty_cow_pnode(c, pnode); in ubifs_lpt_lookup_dirty()
1612 if (IS_ERR(pnode)) in ubifs_lpt_lookup_dirty()
1613 return ERR_CAST(pnode); in ubifs_lpt_lookup_dirty()
1616 pnode->lprops[iip].free, pnode->lprops[iip].dirty, in ubifs_lpt_lookup_dirty()
1617 pnode->lprops[iip].flags); in ubifs_lpt_lookup_dirty()
1618 ubifs_assert(c, test_bit(DIRTY_CNODE, &pnode->flags)); in ubifs_lpt_lookup_dirty()
1619 return &pnode->lprops[iip]; in ubifs_lpt_lookup_dirty()
1777 struct ubifs_pnode pnode; member
1783 struct ubifs_pnode *pnode; member
1862 struct ubifs_pnode *pnode; in scan_get_pnode() local
1867 pnode = branch->pnode; in scan_get_pnode()
1868 if (pnode) { in scan_get_pnode()
1870 path->ptr.pnode = pnode; in scan_get_pnode()
1871 return pnode; in scan_get_pnode()
1873 pnode = &path->pnode; in scan_get_pnode()
1875 path->ptr.pnode = pnode; in scan_get_pnode()
1876 memset(pnode, 0, sizeof(struct ubifs_pnode)); in scan_get_pnode()
1886 pnode->num = calc_pnode_num_from_parent(c, parent, iip); in scan_get_pnode()
1888 struct ubifs_lprops * const lprops = &pnode->lprops[i]; in scan_get_pnode()
1901 err = unpack_pnode(c, buf, pnode); in scan_get_pnode()
1905 err = validate_pnode(c, pnode, parent, iip); in scan_get_pnode()
1909 pnode->num = calc_pnode_num_from_parent(c, parent, iip); in scan_get_pnode()
1910 pnode->parent = parent; in scan_get_pnode()
1911 pnode->iip = iip; in scan_get_pnode()
1912 set_pnode_lnum(c, pnode); in scan_get_pnode()
1913 return pnode; in scan_get_pnode()
1931 struct ubifs_pnode *pnode; in ubifs_lpt_scan_nolock() local
1971 pnode = scan_get_pnode(c, path + h, nnode, iip); in ubifs_lpt_scan_nolock()
1972 if (IS_ERR(pnode)) { in ubifs_lpt_scan_nolock()
1973 err = PTR_ERR(pnode); in ubifs_lpt_scan_nolock()
1980 struct ubifs_lprops *lprops = &pnode->lprops[iip]; in ubifs_lpt_scan_nolock()
2013 pnode = kmemdup(&path[h].pnode, sz, GFP_NOFS); in ubifs_lpt_scan_nolock()
2014 if (!pnode) { in ubifs_lpt_scan_nolock()
2018 parent = pnode->parent; in ubifs_lpt_scan_nolock()
2019 parent->nbranch[pnode->iip].pnode = pnode; in ubifs_lpt_scan_nolock()
2020 path[h].ptr.pnode = pnode; in ubifs_lpt_scan_nolock()
2022 update_cats(c, pnode); in ubifs_lpt_scan_nolock()
2057 iip = pnode->iip; in ubifs_lpt_scan_nolock()
2078 pnode = scan_get_pnode(c, path + h, nnode, iip); in ubifs_lpt_scan_nolock()
2079 if (IS_ERR(pnode)) { in ubifs_lpt_scan_nolock()
2080 err = PTR_ERR(pnode); in ubifs_lpt_scan_nolock()
2098 static int dbg_chk_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, in dbg_chk_pnode() argument
2103 if (pnode->num != col) { in dbg_chk_pnode()
2105 pnode->num, col, pnode->parent->num, pnode->iip); in dbg_chk_pnode()
2109 struct ubifs_lprops *lp, *lprops = &pnode->lprops[i]; in dbg_chk_pnode()
2110 int lnum = (pnode->num << UBIFS_LPT_FANOUT_SHIFT) + i + in dbg_chk_pnode()
2268 struct ubifs_pnode *pnode; in dbg_check_lpt_nodes() local
2271 pnode = (struct ubifs_pnode *)cnode; in dbg_check_lpt_nodes()
2272 err = dbg_chk_pnode(c, pnode, col); in dbg_check_lpt_nodes()