[GFS2] split and annotate gfs2_inum

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
This commit is contained in:
Al Viro 2006-10-13 22:51:24 -04:00 committed by Steven Whitehouse
parent 1e81c4c3e0
commit 629a21e7ec
12 changed files with 46 additions and 41 deletions

View file

@ -1194,7 +1194,7 @@ static int do_filldir_main(struct gfs2_inode *dip, u64 *offset,
int *copied) int *copied)
{ {
const struct gfs2_dirent *dent, *dent_next; const struct gfs2_dirent *dent, *dent_next;
struct gfs2_inum inum; struct gfs2_inum_host inum;
u64 off, off_next; u64 off, off_next;
unsigned int x, y; unsigned int x, y;
int run = 0; int run = 0;
@ -1456,7 +1456,7 @@ out:
*/ */
int gfs2_dir_search(struct inode *dir, const struct qstr *name, int gfs2_dir_search(struct inode *dir, const struct qstr *name,
struct gfs2_inum *inum, unsigned int *type) struct gfs2_inum_host *inum, unsigned int *type)
{ {
struct buffer_head *bh; struct buffer_head *bh;
struct gfs2_dirent *dent; struct gfs2_dirent *dent;
@ -1531,7 +1531,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 *inum, unsigned type) const struct gfs2_inum_host *inum, unsigned type)
{ {
struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_inode *ip = GFS2_I(inode);
struct buffer_head *bh; struct buffer_head *bh;
@ -1666,7 +1666,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 *inum, unsigned int new_type) struct gfs2_inum_host *inum, unsigned int new_type)
{ {
struct buffer_head *bh; struct buffer_head *bh;
struct gfs2_dirent *dent; struct gfs2_dirent *dent;

View file

@ -31,17 +31,17 @@ struct gfs2_inum;
typedef int (*gfs2_filldir_t) (void *opaque, typedef int (*gfs2_filldir_t) (void *opaque,
const char *name, unsigned int length, const char *name, unsigned int length,
u64 offset, u64 offset,
struct gfs2_inum *inum, unsigned int type); struct gfs2_inum_host *inum, unsigned int type);
int gfs2_dir_search(struct inode *dir, const struct qstr *filename, int gfs2_dir_search(struct inode *dir, const struct qstr *filename,
struct gfs2_inum *inum, unsigned int *type); struct gfs2_inum_host *inum, unsigned int *type);
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 *inum, unsigned int type); const struct gfs2_inum_host *inum, 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,
gfs2_filldir_t filldir); gfs2_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 *new_inum, unsigned int new_type); struct gfs2_inum_host *new_inum, unsigned int new_type);
int gfs2_dir_exhash_dealloc(struct gfs2_inode *dip); int gfs2_dir_exhash_dealloc(struct gfs2_inode *dip);

View file

@ -224,7 +224,7 @@ enum {
struct gfs2_inode { struct gfs2_inode {
struct inode i_inode; struct inode i_inode;
struct gfs2_inum i_num; struct gfs2_inum_host i_num;
unsigned long i_flags; /* GIF_... */ unsigned long i_flags; /* GIF_... */

View file

@ -112,7 +112,7 @@ void gfs2_inode_attr_out(struct gfs2_inode *ip)
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 *inum = opaque; struct gfs2_inum_host *inum = opaque;
if (ip && ip->i_num.no_addr == inum->no_addr) if (ip && ip->i_num.no_addr == inum->no_addr)
return 1; return 1;
@ -123,19 +123,19 @@ 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 *inum = opaque; struct gfs2_inum_host *inum = opaque;
ip->i_num = *inum; ip->i_num = *inum;
return 0; return 0;
} }
struct inode *gfs2_ilookup(struct super_block *sb, struct gfs2_inum *inum) struct inode *gfs2_ilookup(struct super_block *sb, struct gfs2_inum_host *inum)
{ {
return ilookup5(sb, (unsigned long)inum->no_formal_ino, return ilookup5(sb, (unsigned long)inum->no_formal_ino,
iget_test, inum); iget_test, inum);
} }
static struct inode *gfs2_iget(struct super_block *sb, struct gfs2_inum *inum) static struct inode *gfs2_iget(struct super_block *sb, struct gfs2_inum_host *inum)
{ {
return iget5_locked(sb, (unsigned long)inum->no_formal_ino, return iget5_locked(sb, (unsigned long)inum->no_formal_ino,
iget_test, iget_set, inum); iget_test, iget_set, inum);
@ -150,7 +150,7 @@ static struct inode *gfs2_iget(struct super_block *sb, struct gfs2_inum *inum)
* 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 *inum, unsigned int type) struct inode *gfs2_inode_lookup(struct super_block *sb, struct gfs2_inum_host *inum, unsigned int type)
{ {
struct inode *inode = gfs2_iget(sb, inum); struct inode *inode = gfs2_iget(sb, inum);
struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_inode *ip = GFS2_I(inode);
@ -394,7 +394,7 @@ 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 inum; struct gfs2_inum_host inum;
unsigned int type; unsigned int type;
int error = 0; int error = 0;
struct inode *inode = NULL; struct inode *inode = NULL;
@ -610,7 +610,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 *inum, static int alloc_dinode(struct gfs2_inode *dip, struct gfs2_inum_host *inum,
u64 *generation) u64 *generation)
{ {
struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode);
@ -650,7 +650,7 @@ out:
*/ */
static void init_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl, static void init_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl,
const struct gfs2_inum *inum, unsigned int mode, const struct gfs2_inum_host *inum, unsigned int mode,
unsigned int uid, unsigned int gid, unsigned int uid, unsigned int gid,
const u64 *generation) const u64 *generation)
{ {
@ -707,7 +707,7 @@ static void init_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl,
} }
static int make_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl, static int make_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl,
unsigned int mode, const struct gfs2_inum *inum, unsigned int mode, const struct gfs2_inum_host *inum,
const u64 *generation) const u64 *generation)
{ {
struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode);
@ -866,7 +866,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 inum; struct gfs2_inum_host inum;
int error; int error;
u64 generation; u64 generation;
@ -1018,7 +1018,7 @@ 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) struct gfs2_inode *ip)
{ {
struct gfs2_inum inum; struct gfs2_inum_host inum;
unsigned int type; unsigned int type;
int error; int error;

View file

@ -27,8 +27,8 @@ static inline int gfs2_is_dir(struct gfs2_inode *ip)
void gfs2_inode_attr_in(struct gfs2_inode *ip); void gfs2_inode_attr_in(struct gfs2_inode *ip);
void gfs2_inode_attr_out(struct gfs2_inode *ip); void gfs2_inode_attr_out(struct gfs2_inode *ip);
struct inode *gfs2_inode_lookup(struct super_block *sb, struct gfs2_inum *inum, unsigned type); struct inode *gfs2_inode_lookup(struct super_block *sb, struct gfs2_inum_host *inum, unsigned type);
struct inode *gfs2_ilookup(struct super_block *sb, struct gfs2_inum *inum); struct inode *gfs2_ilookup(struct super_block *sb, struct gfs2_inum_host *inum);
int gfs2_inode_refresh(struct gfs2_inode *ip); int gfs2_inode_refresh(struct gfs2_inode *ip);

View file

@ -32,7 +32,7 @@
* first arg: the cpu-order structure * first arg: the cpu-order structure
*/ */
void gfs2_inum_in(struct gfs2_inum *no, const void *buf) void gfs2_inum_in(struct gfs2_inum_host *no, const void *buf)
{ {
const struct gfs2_inum *str = buf; const struct gfs2_inum *str = buf;
@ -40,7 +40,7 @@ void gfs2_inum_in(struct gfs2_inum *no, const void *buf)
no->no_addr = be64_to_cpu(str->no_addr); no->no_addr = be64_to_cpu(str->no_addr);
} }
void gfs2_inum_out(const struct gfs2_inum *no, void *buf) void gfs2_inum_out(const struct gfs2_inum_host *no, void *buf)
{ {
struct gfs2_inum *str = buf; struct gfs2_inum *str = buf;
@ -48,7 +48,7 @@ void gfs2_inum_out(const struct gfs2_inum *no, void *buf)
str->no_addr = cpu_to_be64(no->no_addr); str->no_addr = cpu_to_be64(no->no_addr);
} }
static void gfs2_inum_print(const struct gfs2_inum *no) static void gfs2_inum_print(const struct gfs2_inum_host *no)
{ {
printk(KERN_INFO " no_formal_ino = %llu\n", (unsigned long long)no->no_formal_ino); printk(KERN_INFO " no_formal_ino = %llu\n", (unsigned long long)no->no_formal_ino);
printk(KERN_INFO " no_addr = %llu\n", (unsigned long long)no->no_addr); printk(KERN_INFO " no_addr = %llu\n", (unsigned long long)no->no_addr);

View file

@ -43,7 +43,7 @@ static int gfs2_drevalidate(struct dentry *dentry, struct nameidata *nd)
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
struct gfs2_holder d_gh; struct gfs2_holder d_gh;
struct gfs2_inode *ip; struct gfs2_inode *ip;
struct gfs2_inum inum; struct gfs2_inum_host inum;
unsigned int type; unsigned int type;
int error; int error;

View file

@ -35,7 +35,7 @@ static struct dentry *gfs2_decode_fh(struct super_block *sb,
void *context) void *context)
{ {
struct gfs2_fh_obj fh_obj; struct gfs2_fh_obj fh_obj;
struct gfs2_inum *this, parent; struct gfs2_inum_host *this, parent;
if (fh_type != fh_len) if (fh_type != fh_len)
return NULL; return NULL;
@ -114,12 +114,12 @@ static int gfs2_encode_fh(struct dentry *dentry, __u32 *fh, int *len,
} }
struct get_name_filldir { struct get_name_filldir {
struct gfs2_inum inum; struct gfs2_inum_host inum;
char *name; char *name;
}; };
static int get_name_filldir(void *opaque, const char *name, unsigned int length, static int get_name_filldir(void *opaque, const char *name, unsigned int length,
u64 offset, struct gfs2_inum *inum, u64 offset, struct gfs2_inum_host *inum,
unsigned int type) unsigned int type)
{ {
struct get_name_filldir *gnfd = (struct get_name_filldir *)opaque; struct get_name_filldir *gnfd = (struct get_name_filldir *)opaque;
@ -202,7 +202,7 @@ static struct dentry *gfs2_get_dentry(struct super_block *sb, void *inum_obj)
{ {
struct gfs2_sbd *sdp = sb->s_fs_info; struct gfs2_sbd *sdp = sb->s_fs_info;
struct gfs2_fh_obj *fh_obj = (struct gfs2_fh_obj *)inum_obj; struct gfs2_fh_obj *fh_obj = (struct gfs2_fh_obj *)inum_obj;
struct gfs2_inum *inum = &fh_obj->this; struct gfs2_inum_host *inum = &fh_obj->this;
struct gfs2_holder i_gh, ri_gh, rgd_gh; struct gfs2_holder i_gh, ri_gh, rgd_gh;
struct gfs2_rgrpd *rgd; struct gfs2_rgrpd *rgd;
struct inode *inode; struct inode *inode;

View file

@ -15,7 +15,7 @@
extern struct export_operations gfs2_export_ops; extern struct export_operations gfs2_export_ops;
struct gfs2_fh_obj { struct gfs2_fh_obj {
struct gfs2_inum this; struct gfs2_inum_host this;
__u32 imode; __u32 imode;
}; };

View file

@ -139,7 +139,7 @@ static loff_t gfs2_llseek(struct file *file, loff_t offset, int origin)
*/ */
static int filldir_func(void *opaque, const char *name, unsigned int length, static int filldir_func(void *opaque, const char *name, unsigned int length,
u64 offset, struct gfs2_inum *inum, u64 offset, struct gfs2_inum_host *inum,
unsigned int type) unsigned int type)
{ {
struct filldir_reg *fdr = (struct filldir_reg *)opaque; struct filldir_reg *fdr = (struct filldir_reg *)opaque;

View file

@ -237,7 +237,7 @@ fail:
} }
static struct inode *gfs2_lookup_root(struct super_block *sb, static struct inode *gfs2_lookup_root(struct super_block *sb,
struct gfs2_inum *inum) struct gfs2_inum_host *inum)
{ {
return gfs2_inode_lookup(sb, inum, DT_DIR); return gfs2_inode_lookup(sb, inum, DT_DIR);
} }
@ -246,7 +246,7 @@ static int init_sb(struct gfs2_sbd *sdp, int silent, int undo)
{ {
struct super_block *sb = sdp->sd_vfs; struct super_block *sb = sdp->sd_vfs;
struct gfs2_holder sb_gh; struct gfs2_holder sb_gh;
struct gfs2_inum *inum; struct gfs2_inum_host *inum;
struct inode *inode; struct inode *inode;
int error = 0; int error = 0;

View file

@ -54,8 +54,13 @@ struct gfs2_inum {
__be64 no_addr; __be64 no_addr;
}; };
static inline int gfs2_inum_equal(const struct gfs2_inum *ino1, struct gfs2_inum_host {
const struct gfs2_inum *ino2) __u64 no_formal_ino;
__u64 no_addr;
};
static inline int gfs2_inum_equal(const struct gfs2_inum_host *ino1,
const struct gfs2_inum_host *ino2)
{ {
return ino1->no_formal_ino == ino2->no_formal_ino && return ino1->no_formal_ino == ino2->no_formal_ino &&
ino1->no_addr == ino2->no_addr; ino1->no_addr == ino2->no_addr;
@ -143,8 +148,8 @@ struct gfs2_sb_host {
__u32 sb_bsize; __u32 sb_bsize;
__u32 sb_bsize_shift; __u32 sb_bsize_shift;
struct gfs2_inum sb_master_dir; /* Was jindex dinode in gfs1 */ struct gfs2_inum_host sb_master_dir; /* Was jindex dinode in gfs1 */
struct gfs2_inum sb_root_dir; struct gfs2_inum_host sb_root_dir;
char sb_lockproto[GFS2_LOCKNAME_LEN]; char sb_lockproto[GFS2_LOCKNAME_LEN];
char sb_locktable[GFS2_LOCKNAME_LEN]; char sb_locktable[GFS2_LOCKNAME_LEN];
@ -313,7 +318,7 @@ struct gfs2_dinode {
struct gfs2_dinode_host { struct gfs2_dinode_host {
struct gfs2_meta_header_host di_header; struct gfs2_meta_header_host di_header;
struct gfs2_inum di_num; struct gfs2_inum_host di_num;
__u32 di_mode; /* mode of file */ __u32 di_mode; /* mode of file */
__u32 di_uid; /* owner's user id */ __u32 di_uid; /* owner's user id */
@ -503,8 +508,8 @@ struct gfs2_quota_change {
#ifdef __KERNEL__ #ifdef __KERNEL__
/* Translation functions */ /* Translation functions */
extern void gfs2_inum_in(struct gfs2_inum *no, const void *buf); extern void gfs2_inum_in(struct gfs2_inum_host *no, const void *buf);
extern void gfs2_inum_out(const struct gfs2_inum *no, void *buf); extern void gfs2_inum_out(const struct gfs2_inum_host *no, void *buf);
extern void gfs2_sb_in(struct gfs2_sb_host *sb, const void *buf); extern void gfs2_sb_in(struct gfs2_sb_host *sb, const void *buf);
extern void gfs2_rindex_in(struct gfs2_rindex_host *ri, const void *buf); extern void gfs2_rindex_in(struct gfs2_rindex_host *ri, const void *buf);
extern void gfs2_rindex_out(const struct gfs2_rindex_host *ri, void *buf); extern void gfs2_rindex_out(const struct gfs2_rindex_host *ri, void *buf);