Skip to content

Commit

Permalink
[GFS2] split and annotate gfs2_inum
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <[email protected]>
Signed-off-by: Steven Whitehouse <[email protected]>
  • Loading branch information
Al Viro authored and swhiteho committed Nov 30, 2006
1 parent 1e81c4c commit 629a21e
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 41 deletions.
8 changes: 4 additions & 4 deletions fs/gfs2/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,7 @@ static int do_filldir_main(struct gfs2_inode *dip, u64 *offset,
int *copied)
{
const struct gfs2_dirent *dent, *dent_next;
struct gfs2_inum inum;
struct gfs2_inum_host inum;
u64 off, off_next;
unsigned int x, y;
int run = 0;
Expand Down Expand Up @@ -1456,7 +1456,7 @@ int gfs2_dir_read(struct inode *inode, u64 *offset, void *opaque,
*/

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 gfs2_dirent *dent;
Expand Down Expand Up @@ -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,
const struct gfs2_inum *inum, unsigned type)
const struct gfs2_inum_host *inum, unsigned type)
{
struct gfs2_inode *ip = GFS2_I(inode);
struct buffer_head *bh;
Expand Down Expand Up @@ -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,
struct gfs2_inum *inum, unsigned int new_type)
struct gfs2_inum_host *inum, unsigned int new_type)
{
struct buffer_head *bh;
struct gfs2_dirent *dent;
Expand Down
8 changes: 4 additions & 4 deletions fs/gfs2/dir.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ struct gfs2_inum;
typedef int (*gfs2_filldir_t) (void *opaque,
const char *name, unsigned int length,
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,
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,
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_read(struct inode *inode, u64 * offset, void *opaque,
gfs2_filldir_t filldir);
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);

Expand Down
2 changes: 1 addition & 1 deletion fs/gfs2/incore.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ enum {

struct gfs2_inode {
struct inode i_inode;
struct gfs2_inum i_num;
struct gfs2_inum_host i_num;

unsigned long i_flags; /* GIF_... */

Expand Down
22 changes: 11 additions & 11 deletions fs/gfs2/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void gfs2_inode_attr_out(struct gfs2_inode *ip)
static int iget_test(struct inode *inode, void *opaque)
{
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)
return 1;
Expand All @@ -123,19 +123,19 @@ static int iget_test(struct inode *inode, void *opaque)
static int iget_set(struct inode *inode, void *opaque)
{
struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_inum *inum = opaque;
struct gfs2_inum_host *inum = opaque;

ip->i_num = *inum;
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,
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,
iget_test, iget_set, inum);
Expand All @@ -150,7 +150,7 @@ static struct inode *gfs2_iget(struct super_block *sb, struct gfs2_inum *inum)
* 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 gfs2_inode *ip = GFS2_I(inode);
Expand Down Expand Up @@ -394,7 +394,7 @@ struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name,
struct super_block *sb = dir->i_sb;
struct gfs2_inode *dip = GFS2_I(dir);
struct gfs2_holder d_gh;
struct gfs2_inum inum;
struct gfs2_inum_host inum;
unsigned int type;
int error = 0;
struct inode *inode = NULL;
Expand Down Expand Up @@ -610,7 +610,7 @@ static void munge_mode_uid_gid(struct gfs2_inode *dip, unsigned int *mode,
*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)
{
struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode);
Expand Down Expand Up @@ -650,7 +650,7 @@ static int alloc_dinode(struct gfs2_inode *dip, struct gfs2_inum *inum,
*/

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,
const u64 *generation)
{
Expand Down Expand Up @@ -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,
unsigned int mode, const struct gfs2_inum *inum,
unsigned int mode, const struct gfs2_inum_host *inum,
const u64 *generation)
{
struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode);
Expand Down Expand Up @@ -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 inode *dir = &dip->i_inode;
struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode);
struct gfs2_inum inum;
struct gfs2_inum_host inum;
int error;
u64 generation;

Expand Down Expand Up @@ -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,
struct gfs2_inode *ip)
{
struct gfs2_inum inum;
struct gfs2_inum_host inum;
unsigned int type;
int error;

Expand Down
4 changes: 2 additions & 2 deletions fs/gfs2/inode.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_out(struct gfs2_inode *ip);
struct inode *gfs2_inode_lookup(struct super_block *sb, struct gfs2_inum *inum, unsigned type);
struct inode *gfs2_ilookup(struct super_block *sb, struct gfs2_inum *inum);
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_host *inum);

int gfs2_inode_refresh(struct gfs2_inode *ip);

Expand Down
6 changes: 3 additions & 3 deletions fs/gfs2/ondisk.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,23 @@
* 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;

no->no_formal_ino = be64_to_cpu(str->no_formal_ino);
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;

str->no_formal_ino = cpu_to_be64(no->no_formal_ino);
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_addr = %llu\n", (unsigned long long)no->no_addr);
Expand Down
2 changes: 1 addition & 1 deletion fs/gfs2/ops_dentry.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static int gfs2_drevalidate(struct dentry *dentry, struct nameidata *nd)
struct inode *inode = dentry->d_inode;
struct gfs2_holder d_gh;
struct gfs2_inode *ip;
struct gfs2_inum inum;
struct gfs2_inum_host inum;
unsigned int type;
int error;

Expand Down
8 changes: 4 additions & 4 deletions fs/gfs2/ops_export.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static struct dentry *gfs2_decode_fh(struct super_block *sb,
void *context)
{
struct gfs2_fh_obj fh_obj;
struct gfs2_inum *this, parent;
struct gfs2_inum_host *this, parent;

if (fh_type != fh_len)
return NULL;
Expand Down Expand Up @@ -114,12 +114,12 @@ static int gfs2_encode_fh(struct dentry *dentry, __u32 *fh, int *len,
}

struct get_name_filldir {
struct gfs2_inum inum;
struct gfs2_inum_host inum;
char *name;
};

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)
{
struct get_name_filldir *gnfd = (struct get_name_filldir *)opaque;
Expand Down Expand Up @@ -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_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_rgrpd *rgd;
struct inode *inode;
Expand Down
2 changes: 1 addition & 1 deletion fs/gfs2/ops_export.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

extern struct export_operations gfs2_export_ops;
struct gfs2_fh_obj {
struct gfs2_inum this;
struct gfs2_inum_host this;
__u32 imode;
};

Expand Down
2 changes: 1 addition & 1 deletion fs/gfs2/ops_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
u64 offset, struct gfs2_inum *inum,
u64 offset, struct gfs2_inum_host *inum,
unsigned int type)
{
struct filldir_reg *fdr = (struct filldir_reg *)opaque;
Expand Down
4 changes: 2 additions & 2 deletions fs/gfs2/ops_fstype.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ static int init_locking(struct gfs2_sbd *sdp, struct gfs2_holder *mount_gh,
}

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);
}
Expand All @@ -246,7 +246,7 @@ static int init_sb(struct gfs2_sbd *sdp, int silent, int undo)
{
struct super_block *sb = sdp->sd_vfs;
struct gfs2_holder sb_gh;
struct gfs2_inum *inum;
struct gfs2_inum_host *inum;
struct inode *inode;
int error = 0;

Expand Down
19 changes: 12 additions & 7 deletions include/linux/gfs2_ondisk.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,13 @@ struct gfs2_inum {
__be64 no_addr;
};

static inline int gfs2_inum_equal(const struct gfs2_inum *ino1,
const struct gfs2_inum *ino2)
struct gfs2_inum_host {
__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 &&
ino1->no_addr == ino2->no_addr;
Expand Down Expand Up @@ -143,8 +148,8 @@ struct gfs2_sb_host {
__u32 sb_bsize;
__u32 sb_bsize_shift;

struct gfs2_inum sb_master_dir; /* Was jindex dinode in gfs1 */
struct gfs2_inum sb_root_dir;
struct gfs2_inum_host sb_master_dir; /* Was jindex dinode in gfs1 */
struct gfs2_inum_host sb_root_dir;

char sb_lockproto[GFS2_LOCKNAME_LEN];
char sb_locktable[GFS2_LOCKNAME_LEN];
Expand Down Expand Up @@ -313,7 +318,7 @@ struct gfs2_dinode {
struct gfs2_dinode_host {
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_uid; /* owner's user id */
Expand Down Expand Up @@ -503,8 +508,8 @@ struct gfs2_quota_change {
#ifdef __KERNEL__
/* Translation functions */

extern void gfs2_inum_in(struct gfs2_inum *no, const void *buf);
extern void gfs2_inum_out(const struct gfs2_inum *no, void *buf);
extern void gfs2_inum_in(struct gfs2_inum_host *no, const 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_rindex_in(struct gfs2_rindex_host *ri, const void *buf);
extern void gfs2_rindex_out(const struct gfs2_rindex_host *ri, void *buf);
Expand Down

0 comments on commit 629a21e

Please sign in to comment.