aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/ops_inode.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2009-05-22 05:45:09 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2009-05-22 05:45:09 -0400
commit2286dbfad1fb622ee2691537e5caaedee4618860 (patch)
treeda16646efb25515c3b6865b84bf3485a4714caee /fs/gfs2/ops_inode.c
parent9e6e0a128bca0a151d8d3fbd9459b22fc21cfebb (diff)
GFS2: Move gfs2_rmdiri into ops_inode.c
Move gfs2_rmdiri() into ops_inode.c and make it static. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/ops_inode.c')
-rw-r--r--fs/gfs2/ops_inode.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c
index 1c70fa5168d6..5dacd647ff0d 100644
--- a/fs/gfs2/ops_inode.c
+++ b/fs/gfs2/ops_inode.c
@@ -473,6 +473,59 @@ static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode)
473} 473}
474 474
475/** 475/**
476 * gfs2_rmdiri - Remove a directory
477 * @dip: The parent directory of the directory to be removed
478 * @name: The name of the directory to be removed
479 * @ip: The GFS2 inode of the directory to be removed
480 *
481 * Assumes Glocks on dip and ip are held
482 *
483 * Returns: errno
484 */
485
486static int gfs2_rmdiri(struct gfs2_inode *dip, const struct qstr *name,
487 struct gfs2_inode *ip)
488{
489 struct qstr dotname;
490 int error;
491
492 if (ip->i_entries != 2) {
493 if (gfs2_consist_inode(ip))
494 gfs2_dinode_print(ip);
495 return -EIO;
496 }
497
498 error = gfs2_dir_del(dip, name);
499 if (error)
500 return error;
501
502 error = gfs2_change_nlink(dip, -1);
503 if (error)
504 return error;
505
506 gfs2_str2qstr(&dotname, ".");
507 error = gfs2_dir_del(ip, &dotname);
508 if (error)
509 return error;
510
511 gfs2_str2qstr(&dotname, "..");
512 error = gfs2_dir_del(ip, &dotname);
513 if (error)
514 return error;
515
516 /* It looks odd, but it really should be done twice */
517 error = gfs2_change_nlink(ip, -1);
518 if (error)
519 return error;
520
521 error = gfs2_change_nlink(ip, -1);
522 if (error)
523 return error;
524
525 return error;
526}
527
528/**
476 * gfs2_rmdir - Remove a directory 529 * gfs2_rmdir - Remove a directory
477 * @dir: The parent directory of the directory to be removed 530 * @dir: The parent directory of the directory to be removed
478 * @dentry: The dentry of the directory to remove 531 * @dentry: The dentry of the directory to remove