Lines Matching refs:ni
96 static int ntfs_attr_extend_initialized(ntfs_inode *ni, const s64 new_init_size) in ntfs_attr_extend_initialized() argument
102 struct inode *vi = VFS_I(ni); in ntfs_attr_extend_initialized()
113 read_lock_irqsave(&ni->size_lock, flags); in ntfs_attr_extend_initialized()
114 old_init_size = ni->initialized_size; in ntfs_attr_extend_initialized()
116 BUG_ON(new_init_size > ni->allocated_size); in ntfs_attr_extend_initialized()
117 read_unlock_irqrestore(&ni->size_lock, flags); in ntfs_attr_extend_initialized()
121 vi->i_ino, (unsigned)le32_to_cpu(ni->type), in ntfs_attr_extend_initialized()
124 if (!NInoAttr(ni)) in ntfs_attr_extend_initialized()
125 base_ni = ni; in ntfs_attr_extend_initialized()
127 base_ni = ni->ext.base_ntfs_ino; in ntfs_attr_extend_initialized()
129 if (NInoNonResident(ni)) in ntfs_attr_extend_initialized()
143 err = ntfs_attr_lookup(ni->type, ni->name, ni->name_len, in ntfs_attr_extend_initialized()
164 write_lock_irqsave(&ni->size_lock, flags); in ntfs_attr_extend_initialized()
166 ni->initialized_size = new_init_size; in ntfs_attr_extend_initialized()
167 write_unlock_irqrestore(&ni->size_lock, flags); in ntfs_attr_extend_initialized()
187 err = ntfs_attr_lookup(ni->type, ni->name, ni->name_len, in ntfs_attr_extend_initialized()
226 write_lock_irqsave(&ni->size_lock, flags); in ntfs_attr_extend_initialized()
227 ni->initialized_size = (s64)(index + 1) << PAGE_SHIFT; in ntfs_attr_extend_initialized()
228 if (ni->initialized_size > new_init_size) in ntfs_attr_extend_initialized()
229 ni->initialized_size = new_init_size; in ntfs_attr_extend_initialized()
230 write_unlock_irqrestore(&ni->size_lock, flags); in ntfs_attr_extend_initialized()
264 read_lock_irqsave(&ni->size_lock, flags); in ntfs_attr_extend_initialized()
265 BUG_ON(ni->initialized_size != new_init_size); in ntfs_attr_extend_initialized()
266 read_unlock_irqrestore(&ni->size_lock, flags); in ntfs_attr_extend_initialized()
279 err = ntfs_attr_lookup(ni->type, ni->name, ni->name_len, in ntfs_attr_extend_initialized()
301 write_lock_irqsave(&ni->size_lock, flags); in ntfs_attr_extend_initialized()
302 ni->initialized_size = old_init_size; in ntfs_attr_extend_initialized()
303 write_unlock_irqrestore(&ni->size_lock, flags); in ntfs_attr_extend_initialized()
322 ntfs_inode *ni = NTFS_I(vi); in ntfs_prepare_file_for_write() local
323 ntfs_volume *vol = ni->vol; in ntfs_prepare_file_for_write()
327 (unsigned)le32_to_cpu(ni->type), in ntfs_prepare_file_for_write()
337 BUG_ON(NInoMstProtected(ni)); in ntfs_prepare_file_for_write()
338 BUG_ON(ni->type != AT_DATA); in ntfs_prepare_file_for_write()
340 if (NInoEncrypted(ni)) { in ntfs_prepare_file_for_write()
350 if (NInoCompressed(ni)) { in ntfs_prepare_file_for_write()
352 BUG_ON(ni->name_len); in ntfs_prepare_file_for_write()
380 read_lock_irqsave(&ni->size_lock, flags); in ntfs_prepare_file_for_write()
381 ll = ni->allocated_size; in ntfs_prepare_file_for_write()
382 read_unlock_irqrestore(&ni->size_lock, flags); in ntfs_prepare_file_for_write()
391 ll = ntfs_attr_extend_allocation(ni, end, -1, pos); in ntfs_prepare_file_for_write()
401 le32_to_cpu(ni->type)); in ntfs_prepare_file_for_write()
406 read_lock_irqsave(&ni->size_lock, flags); in ntfs_prepare_file_for_write()
407 ll = ni->allocated_size; in ntfs_prepare_file_for_write()
408 read_unlock_irqrestore(&ni->size_lock, flags); in ntfs_prepare_file_for_write()
416 le32_to_cpu(ni->type), in ntfs_prepare_file_for_write()
429 le32_to_cpu(ni->type), in ntfs_prepare_file_for_write()
438 le32_to_cpu(ni->type)); in ntfs_prepare_file_for_write()
450 read_lock_irqsave(&ni->size_lock, flags); in ntfs_prepare_file_for_write()
451 ll = ni->initialized_size; in ntfs_prepare_file_for_write()
452 read_unlock_irqrestore(&ni->size_lock, flags); in ntfs_prepare_file_for_write()
459 err = ntfs_attr_extend_initialized(ni, pos); in ntfs_prepare_file_for_write()
465 (unsigned)le32_to_cpu(ni->type), in ntfs_prepare_file_for_write()
572 ntfs_inode *ni, *base_ni = NULL; in ntfs_prepare_pages_for_non_resident_write() local
596 ni = NTFS_I(vi); in ntfs_prepare_pages_for_non_resident_write()
597 vol = ni->vol; in ntfs_prepare_pages_for_non_resident_write()
600 vi->i_ino, ni->type, pages[0]->index, nr_pages, in ntfs_prepare_pages_for_non_resident_write()
675 read_lock_irqsave(&ni->size_lock, flags); in ntfs_prepare_pages_for_non_resident_write()
676 initialized_size = ni->initialized_size; in ntfs_prepare_pages_for_non_resident_write()
677 read_unlock_irqrestore(&ni->size_lock, flags); in ntfs_prepare_pages_for_non_resident_write()
748 read_lock_irqsave(&ni->size_lock, in ntfs_prepare_pages_for_non_resident_write()
750 initialized_size = ni->initialized_size; in ntfs_prepare_pages_for_non_resident_write()
751 read_unlock_irqrestore(&ni->size_lock, in ntfs_prepare_pages_for_non_resident_write()
808 read_lock_irqsave(&ni->size_lock, flags); in ntfs_prepare_pages_for_non_resident_write()
809 initialized_size = ni->allocated_size; in ntfs_prepare_pages_for_non_resident_write()
810 read_unlock_irqrestore(&ni->size_lock, flags); in ntfs_prepare_pages_for_non_resident_write()
823 down_read(&ni->runlist.lock); in ntfs_prepare_pages_for_non_resident_write()
825 rl = ni->runlist.rl; in ntfs_prepare_pages_for_non_resident_write()
852 up_write(&ni->runlist.lock); in ntfs_prepare_pages_for_non_resident_write()
855 up_read(&ni->runlist.lock); in ntfs_prepare_pages_for_non_resident_write()
877 up_read(&ni->runlist.lock); in ntfs_prepare_pages_for_non_resident_write()
878 down_write(&ni->runlist.lock); in ntfs_prepare_pages_for_non_resident_write()
882 err = ntfs_map_runlist_nolock(ni, bh_cpos, in ntfs_prepare_pages_for_non_resident_write()
907 ni->mft_no, ni->type, in ntfs_prepare_pages_for_non_resident_write()
959 up_read(&ni->runlist.lock); in ntfs_prepare_pages_for_non_resident_write()
960 down_write(&ni->runlist.lock); in ntfs_prepare_pages_for_non_resident_write()
968 while (--rl2 >= ni->runlist.rl) { in ntfs_prepare_pages_for_non_resident_write()
983 rl = ntfs_runlists_merge(ni->runlist.rl, rl2); in ntfs_prepare_pages_for_non_resident_write()
998 ni->runlist.rl = rl; in ntfs_prepare_pages_for_non_resident_write()
1003 if (!NInoAttr(ni)) in ntfs_prepare_pages_for_non_resident_write()
1004 base_ni = ni; in ntfs_prepare_pages_for_non_resident_write()
1006 base_ni = ni->ext.base_ntfs_ino; in ntfs_prepare_pages_for_non_resident_write()
1019 err = ntfs_attr_lookup(ni->type, ni->name, ni->name_len, in ntfs_prepare_pages_for_non_resident_write()
1103 (unsigned)le32_to_cpu(ni->type), err); in ntfs_prepare_pages_for_non_resident_write()
1115 if (likely(NInoSparse(ni) || NInoCompressed(ni))) { in ntfs_prepare_pages_for_non_resident_write()
1125 err = ntfs_attr_lookup(ni->type, ni->name, in ntfs_prepare_pages_for_non_resident_write()
1126 ni->name_len, CASE_SENSITIVE, in ntfs_prepare_pages_for_non_resident_write()
1135 write_lock_irqsave(&ni->size_lock, flags); in ntfs_prepare_pages_for_non_resident_write()
1136 ni->itype.compressed.size += vol->cluster_size; in ntfs_prepare_pages_for_non_resident_write()
1138 cpu_to_sle64(ni->itype.compressed.size); in ntfs_prepare_pages_for_non_resident_write()
1139 write_unlock_irqrestore(&ni->size_lock, flags); in ntfs_prepare_pages_for_non_resident_write()
1162 up_write(&ni->runlist.lock); in ntfs_prepare_pages_for_non_resident_write()
1174 up_write(&ni->runlist.lock); in ntfs_prepare_pages_for_non_resident_write()
1177 up_read(&ni->runlist.lock); in ntfs_prepare_pages_for_non_resident_write()
1181 read_lock_irqsave(&ni->size_lock, flags); in ntfs_prepare_pages_for_non_resident_write()
1182 initialized_size = ni->initialized_size; in ntfs_prepare_pages_for_non_resident_write()
1183 read_unlock_irqrestore(&ni->size_lock, flags); in ntfs_prepare_pages_for_non_resident_write()
1222 if (ntfs_attr_lookup(ni->type, ni->name, ni->name_len, in ntfs_prepare_pages_for_non_resident_write()
1228 write_lock_irqsave(&ni->size_lock, flags); in ntfs_prepare_pages_for_non_resident_write()
1229 ni->itype.compressed.size += vol->cluster_size; in ntfs_prepare_pages_for_non_resident_write()
1230 write_unlock_irqrestore(&ni->size_lock, flags); in ntfs_prepare_pages_for_non_resident_write()
1255 if (ntfs_rl_punch_nolock(vol, &ni->runlist, bh_cpos, 1)) { in ntfs_prepare_pages_for_non_resident_write()
1296 mapping_pairs_offset), ni->runlist.rl, in ntfs_prepare_pages_for_non_resident_write()
1315 up_write(&ni->runlist.lock); in ntfs_prepare_pages_for_non_resident_write()
1317 up_read(&ni->runlist.lock); in ntfs_prepare_pages_for_non_resident_write()
1383 ntfs_inode *ni, *base_ni; in ntfs_commit_pages_after_non_resident_write() local
1393 ni = NTFS_I(vi); in ntfs_commit_pages_after_non_resident_write()
1429 read_lock_irqsave(&ni->size_lock, flags); in ntfs_commit_pages_after_non_resident_write()
1430 initialized_size = ni->initialized_size; in ntfs_commit_pages_after_non_resident_write()
1431 read_unlock_irqrestore(&ni->size_lock, flags); in ntfs_commit_pages_after_non_resident_write()
1440 if (!NInoAttr(ni)) in ntfs_commit_pages_after_non_resident_write()
1441 base_ni = ni; in ntfs_commit_pages_after_non_resident_write()
1443 base_ni = ni->ext.base_ntfs_ino; in ntfs_commit_pages_after_non_resident_write()
1452 BUG_ON(!NInoNonResident(ni)); in ntfs_commit_pages_after_non_resident_write()
1458 err = ntfs_attr_lookup(ni->type, ni->name, ni->name_len, in ntfs_commit_pages_after_non_resident_write()
1467 write_lock_irqsave(&ni->size_lock, flags); in ntfs_commit_pages_after_non_resident_write()
1468 BUG_ON(end > ni->allocated_size); in ntfs_commit_pages_after_non_resident_write()
1469 ni->initialized_size = end; in ntfs_commit_pages_after_non_resident_write()
1476 write_unlock_irqrestore(&ni->size_lock, flags); in ntfs_commit_pages_after_non_resident_write()
1492 NVolSetErrors(ni->vol); in ntfs_commit_pages_after_non_resident_write()
1538 ntfs_inode *ni, *base_ni; in ntfs_commit_pages_after_write() local
1553 ni = NTFS_I(vi); in ntfs_commit_pages_after_write()
1556 vi->i_ino, ni->type, page->index, nr_pages, in ntfs_commit_pages_after_write()
1558 if (NInoNonResident(ni)) in ntfs_commit_pages_after_write()
1566 if (!NInoAttr(ni)) in ntfs_commit_pages_after_write()
1567 base_ni = ni; in ntfs_commit_pages_after_write()
1569 base_ni = ni->ext.base_ntfs_ino; in ntfs_commit_pages_after_write()
1570 BUG_ON(NInoNonResident(ni)); in ntfs_commit_pages_after_write()
1584 err = ntfs_attr_lookup(ni->type, ni->name, ni->name_len, in ntfs_commit_pages_after_write()
1626 read_lock_irqsave(&ni->size_lock, flags); in ntfs_commit_pages_after_write()
1627 initialized_size = ni->initialized_size; in ntfs_commit_pages_after_write()
1628 BUG_ON(end > ni->allocated_size); in ntfs_commit_pages_after_write()
1629 read_unlock_irqrestore(&ni->size_lock, flags); in ntfs_commit_pages_after_write()
1632 write_lock_irqsave(&ni->size_lock, flags); in ntfs_commit_pages_after_write()
1633 ni->initialized_size = end; in ntfs_commit_pages_after_write()
1635 write_unlock_irqrestore(&ni->size_lock, flags); in ntfs_commit_pages_after_write()
1664 NVolSetErrors(ni->vol); in ntfs_commit_pages_after_write()
1725 ntfs_inode *ni = NTFS_I(vi); in ntfs_perform_write() local
1726 ntfs_volume *vol = ni->vol; in ntfs_perform_write()
1737 (unsigned)le32_to_cpu(ni->type), in ntfs_perform_write()
1744 if (unlikely(NInoTruncateFailed(ni))) { in ntfs_perform_write()
1749 if (err || NInoTruncateFailed(ni)) { in ntfs_perform_write()
1756 (unsigned)le32_to_cpu(ni->type), err); in ntfs_perform_write()
1765 if (vol->cluster_size > PAGE_SIZE && NInoNonResident(ni)) in ntfs_perform_write()
1787 down_read(&ni->runlist.lock); in ntfs_perform_write()
1788 lcn = ntfs_attr_vcn_to_lcn_nolock(ni, pos >> in ntfs_perform_write()
1790 up_read(&ni->runlist.lock); in ntfs_perform_write()
1803 le32_to_cpu(ni->type)); in ntfs_perform_write()
1843 if (NInoNonResident(ni)) { in ntfs_perform_write()