Bug #46828 ยป 0001-ceph-fix-inode-number-presentation-on-32-bit-platfor.patch
fs/ceph/caps.c | ||
---|---|---|
int have = ci->i_snap_caps;
|
||
if ((have & mask) == mask) {
|
||
dout("__ceph_caps_issued_mask ino 0x%lx snap issued %s"
|
||
" (mask %s)\n", ci->vfs_inode.i_ino,
|
||
dout("__ceph_caps_issued_mask ino 0x%llx snap issued %s"
|
||
" (mask %s)\n", ceph_ino(&ci->vfs_inode),
|
||
ceph_cap_string(have),
|
||
ceph_cap_string(mask));
|
||
return 1;
|
||
... | ... | |
if (!__cap_is_valid(cap))
|
||
continue;
|
||
if ((cap->issued & mask) == mask) {
|
||
dout("__ceph_caps_issued_mask ino 0x%lx cap %p issued %s"
|
||
" (mask %s)\n", ci->vfs_inode.i_ino, cap,
|
||
dout("__ceph_caps_issued_mask ino 0x%llx cap %p issued %s"
|
||
" (mask %s)\n", ceph_ino(&ci->vfs_inode), cap,
|
||
ceph_cap_string(cap->issued),
|
||
ceph_cap_string(mask));
|
||
if (touch)
|
||
... | ... | |
/* does a combination of caps satisfy mask? */
|
||
have |= cap->issued;
|
||
if ((have & mask) == mask) {
|
||
dout("__ceph_caps_issued_mask ino 0x%lx combo issued %s"
|
||
" (mask %s)\n", ci->vfs_inode.i_ino,
|
||
dout("__ceph_caps_issued_mask ino 0x%llx combo issued %s"
|
||
" (mask %s)\n", ceph_ino(&ci->vfs_inode),
|
||
ceph_cap_string(cap->issued),
|
||
ceph_cap_string(mask));
|
||
if (touch) {
|
||
... | ... | |
struct cap_wait cw;
|
||
DEFINE_WAIT_FUNC(wait, woken_wake_function);
|
||
cw.ino = inode->i_ino;
|
||
cw.ino = ceph_ino(inode);
|
||
cw.tgid = current->tgid;
|
||
cw.need = need;
|
||
cw.want = want;
|
fs/ceph/debugfs.c | ||
---|---|---|
{
|
||
struct seq_file *s = p;
|
||
seq_printf(s, "0x%-17lx%-17s%-17s\n", inode->i_ino,
|
||
seq_printf(s, "0x%-17llx%-17s%-17s\n", ceph_ino(inode),
|
||
ceph_cap_string(cap->issued),
|
||
ceph_cap_string(cap->implemented));
|
||
return 0;
|
||
... | ... | |
spin_lock(&mdsc->caps_list_lock);
|
||
list_for_each_entry(cw, &mdsc->cap_wait_list, list) {
|
||
seq_printf(s, "%-13d0x%-17lx%-17s%-17s\n", cw->tgid, cw->ino,
|
||
seq_printf(s, "%-13d0x%-17llx%-17s%-17s\n", cw->tgid, cw->ino,
|
||
ceph_cap_string(cw->need),
|
||
ceph_cap_string(cw->want));
|
||
}
|
fs/ceph/dir.c | ||
---|---|---|
dentry, dentry, d_inode(dentry));
|
||
ctx->pos = di->offset;
|
||
if (!dir_emit(ctx, dentry->d_name.name,
|
||
dentry->d_name.len,
|
||
ceph_translate_ino(dentry->d_sb,
|
||
d_inode(dentry)->i_ino),
|
||
dentry->d_name.len, ceph_ino(d_inode(dentry)),
|
||
d_inode(dentry)->i_mode >> 12)) {
|
||
dput(dentry);
|
||
err = 0;
|
||
... | ... | |
/* always start with . and .. */
|
||
if (ctx->pos == 0) {
|
||
dout("readdir off 0 -> '.'\n");
|
||
if (!dir_emit(ctx, ".", 1,
|
||
ceph_translate_ino(inode->i_sb, inode->i_ino),
|
||
if (!dir_emit(ctx, ".", 1, ceph_ino(inode),
|
||
inode->i_mode >> 12))
|
||
return 0;
|
||
ctx->pos = 1;
|
||
}
|
||
if (ctx->pos == 1) {
|
||
ino_t ino = parent_ino(file->f_path.dentry);
|
||
dout("readdir off 1 -> '..'\n");
|
||
if (!dir_emit(ctx, "..", 2,
|
||
ceph_translate_ino(inode->i_sb, ino),
|
||
if (!dir_emit(ctx, "..", 2, ceph_ino(inode),
|
||
inode->i_mode >> 12))
|
||
return 0;
|
||
ctx->pos = 2;
|
||
... | ... | |
}
|
||
for (; i < rinfo->dir_nr; i++) {
|
||
struct ceph_mds_reply_dir_entry *rde = rinfo->dir_entries + i;
|
||
struct ceph_vino vino;
|
||
ino_t ino;
|
||
u32 ftype;
|
||
BUG_ON(rde->offset < ctx->pos);
|
||
... | ... | |
rde->name_len, rde->name, &rde->inode.in);
|
||
BUG_ON(!rde->inode.in);
|
||
ftype = le32_to_cpu(rde->inode.in->mode) >> 12;
|
||
vino.ino = le64_to_cpu(rde->inode.in->ino);
|
||
vino.snap = le64_to_cpu(rde->inode.in->snapid);
|
||
ino = ceph_vino_to_ino(vino);
|
||
if (!dir_emit(ctx, rde->name, rde->name_len,
|
||
ceph_translate_ino(inode->i_sb, ino), ftype)) {
|
||
le64_to_cpu(rde->inode.in->ino),
|
||
le32_to_cpu(rde->inode.in->mode) >> 12)) {
|
||
dout("filldir stopping us...\n");
|
||
return 0;
|
||
}
|
||
... | ... | |
if (try_async && op == CEPH_MDS_OP_UNLINK &&
|
||
(req->r_dir_caps = get_caps_for_async_unlink(dir, dentry))) {
|
||
dout("async unlink on %lu/%.*s caps=%s", dir->i_ino,
|
||
dout("async unlink on %llu/%.*s caps=%s", ceph_ino(dir),
|
||
dentry->d_name.len, dentry->d_name.name,
|
||
ceph_cap_string(req->r_dir_caps));
|
||
set_bit(CEPH_MDS_R_ASYNC, &req->r_req_flags);
|
fs/ceph/file.c | ||
---|---|---|
} else {
|
||
struct dentry *dn;
|
||
dout("%s d_adding new inode 0x%llx to 0x%lx/%s\n", __func__,
|
||
vino.ino, dir->i_ino, dentry->d_name.name);
|
||
dout("%s d_adding new inode 0x%llx to 0x%llx/%s\n", __func__,
|
||
vino.ino, ceph_ino(dir), dentry->d_name.name);
|
||
ceph_dir_clear_ordered(dir);
|
||
ceph_init_inode_acls(inode, as_ctx);
|
||
if (inode->i_state & I_NEW) {
|
fs/ceph/inode.c | ||
---|---|---|
static int ceph_set_ino_cb(struct inode *inode, void *data)
|
||
{
|
||
ceph_inode(inode)->i_vino = *(struct ceph_vino *)data;
|
||
inode->i_ino = ceph_vino_to_ino(*(struct ceph_vino *)data);
|
||
inode_set_iversion_raw(inode, 0);
|
||
return 0;
|
||
}
|
||
... | ... | |
struct inode *ceph_get_inode(struct super_block *sb, struct ceph_vino vino)
|
||
{
|
||
struct inode *inode;
|
||
ino_t t = ceph_vino_to_ino(vino);
|
||
inode = iget5_locked(sb, t, ceph_ino_compare, ceph_set_ino_cb, &vino);
|
||
inode = iget5_locked(sb, (unsigned long)vino.ino, ceph_ino_compare,
|
||
ceph_set_ino_cb, &vino);
|
||
if (!inode)
|
||
return ERR_PTR(-ENOMEM);
|
||
if (inode->i_state & I_NEW)
|
||
dout("get_inode created new inode %p %llx.%llx ino %llx\n",
|
||
inode, ceph_vinop(inode), (u64)inode->i_ino);
|
||
inode, ceph_vinop(inode), ceph_ino(inode));
|
||
dout("get_inode on %lu=%llx.%llx got %p\n", inode->i_ino, vino.ino,
|
||
dout("get_inode on %llu=%llx.%llx got %p\n", ceph_ino(inode), vino.ino,
|
||
vino.snap, inode);
|
||
return inode;
|
||
}
|
||
... | ... | |
}
|
||
generic_fillattr(inode, stat);
|
||
stat->ino = ceph_translate_ino(inode->i_sb, inode->i_ino);
|
||
stat->ino = ceph_ino(inode);
|
||
/*
|
||
* btime on newly-allocated inodes is 0, so if this is still set to
|
fs/ceph/mds_client.h | ||
---|---|---|
struct cap_wait {
|
||
struct list_head list;
|
||
unsigned long ino;
|
||
u64 ino;
|
||
pid_t tgid;
|
||
int need;
|
||
int want;
|
fs/ceph/quota.c | ||
---|---|---|
{
|
||
struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
|
||
struct super_block *sb = mdsc->fsc->sb;
|
||
struct inode *root = d_inode(sb->s_root);
|
||
if (atomic64_read(&mdsc->quotarealms_count) > 0)
|
||
return true;
|
||
/* if root is the real CephFS root, we don't have quota realms */
|
||
if (sb->s_root->d_inode &&
|
||
(sb->s_root->d_inode->i_ino == CEPH_INO_ROOT))
|
||
if (root && ceph_ino(root) == CEPH_INO_ROOT)
|
||
return false;
|
||
/* otherwise, we can't know for sure */
|
||
return true;
|
fs/ceph/super.h | ||
---|---|---|
return ceph_inode(inode)->i_vino;
|
||
}
|
||
/*
|
||
* ino_t is <64 bits on many architectures, blech.
|
||
*
|
||
* i_ino (kernel inode) st_ino (userspace)
|
||
* i386 32 32
|
||
* x86_64+ino32 64 32
|
||
* x86_64 64 64
|
||
*/
|
||
static inline u32 ceph_ino_to_ino32(__u64 vino)
|
||
{
|
||
u32 ino = vino & 0xffffffff;
|
||
ino ^= vino >> 32;
|
||
if (!ino)
|
||
ino = 2;
|
||
return ino;
|
||
}
|
||
/*
|
||
* kernel i_ino value
|
||
*/
|
||
static inline ino_t ceph_vino_to_ino(struct ceph_vino vino)
|
||
{
|
||
#if BITS_PER_LONG == 32
|
||
return ceph_ino_to_ino32(vino.ino);
|
||
#else
|
||
return (ino_t)vino.ino;
|
||
#endif
|
||
}
|
||
/*
|
||
* user-visible ino (stat, filldir)
|
||
*/
|
||
#if BITS_PER_LONG == 32
|
||
static inline ino_t ceph_translate_ino(struct super_block *sb, ino_t ino)
|
||
{
|
||
return ino;
|
||
}
|
||
#else
|
||
static inline ino_t ceph_translate_ino(struct super_block *sb, ino_t ino)
|
||
{
|
||
if (ceph_test_mount_opt(ceph_sb_to_client(sb), INO32))
|
||
ino = ceph_ino_to_ino32(ino);
|
||
return ino;
|
||
}
|
||
#endif
|
||
/* for printf-style formatting */
|
||
#define ceph_vinop(i) ceph_inode(i)->i_vino.ino, ceph_inode(i)->i_vino.snap
|
||
... | ... | |
static inline struct inode *ceph_find_inode(struct super_block *sb,
|
||
struct ceph_vino vino)
|
||
{
|
||
ino_t t = ceph_vino_to_ino(vino);
|
||
return ilookup5(sb, t, ceph_ino_compare, &vino);
|
||
return ilookup5(sb, (unsigned long)vino.ino, ceph_ino_compare, &vino);
|
||
}
|
||