diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2006-07-11 09:46:33 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-07-11 09:46:33 -0400 |
commit | 4340fe62531f7d1dafb6f5359ffe0378bdb0db80 (patch) | |
tree | 95ee3f2ace3b07e2fa89a9a01ccd5ac40a556eee /fs/gfs2/inode.c | |
parent | ffeb874b2b893aea7d10b0b088e06a7b1ded2a3e (diff) | |
download | linux-4340fe62531f7d1dafb6f5359ffe0378bdb0db80.tar.bz2 |
[GFS2] Add generation number
This adds a generation number for the eventual use of NFS to the
ondisk inode. Its backward compatible with the current code since
it doesn't really matter what the generation number is to start with,
and indeed since its set to zero, due to it being taken from padding
in both the inode and rgrp header, it should be fine.
The eventual plan is to use this rather than no_formal_ino in the
NFS filehandles. At that point no_formal_ino will be unused.
At the same time we also add a releasepages call back to the
"normal" address space for gfs2 inodes. Also I've removed a
one-linrer function thats not required any more.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/inode.c')
-rw-r--r-- | fs/gfs2/inode.c | 46 |
1 files changed, 20 insertions, 26 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index f4c48395208a..22ca3b5ddaea 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c @@ -38,15 +38,17 @@ #include "util.h" /** - * inode_attr_in - Copy attributes from the dinode into the VFS inode + * gfs2_inode_attr_in - Copy attributes from the dinode into the VFS inode * @ip: The GFS2 inode (with embedded disk inode data) * @inode: The Linux VFS inode * */ -static void inode_attr_in(struct gfs2_inode *ip, struct inode *inode) +void gfs2_inode_attr_in(struct gfs2_inode *ip) { - inode->i_ino = ip->i_num.no_formal_ino; + struct inode *inode = &ip->i_inode; + + inode->i_ino = ip->i_num.no_addr; switch (ip->i_di.di_mode & S_IFMT) { case S_IFBLK: @@ -85,18 +87,6 @@ static void inode_attr_in(struct gfs2_inode *ip, struct inode *inode) } /** - * gfs2_inode_attr_in - Copy attributes from the dinode into the VFS inode - * @ip: The GFS2 inode (with embedded disk inode data) - * - */ - -void gfs2_inode_attr_in(struct gfs2_inode *ip) -{ - struct inode *inode = &ip->i_inode; - inode_attr_in(ip, inode); -} - -/** * gfs2_inode_attr_out - Copy attributes from VFS inode into the dinode * @ip: The GFS2 inode * @@ -621,7 +611,8 @@ 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 *inum, + u64 *generation) { struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); int error; @@ -637,14 +628,14 @@ static int alloc_dinode(struct gfs2_inode *dip, struct gfs2_inum *inum) if (error) goto out_ipreserv; - inum->no_addr = gfs2_alloc_di(dip); + inum->no_addr = gfs2_alloc_di(dip, generation); gfs2_trans_end(sdp); - out_ipreserv: +out_ipreserv: gfs2_inplace_release(dip); - out: +out: gfs2_alloc_put(dip); return error; @@ -662,8 +653,9 @@ static int alloc_dinode(struct gfs2_inode *dip, struct gfs2_inum *inum) */ static void init_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl, - struct gfs2_inum *inum, unsigned int mode, - unsigned int uid, unsigned int gid) + const struct gfs2_inum *inum, unsigned int mode, + unsigned int uid, unsigned int gid, + const u64 *generation) { struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); struct gfs2_dinode *di; @@ -686,7 +678,7 @@ static void init_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl, di->di_atime = di->di_mtime = di->di_ctime = cpu_to_be64(get_seconds()); di->di_major = di->di_minor = cpu_to_be32(0); di->di_goal_meta = di->di_goal_data = cpu_to_be64(inum->no_addr); - di->__pad[0] = di->__pad[1] = 0; + di->di_generation = cpu_to_be64(*generation); di->di_flags = cpu_to_be32(0); if (S_ISREG(mode)) { @@ -717,7 +709,8 @@ 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, struct gfs2_inum *inum) + unsigned int mode, const struct gfs2_inum *inum, + const u64 *generation) { struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); unsigned int uid, gid; @@ -738,7 +731,7 @@ static int make_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl, if (error) goto out_quota; - init_dinode(dip, gl, inum, mode, uid, gid); + init_dinode(dip, gl, inum, mode, uid, gid, generation); gfs2_quota_change(dip, +1, uid, gid); gfs2_trans_end(sdp); @@ -844,6 +837,7 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name, struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); struct gfs2_inum inum; int error; + u64 generation; if (!name->len || name->len > GFS2_FNAMESIZE) return ERR_PTR(-ENAMETOOLONG); @@ -861,7 +855,7 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name, if (error) goto fail_gunlock; - error = alloc_dinode(dip, &inum); + error = alloc_dinode(dip, &inum, &generation); if (error) goto fail_gunlock; @@ -893,7 +887,7 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name, goto fail_gunlock; } - error = make_dinode(dip, ghs[1].gh_gl, mode, &inum); + error = make_dinode(dip, ghs[1].gh_gl, mode, &inum, &generation); if (error) goto fail_gunlock2; |