Lines Matching refs:ni
95 static int ntfs_attr_extend_initialized(ntfs_inode *ni, const s64 new_init_size) in ntfs_attr_extend_initialized() argument
101 struct inode *vi = VFS_I(ni); in ntfs_attr_extend_initialized()
112 read_lock_irqsave(&ni->size_lock, flags); in ntfs_attr_extend_initialized()
113 old_init_size = ni->initialized_size; in ntfs_attr_extend_initialized()
115 BUG_ON(new_init_size > ni->allocated_size); in ntfs_attr_extend_initialized()
116 read_unlock_irqrestore(&ni->size_lock, flags); in ntfs_attr_extend_initialized()
120 vi->i_ino, (unsigned)le32_to_cpu(ni->type), in ntfs_attr_extend_initialized()
123 if (!NInoAttr(ni)) in ntfs_attr_extend_initialized()
124 base_ni = ni; in ntfs_attr_extend_initialized()
126 base_ni = ni->ext.base_ntfs_ino; in ntfs_attr_extend_initialized()
128 if (NInoNonResident(ni)) in ntfs_attr_extend_initialized()
142 err = ntfs_attr_lookup(ni->type, ni->name, ni->name_len, in ntfs_attr_extend_initialized()
163 write_lock_irqsave(&ni->size_lock, flags); in ntfs_attr_extend_initialized()
165 ni->initialized_size = new_init_size; in ntfs_attr_extend_initialized()
166 write_unlock_irqrestore(&ni->size_lock, flags); in ntfs_attr_extend_initialized()
186 err = ntfs_attr_lookup(ni->type, ni->name, ni->name_len, in ntfs_attr_extend_initialized()
230 write_lock_irqsave(&ni->size_lock, flags); in ntfs_attr_extend_initialized()
231 ni->initialized_size = (s64)(index + 1) << PAGE_SHIFT; in ntfs_attr_extend_initialized()
232 if (ni->initialized_size > new_init_size) in ntfs_attr_extend_initialized()
233 ni->initialized_size = new_init_size; in ntfs_attr_extend_initialized()
234 write_unlock_irqrestore(&ni->size_lock, flags); in ntfs_attr_extend_initialized()
268 read_lock_irqsave(&ni->size_lock, flags); in ntfs_attr_extend_initialized()
269 BUG_ON(ni->initialized_size != new_init_size); in ntfs_attr_extend_initialized()
270 read_unlock_irqrestore(&ni->size_lock, flags); in ntfs_attr_extend_initialized()
283 err = ntfs_attr_lookup(ni->type, ni->name, ni->name_len, in ntfs_attr_extend_initialized()
305 write_lock_irqsave(&ni->size_lock, flags); in ntfs_attr_extend_initialized()
306 ni->initialized_size = old_init_size; in ntfs_attr_extend_initialized()
307 write_unlock_irqrestore(&ni->size_lock, flags); in ntfs_attr_extend_initialized()
326 ntfs_inode *base_ni, *ni = NTFS_I(vi); in ntfs_prepare_file_for_write() local
327 ntfs_volume *vol = ni->vol; in ntfs_prepare_file_for_write()
331 (unsigned)le32_to_cpu(ni->type), in ntfs_prepare_file_for_write()
341 BUG_ON(NInoMstProtected(ni)); in ntfs_prepare_file_for_write()
342 BUG_ON(ni->type != AT_DATA); in ntfs_prepare_file_for_write()
344 if (NInoEncrypted(ni)) { in ntfs_prepare_file_for_write()
354 if (NInoCompressed(ni)) { in ntfs_prepare_file_for_write()
356 BUG_ON(ni->name_len); in ntfs_prepare_file_for_write()
368 base_ni = ni; in ntfs_prepare_file_for_write()
369 if (NInoAttr(ni)) in ntfs_prepare_file_for_write()
370 base_ni = ni->ext.base_ntfs_ino; in ntfs_prepare_file_for_write()
387 read_lock_irqsave(&ni->size_lock, flags); in ntfs_prepare_file_for_write()
388 ll = ni->allocated_size; in ntfs_prepare_file_for_write()
389 read_unlock_irqrestore(&ni->size_lock, flags); in ntfs_prepare_file_for_write()
398 ll = ntfs_attr_extend_allocation(ni, end, -1, pos); in ntfs_prepare_file_for_write()
408 le32_to_cpu(ni->type)); in ntfs_prepare_file_for_write()
413 read_lock_irqsave(&ni->size_lock, flags); in ntfs_prepare_file_for_write()
414 ll = ni->allocated_size; in ntfs_prepare_file_for_write()
415 read_unlock_irqrestore(&ni->size_lock, flags); in ntfs_prepare_file_for_write()
423 le32_to_cpu(ni->type), in ntfs_prepare_file_for_write()
436 le32_to_cpu(ni->type), in ntfs_prepare_file_for_write()
445 le32_to_cpu(ni->type)); in ntfs_prepare_file_for_write()
457 read_lock_irqsave(&ni->size_lock, flags); in ntfs_prepare_file_for_write()
458 ll = ni->initialized_size; in ntfs_prepare_file_for_write()
459 read_unlock_irqrestore(&ni->size_lock, flags); in ntfs_prepare_file_for_write()
466 err = ntfs_attr_extend_initialized(ni, pos); in ntfs_prepare_file_for_write()
472 (unsigned)le32_to_cpu(ni->type), in ntfs_prepare_file_for_write()
579 ntfs_inode *ni, *base_ni = NULL; in ntfs_prepare_pages_for_non_resident_write() local
603 ni = NTFS_I(vi); in ntfs_prepare_pages_for_non_resident_write()
604 vol = ni->vol; in ntfs_prepare_pages_for_non_resident_write()
607 vi->i_ino, ni->type, pages[0]->index, nr_pages, in ntfs_prepare_pages_for_non_resident_write()
682 read_lock_irqsave(&ni->size_lock, flags); in ntfs_prepare_pages_for_non_resident_write()
683 initialized_size = ni->initialized_size; in ntfs_prepare_pages_for_non_resident_write()
684 read_unlock_irqrestore(&ni->size_lock, flags); in ntfs_prepare_pages_for_non_resident_write()
755 read_lock_irqsave(&ni->size_lock, in ntfs_prepare_pages_for_non_resident_write()
757 initialized_size = ni->initialized_size; in ntfs_prepare_pages_for_non_resident_write()
758 read_unlock_irqrestore(&ni->size_lock, in ntfs_prepare_pages_for_non_resident_write()
815 read_lock_irqsave(&ni->size_lock, flags); in ntfs_prepare_pages_for_non_resident_write()
816 initialized_size = ni->allocated_size; in ntfs_prepare_pages_for_non_resident_write()
817 read_unlock_irqrestore(&ni->size_lock, flags); in ntfs_prepare_pages_for_non_resident_write()
830 down_read(&ni->runlist.lock); in ntfs_prepare_pages_for_non_resident_write()
832 rl = ni->runlist.rl; in ntfs_prepare_pages_for_non_resident_write()
859 up_write(&ni->runlist.lock); in ntfs_prepare_pages_for_non_resident_write()
862 up_read(&ni->runlist.lock); in ntfs_prepare_pages_for_non_resident_write()
884 up_read(&ni->runlist.lock); in ntfs_prepare_pages_for_non_resident_write()
885 down_write(&ni->runlist.lock); in ntfs_prepare_pages_for_non_resident_write()
889 err = ntfs_map_runlist_nolock(ni, bh_cpos, in ntfs_prepare_pages_for_non_resident_write()
914 ni->mft_no, ni->type, in ntfs_prepare_pages_for_non_resident_write()
966 up_read(&ni->runlist.lock); in ntfs_prepare_pages_for_non_resident_write()
967 down_write(&ni->runlist.lock); in ntfs_prepare_pages_for_non_resident_write()
975 while (--rl2 >= ni->runlist.rl) { in ntfs_prepare_pages_for_non_resident_write()
990 rl = ntfs_runlists_merge(ni->runlist.rl, rl2); in ntfs_prepare_pages_for_non_resident_write()
1005 ni->runlist.rl = rl; in ntfs_prepare_pages_for_non_resident_write()
1010 if (!NInoAttr(ni)) in ntfs_prepare_pages_for_non_resident_write()
1011 base_ni = ni; in ntfs_prepare_pages_for_non_resident_write()
1013 base_ni = ni->ext.base_ntfs_ino; in ntfs_prepare_pages_for_non_resident_write()
1026 err = ntfs_attr_lookup(ni->type, ni->name, ni->name_len, in ntfs_prepare_pages_for_non_resident_write()
1110 (unsigned)le32_to_cpu(ni->type), err); in ntfs_prepare_pages_for_non_resident_write()
1122 if (likely(NInoSparse(ni) || NInoCompressed(ni))) { in ntfs_prepare_pages_for_non_resident_write()
1132 err = ntfs_attr_lookup(ni->type, ni->name, in ntfs_prepare_pages_for_non_resident_write()
1133 ni->name_len, CASE_SENSITIVE, in ntfs_prepare_pages_for_non_resident_write()
1142 write_lock_irqsave(&ni->size_lock, flags); in ntfs_prepare_pages_for_non_resident_write()
1143 ni->itype.compressed.size += vol->cluster_size; in ntfs_prepare_pages_for_non_resident_write()
1145 cpu_to_sle64(ni->itype.compressed.size); in ntfs_prepare_pages_for_non_resident_write()
1146 write_unlock_irqrestore(&ni->size_lock, flags); in ntfs_prepare_pages_for_non_resident_write()
1169 up_write(&ni->runlist.lock); in ntfs_prepare_pages_for_non_resident_write()
1181 up_write(&ni->runlist.lock); in ntfs_prepare_pages_for_non_resident_write()
1184 up_read(&ni->runlist.lock); in ntfs_prepare_pages_for_non_resident_write()
1188 read_lock_irqsave(&ni->size_lock, flags); in ntfs_prepare_pages_for_non_resident_write()
1189 initialized_size = ni->initialized_size; in ntfs_prepare_pages_for_non_resident_write()
1190 read_unlock_irqrestore(&ni->size_lock, flags); in ntfs_prepare_pages_for_non_resident_write()
1229 if (ntfs_attr_lookup(ni->type, ni->name, ni->name_len, in ntfs_prepare_pages_for_non_resident_write()
1235 write_lock_irqsave(&ni->size_lock, flags); in ntfs_prepare_pages_for_non_resident_write()
1236 ni->itype.compressed.size += vol->cluster_size; in ntfs_prepare_pages_for_non_resident_write()
1237 write_unlock_irqrestore(&ni->size_lock, flags); in ntfs_prepare_pages_for_non_resident_write()
1262 if (ntfs_rl_punch_nolock(vol, &ni->runlist, bh_cpos, 1)) { in ntfs_prepare_pages_for_non_resident_write()
1303 mapping_pairs_offset), ni->runlist.rl, in ntfs_prepare_pages_for_non_resident_write()
1322 up_write(&ni->runlist.lock); in ntfs_prepare_pages_for_non_resident_write()
1324 up_read(&ni->runlist.lock); in ntfs_prepare_pages_for_non_resident_write()
1390 ntfs_inode *ni, *base_ni; in ntfs_commit_pages_after_non_resident_write() local
1400 ni = NTFS_I(vi); in ntfs_commit_pages_after_non_resident_write()
1436 read_lock_irqsave(&ni->size_lock, flags); in ntfs_commit_pages_after_non_resident_write()
1437 initialized_size = ni->initialized_size; in ntfs_commit_pages_after_non_resident_write()
1438 read_unlock_irqrestore(&ni->size_lock, flags); in ntfs_commit_pages_after_non_resident_write()
1447 if (!NInoAttr(ni)) in ntfs_commit_pages_after_non_resident_write()
1448 base_ni = ni; in ntfs_commit_pages_after_non_resident_write()
1450 base_ni = ni->ext.base_ntfs_ino; in ntfs_commit_pages_after_non_resident_write()
1459 BUG_ON(!NInoNonResident(ni)); in ntfs_commit_pages_after_non_resident_write()
1465 err = ntfs_attr_lookup(ni->type, ni->name, ni->name_len, in ntfs_commit_pages_after_non_resident_write()
1474 write_lock_irqsave(&ni->size_lock, flags); in ntfs_commit_pages_after_non_resident_write()
1475 BUG_ON(end > ni->allocated_size); in ntfs_commit_pages_after_non_resident_write()
1476 ni->initialized_size = end; in ntfs_commit_pages_after_non_resident_write()
1483 write_unlock_irqrestore(&ni->size_lock, flags); in ntfs_commit_pages_after_non_resident_write()
1499 NVolSetErrors(ni->vol); in ntfs_commit_pages_after_non_resident_write()
1545 ntfs_inode *ni, *base_ni; in ntfs_commit_pages_after_write() local
1560 ni = NTFS_I(vi); in ntfs_commit_pages_after_write()
1563 vi->i_ino, ni->type, page->index, nr_pages, in ntfs_commit_pages_after_write()
1565 if (NInoNonResident(ni)) in ntfs_commit_pages_after_write()
1573 if (!NInoAttr(ni)) in ntfs_commit_pages_after_write()
1574 base_ni = ni; in ntfs_commit_pages_after_write()
1576 base_ni = ni->ext.base_ntfs_ino; in ntfs_commit_pages_after_write()
1577 BUG_ON(NInoNonResident(ni)); in ntfs_commit_pages_after_write()
1591 err = ntfs_attr_lookup(ni->type, ni->name, ni->name_len, in ntfs_commit_pages_after_write()
1633 read_lock_irqsave(&ni->size_lock, flags); in ntfs_commit_pages_after_write()
1634 initialized_size = ni->initialized_size; in ntfs_commit_pages_after_write()
1635 BUG_ON(end > ni->allocated_size); in ntfs_commit_pages_after_write()
1636 read_unlock_irqrestore(&ni->size_lock, flags); in ntfs_commit_pages_after_write()
1639 write_lock_irqsave(&ni->size_lock, flags); in ntfs_commit_pages_after_write()
1640 ni->initialized_size = end; in ntfs_commit_pages_after_write()
1642 write_unlock_irqrestore(&ni->size_lock, flags); in ntfs_commit_pages_after_write()
1671 NVolSetErrors(ni->vol); in ntfs_commit_pages_after_write()
1735 ntfs_inode *ni = NTFS_I(vi); in ntfs_perform_write() local
1736 ntfs_volume *vol = ni->vol; in ntfs_perform_write()
1747 (unsigned)le32_to_cpu(ni->type), in ntfs_perform_write()
1754 if (unlikely(NInoTruncateFailed(ni))) { in ntfs_perform_write()
1759 if (err || NInoTruncateFailed(ni)) { in ntfs_perform_write()
1766 (unsigned)le32_to_cpu(ni->type), err); in ntfs_perform_write()
1775 if (vol->cluster_size > PAGE_SIZE && NInoNonResident(ni)) in ntfs_perform_write()
1797 down_read(&ni->runlist.lock); in ntfs_perform_write()
1798 lcn = ntfs_attr_vcn_to_lcn_nolock(ni, pos >> in ntfs_perform_write()
1800 up_read(&ni->runlist.lock); in ntfs_perform_write()
1813 le32_to_cpu(ni->type)); in ntfs_perform_write()
1853 if (NInoNonResident(ni)) { in ntfs_perform_write()