Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 146927
b: refs/heads/master
c: 2286dbf
h: refs/heads/master
i:
  146925: fd3fb3d
  146923: b206d0b
  146919: d183ae3
  146911: b21be77
v: v3
  • Loading branch information
Steven Whitehouse committed May 22, 2009
1 parent fe361d6 commit fb26920
Show file tree
Hide file tree
Showing 4 changed files with 54 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: 9e6e0a128bca0a151d8d3fbd9459b22fc21cfebb
refs/heads/master: 2286dbfad1fb622ee2691537e5caaedee4618860
52 changes: 0 additions & 52 deletions trunk/fs/gfs2/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1046,58 +1046,6 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name,
return ERR_PTR(error);
}

/**
* gfs2_rmdiri - Remove a directory
* @dip: The parent directory of the directory to be removed
* @name: The name of the directory to be removed
* @ip: The GFS2 inode of the directory to be removed
*
* Assumes Glocks on dip and ip are held
*
* Returns: errno
*/

int gfs2_rmdiri(struct gfs2_inode *dip, const struct qstr *name,
struct gfs2_inode *ip)
{
struct qstr dotname;
int error;

if (ip->i_entries != 2) {
if (gfs2_consist_inode(ip))
gfs2_dinode_print(ip);
return -EIO;
}

error = gfs2_dir_del(dip, name);
if (error)
return error;

error = gfs2_change_nlink(dip, -1);
if (error)
return error;

gfs2_str2qstr(&dotname, ".");
error = gfs2_dir_del(ip, &dotname);
if (error)
return error;

gfs2_str2qstr(&dotname, "..");
error = gfs2_dir_del(ip, &dotname);
if (error)
return error;

/* It looks odd, but it really should be done twice */
error = gfs2_change_nlink(ip, -1);
if (error)
return error;

error = gfs2_change_nlink(ip, -1);
if (error)
return error;

return error;
}

/*
* gfs2_unlink_ok - check to see that a inode is still in a directory
Expand Down
2 changes: 0 additions & 2 deletions trunk/fs/gfs2/inode.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ extern struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name,
extern struct inode *gfs2_createi(struct gfs2_holder *ghs,
const struct qstr *name,
unsigned int mode, dev_t dev);
extern int gfs2_rmdiri(struct gfs2_inode *dip, const struct qstr *name,
struct gfs2_inode *ip);
extern int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name,
const struct gfs2_inode *ip);
extern int gfs2_permission(struct inode *inode, int mask);
Expand Down
53 changes: 53 additions & 0 deletions trunk/fs/gfs2/ops_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,59 @@ static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode)
return 0;
}

/**
* gfs2_rmdiri - Remove a directory
* @dip: The parent directory of the directory to be removed
* @name: The name of the directory to be removed
* @ip: The GFS2 inode of the directory to be removed
*
* Assumes Glocks on dip and ip are held
*
* Returns: errno
*/

static int gfs2_rmdiri(struct gfs2_inode *dip, const struct qstr *name,
struct gfs2_inode *ip)
{
struct qstr dotname;
int error;

if (ip->i_entries != 2) {
if (gfs2_consist_inode(ip))
gfs2_dinode_print(ip);
return -EIO;
}

error = gfs2_dir_del(dip, name);
if (error)
return error;

error = gfs2_change_nlink(dip, -1);
if (error)
return error;

gfs2_str2qstr(&dotname, ".");
error = gfs2_dir_del(ip, &dotname);
if (error)
return error;

gfs2_str2qstr(&dotname, "..");
error = gfs2_dir_del(ip, &dotname);
if (error)
return error;

/* It looks odd, but it really should be done twice */
error = gfs2_change_nlink(ip, -1);
if (error)
return error;

error = gfs2_change_nlink(ip, -1);
if (error)
return error;

return error;
}

/**
* gfs2_rmdir - Remove a directory
* @dir: The parent directory of the directory to be removed
Expand Down

0 comments on commit fb26920

Please sign in to comment.