29 #include <linux/slab.h>
68 if (
likely(!NInoAttr(ni))) {
104 static int ntfs_init_locked_inode(
struct inode *vi,
ntfs_attr *na)
112 NInoSetMstProtected(ni);
149 static int ntfs_read_locked_inode(
struct inode *vi);
150 static int ntfs_read_locked_attr_inode(
struct inode *base_vi,
struct inode *vi);
151 static int ntfs_read_locked_index_inode(
struct inode *base_vi,
182 (
set_t)ntfs_init_locked_inode, &na);
190 err = ntfs_read_locked_inode(vi);
243 (
set_t)ntfs_init_locked_inode, &na);
251 err = ntfs_read_locked_attr_inode(base_vi, vi);
298 (
set_t)ntfs_init_locked_inode, &na);
306 err = ntfs_read_locked_index_inode(base_vi, vi);
331 ntfs_error(sb,
"Allocation of NTFS big inode structure failed.");
352 static inline ntfs_inode *ntfs_alloc_extent_inode(
void)
366 static void ntfs_destroy_extent_inode(
ntfs_inode *ni)
400 ni->
vol = NTFS_SB(sb);
401 ntfs_init_runlist(&ni->
runlist);
409 &attr_list_rl_lock_class);
428 unsigned long mft_no)
470 FILE_NAME_ATTR *file_name_attr;
484 "attribute. You should run chkdsk.");
487 if (attr->non_resident) {
489 "name. You should run chkdsk.");
494 "invalid flags. You should run "
500 "name. You should run chkdsk.");
503 file_name_attr = (FILE_NAME_ATTR*)((
u8*)attr +
505 p2 = (
u8*)attr +
le32_to_cpu(attr->data.resident.value_length);
506 if (p2 < (
u8*)attr || p2 >
p)
507 goto err_corrupt_attr;
516 "doesn't match number of name attributes. You "
517 "should run chkdsk.");
549 static int ntfs_read_locked_inode(
struct inode *vi)
556 STANDARD_INFORMATION *si;
579 ntfs_init_big_inode(vi);
597 if (m->base_mft_record) {
664 si = (STANDARD_INFORMATION*)((
u8*)a +
677 vi->
i_mtime = ntfs2utc(si->last_data_change_time);
683 vi->
i_ctime = ntfs2utc(si->last_mft_change_time);
688 vi->
i_atime = ntfs2utc(si->last_access_time);
701 goto skip_attr_list_load;
712 if (a->non_resident) {
714 "list attribute is encrypted/"
719 "attribute in inode 0x%lx is marked "
720 "encrypted/sparse which is not true. "
721 "However, Windows allows this and "
722 "chkdsk does not detect or correct it "
723 "so we will just ignore the invalid "
724 "flags and pretend they are not set.",
732 "buffer for attribute list.");
736 if (a->non_resident) {
737 NInoSetAttrListNonResident(ni);
738 if (a->data.non_resident.lowest_vcn) {
753 "decompression failed.");
759 sle64_to_cpu(a->data.non_resident.
762 "attribute list attribute.");
768 a->data.resident.value_length) >
776 a->data.resident.value_offset),
778 a->data.resident.value_length));
790 u8 *ir_end, *index_end;
817 "placed after the attribute value.");
827 NInoSetCompressed(ni);
831 "compressed attribute.");
834 NInoSetEncrypted(ni);
838 ir = (INDEX_ROOT*)((
u8*)a +
840 ir_end = (
u8*)ir +
le32_to_cpu(a->data.resident.value_length);
846 index_end = (
u8*)&ir->index +
848 if (index_end > ir_end) {
859 "COLLATION_FILE_NAME.");
862 ni->
itype.
index.collation_rule = ir->collation_rule;
873 "PAGE_CACHE_SIZE (%ld) is not "
882 "NTFS_BLOCK_SIZE (%i) is not "
901 NInoSetMstProtected(ni);
915 goto skip_large_dir_stuff;
917 NInoSetIndexAllocPresent(ni);
925 "attribute is not present but "
926 "$INDEX_ROOT indicated it is.");
934 if (!a->non_resident) {
945 a->data.non_resident.mapping_pairs_offset)))) {
947 "is placed after the mapping pairs "
966 if (a->data.non_resident.lowest_vcn) {
968 "$INDEX_ALLOCATION attribute has non "
972 vi->
i_size = sle64_to_cpu(a->data.non_resident.data_size);
974 a->data.non_resident.initialized_size);
976 a->data.non_resident.allocated_size);
993 if (NInoCompressed(bni) || NInoEncrypted(bni) ||
996 "and/or encrypted and/or sparse.");
997 goto iput_unm_err_out;
1000 bvi_size = i_size_read(bvi);
1001 if ((bvi_size << 3) < (vi->
i_size >>
1004 "for index allocation (0x%llx).",
1005 bvi_size << 3, vi->
i_size);
1006 goto iput_unm_err_out;
1010 skip_large_dir_stuff:
1038 goto no_data_attr_special_case;
1048 if (ntfs_is_extended_system_file(ctx) > 0)
1049 goto no_data_attr_special_case;
1059 NInoSetCompressed(ni);
1062 "compressed data but "
1065 "cluster size (%i) > "
1073 "compression method "
1074 "or corrupt file.");
1082 if (NInoCompressed(ni)) {
1084 "compressed data.");
1087 NInoSetEncrypted(ni);
1089 if (a->non_resident) {
1090 NInoSetNonResident(ni);
1091 if (NInoCompressed(ni) || NInoSparse(ni)) {
1092 if (NInoCompressed(ni) && a->data.non_resident.
1096 "compression unit (%u "
1098 "Cannot handle this.",
1099 a->data.non_resident.
1104 if (a->data.non_resident.compression_unit) {
1106 (a->data.non_resident.
1125 a->data.non_resident.
1128 if (a->data.non_resident.lowest_vcn) {
1130 "attribute has non zero "
1134 vi->
i_size = sle64_to_cpu(
1135 a->data.non_resident.data_size);
1137 a->data.non_resident.initialized_size);
1139 a->data.non_resident.allocated_size);
1142 a->data.resident.value_length);
1145 a->data.resident.value_offset);
1148 "is corrupt (size exceeds "
1153 no_data_attr_special_case:
1163 if (NInoMstProtected(ni))
1178 if (
S_ISREG(vi->
i_mode) && (NInoCompressed(ni) || NInoSparse(ni)))
1194 ntfs_error(vol->
sb,
"Failed with error code %i. Marking corrupt "
1195 "inode 0x%lx as bad. Run chkdsk.", err, vi->
i_ino);
1224 static int ntfs_read_locked_attr_inode(
struct inode *base_vi,
struct inode *vi)
1235 ntfs_init_big_inode(vi);
1238 base_ni = NTFS_I(base_vi);
1271 NInoSetCompressed(ni);
1275 "non-data or named data "
1276 "attribute. Please report "
1277 "you saw this message to "
1278 "linux-ntfs-dev@lists."
1284 "attribute but compression is "
1285 "disabled due to cluster size "
1293 "compression method.");
1303 "but the attribute is %s. Please "
1304 "report you saw this message to "
1306 NInoCompressed(ni) ?
"compressed" :
1314 if (NInoCompressed(ni)) {
1325 "but the attribute is encrypted. "
1326 "Please report you saw this message "
1336 NInoSetEncrypted(ni);
1338 if (!a->non_resident) {
1343 "the attribute value.");
1346 if (NInoMstProtected(ni)) {
1348 "but the attribute is resident. "
1349 "Please report you saw this message to "
1354 a->data.resident.value_length);
1359 "(size exceeds allocation).");
1363 NInoSetNonResident(ni);
1370 a->data.non_resident.mapping_pairs_offset)))) {
1372 "the mapping pairs array.");
1375 if (NInoCompressed(ni) || NInoSparse(ni)) {
1376 if (NInoCompressed(ni) && a->data.non_resident.
1379 "compression unit (%u instead "
1380 "of 4). Cannot handle this.",
1381 a->data.non_resident.
1386 if (a->data.non_resident.compression_unit) {
1388 (a->data.non_resident.
1395 a->data.non_resident.
1403 a->data.non_resident.compressed_size);
1405 if (a->data.non_resident.lowest_vcn) {
1407 "non-zero lowest_vcn.");
1410 vi->
i_size = sle64_to_cpu(a->data.non_resident.data_size);
1412 a->data.non_resident.initialized_size);
1414 a->data.non_resident.allocated_size);
1416 if (NInoMstProtected(ni))
1445 ntfs_error(vol->
sb,
"Failed with error code %i while reading attribute "
1446 "inode (mft_no 0x%lx, type 0x%x, name_len %i). "
1447 "Marking corrupt inode and base inode 0x%lx as bad. "
1489 static int ntfs_read_locked_index_inode(
struct inode *base_vi,
struct inode *vi)
1499 u8 *ir_end, *index_end;
1503 ntfs_init_big_inode(vi);
1505 base_ni = NTFS_I(base_vi);
1540 ntfs_error(vol->
sb,
"$INDEX_ROOT attribute is not resident.");
1546 ntfs_error(vol->
sb,
"$INDEX_ROOT attribute name is placed "
1547 "after the attribute value.");
1560 ir = (INDEX_ROOT*)((
u8*)a +
le16_to_cpu(a->data.resident.value_offset));
1561 ir_end = (
u8*)ir +
le32_to_cpu(a->data.resident.value_length);
1566 index_end = (
u8*)&ir->index +
le32_to_cpu(ir->index.index_length);
1567 if (index_end > ir_end) {
1576 ni->
itype.
index.collation_rule = ir->collation_rule;
1587 "(%ld) is not supported. Sorry.",
1594 "(%i) is not supported. Sorry.",
1617 goto skip_large_index_stuff;
1619 NInoSetIndexAllocPresent(ni);
1627 "not present but $INDEX_ROOT "
1628 "indicated it is.");
1631 "$INDEX_ALLOCATION attribute.");
1635 if (!a->non_resident) {
1645 a->data.non_resident.mapping_pairs_offset)))) {
1646 ntfs_error(vol->
sb,
"$INDEX_ALLOCATION attribute name is "
1647 "placed after the mapping pairs array.");
1664 if (a->data.non_resident.lowest_vcn) {
1666 "attribute has non zero lowest_vcn.");
1669 vi->
i_size = sle64_to_cpu(a->data.non_resident.data_size);
1671 a->data.non_resident.initialized_size);
1672 ni->
allocated_size = sle64_to_cpu(a->data.non_resident.allocated_size);
1689 if (NInoCompressed(bni) || NInoEncrypted(bni) ||
1692 "encrypted and/or sparse.");
1693 goto iput_unm_err_out;
1696 bvi_size = i_size_read(bvi);
1699 "index allocation (0x%llx).", bvi_size << 3,
1701 goto iput_unm_err_out;
1704 skip_large_index_stuff:
1730 ntfs_error(vi->
i_sb,
"Failed with error code %i while reading index "
1731 "inode (mft_no 0x%lx, name_len %i.", err, vi->
i_ino,
1746 static struct lock_class_key mft_ni_runlist_lock_key, mft_ni_mrec_lock_key;
1780 struct buffer_head *bh;
1782 MFT_RECORD *m =
NULL;
1785 unsigned int i, nr_blocks;
1791 ntfs_init_big_inode(vi);
1796 NInoSetNonResident(ni);
1797 NInoSetMstProtected(ni);
1798 NInoSetSparseDisabled(ni);
1814 ntfs_error(sb,
"Unsupported mft record size %i (max 64kiB).",
1821 m = (MFT_RECORD*)ntfs_malloc_nofs(i);
1823 ntfs_error(sb,
"Failed to allocate buffer for $MFT record 0.");
1835 for (i = 0; i < nr_blocks; i++) {
1836 bh = sb_bread(sb, block++);
1849 ntfs_error(sb,
"MST fixup failed. $MFT is corrupt.");
1869 ntfs_error(sb,
"Failed to lookup attribute list "
1870 "attribute. You should run chkdsk.");
1874 ATTR_LIST_ENTRY *al_entry, *next_al_entry;
1876 static const char *
es =
" Not allowed. $MFT is corrupt. "
1877 "You should run chkdsk.";
1879 ntfs_debug(
"Attribute list attribute found in $MFT.");
1880 NInoSetAttrList(ni);
1883 ntfs_error(sb,
"Attribute list attribute is "
1884 "compressed.%s", es);
1889 if (a->non_resident) {
1890 ntfs_error(sb,
"Non-resident attribute list "
1891 "attribute is encrypted/"
1896 "in $MFT system file is marked "
1897 "encrypted/sparse which is not true. "
1898 "However, Windows allows this and "
1899 "chkdsk does not detect or correct it "
1900 "so we will just ignore the invalid "
1901 "flags and pretend they are not set.");
1907 ntfs_error(sb,
"Not enough memory to allocate buffer "
1908 "for attribute list.");
1911 if (a->non_resident) {
1912 NInoSetAttrListNonResident(ni);
1913 if (a->data.non_resident.lowest_vcn) {
1914 ntfs_error(sb,
"Attribute list has non zero "
1915 "lowest_vcn. $MFT is corrupt. "
1916 "You should run chkdsk.");
1925 ntfs_error(sb,
"Mapping pairs decompression "
1926 "failed with error code %i.",
1933 sle64_to_cpu(a->data.
1934 non_resident.initialized_size)))) {
1935 ntfs_error(sb,
"Failed to load attribute list "
1936 "attribute with error code %i.",
1942 a->data.resident.value_offset) +
1944 a->data.resident.value_length) >
1952 a->data.resident.value_offset),
1954 a->data.resident.value_length));
1968 al_entry = (ATTR_LIST_ENTRY*)ni->
attr_list;
1970 for (;; al_entry = next_al_entry) {
1973 (
u8*)al_entry > al_end)
1974 goto em_put_err_out;
1976 if ((
u8*)al_entry == al_end)
1977 goto em_put_err_out;
1978 if (!al_entry->length)
1979 goto em_put_err_out;
1980 if ((
u8*)al_entry + 6 > al_end || (
u8*)al_entry +
1982 goto em_put_err_out;
1983 next_al_entry = (ATTR_LIST_ENTRY*)((
u8*)al_entry +
1986 goto em_put_err_out;
1987 if (
AT_DATA != al_entry->type)
1990 if (al_entry->name_length)
1991 goto em_put_err_out;
1993 if (al_entry->lowest_vcn)
1994 goto em_put_err_out;
1998 ntfs_error(sb,
"BUG: The first $DATA extent "
1999 "of $MFT is not in the base "
2000 "mft record. Please report "
2001 "you saw this message to "
2002 "linux-ntfs-dev@lists."
2007 if (
MSEQNO_LE(al_entry->mft_reference) !=
2009 goto em_put_err_out;
2020 next_vcn = last_vcn = highest_vcn = 0;
2028 if (!a->non_resident) {
2029 ntfs_error(sb,
"$MFT must be non-resident but a "
2030 "resident extent was found. $MFT is "
2031 "corrupt. Run chkdsk.");
2039 "non-sparse, and unencrypted but a "
2040 "compressed/sparse/encrypted extent "
2041 "was found. $MFT is corrupt. Run "
2053 ntfs_error(sb,
"ntfs_mapping_pairs_decompress() "
2054 "failed with error code %ld. $MFT is "
2055 "corrupt.", PTR_ERR(nrl));
2062 if (a->data.non_resident.lowest_vcn) {
2064 "attribute has non zero "
2065 "lowest_vcn. $MFT is corrupt. "
2066 "You should run chkdsk.");
2070 last_vcn = sle64_to_cpu(
2071 a->data.non_resident.allocated_size)
2074 vi->
i_size = sle64_to_cpu(
2075 a->data.non_resident.data_size);
2077 a->data.non_resident.initialized_size);
2079 a->data.non_resident.allocated_size);
2086 ntfs_error(sb,
"$MFT is too big! Aborting.");
2108 ntfs_read_locked_inode(vi);
2111 "failed. BUG or corrupt $MFT. "
2112 "Run chkdsk and if no errors "
2113 "are found, please report you "
2114 "saw this message to "
2115 "linux-ntfs-dev@lists."
2137 highest_vcn = sle64_to_cpu(a->data.non_resident.highest_vcn);
2138 next_vcn = highest_vcn + 1;
2145 if (next_vcn < sle64_to_cpu(
2146 a->data.non_resident.lowest_vcn)) {
2147 ntfs_error(sb,
"$MFT has corrupt attribute list "
2148 "attribute. Run chkdsk.");
2153 ntfs_error(sb,
"Failed to lookup $MFT/$DATA attribute extent. "
2154 "$MFT is corrupt. Run chkdsk.");
2158 ntfs_error(sb,
"$MFT/$DATA attribute not found. $MFT is "
2159 "corrupt. Run chkdsk.");
2162 if (highest_vcn && highest_vcn != last_vcn - 1) {
2163 ntfs_error(sb,
"Failed to load the complete runlist for "
2164 "$MFT/$DATA. Driver bug or corrupt $MFT. "
2166 ntfs_debug(
"highest_vcn = 0x%llx, last_vcn - 1 = 0x%llx",
2167 (
unsigned long long)highest_vcn,
2168 (
unsigned long long)last_vcn - 1);
2185 ntfs_error(sb,
"Couldn't find first extent of $DATA attribute in "
2186 "attribute list. $MFT is corrupt. Run chkdsk.");
2190 ntfs_error(sb,
"Failed. Marking inode as bad.");
2196 static void __ntfs_clear_inode(
ntfs_inode *ni)
2233 if (NInoDirty(ni)) {
2236 "Losing data! This is a BUG!!!");
2241 __ntfs_clear_inode(ni);
2244 ntfs_destroy_extent_inode(ni);
2265 if (NInoDirty(ni)) {
2269 ntfs_commit_inode(vi);
2273 "0x%lx. Losing data!", vi->
i_ino);
2288 __ntfs_clear_inode(ni);
2325 if (NVolCaseSensitive(vol))
2327 if (NVolShowSystemFiles(vol))
2329 if (!NVolSparseEnabled(vol))
2341 static const char *
es =
" Leaving inconsistent metadata. Unmount and run "
2362 int ntfs_truncate(
struct inode *vi)
2364 s64 new_size,
old_size, nr_freed, new_alloc_size, old_alloc_size;
2366 unsigned long flags;
2372 const char *te =
" Leaving file length out of sync with i_size.";
2373 int err, mp_size, size_change, alloc_change;
2379 BUG_ON(NInoMstProtected(ni));
2395 "(error code %d).%s", vi->
i_ino, err, te);
2403 "inode 0x%lx (not enough memory).%s",
2413 "mft record. Inode 0x%lx is corrupt. "
2414 "Run chkdsk.%s", vi->
i_ino, te);
2418 "inode 0x%lx (error code %d).%s",
2419 vi->
i_ino, err, te);
2427 new_size = i_size_read(vi);
2429 old_size = ntfs_attr_size(a);
2431 if (NInoNonResident(ni))
2435 new_alloc_size = (new_size + 7) & ~7;
2445 if (new_size - old_size >= 0) {
2447 if (new_size == old_size)
2452 if (new_alloc_size - old_alloc_size >= 0) {
2454 if (new_alloc_size == old_alloc_size)
2461 if (!size_change && !alloc_change)
2465 err = ntfs_attr_size_bounds_check(vol, ni->
type, new_size);
2469 "inode 0x%lx to %simum size "
2470 "for its attribute type "
2471 "(0x%x). Aborting truncate.",
2473 new_size > old_size ?
"exceed "
2474 "the max" :
"go under the min",
2479 "attribute type 0x%x. "
2480 "Aborting truncate.",
2486 i_size_write(vi, old_size);
2490 if (NInoCompressed(ni) || NInoEncrypted(ni)) {
2492 "supported yet for %s files, ignoring.",
2493 NInoCompressed(ni) ?
"compressed" :
2498 if (a->non_resident)
2499 goto do_non_resident_truncate;
2500 BUG_ON(NInoNonResident(ni));
2502 if (new_size < vol->mft_record_size &&
2503 !ntfs_resident_attr_value_resize(m, a, new_size)) {
2505 flush_dcache_mft_record_page(ctx->
ntfs_ino);
2506 mark_mft_record_dirty(ctx->
ntfs_ino);
2561 err = ntfs_attr_make_non_resident(ni, old_size);
2563 goto retry_truncate;
2570 ntfs_error(vol->
sb,
"Cannot truncate inode 0x%lx, attribute "
2571 "type 0x%x, because the conversion from "
2572 "resident to non-resident attribute failed "
2573 "with error code %i.", vi->
i_ino,
2581 ntfs_error(vol->
sb,
"Not enough space in the mft record/on "
2582 "disk for the non-resident attribute value. "
2583 "This case is not implemented yet.");
2586 "non-resident. This case is not implemented "
2593 goto do_resident_extend;
2606 goto do_resident_extend;
2614 goto do_resident_extend;
2618 do_non_resident_truncate:
2619 BUG_ON(!NInoNonResident(ni));
2620 if (alloc_change < 0) {
2621 highest_vcn = sle64_to_cpu(a->data.non_resident.highest_vcn);
2622 if (highest_vcn > 0 &&
2630 "attribute type 0x%x, because the "
2631 "attribute is highly fragmented (it "
2632 "consists of multiple extents) and "
2633 "this case is not implemented yet.",
2644 if (size_change < 0) {
2651 a->data.non_resident.initialized_size =
2652 cpu_to_sle64(new_size);
2654 a->data.non_resident.data_size = cpu_to_sle64(new_size);
2656 flush_dcache_mft_record_page(ctx->
ntfs_ino);
2657 mark_mft_record_dirty(ctx->
ntfs_ino);
2665 BUG_ON(alloc_change > 0);
2671 if (alloc_change > 0) {
2690 err = ntfs_attr_extend_allocation(ni, new_size,
2691 size_change > 0 ? new_size : -1, -1);
2703 nr_freed = ntfs_cluster_free(ni, new_alloc_size >>
2708 ntfs_error(vol->
sb,
"Failed to release cluster(s) (error code "
2709 "%lli). Unmount and run chkdsk to recover "
2710 "the lost cluster(s).", (
long long)nr_freed);
2715 err = ntfs_rl_truncate_nolock(vol, &ni->
runlist,
2724 ntfs_error(vol->
sb,
"Failed to %s (error code %li).%s",
2726 "restore attribute search context" :
2727 "truncate attribute runlist",
2728 IS_ERR(m) ? PTR_ERR(m) : err, es);
2733 mp_size = ntfs_get_size_for_mapping_pairs(vol, ni->
runlist.
rl, 0, -1);
2735 ntfs_error(vol->
sb,
"Cannot shrink allocation of inode 0x%lx, "
2736 "attribute type 0x%x, because determining the "
2737 "size for the mapping pairs failed with error "
2738 "code %i.%s", vi->
i_ino,
2749 err = ntfs_attr_record_resize(m, a, mp_size +
2750 le16_to_cpu(a->data.non_resident.mapping_pairs_offset));
2755 err = ntfs_mapping_pairs_build(vol, (
u8*)a +
2756 le16_to_cpu(a->data.non_resident.mapping_pairs_offset),
2759 ntfs_error(vol->
sb,
"Cannot shrink allocation of inode 0x%lx, "
2760 "attribute type 0x%x, because building the "
2761 "mapping pairs failed with error code %i.%s",
2768 a->data.non_resident.highest_vcn = cpu_to_sle64((new_alloc_size >>
2772 a->data.non_resident.allocated_size = cpu_to_sle64(new_alloc_size);
2773 if (NInoSparse(ni) || NInoCompressed(ni)) {
2778 a->data.non_resident.compressed_size = cpu_to_sle64(
2783 vi->
i_blocks = new_alloc_size >> 9;
2798 if (size_change > 0)
2799 a->data.non_resident.data_size = cpu_to_sle64(new_size);
2801 flush_dcache_mft_record_page(ctx->
ntfs_ino);
2802 mark_mft_record_dirty(ctx->
ntfs_ino);
2818 if (!timespec_equal(&VFS_I(base_ni)->i_mtime, &now) ||
2819 !timespec_equal(&VFS_I(base_ni)->i_ctime, &now))
2821 VFS_I(base_ni)->i_mtime = now;
2822 VFS_I(base_ni)->i_ctime = now;
2825 mark_inode_dirty_sync(VFS_I(base_ni));
2829 NInoClearTruncateFailed(ni);
2839 NInoSetTruncateFailed(ni);
2840 else if (old_size >= 0)
2841 i_size_write(vi, old_size);
2849 ntfs_debug(
"Failed. Returning error code %i.", err);
2855 NInoSetTruncateFailed(ni);
2857 i_size_write(vi, old_size);
2869 void ntfs_truncate_vfs(
struct inode *vi) {
2889 struct inode *vi = dentry->
d_inode;
2891 unsigned int ia_valid = attr->
ia_valid;
2899 "supported yet, ignoring.");
2904 if (attr->
ia_size != i_size_read(vi)) {
2910 if (NInoCompressed(ni) || NInoEncrypted(ni)) {
2912 "are not supported yet for "
2913 "%s files, ignoring.",
2914 NInoCompressed(ni) ?
2915 "compressed" :
"encrypted");
2919 if (err || ia_valid == ATTR_SIZE)
2931 vi->
i_sb->s_time_gran);
2934 vi->
i_sb->s_time_gran);
2937 vi->
i_sb->s_time_gran);
2938 mark_inode_dirty(vi);
2961 int __ntfs_write_inode(
struct inode *vi,
int sync)
2967 STANDARD_INFORMATION *si;
2969 bool modified =
false;
2971 ntfs_debug(
"Entering for %sinode 0x%lx.", NInoAttr(ni) ?
"attr " :
"",
3001 si = (STANDARD_INFORMATION*)((
u8*)ctx->
attr +
3005 if (si->last_data_change_time != nt) {
3006 ntfs_debug(
"Updating mtime for inode 0x%lx: old = 0x%llx, "
3007 "new = 0x%llx", vi->
i_ino, (
long long)
3008 sle64_to_cpu(si->last_data_change_time),
3009 (
long long)sle64_to_cpu(nt));
3010 si->last_data_change_time = nt;
3014 if (si->last_mft_change_time != nt) {
3015 ntfs_debug(
"Updating ctime for inode 0x%lx: old = 0x%llx, "
3016 "new = 0x%llx", vi->
i_ino, (
long long)
3017 sle64_to_cpu(si->last_mft_change_time),
3018 (
long long)sle64_to_cpu(nt));
3019 si->last_mft_change_time = nt;
3023 if (si->last_access_time != nt) {
3024 ntfs_debug(
"Updating atime for inode 0x%lx: old = 0x%llx, "
3025 "new = 0x%llx", vi->
i_ino,
3026 (
long long)sle64_to_cpu(si->last_access_time),
3027 (
long long)sle64_to_cpu(nt));
3028 si->last_access_time = nt;
3048 flush_dcache_mft_record_page(ctx->
ntfs_ino);
3049 if (!NInoTestSetDirty(ctx->
ntfs_ino))
3056 err = write_mft_record(ni, m, sync);
3067 if (NInoDirty(tni)) {
3072 if (!err || err == -
ENOMEM)
3076 ret = write_mft_record(tni, tm, sync);
3079 if (!err || err == -
ENOMEM)
3096 "Marking the inode dirty again, so the VFS "
3098 mark_inode_dirty(vi);
3101 NVolSetErrors(ni->
vol);