diff mbox series

[v7,08/17] xfs: merge freeing of mp names and mp

Message ID 157190347727.27074.15948763811572596699.stgit@fedora-28 (mailing list archive)
State Superseded, archived
Headers show
Series xfs: mount API patch series | expand

Commit Message

Ian Kent Oct. 24, 2019, 7:51 a.m. UTC
In all cases when struct xfs_mount (mp) fields m_rtname and m_logname
are freed mp is also freed, so merge these into a single function
xfs_mount_free().

Signed-off-by: Ian Kent <raven@themaw.net>
---
 fs/xfs/xfs_super.c |   26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

Comments

Darrick J. Wong Oct. 24, 2019, 3:28 p.m. UTC | #1
On Thu, Oct 24, 2019 at 03:51:17PM +0800, Ian Kent wrote:
> In all cases when struct xfs_mount (mp) fields m_rtname and m_logname
> are freed mp is also freed, so merge these into a single function
> xfs_mount_free().
> 
> Signed-off-by: Ian Kent <raven@themaw.net>

Looks good to me,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/xfs_super.c |   26 ++++++++++++--------------
>  1 file changed, 12 insertions(+), 14 deletions(-)
> 
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index 0596d491dbbe..297e6c98742e 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -446,6 +446,15 @@ xfs_mount_alloc(
>  	return mp;
>  }
>  
> +static void
> +xfs_mount_free(
> +	struct xfs_mount	*mp)
> +{
> +	kfree(mp->m_rtname);
> +	kfree(mp->m_logname);
> +	kmem_free(mp);
> +}
> +
>  struct proc_xfs_info {
>  	uint64_t	flag;
>  	char		*str;
> @@ -1058,14 +1067,6 @@ xfs_fs_drop_inode(
>  	return generic_drop_inode(inode) || (ip->i_flags & XFS_IDONTCACHE);
>  }
>  
> -STATIC void
> -xfs_free_names(
> -	struct xfs_mount	*mp)
> -{
> -	kfree(mp->m_rtname);
> -	kfree(mp->m_logname);
> -}
> -
>  STATIC int
>  xfs_fs_sync_fs(
>  	struct super_block	*sb,
> @@ -1238,8 +1239,7 @@ xfs_test_remount_options(
>  
>  	tmp_mp->m_super = sb;
>  	error = xfs_parseargs(tmp_mp, options);
> -	xfs_free_names(tmp_mp);
> -	kmem_free(tmp_mp);
> +	xfs_mount_free(tmp_mp);
>  
>  	return error;
>  }
> @@ -1747,8 +1747,7 @@ xfs_fs_fill_super(
>  	xfs_close_devices(mp);
>   out_free_names:
>  	sb->s_fs_info = NULL;
> -	xfs_free_names(mp);
> -	kmem_free(mp);
> +	xfs_mount_free(mp);
>   out:
>  	return error;
>  
> @@ -1779,8 +1778,7 @@ xfs_fs_put_super(
>  	xfs_close_devices(mp);
>  
>  	sb->s_fs_info = NULL;
> -	xfs_free_names(mp);
> -	kmem_free(mp);
> +	xfs_mount_free(mp);
>  }
>  
>  STATIC struct dentry *
>
Christoph Hellwig Oct. 25, 2019, 2:37 p.m. UTC | #2
On Thu, Oct 24, 2019 at 03:51:17PM +0800, Ian Kent wrote:
> In all cases when struct xfs_mount (mp) fields m_rtname and m_logname
> are freed mp is also freed, so merge these into a single function
> xfs_mount_free().
> 
> Signed-off-by: Ian Kent <raven@themaw.net>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 0596d491dbbe..297e6c98742e 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -446,6 +446,15 @@  xfs_mount_alloc(
 	return mp;
 }
 
+static void
+xfs_mount_free(
+	struct xfs_mount	*mp)
+{
+	kfree(mp->m_rtname);
+	kfree(mp->m_logname);
+	kmem_free(mp);
+}
+
 struct proc_xfs_info {
 	uint64_t	flag;
 	char		*str;
@@ -1058,14 +1067,6 @@  xfs_fs_drop_inode(
 	return generic_drop_inode(inode) || (ip->i_flags & XFS_IDONTCACHE);
 }
 
-STATIC void
-xfs_free_names(
-	struct xfs_mount	*mp)
-{
-	kfree(mp->m_rtname);
-	kfree(mp->m_logname);
-}
-
 STATIC int
 xfs_fs_sync_fs(
 	struct super_block	*sb,
@@ -1238,8 +1239,7 @@  xfs_test_remount_options(
 
 	tmp_mp->m_super = sb;
 	error = xfs_parseargs(tmp_mp, options);
-	xfs_free_names(tmp_mp);
-	kmem_free(tmp_mp);
+	xfs_mount_free(tmp_mp);
 
 	return error;
 }
@@ -1747,8 +1747,7 @@  xfs_fs_fill_super(
 	xfs_close_devices(mp);
  out_free_names:
 	sb->s_fs_info = NULL;
-	xfs_free_names(mp);
-	kmem_free(mp);
+	xfs_mount_free(mp);
  out:
 	return error;
 
@@ -1779,8 +1778,7 @@  xfs_fs_put_super(
 	xfs_close_devices(mp);
 
 	sb->s_fs_info = NULL;
-	xfs_free_names(mp);
-	kmem_free(mp);
+	xfs_mount_free(mp);
 }
 
 STATIC struct dentry *