Lines Matching full:ni
28 struct ntfs_inode *ni = ntfs_i(inode); in ntfs_read_mft() local
54 err = mi_init(&ni->mi, sbi, ino); in ntfs_read_mft()
58 if (!sbi->mft.ni && ino == MFT_REC_MFT && !sb->s_root) { in ntfs_read_mft()
61 sbi->mft.ni = ni; in ntfs_read_mft()
62 init_rwsem(&ni->file.run_lock); in ntfs_read_mft()
64 if (!run_add_entry(&ni->file.run, 0, t64, t32, true)) { in ntfs_read_mft()
70 err = mi_read(&ni->mi, ino == MFT_REC_MFT); in ntfs_read_mft()
75 rec = ni->mi.mrec; in ntfs_read_mft()
118 * while( (attr = ni_enum_attr_ex(ni, attr, &le, NULL) )) in ntfs_read_mft()
123 attr = ni_enum_attr_ex(ni, attr, &le, NULL); in ntfs_read_mft()
132 run = &ni->file.run; in ntfs_read_mft()
170 nt2kernel(std5->cr_time, &ni->i_crtime); in ntfs_read_mft()
179 ni->std_fa = std5->fa; in ntfs_read_mft()
183 ni->std_security_id = std5->security_id; in ntfs_read_mft()
190 err = ntfs_load_attr_list(ni, attr); in ntfs_read_mft()
237 ni->std_fa |= FILE_ATTRIBUTE_SPARSE_FILE; in ntfs_read_mft()
239 ni->std_fa &= ~FILE_ATTRIBUTE_SPARSE_FILE; in ntfs_read_mft()
242 ni->std_fa |= FILE_ATTRIBUTE_COMPRESSED; in ntfs_read_mft()
244 ni->std_fa &= ~FILE_ATTRIBUTE_COMPRESSED; in ntfs_read_mft()
247 ni->std_fa |= FILE_ATTRIBUTE_ENCRYPTED; in ntfs_read_mft()
249 ni->std_fa &= ~FILE_ATTRIBUTE_ENCRYPTED; in ntfs_read_mft()
252 ni->i_valid = inode->i_size = rsize; in ntfs_read_mft()
259 ni->ni_flags |= NI_FLAG_RESIDENT; in ntfs_read_mft()
265 ni->i_valid = le64_to_cpu(attr->nres.valid_size); in ntfs_read_mft()
271 &ni->file.run; in ntfs_read_mft()
292 ni->ni_flags |= NI_FLAG_DIR; in ntfs_read_mft()
294 err = indx_init(&ni->dir, sbi, attr, INDEX_MUTEX_I30); in ntfs_read_mft()
309 ni->i_valid = le64_to_cpu(attr->nres.valid_size); in ntfs_read_mft()
312 run = &ni->dir.alloc_run; in ntfs_read_mft()
330 run = &ni->dir.bitmap_run; in ntfs_read_mft()
339 rp_fa = ni_parse_reparse(ni, attr, &rp); in ntfs_read_mft()
349 ni->i_valid = inode->i_size; in ntfs_read_mft()
351 if (ni->ni_flags & NI_FLAG_DIR) { in ntfs_read_mft()
352 indx_clear(&ni->dir); in ntfs_read_mft()
353 memset(&ni->dir, 0, sizeof(ni->dir)); in ntfs_read_mft()
354 ni->ni_flags &= ~NI_FLAG_DIR; in ntfs_read_mft()
356 run_close(&ni->file.run); in ntfs_read_mft()
361 run = &ni->file.run; in ntfs_read_mft()
377 ni->ni_flags |= NI_FLAG_EA; in ntfs_read_mft()
430 ni->mi.dirty = true; in ntfs_read_mft()
436 ni->std_fa |= FILE_ATTRIBUTE_DIRECTORY; in ntfs_read_mft()
447 ni->i_valid = 0; in ntfs_read_mft()
449 ni->std_fa &= ~FILE_ATTRIBUTE_DIRECTORY; in ntfs_read_mft()
454 ni->std_fa &= ~FILE_ATTRIBUTE_DIRECTORY; in ntfs_read_mft()
459 inode->i_mapping->a_ops = is_compressed(ni) ? &ntfs_aops_cmpr : in ntfs_read_mft()
462 init_rwsem(&ni->file.run_lock); in ntfs_read_mft()
485 if (!(ni->ni_flags & NI_FLAG_EA)) { in ntfs_read_mft()
491 sbi->mft.ni = NULL; in ntfs_read_mft()
499 sbi->mft.ni = NULL; in ntfs_read_mft()
567 struct ntfs_inode *ni = ntfs_i(inode); in ntfs_get_block_vbo() local
581 if (is_resident(ni)) { in ntfs_get_block_vbo()
588 ni_lock(ni); in ntfs_get_block_vbo()
589 err = attr_data_read_resident(ni, folio); in ntfs_get_block_vbo()
590 ni_unlock(ni); in ntfs_get_block_vbo()
602 err = attr_data_get_block(ni, vcn, 1, &lcn, &len, create ? &new : NULL, in ntfs_get_block_vbo()
631 valid = ni->i_valid; in ntfs_get_block_vbo()
634 /* ntfs_direct_IO will update ni->i_valid. */ in ntfs_get_block_vbo()
646 ni->i_valid = vbo + bytes; in ntfs_get_block_vbo()
720 struct ntfs_inode *ni = ntfs_i(inode); in ntfs_read_folio() local
722 if (is_resident(ni)) { in ntfs_read_folio()
723 ni_lock(ni); in ntfs_read_folio()
724 err = attr_data_read_resident(ni, folio); in ntfs_read_folio()
725 ni_unlock(ni); in ntfs_read_folio()
732 if (is_compressed(ni)) { in ntfs_read_folio()
733 ni_lock(ni); in ntfs_read_folio()
734 err = ni_readpage_cmpr(ni, folio); in ntfs_read_folio()
735 ni_unlock(ni); in ntfs_read_folio()
747 struct ntfs_inode *ni = ntfs_i(inode); in ntfs_readahead() local
751 if (is_resident(ni)) { in ntfs_readahead()
756 if (is_compressed(ni)) { in ntfs_readahead()
761 valid = ni->i_valid; in ntfs_readahead()
792 struct ntfs_inode *ni = ntfs_i(inode); in ntfs_direct_IO() local
800 if (is_resident(ni)) { in ntfs_direct_IO()
817 valid = ni->i_valid; in ntfs_direct_IO()
820 ni->i_valid = end; in ntfs_direct_IO()
837 struct ntfs_inode *ni = ntfs_i(inode); in ntfs_set_size() local
841 if (is_sparsed(ni) || is_compressed(ni)) { in ntfs_set_size()
851 ni_lock(ni); in ntfs_set_size()
852 down_write(&ni->file.run_lock); in ntfs_set_size()
854 err = attr_set_size(ni, ATTR_DATA, NULL, 0, &ni->file.run, new_size, in ntfs_set_size()
855 &ni->i_valid, true, NULL); in ntfs_set_size()
857 up_write(&ni->file.run_lock); in ntfs_set_size()
858 ni_unlock(ni); in ntfs_set_size()
871 struct ntfs_inode *ni = ntfs_i(inode); in ntfs_resident_writepage() local
877 ni_lock(ni); in ntfs_resident_writepage()
878 ret = attr_data_write_resident(ni, folio); in ntfs_resident_writepage()
879 ni_unlock(ni); in ntfs_resident_writepage()
913 struct ntfs_inode *ni = ntfs_i(inode); in ntfs_write_begin() local
918 if (is_resident(ni)) { in ntfs_write_begin()
928 ni_lock(ni); in ntfs_write_begin()
929 err = attr_data_read_resident(ni, folio); in ntfs_write_begin()
930 ni_unlock(ni); in ntfs_write_begin()
957 struct ntfs_inode *ni = ntfs_i(inode); in ntfs_write_end() local
958 u64 valid = ni->i_valid; in ntfs_write_end()
962 if (is_resident(ni)) { in ntfs_write_end()
963 ni_lock(ni); in ntfs_write_end()
964 err = attr_data_write_resident(ni, folio); in ntfs_write_end()
965 ni_unlock(ni); in ntfs_write_end()
990 if (!(ni->std_fa & FILE_ATTRIBUTE_ARCHIVE)) { in ntfs_write_end()
993 ni->std_fa |= FILE_ATTRIBUTE_ARCHIVE; in ntfs_write_end()
997 if (valid != ni->i_valid) { in ntfs_write_end()
998 /* ni->i_valid is changed in ntfs_get_block_vbo. */ in ntfs_write_end()
1198 struct ntfs_inode *ni = NULL; in ntfs_create_inode() local
1309 ni = ntfs_new_inode(sbi, ino, S_ISDIR(mode) ? RECORD_FLAG_DIR : 0); in ntfs_create_inode()
1310 if (IS_ERR(ni)) { in ntfs_create_inode()
1311 err = PTR_ERR(ni); in ntfs_create_inode()
1312 ni = NULL; in ntfs_create_inode()
1315 inode = &ni->vfs_inode; in ntfs_create_inode()
1319 ni->i_crtime = current_time(inode); in ntfs_create_inode()
1321 rec = ni->mi.mrec; in ntfs_create_inode()
1349 ni->std_security_id = security_id; in ntfs_create_inode()
1360 kernel2nt(&ni->i_crtime); in ntfs_create_inode()
1362 std5->fa = ni->std_fa = fa; in ntfs_create_inode()
1371 mi_get_ref(&ni->mi, &new_de->ref); in ntfs_create_inode()
1494 ni->ni_flags |= NI_FLAG_RESIDENT; in ntfs_create_inode()
1498 ni->ni_flags |= NI_FLAG_DIR; in ntfs_create_inode()
1499 err = indx_init(&ni->dir, sbi, attr, INDEX_MUTEX_I30); in ntfs_create_inode()
1542 err = attr_allocate_clusters(sbi, &ni->file.run, 0, 0, in ntfs_create_inode()
1548 err = run_pack(&ni->file.run, 0, clst, in ntfs_create_inode()
1561 err = ntfs_sb_write_run(sbi, &ni->file.run, 0, rp, in ntfs_create_inode()
1607 inode->i_mapping->a_ops = is_compressed(ni) ? &ntfs_aops_cmpr : in ntfs_create_inode()
1609 init_rwsem(&ni->file.run_lock); in ntfs_create_inode()
1640 attr = ni_find_attr(ni, NULL, NULL, ATTR_NAME, NULL, 0, NULL, NULL); in ntfs_create_inode()
1650 ni->ni_flags &= ~NI_FLAG_UPDATE_PARENT; in ntfs_create_inode()
1664 inode_set_atime_to_ts(inode, ni->i_crtime); in ntfs_create_inode()
1665 inode_set_ctime_to_ts(inode, ni->i_crtime); in ntfs_create_inode()
1666 inode_set_mtime_to_ts(inode, ni->i_crtime); in ntfs_create_inode()
1667 inode_set_mtime_to_ts(dir, ni->i_crtime); in ntfs_create_inode()
1668 inode_set_ctime_to_ts(dir, ni->i_crtime); in ntfs_create_inode()
1677 attr = ni_find_attr(ni, NULL, NULL, ATTR_EA, NULL, 0, NULL, NULL); in ntfs_create_inode()
1682 attr_set_size(ni, ATTR_EA, NULL, 0, &run, 0, NULL, false, NULL); in ntfs_create_inode()
1691 run_deallocate(sbi, &ni->file.run, false); in ntfs_create_inode()
1696 ni->mi.dirty = false; in ntfs_create_inode()
1718 struct ntfs_inode *ni = ntfs_i(inode); in ntfs_link_inode() local
1735 err = ni_add_name(ntfs_i(d_inode(dentry->d_parent)), ni, de); in ntfs_link_inode()
1752 struct ntfs_inode *ni = ntfs_i(inode); in ntfs_unlink_inode() local
1757 if (ntfs_is_meta_file(sbi, ni->mi.rno)) in ntfs_unlink_inode()
1765 ni_lock(ni); in ntfs_unlink_inode()
1777 err = ni_remove_name(dir_ni, ni, de, &de2, &undo_remove); in ntfs_unlink_inode()
1786 } else if (!ni_remove_name_undo(dir_ni, ni, de, de2, undo_remove)) { in ntfs_unlink_inode()
1796 ni_unlock(ni); in ntfs_unlink_inode()
1911 struct ntfs_inode *ni = ntfs_i(inode); in ntfs_readlink_hlp() local
1927 attr = ni_find_attr(ni, NULL, NULL, ATTR_REPARSE, NULL, 0, NULL, NULL); in ntfs_readlink_hlp()
1952 err = ntfs_read_run_nb(sbi, &ni->file.run, 0, rp, size, NULL); in ntfs_readlink_hlp()