Lines Matching refs:ni
49 ntfs_inode *ni; in ntfs_test_inode() local
53 ni = NTFS_I(vi); in ntfs_test_inode()
55 if (likely(!NInoAttr(ni))) { in ntfs_test_inode()
61 if (ni->type != na->type) in ntfs_test_inode()
63 if (ni->name_len != na->name_len) in ntfs_test_inode()
65 if (na->name_len && memcmp(ni->name, na->name, in ntfs_test_inode()
94 ntfs_inode *ni = NTFS_I(vi); in ntfs_init_locked_inode() local
98 ni->type = na->type; in ntfs_init_locked_inode()
100 NInoSetMstProtected(ni); in ntfs_init_locked_inode()
102 ni->name = na->name; in ntfs_init_locked_inode()
103 ni->name_len = na->name_len; in ntfs_init_locked_inode()
113 NInoSetAttr(ni); in ntfs_init_locked_inode()
127 ni->name = kmalloc(i + sizeof(ntfschar), GFP_ATOMIC); in ntfs_init_locked_inode()
128 if (!ni->name) in ntfs_init_locked_inode()
130 memcpy(ni->name, na->name, i); in ntfs_init_locked_inode()
131 ni->name[na->name_len] = 0; in ntfs_init_locked_inode()
310 ntfs_inode *ni; in ntfs_alloc_big_inode() local
313 ni = alloc_inode_sb(sb, ntfs_big_inode_cache, GFP_NOFS); in ntfs_alloc_big_inode()
314 if (likely(ni != NULL)) { in ntfs_alloc_big_inode()
315 ni->state = 0; in ntfs_alloc_big_inode()
316 return VFS_I(ni); in ntfs_alloc_big_inode()
329 ntfs_inode *ni; in ntfs_alloc_extent_inode() local
332 ni = kmem_cache_alloc(ntfs_inode_cache, GFP_NOFS); in ntfs_alloc_extent_inode()
333 if (likely(ni != NULL)) { in ntfs_alloc_extent_inode()
334 ni->state = 0; in ntfs_alloc_extent_inode()
335 return ni; in ntfs_alloc_extent_inode()
341 static void ntfs_destroy_extent_inode(ntfs_inode *ni) in ntfs_destroy_extent_inode() argument
344 BUG_ON(ni->page); in ntfs_destroy_extent_inode()
345 if (!atomic_dec_and_test(&ni->count)) in ntfs_destroy_extent_inode()
347 kmem_cache_free(ntfs_inode_cache, ni); in ntfs_destroy_extent_inode()
368 void __ntfs_init_inode(struct super_block *sb, ntfs_inode *ni) in __ntfs_init_inode() argument
371 rwlock_init(&ni->size_lock); in __ntfs_init_inode()
372 ni->initialized_size = ni->allocated_size = 0; in __ntfs_init_inode()
373 ni->seq_no = 0; in __ntfs_init_inode()
374 atomic_set(&ni->count, 1); in __ntfs_init_inode()
375 ni->vol = NTFS_SB(sb); in __ntfs_init_inode()
376 ntfs_init_runlist(&ni->runlist); in __ntfs_init_inode()
377 mutex_init(&ni->mrec_lock); in __ntfs_init_inode()
378 ni->page = NULL; in __ntfs_init_inode()
379 ni->page_ofs = 0; in __ntfs_init_inode()
380 ni->attr_list_size = 0; in __ntfs_init_inode()
381 ni->attr_list = NULL; in __ntfs_init_inode()
382 ntfs_init_runlist(&ni->attr_list_rl); in __ntfs_init_inode()
383 lockdep_set_class(&ni->attr_list_rl.lock, in __ntfs_init_inode()
385 ni->itype.index.block_size = 0; in __ntfs_init_inode()
386 ni->itype.index.vcn_size = 0; in __ntfs_init_inode()
387 ni->itype.index.collation_rule = 0; in __ntfs_init_inode()
388 ni->itype.index.block_size_bits = 0; in __ntfs_init_inode()
389 ni->itype.index.vcn_size_bits = 0; in __ntfs_init_inode()
390 mutex_init(&ni->extent_lock); in __ntfs_init_inode()
391 ni->nr_extents = 0; in __ntfs_init_inode()
392 ni->ext.base_ntfs_ino = NULL; in __ntfs_init_inode()
405 ntfs_inode *ni = ntfs_alloc_extent_inode(); in ntfs_new_extent_inode() local
408 if (likely(ni != NULL)) { in ntfs_new_extent_inode()
409 __ntfs_init_inode(sb, ni); in ntfs_new_extent_inode()
410 lockdep_set_class(&ni->mrec_lock, &extent_inode_mrec_lock_key); in ntfs_new_extent_inode()
411 ni->mft_no = mft_no; in ntfs_new_extent_inode()
412 ni->type = AT_UNUSED; in ntfs_new_extent_inode()
413 ni->name = NULL; in ntfs_new_extent_inode()
414 ni->name_len = 0; in ntfs_new_extent_inode()
416 return ni; in ntfs_new_extent_inode()
527 ntfs_inode *ni; in ntfs_read_locked_inode() local
548 ni = NTFS_I(vi); in ntfs_read_locked_inode()
550 m = map_mft_record(ni); in ntfs_read_locked_inode()
555 ctx = ntfs_attr_get_search_ctx(ni, m); in ntfs_read_locked_inode()
571 vi->i_generation = ni->seq_no = le16_to_cpu(m->sequence_number); in ntfs_read_locked_inode()
677 NInoSetAttrList(ni); in ntfs_read_locked_inode()
702 ni->attr_list_size = (u32)ntfs_attr_size(a); in ntfs_read_locked_inode()
703 ni->attr_list = ntfs_malloc_nofs(ni->attr_list_size); in ntfs_read_locked_inode()
704 if (!ni->attr_list) { in ntfs_read_locked_inode()
711 NInoSetAttrListNonResident(ni); in ntfs_read_locked_inode()
721 ni->attr_list_rl.rl = ntfs_mapping_pairs_decompress(vol, in ntfs_read_locked_inode()
723 if (IS_ERR(ni->attr_list_rl.rl)) { in ntfs_read_locked_inode()
724 err = PTR_ERR(ni->attr_list_rl.rl); in ntfs_read_locked_inode()
725 ni->attr_list_rl.rl = NULL; in ntfs_read_locked_inode()
731 if ((err = load_attribute_list(vol, &ni->attr_list_rl, in ntfs_read_locked_inode()
732 ni->attr_list, ni->attr_list_size, in ntfs_read_locked_inode()
749 memcpy(ni->attr_list, (u8*)a + le16_to_cpu( in ntfs_read_locked_inode()
801 NInoSetCompressed(ni); in ntfs_read_locked_inode()
808 NInoSetEncrypted(ni); in ntfs_read_locked_inode()
811 NInoSetSparse(ni); in ntfs_read_locked_inode()
836 ni->itype.index.collation_rule = ir->collation_rule; in ntfs_read_locked_inode()
837 ni->itype.index.block_size = le32_to_cpu(ir->index_block_size); in ntfs_read_locked_inode()
838 if (ni->itype.index.block_size & in ntfs_read_locked_inode()
839 (ni->itype.index.block_size - 1)) { in ntfs_read_locked_inode()
842 ni->itype.index.block_size); in ntfs_read_locked_inode()
845 if (ni->itype.index.block_size > PAGE_SIZE) { in ntfs_read_locked_inode()
849 ni->itype.index.block_size, in ntfs_read_locked_inode()
854 if (ni->itype.index.block_size < NTFS_BLOCK_SIZE) { in ntfs_read_locked_inode()
858 ni->itype.index.block_size, in ntfs_read_locked_inode()
863 ni->itype.index.block_size_bits = in ntfs_read_locked_inode()
864 ffs(ni->itype.index.block_size) - 1; in ntfs_read_locked_inode()
866 if (vol->cluster_size <= ni->itype.index.block_size) { in ntfs_read_locked_inode()
867 ni->itype.index.vcn_size = vol->cluster_size; in ntfs_read_locked_inode()
868 ni->itype.index.vcn_size_bits = vol->cluster_size_bits; in ntfs_read_locked_inode()
870 ni->itype.index.vcn_size = vol->sector_size; in ntfs_read_locked_inode()
871 ni->itype.index.vcn_size_bits = vol->sector_size_bits; in ntfs_read_locked_inode()
875 NInoSetMstProtected(ni); in ntfs_read_locked_inode()
876 ni->type = AT_INDEX_ALLOCATION; in ntfs_read_locked_inode()
877 ni->name = I30; in ntfs_read_locked_inode()
878 ni->name_len = 4; in ntfs_read_locked_inode()
882 vi->i_size = ni->initialized_size = in ntfs_read_locked_inode()
883 ni->allocated_size = 0; in ntfs_read_locked_inode()
886 unmap_mft_record(ni); in ntfs_read_locked_inode()
891 NInoSetIndexAllocPresent(ni); in ntfs_read_locked_inode()
947 ni->initialized_size = sle64_to_cpu( in ntfs_read_locked_inode()
949 ni->allocated_size = sle64_to_cpu( in ntfs_read_locked_inode()
956 unmap_mft_record(ni); in ntfs_read_locked_inode()
976 ni->itype.index.block_size_bits)) { in ntfs_read_locked_inode()
994 ni->type = AT_DATA; in ntfs_read_locked_inode()
995 ni->name = NULL; in ntfs_read_locked_inode()
996 ni->name_len = 0; in ntfs_read_locked_inode()
1001 vi->i_size = ni->initialized_size = in ntfs_read_locked_inode()
1002 ni->allocated_size = 0; in ntfs_read_locked_inode()
1034 NInoSetCompressed(ni); in ntfs_read_locked_inode()
1054 NInoSetSparse(ni); in ntfs_read_locked_inode()
1057 if (NInoCompressed(ni)) { in ntfs_read_locked_inode()
1062 NInoSetEncrypted(ni); in ntfs_read_locked_inode()
1065 NInoSetNonResident(ni); in ntfs_read_locked_inode()
1066 if (NInoCompressed(ni) || NInoSparse(ni)) { in ntfs_read_locked_inode()
1067 if (NInoCompressed(ni) && a->data.non_resident. in ntfs_read_locked_inode()
1080 ni->itype.compressed.block_size = 1U << in ntfs_read_locked_inode()
1084 ni->itype.compressed.block_size_bits = in ntfs_read_locked_inode()
1085 ffs(ni->itype. in ntfs_read_locked_inode()
1088 ni->itype.compressed.block_clusters = in ntfs_read_locked_inode()
1093 ni->itype.compressed.block_size = 0; in ntfs_read_locked_inode()
1094 ni->itype.compressed.block_size_bits = in ntfs_read_locked_inode()
1096 ni->itype.compressed.block_clusters = in ntfs_read_locked_inode()
1099 ni->itype.compressed.size = sle64_to_cpu( in ntfs_read_locked_inode()
1111 ni->initialized_size = sle64_to_cpu( in ntfs_read_locked_inode()
1113 ni->allocated_size = sle64_to_cpu( in ntfs_read_locked_inode()
1116 vi->i_size = ni->initialized_size = le32_to_cpu( in ntfs_read_locked_inode()
1118 ni->allocated_size = le32_to_cpu(a->length) - in ntfs_read_locked_inode()
1121 if (vi->i_size > ni->allocated_size) { in ntfs_read_locked_inode()
1131 unmap_mft_record(ni); in ntfs_read_locked_inode()
1138 if (NInoMstProtected(ni)) in ntfs_read_locked_inode()
1140 else if (NInoCompressed(ni)) in ntfs_read_locked_inode()
1154 if (S_ISREG(vi->i_mode) && (NInoCompressed(ni) || NInoSparse(ni))) in ntfs_read_locked_inode()
1155 vi->i_blocks = ni->itype.compressed.size >> 9; in ntfs_read_locked_inode()
1157 vi->i_blocks = ni->allocated_size >> 9; in ntfs_read_locked_inode()
1168 unmap_mft_record(ni); in ntfs_read_locked_inode()
1203 ntfs_inode *ni, *base_ni; in ntfs_read_locked_attr_inode() local
1213 ni = NTFS_I(vi); in ntfs_read_locked_attr_inode()
1223 vi->i_generation = ni->seq_no = base_ni->seq_no; in ntfs_read_locked_attr_inode()
1239 err = ntfs_attr_lookup(ni->type, ni->name, ni->name_len, in ntfs_read_locked_attr_inode()
1246 NInoSetCompressed(ni); in ntfs_read_locked_attr_inode()
1247 if ((ni->type != AT_DATA) || (ni->type == AT_DATA && in ntfs_read_locked_attr_inode()
1248 ni->name_len)) { in ntfs_read_locked_attr_inode()
1276 if (NInoMstProtected(ni) && ni->type != AT_INDEX_ROOT) { in ntfs_read_locked_attr_inode()
1281 NInoCompressed(ni) ? "compressed" : in ntfs_read_locked_attr_inode()
1286 NInoSetSparse(ni); in ntfs_read_locked_attr_inode()
1289 if (NInoCompressed(ni)) { in ntfs_read_locked_attr_inode()
1298 if (NInoMstProtected(ni) && ni->type != AT_INDEX_ROOT) { in ntfs_read_locked_attr_inode()
1306 if (ni->type != AT_DATA) { in ntfs_read_locked_attr_inode()
1311 NInoSetEncrypted(ni); in ntfs_read_locked_attr_inode()
1321 if (NInoMstProtected(ni)) { in ntfs_read_locked_attr_inode()
1328 vi->i_size = ni->initialized_size = le32_to_cpu( in ntfs_read_locked_attr_inode()
1330 ni->allocated_size = le32_to_cpu(a->length) - in ntfs_read_locked_attr_inode()
1332 if (vi->i_size > ni->allocated_size) { in ntfs_read_locked_attr_inode()
1338 NInoSetNonResident(ni); in ntfs_read_locked_attr_inode()
1350 if (NInoCompressed(ni) || NInoSparse(ni)) { in ntfs_read_locked_attr_inode()
1351 if (NInoCompressed(ni) && a->data.non_resident. in ntfs_read_locked_attr_inode()
1362 ni->itype.compressed.block_size = 1U << in ntfs_read_locked_attr_inode()
1366 ni->itype.compressed.block_size_bits = in ntfs_read_locked_attr_inode()
1367 ffs(ni->itype.compressed. in ntfs_read_locked_attr_inode()
1369 ni->itype.compressed.block_clusters = 1U << in ntfs_read_locked_attr_inode()
1373 ni->itype.compressed.block_size = 0; in ntfs_read_locked_attr_inode()
1374 ni->itype.compressed.block_size_bits = 0; in ntfs_read_locked_attr_inode()
1375 ni->itype.compressed.block_clusters = 0; in ntfs_read_locked_attr_inode()
1377 ni->itype.compressed.size = sle64_to_cpu( in ntfs_read_locked_attr_inode()
1386 ni->initialized_size = sle64_to_cpu( in ntfs_read_locked_attr_inode()
1388 ni->allocated_size = sle64_to_cpu( in ntfs_read_locked_attr_inode()
1392 if (NInoMstProtected(ni)) in ntfs_read_locked_attr_inode()
1394 else if (NInoCompressed(ni)) in ntfs_read_locked_attr_inode()
1396 if ((NInoCompressed(ni) || NInoSparse(ni)) && ni->type != AT_INDEX_ROOT) in ntfs_read_locked_attr_inode()
1397 vi->i_blocks = ni->itype.compressed.size >> 9; in ntfs_read_locked_attr_inode()
1399 vi->i_blocks = ni->allocated_size >> 9; in ntfs_read_locked_attr_inode()
1405 ni->ext.base_ntfs_ino = base_ni; in ntfs_read_locked_attr_inode()
1406 ni->nr_extents = -1; in ntfs_read_locked_attr_inode()
1424 "Run chkdsk.", err, vi->i_ino, ni->type, ni->name_len, in ntfs_read_locked_attr_inode()
1469 ntfs_inode *ni, *base_ni, *bni; in ntfs_read_locked_index_inode() local
1480 ni = NTFS_I(vi); in ntfs_read_locked_index_inode()
1489 vi->i_generation = ni->seq_no = base_ni->seq_no; in ntfs_read_locked_index_inode()
1504 err = ntfs_attr_lookup(AT_INDEX_ROOT, ni->name, ni->name_len, in ntfs_read_locked_index_inode()
1551 ni->itype.index.collation_rule = ir->collation_rule; in ntfs_read_locked_index_inode()
1554 ni->itype.index.block_size = le32_to_cpu(ir->index_block_size); in ntfs_read_locked_index_inode()
1555 if (!is_power_of_2(ni->itype.index.block_size)) { in ntfs_read_locked_index_inode()
1557 "two.", ni->itype.index.block_size); in ntfs_read_locked_index_inode()
1560 if (ni->itype.index.block_size > PAGE_SIZE) { in ntfs_read_locked_index_inode()
1563 ni->itype.index.block_size, PAGE_SIZE); in ntfs_read_locked_index_inode()
1567 if (ni->itype.index.block_size < NTFS_BLOCK_SIZE) { in ntfs_read_locked_index_inode()
1570 ni->itype.index.block_size, NTFS_BLOCK_SIZE); in ntfs_read_locked_index_inode()
1574 ni->itype.index.block_size_bits = ffs(ni->itype.index.block_size) - 1; in ntfs_read_locked_index_inode()
1576 if (vol->cluster_size <= ni->itype.index.block_size) { in ntfs_read_locked_index_inode()
1577 ni->itype.index.vcn_size = vol->cluster_size; in ntfs_read_locked_index_inode()
1578 ni->itype.index.vcn_size_bits = vol->cluster_size_bits; in ntfs_read_locked_index_inode()
1580 ni->itype.index.vcn_size = vol->sector_size; in ntfs_read_locked_index_inode()
1581 ni->itype.index.vcn_size_bits = vol->sector_size_bits; in ntfs_read_locked_index_inode()
1586 vi->i_size = ni->initialized_size = ni->allocated_size = 0; in ntfs_read_locked_index_inode()
1594 NInoSetIndexAllocPresent(ni); in ntfs_read_locked_index_inode()
1597 err = ntfs_attr_lookup(AT_INDEX_ALLOCATION, ni->name, ni->name_len, in ntfs_read_locked_index_inode()
1645 ni->initialized_size = sle64_to_cpu( in ntfs_read_locked_index_inode()
1647 ni->allocated_size = sle64_to_cpu(a->data.non_resident.allocated_size); in ntfs_read_locked_index_inode()
1657 bvi = ntfs_attr_iget(base_vi, AT_BITMAP, ni->name, ni->name_len); in ntfs_read_locked_index_inode()
1672 if ((bvi_size << 3) < (vi->i_size >> ni->itype.index.block_size_bits)) { in ntfs_read_locked_index_inode()
1682 vi->i_blocks = ni->allocated_size >> 9; in ntfs_read_locked_index_inode()
1688 ni->ext.base_ntfs_ino = base_ni; in ntfs_read_locked_index_inode()
1689 ni->nr_extents = -1; in ntfs_read_locked_index_inode()
1705 ni->name_len); in ntfs_read_locked_index_inode()
1754 ntfs_inode *ni; in ntfs_read_inode_mount() local
1766 ni = NTFS_I(vi); in ntfs_read_inode_mount()
1769 NInoSetNonResident(ni); in ntfs_read_inode_mount()
1770 NInoSetMstProtected(ni); in ntfs_read_inode_mount()
1771 NInoSetSparseDisabled(ni); in ntfs_read_inode_mount()
1772 ni->type = AT_DATA; in ntfs_read_inode_mount()
1773 ni->name = NULL; in ntfs_read_inode_mount()
1774 ni->name_len = 0; in ntfs_read_inode_mount()
1779 ni->itype.index.block_size = vol->mft_record_size; in ntfs_read_inode_mount()
1780 ni->itype.index.block_size_bits = vol->mft_record_size_bits; in ntfs_read_inode_mount()
1840 vi->i_generation = ni->seq_no = le16_to_cpu(m->sequence_number); in ntfs_read_inode_mount()
1845 ctx = ntfs_attr_get_search_ctx(ni, m); in ntfs_read_inode_mount()
1866 NInoSetAttrList(ni); in ntfs_read_inode_mount()
1890 ni->attr_list_size = (u32)ntfs_attr_size(a); in ntfs_read_inode_mount()
1891 if (!ni->attr_list_size) { in ntfs_read_inode_mount()
1895 ni->attr_list = ntfs_malloc_nofs(ni->attr_list_size); in ntfs_read_inode_mount()
1896 if (!ni->attr_list) { in ntfs_read_inode_mount()
1902 NInoSetAttrListNonResident(ni); in ntfs_read_inode_mount()
1910 ni->attr_list_rl.rl = ntfs_mapping_pairs_decompress(vol, in ntfs_read_inode_mount()
1912 if (IS_ERR(ni->attr_list_rl.rl)) { in ntfs_read_inode_mount()
1913 err = PTR_ERR(ni->attr_list_rl.rl); in ntfs_read_inode_mount()
1914 ni->attr_list_rl.rl = NULL; in ntfs_read_inode_mount()
1921 if ((err = load_attribute_list(vol, &ni->attr_list_rl, in ntfs_read_inode_mount()
1922 ni->attr_list, ni->attr_list_size, in ntfs_read_inode_mount()
1941 memcpy(ni->attr_list, (u8*)a + le16_to_cpu( in ntfs_read_inode_mount()
1958 al_entry = (ATTR_LIST_ENTRY*)ni->attr_list; in ntfs_read_inode_mount()
1959 al_end = (u8*)al_entry + ni->attr_list_size; in ntfs_read_inode_mount()
1962 if ((u8*)al_entry < ni->attr_list || in ntfs_read_inode_mount()
1998 ni->seq_no) in ntfs_read_inode_mount()
2041 nrl = ntfs_mapping_pairs_decompress(vol, a, ni->runlist.rl); in ntfs_read_inode_mount()
2048 ni->runlist.rl = nrl; in ntfs_read_inode_mount()
2066 ni->initialized_size = sle64_to_cpu( in ntfs_read_inode_mount()
2068 ni->allocated_size = sle64_to_cpu( in ntfs_read_inode_mount()
2169 lockdep_set_class(&ni->runlist.lock, &mft_ni_runlist_lock_key); in ntfs_read_inode_mount()
2170 lockdep_set_class(&ni->mrec_lock, &mft_ni_mrec_lock_key); in ntfs_read_inode_mount()
2186 static void __ntfs_clear_inode(ntfs_inode *ni) in __ntfs_clear_inode() argument
2189 down_write(&ni->runlist.lock); in __ntfs_clear_inode()
2190 if (ni->runlist.rl) { in __ntfs_clear_inode()
2191 ntfs_free(ni->runlist.rl); in __ntfs_clear_inode()
2192 ni->runlist.rl = NULL; in __ntfs_clear_inode()
2194 up_write(&ni->runlist.lock); in __ntfs_clear_inode()
2196 if (ni->attr_list) { in __ntfs_clear_inode()
2197 ntfs_free(ni->attr_list); in __ntfs_clear_inode()
2198 ni->attr_list = NULL; in __ntfs_clear_inode()
2201 down_write(&ni->attr_list_rl.lock); in __ntfs_clear_inode()
2202 if (ni->attr_list_rl.rl) { in __ntfs_clear_inode()
2203 ntfs_free(ni->attr_list_rl.rl); in __ntfs_clear_inode()
2204 ni->attr_list_rl.rl = NULL; in __ntfs_clear_inode()
2206 up_write(&ni->attr_list_rl.lock); in __ntfs_clear_inode()
2208 if (ni->name_len && ni->name != I30) { in __ntfs_clear_inode()
2210 BUG_ON(!ni->name); in __ntfs_clear_inode()
2211 kfree(ni->name); in __ntfs_clear_inode()
2215 void ntfs_clear_extent_inode(ntfs_inode *ni) in ntfs_clear_extent_inode() argument
2217 ntfs_debug("Entering for inode 0x%lx.", ni->mft_no); in ntfs_clear_extent_inode()
2219 BUG_ON(NInoAttr(ni)); in ntfs_clear_extent_inode()
2220 BUG_ON(ni->nr_extents != -1); in ntfs_clear_extent_inode()
2223 if (NInoDirty(ni)) { in ntfs_clear_extent_inode()
2224 if (!is_bad_inode(VFS_I(ni->ext.base_ntfs_ino))) in ntfs_clear_extent_inode()
2225 ntfs_error(ni->vol->sb, "Clearing dirty extent inode! " in ntfs_clear_extent_inode()
2231 __ntfs_clear_inode(ni); in ntfs_clear_extent_inode()
2234 ntfs_destroy_extent_inode(ni); in ntfs_clear_extent_inode()
2249 ntfs_inode *ni = NTFS_I(vi); in ntfs_evict_big_inode() local
2255 if (NInoDirty(ni)) { in ntfs_evict_big_inode()
2261 if (!was_bad && (is_bad_inode(vi) || NInoDirty(ni))) { in ntfs_evict_big_inode()
2270 if (ni->nr_extents > 0) { in ntfs_evict_big_inode()
2273 for (i = 0; i < ni->nr_extents; i++) in ntfs_evict_big_inode()
2274 ntfs_clear_extent_inode(ni->ext.extent_ntfs_inos[i]); in ntfs_evict_big_inode()
2275 kfree(ni->ext.extent_ntfs_inos); in ntfs_evict_big_inode()
2278 __ntfs_clear_inode(ni); in ntfs_evict_big_inode()
2280 if (NInoAttr(ni)) { in ntfs_evict_big_inode()
2282 if (ni->nr_extents == -1) { in ntfs_evict_big_inode()
2283 iput(VFS_I(ni->ext.base_ntfs_ino)); in ntfs_evict_big_inode()
2284 ni->nr_extents = 0; in ntfs_evict_big_inode()
2285 ni->ext.base_ntfs_ino = NULL; in ntfs_evict_big_inode()
2288 BUG_ON(ni->page); in ntfs_evict_big_inode()
2289 if (!atomic_dec_and_test(&ni->count)) in ntfs_evict_big_inode()
2360 ntfs_inode *base_ni, *ni = NTFS_I(vi); in ntfs_truncate() local
2361 ntfs_volume *vol = ni->vol; in ntfs_truncate()
2369 BUG_ON(NInoAttr(ni)); in ntfs_truncate()
2371 BUG_ON(NInoMstProtected(ni)); in ntfs_truncate()
2372 BUG_ON(ni->nr_extents < 0); in ntfs_truncate()
2378 down_write(&ni->runlist.lock); in ntfs_truncate()
2379 if (!NInoAttr(ni)) in ntfs_truncate()
2380 base_ni = ni; in ntfs_truncate()
2382 base_ni = ni->ext.base_ntfs_ino; in ntfs_truncate()
2400 err = ntfs_attr_lookup(ni->type, ni->name, ni->name_len, in ntfs_truncate()
2423 if (NInoNonResident(ni)) in ntfs_truncate()
2429 read_lock_irqsave(&ni->size_lock, flags); in ntfs_truncate()
2430 old_alloc_size = ni->allocated_size; in ntfs_truncate()
2431 read_unlock_irqrestore(&ni->size_lock, flags); in ntfs_truncate()
2457 err = ntfs_attr_size_bounds_check(vol, ni->type, new_size); in ntfs_truncate()
2467 le32_to_cpu(ni->type)); in ntfs_truncate()
2474 le32_to_cpu(ni->type)); in ntfs_truncate()
2482 if (NInoCompressed(ni) || NInoEncrypted(ni)) { in ntfs_truncate()
2485 NInoCompressed(ni) ? "compressed" : in ntfs_truncate()
2492 BUG_ON(NInoNonResident(ni)); in ntfs_truncate()
2499 write_lock_irqsave(&ni->size_lock, flags); in ntfs_truncate()
2501 ni->allocated_size = le32_to_cpu(a->length) - in ntfs_truncate()
2531 ni->initialized_size = new_size; in ntfs_truncate()
2532 write_unlock_irqrestore(&ni->size_lock, flags); in ntfs_truncate()
2548 up_write(&ni->runlist.lock); in ntfs_truncate()
2553 err = ntfs_attr_make_non_resident(ni, old_size); in ntfs_truncate()
2566 (unsigned)le32_to_cpu(ni->type), err); in ntfs_truncate()
2592 if (ni->type == AT_ATTRIBUTE_LIST || in ntfs_truncate()
2593 ni->type == AT_STANDARD_INFORMATION) { in ntfs_truncate()
2611 BUG_ON(!NInoNonResident(ni)); in ntfs_truncate()
2627 (unsigned)le32_to_cpu(ni->type)); in ntfs_truncate()
2640 write_lock_irqsave(&ni->size_lock, flags); in ntfs_truncate()
2641 if (new_size < ni->initialized_size) { in ntfs_truncate()
2642 ni->initialized_size = new_size; in ntfs_truncate()
2647 write_unlock_irqrestore(&ni->size_lock, flags); in ntfs_truncate()
2681 up_write(&ni->runlist.lock); in ntfs_truncate()
2682 err = ntfs_attr_extend_allocation(ni, new_size, in ntfs_truncate()
2695 nr_freed = ntfs_cluster_free(ni, new_alloc_size >> in ntfs_truncate()
2707 err = ntfs_rl_truncate_nolock(vol, &ni->runlist, in ntfs_truncate()
2725 mp_size = ntfs_get_size_for_mapping_pairs(vol, ni->runlist.rl, 0, -1); in ntfs_truncate()
2731 (unsigned)le32_to_cpu(ni->type), mp_size, es); in ntfs_truncate()
2748 mp_size, ni->runlist.rl, 0, -1, NULL); in ntfs_truncate()
2753 vi->i_ino, (unsigned)le32_to_cpu(ni->type), in ntfs_truncate()
2761 write_lock_irqsave(&ni->size_lock, flags); in ntfs_truncate()
2762 ni->allocated_size = new_alloc_size; in ntfs_truncate()
2764 if (NInoSparse(ni) || NInoCompressed(ni)) { in ntfs_truncate()
2766 ni->itype.compressed.size -= nr_freed << in ntfs_truncate()
2768 BUG_ON(ni->itype.compressed.size < 0); in ntfs_truncate()
2770 ni->itype.compressed.size); in ntfs_truncate()
2771 vi->i_blocks = ni->itype.compressed.size >> 9; in ntfs_truncate()
2775 write_unlock_irqrestore(&ni->size_lock, flags); in ntfs_truncate()
2797 up_write(&ni->runlist.lock); in ntfs_truncate()
2820 NInoClearTruncateFailed(ni); in ntfs_truncate()
2830 NInoSetTruncateFailed(ni); in ntfs_truncate()
2838 up_write(&ni->runlist.lock); in ntfs_truncate()
2846 NInoSetTruncateFailed(ni); in ntfs_truncate()
2900 ntfs_inode *ni = NTFS_I(vi); in ntfs_setattr() local
2905 if (NInoCompressed(ni) || NInoEncrypted(ni)) { in ntfs_setattr()
2909 NInoCompressed(ni) ? in ntfs_setattr()
2958 ntfs_inode *ni = NTFS_I(vi); in __ntfs_write_inode() local
2965 ntfs_debug("Entering for %sinode 0x%lx.", NInoAttr(ni) ? "attr " : "", in __ntfs_write_inode()
2972 if (NInoAttr(ni)) { in __ntfs_write_inode()
2973 NInoClearDirty(ni); in __ntfs_write_inode()
2978 m = map_mft_record(ni); in __ntfs_write_inode()
2984 ctx = ntfs_attr_get_search_ctx(ni, m); in __ntfs_write_inode()
3049 if (NInoDirty(ni)) in __ntfs_write_inode()
3050 err = write_mft_record(ni, m, sync); in __ntfs_write_inode()
3052 mutex_lock(&ni->extent_lock); in __ntfs_write_inode()
3053 if (ni->nr_extents > 0) { in __ntfs_write_inode()
3054 ntfs_inode **extent_nis = ni->ext.extent_ntfs_inos; in __ntfs_write_inode()
3057 ntfs_debug("Writing %i extent inodes.", ni->nr_extents); in __ntfs_write_inode()
3058 for (i = 0; i < ni->nr_extents; i++) { in __ntfs_write_inode()
3079 mutex_unlock(&ni->extent_lock); in __ntfs_write_inode()
3080 unmap_mft_record(ni); in __ntfs_write_inode()
3086 unmap_mft_record(ni); in __ntfs_write_inode()
3095 NVolSetErrors(ni->vol); in __ntfs_write_inode()