Lines Matching refs:vi

32  * @vi:		vfs inode which to test
36 * inode @vi for equality with the ntfs attribute @data.
46 int ntfs_test_inode(struct inode *vi, void *data)
51 if (vi->i_ino != na->mft_no)
53 ni = NTFS_I(vi);
54 /* If !NInoAttr(ni), @vi is a normal file or directory inode. */
75 * @vi: vfs inode to initialize
76 * @data: data which to initialize @vi to
78 * Initialize the vfs inode @vi with the values from the ntfs attribute @data in
91 static int ntfs_init_locked_inode(struct inode *vi, void *data)
94 ntfs_inode *ni = NTFS_I(vi);
96 vi->i_ino = na->mft_no;
136 static int ntfs_read_locked_inode(struct inode *vi);
137 static int ntfs_read_locked_attr_inode(struct inode *base_vi, struct inode *vi);
139 struct inode *vi);
159 struct inode *vi;
168 vi = iget5_locked(sb, mft_no, ntfs_test_inode,
170 if (unlikely(!vi))
176 if (vi->i_state & I_NEW) {
177 err = ntfs_read_locked_inode(vi);
178 unlock_new_inode(vi);
185 iput(vi);
186 vi = ERR_PTR(err);
188 return vi;
217 struct inode *vi;
229 vi = iget5_locked(base_vi->i_sb, na.mft_no, ntfs_test_inode,
231 if (unlikely(!vi))
237 if (vi->i_state & I_NEW) {
238 err = ntfs_read_locked_attr_inode(base_vi, vi);
239 unlock_new_inode(vi);
247 iput(vi);
248 vi = ERR_PTR(err);
250 return vi;
275 struct inode *vi;
284 vi = iget5_locked(base_vi->i_sb, na.mft_no, ntfs_test_inode,
286 if (unlikely(!vi))
292 if (vi->i_state & I_NEW) {
293 err = ntfs_read_locked_index_inode(base_vi, vi);
294 unlock_new_inode(vi);
302 iput(vi);
303 vi = ERR_PTR(err);
305 return vi;
500 * @vi: inode to read
503 * described by @vi into memory from the device.
505 * The only fields in @vi that we need to/can look at when the function is
510 * for reading and sets up the necessary @vi fields as well as initializing
524 static int ntfs_read_locked_inode(struct inode *vi)
526 ntfs_volume *vol = NTFS_SB(vi->i_sb);
535 ntfs_debug("Entering for i_ino 0x%lx.", vi->i_ino);
538 vi->i_uid = vol->uid;
539 vi->i_gid = vol->gid;
540 vi->i_mode = 0;
543 * Initialize the ntfs specific part of @vi special casing
546 if (vi->i_ino != FILE_MFT)
547 ntfs_init_big_inode(vi);
548 ni = NTFS_I(vi);
562 ntfs_error(vi->i_sb, "Inode is not in use!");
566 ntfs_error(vi->i_sb, "Inode is an extent inode!");
571 vi->i_generation = ni->seq_no = le16_to_cpu(m->sequence_number);
582 set_nlink(vi, le16_to_cpu(m->link_count));
591 vi->i_mode |= S_IRWXUGO;
593 if (IS_RDONLY(vi))
594 vi->i_mode &= ~S_IWUGO;
596 vi->i_mode |= S_IFDIR;
601 vi->i_mode &= ~vol->dmask;
603 if (vi->i_nlink > 1)
604 set_nlink(vi, 1);
606 vi->i_mode |= S_IFREG;
608 vi->i_mode &= ~vol->fmask;
625 ntfs_error(vi->i_sb, "$STANDARD_INFORMATION attribute "
635 ntfs_error(vi->i_sb, "Corrupt standard information attribute in inode.");
641 /* Transfer information from the standard information into vi. */
651 vi->i_mtime = ntfs2utc(si->last_data_change_time);
657 vi->i_ctime = ntfs2utc(si->last_mft_change_time);
662 vi->i_atime = ntfs2utc(si->last_access_time);
669 ntfs_error(vi->i_sb, "Failed to lookup attribute list "
674 if (vi->i_ino == FILE_MFT)
676 ntfs_debug("Attribute list found in inode 0x%lx.", vi->i_ino);
680 ntfs_error(vi->i_sb, "Attribute list attribute is "
687 ntfs_error(vi->i_sb, "Non-resident attribute "
692 ntfs_warning(vi->i_sb, "Resident attribute list "
699 vi->i_ino);
705 ntfs_error(vi->i_sb, "Not enough memory to allocate "
713 ntfs_error(vi->i_sb, "Attribute list has non "
726 ntfs_error(vi->i_sb, "Mapping pairs "
735 ntfs_error(vi->i_sb, "Failed to load "
744 ntfs_error(vi->i_sb, "Corrupt attribute list "
760 if (S_ISDIR(vi->i_mode)) {
775 ntfs_error(vi->i_sb, "$INDEX_ROOT attribute "
804 ntfs_error(vi->i_sb, "Found encrypted and "
816 ntfs_error(vi->i_sb, "$INDEX_ROOT attribute is "
823 ntfs_error(vi->i_sb, "Directory index is corrupt.");
827 ntfs_error(vi->i_sb, "Indexed attribute is not "
832 ntfs_error(vi->i_sb, "Index collation rule is not "
840 ntfs_error(vi->i_sb, "Index block size (%u) is not a "
846 ntfs_error(vi->i_sb, "Index block size (%u) > "
855 ntfs_error(vi->i_sb, "Index block size (%u) < "
882 vi->i_size = ni->initialized_size =
898 ntfs_error(vi->i_sb, "$INDEX_ALLOCATION "
902 ntfs_error(vi->i_sb, "Failed to lookup "
909 ntfs_error(vi->i_sb, "$INDEX_ALLOCATION attribute "
926 ntfs_error(vi->i_sb, "$INDEX_ALLOCATION attribute "
931 ntfs_error(vi->i_sb, "$INDEX_ALLOCATION attribute "
936 ntfs_error(vi->i_sb, "$INDEX_ALLOCATION attribute "
941 ntfs_error(vi->i_sb, "First extent of "
946 vi->i_size = sle64_to_cpu(a->data.non_resident.data_size);
960 bvi = ntfs_attr_iget(vi, AT_BITMAP, I30, 4);
962 ntfs_error(vi->i_sb, "Failed to get bitmap attribute.");
969 ntfs_error(vi->i_sb, "$BITMAP attribute is compressed "
975 if ((bvi_size << 3) < (vi->i_size >>
977 ntfs_error(vi->i_sb, "Index bitmap too small (0x%llx) "
979 bvi_size << 3, vi->i_size);
986 vi->i_op = &ntfs_dir_inode_ops;
987 vi->i_fop = &ntfs_dir_ops;
988 vi->i_mapping->a_ops = &ntfs_mst_aops;
1001 vi->i_size = ni->initialized_size =
1004 ntfs_error(vi->i_sb, "Failed to lookup $DATA "
1012 if (vi->i_ino == FILE_Secure)
1027 ntfs_error(vi->i_sb, "$DATA attribute is missing.");
1036 ntfs_error(vi->i_sb, "Found "
1047 ntfs_error(vi->i_sb, "Found unknown "
1058 ntfs_error(vi->i_sb, "Found encrypted and "
1069 ntfs_error(vi->i_sb, "Found "
1104 ntfs_error(vi->i_sb, "First extent of $DATA "
1109 vi->i_size = sle64_to_cpu(
1116 vi->i_size = ni->initialized_size = le32_to_cpu(
1121 if (vi->i_size > ni->allocated_size) {
1122 ntfs_error(vi->i_sb, "Resident data attribute "
1135 vi->i_op = &ntfs_file_inode_ops;
1136 vi->i_fop = &ntfs_file_ops;
1137 vi->i_mapping->a_ops = &ntfs_normal_aops;
1139 vi->i_mapping->a_ops = &ntfs_mst_aops;
1141 vi->i_mapping->a_ops = &ntfs_compressed_aops;
1154 if (S_ISREG(vi->i_mode) && (NInoCompressed(ni) || NInoSparse(ni)))
1155 vi->i_blocks = ni->itype.compressed.size >> 9;
1157 vi->i_blocks = ni->allocated_size >> 9;
1171 "inode 0x%lx as bad. Run chkdsk.", err, vi->i_ino);
1172 make_bad_inode(vi);
1181 * @vi: attribute inode to read
1184 * attribute inode described by @vi into memory from the base mft record
1188 * reading and looks up the attribute described by @vi before setting up the
1189 * necessary fields in @vi as well as initializing the ntfs inode.
1200 static int ntfs_read_locked_attr_inode(struct inode *base_vi, struct inode *vi)
1202 ntfs_volume *vol = NTFS_SB(vi->i_sb);
1209 ntfs_debug("Entering for i_ino 0x%lx.", vi->i_ino);
1211 ntfs_init_big_inode(vi);
1213 ni = NTFS_I(vi);
1217 vi->i_uid = base_vi->i_uid;
1218 vi->i_gid = base_vi->i_gid;
1219 set_nlink(vi, base_vi->i_nlink);
1220 vi->i_mtime = base_vi->i_mtime;
1221 vi->i_ctime = base_vi->i_ctime;
1222 vi->i_atime = base_vi->i_atime;
1223 vi->i_generation = ni->seq_no = base_ni->seq_no;
1226 vi->i_mode = base_vi->i_mode & ~S_IFMT;
1249 ntfs_error(vi->i_sb, "Found compressed "
1258 ntfs_error(vi->i_sb, "Found compressed "
1267 ntfs_error(vi->i_sb, "Found unknown "
1277 ntfs_error(vi->i_sb, "Found mst protected attribute "
1290 ntfs_error(vi->i_sb, "Found encrypted and compressed "
1299 ntfs_error(vi->i_sb, "Found mst protected attribute "
1307 ntfs_error(vi->i_sb, "Found encrypted non-data "
1322 ntfs_error(vi->i_sb, "Found mst protected attribute "
1328 vi->i_size = ni->initialized_size = le32_to_cpu(
1332 if (vi->i_size > ni->allocated_size) {
1333 ntfs_error(vi->i_sb, "Resident attribute is corrupt "
1353 ntfs_error(vi->i_sb, "Found non-standard "
1381 ntfs_error(vi->i_sb, "First extent of attribute has "
1385 vi->i_size = sle64_to_cpu(a->data.non_resident.data_size);
1391 vi->i_mapping->a_ops = &ntfs_normal_aops;
1393 vi->i_mapping->a_ops = &ntfs_mst_aops;
1395 vi->i_mapping->a_ops = &ntfs_compressed_aops;
1397 vi->i_blocks = ni->itype.compressed.size >> 9;
1399 vi->i_blocks = ni->allocated_size >> 9;
1424 "Run chkdsk.", err, vi->i_ino, ni->type, ni->name_len,
1426 make_bad_inode(vi);
1435 * @vi: index inode to read
1438 * index inode described by @vi into memory from the base mft record described
1442 * reading and looks up the attributes relating to the index described by @vi
1443 * before setting up the necessary fields in @vi as well as initializing the
1465 static int ntfs_read_locked_index_inode(struct inode *base_vi, struct inode *vi)
1468 ntfs_volume *vol = NTFS_SB(vi->i_sb);
1478 ntfs_debug("Entering for i_ino 0x%lx.", vi->i_ino);
1479 ntfs_init_big_inode(vi);
1480 ni = NTFS_I(vi);
1483 vi->i_uid = base_vi->i_uid;
1484 vi->i_gid = base_vi->i_gid;
1485 set_nlink(vi, base_vi->i_nlink);
1486 vi->i_mtime = base_vi->i_mtime;
1487 vi->i_ctime = base_vi->i_ctime;
1488 vi->i_atime = base_vi->i_atime;
1489 vi->i_generation = ni->seq_no = base_ni->seq_no;
1491 vi->i_mode = base_vi->i_mode & ~S_IFMT;
1508 ntfs_error(vi->i_sb, "$INDEX_ROOT attribute is "
1531 ntfs_error(vi->i_sb, "Found compressed/encrypted/sparse index "
1538 ntfs_error(vi->i_sb, "$INDEX_ROOT attribute is corrupt.");
1543 ntfs_error(vi->i_sb, "Index is corrupt.");
1547 ntfs_error(vi->i_sb, "Index type is not 0 (type is 0x%x).",
1556 ntfs_error(vi->i_sb, "Index block size (%u) is not a power of "
1561 ntfs_error(vi->i_sb, "Index block size (%u) > PAGE_SIZE "
1568 ntfs_error(vi->i_sb, "Index block size (%u) < NTFS_BLOCK_SIZE "
1586 vi->i_size = ni->initialized_size = ni->allocated_size = 0;
1601 ntfs_error(vi->i_sb, "$INDEX_ALLOCATION attribute is "
1605 ntfs_error(vi->i_sb, "Failed to lookup "
1611 ntfs_error(vi->i_sb, "$INDEX_ALLOCATION attribute is "
1626 ntfs_error(vi->i_sb, "$INDEX_ALLOCATION attribute is "
1631 ntfs_error(vi->i_sb, "$INDEX_ALLOCATION attribute is sparse.");
1635 ntfs_error(vi->i_sb, "$INDEX_ALLOCATION attribute is "
1640 ntfs_error(vi->i_sb, "First extent of $INDEX_ALLOCATION "
1644 vi->i_size = sle64_to_cpu(a->data.non_resident.data_size);
1659 ntfs_error(vi->i_sb, "Failed to get bitmap attribute.");
1666 ntfs_error(vi->i_sb, "$BITMAP attribute is compressed and/or "
1672 if ((bvi_size << 3) < (vi->i_size >> ni->itype.index.block_size_bits)) {
1673 ntfs_error(vi->i_sb, "Index bitmap too small (0x%llx) for "
1675 vi->i_size);
1681 vi->i_mapping->a_ops = &ntfs_mst_aops;
1682 vi->i_blocks = ni->allocated_size >> 9;
1703 ntfs_error(vi->i_sb, "Failed with error code %i while reading index "
1704 "inode (mft_no 0x%lx, name_len %i.", err, vi->i_ino,
1706 make_bad_inode(vi);
1723 * @vi: inode to read
1747 int ntfs_read_inode_mount(struct inode *vi)
1751 struct super_block *sb = vi->i_sb;
1763 /* Initialize the ntfs specific part of @vi. */
1764 ntfs_init_big_inode(vi);
1766 ni = NTFS_I(vi);
1783 vol->mft_ino = vi;
1840 vi->i_generation = ni->seq_no = le16_to_cpu(m->sequence_number);
1843 vi->i_mapping->a_ops = &ntfs_mst_aops;
1986 if (MREF_LE(al_entry->mft_reference) != vi->i_ino) {
2064 vi->i_size = sle64_to_cpu(
2074 if ((vi->i_size >> vol->mft_record_size_bits) >=
2098 ntfs_read_locked_inode(vi);
2099 if (is_bad_inode(vi)) {
2117 vi->i_uid = GLOBAL_ROOT_UID;
2118 vi->i_gid = GLOBAL_ROOT_GID;
2120 vi->i_mode = S_IFREG;
2122 vi->i_op = &ntfs_empty_inode_ops;
2123 vi->i_fop = &ntfs_empty_file_ops;
2181 make_bad_inode(vi);
2239 * @vi: vfs inode pending annihilation
2247 void ntfs_evict_big_inode(struct inode *vi)
2249 ntfs_inode *ni = NTFS_I(vi);
2251 truncate_inode_pages_final(&vi->i_data);
2252 clear_inode(vi);
2256 bool was_bad = (is_bad_inode(vi));
2259 ntfs_commit_inode(vi);
2261 if (!was_bad && (is_bad_inode(vi) || NInoDirty(ni))) {
2262 ntfs_error(vi->i_sb, "Failed to commit dirty inode "
2263 "0x%lx. Losing data!", vi->i_ino);
2339 * @vi: inode for which the i_size was changed
2345 * The kernel guarantees that @vi is a regular file (S_ISREG() is true) and
2348 * This implies for us that @vi is a file inode rather than a directory, index,
2349 * or attribute inode as well as that @vi is a base inode.
2355 int ntfs_truncate(struct inode *vi)
2360 ntfs_inode *base_ni, *ni = NTFS_I(vi);
2369 ntfs_debug("Entering for inode 0x%lx.", vi->i_ino);
2371 BUG_ON(S_ISDIR(vi->i_mode));
2387 ntfs_error(vi->i_sb, "Failed to map mft record for inode 0x%lx "
2388 "(error code %d).%s", vi->i_ino, err, te);
2395 ntfs_error(vi->i_sb, "Failed to allocate a search context for "
2397 vi->i_ino, te);
2405 ntfs_error(vi->i_sb, "Open attribute is missing from "
2407 "Run chkdsk.%s", vi->i_ino, te);
2410 ntfs_error(vi->i_sb, "Failed to lookup attribute in "
2412 vi->i_ino, err, te);
2420 new_size = i_size_read(vi);
2465 vi->i_ino,
2474 vi->i_ino,
2479 i_size_write(vi, old_size);
2484 ntfs_warning(vi->i_sb, "Changes in inode size are not "
2566 "with error code %i.", vi->i_ino,
2627 vi->i_ino,
2731 "code %i.%s", vi->i_ino,
2755 vi->i_ino, (unsigned)le32_to_cpu(ni->type),
2773 vi->i_blocks = ni->itype.compressed.size >> 9;
2776 vi->i_blocks = new_alloc_size >> 9;
2834 i_size_write(vi, old_size);
2850 i_size_write(vi, old_size);
2856 * @vi: inode for which the i_size was changed
2863 void ntfs_truncate_vfs(struct inode *vi) {
2864 ntfs_truncate(vi);
2884 struct inode *vi = d_inode(dentry);
2893 ntfs_warning(vi->i_sb, "Changes in user/group/mode are not "
2899 if (attr->ia_size != i_size_read(vi)) {
2900 ntfs_inode *ni = NTFS_I(vi);
2906 ntfs_warning(vi->i_sb, "Changes in inode size "
2913 truncate_setsize(vi, attr->ia_size);
2914 ntfs_truncate_vfs(vi);
2927 vi->i_atime = attr->ia_atime;
2929 vi->i_mtime = attr->ia_mtime;
2931 vi->i_ctime = attr->ia_ctime;
2932 mark_inode_dirty(vi);
2939 * @vi: inode to write out
2955 int __ntfs_write_inode(struct inode *vi, int sync)
2958 ntfs_inode *ni = NTFS_I(vi);
2966 vi->i_ino);
2998 nt = utc2ntfs(vi->i_mtime);
3001 "new = 0x%llx", vi->i_ino, (long long)
3007 nt = utc2ntfs(vi->i_ctime);
3010 "new = 0x%llx", vi->i_ino, (long long)
3016 nt = utc2ntfs(vi->i_atime);
3019 "new = 0x%llx", vi->i_ino,
3089 ntfs_warning(vi->i_sb, "Not enough memory to write inode. "
3092 mark_inode_dirty(vi);
3094 ntfs_error(vi->i_sb, "Failed (error %i): Run chkdsk.", -err);