Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 38631
b: refs/heads/master
c: c9fd430
h: refs/heads/master
i:
  38629: 49fa2de
  38627: 5069ff1
  38623: 822063a
v: v3
  • Loading branch information
Steven Whitehouse committed Mar 1, 2006
1 parent f47a353 commit 35f8bb3
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 55 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e317ffcb7cc26c5e80cab97160a5e2761a4436ec
refs/heads/master: c9fd43078f5007c6ca6b3a9cd04c51a8f0e44a20
1 change: 0 additions & 1 deletion trunk/fs/gfs2/incore.h
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,6 @@ struct gfs2_sbd {
struct inode *sd_qc_inode;
struct inode *sd_rindex;
struct inode *sd_quota_inode;
struct inode *sd_root_dir;

/* Inum stuff */

Expand Down
13 changes: 7 additions & 6 deletions trunk/fs/gfs2/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ int gfs2_inode_refresh(struct gfs2_inode *ip)
* Returns: errno
*/

static int inode_create(struct gfs2_glock *i_gl, struct gfs2_inum *inum,
static int inode_create(struct gfs2_glock *i_gl, const struct gfs2_inum *inum,
struct gfs2_glock *io_gl, unsigned int io_state,
struct gfs2_inode **ipp)
{
Expand Down Expand Up @@ -354,8 +354,8 @@ static int inode_create(struct gfs2_glock *i_gl, struct gfs2_inum *inum,
* Returns: errno
*/

int gfs2_inode_get(struct gfs2_glock *i_gl, struct gfs2_inum *inum, int create,
struct gfs2_inode **ipp)
int gfs2_inode_get(struct gfs2_glock *i_gl, const struct gfs2_inum *inum,
int create, struct gfs2_inode **ipp)
{
struct gfs2_sbd *sdp = i_gl->gl_sbd;
struct gfs2_glock *io_gl;
Expand Down Expand Up @@ -718,6 +718,7 @@ int gfs2_change_nlink(struct gfs2_inode *ip, int diff)
int gfs2_lookupi(struct inode *dir, struct qstr *name, int is_root,
struct inode **inodep)
{
struct super_block *sb = dir->i_sb;
struct gfs2_inode *ipp;
struct gfs2_inode *dip = dir->u.generic_ip;
struct gfs2_sbd *sdp = dip->i_sbd;
Expand All @@ -733,7 +734,7 @@ int gfs2_lookupi(struct inode *dir, struct qstr *name, int is_root,
return -ENAMETOOLONG;

if (gfs2_filecmp(name, ".", 1) ||
(gfs2_filecmp(name, "..", 2) && dir == sdp->sd_root_dir)) {
(gfs2_filecmp(name, "..", 2) && dir == sb->s_root->d_inode)) {
gfs2_inode_hold(dip);
ipp = dip;
goto done;
Expand Down Expand Up @@ -1466,8 +1467,8 @@ int gfs2_unlink_ok(struct gfs2_inode *dip, struct qstr *name,

int gfs2_ok_to_move(struct gfs2_inode *this, struct gfs2_inode *to)
{
struct gfs2_sbd *sdp = this->i_sbd;
struct inode *dir = to->i_vnode;
struct super_block *sb = dir->i_sb;
struct inode *tmp;
struct qstr dotdot;
int error = 0;
Expand All @@ -1483,7 +1484,7 @@ int gfs2_ok_to_move(struct gfs2_inode *this, struct gfs2_inode *to)
error = -EINVAL;
break;
}
if (dir == sdp->sd_root_dir) {
if (dir == sb->s_root->d_inode) {
error = 0;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/gfs2/inode.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void gfs2_inode_min_init(struct gfs2_inode *ip, unsigned int type);
int gfs2_inode_refresh(struct gfs2_inode *ip);

int gfs2_inode_get(struct gfs2_glock *i_gl,
struct gfs2_inum *inum, int create,
const struct gfs2_inum *inum, int create,
struct gfs2_inode **ipp);
void gfs2_inode_hold(struct gfs2_inode *ip);
void gfs2_inode_put(struct gfs2_inode *ip);
Expand Down
4 changes: 2 additions & 2 deletions trunk/fs/gfs2/ops_export.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ static int gfs2_encode_fh(struct dentry *dentry, __u32 *fh, int *len,
int connectable)
{
struct inode *inode = dentry->d_inode;
struct super_block *sb = inode->i_sb;
struct gfs2_inode *ip = inode->u.generic_ip;
struct gfs2_sbd *sdp = ip->i_sbd;

if (*len < 4 || (connectable && *len < 8))
return 255;
Expand All @@ -80,7 +80,7 @@ static int gfs2_encode_fh(struct dentry *dentry, __u32 *fh, int *len,
fh[3] = cpu_to_be32(fh[3]);
*len = 4;

if (!connectable || ip == sdp->sd_root_dir->u.generic_ip)
if (!connectable || inode == sb->s_root->d_inode)
return *len;

spin_lock(&dentry->d_lock);
Expand Down
40 changes: 17 additions & 23 deletions trunk/fs/gfs2/ops_fstype.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,27 +280,30 @@ static int init_locking(struct gfs2_sbd *sdp, struct gfs2_holder *mount_gh,
return error;
}

int gfs2_lookup_root(struct gfs2_sbd *sdp)
static struct inode *gfs2_lookup_root(struct gfs2_sbd *sdp,
const struct gfs2_inum *inum)
{
int error;
struct gfs2_glock *gl;
struct gfs2_inode *ip;
struct inode *inode;

error = gfs2_glock_get(sdp, sdp->sd_sb.sb_root_dir.no_addr,
error = gfs2_glock_get(sdp, inum->no_addr,
&gfs2_inode_glops, CREATE, &gl);
if (!error) {
error = gfs2_inode_get(gl, &sdp->sd_sb.sb_root_dir,
error = gfs2_inode_get(gl, inum,
CREATE, &ip);
if (!error) {
if (!error)
gfs2_inode_min_init(ip, DT_DIR);
sdp->sd_root_dir = gfs2_ip2v(ip);
inode = gfs2_ip2v(ip);
gfs2_inode_put(ip);
return inode;
}
gfs2_glock_put(gl);
}

return error;
return ERR_PTR(error);
}

static int init_sb(struct gfs2_sbd *sdp, int silent, int undo)
Expand All @@ -311,7 +314,6 @@ static int init_sb(struct gfs2_sbd *sdp, int silent, int undo)
int error = 0;

if (undo) {
iput(sdp->sd_master_dir);
return 0;
}

Expand Down Expand Up @@ -351,35 +353,24 @@ static int init_sb(struct gfs2_sbd *sdp, int silent, int undo)
sb_set_blocksize(sb, sdp->sd_sb.sb_bsize);

/* Get the root inode */
error = gfs2_lookup_root(sdp);
if (error) {
inode = gfs2_lookup_root(sdp, &sdp->sd_sb.sb_root_dir);
if (IS_ERR(inode)) {
error = PTR_ERR(inode);
fs_err(sdp, "can't read in root inode: %d\n", error);
goto out;
}

/* Get the root inode/dentry */
inode = sdp->sd_root_dir;
if (!inode) {
fs_err(sdp, "can't get root inode\n");
error = -ENOMEM;
goto out_rooti;
}

igrab(inode);
sb->s_root = d_alloc_root(inode);
if (!sb->s_root) {
fs_err(sdp, "can't get root dentry\n");
error = -ENOMEM;
goto out_rooti;
iput(inode);
}

out:
gfs2_glock_dq_uninit(&sb_gh);

return error;
out_rooti:
iput(sdp->sd_root_dir);
goto out;
}

static int init_journal(struct gfs2_sbd *sdp, int undo)
Expand Down Expand Up @@ -529,15 +520,18 @@ static int init_inodes(struct gfs2_sbd *sdp, int undo)
{
int error = 0;
struct gfs2_inode *ip;
struct inode *inode;

if (undo)
goto fail_qinode;

error = gfs2_lookup_master_dir(sdp);
if (error) {
inode = gfs2_lookup_root(sdp, &sdp->sd_sb.sb_master_dir);
if (IS_ERR(inode)) {
error = PTR_ERR(inode);
fs_err(sdp, "can't read in master directory: %d\n", error);
goto fail;
}
sdp->sd_master_dir = inode;

error = init_journal(sdp, undo);
if (error)
Expand Down
1 change: 0 additions & 1 deletion trunk/fs/gfs2/ops_super.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ static void gfs2_put_super(struct super_block *sb)
iput(sdp->sd_statfs_inode);
iput(sdp->sd_rindex);
iput(sdp->sd_quota_inode);
iput(sdp->sd_root_dir);

gfs2_glock_put(sdp->sd_rename_gl);
gfs2_glock_put(sdp->sd_trans_gl);
Expand Down
19 changes: 0 additions & 19 deletions trunk/fs/gfs2/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,25 +447,6 @@ int gfs2_jdesc_check(struct gfs2_jdesc *jd)
return error;
}

int gfs2_lookup_master_dir(struct gfs2_sbd *sdp)
{
struct inode *inode = NULL;
struct gfs2_glock *gl;
int error;

error = gfs2_glock_get(sdp,
sdp->sd_sb.sb_master_dir.no_addr,
&gfs2_inode_glops, CREATE, &gl);
if (!error) {
error = gfs2_lookup_simple(sdp->sd_root_dir, ".gfs2_admin",
&inode);
sdp->sd_master_dir = inode;
gfs2_glock_put(gl);
}

return error;
}

/**
* gfs2_make_fs_rw - Turn a Read-Only FS into a Read-Write one
* @sdp: the filesystem
Expand Down
1 change: 0 additions & 1 deletion trunk/fs/gfs2/super.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ void gfs2_jdesc_make_dirty(struct gfs2_sbd *sdp, unsigned int jid);
struct gfs2_jdesc *gfs2_jdesc_find_dirty(struct gfs2_sbd *sdp);
int gfs2_jdesc_check(struct gfs2_jdesc *jd);

int gfs2_lookup_master_dir(struct gfs2_sbd *sdp);
int gfs2_lookup_in_master_dir(struct gfs2_sbd *sdp, char *filename,
struct gfs2_inode **ipp);

Expand Down

0 comments on commit 35f8bb3

Please sign in to comment.