Lines Matching full:ni
58 struct ntfs_inode *ni = ntfs_i(inode); in ntfs_fileattr_get() local
67 if (is_compressed(ni)) in ntfs_fileattr_get()
70 if (is_encrypted(ni)) in ntfs_fileattr_get()
85 struct ntfs_inode *ni = ntfs_i(inode); in ntfs_fileattr_set() local
102 if (!is_dedup(ni) && !is_encrypted(ni) && in ntfs_fileattr_set()
148 struct ntfs_inode *ni = ntfs_i(inode); in ntfs_getattr() local
151 stat->btime = ni->i_crtime; in ntfs_getattr()
152 stat->blksize = ni->mi.sbi->cluster_size; /* 512, 1K, ..., 2M */ in ntfs_getattr()
160 if (is_compressed(ni)) in ntfs_getattr()
163 if (is_encrypted(ni)) in ntfs_getattr()
175 struct ntfs_inode *ni, in ntfs_extend_initialized_size() argument
179 struct inode *inode = &ni->vfs_inode; in ntfs_extend_initialized_size()
185 if (is_resident(ni)) { in ntfs_extend_initialized_size()
186 ni->i_valid = new_valid; in ntfs_extend_initialized_size()
190 WARN_ON(is_compressed(ni)); in ntfs_extend_initialized_size()
199 if (is_sparsed(ni)) { in ntfs_extend_initialized_size()
203 err = attr_data_get_block(ni, vcn, 1, &lcn, &clen, NULL, in ntfs_extend_initialized_size()
210 ni->i_valid = pos; in ntfs_extend_initialized_size()
243 ni->i_valid = valid; in ntfs_extend_initialized_size()
333 struct ntfs_inode *ni = ntfs_i(inode); in ntfs_file_mmap() local
341 if (is_encrypted(ni)) { in ntfs_file_mmap()
346 if (is_dedup(ni)) { in ntfs_file_mmap()
351 if (is_compressed(ni) && rw) { in ntfs_file_mmap()
360 if (is_sparsed(ni)) { in ntfs_file_mmap()
369 err = attr_data_get_block(ni, vcn, 1, &lcn, in ntfs_file_mmap()
376 if (ni->i_valid < to) { in ntfs_file_mmap()
378 err = ntfs_extend_initialized_size(file, ni, in ntfs_file_mmap()
379 ni->i_valid, to); in ntfs_file_mmap()
394 struct ntfs_inode *ni = ntfs_i(inode); in ntfs_extend() local
397 bool extend_init = file && pos > ni->i_valid; in ntfs_extend()
404 ntfs_set_state(ni->mi.sbi, NTFS_DIRTY_DIRTY); in ntfs_extend()
412 if (extend_init && !is_compressed(ni)) { in ntfs_extend()
413 err = ntfs_extend_initialized_size(file, ni, ni->i_valid, pos); in ntfs_extend()
420 if (file && is_sparsed(ni)) { in ntfs_extend()
425 struct ntfs_sb_info *sbi = ni->mi.sbi; in ntfs_extend()
428 CLST cend_v = bytes_to_cluster(sbi, ni->i_valid); in ntfs_extend()
440 err = attr_data_get_block(ni, vcn, cend_v - vcn, &lcn, in ntfs_extend()
449 err = attr_data_get_block(ni, vcn, cend - vcn, &lcn, in ntfs_extend()
480 struct ntfs_inode *ni = ntfs_i(inode); in ntfs_truncate() local
487 if (is_compressed(ni)) { in ntfs_truncate()
488 if (ni->i_valid > new_size) in ntfs_truncate()
489 ni->i_valid = new_size; in ntfs_truncate()
497 new_valid = ntfs_up_block(sb, min_t(u64, ni->i_valid, new_size)); in ntfs_truncate()
501 ni_lock(ni); in ntfs_truncate()
503 down_write(&ni->file.run_lock); in ntfs_truncate()
504 err = attr_set_size(ni, ATTR_DATA, NULL, 0, &ni->file.run, new_size, in ntfs_truncate()
505 &new_valid, ni->mi.sbi->options->prealloc, NULL); in ntfs_truncate()
506 up_write(&ni->file.run_lock); in ntfs_truncate()
508 if (new_valid < ni->i_valid) in ntfs_truncate()
509 ni->i_valid = new_valid; in ntfs_truncate()
511 ni_unlock(ni); in ntfs_truncate()
513 ni->std_fa |= FILE_ATTRIBUTE_ARCHIVE; in ntfs_truncate()
546 struct ntfs_inode *ni = ntfs_i(inode); in ntfs_fallocate() local
550 bool is_supported_holes = is_sparsed(ni) || is_compressed(ni); in ntfs_fallocate()
585 if (WARN_ON(ni->ni_flags & NI_FLAG_COMPRESSED_MASK)) { in ntfs_fallocate()
609 ni_lock(ni); in ntfs_fallocate()
610 err = attr_punch_hole(ni, vbo, len, &frame_size); in ntfs_fallocate()
611 ni_unlock(ni); in ntfs_fallocate()
639 ni_lock(ni); in ntfs_fallocate()
640 err = attr_punch_hole(ni, vbo_a, end_a - vbo_a, NULL); in ntfs_fallocate()
641 ni_unlock(ni); in ntfs_fallocate()
664 ni_lock(ni); in ntfs_fallocate()
665 err = attr_collapse_range(ni, vbo, len); in ntfs_fallocate()
666 ni_unlock(ni); in ntfs_fallocate()
682 ni_lock(ni); in ntfs_fallocate()
683 err = attr_insert_range(ni, vbo, len); in ntfs_fallocate()
684 ni_unlock(ni); in ntfs_fallocate()
692 if (is_resident(ni)) { in ntfs_fallocate()
693 ni_lock(ni); in ntfs_fallocate()
694 err = attr_force_nonresident(ni); in ntfs_fallocate()
695 ni_unlock(ni); in ntfs_fallocate()
728 CLST cend_v = bytes_to_cluster(sbi, ni->i_valid); in ntfs_fallocate()
740 err = attr_data_get_block(ni, vcn, cend_v - vcn, in ntfs_fallocate()
750 err = attr_data_get_block(ni, vcn, cend - vcn, in ntfs_fallocate()
759 ni_lock(ni); in ntfs_fallocate()
761 err = attr_set_size(ni, ATTR_DATA, NULL, 0, in ntfs_fallocate()
762 &ni->file.run, i_size, &ni->i_valid, in ntfs_fallocate()
764 ni_unlock(ni); in ntfs_fallocate()
797 struct ntfs_inode *ni = ntfs_i(inode); in ntfs_setattr() local
812 if (WARN_ON(ni->ni_flags & NI_FLAG_COMPRESSED_MASK)) { in ntfs_setattr()
829 ni->ni_flags |= NI_FLAG_UPDATE_PARENT; in ntfs_setattr()
842 ni->std_fa &= ~FILE_ATTRIBUTE_READONLY; in ntfs_setattr()
844 ni->std_fa |= FILE_ATTRIBUTE_READONLY; in ntfs_setattr()
860 struct ntfs_inode *ni = ntfs_i(inode); in check_read_restriction() local
865 if (is_encrypted(ni)) { in check_read_restriction()
871 if (ni->ni_flags & NI_FLAG_COMPRESSED_MASK) { in check_read_restriction()
879 if (is_dedup(ni)) { in check_read_restriction()
894 struct ntfs_inode *ni = ntfs_i(inode); in ntfs_file_read_iter() local
901 if (is_compressed(ni) && (iocb->ki_flags & IOCB_DIRECT)) { in ntfs_file_read_iter()
977 struct ntfs_inode *ni = ntfs_i(inode); in ntfs_compress_write() local
978 u64 valid = ni->i_valid; in ntfs_compress_write()
979 struct ntfs_sb_info *sbi = ni->mi.sbi; in ntfs_compress_write()
1020 err = attr_data_get_block(ni, frame << NTFS_LZNT_CUNIT, 1, &lcn, in ntfs_compress_write()
1026 ni->i_valid = valid = in ntfs_compress_write()
1039 err = ni_read_frame(ni, frame_vbo, pages, in ntfs_compress_write()
1060 ni_lock(ni); in ntfs_compress_write()
1061 err = ni_write_frame(ni, pages, pages_per_frame); in ntfs_compress_write()
1062 ni_unlock(ni); in ntfs_compress_write()
1074 ni->i_valid = valid = frame_vbo + frame_size; in ntfs_compress_write()
1104 err = ni_read_frame(ni, frame_vbo, pages, in ntfs_compress_write()
1145 ni_lock(ni); in ntfs_compress_write()
1146 err = ni_write_frame(ni, pages, pages_per_frame); in ntfs_compress_write()
1147 ni_unlock(ni); in ntfs_compress_write()
1180 if (iocb->ki_pos > ni->i_valid) in ntfs_compress_write()
1181 ni->i_valid = iocb->ki_pos; in ntfs_compress_write()
1194 struct ntfs_inode *ni = ntfs_i(inode); in check_write_restriction() local
1199 if (is_encrypted(ni)) { in check_write_restriction()
1204 if (is_dedup(ni)) { in check_write_restriction()
1219 struct ntfs_inode *ni = ntfs_i(inode); in ntfs_file_write_iter() local
1227 if (is_compressed(ni) && (iocb->ki_flags & IOCB_DIRECT)) { in ntfs_file_write_iter()
1248 if (WARN_ON(ni->ni_flags & NI_FLAG_COMPRESSED_MASK)) { in ntfs_file_write_iter()
1258 ret = is_compressed(ni) ? ntfs_compress_write(iocb, from) : in ntfs_file_write_iter()
1275 struct ntfs_inode *ni = ntfs_i(inode); in ntfs_file_open() local
1280 if (unlikely((is_compressed(ni) || is_encrypted(ni)) && in ntfs_file_open()
1286 if ((ni->ni_flags & NI_FLAG_COMPRESSED_MASK) && in ntfs_file_open()
1289 int err = ni_decompress_file(ni); in ntfs_file_open()
1309 struct ntfs_inode *ni = ntfs_i(inode); in ntfs_file_release() local
1310 struct ntfs_sb_info *sbi = ni->mi.sbi; in ntfs_file_release()
1319 * init_rwsem(&ni->file.run_lock) is not called explicitly is MFT. in ntfs_file_release()
1324 ni_lock(ni); in ntfs_file_release()
1325 down_write(&ni->file.run_lock); in ntfs_file_release()
1327 err = attr_set_size(ni, ATTR_DATA, NULL, 0, &ni->file.run, in ntfs_file_release()
1328 i_size_read(inode), &ni->i_valid, false, in ntfs_file_release()
1331 up_write(&ni->file.run_lock); in ntfs_file_release()
1332 ni_unlock(ni); in ntfs_file_release()
1344 struct ntfs_inode *ni = ntfs_i(inode); in ntfs_fiemap() local
1350 ni_lock(ni); in ntfs_fiemap()
1352 err = ni_fiemap(ni, fieinfo, start, len); in ntfs_fiemap()
1354 ni_unlock(ni); in ntfs_fiemap()