Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ntfs: change mft_no type to u64

Changes the type of ntfs_inode::mft_no from unsigned long to u64
to safely handle the full 48-bit range without truncation risk, especially
in preparation for broader VFS inode number type (i_ino:u64) and to
improve consistency with ntfs driver practices.

Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>

+119 -128
+3 -3
fs/ntfs/aops.c
··· 96 96 unsigned int delta; 97 97 unsigned char blocksize_bits; 98 98 99 - ntfs_debug("Entering for mft_no 0x%lx, logical block 0x%llx.", 99 + ntfs_debug("Entering for mft_no 0x%llx, logical block 0x%llx.", 100 100 ni->mft_no, (unsigned long long)block); 101 101 if (ni->type != AT_DATA || !NInoNonResident(ni) || NInoEncrypted(ni) || 102 102 NInoMstProtected(ni)) { ··· 144 144 goto hole; 145 145 case LCN_ENOMEM: 146 146 ntfs_error(vol->sb, 147 - "Not enough memory to complete mapping for inode 0x%lx. Returning 0.", 147 + "Not enough memory to complete mapping for inode 0x%llx. Returning 0.", 148 148 ni->mft_no); 149 149 break; 150 150 default: 151 151 ntfs_error(vol->sb, 152 - "Failed to complete mapping for inode 0x%lx. Run chkdsk. Returning 0.", 152 + "Failed to complete mapping for inode 0x%llx. Run chkdsk. Returning 0.", 153 153 ni->mft_no); 154 154 break; 155 155 }
+13 -13
fs/ntfs/attrib.c
··· 370 370 unsigned long flags; 371 371 bool is_retry = false; 372 372 373 - ntfs_debug("Entering for i_ino 0x%lx, vcn 0x%llx, %s_locked.", 373 + ntfs_debug("Entering for i_ino 0x%llx, vcn 0x%llx, %s_locked.", 374 374 ni->mft_no, (unsigned long long)vcn, 375 375 write_locked ? "write" : "read"); 376 376 if (!ni->runlist.rl) { ··· 521 521 int err = 0; 522 522 bool is_retry = false; 523 523 524 - ntfs_debug("Entering for i_ino 0x%lx, vcn 0x%llx, with%s ctx.", 524 + ntfs_debug("Entering for i_ino 0x%llx, vcn 0x%llx, with%s ctx.", 525 525 ni->mft_no, (unsigned long long)vcn, ctx ? "" : "out"); 526 526 if (!ni->runlist.rl) { 527 527 read_lock_irqsave(&ni->size_lock, flags); ··· 679 679 if (a->name_length && ((le16_to_cpu(a->name_offset) + 680 680 a->name_length * sizeof(__le16)) > 681 681 le32_to_cpu(a->length))) { 682 - ntfs_error(vol->sb, "Corrupt attribute name in MFT record %lld\n", 683 - (long long)ctx->ntfs_ino->mft_no); 682 + ntfs_error(vol->sb, "Corrupt attribute name in MFT record %llu\n", 683 + ctx->ntfs_ino->mft_no); 684 684 break; 685 685 } 686 686 ··· 790 790 attr_vi = ntfs_attr_iget(VFS_I(base_ni), AT_ATTRIBUTE_LIST, AT_UNNAMED, 0); 791 791 if (IS_ERR(attr_vi)) { 792 792 ntfs_error(base_ni->vol->sb, 793 - "Failed to open an inode for Attribute list, mft = %ld", 793 + "Failed to open an inode for Attribute list, mft = %llu", 794 794 base_ni->mft_no); 795 795 return PTR_ERR(attr_vi); 796 796 } ··· 798 798 if (ntfs_inode_attr_pread(attr_vi, 0, size, al_start) != size) { 799 799 iput(attr_vi); 800 800 ntfs_error(base_ni->vol->sb, 801 - "Failed to read attribute list, mft = %ld", 801 + "Failed to read attribute list, mft = %llu", 802 802 base_ni->mft_no); 803 803 return -EIO; 804 804 } ··· 817 817 break; 818 818 } 819 819 if (al != al_start + size) { 820 - ntfs_error(base_ni->vol->sb, "Corrupt attribute list, mft = %ld", 820 + ntfs_error(base_ni->vol->sb, "Corrupt attribute list, mft = %llu", 821 821 base_ni->mft_no); 822 822 return -EIO; 823 823 } ··· 890 890 int err = 0; 891 891 static const char *es = " Unmount and run chkdsk."; 892 892 893 - ntfs_debug("Entering for inode 0x%lx, type 0x%x.", ni->mft_no, type); 893 + ntfs_debug("Entering for inode 0x%llx, type 0x%x.", ni->mft_no, type); 894 894 if (!base_ni) { 895 895 /* First call happens with the base mft record. */ 896 896 base_ni = ctx->base_ntfs_ino = ctx->ntfs_ino; ··· 1090 1090 if (MREF_LE(al_entry->mft_reference) == ni->mft_no) { 1091 1091 if (MSEQNO_LE(al_entry->mft_reference) != ni->seq_no) { 1092 1092 ntfs_error(vol->sb, 1093 - "Found stale mft reference in attribute list of base inode 0x%lx.%s", 1093 + "Found stale mft reference in attribute list of base inode 0x%llx.%s", 1094 1094 base_ni->mft_no, es); 1095 1095 err = -EIO; 1096 1096 break; ··· 1112 1112 al_entry->mft_reference), &ni); 1113 1113 if (IS_ERR(ctx->mrec)) { 1114 1114 ntfs_error(vol->sb, 1115 - "Failed to map extent mft record 0x%lx of base inode 0x%lx.%s", 1115 + "Failed to map extent mft record 0x%lx of base inode 0x%llx.%s", 1116 1116 MREF_LE(al_entry->mft_reference), 1117 1117 base_ni->mft_no, es); 1118 1118 err = PTR_ERR(ctx->mrec); ··· 1201 1201 1202 1202 if (!err) { 1203 1203 ntfs_error(vol->sb, 1204 - "Base inode 0x%lx contains corrupt attribute list attribute.%s", 1204 + "Base inode 0x%llx contains corrupt attribute list attribute.%s", 1205 1205 base_ni->mft_no, es); 1206 1206 err = -EIO; 1207 1207 } ··· 3497 3497 * delete extent) and continue search. 3498 3498 */ 3499 3499 if (finished_build) { 3500 - ntfs_debug("Mark attr 0x%x for delete in inode 0x%lx.\n", 3500 + ntfs_debug("Mark attr 0x%x for delete in inode 0x%llx.\n", 3501 3501 (unsigned int)le32_to_cpu(a->type), ctx->ntfs_ino->mft_no); 3502 3502 a->data.non_resident.highest_vcn = cpu_to_le64(NTFS_VCN_DELETE_MARK); 3503 3503 mark_mft_record_dirty(ctx->ntfs_ino); ··· 4728 4728 CASE_SENSITIVE, vcn, NULL, 0, ctx); 4729 4729 if (err) { 4730 4730 ntfs_error(vol->sb, 4731 - "ntfs_attr_lookup failed, ntfs inode(mft_no : %ld) type : 0x%x, err : %d", 4731 + "ntfs_attr_lookup failed, ntfs inode(mft_no : %llu) type : 0x%x, err : %d", 4732 4732 ni->mft_no, ni->type, err); 4733 4733 goto out; 4734 4734 }
+2 -2
fs/ntfs/compress.c
··· 797 797 */ 798 798 if (err) { 799 799 ntfs_error(vol->sb, 800 - "ntfs_decompress() failed in inode 0x%lx with error code %i. Skipping this compression block.", 800 + "ntfs_decompress() failed in inode 0x%llx with error code %i. Skipping this compression block.", 801 801 ni->mft_no, -err); 802 802 /* Release the unfinished pages. */ 803 803 for (; prev_cur_page < cur_page; prev_cur_page++) { ··· 823 823 page = pages[cur_page]; 824 824 if (page) { 825 825 ntfs_error(vol->sb, 826 - "Still have pages left! Terminating them with extreme prejudice. Inode 0x%lx, page index 0x%lx.", 826 + "Still have pages left! Terminating them with extreme prejudice. Inode 0x%llx, page index 0x%lx.", 827 827 ni->mft_no, page->__folio_index); 828 828 flush_dcache_page(page); 829 829 kunmap_local(page_address(page));
+19 -19
fs/ntfs/dir.c
··· 102 102 if (unlikely(err)) { 103 103 if (err == -ENOENT) { 104 104 ntfs_error(sb, 105 - "Index root attribute missing in directory inode 0x%lx.", 105 + "Index root attribute missing in directory inode 0x%llx.", 106 106 dir_ni->mft_no); 107 107 err = -EIO; 108 108 } ··· 338 338 /* Bounds checks. */ 339 339 if ((u8 *)ia < kaddr || (u8 *)ia > kaddr + PAGE_SIZE) { 340 340 ntfs_error(sb, 341 - "Out of bounds check failed. Corrupt directory inode 0x%lx or driver bug.", 341 + "Out of bounds check failed. Corrupt directory inode 0x%llx or driver bug.", 342 342 dir_ni->mft_no); 343 343 goto unm_err_out; 344 344 } 345 345 /* Catch multi sector transfer fixup errors. */ 346 346 if (unlikely(!ntfs_is_indx_record(ia->magic))) { 347 347 ntfs_error(sb, 348 - "Directory index record with vcn 0x%llx is corrupt. Corrupt inode 0x%lx. Run chkdsk.", 349 - (unsigned long long)vcn, dir_ni->mft_no); 348 + "Directory index record with vcn 0x%llx is corrupt. Corrupt inode 0x%llx. Run chkdsk.", 349 + vcn, dir_ni->mft_no); 350 350 goto unm_err_out; 351 351 } 352 352 if (le64_to_cpu(ia->index_block_vcn) != vcn) { 353 353 ntfs_error(sb, 354 - "Actual VCN (0x%llx) of index buffer is different from expected VCN (0x%llx). Directory inode 0x%lx is corrupt or driver bug.", 355 - (unsigned long long)le64_to_cpu(ia->index_block_vcn), 356 - (unsigned long long)vcn, dir_ni->mft_no); 354 + "Actual VCN (0x%llx) of index buffer is different from expected VCN (0x%llx). Directory inode 0x%llx is corrupt or driver bug.", 355 + le64_to_cpu(ia->index_block_vcn), 356 + vcn, dir_ni->mft_no); 357 357 goto unm_err_out; 358 358 } 359 359 if (le32_to_cpu(ia->index.allocated_size) + 0x18 != 360 360 dir_ni->itype.index.block_size) { 361 361 ntfs_error(sb, 362 - "Index buffer (VCN 0x%llx) of directory inode 0x%lx has a size (%u) differing from the directory specified size (%u). Directory inode is corrupt or driver bug.", 363 - (unsigned long long)vcn, dir_ni->mft_no, 362 + "Index buffer (VCN 0x%llx) of directory inode 0x%llx has a size (%u) differing from the directory specified size (%u). Directory inode is corrupt or driver bug.", 363 + vcn, dir_ni->mft_no, 364 364 le32_to_cpu(ia->index.allocated_size) + 0x18, 365 365 dir_ni->itype.index.block_size); 366 366 goto unm_err_out; ··· 368 368 index_end = (u8 *)ia + dir_ni->itype.index.block_size; 369 369 if (index_end > kaddr + PAGE_SIZE) { 370 370 ntfs_error(sb, 371 - "Index buffer (VCN 0x%llx) of directory inode 0x%lx crosses page boundary. Impossible! Cannot access! This is probably a bug in the driver.", 372 - (unsigned long long)vcn, dir_ni->mft_no); 371 + "Index buffer (VCN 0x%llx) of directory inode 0x%llx crosses page boundary. Impossible! Cannot access! This is probably a bug in the driver.", 372 + vcn, dir_ni->mft_no); 373 373 goto unm_err_out; 374 374 } 375 375 index_end = (u8 *)&ia->index + le32_to_cpu(ia->index.index_length); 376 376 if (index_end > (u8 *)ia + dir_ni->itype.index.block_size) { 377 377 ntfs_error(sb, 378 - "Size of index buffer (VCN 0x%llx) of directory inode 0x%lx exceeds maximum size.", 379 - (unsigned long long)vcn, dir_ni->mft_no); 378 + "Size of index buffer (VCN 0x%llx) of directory inode 0x%llx exceeds maximum size.", 379 + vcn, dir_ni->mft_no); 380 380 goto unm_err_out; 381 381 } 382 382 /* The first index entry. */ ··· 393 393 (u8 *)ie + sizeof(struct index_entry_header) > index_end || 394 394 (u8 *)ie + sizeof(struct index_entry_header) + le16_to_cpu(ie->key_length) > 395 395 index_end || (u8 *)ie + le16_to_cpu(ie->length) > index_end) { 396 - ntfs_error(sb, "Index entry out of bounds in directory inode 0x%lx.", 396 + ntfs_error(sb, "Index entry out of bounds in directory inode 0x%llx.", 397 397 dir_ni->mft_no); 398 398 goto unm_err_out; 399 399 } ··· 546 546 if (ie->flags & INDEX_ENTRY_NODE) { 547 547 if ((ia->index.flags & NODE_MASK) == LEAF_NODE) { 548 548 ntfs_error(sb, 549 - "Index entry with child node found in a leaf node in directory inode 0x%lx.", 549 + "Index entry with child node found in a leaf node in directory inode 0x%llx.", 550 550 dir_ni->mft_no); 551 551 goto unm_err_out; 552 552 } ··· 566 566 kaddr = NULL; 567 567 goto descend_into_child_node; 568 568 } 569 - ntfs_error(sb, "Negative child node vcn in directory inode 0x%lx.", 569 + ntfs_error(sb, "Negative child node vcn in directory inode 0x%llx.", 570 570 dir_ni->mft_no); 571 571 goto unm_err_out; 572 572 } ··· 863 863 /* Find the index root attribute in the mft record. */ 864 864 if (ntfs_attr_lookup(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, 0, NULL, 0, 865 865 ctx)) { 866 - ntfs_error(sb, "Index root attribute missing in directory inode %ld", 866 + ntfs_error(sb, "Index root attribute missing in directory inode %llu", 867 867 ndir->mft_no); 868 868 ntfs_attr_put_search_ctx(ctx); 869 869 err = -ENOMEM; ··· 1062 1062 ret = ntfs_attr_lookup(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, 0, NULL, 1063 1063 0, ctx); 1064 1064 if (ret) { 1065 - ntfs_error(ni->vol->sb, "Index root attribute missing in directory inode %lld", 1066 - (unsigned long long)ni->mft_no); 1065 + ntfs_error(ni->vol->sb, "Index root attribute missing in directory inode %llu", 1066 + ni->mft_no); 1067 1067 ntfs_attr_put_search_ctx(ctx); 1068 1068 return ret; 1069 1069 }
+31 -33
fs/ntfs/inode.c
··· 89 89 struct ntfs_attr *na = data; 90 90 struct ntfs_inode *ni = NTFS_I(vi); 91 91 92 - vi->i_ino = na->mft_no; 92 + vi->i_ino = (unsigned long)na->mft_no; 93 93 94 94 if (na->type == AT_INDEX_ALLOCATION) 95 95 NInoSetMstProtected(ni); ··· 149 149 * Return the struct inode on success. Check the return value with IS_ERR() and 150 150 * if true, the function failed and the error code is obtained from PTR_ERR(). 151 151 */ 152 - struct inode *ntfs_iget(struct super_block *sb, unsigned long mft_no) 152 + struct inode *ntfs_iget(struct super_block *sb, u64 mft_no) 153 153 { 154 154 struct inode *vi; 155 155 int err; ··· 500 500 static struct lock_class_key extent_inode_mrec_lock_key; 501 501 502 502 inline struct ntfs_inode *ntfs_new_extent_inode(struct super_block *sb, 503 - unsigned long mft_no) 503 + u64 mft_no) 504 504 { 505 505 struct ntfs_inode *ni = ntfs_alloc_extent_inode(); 506 506 ··· 1451 1451 err_out: 1452 1452 if (err != -ENOENT) 1453 1453 ntfs_error(vol->sb, 1454 - "Failed with error code %i while reading attribute inode (mft_no 0x%lx, type 0x%x, name_len %i). Marking corrupt inode and base inode 0x%lx as bad. Run chkdsk.", 1455 - err, vi->i_ino, ni->type, ni->name_len, 1456 - base_vi->i_ino); 1454 + "Failed with error code %i while reading attribute inode (mft_no 0x%llx, type 0x%x, name_len %i). Marking corrupt inode and base inode 0x%llx as bad. Run chkdsk.", 1455 + err, ni->mft_no, ni->type, ni->name_len, 1456 + base_ni->mft_no); 1457 1457 if (err != -ENOENT && err != -ENOMEM) 1458 1458 NVolSetErrors(vol); 1459 1459 return err; ··· 1709 1709 unmap_mft_record(base_ni); 1710 1710 err_out: 1711 1711 ntfs_error(vi->i_sb, 1712 - "Failed with error code %i while reading index inode (mft_no 0x%lx, name_len %i.", 1713 - err, vi->i_ino, ni->name_len); 1712 + "Failed with error code %i while reading index inode (mft_no 0x%llx, name_len %i.", 1713 + err, ni->mft_no, ni->name_len); 1714 1714 if (err != -EOPNOTSUPP && err != -ENOMEM) 1715 1715 NVolSetErrors(vol); 1716 1716 return err; ··· 2244 2244 2245 2245 void ntfs_clear_extent_inode(struct ntfs_inode *ni) 2246 2246 { 2247 - ntfs_debug("Entering for inode 0x%lx.", ni->mft_no); 2247 + ntfs_debug("Entering for inode 0x%llx.", ni->mft_no); 2248 2248 2249 2249 WARN_ON(NInoAttr(ni)); 2250 2250 WARN_ON(ni->nr_extents != -1); ··· 2580 2580 int err = 0; 2581 2581 unsigned long flags; 2582 2582 2583 - ntfs_debug("Entering for inode %lld\n", (long long)ni->mft_no); 2583 + ntfs_debug("Entering for inode %llu\n", ni->mft_no); 2584 2584 2585 2585 ctx = ntfs_attr_get_search_ctx(ni, NULL); 2586 2586 if (!ctx) ··· 2623 2623 2624 2624 ictx = ntfs_index_ctx_get(index_ni, I30, 4); 2625 2625 if (!ictx) { 2626 - ntfs_error(sb, "Failed to get index ctx, inode %lld", 2627 - (long long)index_ni->mft_no); 2626 + ntfs_error(sb, "Failed to get index ctx, inode %llu", 2627 + index_ni->mft_no); 2628 2628 iput(index_vi); 2629 2629 mutex_unlock(&index_ni->mrec_lock); 2630 2630 continue; ··· 2632 2632 2633 2633 err = ntfs_index_lookup(fn, sizeof(struct file_name_attr), ictx); 2634 2634 if (err) { 2635 - ntfs_debug("Index lookup failed, inode %lld", 2636 - (long long)index_ni->mft_no); 2635 + ntfs_debug("Index lookup failed, inode %llu", 2636 + index_ni->mft_no); 2637 2637 ntfs_index_ctx_put(ictx); 2638 2638 iput(index_vi); 2639 2639 mutex_unlock(&index_ni->mrec_lock); ··· 2679 2679 } 2680 2680 /* Check for real error occurred. */ 2681 2681 if (err != -ENOENT) { 2682 - ntfs_error(sb, "Attribute lookup failed, err : %d, inode %lld", err, 2683 - (long long)ni->mft_no); 2682 + ntfs_error(sb, "Attribute lookup failed, err : %d, inode %llu", err, 2683 + ni->mft_no); 2684 2684 } else 2685 2685 err = 0; 2686 2686 ··· 2927 2927 return NULL; 2928 2928 2929 2929 sb = base_ni->vol->sb; 2930 - ntfs_debug("Opening extent inode %lld (base mft record %lld).\n", 2931 - (unsigned long long)mft_no, 2932 - (unsigned long long)base_ni->mft_no); 2930 + ntfs_debug("Opening extent inode %llu (base mft record %llu).\n", 2931 + mft_no, base_ni->mft_no); 2933 2932 2934 2933 /* Is the extent inode already open and attached to the base inode? */ 2935 2934 if (base_ni->nr_extents > 0) { ··· 2941 2942 continue; 2942 2943 ni_mrec = map_mft_record(ni); 2943 2944 if (IS_ERR(ni_mrec)) { 2944 - ntfs_error(sb, "failed to map mft record for %lu", 2945 + ntfs_error(sb, "failed to map mft record for %llu", 2945 2946 ni->mft_no); 2946 2947 goto out; 2947 2948 } ··· 2949 2950 seq_no = MSEQNO_LE(mref); 2950 2951 if (seq_no && 2951 2952 seq_no != le16_to_cpu(ni_mrec->sequence_number)) { 2952 - ntfs_error(sb, "Found stale extent mft reference mft=%lld", 2953 - (long long)ni->mft_no); 2953 + ntfs_error(sb, "Found stale extent mft reference mft=%llu", 2954 + ni->mft_no); 2954 2955 unmap_mft_record(ni); 2955 2956 goto out; 2956 2957 } ··· 3010 3011 if (NInoAttr(ni)) 3011 3012 ni = ni->ext.base_ntfs_ino; 3012 3013 3013 - ntfs_debug("Entering for inode 0x%llx.\n", (long long) ni->mft_no); 3014 + ntfs_debug("Entering for inode 0x%llx.\n", ni->mft_no); 3014 3015 3015 3016 /* Inode haven't got attribute list, thus nothing to attach. */ 3016 3017 if (!NInoAttrList(ni)) ··· 3056 3057 if (!ni) 3057 3058 return -EINVAL; 3058 3059 3059 - ntfs_debug("inode %llu\n", (unsigned long long) ni->mft_no); 3060 + ntfs_debug("inode %llu\n", ni->mft_no); 3060 3061 3061 3062 if (NInoAttrList(ni) || ni->nr_extents) { 3062 3063 ntfs_error(ni->vol->sb, "Inode already has attribute list"); ··· 3121 3122 3122 3123 /* Check for real error occurred. */ 3123 3124 if (err != -ENOENT) { 3124 - ntfs_error(ni->vol->sb, "%s: Attribute lookup failed, inode %lld", 3125 - __func__, (long long)ni->mft_no); 3125 + ntfs_error(ni->vol->sb, "%s: Attribute lookup failed, inode %llu", 3126 + __func__, ni->mft_no); 3126 3127 goto put_err_out; 3127 3128 } 3128 3129 ··· 3243 3244 if (!ni) 3244 3245 return 0; 3245 3246 3246 - ntfs_debug("Entering for inode %lld\n", (long long)ni->mft_no); 3247 + ntfs_debug("Entering for inode %llu\n", ni->mft_no); 3247 3248 3248 3249 /* Is this a base inode with mapped extent inodes? */ 3249 3250 /* ··· 3281 3282 } 3282 3283 3283 3284 if (NInoDirty(ni)) 3284 - ntfs_error(ni->vol->sb, "Releasing dirty inode %lld!\n", 3285 - (long long)ni->mft_no); 3285 + ntfs_error(ni->vol->sb, "Releasing dirty inode %llu!\n", 3286 + ni->mft_no); 3286 3287 if (NInoAttrList(ni) && ni->attr_list) 3287 3288 kvfree(ni->attr_list); 3288 3289 ntfs_destroy_ext_inode(ni); ··· 3300 3301 ntfs_attr_close(ni); 3301 3302 3302 3303 if (NInoDirty(ni)) 3303 - ntfs_error(ni->vol->sb, "Releasing dirty ext inode %lld!\n", 3304 - (long long)ni->mft_no); 3304 + ntfs_error(ni->vol->sb, "Releasing dirty ext inode %llu!\n", 3305 + ni->mft_no); 3305 3306 if (NInoAttrList(ni) && ni->attr_list) 3306 3307 kvfree(ni->attr_list); 3307 3308 kfree(ni->mrec); ··· 3365 3366 3366 3367 if (!ni || size < 0) 3367 3368 return -EINVAL; 3368 - ntfs_debug("Entering for inode %lld, size %d\n", 3369 - (unsigned long long)ni->mft_no, size); 3369 + ntfs_debug("Entering for inode %llu, size %d\n", ni->mft_no, size); 3370 3370 3371 3371 sb = ni->vol->sb; 3372 3372 ni_mrec = map_mft_record(ni);
+4 -5
fs/ntfs/inode.h
··· 100 100 rwlock_t size_lock; 101 101 unsigned long state; 102 102 __le32 flags; 103 - unsigned long mft_no; 103 + u64 mft_no; 104 104 u16 seq_no; 105 105 atomic_t count; 106 106 struct ntfs_volume *vol; ··· 292 292 * possible on all architectures. 293 293 */ 294 294 struct ntfs_attr { 295 - unsigned long mft_no; 295 + u64 mft_no; 296 296 __le16 *name; 297 297 u32 name_len; 298 298 __le32 type; ··· 300 300 }; 301 301 302 302 int ntfs_test_inode(struct inode *vi, void *data); 303 - struct inode *ntfs_iget(struct super_block *sb, unsigned long mft_no); 303 + struct inode *ntfs_iget(struct super_block *sb, u64 mft_no); 304 304 struct inode *ntfs_attr_iget(struct inode *base_vi, __le32 type, 305 305 __le16 *name, u32 name_len); 306 306 struct inode *ntfs_index_iget(struct inode *base_vi, __le16 *name, ··· 320 320 ni->mft_no = vi->i_ino; 321 321 } 322 322 323 - struct ntfs_inode *ntfs_new_extent_inode(struct super_block *sb, 324 - unsigned long mft_no); 323 + struct ntfs_inode *ntfs_new_extent_inode(struct super_block *sb, u64 mft_no); 325 324 void ntfs_clear_extent_inode(struct ntfs_inode *ni); 326 325 int ntfs_read_inode_mount(struct inode *vi); 327 326 int ntfs_show_options(struct seq_file *sf, struct dentry *root);
+1 -1
fs/ntfs/lcnalloc.c
··· 842 842 int err; 843 843 unsigned int memalloc_flags; 844 844 845 - ntfs_debug("Entering for i_ino 0x%lx, start_vcn 0x%llx, count 0x%llx.%s", 845 + ntfs_debug("Entering for i_ino 0x%llx, start_vcn 0x%llx, count 0x%llx.%s", 846 846 ni->mft_no, start_vcn, count, 847 847 is_rollback ? " (rollback)" : ""); 848 848 vol = ni->vol;
+39 -42
fs/ntfs/mft.c
··· 26 26 * Returns 0 if the checks are successful. If not, return -EIO. 27 27 */ 28 28 int ntfs_mft_record_check(const struct ntfs_volume *vol, struct mft_record *m, 29 - unsigned long mft_no) 29 + u64 mft_no) 30 30 { 31 31 struct attr_record *a; 32 32 struct super_block *sb = vol->sb; 33 33 34 34 if (!ntfs_is_file_record(m->magic)) { 35 35 ntfs_error(sb, "Record %llu has no FILE magic (0x%x)\n", 36 - (unsigned long long)mft_no, le32_to_cpu(*(__le32 *)m)); 36 + mft_no, le32_to_cpu(*(__le32 *)m)); 37 37 goto err_out; 38 38 } 39 39 ··· 41 41 (vol->mft_record_size >> NTFS_BLOCK_SIZE_BITS) + 1 != le16_to_cpu(m->usa_count) || 42 42 le16_to_cpu(m->usa_ofs) + le16_to_cpu(m->usa_count) * 2 > vol->mft_record_size) { 43 43 ntfs_error(sb, "Record %llu has corrupt fix-up values fields\n", 44 - (unsigned long long)mft_no); 44 + mft_no); 45 45 goto err_out; 46 46 } 47 47 48 48 if (le32_to_cpu(m->bytes_allocated) != vol->mft_record_size) { 49 49 ntfs_error(sb, "Record %llu has corrupt allocation size (%u <> %u)\n", 50 - (unsigned long long)mft_no, 51 - vol->mft_record_size, 50 + mft_no, vol->mft_record_size, 52 51 le32_to_cpu(m->bytes_allocated)); 53 52 goto err_out; 54 53 } 55 54 56 55 if (le32_to_cpu(m->bytes_in_use) > vol->mft_record_size) { 57 56 ntfs_error(sb, "Record %llu has corrupt in-use size (%u > %u)\n", 58 - (unsigned long long)mft_no, 59 - le32_to_cpu(m->bytes_in_use), 57 + mft_no, le32_to_cpu(m->bytes_in_use), 60 58 vol->mft_record_size); 61 59 goto err_out; 62 60 } 63 61 64 62 if (le16_to_cpu(m->attrs_offset) & 7) { 65 63 ntfs_error(sb, "Attributes badly aligned in record %llu\n", 66 - (unsigned long long)mft_no); 64 + mft_no); 67 65 goto err_out; 68 66 } 69 67 70 68 a = (struct attr_record *)((char *)m + le16_to_cpu(m->attrs_offset)); 71 69 if ((char *)a < (char *)m || (char *)a > (char *)m + vol->mft_record_size) { 72 - ntfs_error(sb, "Record %llu is corrupt\n", 73 - (unsigned long long)mft_no); 70 + ntfs_error(sb, "Record %llu is corrupt\n", mft_no); 74 71 goto err_out; 75 72 } 76 73 ··· 122 125 vol->mft_record_size) { 123 126 folio = ERR_PTR(-ENOENT); 124 127 ntfs_error(vol->sb, 125 - "Attempt to read mft record 0x%lx, which is beyond the end of the mft. This is probably a bug in the ntfs driver.", 128 + "Attempt to read mft record 0x%llx, which is beyond the end of the mft. This is probably a bug in the ntfs driver.", 126 129 ni->mft_no); 127 130 goto err_out; 128 131 } ··· 189 192 if (!ni) 190 193 return ERR_PTR(-EINVAL); 191 194 192 - ntfs_debug("Entering for mft_no 0x%lx.", ni->mft_no); 195 + ntfs_debug("Entering for mft_no 0x%llx.", ni->mft_no); 193 196 194 197 /* Make sure the ntfs inode doesn't go away. */ 195 198 atomic_inc(&ni->count); ··· 227 230 if (!ni) 228 231 return; 229 232 230 - ntfs_debug("Entering for mft_no 0x%lx.", ni->mft_no); 233 + ntfs_debug("Entering for mft_no 0x%llx.", ni->mft_no); 231 234 232 235 folio = ni->folio; 233 236 if (atomic_dec_return(&ni->count) > 1) ··· 255 258 struct ntfs_inode *ni = NULL; 256 259 struct ntfs_inode **extent_nis = NULL; 257 260 int i; 258 - unsigned long mft_no = MREF(mref); 261 + u64 mft_no = MREF(mref); 259 262 u16 seq_no = MSEQNO(mref); 260 263 bool destroy_ni = false; 261 264 262 - ntfs_debug("Mapping extent mft record 0x%lx (base mft record 0x%lx).", 265 + ntfs_debug("Mapping extent mft record 0x%llx (base mft record 0x%llx).", 263 266 mft_no, base_ni->mft_no); 264 267 /* Make sure the base ntfs inode doesn't go away. */ 265 268 atomic_inc(&base_ni->count); ··· 407 410 { 408 411 struct ntfs_inode *base_ni; 409 412 410 - ntfs_debug("Entering for inode 0x%lx.", ni->mft_no); 413 + ntfs_debug("Entering for inode 0x%llx.", ni->mft_no); 411 414 WARN_ON(NInoAttr(ni)); 412 415 /* Determine the base vfs inode and mark it dirty, too. */ 413 416 if (likely(ni->nr_extents >= 0)) ··· 446 449 * 447 450 * NOTE: We always perform synchronous i/o. 448 451 */ 449 - int ntfs_sync_mft_mirror(struct ntfs_volume *vol, const unsigned long mft_no, 452 + int ntfs_sync_mft_mirror(struct ntfs_volume *vol, const u64 mft_no, 450 453 struct mft_record *m) 451 454 { 452 455 u8 *kmirr = NULL; ··· 455 458 int err = 0; 456 459 struct bio *bio; 457 460 458 - ntfs_debug("Entering for inode 0x%lx.", mft_no); 461 + ntfs_debug("Entering for inode 0x%llx.", mft_no); 459 462 460 463 if (unlikely(!vol->mftmirr_ino)) { 461 464 /* This could happen during umount... */ ··· 508 511 if (likely(!err)) { 509 512 ntfs_debug("Done."); 510 513 } else { 511 - ntfs_error(vol->sb, "I/O error while writing mft mirror record 0x%lx!", mft_no); 514 + ntfs_error(vol->sb, "I/O error while writing mft mirror record 0x%llx!", mft_no); 512 515 err_out: 513 516 ntfs_error(vol->sb, 514 517 "Failed to synchronize $MFTMirr (error code %i). Volume will be left marked dirty on umount. Run chkdsk on the partition after umounting to correct this.", ··· 544 547 struct bio *bio; 545 548 unsigned int offset = 0, folio_size; 546 549 547 - ntfs_debug("Entering for inode 0x%lx.", ni->mft_no); 550 + ntfs_debug("Entering for inode 0x%llx.", ni->mft_no); 548 551 549 552 WARN_ON(NInoAttr(ni)); 550 553 WARN_ON(!folio_test_locked(folio)); ··· 606 609 if (unlikely(err)) { 607 610 /* I/O error during writing. This is really bad! */ 608 611 ntfs_error(vol->sb, 609 - "I/O error while writing mft record 0x%lx! Marking base inode as bad. You should unmount the volume and run chkdsk.", 612 + "I/O error while writing mft record 0x%llx! Marking base inode as bad. You should unmount the volume and run chkdsk.", 610 613 ni->mft_no); 611 614 goto err_out; 612 615 } ··· 731 734 * If we manage to obtain the lock we have exclusive access to the extent mft 732 735 * record. We set @locked_ni to the now locked ntfs inode and return 'true'. 733 736 */ 734 - bool ntfs_may_write_mft_record(struct ntfs_volume *vol, const unsigned long mft_no, 737 + static bool ntfs_may_write_mft_record(struct ntfs_volume *vol, const u64 mft_no, 735 738 const struct mft_record *m, struct ntfs_inode **locked_ni, 736 739 struct inode **ref_vi) 737 740 { ··· 742 745 int i; 743 746 struct ntfs_attr na = {0}; 744 747 745 - ntfs_debug("Entering for inode 0x%lx.", mft_no); 748 + ntfs_debug("Entering for inode 0x%llx.", mft_no); 746 749 /* 747 750 * Normally we do not return a locked inode so set @locked_ni to NULL. 748 751 */ ··· 753 756 * Check if the inode corresponding to this mft record is in the VFS 754 757 * inode cache and obtain a reference to it if it is. 755 758 */ 756 - ntfs_debug("Looking for inode 0x%lx in icache.", mft_no); 759 + ntfs_debug("Looking for inode 0x%llx in icache.", mft_no); 757 760 na.mft_no = mft_no; 758 761 na.type = AT_UNUSED; 759 762 /* ··· 775 778 return false; 776 779 } 777 780 if (vi) { 778 - ntfs_debug("Base inode 0x%lx is in icache.", mft_no); 781 + ntfs_debug("Base inode 0x%llx is in icache.", mft_no); 779 782 /* The inode is in icache. */ 780 783 ni = NTFS_I(vi); 781 784 /* Take a reference to the ntfs inode. */ 782 785 atomic_inc(&ni->count); 783 786 /* If the inode is dirty, do not write this record. */ 784 787 if (NInoDirty(ni)) { 785 - ntfs_debug("Inode 0x%lx is dirty, do not write it.", 788 + ntfs_debug("Inode 0x%llx is dirty, do not write it.", 786 789 mft_no); 787 790 atomic_dec(&ni->count); 788 791 *ref_vi = vi; 789 792 return false; 790 793 } 791 - ntfs_debug("Inode 0x%lx is not dirty.", mft_no); 794 + ntfs_debug("Inode 0x%llx is not dirty.", mft_no); 792 795 /* The inode is not dirty, try to take the mft record lock. */ 793 796 if (unlikely(!mutex_trylock(&ni->mrec_lock))) { 794 - ntfs_debug("Mft record 0x%lx is already locked, do not write it.", mft_no); 797 + ntfs_debug("Mft record 0x%llx is already locked, do not write it.", mft_no); 795 798 atomic_dec(&ni->count); 796 799 *ref_vi = vi; 797 800 return false; 798 801 } 799 - ntfs_debug("Managed to lock mft record 0x%lx, write it.", 802 + ntfs_debug("Managed to lock mft record 0x%llx, write it.", 800 803 mft_no); 801 804 /* 802 805 * The write has to occur while we hold the mft record lock so ··· 805 808 *locked_ni = ni; 806 809 return true; 807 810 } 808 - ntfs_debug("Inode 0x%lx is not in icache.", mft_no); 811 + ntfs_debug("Inode 0x%llx is not in icache.", mft_no); 809 812 /* The inode is not in icache. */ 810 813 /* Write the record if it is not a mft record (type "FILE"). */ 811 814 if (!ntfs_is_mft_record(m->magic)) { 812 - ntfs_debug("Mft record 0x%lx is not a FILE record, write it.", 815 + ntfs_debug("Mft record 0x%llx is not a FILE record, write it.", 813 816 mft_no); 814 817 return true; 815 818 } 816 819 /* Write the mft record if it is a base inode. */ 817 820 if (!m->base_mft_record) { 818 - ntfs_debug("Mft record 0x%lx is a base record, write it.", 821 + ntfs_debug("Mft record 0x%llx is a base record, write it.", 819 822 mft_no); 820 823 return true; 821 824 } ··· 826 829 */ 827 830 na.mft_no = MREF_LE(m->base_mft_record); 828 831 na.state = 0; 829 - ntfs_debug("Mft record 0x%lx is an extent record. Looking for base inode 0x%lx in icache.", 832 + ntfs_debug("Mft record 0x%llx is an extent record. Looking for base inode 0x%llx in icache.", 830 833 mft_no, na.mft_no); 831 834 if (!na.mft_no) { 832 835 /* Balance the below iput(). */ ··· 840 843 841 844 if (!vi) 842 845 return false; 843 - ntfs_debug("Base inode 0x%lx is in icache.", na.mft_no); 846 + ntfs_debug("Base inode 0x%llx is in icache.", na.mft_no); 844 847 /* 845 848 * The base inode is in icache. Check if it has the extent inode 846 849 * corresponding to this extent mft record attached. ··· 854 857 */ 855 858 mutex_unlock(&ni->extent_lock); 856 859 *ref_vi = vi; 857 - ntfs_debug("Base inode 0x%lx has no attached extent inodes, write the extent record.", 860 + ntfs_debug("Base inode 0x%llx has no attached extent inodes, write the extent record.", 858 861 na.mft_no); 859 862 return true; 860 863 } ··· 877 880 if (!eni) { 878 881 mutex_unlock(&ni->extent_lock); 879 882 *ref_vi = vi; 880 - ntfs_debug("Extent inode 0x%lx is not attached to its base inode 0x%lx, write the extent record.", 883 + ntfs_debug("Extent inode 0x%llx is not attached to its base inode 0x%llx, write the extent record.", 881 884 mft_no, na.mft_no); 882 885 return true; 883 886 } 884 - ntfs_debug("Extent inode 0x%lx is attached to its base inode 0x%lx.", 887 + ntfs_debug("Extent inode 0x%llx is attached to its base inode 0x%llx.", 885 888 mft_no, na.mft_no); 886 889 /* Take a reference to the extent ntfs inode. */ 887 890 atomic_inc(&eni->count); ··· 901 904 if (unlikely(!mutex_trylock(&eni->mrec_lock))) { 902 905 atomic_dec(&eni->count); 903 906 *ref_vi = vi; 904 - ntfs_debug("Extent mft record 0x%lx is already locked, do not write it.", 907 + ntfs_debug("Extent mft record 0x%llx is already locked, do not write it.", 905 908 mft_no); 906 909 return false; 907 910 } 908 - ntfs_debug("Managed to lock extent mft record 0x%lx, write it.", 911 + ntfs_debug("Managed to lock extent mft record 0x%llx, write it.", 909 912 mft_no); 910 913 /* 911 914 * The write has to occur while we hold the mft record lock so return ··· 938 941 * 939 942 * Locking: Caller must hold vol->mftbmp_lock for writing. 940 943 */ 941 - static int ntfs_mft_bitmap_find_and_alloc_free_rec_nolock(struct ntfs_volume *vol, 944 + static s64 ntfs_mft_bitmap_find_and_alloc_free_rec_nolock(struct ntfs_volume *vol, 942 945 struct ntfs_inode *base_ni) 943 946 { 944 947 s64 pass_end, ll, data_pos, pass_start, ofs, bit; ··· 2708 2711 sizeof(struct inode *), GFP_NOFS); 2709 2712 int nr_ref_inos = 0; 2710 2713 struct bio *bio = NULL; 2711 - unsigned long mft_no; 2714 + u64 mft_no; 2712 2715 struct ntfs_inode *tni; 2713 2716 s64 lcn; 2714 2717 s64 vcn = ntfs_pidx_to_cluster(vol, folio->index); ··· 2872 2875 else 2873 2876 base_tni = tni->ext.base_ntfs_ino; 2874 2877 mutex_unlock(&tni->extent_lock); 2875 - ntfs_debug("Unlocking %s inode 0x%lx.", 2878 + ntfs_debug("Unlocking %s inode 0x%llx.", 2876 2879 tni == base_tni ? "base" : "extent", 2877 2880 tni->mft_no); 2878 2881 atomic_dec(&tni->count);
+2 -5
fs/ntfs/mft.h
··· 42 42 __mark_mft_record_dirty(ni); 43 43 } 44 44 45 - int ntfs_sync_mft_mirror(struct ntfs_volume *vol, const unsigned long mft_no, 45 + int ntfs_sync_mft_mirror(struct ntfs_volume *vol, const u64 mft_no, 46 46 struct mft_record *m); 47 47 int write_mft_record_nolock(struct ntfs_inode *ni, struct mft_record *m, int sync); 48 48 ··· 76 76 return err; 77 77 } 78 78 79 - bool ntfs_may_write_mft_record(struct ntfs_volume *vol, 80 - const unsigned long mft_no, const struct mft_record *m, 81 - struct ntfs_inode **locked_ni, struct inode **ref_vi); 82 79 int ntfs_mft_record_alloc(struct ntfs_volume *vol, const int mode, 83 80 struct ntfs_inode **ni, struct ntfs_inode *base_ni, 84 81 struct mft_record **ni_mrec); ··· 83 86 int ntfs_mft_records_write(const struct ntfs_volume *vol, const u64 mref, 84 87 const s64 count, struct mft_record *b); 85 88 int ntfs_mft_record_check(const struct ntfs_volume *vol, struct mft_record *m, 86 - unsigned long mft_no); 89 + u64 mft_no); 87 90 int ntfs_mft_writepages(struct address_space *mapping, 88 91 struct writeback_control *wbc); 89 92 void ntfs_mft_mark_dirty(struct folio *folio);
+5 -5
fs/ntfs/namei.c
··· 508 508 spin_unlock(&vi->i_lock); 509 509 510 510 /* Add the inode to the inode hash for the superblock. */ 511 - vi->i_ino = ni->mft_no; 511 + vi->i_ino = (unsigned long)ni->mft_no; 512 512 inode_set_iversion(vi, 1); 513 513 insert_inode_hash(vi); 514 514 ··· 521 521 522 522 dni_mrec = map_mft_record(dir_ni); 523 523 if (IS_ERR(dni_mrec)) { 524 - ntfs_error(dir_ni->vol->sb, "failed to map mft record for file %ld.\n", 524 + ntfs_error(dir_ni->vol->sb, "failed to map mft record for file 0x%llx.\n", 525 525 dir_ni->mft_no); 526 526 err = -EIO; 527 527 goto err_out; ··· 810 810 static int ntfs_test_inode_attr(struct inode *vi, void *data) 811 811 { 812 812 struct ntfs_inode *ni = NTFS_I(vi); 813 - unsigned long mft_no = (unsigned long)data; 813 + u64 mft_no = (u64)data; 814 814 815 815 if (ni->mft_no != mft_no) 816 816 return 0; ··· 904 904 905 905 /* Ignore hard links from other directories */ 906 906 if (dir_ni->mft_no != MREF_LE(fn->parent_directory)) { 907 - ntfs_debug("MFT record numbers don't match (%lu != %lu)\n", 907 + ntfs_debug("MFT record numbers don't match (%llu != %lu)\n", 908 908 dir_ni->mft_no, 909 909 MREF_LE(fn->parent_directory)); 910 910 continue; ··· 1363 1363 if (err) { 1364 1364 int err2; 1365 1365 1366 - ntfs_error(sb, "Failed to delete old ntfs inode(%ld) in old dir, err : %d\n", 1366 + ntfs_error(sb, "Failed to delete old ntfs inode(%llu) in old dir, err : %d\n", 1367 1367 old_ni->mft_no, err); 1368 1368 err2 = ntfs_delete(old_ni, new_dir_ni, uname_new, new_name_len, false); 1369 1369 if (err2)