public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4/6] refactor xfs_mount_free
@ 2008-07-26  9:53 Christoph Hellwig
  2008-07-26  9:58 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Hellwig @ 2008-07-26  9:53 UTC (permalink / raw)
  To: xfs

xfs_mount_free mostly frees the perag data, which is something that
is duplicated in the mount error path.

Move the XFS_QM_DONE call to the caller and remove the useless
mutex_destroy/spinlock_destroy calls so that we can re-use it for
the mount error path.  Also rename it to xfs_free_perag to reflect what
it does.


Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6-xfs/fs/xfs/xfs_mount.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/xfs_mount.c	2008-07-26 09:27:46.000000000 +0200
+++ linux-2.6-xfs/fs/xfs/xfs_mount.c	2008-07-26 09:27:47.000000000 +0200
@@ -128,7 +128,7 @@ static const struct {
  * initialized.
  */
 STATIC void
-xfs_mount_free(
+xfs_free_perag(
 	xfs_mount_t	*mp)
 {
 	if (mp->m_perag) {
@@ -139,13 +139,6 @@ xfs_mount_free(
 				kmem_free(mp->m_perag[agno].pagb_list);
 		kmem_free(mp->m_perag);
 	}
-
-	spinlock_destroy(&mp->m_ail_lock);
-	spinlock_destroy(&mp->m_sb_lock);
-	mutex_destroy(&mp->m_ilock);
-	mutex_destroy(&mp->m_growlock);
-	if (mp->m_quotainfo)
-		XFS_QM_DONE(mp);
 }
 
 /*
@@ -922,7 +915,6 @@ xfs_mountfs(
 	__uint64_t	resblks;
 	__int64_t	update_flags = 0LL;
 	uint		quotamount, quotaflags;
-	int		agno;
 	int		uuid_mounted = 0;
 	int		error = 0;
 
@@ -1216,12 +1208,7 @@ xfs_mountfs(
  error3:
 	xfs_log_unmount_dealloc(mp);
  error2:
-	for (agno = 0; agno < sbp->sb_agcount; agno++)
-		if (mp->m_perag[agno].pagb_list)
-			kmem_free(mp->m_perag[agno].pagb_list);
-	kmem_free(mp->m_perag);
-	mp->m_perag = NULL;
-	/* FALLTHROUGH */
+	xfs_free_perag(mp);
  error1:
 	if (uuid_mounted)
 		uuid_table_remove(&mp->m_sb.sb_uuid);
@@ -1307,7 +1294,9 @@ xfs_unmountfs(
 #if defined(DEBUG)
 	xfs_errortag_clearall(mp, 0);
 #endif
-	xfs_mount_free(mp);
+	xfs_free_perag(mp);
+	if (mp->m_quotainfo)
+		XFS_QM_DONE(mp);
 }
 
 STATIC void

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 4/6] refactor xfs_mount_free
  2008-07-26  9:53 [PATCH 4/6] refactor xfs_mount_free Christoph Hellwig
@ 2008-07-26  9:58 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2008-07-26  9:58 UTC (permalink / raw)
  To: xfs

Sorry, this should have been 5/6

On Sat, Jul 26, 2008 at 11:53:54AM +0200, Christoph Hellwig wrote:
> xfs_mount_free mostly frees the perag data, which is something that
> is duplicated in the mount error path.
> 
> Move the XFS_QM_DONE call to the caller and remove the useless
> mutex_destroy/spinlock_destroy calls so that we can re-use it for
> the mount error path.  Also rename it to xfs_free_perag to reflect what
> it does.
> 
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> Index: linux-2.6-xfs/fs/xfs/xfs_mount.c
> ===================================================================
> --- linux-2.6-xfs.orig/fs/xfs/xfs_mount.c	2008-07-26 09:27:46.000000000 +0200
> +++ linux-2.6-xfs/fs/xfs/xfs_mount.c	2008-07-26 09:27:47.000000000 +0200
> @@ -128,7 +128,7 @@ static const struct {
>   * initialized.
>   */
>  STATIC void
> -xfs_mount_free(
> +xfs_free_perag(
>  	xfs_mount_t	*mp)
>  {
>  	if (mp->m_perag) {
> @@ -139,13 +139,6 @@ xfs_mount_free(
>  				kmem_free(mp->m_perag[agno].pagb_list);
>  		kmem_free(mp->m_perag);
>  	}
> -
> -	spinlock_destroy(&mp->m_ail_lock);
> -	spinlock_destroy(&mp->m_sb_lock);
> -	mutex_destroy(&mp->m_ilock);
> -	mutex_destroy(&mp->m_growlock);
> -	if (mp->m_quotainfo)
> -		XFS_QM_DONE(mp);
>  }
>  
>  /*
> @@ -922,7 +915,6 @@ xfs_mountfs(
>  	__uint64_t	resblks;
>  	__int64_t	update_flags = 0LL;
>  	uint		quotamount, quotaflags;
> -	int		agno;
>  	int		uuid_mounted = 0;
>  	int		error = 0;
>  
> @@ -1216,12 +1208,7 @@ xfs_mountfs(
>   error3:
>  	xfs_log_unmount_dealloc(mp);
>   error2:
> -	for (agno = 0; agno < sbp->sb_agcount; agno++)
> -		if (mp->m_perag[agno].pagb_list)
> -			kmem_free(mp->m_perag[agno].pagb_list);
> -	kmem_free(mp->m_perag);
> -	mp->m_perag = NULL;
> -	/* FALLTHROUGH */
> +	xfs_free_perag(mp);
>   error1:
>  	if (uuid_mounted)
>  		uuid_table_remove(&mp->m_sb.sb_uuid);
> @@ -1307,7 +1294,9 @@ xfs_unmountfs(
>  #if defined(DEBUG)
>  	xfs_errortag_clearall(mp, 0);
>  #endif
> -	xfs_mount_free(mp);
> +	xfs_free_perag(mp);
> +	if (mp->m_quotainfo)
> +		XFS_QM_DONE(mp);
>  }
>  
>  STATIC void
---end quoted text---

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-07-26  9:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-26  9:53 [PATCH 4/6] refactor xfs_mount_free Christoph Hellwig
2008-07-26  9:58 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox