diff mbox series

[16/20] xfs: merge xfs_bud_init into xfs_trans_get_bud

Message ID 20190517073119.30178-17-hch@lst.de (mailing list archive)
State Superseded, archived
Headers show
Series [01/20] xfs: fix a trivial comment typo in the xfs_trans_committed_bulk | expand

Commit Message

Christoph Hellwig May 17, 2019, 7:31 a.m. UTC
There is no good reason to keep these two functions separate.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_bmap_item.c  | 14 ++++++--------
 fs/xfs/xfs_bmap_item.h  |  2 --
 fs/xfs/xfs_trans_bmap.c | 16 ----------------
 3 files changed, 6 insertions(+), 26 deletions(-)

Comments

Brian Foster May 20, 2019, 1:13 p.m. UTC | #1
On Fri, May 17, 2019 at 09:31:15AM +0200, Christoph Hellwig wrote:
> There is no good reason to keep these two functions separate.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  fs/xfs/xfs_bmap_item.c  | 14 ++++++--------
>  fs/xfs/xfs_bmap_item.h  |  2 --
>  fs/xfs/xfs_trans_bmap.c | 16 ----------------
>  3 files changed, 6 insertions(+), 26 deletions(-)
> 
> diff --git a/fs/xfs/xfs_bmap_item.c b/fs/xfs/xfs_bmap_item.c
> index 46dcadf790c2..40385c8b752a 100644
> --- a/fs/xfs/xfs_bmap_item.c
> +++ b/fs/xfs/xfs_bmap_item.c
> @@ -212,22 +212,20 @@ static const struct xfs_item_ops xfs_bud_item_ops = {
>  	.iop_release	= xfs_bud_item_release,
>  };
>  
> -/*
> - * Allocate and initialize an bud item with the given number of extents.
> - */
>  struct xfs_bud_log_item *
> -xfs_bud_init(
> -	struct xfs_mount		*mp,
> +xfs_trans_get_bud(
> +	struct xfs_trans		*tp,
>  	struct xfs_bui_log_item		*buip)
> -
>  {
> -	struct xfs_bud_log_item	*budp;
> +	struct xfs_bud_log_item		*budp;
>  
>  	budp = kmem_zone_zalloc(xfs_bud_zone, KM_SLEEP);
> -	xfs_log_item_init(mp, &budp->bud_item, XFS_LI_BUD, &xfs_bud_item_ops);
> +	xfs_log_item_init(tp->t_mountp, &budp->bud_item, XFS_LI_BUD,
> +			  &xfs_bud_item_ops);
>  	budp->bud_buip = buip;
>  	budp->bud_format.bud_bui_id = buip->bui_format.bui_id;
>  
> +	xfs_trans_add_item(tp, &budp->bud_item);
>  	return budp;
>  }
>  
> diff --git a/fs/xfs/xfs_bmap_item.h b/fs/xfs/xfs_bmap_item.h
> index 89e043a88bb8..ad479cc73de8 100644
> --- a/fs/xfs/xfs_bmap_item.h
> +++ b/fs/xfs/xfs_bmap_item.h
> @@ -75,8 +75,6 @@ extern struct kmem_zone	*xfs_bui_zone;
>  extern struct kmem_zone	*xfs_bud_zone;
>  
>  struct xfs_bui_log_item *xfs_bui_init(struct xfs_mount *);
> -struct xfs_bud_log_item *xfs_bud_init(struct xfs_mount *,
> -		struct xfs_bui_log_item *);
>  void xfs_bui_item_free(struct xfs_bui_log_item *);
>  void xfs_bui_release(struct xfs_bui_log_item *);
>  int xfs_bui_recover(struct xfs_trans *parent_tp, struct xfs_bui_log_item *buip);
> diff --git a/fs/xfs/xfs_trans_bmap.c b/fs/xfs/xfs_trans_bmap.c
> index e1c7d55b32c3..c6f5b217d17c 100644
> --- a/fs/xfs/xfs_trans_bmap.c
> +++ b/fs/xfs/xfs_trans_bmap.c
> @@ -18,22 +18,6 @@
>  #include "xfs_bmap.h"
>  #include "xfs_inode.h"
>  
> -/*
> - * This routine is called to allocate a "bmap update done"
> - * log item.
> - */
> -struct xfs_bud_log_item *
> -xfs_trans_get_bud(
> -	struct xfs_trans		*tp,
> -	struct xfs_bui_log_item		*buip)
> -{
> -	struct xfs_bud_log_item		*budp;
> -
> -	budp = xfs_bud_init(tp->t_mountp, buip);
> -	xfs_trans_add_item(tp, &budp->bud_item);
> -	return budp;
> -}
> -
>  /*
>   * Finish an bmap update and log it to the BUD. Note that the
>   * transaction is marked dirty regardless of whether the bmap update
> -- 
> 2.20.1
>
diff mbox series

Patch

diff --git a/fs/xfs/xfs_bmap_item.c b/fs/xfs/xfs_bmap_item.c
index 46dcadf790c2..40385c8b752a 100644
--- a/fs/xfs/xfs_bmap_item.c
+++ b/fs/xfs/xfs_bmap_item.c
@@ -212,22 +212,20 @@  static const struct xfs_item_ops xfs_bud_item_ops = {
 	.iop_release	= xfs_bud_item_release,
 };
 
-/*
- * Allocate and initialize an bud item with the given number of extents.
- */
 struct xfs_bud_log_item *
-xfs_bud_init(
-	struct xfs_mount		*mp,
+xfs_trans_get_bud(
+	struct xfs_trans		*tp,
 	struct xfs_bui_log_item		*buip)
-
 {
-	struct xfs_bud_log_item	*budp;
+	struct xfs_bud_log_item		*budp;
 
 	budp = kmem_zone_zalloc(xfs_bud_zone, KM_SLEEP);
-	xfs_log_item_init(mp, &budp->bud_item, XFS_LI_BUD, &xfs_bud_item_ops);
+	xfs_log_item_init(tp->t_mountp, &budp->bud_item, XFS_LI_BUD,
+			  &xfs_bud_item_ops);
 	budp->bud_buip = buip;
 	budp->bud_format.bud_bui_id = buip->bui_format.bui_id;
 
+	xfs_trans_add_item(tp, &budp->bud_item);
 	return budp;
 }
 
diff --git a/fs/xfs/xfs_bmap_item.h b/fs/xfs/xfs_bmap_item.h
index 89e043a88bb8..ad479cc73de8 100644
--- a/fs/xfs/xfs_bmap_item.h
+++ b/fs/xfs/xfs_bmap_item.h
@@ -75,8 +75,6 @@  extern struct kmem_zone	*xfs_bui_zone;
 extern struct kmem_zone	*xfs_bud_zone;
 
 struct xfs_bui_log_item *xfs_bui_init(struct xfs_mount *);
-struct xfs_bud_log_item *xfs_bud_init(struct xfs_mount *,
-		struct xfs_bui_log_item *);
 void xfs_bui_item_free(struct xfs_bui_log_item *);
 void xfs_bui_release(struct xfs_bui_log_item *);
 int xfs_bui_recover(struct xfs_trans *parent_tp, struct xfs_bui_log_item *buip);
diff --git a/fs/xfs/xfs_trans_bmap.c b/fs/xfs/xfs_trans_bmap.c
index e1c7d55b32c3..c6f5b217d17c 100644
--- a/fs/xfs/xfs_trans_bmap.c
+++ b/fs/xfs/xfs_trans_bmap.c
@@ -18,22 +18,6 @@ 
 #include "xfs_bmap.h"
 #include "xfs_inode.h"
 
-/*
- * This routine is called to allocate a "bmap update done"
- * log item.
- */
-struct xfs_bud_log_item *
-xfs_trans_get_bud(
-	struct xfs_trans		*tp,
-	struct xfs_bui_log_item		*buip)
-{
-	struct xfs_bud_log_item		*budp;
-
-	budp = xfs_bud_init(tp->t_mountp, buip);
-	xfs_trans_add_item(tp, &budp->bud_item);
-	return budp;
-}
-
 /*
  * Finish an bmap update and log it to the BUD. Note that the
  * transaction is marked dirty regardless of whether the bmap update