Commit dbb7cae2 authored by Steven Whitehouse's avatar Steven Whitehouse
Browse files

[GFS2] Clean up inode number handling



This patch cleans up the inode number handling code. The main difference
is that instead of looking up the inodes using a struct gfs2_inum_host
we now use just the no_addr member of this structure. The tests relating
to no_formal_ino can then be done by the calling code. This has
advantages in that we want to do different things in different code
paths if the no_formal_ino doesn't match. In the NFS patch we want to
return -ESTALE, but in the ->lookup() path, its a bug in the fs if the
no_formal_ino doesn't match and thus we can withdraw in this case.

In order to later fix bz #201012, we need to be able to look up an inode
without knowing no_formal_ino, as the only information that is known to
us is the on-disk location of the inode in question.

This patch will also help us to fix bz #236099 at a later date by
cleaning up a lot of the code in that area.

There are no user visible changes as a result of this patch and there
are no changes to the on-disk format either.
Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
parent 41d7db0a
...@@ -1040,7 +1040,7 @@ static int trunc_end(struct gfs2_inode *ip) ...@@ -1040,7 +1040,7 @@ static int trunc_end(struct gfs2_inode *ip)
ip->i_di.di_height = 0; ip->i_di.di_height = 0;
ip->i_di.di_goal_meta = ip->i_di.di_goal_meta =
ip->i_di.di_goal_data = ip->i_di.di_goal_data =
ip->i_num.no_addr; ip->i_no_addr;
gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode)); gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode));
} }
ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME_SEC; ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME_SEC;
......
...@@ -1456,7 +1456,7 @@ int gfs2_dir_read(struct inode *inode, u64 *offset, void *opaque, ...@@ -1456,7 +1456,7 @@ int gfs2_dir_read(struct inode *inode, u64 *offset, void *opaque,
if (dip->i_di.di_entries != g.offset) { if (dip->i_di.di_entries != g.offset) {
fs_warn(sdp, "Number of entries corrupt in dir %llu, " fs_warn(sdp, "Number of entries corrupt in dir %llu, "
"ip->i_di.di_entries (%u) != g.offset (%u)\n", "ip->i_di.di_entries (%u) != g.offset (%u)\n",
(unsigned long long)dip->i_num.no_addr, (unsigned long long)dip->i_no_addr,
dip->i_di.di_entries, dip->i_di.di_entries,
g.offset); g.offset);
error = -EIO; error = -EIO;
...@@ -1488,24 +1488,54 @@ out: ...@@ -1488,24 +1488,54 @@ out:
* Returns: errno * Returns: errno
*/ */
int gfs2_dir_search(struct inode *dir, const struct qstr *name, struct inode *gfs2_dir_search(struct inode *dir, const struct qstr *name)
struct gfs2_inum_host *inum, unsigned int *type)
{ {
struct buffer_head *bh; struct buffer_head *bh;
struct gfs2_dirent *dent; struct gfs2_dirent *dent;
struct inode *inode;
dent = gfs2_dirent_search(dir, name, gfs2_dirent_find, &bh);
if (dent) {
if (IS_ERR(dent))
return ERR_PTR(PTR_ERR(dent));
inode = gfs2_inode_lookup(dir->i_sb,
be64_to_cpu(dent->de_inum.no_addr),
be16_to_cpu(dent->de_type));
brelse(bh);
return inode;
}
return ERR_PTR(-ENOENT);
}
int gfs2_dir_check(struct inode *dir, const struct qstr *name,
const struct gfs2_inode *ip)
{
struct buffer_head *bh;
struct gfs2_dirent *dent;
int ret = -ENOENT;
dent = gfs2_dirent_search(dir, name, gfs2_dirent_find, &bh); dent = gfs2_dirent_search(dir, name, gfs2_dirent_find, &bh);
if (dent) { if (dent) {
if (IS_ERR(dent)) if (IS_ERR(dent))
return PTR_ERR(dent); return PTR_ERR(dent);
if (inum) if (ip) {
gfs2_inum_in(inum, (char *)&dent->de_inum); if (be64_to_cpu(dent->de_inum.no_addr) != ip->i_no_addr)
if (type) goto out;
*type = be16_to_cpu(dent->de_type); if (be64_to_cpu(dent->de_inum.no_formal_ino) !=
ip->i_no_formal_ino)
goto out;
if (unlikely(IF2DT(ip->i_inode.i_mode) !=
be16_to_cpu(dent->de_type))) {
gfs2_consist_inode(GFS2_I(dir));
ret = -EIO;
goto out;
}
}
ret = 0;
out:
brelse(bh); brelse(bh);
return 0;
} }
return -ENOENT; return ret;
} }
static int dir_new_leaf(struct inode *inode, const struct qstr *name) static int dir_new_leaf(struct inode *inode, const struct qstr *name)
...@@ -1565,7 +1595,7 @@ static int dir_new_leaf(struct inode *inode, const struct qstr *name) ...@@ -1565,7 +1595,7 @@ static int dir_new_leaf(struct inode *inode, const struct qstr *name)
*/ */
int gfs2_dir_add(struct inode *inode, const struct qstr *name, int gfs2_dir_add(struct inode *inode, const struct qstr *name,
const struct gfs2_inum_host *inum, unsigned type) const struct gfs2_inode *nip, unsigned type)
{ {
struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_inode *ip = GFS2_I(inode);
struct buffer_head *bh; struct buffer_head *bh;
...@@ -1580,7 +1610,7 @@ int gfs2_dir_add(struct inode *inode, const struct qstr *name, ...@@ -1580,7 +1610,7 @@ int gfs2_dir_add(struct inode *inode, const struct qstr *name,
if (IS_ERR(dent)) if (IS_ERR(dent))
return PTR_ERR(dent); return PTR_ERR(dent);
dent = gfs2_init_dirent(inode, dent, name, bh); dent = gfs2_init_dirent(inode, dent, name, bh);
gfs2_inum_out(inum, (char *)&dent->de_inum); gfs2_inum_out(nip, dent);
dent->de_type = cpu_to_be16(type); dent->de_type = cpu_to_be16(type);
if (ip->i_di.di_flags & GFS2_DIF_EXHASH) { if (ip->i_di.di_flags & GFS2_DIF_EXHASH) {
leaf = (struct gfs2_leaf *)bh->b_data; leaf = (struct gfs2_leaf *)bh->b_data;
...@@ -1700,7 +1730,7 @@ int gfs2_dir_del(struct gfs2_inode *dip, const struct qstr *name) ...@@ -1700,7 +1730,7 @@ int gfs2_dir_del(struct gfs2_inode *dip, const struct qstr *name)
*/ */
int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename, int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename,
struct gfs2_inum_host *inum, unsigned int new_type) const struct gfs2_inode *nip, unsigned int new_type)
{ {
struct buffer_head *bh; struct buffer_head *bh;
struct gfs2_dirent *dent; struct gfs2_dirent *dent;
...@@ -1715,7 +1745,7 @@ int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename, ...@@ -1715,7 +1745,7 @@ int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename,
return PTR_ERR(dent); return PTR_ERR(dent);
gfs2_trans_add_bh(dip->i_gl, bh, 1); gfs2_trans_add_bh(dip->i_gl, bh, 1);
gfs2_inum_out(inum, (char *)&dent->de_inum); gfs2_inum_out(nip, dent);
dent->de_type = cpu_to_be16(new_type); dent->de_type = cpu_to_be16(new_type);
if (dip->i_di.di_flags & GFS2_DIF_EXHASH) { if (dip->i_di.di_flags & GFS2_DIF_EXHASH) {
......
...@@ -16,15 +16,16 @@ struct inode; ...@@ -16,15 +16,16 @@ struct inode;
struct gfs2_inode; struct gfs2_inode;
struct gfs2_inum; struct gfs2_inum;
int gfs2_dir_search(struct inode *dir, const struct qstr *filename, struct inode *gfs2_dir_search(struct inode *dir, const struct qstr *filename);
struct gfs2_inum_host *inum, unsigned int *type); int gfs2_dir_check(struct inode *dir, const struct qstr *filename,
const struct gfs2_inode *ip);
int gfs2_dir_add(struct inode *inode, const struct qstr *filename, int gfs2_dir_add(struct inode *inode, const struct qstr *filename,
const struct gfs2_inum_host *inum, unsigned int type); const struct gfs2_inode *ip, unsigned int type);
int gfs2_dir_del(struct gfs2_inode *dip, const struct qstr *filename); int gfs2_dir_del(struct gfs2_inode *dip, const struct qstr *filename);
int gfs2_dir_read(struct inode *inode, u64 *offset, void *opaque, int gfs2_dir_read(struct inode *inode, u64 *offset, void *opaque,
filldir_t filldir); filldir_t filldir);
int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename, int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename,
struct gfs2_inum_host *new_inum, unsigned int new_type); const struct gfs2_inode *nip, unsigned int new_type);
int gfs2_dir_exhash_dealloc(struct gfs2_inode *dip); int gfs2_dir_exhash_dealloc(struct gfs2_inode *dip);
......
...@@ -1823,8 +1823,8 @@ static int dump_inode(struct glock_iter *gi, struct gfs2_inode *ip) ...@@ -1823,8 +1823,8 @@ static int dump_inode(struct glock_iter *gi, struct gfs2_inode *ip)
print_dbg(gi, " Inode:\n"); print_dbg(gi, " Inode:\n");
print_dbg(gi, " num = %llu/%llu\n", print_dbg(gi, " num = %llu/%llu\n",
(unsigned long long)ip->i_num.no_formal_ino, (unsigned long long)ip->i_no_formal_ino,
(unsigned long long)ip->i_num.no_addr); (unsigned long long)ip->i_no_addr);
print_dbg(gi, " type = %u\n", IF2DT(ip->i_inode.i_mode)); print_dbg(gi, " type = %u\n", IF2DT(ip->i_inode.i_mode));
print_dbg(gi, " i_flags ="); print_dbg(gi, " i_flags =");
for (x = 0; x < 32; x++) for (x = 0; x < 32; x++)
......
...@@ -213,8 +213,8 @@ enum { ...@@ -213,8 +213,8 @@ enum {
struct gfs2_inode { struct gfs2_inode {
struct inode i_inode; struct inode i_inode;
struct gfs2_inum_host i_num; u64 i_no_addr;
u64 i_no_formal_ino;
unsigned long i_flags; /* GIF_... */ unsigned long i_flags; /* GIF_... */
struct gfs2_dinode_host i_di; /* To be replaced by ref to block */ struct gfs2_dinode_host i_di; /* To be replaced by ref to block */
......
...@@ -41,9 +41,9 @@ ...@@ -41,9 +41,9 @@
static int iget_test(struct inode *inode, void *opaque) static int iget_test(struct inode *inode, void *opaque)
{ {
struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_inum_host *inum = opaque; u64 *no_addr = opaque;
if (ip->i_num.no_addr == inum->no_addr && if (ip->i_no_addr == *no_addr &&
inode->i_private != NULL) inode->i_private != NULL)
return 1; return 1;
...@@ -53,37 +53,37 @@ static int iget_test(struct inode *inode, void *opaque) ...@@ -53,37 +53,37 @@ static int iget_test(struct inode *inode, void *opaque)
static int iget_set(struct inode *inode, void *opaque) static int iget_set(struct inode *inode, void *opaque)
{ {
struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_inum_host *inum = opaque; u64 *no_addr = opaque;
ip->i_num = *inum; inode->i_ino = (unsigned long)*no_addr;
inode->i_ino = inum->no_addr; ip->i_no_addr = *no_addr;
return 0; return 0;
} }
struct inode *gfs2_ilookup(struct super_block *sb, struct gfs2_inum_host *inum) struct inode *gfs2_ilookup(struct super_block *sb, u64 no_addr)
{ {
return ilookup5(sb, (unsigned long)inum->no_addr, unsigned long hash = (unsigned long)no_addr;
iget_test, inum); return ilookup5(sb, hash, iget_test, &no_addr);
} }
static struct inode *gfs2_iget(struct super_block *sb, struct gfs2_inum_host *inum) static struct inode *gfs2_iget(struct super_block *sb, u64 no_addr)
{ {
return iget5_locked(sb, (unsigned long)inum->no_addr, unsigned long hash = (unsigned long)no_addr;
iget_test, iget_set, inum); return iget5_locked(sb, hash, iget_test, iget_set, &no_addr);
} }
/** /**
* gfs2_inode_lookup - Lookup an inode * gfs2_inode_lookup - Lookup an inode
* @sb: The super block * @sb: The super block
* @inum: The inode number * @no_addr: The inode number
* @type: The type of the inode * @type: The type of the inode
* *
* Returns: A VFS inode, or an error * Returns: A VFS inode, or an error
*/ */
struct inode *gfs2_inode_lookup(struct super_block *sb, struct gfs2_inum_host *inum, unsigned int type) struct inode *gfs2_inode_lookup(struct super_block *sb, u64 no_addr, unsigned int type)
{ {
struct inode *inode = gfs2_iget(sb, inum); struct inode *inode = gfs2_iget(sb, no_addr);
struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_glock *io_gl; struct gfs2_glock *io_gl;
int error; int error;
...@@ -110,12 +110,12 @@ struct inode *gfs2_inode_lookup(struct super_block *sb, struct gfs2_inum_host *i ...@@ -110,12 +110,12 @@ struct inode *gfs2_inode_lookup(struct super_block *sb, struct gfs2_inum_host *i
inode->i_op = &gfs2_dev_iops; inode->i_op = &gfs2_dev_iops;
} }
error = gfs2_glock_get(sdp, inum->no_addr, &gfs2_inode_glops, CREATE, &ip->i_gl); error = gfs2_glock_get(sdp, no_addr, &gfs2_inode_glops, CREATE, &ip->i_gl);
if (unlikely(error)) if (unlikely(error))
goto fail; goto fail;
ip->i_gl->gl_object = ip; ip->i_gl->gl_object = ip;
error = gfs2_glock_get(sdp, inum->no_addr, &gfs2_iopen_glops, CREATE, &io_gl); error = gfs2_glock_get(sdp, no_addr, &gfs2_iopen_glops, CREATE, &io_gl);
if (unlikely(error)) if (unlikely(error))
goto fail_put; goto fail_put;
...@@ -144,14 +144,12 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf) ...@@ -144,14 +144,12 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
struct gfs2_dinode_host *di = &ip->i_di; struct gfs2_dinode_host *di = &ip->i_di;
const struct gfs2_dinode *str = buf; const struct gfs2_dinode *str = buf;
if (ip->i_num.no_addr != be64_to_cpu(str->di_num.no_addr)) { if (ip->i_no_addr != be64_to_cpu(str->di_num.no_addr)) {
if (gfs2_consist_inode(ip)) if (gfs2_consist_inode(ip))
gfs2_dinode_print(ip); gfs2_dinode_print(ip);
return -EIO; return -EIO;
} }
if (ip->i_num.no_formal_ino != be64_to_cpu(str->di_num.no_formal_ino)) ip->i_no_formal_ino = be64_to_cpu(str->di_num.no_formal_ino);
return -ESTALE;
ip->i_inode.i_mode = be32_to_cpu(str->di_mode); ip->i_inode.i_mode = be32_to_cpu(str->di_mode);
ip->i_inode.i_rdev = 0; ip->i_inode.i_rdev = 0;
switch (ip->i_inode.i_mode & S_IFMT) { switch (ip->i_inode.i_mode & S_IFMT) {
...@@ -247,7 +245,7 @@ int gfs2_dinode_dealloc(struct gfs2_inode *ip) ...@@ -247,7 +245,7 @@ int gfs2_dinode_dealloc(struct gfs2_inode *ip)
if (error) if (error)
goto out_qs; goto out_qs;
rgd = gfs2_blk2rgrpd(sdp, ip->i_num.no_addr); rgd = gfs2_blk2rgrpd(sdp, ip->i_no_addr);
if (!rgd) { if (!rgd) {
gfs2_consist_inode(ip); gfs2_consist_inode(ip);
error = -EIO; error = -EIO;
...@@ -366,8 +364,6 @@ struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name, ...@@ -366,8 +364,6 @@ struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name,
struct super_block *sb = dir->i_sb; struct super_block *sb = dir->i_sb;
struct gfs2_inode *dip = GFS2_I(dir); struct gfs2_inode *dip = GFS2_I(dir);
struct gfs2_holder d_gh; struct gfs2_holder d_gh;
struct gfs2_inum_host inum;
unsigned int type;
int error; int error;
struct inode *inode = NULL; struct inode *inode = NULL;
int unlock = 0; int unlock = 0;
...@@ -395,12 +391,9 @@ struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name, ...@@ -395,12 +391,9 @@ struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name,
goto out; goto out;
} }
error = gfs2_dir_search(dir, name, &inum, &type); inode = gfs2_dir_search(dir, name);
if (error) if (IS_ERR(inode))
goto out; error = PTR_ERR(inode);
inode = gfs2_inode_lookup(sb, &inum, type);
out: out:
if (unlock) if (unlock)
gfs2_glock_dq_uninit(&d_gh); gfs2_glock_dq_uninit(&d_gh);
...@@ -548,7 +541,7 @@ static int create_ok(struct gfs2_inode *dip, const struct qstr *name, ...@@ -548,7 +541,7 @@ static int create_ok(struct gfs2_inode *dip, const struct qstr *name,
if (!dip->i_inode.i_nlink) if (!dip->i_inode.i_nlink)
return -EPERM; return -EPERM;
error = gfs2_dir_search(&dip->i_inode, name, NULL, NULL); error = gfs2_dir_check(&dip->i_inode, name, NULL);
switch (error) { switch (error) {
case -ENOENT: case -ENOENT:
error = 0; error = 0;
...@@ -588,8 +581,7 @@ static void munge_mode_uid_gid(struct gfs2_inode *dip, unsigned int *mode, ...@@ -588,8 +581,7 @@ static void munge_mode_uid_gid(struct gfs2_inode *dip, unsigned int *mode,
*gid = current->fsgid; *gid = current->fsgid;
} }
static int alloc_dinode(struct gfs2_inode *dip, struct gfs2_inum_host *inum, static int alloc_dinode(struct gfs2_inode *dip, u64 *no_addr, u64 *generation)
u64 *generation)
{ {
struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode);
int error; int error;
...@@ -605,7 +597,7 @@ static int alloc_dinode(struct gfs2_inode *dip, struct gfs2_inum_host *inum, ...@@ -605,7 +597,7 @@ static int alloc_dinode(struct gfs2_inode *dip, struct gfs2_inum_host *inum,
if (error) if (error)
goto out_ipreserv; goto out_ipreserv;
inum->no_addr = gfs2_alloc_di(dip, generation); *no_addr = gfs2_alloc_di(dip, generation);
gfs2_trans_end(sdp); gfs2_trans_end(sdp);
...@@ -760,7 +752,7 @@ static int link_dinode(struct gfs2_inode *dip, const struct qstr *name, ...@@ -760,7 +752,7 @@ static int link_dinode(struct gfs2_inode *dip, const struct qstr *name,
goto fail_quota_locks; goto fail_quota_locks;
} }
error = gfs2_dir_add(&dip->i_inode, name, &ip->i_num, IF2DT(ip->i_inode.i_mode)); error = gfs2_dir_add(&dip->i_inode, name, ip, IF2DT(ip->i_inode.i_mode));
if (error) if (error)
goto fail_end_trans; goto fail_end_trans;
...@@ -844,7 +836,7 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name, ...@@ -844,7 +836,7 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name,
struct gfs2_inode *dip = ghs->gh_gl->gl_object; struct gfs2_inode *dip = ghs->gh_gl->gl_object;
struct inode *dir = &dip->i_inode; struct inode *dir = &dip->i_inode;
struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode);
struct gfs2_inum_host inum; struct gfs2_inum_host inum = { .no_addr = 0, .no_formal_ino = 0 };
int error; int error;
u64 generation; u64 generation;
...@@ -864,7 +856,7 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name, ...@@ -864,7 +856,7 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name,
if (error) if (error)
goto fail_gunlock; goto fail_gunlock;
error = alloc_dinode(dip, &inum, &generation); error = alloc_dinode(dip, &inum.no_addr, &generation);
if (error) if (error)
goto fail_gunlock; goto fail_gunlock;
...@@ -877,7 +869,7 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name, ...@@ -877,7 +869,7 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name,
if (error) if (error)
goto fail_gunlock2; goto fail_gunlock2;
inode = gfs2_inode_lookup(dir->i_sb, &inum, IF2DT(mode)); inode = gfs2_inode_lookup(dir->i_sb, inum.no_addr, IF2DT(mode));
if (IS_ERR(inode)) if (IS_ERR(inode))
goto fail_gunlock2; goto fail_gunlock2;
...@@ -976,10 +968,8 @@ int gfs2_rmdiri(struct gfs2_inode *dip, const struct qstr *name, ...@@ -976,10 +968,8 @@ int gfs2_rmdiri(struct gfs2_inode *dip, const struct qstr *name,
*/ */
int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name, int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name,
struct gfs2_inode *ip) const struct gfs2_inode *ip)
{ {
struct gfs2_inum_host inum;
unsigned int type;
int error; int error;
if (IS_IMMUTABLE(&ip->i_inode) || IS_APPEND(&ip->i_inode)) if (IS_IMMUTABLE(&ip->i_inode) || IS_APPEND(&ip->i_inode))
...@@ -997,18 +987,10 @@ int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name, ...@@ -997,18 +987,10 @@ int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name,
if (error) if (error)
return error; return error;
error = gfs2_dir_search(&dip->i_inode, name, &inum, &type); error = gfs2_dir_check(&dip->i_inode, name, ip);
if (error) if (error)
return error; return error;
if (!gfs2_inum_equal(&inum, &ip->i_num))
return -ENOENT;
if (IF2DT(ip->i_inode.i_mode) != type) {
gfs2_consist_inode(dip);
return -EIO;
}
return 0; return 0;
} }
......
...@@ -10,17 +10,17 @@ ...@@ -10,17 +10,17 @@
#ifndef __INODE_DOT_H__ #ifndef __INODE_DOT_H__
#define __INODE_DOT_H__ #define __INODE_DOT_H__
static inline int gfs2_is_stuffed(struct gfs2_inode *ip) static inline int gfs2_is_stuffed(const struct gfs2_inode *ip)
{ {
return !ip->i_di.di_height; return !ip->i_di.di_height;
} }
static inline int gfs2_is_jdata(struct gfs2_inode *ip) static inline int gfs2_is_jdata(const struct gfs2_inode *ip)
{ {
return ip->i_di.di_flags & GFS2_DIF_JDATA; return ip->i_di.di_flags & GFS2_DIF_JDATA;
} }
static inline int gfs2_is_dir(struct gfs2_inode *ip) static inline int gfs2_is_dir(const struct gfs2_inode *ip)
{ {
return S_ISDIR(ip->i_inode.i_mode); return S_ISDIR(ip->i_inode.i_mode);
} }
...@@ -32,9 +32,15 @@ static inline void gfs2_set_inode_blocks(struct inode *inode) ...@@ -32,9 +32,15 @@ static inline void gfs2_set_inode_blocks(struct inode *inode)
(GFS2_SB(inode)->sd_sb.sb_bsize_shift - GFS2_BASIC_BLOCK_SHIFT); (GFS2_SB(inode)->sd_sb.sb_bsize_shift - GFS2_BASIC_BLOCK_SHIFT);
} }
static inline int gfs2_check_inum(const struct gfs2_inode *ip, u64 no_addr,
u64 no_formal_ino)
{
return ip->i_no_addr == no_addr && ip->i_no_formal_ino == no_formal_ino;
}
void gfs2_inode_attr_in(struct gfs2_inode *ip); void gfs2_inode_attr_in(struct gfs2_inode *ip);
struct inode *gfs2_inode_lookup(struct super_block *sb, struct gfs2_inum_host *inum, unsigned type); struct inode *gfs2_inode_lookup(struct super_block *sb, u64 no_addr, unsigned type);
struct inode *gfs2_ilookup(struct super_block *sb, struct gfs2_inum_host *inum); struct inode *gfs2_ilookup(struct super_block *sb, u64 no_addr);
int gfs2_inode_refresh(struct gfs2_inode *ip); int gfs2_inode_refresh(struct gfs2_inode *ip);
...@@ -47,7 +53,7 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name, ...@@ -47,7 +53,7 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name,
int gfs2_rmdiri(struct gfs2_inode *dip, const struct qstr *name, int gfs2_rmdiri(struct gfs2_inode *dip, const struct qstr *name,
struct gfs2_inode *ip); struct gfs2_inode *ip);
int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name, int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name,
struct gfs2_inode *ip); const struct gfs2_inode *ip);