Lines Matching full:mi

27 		struct mft_inode *mi;  in ni_ins_mi()  local
30 mi = rb_entry(pr, struct mft_inode, node); in ni_ins_mi()
31 if (mi->rno > ino) in ni_ins_mi()
33 else if (mi->rno < ino) in ni_ins_mi()
36 return mi; in ni_ins_mi()
58 static void ni_add_mi(struct ntfs_inode *ni, struct mft_inode *mi) in ni_add_mi() argument
60 ni_ins_mi(ni, &ni->mi_tree, mi->rno, &mi->node); in ni_add_mi()
66 void ni_remove_mi(struct ntfs_inode *ni, struct mft_inode *mi) in ni_remove_mi() argument
68 rb_erase(&mi->node, &ni->mi_tree); in ni_remove_mi()
78 attr = mi_find_attr(&ni->mi, NULL, ATTR_STD, NULL, 0, NULL); in ni_std()
92 attr = mi_find_attr(&ni->mi, NULL, ATTR_STD, NULL, 0, NULL); in ni_std5()
105 if (!ni->vfs_inode.i_nlink && ni->mi.mrec && in ni_clear()
106 is_rec_inuse(ni->mi.mrec) && in ni_clear()
107 !(ni->mi.sbi->flags & NTFS_FLAGS_LOG_REPLAYING)) in ni_clear()
114 struct mft_inode *mi = rb_entry(node, struct mft_inode, node); in ni_clear() local
117 mi_put(mi); in ni_clear()
135 mi_clear(&ni->mi); in ni_clear()
141 int ni_load_mi_ex(struct ntfs_inode *ni, CLST rno, struct mft_inode **mi) in ni_load_mi_ex() argument
150 err = mi_get(ni->mi.sbi, rno, &r); in ni_load_mi_ex()
157 if (mi) in ni_load_mi_ex()
158 *mi = r; in ni_load_mi_ex()
166 struct mft_inode **mi) in ni_load_mi() argument
171 *mi = &ni->mi; in ni_load_mi()
176 if (rno == ni->mi.rno) { in ni_load_mi()
177 *mi = &ni->mi; in ni_load_mi()
180 return ni_load_mi_ex(ni, rno, mi); in ni_load_mi()
191 struct mft_inode **mi) in ni_find_attr() argument
200 if (mi) in ni_find_attr()
201 *mi = &ni->mi; in ni_find_attr()
204 return mi_find_attr(&ni->mi, attr, type, name, name_len, NULL); in ni_find_attr()
236 if (mi) in ni_find_attr()
237 *mi = m; in ni_find_attr()
242 ntfs_set_state(ni->mi.sbi, NTFS_DIRTY_ERROR); in ni_find_attr()
251 struct mft_inode **mi) in ni_enum_attr_ex() argument
259 if (mi) in ni_enum_attr_ex()
260 *mi = &ni->mi; in ni_enum_attr_ex()
262 return mi_enum_attr(&ni->mi, attr); in ni_enum_attr_ex()
274 if (mi) in ni_enum_attr_ex()
275 *mi = mi2; in ni_enum_attr_ex()
290 struct mft_inode *mi; in ni_load_attr() local
295 *pmi = &ni->mi; in ni_load_attr()
296 return mi_find_attr(&ni->mi, NULL, type, name, name_len, NULL); in ni_load_attr()
316 if (ni_load_mi(ni, le, &mi)) in ni_load_attr()
320 *pmi = mi; in ni_load_attr()
322 attr = mi_find_attr(mi, NULL, type, name, name_len, &le->id); in ni_load_attr()
352 if (rno == ni->mi.rno) in ni_load_all_mi()
366 bool ni_add_subrecord(struct ntfs_inode *ni, CLST rno, struct mft_inode **mi) in ni_add_subrecord() argument
374 if (mi_format_new(m, ni->mi.sbi, rno, 0, ni->mi.rno == MFT_REC_MFT)) { in ni_add_subrecord()
379 mi_get_ref(&ni->mi, &m->mrec->parent_ref); in ni_add_subrecord()
382 *mi = m; in ni_add_subrecord()
396 struct mft_inode *mi; in ni_remove_attr() local
401 attr = mi_find_attr(&ni->mi, NULL, type, name, name_len, id); in ni_remove_attr()
405 mi_remove_attr(ni, &ni->mi, attr); in ni_remove_attr()
434 err = ni_load_mi(ni, le, &mi); in ni_remove_attr()
440 attr = mi_find_attr(mi, NULL, type, name, name_len, id); in ni_remove_attr()
444 mi_remove_attr(ni, mi, attr); in ni_remove_attr()
458 ni_ins_new_attr(struct ntfs_inode *ni, struct mft_inode *mi, in ni_ins_new_attr() argument
468 mi_get_ref(mi, &ref); in ni_ins_new_attr()
488 attr = mi_insert_attr(mi, type, name, name_len, asize, name_off); in ni_ins_new_attr()
527 struct ntfs_sb_info *sbi = ni->mi.sbi; in ni_repack()
528 struct mft_inode *mi, *mi_p = NULL; in ni_repack()
539 while ((attr = ni_enum_attr_ex(ni, attr, &le, &mi))) { in ni_repack()
567 if (le32_to_cpu(mi->mrec->used) + 8 >= rs) in ni_repack()
583 err = run_unpack(&run, sbi, ni->mi.rno, svcn, evcn, svcn, in ni_repack()
590 mi_p = mi; in ni_repack()
600 * Run contains data from two records: mi_p and mi in ni_repack()
612 mi_remove_attr(NULL, mi, attr); in ni_repack()
618 mi->dirty = true; in ni_repack()
622 err = mi_pack_runs(mi, attr, &run, in ni_repack()
628 mi_p = mi; in ni_repack()
660 struct ntfs_sb_info *sbi = ni->mi.sbi; in ni_try_remove_attr_list()
663 struct mft_inode *mi; in ni_try_remove_attr_list() local
676 attr_list = mi_find_attr(&ni->mi, NULL, ATTR_LIST, NULL, 0, NULL); in ni_try_remove_attr_list()
683 free = sbi->record_size - le32_to_cpu(ni->mi.mrec->used) + asize; in ni_try_remove_attr_list()
684 mi_get_ref(&ni->mi, &ref); in ni_try_remove_attr_list()
694 mi = ni_find_mi(ni, ino_get(&le->ref)); in ni_try_remove_attr_list()
695 if (!mi) in ni_try_remove_attr_list()
698 attr = mi_find_attr(mi, NULL, le->type, le_name(le), in ni_try_remove_attr_list()
711 mrec = kmemdup(ni->mi.mrec, sbi->record_size, GFP_NOFS); in ni_try_remove_attr_list()
716 mi_remove_attr(NULL, &ni->mi, attr_list); in ni_try_remove_attr_list()
728 mi = ni_find_mi(ni, ino_get(&le->ref)); in ni_try_remove_attr_list()
729 if (!mi) { in ni_try_remove_attr_list()
734 attr = mi_find_attr(mi, NULL, le->type, le_name(le), in ni_try_remove_attr_list()
743 attr_ins = mi_insert_attr(&ni->mi, le->type, le_name(le), in ni_try_remove_attr_list()
767 mi = ni_find_mi(ni, ino_get(&le->ref)); in ni_try_remove_attr_list()
768 if (!mi) in ni_try_remove_attr_list()
771 attr = mi_find_attr(mi, NULL, le->type, le_name(le), in ni_try_remove_attr_list()
777 mi_remove_attr(NULL, mi, attr); in ni_try_remove_attr_list()
791 swap(mrec, ni->mi.mrec); in ni_try_remove_attr_list()
801 struct ntfs_sb_info *sbi = ni->mi.sbi; in ni_create_attr_list()
810 struct mft_inode *mi; in ni_create_attr_list() local
814 is_mft = ni->mi.rno == MFT_REC_MFT; in ni_create_attr_list()
815 rec = ni->mi.mrec; in ni_create_attr_list()
826 mi_get_ref(&ni->mi, &le->ref); in ni_create_attr_list()
834 for (; (attr = mi_enum_attr(&ni->mi, attr)); le = Add2Ptr(le, sz)) { in ni_create_attr_list()
878 err = ntfs_look_free_mft(sbi, &rno, is_mft, ni, &mi); in ni_create_attr_list()
889 attr = mi_insert_attr(mi, b->type, Add2Ptr(b, name_off), in ni_create_attr_list()
894 mi_get_ref(mi, &le_b[nb]->ref); in ni_create_attr_list()
902 if (!mi_remove_attr(NULL, &ni->mi, b)) in ni_create_attr_list()
912 attr = mi_insert_attr(&ni->mi, ATTR_LIST, NULL, 0, in ni_create_attr_list()
948 struct mft_inode *mi; in ni_ins_attr_ext() local
954 struct ntfs_sb_info *sbi = ni->mi.sbi; in ni_ins_attr_ext()
956 is_mft = ni->mi.rno == MFT_REC_MFT; in ni_ins_attr_ext()
969 ni->mi.rno == MFT_REC_LOG) { in ni_ins_attr_ext()
993 mi = rb_entry(node, struct mft_inode, node); in ni_ins_attr_ext()
996 (mi_enum_attr(mi, NULL) || in ni_ins_attr_ext()
997 vbo <= ((u64)mi->rno << sbi->record_bits))) { in ni_ins_attr_ext()
1002 mi_find_attr(mi, NULL, ATTR_DATA, NULL, 0, NULL)) { in ni_ins_attr_ext()
1011 mi_find_attr(mi, NULL, type, name, name_len, NULL)) { in ni_ins_attr_ext()
1020 if (le32_to_cpu(mi->mrec->used) + asize > sbi->record_size) in ni_ins_attr_ext()
1024 attr = ni_ins_new_attr(ni, mi, le, type, name, name_len, asize, in ni_ins_attr_ext()
1034 *ins_mi = mi; in ni_ins_attr_ext()
1040 err = ntfs_look_free_mft(sbi, &rno, is_mft_data, ni, &mi); in ni_ins_attr_ext()
1049 attr = ni_ins_new_attr(ni, mi, le, type, name, name_len, asize, in ni_ins_attr_ext()
1064 *ins_mi = mi; in ni_ins_attr_ext()
1069 ni_remove_mi(ni, mi); in ni_ins_attr_ext()
1070 mi_put(mi); in ni_ins_attr_ext()
1098 struct ntfs_sb_info *sbi = ni->mi.sbi; in ni_insert_attr()
1108 is_mft = ni->mi.rno == MFT_REC_MFT; in ni_insert_attr()
1109 rec = ni->mi.mrec; in ni_insert_attr()
1124 attr = ni_ins_new_attr(ni, &ni->mi, NULL, type, name, name_len, in ni_insert_attr()
1135 *ins_mi = &ni->mi; in ni_insert_attr()
1160 while ((attr = mi_enum_attr(&ni->mi, attr))) { in ni_insert_attr()
1178 attr = mi_enum_attr(&ni->mi, attr); in ni_insert_attr()
1212 mi_remove_attr(NULL, &ni->mi, attr); in ni_insert_attr()
1221 attr = ni_ins_new_attr(ni, &ni->mi, NULL, type, name, name_len, asize, in ni_insert_attr()
1236 *ins_mi = &ni->mi; in ni_insert_attr()
1251 struct mft_inode *mi, *mi_min, *mi_new; in ni_expand_mft_list() local
1252 struct ntfs_sb_info *sbi = ni->mi.sbi; in ni_expand_mft_list()
1260 mi = rb_entry(node, struct mft_inode, node); in ni_expand_mft_list()
1262 attr = mi_enum_attr(mi, NULL); in ni_expand_mft_list()
1265 mft_min = mi->rno; in ni_expand_mft_list()
1266 mi_min = mi; in ni_expand_mft_list()
1283 attr = mi_find_attr(&ni->mi, NULL, ATTR_DATA, NULL, 0, NULL); in ni_expand_mft_list()
1320 le32_sub_cpu(&ni->mi.mrec->used, done); in ni_expand_mft_list()
1383 bool is_mft = ni->mi.rno == MFT_REC_MFT; in ni_expand_list()
1386 mi_get_ref(&ni->mi, &ref); in ni_expand_list()
1400 attr = rec_find_attr_le(&ni->mi, le); in ni_expand_list()
1420 mi_remove_attr(NULL, &ni->mi, attr); in ni_expand_list()
1445 struct mft_inode **mi, struct ATTR_LIST_ENTRY **le) in ni_insert_nonresident() argument
1456 struct ntfs_sb_info *sbi = ni->mi.sbi; in ni_insert_nonresident()
1479 &attr, mi, le); in ni_insert_nonresident()
1500 svcn ? 0 : cpu_to_le64((u64)len << ni->mi.sbi->cluster_bits); in ni_insert_nonresident()
1519 struct ATTRIB **new_attr, struct mft_inode **mi, in ni_insert_resident() argument
1528 0, &attr, mi, le); in ni_insert_resident()
1541 le16_add_cpu(&ni->mi.mrec->hard_links, 1); in ni_insert_resident()
1542 ni->mi.dirty = true; in ni_insert_resident()
1556 struct mft_inode *mi, struct ATTR_LIST_ENTRY *le) in ni_remove_attr_le() argument
1558 mi_remove_attr(ni, mi, attr); in ni_remove_attr_le()
1578 struct ntfs_sb_info *sbi = ni->mi.sbi; in ni_delete_all()
1586 mi_get_ref(&ni->mi, &ref); in ni_delete_all()
1612 run_unpack_ex(RUN_DEALLOCATE, sbi, ni->mi.rno, svcn, evcn, svcn, in ni_delete_all()
1617 run_deallocate(ni->mi.sbi, &ni->attr_list.run, true); in ni_delete_all()
1624 struct mft_inode *mi = rb_entry(node, struct mft_inode, node); in ni_delete_all() local
1626 clear_rec_inuse(mi->mrec); in ni_delete_all()
1627 mi->dirty = true; in ni_delete_all()
1628 mi_write(mi, 0); in ni_delete_all()
1630 ntfs_mark_rec_free(sbi, mi->rno, false); in ni_delete_all()
1631 ni_remove_mi(ni, mi); in ni_delete_all()
1632 mi_put(mi); in ni_delete_all()
1637 clear_rec_inuse(ni->mi.mrec); in ni_delete_all()
1638 ni->mi.dirty = true; in ni_delete_all()
1639 err = mi_write(&ni->mi, 0); in ni_delete_all()
1641 ntfs_mark_rec_free(sbi, ni->mi.rno, false); in ni_delete_all()
1653 struct mft_inode **mi, in ni_fname_name() argument
1664 attr = ni_find_attr(ni, attr, le, ATTR_NAME, NULL, 0, NULL, mi); in ni_fname_name()
1693 struct mft_inode **mi, in ni_fname_type() argument
1706 attr = ni_find_attr(ni, attr, le, ATTR_NAME, NULL, 0, NULL, mi); in ni_fname_type()
1726 struct mft_inode *mi; in ni_new_attr_flags() local
1730 attr = ni_find_attr(ni, NULL, NULL, ATTR_DATA, NULL, 0, NULL, &mi); in ni_new_attr_flags()
1771 if (!mi_resize_attr(mi, attr, new_asize - le32_to_cpu(attr->size))) in ni_new_attr_flags()
1793 mi->dirty = true; in ni_new_attr_flags()
1821 !ntfs_read_run_nb(ni->mi.sbi, &run, 0, buffer, in ni_parse_reparse()
1954 struct ntfs_sb_info *sbi = ni->mi.sbi; in ni_fiemap()
2159 struct ntfs_sb_info *sbi = ni->mi.sbi; in ni_readpage_cmpr()
2240 struct ntfs_sb_info *sbi = ni->mi.sbi; in ni_decompress_file()
2253 struct mft_inode *mi; in ni_decompress_file() local
2352 mi_get_ref(&ni->mi, &ref); in ni_decompress_file()
2380 run_unpack_ex(RUN_DEALLOCATE, sbi, ni->mi.rno, svcn, evcn, svcn, in ni_decompress_file()
2402 attr = ni_find_attr(ni, NULL, NULL, ATTR_DATA, NULL, 0, NULL, &mi); in ni_decompress_file()
2410 struct MFT_REC *rec = mi->mrec; in ni_decompress_file()
2422 mi->dirty = true; in ni_decompress_file()
2518 struct ntfs_sb_info *sbi = ni->mi.sbi; in ni_read_frame()
2802 struct ntfs_sb_info *sbi = ni->mi.sbi; in ni_write_frame()
2812 struct mft_inode *mi; in ni_write_frame() local
2818 attr = ni_find_attr(ni, NULL, &le, ATTR_DATA, NULL, 0, NULL, &mi); in ni_write_frame()
2836 err = attr_make_nonresident(ni, attr, le, mi, in ni_write_frame()
2969 struct ntfs_sb_info *sbi = ni->mi.sbi; in ni_remove_name()
2973 struct mft_inode *mi; in ni_remove_name() local
2980 mi_get_ref(&dir_ni->mi, &de_name->home); in ni_remove_name()
2983 &de_name->home, &mi, &le); in ni_remove_name()
2999 ni_remove_attr_le(ni, attr_from_name(fname), mi, le); in ni_remove_name()
3004 fname = ni_fname_type(ni, name_type, &mi, &le); in ni_remove_name()
3020 ni_remove_attr_le(ni, attr_from_name(fname), mi, le); in ni_remove_name()
3035 struct ntfs_sb_info *sbi = ni->mi.sbi; in ni_remove_name_undo()
3047 mi_get_ref(&ni->mi, &de2->ref); in ni_remove_name_undo()
3065 mi_get_ref(&ni->mi, &de->ref); in ni_remove_name_undo()
3081 struct ntfs_sb_info *sbi = ni->mi.sbi; in ni_add_name()
3084 struct mft_inode *mi; in ni_add_name() local
3094 if (ni->mi.sbi->options->hide_dot_files) { in ni_add_name()
3102 mi_get_ref(&ni->mi, &de->ref); in ni_add_name()
3103 mi_get_ref(&dir_ni->mi, &de_name->home); in ni_add_name()
3113 &mi, &le); in ni_add_name()
3122 ni_remove_attr_le(ni, attr, mi, le); in ni_add_name()
3182 if (ni->mi.dirty || ni->attr_list.dirty || in ni_is_dirty()
3203 struct mft_inode *mi; in ni_update_parent() local
3205 struct ntfs_sb_info *sbi = ni->mi.sbi; in ni_update_parent()
3209 if (ni->mi.mrec->flags & RECORD_FLAG_DIR) { in ni_update_parent()
3218 &mi); in ni_update_parent()
3242 mi->dirty = true; in ni_update_parent()
3268 &mi))) { in ni_update_parent()
3301 mi->dirty = true; in ni_update_parent()
3336 if (!ni->mi.mrec) in ni_write_inode()
3339 if (is_rec_inuse(ni->mi.mrec) && in ni_write_inode()
3381 ni->mi.dirty = true; in ni_write_inode()
3412 struct mft_inode *mi = rb_entry(node, struct mft_inode, node); in ni_write_inode() local
3417 if (!mi->dirty) in ni_write_inode()
3420 is_empty = !mi_enum_attr(mi, NULL); in ni_write_inode()
3423 clear_rec_inuse(mi->mrec); in ni_write_inode()
3425 err2 = mi_write(mi, sync); in ni_write_inode()
3430 ntfs_mark_rec_free(sbi, mi->rno, false); in ni_write_inode()
3432 mi_put(mi); in ni_write_inode()
3436 if (ni->mi.dirty) { in ni_write_inode()
3437 err2 = mi_write(&ni->mi, sync); in ni_write_inode()
3512 ni->mi.dirty = true; in ni_set_compress()