]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ntfs: use ->mft_no instead of ->i_ino in prints
authorNamjae Jeon <linkinjeon@kernel.org>
Thu, 5 Mar 2026 01:46:42 +0000 (10:46 +0900)
committerNamjae Jeon <linkinjeon@kernel.org>
Fri, 6 Mar 2026 13:08:42 +0000 (22:08 +0900)
This improves log accuracy for NTFS debugging and removes unnecessary
reliance on the VFS i_ino field ahead of the core VFS type change.

Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
fs/ntfs/attrib.c
fs/ntfs/bitmap.c
fs/ntfs/dir.c
fs/ntfs/file.c
fs/ntfs/inode.c
fs/ntfs/mft.c
fs/ntfs/namei.c

index d86d96051c70135243c71c69951384874a5fc082..48759f6a78c4166eb044f952b8144f9d36ad005f 100644 (file)
@@ -1908,8 +1908,8 @@ undo_err_out:
                        err2 = attr_size;
                        attr_size = arec_size - mp_ofs;
                        ntfs_error(vol->sb,
-                               "Failed to undo partial resident to non-resident attribute conversion.  Truncating inode 0x%lx, attribute type 0x%x from %i bytes to %i bytes to maintain metadata consistency.  THIS MEANS YOU ARE LOSING %i BYTES DATA FROM THIS %s.",
-                                       vi->i_ino,
+                               "Failed to undo partial resident to non-resident attribute conversion.  Truncating inode 0x%llx, attribute type 0x%x from %i bytes to %i bytes to maintain metadata consistency.  THIS MEANS YOU ARE LOSING %i BYTES DATA FROM THIS %s.",
+                                       ni->mft_no,
                                        (unsigned int)le32_to_cpu(ni->type),
                                        err2, attr_size, err2 - attr_size,
                                        ((ni->type == AT_DATA) &&
index ed7770853fa8b9069945f855b8649584a6efca92..656d802333e35745bbf1d5985af4a530ac2621c3 100644 (file)
@@ -130,8 +130,8 @@ int __ntfs_bitmap_set_bits_in_run(struct inode *vi, const s64 start_bit,
        struct ntfs_inode *ni = NTFS_I(vi);
        struct ntfs_volume *vol = ni->vol;
 
-       ntfs_debug("Entering for i_ino 0x%lx, start_bit 0x%llx, count 0x%llx, value %u.%s",
-                       vi->i_ino, (unsigned long long)start_bit,
+       ntfs_debug("Entering for i_ino 0x%llx, start_bit 0x%llx, count 0x%llx, value %u.%s",
+                       ni->mft_no, (unsigned long long)start_bit,
                        (unsigned long long)cnt, (unsigned int)value,
                        is_rollback ? " (rollback)" : "");
 
index 30ac696c4ba7b385695ffc0ef0c899072ee538f6..8d417b4a0e80a104425f86823ff6a3699f2ed81b 100644 (file)
@@ -767,8 +767,8 @@ static int ntfs_readdir(struct file *file, struct dir_context *actor)
        struct rb_root ra_root = RB_ROOT;
        struct file_ra_state *ra;
 
-       ntfs_debug("Entering for inode 0x%lx, fpos 0x%llx.",
-                       vdir->i_ino, actor->pos);
+       ntfs_debug("Entering for inode 0x%llx, fpos 0x%llx.",
+                       ndir->mft_no, actor->pos);
 
        if (file->private_data) {
                private = file->private_data;
@@ -1148,7 +1148,7 @@ static int ntfs_dir_fsync(struct file *filp, loff_t start, loff_t end,
        int err, ret;
        struct ntfs_attr na;
 
-       ntfs_debug("Entering for inode 0x%lx.", vi->i_ino);
+       ntfs_debug("Entering for inode 0x%llx.", ni->mft_no);
 
        if (NVolShutdown(vol))
                return -EIO;
@@ -1215,8 +1215,8 @@ static int ntfs_dir_fsync(struct file *filp, loff_t start, loff_t end,
                ntfs_debug("Done.");
        else
                ntfs_warning(vi->i_sb,
-                       "Failed to f%ssync inode 0x%lx.  Error %u.",
-                       datasync ? "data" : "", vi->i_ino, -ret);
+                       "Failed to f%ssync inode 0x%llx.  Error %u.",
+                       datasync ? "data" : "", ni->mft_no, -ret);
        inode_unlock(vi);
        return ret;
 }
index 7f595c875f88bccd307312dd8d3720d73f96511a..27357801599999461a2a62d7689f174e1010a58a 100644 (file)
@@ -163,7 +163,7 @@ static int ntfs_file_fsync(struct file *filp, loff_t start, loff_t end,
        struct inode *parent_vi, *ia_vi;
        struct ntfs_attr_search_ctx *ctx;
 
-       ntfs_debug("Entering for inode 0x%lx.", vi->i_ino);
+       ntfs_debug("Entering for inode 0x%llx.", ni->mft_no);
 
        if (NVolShutdown(vol))
                return -EIO;
@@ -242,8 +242,8 @@ static int ntfs_file_fsync(struct file *filp, loff_t start, loff_t end,
                ntfs_debug("Done.");
        else
                ntfs_warning(vi->i_sb,
-                               "Failed to f%ssync inode 0x%lx.  Error %u.",
-                               datasync ? "data" : "", vi->i_ino, -ret);
+                               "Failed to f%ssync inode 0x%llx.  Error %u.",
+                               datasync ? "data" : "", ni->mft_no, -ret);
        if (!ret)
                blkdev_issue_flush(vi->i_sb->s_bdev);
        return ret;
index cfa95998d3cd13c5588408231813ce933008ac9f..43d7ecc14c150e19961c244f7f6612a0990efef6 100644 (file)
@@ -670,7 +670,7 @@ void ntfs_set_vfs_operations(struct inode *inode, mode_t mode, dev_t dev)
 static int ntfs_read_locked_inode(struct inode *vi)
 {
        struct ntfs_volume *vol = NTFS_SB(vi->i_sb);
-       struct ntfs_inode *ni;
+       struct ntfs_inode *ni = NTFS_I(vi);
        struct mft_record *m;
        struct attr_record *a;
        struct standard_information *si;
@@ -682,7 +682,7 @@ static int ntfs_read_locked_inode(struct inode *vi)
        dev_t dev = 0;
        bool vol_err = true;
 
-       ntfs_debug("Entering for i_ino 0x%lx.", vi->i_ino);
+       ntfs_debug("Entering for i_ino 0x%llx.", ni->mft_no);
 
        if (uid_valid(vol->uid)) {
                vi->i_uid = vol->uid;
@@ -704,7 +704,6 @@ static int ntfs_read_locked_inode(struct inode *vi)
         */
        if (vi->i_ino != FILE_MFT)
                ntfs_init_big_inode(vi);
-       ni = NTFS_I(vi);
 
        m = map_mft_record(ni);
        if (IS_ERR(m)) {
@@ -804,7 +803,7 @@ static int ntfs_read_locked_inode(struct inode *vi)
        } else {
                if (vi->i_ino == FILE_MFT)
                        goto skip_attr_list_load;
-               ntfs_debug("Attribute list found in inode 0x%lx.", vi->i_ino);
+               ntfs_debug("Attribute list found in inode 0x%llx.", ni->mft_no);
                NInoSetAttrList(ni);
                a = ctx->attr;
                if (a->flags & ATTR_COMPRESSION_MASK) {
@@ -820,8 +819,8 @@ static int ntfs_read_locked_inode(struct inode *vi)
                                goto unm_err_out;
                        }
                        ntfs_warning(vi->i_sb,
-                               "Resident attribute list attribute in inode 0x%lx is marked encrypted/sparse which is not true.  However, Windows allows this and chkdsk does not detect or correct it so we will just ignore the invalid flags and pretend they are not set.",
-                               vi->i_ino);
+                               "Resident attribute list attribute in inode 0x%llx is marked encrypted/sparse which is not true.  However, Windows allows this and chkdsk does not detect or correct it so we will just ignore the invalid flags and pretend they are not set.",
+                               ni->mft_no);
                }
                /* Now allocate memory for the attribute list. */
                ni->attr_list_size = (u32)ntfs_attr_size(a);
@@ -1225,8 +1224,8 @@ unm_err_out:
 err_out:
        if (err != -EOPNOTSUPP && err != -ENOMEM && vol_err == true) {
                ntfs_error(vol->sb,
-                       "Failed with error code %i.  Marking corrupt inode 0x%lx as bad.  Run chkdsk.",
-                       err, vi->i_ino);
+                       "Failed with error code %i.  Marking corrupt inode 0x%llx as bad.  Run chkdsk.",
+                       err, ni->mft_no);
                NVolSetErrors(vol);
        }
        return err;
@@ -1262,7 +1261,7 @@ static int ntfs_read_locked_attr_inode(struct inode *base_vi, struct inode *vi)
        struct ntfs_attr_search_ctx *ctx;
        int err = 0;
 
-       ntfs_debug("Entering for i_ino 0x%lx.", vi->i_ino);
+       ntfs_debug("Entering for i_ino 0x%llx.", ni->mft_no);
 
        ntfs_init_big_inode(vi);
 
@@ -1504,7 +1503,7 @@ static int ntfs_read_locked_index_inode(struct inode *base_vi, struct inode *vi)
        u8 *ir_end, *index_end;
        int err = 0;
 
-       ntfs_debug("Entering for i_ino 0x%lx.", vi->i_ino);
+       ntfs_debug("Entering for i_ino 0x%llx.", ni->mft_no);
        lockdep_assert_held(&base_ni->mrec_lock);
 
        ntfs_init_big_inode(vi);
@@ -2312,8 +2311,8 @@ void ntfs_evict_big_inode(struct inode *vi)
                ntfs_commit_inode(vi);
 
                if (NInoDirty(ni)) {
-                       ntfs_debug("Failed to commit dirty inode 0x%lx.  Losing data!",
-                                  vi->i_ino);
+                       ntfs_debug("Failed to commit dirty inode 0x%llx.  Losing data!",
+                                  ni->mft_no);
                        NInoClearAttrListDirty(ni);
                        NInoClearDirty(ni);
                }
@@ -2500,8 +2499,8 @@ static int ntfs_inode_sync_standard_information(struct inode *vi, struct mft_rec
        /* Update the creation times if they have changed. */
        nt = utc2ntfs(ni->i_crtime);
        if (si->creation_time != nt) {
-               ntfs_debug("Updating creation time for inode 0x%lx: old = 0x%llx, new = 0x%llx",
-                               vi->i_ino, le64_to_cpu(si->creation_time),
+               ntfs_debug("Updating creation time for inode 0x%llx: old = 0x%llx, new = 0x%llx",
+                               ni->mft_no, le64_to_cpu(si->creation_time),
                                le64_to_cpu(nt));
                si->creation_time = nt;
                modified = true;
@@ -2510,8 +2509,8 @@ static int ntfs_inode_sync_standard_information(struct inode *vi, struct mft_rec
        /* Update the access times if they have changed. */
        nt = utc2ntfs(inode_get_mtime(vi));
        if (si->last_data_change_time != nt) {
-               ntfs_debug("Updating mtime for inode 0x%lx: old = 0x%llx, new = 0x%llx",
-                               vi->i_ino, le64_to_cpu(si->last_data_change_time),
+               ntfs_debug("Updating mtime for inode 0x%llx: old = 0x%llx, new = 0x%llx",
+                               ni->mft_no, le64_to_cpu(si->last_data_change_time),
                                le64_to_cpu(nt));
                si->last_data_change_time = nt;
                modified = true;
@@ -2519,16 +2518,16 @@ static int ntfs_inode_sync_standard_information(struct inode *vi, struct mft_rec
 
        nt = utc2ntfs(inode_get_ctime(vi));
        if (si->last_mft_change_time != nt) {
-               ntfs_debug("Updating ctime for inode 0x%lx: old = 0x%llx, new = 0x%llx",
-                               vi->i_ino, le64_to_cpu(si->last_mft_change_time),
+               ntfs_debug("Updating ctime for inode 0x%llx: old = 0x%llx, new = 0x%llx",
+                               ni->mft_no, le64_to_cpu(si->last_mft_change_time),
                                le64_to_cpu(nt));
                si->last_mft_change_time = nt;
                modified = true;
        }
        nt = utc2ntfs(inode_get_atime(vi));
        if (si->last_access_time != nt) {
-               ntfs_debug("Updating atime for inode 0x%lx: old = 0x%llx, new = 0x%llx",
-                               vi->i_ino,
+               ntfs_debug("Updating atime for inode 0x%llx: old = 0x%llx, new = 0x%llx",
+                               ni->mft_no,
                                le64_to_cpu(si->last_access_time),
                                le64_to_cpu(nt));
                si->last_access_time = nt;
@@ -2743,8 +2742,8 @@ int __ntfs_write_inode(struct inode *vi, int sync)
        int err = 0;
        bool need_iput = false;
 
-       ntfs_debug("Entering for %sinode 0x%lx.", NInoAttr(ni) ? "attr " : "",
-                       vi->i_ino);
+       ntfs_debug("Entering for %sinode 0x%llx.", NInoAttr(ni) ? "attr " : "",
+                       ni->mft_no);
 
        if (NVolShutdown(ni->vol))
                return -EIO;
index 2665857af01e9d549c5f002bb12acef8d48cd028..48e64eaa7ec33f734ed1bd5a89590a1d75140176 100644 (file)
@@ -2717,8 +2717,8 @@ static int ntfs_write_mft_block(struct folio *folio, struct writeback_control *w
        struct runlist_element *rl;
        loff_t i_size = i_size_read(vi);
 
-       ntfs_debug("Entering for inode 0x%lx, attribute type 0x%x, folio index 0x%lx.",
-                       vi->i_ino, ni->type, folio->index);
+       ntfs_debug("Entering for inode 0x%llx, attribute type 0x%x, folio index 0x%lx.",
+                       ni->mft_no, ni->type, folio->index);
 
        if (!locked_nis || !ref_inos)
                return -ENOMEM;
index 331b66fe6b7da687b330a8a89efaae2f2e8fb42f..62c3f5733dbef523cdec86f5aa630d9511a06cf5 100644 (file)
@@ -178,8 +178,8 @@ static struct dentry *ntfs_lookup(struct inode *dir_ino, struct dentry *dent,
        unsigned long dent_ino;
        int uname_len;
 
-       ntfs_debug("Looking up %pd in directory inode 0x%lx.",
-                       dent, dir_ino->i_ino);
+       ntfs_debug("Looking up %pd in directory inode 0x%llx.",
+                       dent, NTFS_I(dir_ino)->mft_no);
        /* Convert the name of the dentry to Unicode. */
        uname_len = ntfs_nlstoucs(vol, dent->d_name.name, dent->d_name.len,
                                  &uname, NTFS_MAX_NAME_LEN);
@@ -1611,7 +1611,7 @@ static struct dentry *ntfs_get_parent(struct dentry *child_dent)
        unsigned long parent_ino;
        int err;
 
-       ntfs_debug("Entering for inode 0x%lx.", vi->i_ino);
+       ntfs_debug("Entering for inode 0x%llx.", ni->mft_no);
        /* Get the mft record of the inode belonging to the child dentry. */
        mrec = map_mft_record(ni);
        if (IS_ERR(mrec))
@@ -1630,8 +1630,8 @@ try_next:
                unmap_mft_record(ni);
                if (err == -ENOENT)
                        ntfs_error(vi->i_sb,
-                                  "Inode 0x%lx does not have a file name attribute.  Run chkdsk.",
-                                  vi->i_ino);
+                                  "Inode 0x%llx does not have a file name attribute.  Run chkdsk.",
+                                  ni->mft_no);
                return ERR_PTR(err);
        }
        attr = ctx->attr;