nilfs2: standardize the inode number type to u64

Variables handling inode numbers - such as the 'i_ino' member of the
inode structure - have been converted to 'u64' within the kernel to
ensure consistency.  However, some parts of the nilfs2 implementation
still use 'ino_t' or 'unsigned long' - both of which are
architecture-dependent types - to handle inode numbers.

Replace those remaining instances of 'ino_t' or 'unsigned long' with
'u64'.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
This commit is contained in:
Ryusuke Konishi
2026-08-10 16:06:23 -07:00
committed by Viacheslav Dubeyko
parent d7d54599a1
commit 24a098541a
10 changed files with 46 additions and 50 deletions
+5 -6
View File
@@ -169,17 +169,16 @@ Einumber:
error = "disallowed inode number";
bad_entry:
nilfs_error(sb,
"bad entry in directory #%llu: %s - offset=%lu, inode=%lu, rec_len=%zd, name_len=%d",
"bad entry in directory #%llu: %s - offset=%lu, inode=%llu, rec_len=%zd, name_len=%d",
dir->i_ino, error, (folio->index << PAGE_SHIFT) + offs,
(unsigned long)le64_to_cpu(p->inode),
rec_len, p->name_len);
le64_to_cpu(p->inode), rec_len, p->name_len);
goto fail;
Eend:
p = (struct nilfs_dir_entry *)(kaddr + offs);
nilfs_error(sb,
"entry in directory #%llu spans the page boundary offset=%lu, inode=%lu",
"entry in directory #%llu spans the page boundary offset=%lu, inode=%llu",
dir->i_ino, (folio->index << PAGE_SHIFT) + offs,
(unsigned long)le64_to_cpu(p->inode));
le64_to_cpu(p->inode));
fail:
return false;
}
@@ -387,7 +386,7 @@ fail:
return NULL;
}
int nilfs_inode_by_name(struct inode *dir, const struct qstr *qstr, ino_t *ino)
int nilfs_inode_by_name(struct inode *dir, const struct qstr *qstr, u64 *ino)
{
struct nilfs_dir_entry *de;
struct folio *folio;
+6 -7
View File
@@ -49,7 +49,7 @@ static inline struct nilfs_ifile_info *NILFS_IFILE_I(struct inode *ifile)
* * %-ENOMEM - Insufficient memory available.
* * %-ENOSPC - No inode left.
*/
int nilfs_ifile_create_inode(struct inode *ifile, ino_t *out_ino,
int nilfs_ifile_create_inode(struct inode *ifile, u64 *out_ino,
struct buffer_head **out_bh)
{
struct nilfs_palloc_req req;
@@ -72,7 +72,7 @@ int nilfs_ifile_create_inode(struct inode *ifile, ino_t *out_ino,
nilfs_palloc_commit_alloc_entry(ifile, &req);
mark_buffer_dirty(req.pr_entry_bh);
nilfs_mdt_mark_dirty(ifile);
*out_ino = (ino_t)req.pr_entry_nr;
*out_ino = req.pr_entry_nr;
*out_bh = req.pr_entry_bh;
return 0;
}
@@ -88,7 +88,7 @@ int nilfs_ifile_create_inode(struct inode *ifile, ino_t *out_ino,
* * %-ENOENT - Inode number unallocated.
* * %-ENOMEM - Insufficient memory available.
*/
int nilfs_ifile_delete_inode(struct inode *ifile, ino_t ino)
int nilfs_ifile_delete_inode(struct inode *ifile, u64 ino)
{
struct nilfs_palloc_req req = {
.pr_entry_nr = ino, .pr_entry_bh = NULL
@@ -123,21 +123,20 @@ int nilfs_ifile_delete_inode(struct inode *ifile, ino_t ino)
return 0;
}
int nilfs_ifile_get_inode_block(struct inode *ifile, ino_t ino,
int nilfs_ifile_get_inode_block(struct inode *ifile, u64 ino,
struct buffer_head **out_bh)
{
struct super_block *sb = ifile->i_sb;
int err;
if (unlikely(!NILFS_VALID_INODE(sb, ino))) {
nilfs_error(sb, "bad inode number: %lu", (unsigned long)ino);
nilfs_error(sb, "bad inode number: %llu", ino);
return -EINVAL;
}
err = nilfs_palloc_get_entry_block(ifile, ino, 0, out_bh);
if (unlikely(err))
nilfs_warn(sb, "error %d reading inode: ino=%lu",
err, (unsigned long)ino);
nilfs_warn(sb, "error %d reading inode: ino=%llu", err, ino);
return err;
}
+6 -4
View File
@@ -19,7 +19,7 @@
static inline struct nilfs_inode *
nilfs_ifile_map_inode(struct inode *ifile, ino_t ino, struct buffer_head *ibh)
nilfs_ifile_map_inode(struct inode *ifile, u64 ino, struct buffer_head *ibh)
{
size_t __offset_in_folio = nilfs_palloc_entry_offset(ifile, ino, ibh);
@@ -31,9 +31,11 @@ static inline void nilfs_ifile_unmap_inode(struct nilfs_inode *raw_inode)
kunmap_local(raw_inode);
}
int nilfs_ifile_create_inode(struct inode *, ino_t *, struct buffer_head **);
int nilfs_ifile_delete_inode(struct inode *, ino_t);
int nilfs_ifile_get_inode_block(struct inode *, ino_t, struct buffer_head **);
int nilfs_ifile_create_inode(struct inode *ifile, u64 *out_ino,
struct buffer_head **out_bh);
int nilfs_ifile_delete_inode(struct inode *ifile, u64 ino);
int nilfs_ifile_get_inode_block(struct inode *ifile, u64 ino,
struct buffer_head **out_bh);
int nilfs_ifile_count_free_inodes(struct inode *, u64 *, u64 *);
+11 -13
View File
@@ -287,8 +287,7 @@ const struct address_space_operations nilfs_buffer_cache_aops = {
};
static int nilfs_insert_inode_locked(struct inode *inode,
struct nilfs_root *root,
unsigned long ino)
struct nilfs_root *root, u64 ino)
{
struct nilfs_iget_args args = {
.ino = ino, .root = root, .cno = 0, .type = NILFS_I_TYPE_NORMAL
@@ -305,7 +304,7 @@ struct inode *nilfs_new_inode(struct inode *dir, umode_t mode)
struct nilfs_root *root;
struct buffer_head *bh;
int err = -ENOMEM;
ino_t ino;
u64 ino;
inode = new_inode(sb);
if (unlikely(!inode))
@@ -443,7 +442,7 @@ int nilfs_read_inode_common(struct inode *inode,
}
static int __nilfs_read_inode(struct super_block *sb,
struct nilfs_root *root, unsigned long ino,
struct nilfs_root *root, u64 ino,
struct inode *inode)
{
struct the_nilfs *nilfs = sb->s_fs_info;
@@ -482,8 +481,8 @@ static int __nilfs_read_inode(struct super_block *sb,
huge_decode_dev(le64_to_cpu(raw_inode->i_device_code)));
} else {
nilfs_error(sb,
"invalid file type bits in mode 0%o for inode %lu",
inode->i_mode, ino);
"invalid file type bits in mode 0%o for inode %llu",
inode->i_mode, ino);
err = -EIO;
goto failed_unmap;
}
@@ -533,7 +532,7 @@ static int nilfs_iget_set(struct inode *inode, void *opaque)
}
struct inode *nilfs_ilookup(struct super_block *sb, struct nilfs_root *root,
unsigned long ino)
u64 ino)
{
struct nilfs_iget_args args = {
.ino = ino, .root = root, .cno = 0, .type = NILFS_I_TYPE_NORMAL
@@ -542,8 +541,8 @@ struct inode *nilfs_ilookup(struct super_block *sb, struct nilfs_root *root,
return ilookup5(sb, ino, nilfs_iget_test, &args);
}
struct inode *nilfs_iget_locked(struct super_block *sb, struct nilfs_root *root,
unsigned long ino)
struct inode *nilfs_iget_locked(struct super_block *sb,
struct nilfs_root *root, u64 ino)
{
struct nilfs_iget_args args = {
.ino = ino, .root = root, .cno = 0, .type = NILFS_I_TYPE_NORMAL
@@ -553,7 +552,7 @@ struct inode *nilfs_iget_locked(struct super_block *sb, struct nilfs_root *root,
}
struct inode *nilfs_iget(struct super_block *sb, struct nilfs_root *root,
unsigned long ino)
u64 ino)
{
struct inode *inode;
int err;
@@ -579,8 +578,7 @@ struct inode *nilfs_iget(struct super_block *sb, struct nilfs_root *root,
return inode;
}
struct inode *nilfs_iget_for_gc(struct super_block *sb, unsigned long ino,
__u64 cno)
struct inode *nilfs_iget_for_gc(struct super_block *sb, u64 ino, __u64 cno)
{
struct nilfs_iget_args args = {
.ino = ino, .root = NULL, .cno = cno, .type = NILFS_I_TYPE_GC
@@ -740,7 +738,7 @@ void nilfs_write_inode_common(struct inode *inode,
void nilfs_update_inode(struct inode *inode, struct buffer_head *ibh, int flags)
{
ino_t ino = inode->i_ino;
u64 ino = inode->i_ino;
struct nilfs_inode_info *ii = NILFS_I(inode);
struct inode *ifile = ii->i_root->ifile;
struct nilfs_inode *raw_inode;
+1 -1
View File
@@ -612,7 +612,7 @@ static int nilfs_ioctl_move_blocks(struct super_block *sb,
struct nilfs_vdesc *vdesc;
struct buffer_head *bh, *n;
LIST_HEAD(buffers);
ino_t ino;
u64 ino;
__u64 cno;
int i, ret;
+3 -3
View File
@@ -54,7 +54,7 @@ static struct dentry *
nilfs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
{
struct inode *inode;
ino_t ino;
u64 ino;
int res;
if (dentry->d_name.len > NILFS_NAME_LEN)
@@ -69,7 +69,7 @@ nilfs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
inode = nilfs_iget(dir->i_sb, NILFS_I(dir)->i_root, ino);
if (inode == ERR_PTR(-ESTALE)) {
nilfs_error(dir->i_sb,
"deleted inode referenced: %lu", ino);
"deleted inode referenced: %llu", ino);
return ERR_PTR(-EIO);
}
}
@@ -463,7 +463,7 @@ out:
*/
static struct dentry *nilfs_get_parent(struct dentry *child)
{
ino_t ino;
u64 ino;
int res;
struct nilfs_root *root;
+7 -8
View File
@@ -144,7 +144,7 @@ enum {
((ino) < NILFS_USER_INO && (NILFS_SYS_INO_BITS & BIT(ino))))
#define NILFS_PRIVATE_INODE(ino) ({ \
ino_t __ino = (ino); \
u64 __ino = (ino); \
((__ino) < NILFS_USER_INO && (__ino) != NILFS_ROOT_INO && \
(__ino) != NILFS_SKETCH_INO); })
@@ -255,7 +255,7 @@ static inline __u32 nilfs_mask_flags(umode_t mode, __u32 flags)
/* dir.c */
int nilfs_add_link(struct dentry *, struct inode *);
int nilfs_inode_by_name(struct inode *dir, const struct qstr *qstr, ino_t *ino);
int nilfs_inode_by_name(struct inode *dir, const struct qstr *qstr, u64 *ino);
int nilfs_make_empty(struct inode *, struct inode *);
struct nilfs_dir_entry *nilfs_find_entry(struct inode *, const struct qstr *,
struct folio **);
@@ -287,13 +287,12 @@ extern int nilfs_read_inode_common(struct inode *, struct nilfs_inode *);
void nilfs_write_inode_common(struct inode *inode,
struct nilfs_inode *raw_inode);
struct inode *nilfs_ilookup(struct super_block *sb, struct nilfs_root *root,
unsigned long ino);
struct inode *nilfs_iget_locked(struct super_block *sb, struct nilfs_root *root,
unsigned long ino);
u64 ino);
struct inode *nilfs_iget_locked(struct super_block *sb,
struct nilfs_root *root, u64 ino);
struct inode *nilfs_iget(struct super_block *sb, struct nilfs_root *root,
unsigned long ino);
extern struct inode *nilfs_iget_for_gc(struct super_block *sb,
unsigned long ino, __u64 cno);
u64 ino);
struct inode *nilfs_iget_for_gc(struct super_block *sb, u64 ino, __u64 cno);
int nilfs_attach_btree_node_cache(struct inode *inode);
void nilfs_detach_btree_node_cache(struct inode *inode);
struct inode *nilfs_iget_for_shadow(struct inode *inode);
+4 -5
View File
@@ -154,7 +154,7 @@ void nilfs_folio_bug(struct folio *folio)
{
struct buffer_head *bh, *head;
struct address_space *m;
unsigned long ino;
u64 ino;
if (unlikely(!folio)) {
printk(KERN_CRIT "NILFS_FOLIO_BUG(NULL)\n");
@@ -164,10 +164,9 @@ void nilfs_folio_bug(struct folio *folio)
m = folio->mapping;
ino = m ? m->host->i_ino : 0;
printk(KERN_CRIT "NILFS_FOLIO_BUG(%p): cnt=%d index#=%llu flags=0x%lx "
"mapping=%p ino=%lu\n",
folio, folio_ref_count(folio),
(unsigned long long)folio->index, folio->flags.f, m, ino);
printk(KERN_CRIT "NILFS_FOLIO_BUG(%p): cnt=%d index#=%lu flags=0x%lx mapping=%p ino=%llu\n",
folio, folio_ref_count(folio), folio->index, folio->flags.f,
m, ino);
head = folio_buffers(folio);
if (head) {
+2 -2
View File
@@ -34,7 +34,7 @@ enum {
/* work structure for recovery */
struct nilfs_recovery_block {
ino_t ino; /*
u64 ino; /*
* Inode number of the file that this block
* belongs to
*/
@@ -333,7 +333,7 @@ static int nilfs_scan_dsync_log(struct the_nilfs *nilfs, sector_t start_blocknr,
unsigned int offset;
u32 nfinfo, sumbytes;
sector_t blocknr;
ino_t ino;
u64 ino;
int err = -EIO;
nfinfo = le32_to_cpu(sum->ss_nfinfo);
+1 -1
View File
@@ -1610,7 +1610,7 @@ nilfs_segctor_update_payload_blocknr(struct nilfs_sc_info *sci,
struct nilfs_finfo *finfo = NULL;
union nilfs_binfo binfo;
struct buffer_head *bh, *bh_org;
ino_t ino = 0;
u64 ino = 0;
int err = 0;
if (!nfinfo)