cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 16/24] GFS2: Move gfs2_rmdiri into ops_inode.c
Date: Wed, 10 Jun 2009 09:30:57 +0100	[thread overview]
Message-ID: <1244622665-7470-17-git-send-email-swhiteho@redhat.com> (raw)
In-Reply-To: <1244622665-7470-16-git-send-email-swhiteho@redhat.com>

Move gfs2_rmdiri() into ops_inode.c and make it static.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>

diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index c03a1a3..9b17447 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -1046,58 +1046,6 @@ fail:
 	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
diff --git a/fs/gfs2/inode.h b/fs/gfs2/inode.h
index 2c3ec07..6cd3928 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,
 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);
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c
index 1c70fa5..5dacd64 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)
 }
 
 /**
+ * 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
  * @dentry: The dentry of the directory to remove
-- 
1.6.0.6



  reply	other threads:[~2009-06-10  8:30 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-10  8:30 [Cluster-devel] GFS2: Pre-pull patch posting Steven Whitehouse
2009-06-10  8:30 ` [Cluster-devel] [PATCH 01/24] GFS2: Update the rw flags Steven Whitehouse
2009-06-10  8:30   ` [Cluster-devel] [PATCH 02/24] GFS2: Optimise writepage for metadata Steven Whitehouse
2009-06-10  8:30     ` [Cluster-devel] [PATCH 03/24] GFS2: Something nonlinear this way comes! Steven Whitehouse
2009-06-10  8:30       ` [Cluster-devel] [PATCH 04/24] GFS2: Fix timestamps on write Steven Whitehouse
2009-06-10  8:30         ` [Cluster-devel] [PATCH 05/24] GFS2: Move journal live test at transaction start Steven Whitehouse
2009-06-10  8:30           ` [Cluster-devel] [PATCH 06/24] GFS2: Add commit= mount option Steven Whitehouse
2009-06-10  8:30             ` [Cluster-devel] [PATCH 07/24] GFS2: Remove a couple of unused sysfs entries Steven Whitehouse
2009-06-10  8:30               ` [Cluster-devel] [PATCH 08/24] GFS2: Umount recovery race fix Steven Whitehouse
2009-06-10  8:30                 ` [Cluster-devel] [PATCH 09/24] GFS2: Update docs Steven Whitehouse
2009-06-10  8:30                   ` [Cluster-devel] [PATCH 10/24] GFS2: Don't warn when delete inode fails on ro filesystem Steven Whitehouse
2009-06-10  8:30                     ` [Cluster-devel] [PATCH 11/24] GFS2: Improve resource group error handling Steven Whitehouse
2009-06-10  8:30                       ` [Cluster-devel] [PATCH 12/24] GFS2: Add a rgrp bitmap full flag Steven Whitehouse
2009-06-10  8:30                         ` [Cluster-devel] [PATCH 13/24] GFS2: Be more aggressive in reclaiming unlinked inodes Steven Whitehouse
2009-06-10  8:30                           ` [Cluster-devel] [PATCH 14/24] GFS2: Clean up some file names Steven Whitehouse
2009-06-10  8:30                             ` [Cluster-devel] [PATCH 15/24] GFS2: Merge mount.c and ops_super.c into super.c Steven Whitehouse
2009-06-10  8:30                               ` Steven Whitehouse [this message]
2009-06-10  8:30                                 ` [Cluster-devel] [PATCH 17/24] GFS2: Move gfs2_readlinki into ops_inode.c Steven Whitehouse
2009-06-10  8:30                                   ` [Cluster-devel] [PATCH 18/24] GFS2: Move gfs2_unlink_ok " Steven Whitehouse
2009-06-10  8:31                                     ` [Cluster-devel] [PATCH 19/24] GFS2: Remove lockstruct subdir from gfs2 sysfs files Steven Whitehouse
2009-06-10  8:31                                       ` [Cluster-devel] [PATCH 20/24] GFS2: Remove args " Steven Whitehouse
2009-06-10  8:31                                         ` [Cluster-devel] [PATCH 21/24] GFS2: smbd proccess hangs with flock() call Steven Whitehouse
2009-06-10  8:31                                           ` [Cluster-devel] [PATCH 22/24] GFS2: Remove unused variable Steven Whitehouse
2009-06-10  8:31                                             ` [Cluster-devel] [PATCH 23/24] GFS2: Fix locking issue mounting gfs2meta fs Steven Whitehouse
2009-06-10  8:31                                               ` [Cluster-devel] [PATCH 24/24] GFS2: Fix cache coherency between truncate and O_DIRECT read Steven Whitehouse
2009-06-10  9:53                                               ` [Cluster-devel] Re: [PATCH 23/24] GFS2: Fix locking issue mounting gfs2meta fs Christoph Hellwig
2009-06-10 10:06                                                 ` Steven Whitehouse
2009-06-10 10:43                                                 ` [Cluster-devel] GFS2: Merge gfs2_get_sb into gfs2_get_sb_meta Steven Whitehouse
2009-06-10  9:49                     ` [Cluster-devel] Re: [PATCH 10/24] GFS2: Don't warn when delete inode fails on ro filesystem Christoph Hellwig
2009-06-10 10:03                       ` Steven Whitehouse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1244622665-7470-17-git-send-email-swhiteho@redhat.com \
    --to=swhiteho@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).