Skip to content

Commit 8015cf6

Browse files
namjaejeon1Naim
authored andcommitted
ntfs: use ->mft_no instead of ->i_ino in prints
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>
1 parent fd40282 commit 8015cf6

7 files changed

Lines changed: 40 additions & 41 deletions

File tree

fs/ntfs/attrib.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1908,8 +1908,8 @@ int ntfs_attr_make_non_resident(struct ntfs_inode *ni, const u32 data_size)
19081908
err2 = attr_size;
19091909
attr_size = arec_size - mp_ofs;
19101910
ntfs_error(vol->sb,
1911-
"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.",
1912-
vi->i_ino,
1911+
"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.",
1912+
ni->mft_no,
19131913
(unsigned int)le32_to_cpu(ni->type),
19141914
err2, attr_size, err2 - attr_size,
19151915
((ni->type == AT_DATA) &&

fs/ntfs/bitmap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ int __ntfs_bitmap_set_bits_in_run(struct inode *vi, const s64 start_bit,
130130
struct ntfs_inode *ni = NTFS_I(vi);
131131
struct ntfs_volume *vol = ni->vol;
132132

133-
ntfs_debug("Entering for i_ino 0x%lx, start_bit 0x%llx, count 0x%llx, value %u.%s",
134-
vi->i_ino, (unsigned long long)start_bit,
133+
ntfs_debug("Entering for i_ino 0x%llx, start_bit 0x%llx, count 0x%llx, value %u.%s",
134+
ni->mft_no, (unsigned long long)start_bit,
135135
(unsigned long long)cnt, (unsigned int)value,
136136
is_rollback ? " (rollback)" : "");
137137

fs/ntfs/dir.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -767,8 +767,8 @@ static int ntfs_readdir(struct file *file, struct dir_context *actor)
767767
struct rb_root ra_root = RB_ROOT;
768768
struct file_ra_state *ra;
769769

770-
ntfs_debug("Entering for inode 0x%lx, fpos 0x%llx.",
771-
vdir->i_ino, actor->pos);
770+
ntfs_debug("Entering for inode 0x%llx, fpos 0x%llx.",
771+
ndir->mft_no, actor->pos);
772772

773773
if (file->private_data) {
774774
private = file->private_data;
@@ -1148,7 +1148,7 @@ static int ntfs_dir_fsync(struct file *filp, loff_t start, loff_t end,
11481148
int err, ret;
11491149
struct ntfs_attr na;
11501150

1151-
ntfs_debug("Entering for inode 0x%lx.", vi->i_ino);
1151+
ntfs_debug("Entering for inode 0x%llx.", ni->mft_no);
11521152

11531153
if (NVolShutdown(vol))
11541154
return -EIO;
@@ -1215,8 +1215,8 @@ static int ntfs_dir_fsync(struct file *filp, loff_t start, loff_t end,
12151215
ntfs_debug("Done.");
12161216
else
12171217
ntfs_warning(vi->i_sb,
1218-
"Failed to f%ssync inode 0x%lx. Error %u.",
1219-
datasync ? "data" : "", vi->i_ino, -ret);
1218+
"Failed to f%ssync inode 0x%llx. Error %u.",
1219+
datasync ? "data" : "", ni->mft_no, -ret);
12201220
inode_unlock(vi);
12211221
return ret;
12221222
}

fs/ntfs/file.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ static int ntfs_file_fsync(struct file *filp, loff_t start, loff_t end,
163163
struct inode *parent_vi, *ia_vi;
164164
struct ntfs_attr_search_ctx *ctx;
165165

166-
ntfs_debug("Entering for inode 0x%lx.", vi->i_ino);
166+
ntfs_debug("Entering for inode 0x%llx.", ni->mft_no);
167167

168168
if (NVolShutdown(vol))
169169
return -EIO;
@@ -242,8 +242,8 @@ static int ntfs_file_fsync(struct file *filp, loff_t start, loff_t end,
242242
ntfs_debug("Done.");
243243
else
244244
ntfs_warning(vi->i_sb,
245-
"Failed to f%ssync inode 0x%lx. Error %u.",
246-
datasync ? "data" : "", vi->i_ino, -ret);
245+
"Failed to f%ssync inode 0x%llx. Error %u.",
246+
datasync ? "data" : "", ni->mft_no, -ret);
247247
if (!ret)
248248
blkdev_issue_flush(vi->i_sb->s_bdev);
249249
return ret;

fs/ntfs/inode.c

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ void ntfs_set_vfs_operations(struct inode *inode, mode_t mode, dev_t dev)
670670
static int ntfs_read_locked_inode(struct inode *vi)
671671
{
672672
struct ntfs_volume *vol = NTFS_SB(vi->i_sb);
673-
struct ntfs_inode *ni;
673+
struct ntfs_inode *ni = NTFS_I(vi);
674674
struct mft_record *m;
675675
struct attr_record *a;
676676
struct standard_information *si;
@@ -682,7 +682,7 @@ static int ntfs_read_locked_inode(struct inode *vi)
682682
dev_t dev = 0;
683683
bool vol_err = true;
684684

685-
ntfs_debug("Entering for i_ino 0x%lx.", vi->i_ino);
685+
ntfs_debug("Entering for i_ino 0x%llx.", ni->mft_no);
686686

687687
if (uid_valid(vol->uid)) {
688688
vi->i_uid = vol->uid;
@@ -704,7 +704,6 @@ static int ntfs_read_locked_inode(struct inode *vi)
704704
*/
705705
if (vi->i_ino != FILE_MFT)
706706
ntfs_init_big_inode(vi);
707-
ni = NTFS_I(vi);
708707

709708
m = map_mft_record(ni);
710709
if (IS_ERR(m)) {
@@ -804,7 +803,7 @@ static int ntfs_read_locked_inode(struct inode *vi)
804803
} else {
805804
if (vi->i_ino == FILE_MFT)
806805
goto skip_attr_list_load;
807-
ntfs_debug("Attribute list found in inode 0x%lx.", vi->i_ino);
806+
ntfs_debug("Attribute list found in inode 0x%llx.", ni->mft_no);
808807
NInoSetAttrList(ni);
809808
a = ctx->attr;
810809
if (a->flags & ATTR_COMPRESSION_MASK) {
@@ -820,8 +819,8 @@ static int ntfs_read_locked_inode(struct inode *vi)
820819
goto unm_err_out;
821820
}
822821
ntfs_warning(vi->i_sb,
823-
"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.",
824-
vi->i_ino);
822+
"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.",
823+
ni->mft_no);
825824
}
826825
/* Now allocate memory for the attribute list. */
827826
ni->attr_list_size = (u32)ntfs_attr_size(a);
@@ -1225,8 +1224,8 @@ static int ntfs_read_locked_inode(struct inode *vi)
12251224
err_out:
12261225
if (err != -EOPNOTSUPP && err != -ENOMEM && vol_err == true) {
12271226
ntfs_error(vol->sb,
1228-
"Failed with error code %i. Marking corrupt inode 0x%lx as bad. Run chkdsk.",
1229-
err, vi->i_ino);
1227+
"Failed with error code %i. Marking corrupt inode 0x%llx as bad. Run chkdsk.",
1228+
err, ni->mft_no);
12301229
NVolSetErrors(vol);
12311230
}
12321231
return err;
@@ -1262,7 +1261,7 @@ static int ntfs_read_locked_attr_inode(struct inode *base_vi, struct inode *vi)
12621261
struct ntfs_attr_search_ctx *ctx;
12631262
int err = 0;
12641263

1265-
ntfs_debug("Entering for i_ino 0x%lx.", vi->i_ino);
1264+
ntfs_debug("Entering for i_ino 0x%llx.", ni->mft_no);
12661265

12671266
ntfs_init_big_inode(vi);
12681267

@@ -1504,7 +1503,7 @@ static int ntfs_read_locked_index_inode(struct inode *base_vi, struct inode *vi)
15041503
u8 *ir_end, *index_end;
15051504
int err = 0;
15061505

1507-
ntfs_debug("Entering for i_ino 0x%lx.", vi->i_ino);
1506+
ntfs_debug("Entering for i_ino 0x%llx.", ni->mft_no);
15081507
lockdep_assert_held(&base_ni->mrec_lock);
15091508

15101509
ntfs_init_big_inode(vi);
@@ -2312,8 +2311,8 @@ void ntfs_evict_big_inode(struct inode *vi)
23122311
ntfs_commit_inode(vi);
23132312

23142313
if (NInoDirty(ni)) {
2315-
ntfs_debug("Failed to commit dirty inode 0x%lx. Losing data!",
2316-
vi->i_ino);
2314+
ntfs_debug("Failed to commit dirty inode 0x%llx. Losing data!",
2315+
ni->mft_no);
23172316
NInoClearAttrListDirty(ni);
23182317
NInoClearDirty(ni);
23192318
}
@@ -2500,8 +2499,8 @@ static int ntfs_inode_sync_standard_information(struct inode *vi, struct mft_rec
25002499
/* Update the creation times if they have changed. */
25012500
nt = utc2ntfs(ni->i_crtime);
25022501
if (si->creation_time != nt) {
2503-
ntfs_debug("Updating creation time for inode 0x%lx: old = 0x%llx, new = 0x%llx",
2504-
vi->i_ino, le64_to_cpu(si->creation_time),
2502+
ntfs_debug("Updating creation time for inode 0x%llx: old = 0x%llx, new = 0x%llx",
2503+
ni->mft_no, le64_to_cpu(si->creation_time),
25052504
le64_to_cpu(nt));
25062505
si->creation_time = nt;
25072506
modified = true;
@@ -2510,25 +2509,25 @@ static int ntfs_inode_sync_standard_information(struct inode *vi, struct mft_rec
25102509
/* Update the access times if they have changed. */
25112510
nt = utc2ntfs(inode_get_mtime(vi));
25122511
if (si->last_data_change_time != nt) {
2513-
ntfs_debug("Updating mtime for inode 0x%lx: old = 0x%llx, new = 0x%llx",
2514-
vi->i_ino, le64_to_cpu(si->last_data_change_time),
2512+
ntfs_debug("Updating mtime for inode 0x%llx: old = 0x%llx, new = 0x%llx",
2513+
ni->mft_no, le64_to_cpu(si->last_data_change_time),
25152514
le64_to_cpu(nt));
25162515
si->last_data_change_time = nt;
25172516
modified = true;
25182517
}
25192518

25202519
nt = utc2ntfs(inode_get_ctime(vi));
25212520
if (si->last_mft_change_time != nt) {
2522-
ntfs_debug("Updating ctime for inode 0x%lx: old = 0x%llx, new = 0x%llx",
2523-
vi->i_ino, le64_to_cpu(si->last_mft_change_time),
2521+
ntfs_debug("Updating ctime for inode 0x%llx: old = 0x%llx, new = 0x%llx",
2522+
ni->mft_no, le64_to_cpu(si->last_mft_change_time),
25242523
le64_to_cpu(nt));
25252524
si->last_mft_change_time = nt;
25262525
modified = true;
25272526
}
25282527
nt = utc2ntfs(inode_get_atime(vi));
25292528
if (si->last_access_time != nt) {
2530-
ntfs_debug("Updating atime for inode 0x%lx: old = 0x%llx, new = 0x%llx",
2531-
vi->i_ino,
2529+
ntfs_debug("Updating atime for inode 0x%llx: old = 0x%llx, new = 0x%llx",
2530+
ni->mft_no,
25322531
le64_to_cpu(si->last_access_time),
25332532
le64_to_cpu(nt));
25342533
si->last_access_time = nt;
@@ -2743,8 +2742,8 @@ int __ntfs_write_inode(struct inode *vi, int sync)
27432742
int err = 0;
27442743
bool need_iput = false;
27452744

2746-
ntfs_debug("Entering for %sinode 0x%lx.", NInoAttr(ni) ? "attr " : "",
2747-
vi->i_ino);
2745+
ntfs_debug("Entering for %sinode 0x%llx.", NInoAttr(ni) ? "attr " : "",
2746+
ni->mft_no);
27482747

27492748
if (NVolShutdown(ni->vol))
27502749
return -EIO;

fs/ntfs/mft.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2717,8 +2717,8 @@ static int ntfs_write_mft_block(struct folio *folio, struct writeback_control *w
27172717
struct runlist_element *rl;
27182718
loff_t i_size = i_size_read(vi);
27192719

2720-
ntfs_debug("Entering for inode 0x%lx, attribute type 0x%x, folio index 0x%lx.",
2721-
vi->i_ino, ni->type, folio->index);
2720+
ntfs_debug("Entering for inode 0x%llx, attribute type 0x%x, folio index 0x%lx.",
2721+
ni->mft_no, ni->type, folio->index);
27222722

27232723
if (!locked_nis || !ref_inos)
27242724
return -ENOMEM;

fs/ntfs/namei.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ static struct dentry *ntfs_lookup(struct inode *dir_ino, struct dentry *dent,
178178
unsigned long dent_ino;
179179
int uname_len;
180180

181-
ntfs_debug("Looking up %pd in directory inode 0x%lx.",
182-
dent, dir_ino->i_ino);
181+
ntfs_debug("Looking up %pd in directory inode 0x%llx.",
182+
dent, NTFS_I(dir_ino)->mft_no);
183183
/* Convert the name of the dentry to Unicode. */
184184
uname_len = ntfs_nlstoucs(vol, dent->d_name.name, dent->d_name.len,
185185
&uname, NTFS_MAX_NAME_LEN);
@@ -1611,7 +1611,7 @@ static struct dentry *ntfs_get_parent(struct dentry *child_dent)
16111611
unsigned long parent_ino;
16121612
int err;
16131613

1614-
ntfs_debug("Entering for inode 0x%lx.", vi->i_ino);
1614+
ntfs_debug("Entering for inode 0x%llx.", ni->mft_no);
16151615
/* Get the mft record of the inode belonging to the child dentry. */
16161616
mrec = map_mft_record(ni);
16171617
if (IS_ERR(mrec))
@@ -1630,8 +1630,8 @@ static struct dentry *ntfs_get_parent(struct dentry *child_dent)
16301630
unmap_mft_record(ni);
16311631
if (err == -ENOENT)
16321632
ntfs_error(vi->i_sb,
1633-
"Inode 0x%lx does not have a file name attribute. Run chkdsk.",
1634-
vi->i_ino);
1633+
"Inode 0x%llx does not have a file name attribute. Run chkdsk.",
1634+
ni->mft_no);
16351635
return ERR_PTR(err);
16361636
}
16371637
attr = ctx->attr;

0 commit comments

Comments
 (0)