diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2009-05-22 05:45:09 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2009-05-22 05:45:09 -0400 |
commit | 2286dbfad1fb622ee2691537e5caaedee4618860 (patch) | |
tree | da16646efb25515c3b6865b84bf3485a4714caee /fs/gfs2 | |
parent | 9e6e0a128bca0a151d8d3fbd9459b22fc21cfebb (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')
-rw-r--r-- | fs/gfs2/inode.c | 52 | ||||
-rw-r--r-- | fs/gfs2/inode.h | 2 | ||||
-rw-r--r-- | fs/gfs2/ops_inode.c | 53 |
3 files changed, 53 insertions, 54 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index c03a1a384e72..9b17447a0f95 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -1046,58 +1046,6 @@ fail: | |||
1046 | return ERR_PTR(error); | 1046 | return ERR_PTR(error); |
1047 | } | 1047 | } |
1048 | 1048 | ||
1049 | /** | ||
1050 | * gfs2_rmdiri - Remove a directory | ||
1051 | * @dip: The parent directory of the directory to be removed | ||
1052 | * @name: The name of the directory to be removed | ||
1053 | * @ip: The GFS2 inode of the directory to be removed | ||
1054 | * | ||
1055 | * Assumes Glocks on dip and ip are held | ||
1056 | * | ||
1057 | * Returns: errno | ||
1058 | */ | ||
1059 | |||
1060 | int gfs2_rmdiri(struct gfs2_inode *dip, const struct qstr *name, | ||
1061 | struct gfs2_inode *ip) | ||
1062 | { | ||
1063 | struct qstr dotname; | ||
1064 | int error; | ||
1065 | |||
1066 | if (ip->i_entries != 2) { | ||
1067 | if (gfs2_consist_inode(ip)) | ||
1068 | gfs2_dinode_print(ip); | ||
1069 | return -EIO; | ||
1070 | } | ||
1071 | |||
1072 | error = gfs2_dir_del(dip, name); | ||
1073 | if (error) | ||
1074 | return error; | ||
1075 | |||
1076 | error = gfs2_change_nlink(dip, -1); | ||
1077 | if (error) | ||
1078 | return error; | ||
1079 | |||
1080 | gfs2_str2qstr(&dotname, "."); | ||
1081 | error = gfs2_dir_del(ip, &dotname); | ||
1082 | if (error) | ||
1083 | return error; | ||
1084 | |||
1085 | gfs2_str2qstr(&dotname, ".."); | ||
1086 | error = gfs2_dir_del(ip, &dotname); | ||
1087 | if (error) | ||
1088 | return error; | ||
1089 | |||
1090 | /* It looks odd, but it really should be done twice */ | ||
1091 | error = gfs2_change_nlink(ip, -1); | ||
1092 | if (error) | ||
1093 | return error; | ||
1094 | |||
1095 | error = gfs2_change_nlink(ip, -1); | ||
1096 | if (error) | ||
1097 | return error; | ||
1098 | |||
1099 | return error; | ||
1100 | } | ||
1101 | 1049 | ||
1102 | /* | 1050 | /* |
1103 | * gfs2_unlink_ok - check to see that a inode is still in a directory | 1051 | * gfs2_unlink_ok - check to see that a inode is still in a directory |
diff --git a/fs/gfs2/inode.h b/fs/gfs2/inode.h index 2c3ec072d60e..6cd39284eb08 100644 --- a/fs/gfs2/inode.h +++ b/fs/gfs2/inode.h | |||
@@ -96,8 +96,6 @@ extern struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name, | |||
96 | extern struct inode *gfs2_createi(struct gfs2_holder *ghs, | 96 | extern struct inode *gfs2_createi(struct gfs2_holder *ghs, |
97 | const struct qstr *name, | 97 | const struct qstr *name, |
98 | unsigned int mode, dev_t dev); | 98 | unsigned int mode, dev_t dev); |
99 | extern int gfs2_rmdiri(struct gfs2_inode *dip, const struct qstr *name, | ||
100 | struct gfs2_inode *ip); | ||
101 | extern int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name, | 99 | extern int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name, |
102 | const struct gfs2_inode *ip); | 100 | const struct gfs2_inode *ip); |
103 | extern int gfs2_permission(struct inode *inode, int mask); | 101 | extern int gfs2_permission(struct inode *inode, int mask); |
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 | |||
486 | static 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 |