unsigned int delta;
unsigned char blocksize_bits;
- ntfs_debug("Entering for mft_no 0x%lx, logical block 0x%llx.",
+ ntfs_debug("Entering for mft_no 0x%llx, logical block 0x%llx.",
ni->mft_no, (unsigned long long)block);
if (ni->type != AT_DATA || !NInoNonResident(ni) || NInoEncrypted(ni) ||
NInoMstProtected(ni)) {
goto hole;
case LCN_ENOMEM:
ntfs_error(vol->sb,
- "Not enough memory to complete mapping for inode 0x%lx. Returning 0.",
+ "Not enough memory to complete mapping for inode 0x%llx. Returning 0.",
ni->mft_no);
break;
default:
ntfs_error(vol->sb,
- "Failed to complete mapping for inode 0x%lx. Run chkdsk. Returning 0.",
+ "Failed to complete mapping for inode 0x%llx. Run chkdsk. Returning 0.",
ni->mft_no);
break;
}
unsigned long flags;
bool is_retry = false;
- ntfs_debug("Entering for i_ino 0x%lx, vcn 0x%llx, %s_locked.",
+ ntfs_debug("Entering for i_ino 0x%llx, vcn 0x%llx, %s_locked.",
ni->mft_no, (unsigned long long)vcn,
write_locked ? "write" : "read");
if (!ni->runlist.rl) {
int err = 0;
bool is_retry = false;
- ntfs_debug("Entering for i_ino 0x%lx, vcn 0x%llx, with%s ctx.",
+ ntfs_debug("Entering for i_ino 0x%llx, vcn 0x%llx, with%s ctx.",
ni->mft_no, (unsigned long long)vcn, ctx ? "" : "out");
if (!ni->runlist.rl) {
read_lock_irqsave(&ni->size_lock, flags);
if (a->name_length && ((le16_to_cpu(a->name_offset) +
a->name_length * sizeof(__le16)) >
le32_to_cpu(a->length))) {
- ntfs_error(vol->sb, "Corrupt attribute name in MFT record %lld\n",
- (long long)ctx->ntfs_ino->mft_no);
+ ntfs_error(vol->sb, "Corrupt attribute name in MFT record %llu\n",
+ ctx->ntfs_ino->mft_no);
break;
}
attr_vi = ntfs_attr_iget(VFS_I(base_ni), AT_ATTRIBUTE_LIST, AT_UNNAMED, 0);
if (IS_ERR(attr_vi)) {
ntfs_error(base_ni->vol->sb,
- "Failed to open an inode for Attribute list, mft = %ld",
+ "Failed to open an inode for Attribute list, mft = %llu",
base_ni->mft_no);
return PTR_ERR(attr_vi);
}
if (ntfs_inode_attr_pread(attr_vi, 0, size, al_start) != size) {
iput(attr_vi);
ntfs_error(base_ni->vol->sb,
- "Failed to read attribute list, mft = %ld",
+ "Failed to read attribute list, mft = %llu",
base_ni->mft_no);
return -EIO;
}
break;
}
if (al != al_start + size) {
- ntfs_error(base_ni->vol->sb, "Corrupt attribute list, mft = %ld",
+ ntfs_error(base_ni->vol->sb, "Corrupt attribute list, mft = %llu",
base_ni->mft_no);
return -EIO;
}
int err = 0;
static const char *es = " Unmount and run chkdsk.";
- ntfs_debug("Entering for inode 0x%lx, type 0x%x.", ni->mft_no, type);
+ ntfs_debug("Entering for inode 0x%llx, type 0x%x.", ni->mft_no, type);
if (!base_ni) {
/* First call happens with the base mft record. */
base_ni = ctx->base_ntfs_ino = ctx->ntfs_ino;
if (MREF_LE(al_entry->mft_reference) == ni->mft_no) {
if (MSEQNO_LE(al_entry->mft_reference) != ni->seq_no) {
ntfs_error(vol->sb,
- "Found stale mft reference in attribute list of base inode 0x%lx.%s",
+ "Found stale mft reference in attribute list of base inode 0x%llx.%s",
base_ni->mft_no, es);
err = -EIO;
break;
al_entry->mft_reference), &ni);
if (IS_ERR(ctx->mrec)) {
ntfs_error(vol->sb,
- "Failed to map extent mft record 0x%lx of base inode 0x%lx.%s",
+ "Failed to map extent mft record 0x%lx of base inode 0x%llx.%s",
MREF_LE(al_entry->mft_reference),
base_ni->mft_no, es);
err = PTR_ERR(ctx->mrec);
if (!err) {
ntfs_error(vol->sb,
- "Base inode 0x%lx contains corrupt attribute list attribute.%s",
+ "Base inode 0x%llx contains corrupt attribute list attribute.%s",
base_ni->mft_no, es);
err = -EIO;
}
* delete extent) and continue search.
*/
if (finished_build) {
- ntfs_debug("Mark attr 0x%x for delete in inode 0x%lx.\n",
+ ntfs_debug("Mark attr 0x%x for delete in inode 0x%llx.\n",
(unsigned int)le32_to_cpu(a->type), ctx->ntfs_ino->mft_no);
a->data.non_resident.highest_vcn = cpu_to_le64(NTFS_VCN_DELETE_MARK);
mark_mft_record_dirty(ctx->ntfs_ino);
CASE_SENSITIVE, vcn, NULL, 0, ctx);
if (err) {
ntfs_error(vol->sb,
- "ntfs_attr_lookup failed, ntfs inode(mft_no : %ld) type : 0x%x, err : %d",
+ "ntfs_attr_lookup failed, ntfs inode(mft_no : %llu) type : 0x%x, err : %d",
ni->mft_no, ni->type, err);
goto out;
}
*/
if (err) {
ntfs_error(vol->sb,
- "ntfs_decompress() failed in inode 0x%lx with error code %i. Skipping this compression block.",
+ "ntfs_decompress() failed in inode 0x%llx with error code %i. Skipping this compression block.",
ni->mft_no, -err);
/* Release the unfinished pages. */
for (; prev_cur_page < cur_page; prev_cur_page++) {
page = pages[cur_page];
if (page) {
ntfs_error(vol->sb,
- "Still have pages left! Terminating them with extreme prejudice. Inode 0x%lx, page index 0x%lx.",
+ "Still have pages left! Terminating them with extreme prejudice. Inode 0x%llx, page index 0x%lx.",
ni->mft_no, page->__folio_index);
flush_dcache_page(page);
kunmap_local(page_address(page));
if (unlikely(err)) {
if (err == -ENOENT) {
ntfs_error(sb,
- "Index root attribute missing in directory inode 0x%lx.",
+ "Index root attribute missing in directory inode 0x%llx.",
dir_ni->mft_no);
err = -EIO;
}
/* Bounds checks. */
if ((u8 *)ia < kaddr || (u8 *)ia > kaddr + PAGE_SIZE) {
ntfs_error(sb,
- "Out of bounds check failed. Corrupt directory inode 0x%lx or driver bug.",
+ "Out of bounds check failed. Corrupt directory inode 0x%llx or driver bug.",
dir_ni->mft_no);
goto unm_err_out;
}
/* Catch multi sector transfer fixup errors. */
if (unlikely(!ntfs_is_indx_record(ia->magic))) {
ntfs_error(sb,
- "Directory index record with vcn 0x%llx is corrupt. Corrupt inode 0x%lx. Run chkdsk.",
- (unsigned long long)vcn, dir_ni->mft_no);
+ "Directory index record with vcn 0x%llx is corrupt. Corrupt inode 0x%llx. Run chkdsk.",
+ vcn, dir_ni->mft_no);
goto unm_err_out;
}
if (le64_to_cpu(ia->index_block_vcn) != vcn) {
ntfs_error(sb,
- "Actual VCN (0x%llx) of index buffer is different from expected VCN (0x%llx). Directory inode 0x%lx is corrupt or driver bug.",
- (unsigned long long)le64_to_cpu(ia->index_block_vcn),
- (unsigned long long)vcn, dir_ni->mft_no);
+ "Actual VCN (0x%llx) of index buffer is different from expected VCN (0x%llx). Directory inode 0x%llx is corrupt or driver bug.",
+ le64_to_cpu(ia->index_block_vcn),
+ vcn, dir_ni->mft_no);
goto unm_err_out;
}
if (le32_to_cpu(ia->index.allocated_size) + 0x18 !=
dir_ni->itype.index.block_size) {
ntfs_error(sb,
- "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.",
- (unsigned long long)vcn, dir_ni->mft_no,
+ "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.",
+ vcn, dir_ni->mft_no,
le32_to_cpu(ia->index.allocated_size) + 0x18,
dir_ni->itype.index.block_size);
goto unm_err_out;
index_end = (u8 *)ia + dir_ni->itype.index.block_size;
if (index_end > kaddr + PAGE_SIZE) {
ntfs_error(sb,
- "Index buffer (VCN 0x%llx) of directory inode 0x%lx crosses page boundary. Impossible! Cannot access! This is probably a bug in the driver.",
- (unsigned long long)vcn, dir_ni->mft_no);
+ "Index buffer (VCN 0x%llx) of directory inode 0x%llx crosses page boundary. Impossible! Cannot access! This is probably a bug in the driver.",
+ vcn, dir_ni->mft_no);
goto unm_err_out;
}
index_end = (u8 *)&ia->index + le32_to_cpu(ia->index.index_length);
if (index_end > (u8 *)ia + dir_ni->itype.index.block_size) {
ntfs_error(sb,
- "Size of index buffer (VCN 0x%llx) of directory inode 0x%lx exceeds maximum size.",
- (unsigned long long)vcn, dir_ni->mft_no);
+ "Size of index buffer (VCN 0x%llx) of directory inode 0x%llx exceeds maximum size.",
+ vcn, dir_ni->mft_no);
goto unm_err_out;
}
/* The first index entry. */
(u8 *)ie + sizeof(struct index_entry_header) > index_end ||
(u8 *)ie + sizeof(struct index_entry_header) + le16_to_cpu(ie->key_length) >
index_end || (u8 *)ie + le16_to_cpu(ie->length) > index_end) {
- ntfs_error(sb, "Index entry out of bounds in directory inode 0x%lx.",
+ ntfs_error(sb, "Index entry out of bounds in directory inode 0x%llx.",
dir_ni->mft_no);
goto unm_err_out;
}
if (ie->flags & INDEX_ENTRY_NODE) {
if ((ia->index.flags & NODE_MASK) == LEAF_NODE) {
ntfs_error(sb,
- "Index entry with child node found in a leaf node in directory inode 0x%lx.",
+ "Index entry with child node found in a leaf node in directory inode 0x%llx.",
dir_ni->mft_no);
goto unm_err_out;
}
kaddr = NULL;
goto descend_into_child_node;
}
- ntfs_error(sb, "Negative child node vcn in directory inode 0x%lx.",
+ ntfs_error(sb, "Negative child node vcn in directory inode 0x%llx.",
dir_ni->mft_no);
goto unm_err_out;
}
/* Find the index root attribute in the mft record. */
if (ntfs_attr_lookup(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, 0, NULL, 0,
ctx)) {
- ntfs_error(sb, "Index root attribute missing in directory inode %ld",
+ ntfs_error(sb, "Index root attribute missing in directory inode %llu",
ndir->mft_no);
ntfs_attr_put_search_ctx(ctx);
err = -ENOMEM;
ret = ntfs_attr_lookup(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, 0, NULL,
0, ctx);
if (ret) {
- ntfs_error(ni->vol->sb, "Index root attribute missing in directory inode %lld",
- (unsigned long long)ni->mft_no);
+ ntfs_error(ni->vol->sb, "Index root attribute missing in directory inode %llu",
+ ni->mft_no);
ntfs_attr_put_search_ctx(ctx);
return ret;
}
struct ntfs_attr *na = data;
struct ntfs_inode *ni = NTFS_I(vi);
- vi->i_ino = na->mft_no;
+ vi->i_ino = (unsigned long)na->mft_no;
if (na->type == AT_INDEX_ALLOCATION)
NInoSetMstProtected(ni);
* Return the struct inode on success. Check the return value with IS_ERR() and
* if true, the function failed and the error code is obtained from PTR_ERR().
*/
-struct inode *ntfs_iget(struct super_block *sb, unsigned long mft_no)
+struct inode *ntfs_iget(struct super_block *sb, u64 mft_no)
{
struct inode *vi;
int err;
static struct lock_class_key extent_inode_mrec_lock_key;
inline struct ntfs_inode *ntfs_new_extent_inode(struct super_block *sb,
- unsigned long mft_no)
+ u64 mft_no)
{
struct ntfs_inode *ni = ntfs_alloc_extent_inode();
err_out:
if (err != -ENOENT)
ntfs_error(vol->sb,
- "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.",
- err, vi->i_ino, ni->type, ni->name_len,
- base_vi->i_ino);
+ "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.",
+ err, ni->mft_no, ni->type, ni->name_len,
+ base_ni->mft_no);
if (err != -ENOENT && err != -ENOMEM)
NVolSetErrors(vol);
return err;
unmap_mft_record(base_ni);
err_out:
ntfs_error(vi->i_sb,
- "Failed with error code %i while reading index inode (mft_no 0x%lx, name_len %i.",
- err, vi->i_ino, ni->name_len);
+ "Failed with error code %i while reading index inode (mft_no 0x%llx, name_len %i.",
+ err, ni->mft_no, ni->name_len);
if (err != -EOPNOTSUPP && err != -ENOMEM)
NVolSetErrors(vol);
return err;
void ntfs_clear_extent_inode(struct ntfs_inode *ni)
{
- ntfs_debug("Entering for inode 0x%lx.", ni->mft_no);
+ ntfs_debug("Entering for inode 0x%llx.", ni->mft_no);
WARN_ON(NInoAttr(ni));
WARN_ON(ni->nr_extents != -1);
int err = 0;
unsigned long flags;
- ntfs_debug("Entering for inode %lld\n", (long long)ni->mft_no);
+ ntfs_debug("Entering for inode %llu\n", ni->mft_no);
ctx = ntfs_attr_get_search_ctx(ni, NULL);
if (!ctx)
ictx = ntfs_index_ctx_get(index_ni, I30, 4);
if (!ictx) {
- ntfs_error(sb, "Failed to get index ctx, inode %lld",
- (long long)index_ni->mft_no);
+ ntfs_error(sb, "Failed to get index ctx, inode %llu",
+ index_ni->mft_no);
iput(index_vi);
mutex_unlock(&index_ni->mrec_lock);
continue;
err = ntfs_index_lookup(fn, sizeof(struct file_name_attr), ictx);
if (err) {
- ntfs_debug("Index lookup failed, inode %lld",
- (long long)index_ni->mft_no);
+ ntfs_debug("Index lookup failed, inode %llu",
+ index_ni->mft_no);
ntfs_index_ctx_put(ictx);
iput(index_vi);
mutex_unlock(&index_ni->mrec_lock);
}
/* Check for real error occurred. */
if (err != -ENOENT) {
- ntfs_error(sb, "Attribute lookup failed, err : %d, inode %lld", err,
- (long long)ni->mft_no);
+ ntfs_error(sb, "Attribute lookup failed, err : %d, inode %llu", err,
+ ni->mft_no);
} else
err = 0;
return NULL;
sb = base_ni->vol->sb;
- ntfs_debug("Opening extent inode %lld (base mft record %lld).\n",
- (unsigned long long)mft_no,
- (unsigned long long)base_ni->mft_no);
+ ntfs_debug("Opening extent inode %llu (base mft record %llu).\n",
+ mft_no, base_ni->mft_no);
/* Is the extent inode already open and attached to the base inode? */
if (base_ni->nr_extents > 0) {
continue;
ni_mrec = map_mft_record(ni);
if (IS_ERR(ni_mrec)) {
- ntfs_error(sb, "failed to map mft record for %lu",
+ ntfs_error(sb, "failed to map mft record for %llu",
ni->mft_no);
goto out;
}
seq_no = MSEQNO_LE(mref);
if (seq_no &&
seq_no != le16_to_cpu(ni_mrec->sequence_number)) {
- ntfs_error(sb, "Found stale extent mft reference mft=%lld",
- (long long)ni->mft_no);
+ ntfs_error(sb, "Found stale extent mft reference mft=%llu",
+ ni->mft_no);
unmap_mft_record(ni);
goto out;
}
if (NInoAttr(ni))
ni = ni->ext.base_ntfs_ino;
- ntfs_debug("Entering for inode 0x%llx.\n", (long long) ni->mft_no);
+ ntfs_debug("Entering for inode 0x%llx.\n", ni->mft_no);
/* Inode haven't got attribute list, thus nothing to attach. */
if (!NInoAttrList(ni))
if (!ni)
return -EINVAL;
- ntfs_debug("inode %llu\n", (unsigned long long) ni->mft_no);
+ ntfs_debug("inode %llu\n", ni->mft_no);
if (NInoAttrList(ni) || ni->nr_extents) {
ntfs_error(ni->vol->sb, "Inode already has attribute list");
/* Check for real error occurred. */
if (err != -ENOENT) {
- ntfs_error(ni->vol->sb, "%s: Attribute lookup failed, inode %lld",
- __func__, (long long)ni->mft_no);
+ ntfs_error(ni->vol->sb, "%s: Attribute lookup failed, inode %llu",
+ __func__, ni->mft_no);
goto put_err_out;
}
if (!ni)
return 0;
- ntfs_debug("Entering for inode %lld\n", (long long)ni->mft_no);
+ ntfs_debug("Entering for inode %llu\n", ni->mft_no);
/* Is this a base inode with mapped extent inodes? */
/*
}
if (NInoDirty(ni))
- ntfs_error(ni->vol->sb, "Releasing dirty inode %lld!\n",
- (long long)ni->mft_no);
+ ntfs_error(ni->vol->sb, "Releasing dirty inode %llu!\n",
+ ni->mft_no);
if (NInoAttrList(ni) && ni->attr_list)
kvfree(ni->attr_list);
ntfs_destroy_ext_inode(ni);
ntfs_attr_close(ni);
if (NInoDirty(ni))
- ntfs_error(ni->vol->sb, "Releasing dirty ext inode %lld!\n",
- (long long)ni->mft_no);
+ ntfs_error(ni->vol->sb, "Releasing dirty ext inode %llu!\n",
+ ni->mft_no);
if (NInoAttrList(ni) && ni->attr_list)
kvfree(ni->attr_list);
kfree(ni->mrec);
if (!ni || size < 0)
return -EINVAL;
- ntfs_debug("Entering for inode %lld, size %d\n",
- (unsigned long long)ni->mft_no, size);
+ ntfs_debug("Entering for inode %llu, size %d\n", ni->mft_no, size);
sb = ni->vol->sb;
ni_mrec = map_mft_record(ni);
rwlock_t size_lock;
unsigned long state;
__le32 flags;
- unsigned long mft_no;
+ u64 mft_no;
u16 seq_no;
atomic_t count;
struct ntfs_volume *vol;
* possible on all architectures.
*/
struct ntfs_attr {
- unsigned long mft_no;
+ u64 mft_no;
__le16 *name;
u32 name_len;
__le32 type;
};
int ntfs_test_inode(struct inode *vi, void *data);
-struct inode *ntfs_iget(struct super_block *sb, unsigned long mft_no);
+struct inode *ntfs_iget(struct super_block *sb, u64 mft_no);
struct inode *ntfs_attr_iget(struct inode *base_vi, __le32 type,
__le16 *name, u32 name_len);
struct inode *ntfs_index_iget(struct inode *base_vi, __le16 *name,
ni->mft_no = vi->i_ino;
}
-struct ntfs_inode *ntfs_new_extent_inode(struct super_block *sb,
- unsigned long mft_no);
+struct ntfs_inode *ntfs_new_extent_inode(struct super_block *sb, u64 mft_no);
void ntfs_clear_extent_inode(struct ntfs_inode *ni);
int ntfs_read_inode_mount(struct inode *vi);
int ntfs_show_options(struct seq_file *sf, struct dentry *root);
int err;
unsigned int memalloc_flags;
- ntfs_debug("Entering for i_ino 0x%lx, start_vcn 0x%llx, count 0x%llx.%s",
+ ntfs_debug("Entering for i_ino 0x%llx, start_vcn 0x%llx, count 0x%llx.%s",
ni->mft_no, start_vcn, count,
is_rollback ? " (rollback)" : "");
vol = ni->vol;
* Returns 0 if the checks are successful. If not, return -EIO.
*/
int ntfs_mft_record_check(const struct ntfs_volume *vol, struct mft_record *m,
- unsigned long mft_no)
+ u64 mft_no)
{
struct attr_record *a;
struct super_block *sb = vol->sb;
if (!ntfs_is_file_record(m->magic)) {
ntfs_error(sb, "Record %llu has no FILE magic (0x%x)\n",
- (unsigned long long)mft_no, le32_to_cpu(*(__le32 *)m));
+ mft_no, le32_to_cpu(*(__le32 *)m));
goto err_out;
}
(vol->mft_record_size >> NTFS_BLOCK_SIZE_BITS) + 1 != le16_to_cpu(m->usa_count) ||
le16_to_cpu(m->usa_ofs) + le16_to_cpu(m->usa_count) * 2 > vol->mft_record_size) {
ntfs_error(sb, "Record %llu has corrupt fix-up values fields\n",
- (unsigned long long)mft_no);
+ mft_no);
goto err_out;
}
if (le32_to_cpu(m->bytes_allocated) != vol->mft_record_size) {
ntfs_error(sb, "Record %llu has corrupt allocation size (%u <> %u)\n",
- (unsigned long long)mft_no,
- vol->mft_record_size,
+ mft_no, vol->mft_record_size,
le32_to_cpu(m->bytes_allocated));
goto err_out;
}
if (le32_to_cpu(m->bytes_in_use) > vol->mft_record_size) {
ntfs_error(sb, "Record %llu has corrupt in-use size (%u > %u)\n",
- (unsigned long long)mft_no,
- le32_to_cpu(m->bytes_in_use),
+ mft_no, le32_to_cpu(m->bytes_in_use),
vol->mft_record_size);
goto err_out;
}
if (le16_to_cpu(m->attrs_offset) & 7) {
ntfs_error(sb, "Attributes badly aligned in record %llu\n",
- (unsigned long long)mft_no);
+ mft_no);
goto err_out;
}
a = (struct attr_record *)((char *)m + le16_to_cpu(m->attrs_offset));
if ((char *)a < (char *)m || (char *)a > (char *)m + vol->mft_record_size) {
- ntfs_error(sb, "Record %llu is corrupt\n",
- (unsigned long long)mft_no);
+ ntfs_error(sb, "Record %llu is corrupt\n", mft_no);
goto err_out;
}
vol->mft_record_size) {
folio = ERR_PTR(-ENOENT);
ntfs_error(vol->sb,
- "Attempt to read mft record 0x%lx, which is beyond the end of the mft. This is probably a bug in the ntfs driver.",
+ "Attempt to read mft record 0x%llx, which is beyond the end of the mft. This is probably a bug in the ntfs driver.",
ni->mft_no);
goto err_out;
}
if (!ni)
return ERR_PTR(-EINVAL);
- ntfs_debug("Entering for mft_no 0x%lx.", ni->mft_no);
+ ntfs_debug("Entering for mft_no 0x%llx.", ni->mft_no);
/* Make sure the ntfs inode doesn't go away. */
atomic_inc(&ni->count);
if (!ni)
return;
- ntfs_debug("Entering for mft_no 0x%lx.", ni->mft_no);
+ ntfs_debug("Entering for mft_no 0x%llx.", ni->mft_no);
folio = ni->folio;
if (atomic_dec_return(&ni->count) > 1)
struct ntfs_inode *ni = NULL;
struct ntfs_inode **extent_nis = NULL;
int i;
- unsigned long mft_no = MREF(mref);
+ u64 mft_no = MREF(mref);
u16 seq_no = MSEQNO(mref);
bool destroy_ni = false;
- ntfs_debug("Mapping extent mft record 0x%lx (base mft record 0x%lx).",
+ ntfs_debug("Mapping extent mft record 0x%llx (base mft record 0x%llx).",
mft_no, base_ni->mft_no);
/* Make sure the base ntfs inode doesn't go away. */
atomic_inc(&base_ni->count);
{
struct ntfs_inode *base_ni;
- ntfs_debug("Entering for inode 0x%lx.", ni->mft_no);
+ ntfs_debug("Entering for inode 0x%llx.", ni->mft_no);
WARN_ON(NInoAttr(ni));
/* Determine the base vfs inode and mark it dirty, too. */
if (likely(ni->nr_extents >= 0))
*
* NOTE: We always perform synchronous i/o.
*/
-int ntfs_sync_mft_mirror(struct ntfs_volume *vol, const unsigned long mft_no,
+int ntfs_sync_mft_mirror(struct ntfs_volume *vol, const u64 mft_no,
struct mft_record *m)
{
u8 *kmirr = NULL;
int err = 0;
struct bio *bio;
- ntfs_debug("Entering for inode 0x%lx.", mft_no);
+ ntfs_debug("Entering for inode 0x%llx.", mft_no);
if (unlikely(!vol->mftmirr_ino)) {
/* This could happen during umount... */
if (likely(!err)) {
ntfs_debug("Done.");
} else {
- ntfs_error(vol->sb, "I/O error while writing mft mirror record 0x%lx!", mft_no);
+ ntfs_error(vol->sb, "I/O error while writing mft mirror record 0x%llx!", mft_no);
err_out:
ntfs_error(vol->sb,
"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.",
struct bio *bio;
unsigned int offset = 0, folio_size;
- ntfs_debug("Entering for inode 0x%lx.", ni->mft_no);
+ ntfs_debug("Entering for inode 0x%llx.", ni->mft_no);
WARN_ON(NInoAttr(ni));
WARN_ON(!folio_test_locked(folio));
if (unlikely(err)) {
/* I/O error during writing. This is really bad! */
ntfs_error(vol->sb,
- "I/O error while writing mft record 0x%lx! Marking base inode as bad. You should unmount the volume and run chkdsk.",
+ "I/O error while writing mft record 0x%llx! Marking base inode as bad. You should unmount the volume and run chkdsk.",
ni->mft_no);
goto err_out;
}
* If we manage to obtain the lock we have exclusive access to the extent mft
* record. We set @locked_ni to the now locked ntfs inode and return 'true'.
*/
-bool ntfs_may_write_mft_record(struct ntfs_volume *vol, const unsigned long mft_no,
+static bool ntfs_may_write_mft_record(struct ntfs_volume *vol, const u64 mft_no,
const struct mft_record *m, struct ntfs_inode **locked_ni,
struct inode **ref_vi)
{
int i;
struct ntfs_attr na = {0};
- ntfs_debug("Entering for inode 0x%lx.", mft_no);
+ ntfs_debug("Entering for inode 0x%llx.", mft_no);
/*
* Normally we do not return a locked inode so set @locked_ni to NULL.
*/
* Check if the inode corresponding to this mft record is in the VFS
* inode cache and obtain a reference to it if it is.
*/
- ntfs_debug("Looking for inode 0x%lx in icache.", mft_no);
+ ntfs_debug("Looking for inode 0x%llx in icache.", mft_no);
na.mft_no = mft_no;
na.type = AT_UNUSED;
/*
return false;
}
if (vi) {
- ntfs_debug("Base inode 0x%lx is in icache.", mft_no);
+ ntfs_debug("Base inode 0x%llx is in icache.", mft_no);
/* The inode is in icache. */
ni = NTFS_I(vi);
/* Take a reference to the ntfs inode. */
atomic_inc(&ni->count);
/* If the inode is dirty, do not write this record. */
if (NInoDirty(ni)) {
- ntfs_debug("Inode 0x%lx is dirty, do not write it.",
+ ntfs_debug("Inode 0x%llx is dirty, do not write it.",
mft_no);
atomic_dec(&ni->count);
*ref_vi = vi;
return false;
}
- ntfs_debug("Inode 0x%lx is not dirty.", mft_no);
+ ntfs_debug("Inode 0x%llx is not dirty.", mft_no);
/* The inode is not dirty, try to take the mft record lock. */
if (unlikely(!mutex_trylock(&ni->mrec_lock))) {
- ntfs_debug("Mft record 0x%lx is already locked, do not write it.", mft_no);
+ ntfs_debug("Mft record 0x%llx is already locked, do not write it.", mft_no);
atomic_dec(&ni->count);
*ref_vi = vi;
return false;
}
- ntfs_debug("Managed to lock mft record 0x%lx, write it.",
+ ntfs_debug("Managed to lock mft record 0x%llx, write it.",
mft_no);
/*
* The write has to occur while we hold the mft record lock so
*locked_ni = ni;
return true;
}
- ntfs_debug("Inode 0x%lx is not in icache.", mft_no);
+ ntfs_debug("Inode 0x%llx is not in icache.", mft_no);
/* The inode is not in icache. */
/* Write the record if it is not a mft record (type "FILE"). */
if (!ntfs_is_mft_record(m->magic)) {
- ntfs_debug("Mft record 0x%lx is not a FILE record, write it.",
+ ntfs_debug("Mft record 0x%llx is not a FILE record, write it.",
mft_no);
return true;
}
/* Write the mft record if it is a base inode. */
if (!m->base_mft_record) {
- ntfs_debug("Mft record 0x%lx is a base record, write it.",
+ ntfs_debug("Mft record 0x%llx is a base record, write it.",
mft_no);
return true;
}
*/
na.mft_no = MREF_LE(m->base_mft_record);
na.state = 0;
- ntfs_debug("Mft record 0x%lx is an extent record. Looking for base inode 0x%lx in icache.",
+ ntfs_debug("Mft record 0x%llx is an extent record. Looking for base inode 0x%llx in icache.",
mft_no, na.mft_no);
if (!na.mft_no) {
/* Balance the below iput(). */
if (!vi)
return false;
- ntfs_debug("Base inode 0x%lx is in icache.", na.mft_no);
+ ntfs_debug("Base inode 0x%llx is in icache.", na.mft_no);
/*
* The base inode is in icache. Check if it has the extent inode
* corresponding to this extent mft record attached.
*/
mutex_unlock(&ni->extent_lock);
*ref_vi = vi;
- ntfs_debug("Base inode 0x%lx has no attached extent inodes, write the extent record.",
+ ntfs_debug("Base inode 0x%llx has no attached extent inodes, write the extent record.",
na.mft_no);
return true;
}
if (!eni) {
mutex_unlock(&ni->extent_lock);
*ref_vi = vi;
- ntfs_debug("Extent inode 0x%lx is not attached to its base inode 0x%lx, write the extent record.",
+ ntfs_debug("Extent inode 0x%llx is not attached to its base inode 0x%llx, write the extent record.",
mft_no, na.mft_no);
return true;
}
- ntfs_debug("Extent inode 0x%lx is attached to its base inode 0x%lx.",
+ ntfs_debug("Extent inode 0x%llx is attached to its base inode 0x%llx.",
mft_no, na.mft_no);
/* Take a reference to the extent ntfs inode. */
atomic_inc(&eni->count);
if (unlikely(!mutex_trylock(&eni->mrec_lock))) {
atomic_dec(&eni->count);
*ref_vi = vi;
- ntfs_debug("Extent mft record 0x%lx is already locked, do not write it.",
+ ntfs_debug("Extent mft record 0x%llx is already locked, do not write it.",
mft_no);
return false;
}
- ntfs_debug("Managed to lock extent mft record 0x%lx, write it.",
+ ntfs_debug("Managed to lock extent mft record 0x%llx, write it.",
mft_no);
/*
* The write has to occur while we hold the mft record lock so return
*
* Locking: Caller must hold vol->mftbmp_lock for writing.
*/
-static int ntfs_mft_bitmap_find_and_alloc_free_rec_nolock(struct ntfs_volume *vol,
+static s64 ntfs_mft_bitmap_find_and_alloc_free_rec_nolock(struct ntfs_volume *vol,
struct ntfs_inode *base_ni)
{
s64 pass_end, ll, data_pos, pass_start, ofs, bit;
sizeof(struct inode *), GFP_NOFS);
int nr_ref_inos = 0;
struct bio *bio = NULL;
- unsigned long mft_no;
+ u64 mft_no;
struct ntfs_inode *tni;
s64 lcn;
s64 vcn = ntfs_pidx_to_cluster(vol, folio->index);
else
base_tni = tni->ext.base_ntfs_ino;
mutex_unlock(&tni->extent_lock);
- ntfs_debug("Unlocking %s inode 0x%lx.",
+ ntfs_debug("Unlocking %s inode 0x%llx.",
tni == base_tni ? "base" : "extent",
tni->mft_no);
atomic_dec(&tni->count);
__mark_mft_record_dirty(ni);
}
-int ntfs_sync_mft_mirror(struct ntfs_volume *vol, const unsigned long mft_no,
+int ntfs_sync_mft_mirror(struct ntfs_volume *vol, const u64 mft_no,
struct mft_record *m);
int write_mft_record_nolock(struct ntfs_inode *ni, struct mft_record *m, int sync);
return err;
}
-bool ntfs_may_write_mft_record(struct ntfs_volume *vol,
- const unsigned long mft_no, const struct mft_record *m,
- struct ntfs_inode **locked_ni, struct inode **ref_vi);
int ntfs_mft_record_alloc(struct ntfs_volume *vol, const int mode,
struct ntfs_inode **ni, struct ntfs_inode *base_ni,
struct mft_record **ni_mrec);
int ntfs_mft_records_write(const struct ntfs_volume *vol, const u64 mref,
const s64 count, struct mft_record *b);
int ntfs_mft_record_check(const struct ntfs_volume *vol, struct mft_record *m,
- unsigned long mft_no);
+ u64 mft_no);
int ntfs_mft_writepages(struct address_space *mapping,
struct writeback_control *wbc);
void ntfs_mft_mark_dirty(struct folio *folio);
spin_unlock(&vi->i_lock);
/* Add the inode to the inode hash for the superblock. */
- vi->i_ino = ni->mft_no;
+ vi->i_ino = (unsigned long)ni->mft_no;
inode_set_iversion(vi, 1);
insert_inode_hash(vi);
dni_mrec = map_mft_record(dir_ni);
if (IS_ERR(dni_mrec)) {
- ntfs_error(dir_ni->vol->sb, "failed to map mft record for file %ld.\n",
+ ntfs_error(dir_ni->vol->sb, "failed to map mft record for file 0x%llx.\n",
dir_ni->mft_no);
err = -EIO;
goto err_out;
static int ntfs_test_inode_attr(struct inode *vi, void *data)
{
struct ntfs_inode *ni = NTFS_I(vi);
- unsigned long mft_no = (unsigned long)data;
+ u64 mft_no = (u64)data;
if (ni->mft_no != mft_no)
return 0;
/* Ignore hard links from other directories */
if (dir_ni->mft_no != MREF_LE(fn->parent_directory)) {
- ntfs_debug("MFT record numbers don't match (%lu != %lu)\n",
+ ntfs_debug("MFT record numbers don't match (%llu != %lu)\n",
dir_ni->mft_no,
MREF_LE(fn->parent_directory));
continue;
if (err) {
int err2;
- ntfs_error(sb, "Failed to delete old ntfs inode(%ld) in old dir, err : %d\n",
+ ntfs_error(sb, "Failed to delete old ntfs inode(%llu) in old dir, err : %d\n",
old_ni->mft_no, err);
err2 = ntfs_delete(old_ni, new_dir_ni, uname_new, new_name_len, false);
if (err2)