• Home
  • Raw
  • Download

Lines Matching refs:ni

70 int ntfs_map_runlist_nolock(ntfs_inode *ni, VCN vcn, ntfs_attr_search_ctx *ctx)  in ntfs_map_runlist_nolock()  argument
85 if (!NInoAttr(ni)) in ntfs_map_runlist_nolock()
86 base_ni = ni; in ntfs_map_runlist_nolock()
88 base_ni = ni->ext.base_ntfs_ino; in ntfs_map_runlist_nolock()
107 read_lock_irqsave(&ni->size_lock, flags); in ntfs_map_runlist_nolock()
108 allocated_size_vcn = ni->allocated_size >> in ntfs_map_runlist_nolock()
109 ni->vol->cluster_size_bits; in ntfs_map_runlist_nolock()
110 read_unlock_irqrestore(&ni->size_lock, flags); in ntfs_map_runlist_nolock()
120 if (vcn >= allocated_size_vcn || (a->type == ni->type && in ntfs_map_runlist_nolock()
121 a->name_length == ni->name_len && in ntfs_map_runlist_nolock()
123 ni->name, ni->name_len) && in ntfs_map_runlist_nolock()
152 err = ntfs_attr_lookup(ni->type, ni->name, ni->name_len, in ntfs_map_runlist_nolock()
173 rl = ntfs_mapping_pairs_decompress(ni->vol, a, ni->runlist.rl); in ntfs_map_runlist_nolock()
177 ni->runlist.rl = rl; in ntfs_map_runlist_nolock()
284 int ntfs_map_runlist(ntfs_inode *ni, VCN vcn) in ntfs_map_runlist() argument
288 down_write(&ni->runlist.lock); in ntfs_map_runlist()
290 if (likely(ntfs_rl_vcn_to_lcn(ni->runlist.rl, vcn) <= in ntfs_map_runlist()
292 err = ntfs_map_runlist_nolock(ni, vcn, NULL); in ntfs_map_runlist()
293 up_write(&ni->runlist.lock); in ntfs_map_runlist()
327 LCN ntfs_attr_vcn_to_lcn_nolock(ntfs_inode *ni, const VCN vcn, in ntfs_attr_vcn_to_lcn_nolock() argument
334 BUG_ON(!ni); in ntfs_attr_vcn_to_lcn_nolock()
336 ni->mft_no, (unsigned long long)vcn, in ntfs_attr_vcn_to_lcn_nolock()
338 BUG_ON(!NInoNonResident(ni)); in ntfs_attr_vcn_to_lcn_nolock()
340 if (!ni->runlist.rl) { in ntfs_attr_vcn_to_lcn_nolock()
341 read_lock_irqsave(&ni->size_lock, flags); in ntfs_attr_vcn_to_lcn_nolock()
342 if (!ni->allocated_size) { in ntfs_attr_vcn_to_lcn_nolock()
343 read_unlock_irqrestore(&ni->size_lock, flags); in ntfs_attr_vcn_to_lcn_nolock()
346 read_unlock_irqrestore(&ni->size_lock, flags); in ntfs_attr_vcn_to_lcn_nolock()
350 lcn = ntfs_rl_vcn_to_lcn(ni->runlist.rl, vcn); in ntfs_attr_vcn_to_lcn_nolock()
362 up_read(&ni->runlist.lock); in ntfs_attr_vcn_to_lcn_nolock()
363 down_write(&ni->runlist.lock); in ntfs_attr_vcn_to_lcn_nolock()
364 if (unlikely(ntfs_rl_vcn_to_lcn(ni->runlist.rl, vcn) != in ntfs_attr_vcn_to_lcn_nolock()
366 up_write(&ni->runlist.lock); in ntfs_attr_vcn_to_lcn_nolock()
367 down_read(&ni->runlist.lock); in ntfs_attr_vcn_to_lcn_nolock()
371 err = ntfs_map_runlist_nolock(ni, vcn, NULL); in ntfs_attr_vcn_to_lcn_nolock()
373 up_write(&ni->runlist.lock); in ntfs_attr_vcn_to_lcn_nolock()
374 down_read(&ni->runlist.lock); in ntfs_attr_vcn_to_lcn_nolock()
388 ntfs_error(ni->vol->sb, "Failed with error code %lli.", in ntfs_attr_vcn_to_lcn_nolock()
450 runlist_element *ntfs_attr_find_vcn_nolock(ntfs_inode *ni, const VCN vcn, in ntfs_attr_find_vcn_nolock() argument
458 BUG_ON(!ni); in ntfs_attr_find_vcn_nolock()
460 ni->mft_no, (unsigned long long)vcn, ctx ? "" : "out"); in ntfs_attr_find_vcn_nolock()
461 BUG_ON(!NInoNonResident(ni)); in ntfs_attr_find_vcn_nolock()
463 if (!ni->runlist.rl) { in ntfs_attr_find_vcn_nolock()
464 read_lock_irqsave(&ni->size_lock, flags); in ntfs_attr_find_vcn_nolock()
465 if (!ni->allocated_size) { in ntfs_attr_find_vcn_nolock()
466 read_unlock_irqrestore(&ni->size_lock, flags); in ntfs_attr_find_vcn_nolock()
469 read_unlock_irqrestore(&ni->size_lock, flags); in ntfs_attr_find_vcn_nolock()
472 rl = ni->runlist.rl; in ntfs_attr_find_vcn_nolock()
503 err = ntfs_map_runlist_nolock(ni, vcn, ctx); in ntfs_attr_find_vcn_nolock()
514 ntfs_error(ni->vol->sb, "Failed with error code %i.", err); in ntfs_attr_find_vcn_nolock()
872 ntfs_inode *base_ni, *ni; in ntfs_external_attr_find() local
882 ni = ctx->ntfs_ino; in ntfs_external_attr_find()
884 ntfs_debug("Entering for inode 0x%lx, type 0x%x.", ni->mft_no, type); in ntfs_external_attr_find()
890 if (ni == base_ni) in ntfs_external_attr_find()
991 if (MREF_LE(al_entry->mft_reference) == ni->mft_no) { in ntfs_external_attr_find()
992 if (MSEQNO_LE(al_entry->mft_reference) != ni->seq_no) { in ntfs_external_attr_find()
1002 if (ni != base_ni) in ntfs_external_attr_find()
1003 unmap_extent_mft_record(ni); in ntfs_external_attr_find()
1007 ni = ctx->ntfs_ino = base_ni; in ntfs_external_attr_find()
1013 al_entry->mft_reference), &ni); in ntfs_external_attr_find()
1026 ni = NULL; in ntfs_external_attr_find()
1029 ctx->ntfs_ino = ni; in ntfs_external_attr_find()
1100 if (ni != base_ni) { in ntfs_external_attr_find()
1101 if (ni) in ntfs_external_attr_find()
1102 unmap_extent_mft_record(ni); in ntfs_external_attr_find()
1133 if (ni != base_ni) in ntfs_external_attr_find()
1134 unmap_extent_mft_record(ni); in ntfs_external_attr_find()
1228 ntfs_inode *ni, MFT_RECORD *mrec) in ntfs_attr_init_search_ctx() argument
1236 .ntfs_ino = ni, in ntfs_attr_init_search_ctx()
1279 ntfs_attr_search_ctx *ntfs_attr_get_search_ctx(ntfs_inode *ni, MFT_RECORD *mrec) in ntfs_attr_get_search_ctx() argument
1285 ntfs_attr_init_search_ctx(ctx, ni, mrec); in ntfs_attr_get_search_ctx()
1545 int ntfs_attr_make_non_resident(ntfs_inode *ni, const u32 data_size) in ntfs_attr_make_non_resident() argument
1548 struct inode *vi = VFS_I(ni); in ntfs_attr_make_non_resident()
1549 ntfs_volume *vol = ni->vol; in ntfs_attr_make_non_resident()
1563 err = ntfs_attr_can_be_non_resident(vol, ni->type); in ntfs_attr_make_non_resident()
1577 BUG_ON(NInoCompressed(ni)); in ntfs_attr_make_non_resident()
1578 BUG_ON(NInoEncrypted(ni)); in ntfs_attr_make_non_resident()
1617 down_write(&ni->runlist.lock); in ntfs_attr_make_non_resident()
1618 if (!NInoAttr(ni)) in ntfs_attr_make_non_resident()
1619 base_ni = ni; in ntfs_attr_make_non_resident()
1621 base_ni = ni->ext.base_ntfs_ino; in ntfs_attr_make_non_resident()
1634 err = ntfs_attr_lookup(ni->type, ni->name, ni->name_len, in ntfs_attr_make_non_resident()
1643 BUG_ON(NInoNonResident(ni)); in ntfs_attr_make_non_resident()
1648 if (NInoSparse(ni) || NInoCompressed(ni)) in ntfs_attr_make_non_resident()
1705 if (NInoSparse(ni) || NInoCompressed(ni)) { in ntfs_attr_make_non_resident()
1707 if (NInoCompressed(ni) || vol->major_ver < 3) in ntfs_attr_make_non_resident()
1722 ni->runlist.rl = rl; in ntfs_attr_make_non_resident()
1723 write_lock_irqsave(&ni->size_lock, flags); in ntfs_attr_make_non_resident()
1724 ni->allocated_size = new_size; in ntfs_attr_make_non_resident()
1725 if (NInoSparse(ni) || NInoCompressed(ni)) { in ntfs_attr_make_non_resident()
1726 ni->itype.compressed.size = ni->allocated_size; in ntfs_attr_make_non_resident()
1728 ni->itype.compressed.block_size = 1U << (a->data. in ntfs_attr_make_non_resident()
1731 ni->itype.compressed.block_size_bits = in ntfs_attr_make_non_resident()
1732 ffs(ni->itype.compressed.block_size) - in ntfs_attr_make_non_resident()
1734 ni->itype.compressed.block_clusters = 1U << in ntfs_attr_make_non_resident()
1737 ni->itype.compressed.block_size = 0; in ntfs_attr_make_non_resident()
1738 ni->itype.compressed.block_size_bits = 0; in ntfs_attr_make_non_resident()
1739 ni->itype.compressed.block_clusters = 0; in ntfs_attr_make_non_resident()
1741 vi->i_blocks = ni->itype.compressed.size >> 9; in ntfs_attr_make_non_resident()
1743 vi->i_blocks = ni->allocated_size >> 9; in ntfs_attr_make_non_resident()
1744 write_unlock_irqrestore(&ni->size_lock, flags); in ntfs_attr_make_non_resident()
1751 NInoSetNonResident(ni); in ntfs_attr_make_non_resident()
1757 up_write(&ni->runlist.lock); in ntfs_attr_make_non_resident()
1800 (unsigned)le32_to_cpu(ni->type), in ntfs_attr_make_non_resident()
1802 ((ni->type == AT_DATA) && in ntfs_attr_make_non_resident()
1803 !ni->name_len) ? "FILE": "ATTRIBUTE"); in ntfs_attr_make_non_resident()
1804 write_lock_irqsave(&ni->size_lock, flags); in ntfs_attr_make_non_resident()
1805 ni->initialized_size = attr_size; in ntfs_attr_make_non_resident()
1807 write_unlock_irqrestore(&ni->size_lock, flags); in ntfs_attr_make_non_resident()
1823 write_lock_irqsave(&ni->size_lock, flags); in ntfs_attr_make_non_resident()
1824 ni->allocated_size = arec_size - mp_ofs; in ntfs_attr_make_non_resident()
1825 write_unlock_irqrestore(&ni->size_lock, flags); in ntfs_attr_make_non_resident()
1834 ni->runlist.rl = NULL; in ntfs_attr_make_non_resident()
1835 up_write(&ni->runlist.lock); in ntfs_attr_make_non_resident()
1914 s64 ntfs_attr_extend_allocation(ntfs_inode *ni, s64 new_alloc_size, in ntfs_attr_extend_allocation() argument
1919 struct inode *vi = VFS_I(ni); in ntfs_attr_extend_allocation()
1920 ntfs_volume *vol = ni->vol; in ntfs_attr_extend_allocation()
1932 read_lock_irqsave(&ni->size_lock, flags); in ntfs_attr_extend_allocation()
1933 allocated_size = ni->allocated_size; in ntfs_attr_extend_allocation()
1934 read_unlock_irqrestore(&ni->size_lock, flags); in ntfs_attr_extend_allocation()
1939 (unsigned)le32_to_cpu(ni->type), in ntfs_attr_extend_allocation()
1950 if (NInoNonResident(ni)) { in ntfs_attr_extend_allocation()
1958 err = ntfs_attr_size_bounds_check(vol, ni->type, new_alloc_size); in ntfs_attr_extend_allocation()
1961 read_lock_irqsave(&ni->size_lock, flags); in ntfs_attr_extend_allocation()
1962 allocated_size = ni->allocated_size; in ntfs_attr_extend_allocation()
1963 read_unlock_irqrestore(&ni->size_lock, flags); in ntfs_attr_extend_allocation()
1973 le32_to_cpu(ni->type)); in ntfs_attr_extend_allocation()
1983 le32_to_cpu(ni->type)); in ntfs_attr_extend_allocation()
1993 if (!NInoAttr(ni)) in ntfs_attr_extend_allocation()
1994 base_ni = ni; in ntfs_attr_extend_allocation()
1996 base_ni = ni->ext.base_ntfs_ino; in ntfs_attr_extend_allocation()
2001 down_write(&ni->runlist.lock); in ntfs_attr_extend_allocation()
2014 read_lock_irqsave(&ni->size_lock, flags); in ntfs_attr_extend_allocation()
2015 allocated_size = ni->allocated_size; in ntfs_attr_extend_allocation()
2016 read_unlock_irqrestore(&ni->size_lock, flags); in ntfs_attr_extend_allocation()
2021 vcn = NInoNonResident(ni) ? allocated_size >> vol->cluster_size_bits : in ntfs_attr_extend_allocation()
2040 err = ntfs_attr_lookup(ni->type, ni->name, ni->name_len, in ntfs_attr_extend_allocation()
2052 BUG_ON(NInoNonResident(ni)); in ntfs_attr_extend_allocation()
2065 write_lock_irqsave(&ni->size_lock, flags); in ntfs_attr_extend_allocation()
2066 ni->allocated_size = le32_to_cpu(a->length) - in ntfs_attr_extend_allocation()
2068 write_unlock_irqrestore(&ni->size_lock, flags); in ntfs_attr_extend_allocation()
2086 up_write(&ni->runlist.lock); in ntfs_attr_extend_allocation()
2091 err = ntfs_attr_make_non_resident(ni, attr_len); in ntfs_attr_extend_allocation()
2101 read_lock_irqsave(&ni->size_lock, flags); in ntfs_attr_extend_allocation()
2102 allocated_size = ni->allocated_size; in ntfs_attr_extend_allocation()
2103 read_unlock_irqrestore(&ni->size_lock, flags); in ntfs_attr_extend_allocation()
2110 (unsigned)le32_to_cpu(ni->type), err); in ntfs_attr_extend_allocation()
2116 read_lock_irqsave(&ni->size_lock, flags); in ntfs_attr_extend_allocation()
2117 allocated_size = ni->allocated_size; in ntfs_attr_extend_allocation()
2118 read_unlock_irqrestore(&ni->size_lock, flags); in ntfs_attr_extend_allocation()
2142 if (ni->type == AT_ATTRIBUTE_LIST || in ntfs_attr_extend_allocation()
2143 ni->type == AT_STANDARD_INFORMATION) { in ntfs_attr_extend_allocation()
2161 BUG_ON(!NInoNonResident(ni)); in ntfs_attr_extend_allocation()
2174 if ((start >= 0 && start <= allocated_size) || ni->type != AT_DATA || in ntfs_attr_extend_allocation()
2175 !NVolSparseEnabled(vol) || NInoSparseDisabled(ni)) in ntfs_attr_extend_allocation()
2182 rl = ni->runlist.rl; in ntfs_attr_extend_allocation()
2190 (rl->lcn == LCN_ENOENT && rl > ni->runlist.rl && in ntfs_attr_extend_allocation()
2194 rl = ntfs_mapping_pairs_decompress(vol, a, ni->runlist.rl); in ntfs_attr_extend_allocation()
2204 (unsigned)le32_to_cpu(ni->type), in ntfs_attr_extend_allocation()
2210 ni->runlist.rl = rl; in ntfs_attr_extend_allocation()
2223 while (rl->lcn < 0 && rl > ni->runlist.rl) in ntfs_attr_extend_allocation()
2240 (unsigned)le32_to_cpu(ni->type), err); in ntfs_attr_extend_allocation()
2245 rl = ntfs_runlists_merge(ni->runlist.rl, rl2); in ntfs_attr_extend_allocation()
2253 (unsigned)le32_to_cpu(ni->type), err); in ntfs_attr_extend_allocation()
2266 ni->runlist.rl = rl; in ntfs_attr_extend_allocation()
2286 (unsigned)le32_to_cpu(ni->type), err); in ntfs_attr_extend_allocation()
2321 (unsigned)le32_to_cpu(ni->type), err); in ntfs_attr_extend_allocation()
2340 err = ntfs_attr_lookup(ni->type, ni->name, ni->name_len, in ntfs_attr_extend_allocation()
2347 write_lock_irqsave(&ni->size_lock, flags); in ntfs_attr_extend_allocation()
2348 ni->allocated_size = new_alloc_size; in ntfs_attr_extend_allocation()
2360 if (NInoSparse(ni) || NInoCompressed(ni)) { in ntfs_attr_extend_allocation()
2361 ni->itype.compressed.size += new_alloc_size - allocated_size; in ntfs_attr_extend_allocation()
2363 cpu_to_sle64(ni->itype.compressed.size); in ntfs_attr_extend_allocation()
2364 vi->i_blocks = ni->itype.compressed.size >> 9; in ntfs_attr_extend_allocation()
2367 write_unlock_irqrestore(&ni->size_lock, flags); in ntfs_attr_extend_allocation()
2381 up_write(&ni->runlist.lock); in ntfs_attr_extend_allocation()
2391 (unsigned)le32_to_cpu(ni->type), err); in ntfs_attr_extend_allocation()
2395 if (ntfs_attr_lookup(ni->type, ni->name, ni->name_len, CASE_SENSITIVE, in ntfs_attr_extend_allocation()
2401 write_lock_irqsave(&ni->size_lock, flags); in ntfs_attr_extend_allocation()
2402 ni->allocated_size = new_alloc_size; in ntfs_attr_extend_allocation()
2408 if (NInoSparse(ni) || NInoCompressed(ni)) { in ntfs_attr_extend_allocation()
2409 ni->itype.compressed.size += new_alloc_size - in ntfs_attr_extend_allocation()
2411 vi->i_blocks = ni->itype.compressed.size >> 9; in ntfs_attr_extend_allocation()
2414 write_unlock_irqrestore(&ni->size_lock, flags); in ntfs_attr_extend_allocation()
2417 up_write(&ni->runlist.lock); in ntfs_attr_extend_allocation()
2429 if (ntfs_cluster_free(ni, ll, -1, ctx) < 0) { in ntfs_attr_extend_allocation()
2443 if (ntfs_rl_truncate_nolock(vol, &ni->runlist, ll) || IS_ERR(m)) { in ntfs_attr_extend_allocation()
2477 up_write(&ni->runlist.lock); in ntfs_attr_extend_allocation()
2503 int ntfs_attr_set(ntfs_inode *ni, const s64 ofs, const s64 cnt, const u8 val) in ntfs_attr_set() argument
2505 ntfs_volume *vol = ni->vol; in ntfs_attr_set()
2522 BUG_ON(NInoCompressed(ni)); in ntfs_attr_set()
2523 BUG_ON(NInoEncrypted(ni)); in ntfs_attr_set()
2524 mapping = VFS_I(ni)->i_mapping; in ntfs_attr_set()
2532 if (unlikely(end > i_size_read(VFS_I(ni)))) { in ntfs_attr_set()