Lines Matching refs:err
142 int err; in ins_clr_old_idx_znode() local
149 err = insert_old_idx(c, zbr->lnum, zbr->offs); in ins_clr_old_idx_znode()
150 if (err) in ins_clr_old_idx_znode()
151 return err; in ins_clr_old_idx_znode()
158 err = insert_old_idx(c, c->zroot.lnum, c->zroot.offs); in ins_clr_old_idx_znode()
159 if (err) in ins_clr_old_idx_znode()
160 return err; in ins_clr_old_idx_znode()
271 int err; in dirty_cow_znode() local
279 err = add_idx_dirt(c, zbr->lnum, zbr->len); in dirty_cow_znode()
280 if (unlikely(err)) in dirty_cow_znode()
281 return ERR_PTR(err); in dirty_cow_znode()
291 err = insert_old_idx(c, zbr->lnum, zbr->offs); in dirty_cow_znode()
292 if (unlikely(err)) in dirty_cow_znode()
293 return ERR_PTR(err); in dirty_cow_znode()
294 err = add_idx_dirt(c, zbr->lnum, zbr->len); in dirty_cow_znode()
296 err = 0; in dirty_cow_znode()
303 if (unlikely(err)) in dirty_cow_znode()
304 return ERR_PTR(err); in dirty_cow_znode()
331 int err; in lnc_add() local
339 err = ubifs_validate_entry(c, dent); in lnc_add()
340 if (err) { in lnc_add()
343 return err; in lnc_add()
368 int err; in lnc_add_directly() local
373 err = ubifs_validate_entry(c, node); in lnc_add_directly()
374 if (err) { in lnc_add_directly()
377 return err; in lnc_add_directly()
411 int err; in tnc_read_node_nm() local
422 err = ubifs_tnc_read_node(c, zbr, node); in tnc_read_node_nm()
423 if (err) in tnc_read_node_nm()
424 return err; in tnc_read_node_nm()
427 err = lnc_add(c, zbr, node); in tnc_read_node_nm()
428 return err; in tnc_read_node_nm()
455 int err, node_len; in try_read_node() local
461 err = ubi_read(c->ubi, lnum, buf, offs, len); in try_read_node()
462 if (err) { in try_read_node()
464 type, lnum, offs, err); in try_read_node()
465 return err; in try_read_node()
538 int nlen, err; in matches_name() local
546 err = ubifs_tnc_read_node(c, zbr, dent); in matches_name()
547 if (err) in matches_name()
551 err = lnc_add_directly(c, zbr, dent); in matches_name()
552 if (err) in matches_name()
558 err = memcmp(dent->name, nm->name, min_t(int, nlen, nm->len)); in matches_name()
559 if (err == 0) { in matches_name()
566 } else if (err < 0) in matches_name()
573 return err; in matches_name()
707 int err; in resolve_collision() local
709 err = matches_name(c, &(*zn)->zbranch[*n], nm); in resolve_collision()
710 if (unlikely(err < 0)) in resolve_collision()
711 return err; in resolve_collision()
712 if (err == NAME_MATCHES) in resolve_collision()
715 if (err == NAME_GREATER) { in resolve_collision()
718 err = tnc_prev(c, zn, n); in resolve_collision()
719 if (err == -ENOENT) { in resolve_collision()
724 if (err < 0) in resolve_collision()
725 return err; in resolve_collision()
757 err = tnc_next(c, zn, n); in resolve_collision()
758 if (err) { in resolve_collision()
761 if (err == -ENOENT) in resolve_collision()
762 err = -EINVAL; in resolve_collision()
763 return err; in resolve_collision()
770 err = matches_name(c, &(*zn)->zbranch[*n], nm); in resolve_collision()
771 if (err < 0) in resolve_collision()
772 return err; in resolve_collision()
773 if (err == NAME_LESS) in resolve_collision()
775 if (err == NAME_MATCHES) in resolve_collision()
777 ubifs_assert(err == NAME_GREATER); in resolve_collision()
785 err = tnc_next(c, &znode, &nn); in resolve_collision()
786 if (err == -ENOENT) in resolve_collision()
788 if (err < 0) in resolve_collision()
789 return err; in resolve_collision()
792 err = matches_name(c, &znode->zbranch[nn], nm); in resolve_collision()
793 if (err < 0) in resolve_collision()
794 return err; in resolve_collision()
795 if (err == NAME_GREATER) in resolve_collision()
799 if (err == NAME_MATCHES) in resolve_collision()
801 ubifs_assert(err == NAME_LESS); in resolve_collision()
826 int nlen, err; in fallible_matches_name() local
834 err = fallible_read_node(c, &zbr->key, zbr, dent); in fallible_matches_name()
835 if (err < 0) in fallible_matches_name()
837 if (err == 0) { in fallible_matches_name()
839 err = NOT_ON_MEDIA; in fallible_matches_name()
842 ubifs_assert(err == 1); in fallible_matches_name()
844 err = lnc_add_directly(c, zbr, dent); in fallible_matches_name()
845 if (err) in fallible_matches_name()
851 err = memcmp(dent->name, nm->name, min_t(int, nlen, nm->len)); in fallible_matches_name()
852 if (err == 0) { in fallible_matches_name()
859 } else if (err < 0) in fallible_matches_name()
866 return err; in fallible_matches_name()
897 int uninitialized_var(o_n), err, cmp, unsure = 0, nn = *n; in fallible_resolve_collision()
919 err = tnc_prev(c, zn, n); in fallible_resolve_collision()
920 if (err == -ENOENT) { in fallible_resolve_collision()
925 if (err < 0) in fallible_resolve_collision()
926 return err; in fallible_resolve_collision()
930 err = tnc_next(c, zn, n); in fallible_resolve_collision()
931 if (err) { in fallible_resolve_collision()
934 if (err == -ENOENT) in fallible_resolve_collision()
935 err = -EINVAL; in fallible_resolve_collision()
936 return err; in fallible_resolve_collision()
943 err = fallible_matches_name(c, &(*zn)->zbranch[*n], nm); in fallible_resolve_collision()
944 if (err < 0) in fallible_resolve_collision()
945 return err; in fallible_resolve_collision()
946 if (err == NAME_MATCHES) in fallible_resolve_collision()
948 if (err == NOT_ON_MEDIA) { in fallible_resolve_collision()
955 if (err == NAME_LESS) in fallible_resolve_collision()
967 err = tnc_next(c, &znode, &nn); in fallible_resolve_collision()
968 if (err == -ENOENT) in fallible_resolve_collision()
970 if (err < 0) in fallible_resolve_collision()
971 return err; in fallible_resolve_collision()
974 err = fallible_matches_name(c, &znode->zbranch[nn], nm); in fallible_resolve_collision()
975 if (err < 0) in fallible_resolve_collision()
976 return err; in fallible_resolve_collision()
977 if (err == NAME_GREATER) in fallible_resolve_collision()
981 if (err == NAME_MATCHES) in fallible_resolve_collision()
983 if (err == NOT_ON_MEDIA) { in fallible_resolve_collision()
1041 int nn, err; in resolve_collision_directly() local
1050 err = tnc_prev(c, &znode, &nn); in resolve_collision_directly()
1051 if (err == -ENOENT) in resolve_collision_directly()
1053 if (err < 0) in resolve_collision_directly()
1054 return err; in resolve_collision_directly()
1068 err = tnc_next(c, &znode, &nn); in resolve_collision_directly()
1069 if (err == -ENOENT) in resolve_collision_directly()
1071 if (err < 0) in resolve_collision_directly()
1072 return err; in resolve_collision_directly()
1174 int err, exact; in ubifs_lookup_level0() local
1262 err = tnc_prev(c, &znode, n); in ubifs_lookup_level0()
1263 if (err == -ENOENT) { in ubifs_lookup_level0()
1268 if (unlikely(err < 0)) in ubifs_lookup_level0()
1269 return err; in ubifs_lookup_level0()
1309 int err, exact; in lookup_level0_dirty() local
1367 err = tnc_prev(c, &znode, n); in lookup_level0_dirty()
1368 if (err == -ENOENT) { in lookup_level0_dirty()
1373 if (unlikely(err < 0)) in lookup_level0_dirty()
1374 return err; in lookup_level0_dirty()
1444 int found, n, err, safely = 0, gc_seq1; in ubifs_tnc_locate() local
1452 err = -ENOENT; in ubifs_tnc_locate()
1455 err = found; in ubifs_tnc_locate()
1468 err = tnc_read_node_nm(c, zt, node); in ubifs_tnc_locate()
1472 err = ubifs_tnc_read_node(c, zt, node); in ubifs_tnc_locate()
1482 err = ubifs_tnc_read_node(c, &zbr, node); in ubifs_tnc_locate()
1483 return err; in ubifs_tnc_locate()
1486 err = fallible_read_node(c, key, &zbr, node); in ubifs_tnc_locate()
1487 if (err <= 0 || maybe_leb_gced(c, zbr.lnum, gc_seq1)) { in ubifs_tnc_locate()
1499 return err; in ubifs_tnc_locate()
1517 int n, err = 0, lnum = -1, uninitialized_var(offs); in ubifs_tnc_get_bu_keys() local
1528 err = ubifs_lookup_level0(c, &bu->key, &znode, &n); in ubifs_tnc_get_bu_keys()
1529 if (err < 0) in ubifs_tnc_get_bu_keys()
1531 if (err) { in ubifs_tnc_get_bu_keys()
1536 err = -EINVAL; in ubifs_tnc_get_bu_keys()
1551 err = tnc_next(c, &znode, &n); in ubifs_tnc_get_bu_keys()
1552 if (err) in ubifs_tnc_get_bu_keys()
1559 err = -ENOENT; in ubifs_tnc_get_bu_keys()
1568 err = -EINVAL; in ubifs_tnc_get_bu_keys()
1600 if (err == -ENOENT) { in ubifs_tnc_get_bu_keys()
1602 err = 0; in ubifs_tnc_get_bu_keys()
1606 if (err) in ubifs_tnc_get_bu_keys()
1607 return err; in ubifs_tnc_get_bu_keys()
1695 int err, len; in validate_data_node() local
1703 err = ubifs_check_node(c, buf, zbr->lnum, zbr->offs, 0, 0); in validate_data_node()
1704 if (err) { in validate_data_node()
1728 err = -EINVAL; in validate_data_node()
1733 return err; in validate_data_node()
1748 int lnum = bu->zbranch[0].lnum, offs = bu->zbranch[0].offs, len, err, i; in ubifs_tnc_bulk_read() local
1762 err = read_wbuf(wbuf, bu->buf, len, lnum, offs); in ubifs_tnc_bulk_read()
1764 err = ubi_read(c->ubi, lnum, bu->buf, offs, len); in ubifs_tnc_bulk_read()
1770 if (err && err != -EBADMSG) { in ubifs_tnc_bulk_read()
1772 lnum, offs, err); in ubifs_tnc_bulk_read()
1775 return err; in ubifs_tnc_bulk_read()
1781 err = validate_data_node(c, buf, &bu->zbranch[i]); in ubifs_tnc_bulk_read()
1782 if (err) in ubifs_tnc_bulk_read()
1783 return err; in ubifs_tnc_bulk_read()
1806 int found, n, err; in do_lookup_nm() local
1813 err = -ENOENT; in do_lookup_nm()
1816 err = found; in do_lookup_nm()
1822 err = resolve_collision(c, key, &znode, &n, nm); in do_lookup_nm()
1823 dbg_tnc("rc returned %d, znode %p, n %d", err, znode, n); in do_lookup_nm()
1824 if (unlikely(err < 0)) in do_lookup_nm()
1826 if (err == 0) { in do_lookup_nm()
1827 err = -ENOENT; in do_lookup_nm()
1831 err = tnc_read_node_nm(c, &znode->zbranch[n], node); in do_lookup_nm()
1835 return err; in do_lookup_nm()
1854 int err, len; in ubifs_tnc_lookup_nm() local
1861 err = ubifs_tnc_lookup(c, key, node); in ubifs_tnc_lookup_nm()
1862 if (err) in ubifs_tnc_lookup_nm()
1863 return err; in ubifs_tnc_lookup_nm()
2165 int found, n, err = 0; in ubifs_tnc_add() local
2179 err = tnc_insert(c, znode, &zbr, n + 1); in ubifs_tnc_add()
2184 err = ubifs_add_dirt(c, zbr->lnum, zbr->len); in ubifs_tnc_add()
2189 err = found; in ubifs_tnc_add()
2190 if (!err) in ubifs_tnc_add()
2191 err = dbg_check_tnc(c, 0); in ubifs_tnc_add()
2194 return err; in ubifs_tnc_add()
2214 int found, n, err = 0; in ubifs_tnc_replace() local
2222 err = found; in ubifs_tnc_replace()
2232 err = ubifs_add_dirt(c, zbr->lnum, zbr->len); in ubifs_tnc_replace()
2233 if (err) in ubifs_tnc_replace()
2245 err = found; in ubifs_tnc_replace()
2254 err = PTR_ERR(znode); in ubifs_tnc_replace()
2260 err = ubifs_add_dirt(c, zbr->lnum, in ubifs_tnc_replace()
2262 if (err) in ubifs_tnc_replace()
2272 err = ubifs_add_dirt(c, lnum, len); in ubifs_tnc_replace()
2274 if (!err) in ubifs_tnc_replace()
2275 err = dbg_check_tnc(c, 0); in ubifs_tnc_replace()
2279 return err; in ubifs_tnc_replace()
2297 int found, n, err = 0; in ubifs_tnc_add_nm() local
2305 err = found; in ubifs_tnc_add_nm()
2317 err = found; in ubifs_tnc_add_nm()
2325 err = PTR_ERR(znode); in ubifs_tnc_add_nm()
2334 err = ubifs_add_dirt(c, zbr->lnum, zbr->len); in ubifs_tnc_add_nm()
2350 err = tnc_insert(c, znode, &zbr, n + 1); in ubifs_tnc_add_nm()
2351 if (err) in ubifs_tnc_add_nm()
2362 err = dbg_check_tnc(c, 0); in ubifs_tnc_add_nm()
2364 if (err) in ubifs_tnc_add_nm()
2365 return err; in ubifs_tnc_add_nm()
2371 if (!err) in ubifs_tnc_add_nm()
2372 err = dbg_check_tnc(c, 0); in ubifs_tnc_add_nm()
2374 return err; in ubifs_tnc_add_nm()
2390 int i, err; in tnc_delete() local
2400 err = ubifs_add_dirt(c, zbr->lnum, zbr->len); in tnc_delete()
2401 if (err) { in tnc_delete()
2403 return err; in tnc_delete()
2428 err = insert_old_idx_znode(c, znode); in tnc_delete()
2429 if (err) in tnc_delete()
2430 return err; in tnc_delete()
2467 err = insert_old_idx(c, c->zroot.lnum, in tnc_delete()
2469 if (err) in tnc_delete()
2470 return err; in tnc_delete()
2502 int found, n, err = 0; in ubifs_tnc_remove() local
2509 err = found; in ubifs_tnc_remove()
2513 err = tnc_delete(c, znode, n); in ubifs_tnc_remove()
2514 if (!err) in ubifs_tnc_remove()
2515 err = dbg_check_tnc(c, 0); in ubifs_tnc_remove()
2519 return err; in ubifs_tnc_remove()
2533 int n, err; in ubifs_tnc_remove_nm() local
2538 err = lookup_level0_dirty(c, key, &znode, &n); in ubifs_tnc_remove_nm()
2539 if (err < 0) in ubifs_tnc_remove_nm()
2542 if (err) { in ubifs_tnc_remove_nm()
2544 err = fallible_resolve_collision(c, key, &znode, &n, in ubifs_tnc_remove_nm()
2547 err = resolve_collision(c, key, &znode, &n, nm); in ubifs_tnc_remove_nm()
2548 dbg_tnc("rc returned %d, znode %p, n %d", err, znode, n); in ubifs_tnc_remove_nm()
2549 if (err < 0) in ubifs_tnc_remove_nm()
2551 if (err) { in ubifs_tnc_remove_nm()
2556 err = PTR_ERR(znode); in ubifs_tnc_remove_nm()
2560 err = tnc_delete(c, znode, n); in ubifs_tnc_remove_nm()
2565 if (!err) in ubifs_tnc_remove_nm()
2566 err = dbg_check_tnc(c, 0); in ubifs_tnc_remove_nm()
2568 return err; in ubifs_tnc_remove_nm()
2603 int i, n, k, err = 0; in ubifs_tnc_remove_range() local
2610 err = ubifs_lookup_level0(c, from_key, &znode, &n); in ubifs_tnc_remove_range()
2611 if (err < 0) in ubifs_tnc_remove_range()
2614 if (err) in ubifs_tnc_remove_range()
2617 err = tnc_next(c, &znode, &n); in ubifs_tnc_remove_range()
2618 if (err == -ENOENT) { in ubifs_tnc_remove_range()
2619 err = 0; in ubifs_tnc_remove_range()
2622 if (err < 0) in ubifs_tnc_remove_range()
2626 err = 0; in ubifs_tnc_remove_range()
2635 err = PTR_ERR(znode); in ubifs_tnc_remove_range()
2646 err = ubifs_add_dirt(c, znode->zbranch[i].lnum, in ubifs_tnc_remove_range()
2648 if (err) { in ubifs_tnc_remove_range()
2661 err = tnc_delete(c, znode, n); in ubifs_tnc_remove_range()
2662 if (err) in ubifs_tnc_remove_range()
2667 if (!err) in ubifs_tnc_remove_range()
2668 err = dbg_check_tnc(c, 0); in ubifs_tnc_remove_range()
2670 return err; in ubifs_tnc_remove_range()
2697 int err; in ubifs_tnc_remove_ino() local
2701 err = PTR_ERR(xent); in ubifs_tnc_remove_ino()
2702 if (err == -ENOENT) in ubifs_tnc_remove_ino()
2704 return err; in ubifs_tnc_remove_ino()
2713 err = ubifs_tnc_remove_nm(c, &key1, &nm); in ubifs_tnc_remove_ino()
2714 if (err) { in ubifs_tnc_remove_ino()
2716 return err; in ubifs_tnc_remove_ino()
2721 err = ubifs_tnc_remove_range(c, &key1, &key2); in ubifs_tnc_remove_ino()
2722 if (err) { in ubifs_tnc_remove_ino()
2724 return err; in ubifs_tnc_remove_ino()
2766 int n, err, type = key_type(c, key); in ubifs_tnc_next_ent() local
2776 err = ubifs_lookup_level0(c, key, &znode, &n); in ubifs_tnc_next_ent()
2777 if (unlikely(err < 0)) in ubifs_tnc_next_ent()
2781 if (err) { in ubifs_tnc_next_ent()
2783 err = resolve_collision(c, key, &znode, &n, nm); in ubifs_tnc_next_ent()
2785 err, znode, n); in ubifs_tnc_next_ent()
2786 if (unlikely(err < 0)) in ubifs_tnc_next_ent()
2791 err = tnc_next(c, &znode, &n); in ubifs_tnc_next_ent()
2792 if (unlikely(err)) in ubifs_tnc_next_ent()
2800 if (!err) { in ubifs_tnc_next_ent()
2806 err = tnc_next(c, &znode, &n); in ubifs_tnc_next_ent()
2807 if (err) in ubifs_tnc_next_ent()
2815 err = -ENOMEM; in ubifs_tnc_next_ent()
2826 err = -ENOENT; in ubifs_tnc_next_ent()
2830 err = tnc_read_node_nm(c, zbr, dent); in ubifs_tnc_next_ent()
2831 if (unlikely(err)) in ubifs_tnc_next_ent()
2841 return ERR_PTR(err); in ubifs_tnc_next_ent()
3142 int n, found, err, nn; in is_leaf_node_in_tnc() local
3163 err = tnc_prev(c, &znode, &n); in is_leaf_node_in_tnc()
3164 if (err == -ENOENT) in is_leaf_node_in_tnc()
3166 if (err) in is_leaf_node_in_tnc()
3167 return err; in is_leaf_node_in_tnc()
3178 err = tnc_next(c, &znode, &n); in is_leaf_node_in_tnc()
3179 if (err) { in is_leaf_node_in_tnc()
3180 if (err == -ENOENT) in is_leaf_node_in_tnc()
3182 return err; in is_leaf_node_in_tnc()
3210 int err; in ubifs_tnc_has_node() local
3214 err = is_idx_node_in_tnc(c, key, level, lnum, offs); in ubifs_tnc_has_node()
3215 if (err < 0) in ubifs_tnc_has_node()
3217 if (err == 1) in ubifs_tnc_has_node()
3219 err = 0; in ubifs_tnc_has_node()
3220 else if (err == 2) in ubifs_tnc_has_node()
3222 err = 1; in ubifs_tnc_has_node()
3224 BUG_ON(err != 0); in ubifs_tnc_has_node()
3226 err = is_leaf_node_in_tnc(c, key, lnum, offs); in ubifs_tnc_has_node()
3230 return err; in ubifs_tnc_has_node()
3251 int err = 0; in ubifs_dirty_idx_node() local
3258 err = PTR_ERR(znode); in ubifs_dirty_idx_node()
3263 err = PTR_ERR(znode); in ubifs_dirty_idx_node()
3269 return err; in ubifs_dirty_idx_node()