Lines Matching full:ni

204 static int bmp_buf_get(struct ntfs_index *indx, struct ntfs_inode *ni,  in bmp_buf_get()  argument
209 struct ntfs_sb_info *sbi = ni->mi.sbi; in bmp_buf_get()
219 b = ni_find_attr(ni, NULL, &le, ATTR_BITMAP, in->name, in->name_len, in bmp_buf_get()
316 static int indx_mark_used(struct ntfs_index *indx, struct ntfs_inode *ni, in indx_mark_used() argument
322 err = bmp_buf_get(indx, ni, bit, &bbuf); in indx_mark_used()
336 static int indx_mark_free(struct ntfs_index *indx, struct ntfs_inode *ni, in indx_mark_free() argument
342 err = bmp_buf_get(indx, ni, bit, &bbuf); in indx_mark_free()
360 static int scan_nres_bitmap(struct ntfs_inode *ni, struct ATTRIB *bitmap, in scan_nres_bitmap() argument
366 struct ntfs_sb_info *sbi = ni->mi.sbi; in scan_nres_bitmap()
402 err = attr_load_runs_vcn(ni, ATTR_BITMAP, name->name, in scan_nres_bitmap()
474 static int indx_find_free(struct ntfs_index *indx, struct ntfs_inode *ni, in indx_find_free() argument
482 b = ni_find_attr(ni, NULL, &le, ATTR_BITMAP, in->name, in->name_len, in indx_find_free()
498 err = scan_nres_bitmap(ni, b, indx, 0, &scan_for_free, bit); in indx_find_free()
522 int indx_used_bit(struct ntfs_index *indx, struct ntfs_inode *ni, size_t *bit) in indx_used_bit() argument
530 b = ni_find_attr(ni, NULL, &le, ATTR_BITMAP, in->name, in->name_len, in indx_used_bit()
545 err = scan_nres_bitmap(ni, b, indx, from, &scan_for_used, bit); in indx_used_bit()
932 struct ntfs_inode *ni, CLST vbn, in indx_new() argument
955 err = ntfs_get_bh(ni->mi.sbi, &indx->alloc_run, vbo, bytes, &r->nb); in indx_new()
994 struct INDEX_ROOT *indx_get_root(struct ntfs_index *indx, struct ntfs_inode *ni, in indx_get_root() argument
1002 a = ni_find_attr(ni, NULL, &le, ATTR_ROOT, in->name, in->name_len, NULL, in indx_get_root()
1022 static int indx_write(struct ntfs_index *indx, struct ntfs_inode *ni, in indx_write() argument
1027 return ntfs_write_bh(ni->mi.sbi, &ib->rhdr, &node->nb, sync); in indx_write()
1037 int indx_read(struct ntfs_index *indx, struct ntfs_inode *ni, CLST vbn, in indx_read() argument
1067 err = ntfs_read_bh(ni->mi.sbi, run, vbo, &ib->rhdr, bytes, &in->nb); in indx_read()
1080 err = attr_load_runs_range(ni, ATTR_ALLOC, name->name, name->name_len, in indx_read()
1087 err = ntfs_read_bh(ni->mi.sbi, run, vbo, &ib->rhdr, bytes, &in->nb); in indx_read()
1097 ntfs_inode_err(&ni->vfs_inode, "directory corrupted"); in indx_read()
1098 ntfs_set_state(ni->mi.sbi, NTFS_DIRTY_ERROR); in indx_read()
1104 ntfs_write_bh(ni->mi.sbi, &ib->rhdr, &in->nb, 0); in indx_read()
1120 ntfs_inode_err(&ni->vfs_inode, "directory corrupted"); in indx_read()
1121 ntfs_set_state(ni->mi.sbi, NTFS_DIRTY_ERROR); in indx_read()
1139 int indx_find(struct ntfs_index *indx, struct ntfs_inode *ni, in indx_find() argument
1149 root = indx_get_root(&ni->dir, ni, NULL, NULL); in indx_find()
1181 err = indx_read(indx, ni, de_get_vbn(e), &node); in indx_find()
1202 int indx_find_sort(struct ntfs_index *indx, struct ntfs_inode *ni, in indx_find_sort() argument
1259 err = indx_read(indx, ni, de_get_vbn(e), &n); in indx_find_sort()
1312 int indx_find_raw(struct ntfs_index *indx, struct ntfs_inode *ni, in indx_find_raw() argument
1323 u32 record_size = ni->mi.sbi->record_size; in indx_find_raw()
1393 err = indx_used_bit(indx, ni, &bit); in indx_find_raw()
1403 err = indx_read(indx, ni, next_used_vbn, &n); in indx_find_raw()
1431 static int indx_create_allocate(struct ntfs_index *indx, struct ntfs_inode *ni, in indx_create_allocate() argument
1435 struct ntfs_sb_info *sbi = ni->mi.sbi; in indx_create_allocate()
1452 err = ni_insert_nonresident(ni, ATTR_ALLOC, in->name, in->name_len, in indx_create_allocate()
1459 err = ni_insert_resident(ni, ntfs3_bitmap_size(1), ATTR_BITMAP, in indx_create_allocate()
1465 i_size_write(&ni->vfs_inode, data_size); in indx_create_allocate()
1466 inode_set_bytes(&ni->vfs_inode, alloc_size); in indx_create_allocate()
1476 mi_remove_attr(NULL, &ni->mi, alloc); in indx_create_allocate()
1488 static int indx_add_allocate(struct ntfs_index *indx, struct ntfs_inode *ni, in indx_add_allocate() argument
1499 err = indx_find_free(indx, ni, &bit, &bmp); in indx_add_allocate()
1520 err = attr_set_size(ni, ATTR_BITMAP, in->name, in->name_len, in indx_add_allocate()
1528 alloc = ni_find_attr(ni, NULL, NULL, ATTR_ALLOC, in->name, in->name_len, in indx_add_allocate()
1543 err = attr_set_size(ni, ATTR_ALLOC, in->name, in->name_len, in indx_add_allocate()
1553 i_size_write(&ni->vfs_inode, data_size); in indx_add_allocate()
1562 attr_set_size(ni, ATTR_BITMAP, in->name, in->name_len, in indx_add_allocate()
1575 static int indx_insert_into_root(struct ntfs_index *indx, struct ntfs_inode *ni, in indx_insert_into_root() argument
1596 root = indx_get_root(indx, ni, &attr, &mi); in indx_insert_into_root()
1606 sbi = ni->mi.sbi; in indx_insert_into_root()
1695 indx_create_allocate(indx, ni, &new_vbn) : in indx_insert_into_root()
1696 indx_add_allocate(indx, ni, &new_vbn); in indx_insert_into_root()
1699 root = indx_get_root(indx, ni, &attr, &mi); in indx_insert_into_root()
1723 n = indx_new(indx, ni, new_vbn, sub_vbn); in indx_insert_into_root()
1737 indx_mark_used(indx, ni, new_vbn >> indx->idx2vbn_bits); in indx_insert_into_root()
1748 indx_write(indx, ni, n, 0); in indx_insert_into_root()
1752 err = indx_insert_entry(indx, ni, new_de, ctx, fnd, undo); in indx_insert_into_root()
1768 indx_write(indx, ni, n, 0); in indx_insert_into_root()
1788 indx_insert_into_buffer(struct ntfs_index *indx, struct ntfs_inode *ni, in indx_insert_into_buffer() argument
1811 indx_write(indx, ni, n1, 0); in indx_insert_into_buffer()
1853 err = indx_add_allocate(indx, ni, &new_vbn); in indx_insert_into_buffer()
1858 n2 = indx_new(indx, ni, new_vbn, sub_vbn); in indx_insert_into_buffer()
1891 indx_mark_used(indx, ni, new_vbn >> indx->idx2vbn_bits); in indx_insert_into_buffer()
1893 indx_write(indx, ni, n1, 0); in indx_insert_into_buffer()
1894 indx_write(indx, ni, n2, 0); in indx_insert_into_buffer()
1904 err = indx_insert_into_root(indx, ni, up_e, NULL, ctx, fnd, 0); in indx_insert_into_buffer()
1910 err = indx_insert_into_buffer(indx, ni, root, up_e, ctx, in indx_insert_into_buffer()
1918 indx_mark_free(indx, ni, new_vbn >> indx->idx2vbn_bits); in indx_insert_into_buffer()
1920 indx_write(indx, ni, n1, 0); in indx_insert_into_buffer()
1935 int indx_insert_entry(struct ntfs_index *indx, struct ntfs_inode *ni, in indx_insert_entry() argument
1954 root = indx_get_root(indx, ni, NULL, NULL); in indx_insert_entry()
1965 err = indx_find(indx, ni, root, new_de + 1, in indx_insert_entry()
1982 err = indx_insert_into_root(indx, ni, new_de, fnd->root_de, ctx, in indx_insert_entry()
1988 err = indx_insert_into_buffer(indx, ni, root, new_de, ctx, in indx_insert_entry()
2002 struct ntfs_inode *ni, in indx_find_buffer() argument
2027 err = indx_read(indx, ni, de_get_vbn(e), &n); in indx_find_buffer()
2031 r = indx_find_buffer(indx, ni, root, vbn, n); in indx_find_buffer()
2048 static int indx_shrink(struct ntfs_index *indx, struct ntfs_inode *ni, in indx_shrink() argument
2058 b = ni_find_attr(ni, NULL, &le, ATTR_BITMAP, in->name, in->name_len, in indx_shrink()
2084 err = scan_nres_bitmap(ni, b, indx, bit, &scan_for_used, &used); in indx_shrink()
2094 err = attr_set_size(ni, ATTR_ALLOC, in->name, in->name_len, in indx_shrink()
2100 i_size_write(&ni->vfs_inode, new_data); in indx_shrink()
2106 err = attr_set_size(ni, ATTR_BITMAP, in->name, in->name_len, in indx_shrink()
2112 static int indx_free_children(struct ntfs_index *indx, struct ntfs_inode *ni, in indx_free_children() argument
2121 err = indx_read(indx, ni, vbn, &n); in indx_free_children()
2129 indx_free_children(indx, ni, e, false); in indx_free_children()
2141 indx_mark_free(indx, ni, i); in indx_free_children()
2151 indx_shrink(indx, ni, i + 1); in indx_free_children()
2163 struct ntfs_inode *ni, in indx_get_entry_to_replace() argument
2181 err = indx_read(indx, ni, vbn, &n); in indx_get_entry_to_replace()
2231 indx_free_children(indx, ni, te, true); in indx_get_entry_to_replace()
2242 indx_write(indx, ni, n, 0); in indx_get_entry_to_replace()
2257 int indx_delete_entry(struct ntfs_index *indx, struct ntfs_inode *ni, in indx_delete_entry() argument
2287 root = indx_get_root(indx, ni, &attr, &mi); in indx_delete_entry()
2294 err = indx_find(indx, ni, root, key, key_len, ctx, &diff, &e, fnd); in indx_delete_entry()
2330 indx_write(indx, ni, n, 0); in indx_delete_entry()
2347 err = indx_get_entry_to_replace(indx, ni, next, &re, fnd2); in indx_delete_entry()
2355 err = level ? indx_insert_into_buffer(indx, ni, root, in indx_delete_entry()
2359 indx_insert_into_root(indx, ni, re, e, in indx_delete_entry()
2373 indx_free_children(indx, ni, next, true); in indx_delete_entry()
2378 indx_write(indx, ni, n, 0); in indx_delete_entry()
2393 root = indx_get_root(indx, ni, &attr, &mi); in indx_delete_entry()
2428 in = indx_find_buffer(indx, ni, root, sub_vbn, NULL); in indx_delete_entry()
2540 indx_write(indx, ni, n2d, 0); in indx_delete_entry()
2552 indx_mark_free(indx, ni, k); in indx_delete_entry()
2565 err = indx_insert_entry(indx, ni, me, ctx, fnd, 0); in indx_delete_entry()
2571 indx_shrink(indx, ni, trim_bit); in indx_delete_entry()
2583 err = attr_set_size(ni, ATTR_ALLOC, in->name, in->name_len, in indx_delete_entry()
2586 i_size_write(&ni->vfs_inode, 0); in indx_delete_entry()
2588 err = ni_remove_attr(ni, ATTR_ALLOC, in->name, in->name_len, in indx_delete_entry()
2592 err = attr_set_size(ni, ATTR_BITMAP, in->name, in->name_len, in indx_delete_entry()
2594 err = ni_remove_attr(ni, ATTR_BITMAP, in->name, in->name_len, in indx_delete_entry()
2598 root = indx_get_root(indx, ni, &attr, &mi); in indx_delete_entry()
2643 int indx_update_dup(struct ntfs_inode *ni, struct ntfs_sb_info *sbi, in indx_update_dup() argument
2653 struct ntfs_index *indx = &ni->dir; in indx_update_dup()
2659 root = indx_get_root(indx, ni, NULL, &mi); in indx_update_dup()
2666 err = indx_find(indx, ni, root, fname, fname_full_size(fname), sbi, in indx_update_dup()
2694 err = indx_write(indx, ni, fnd->nodes[fnd->level - 1], sync); in indx_update_dup()
2701 mark_inode_dirty(&ni->vfs_inode); in indx_update_dup()