diff mbox series

[22/25] libxfs: remove the libxfs_{get,put}bufr APIs

Message ID 158258962890.451378.12681114574724102575.stgit@magnolia (mailing list archive)
State Superseded
Headers show
Series xfsprogs: refactor buffer function names | expand

Commit Message

Darrick J. Wong Feb. 25, 2020, 12:13 a.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

Hide libxfs_getbufr since nobody should be using the internal function,
and fold libxfs_putbufr into its only caller.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 libxfs/libxfs_io.h |    3 ---
 libxfs/rdwr.c      |   20 ++++++++------------
 2 files changed, 8 insertions(+), 15 deletions(-)

Comments

Christoph Hellwig Feb. 25, 2020, 5:52 p.m. UTC | #1
On Mon, Feb 24, 2020 at 04:13:48PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Hide libxfs_getbufr since nobody should be using the internal function,
> and fold libxfs_putbufr into its only caller.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Looks good,

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

Patch

diff --git a/libxfs/libxfs_io.h b/libxfs/libxfs_io.h
index cd159881..c69eea97 100644
--- a/libxfs/libxfs_io.h
+++ b/libxfs/libxfs_io.h
@@ -213,9 +213,6 @@  extern void	libxfs_bcache_flush(void);
 extern int	libxfs_bcache_overflowed(void);
 
 /* Buffer (Raw) Interfaces */
-extern xfs_buf_t *libxfs_getbufr(struct xfs_buftarg *, xfs_daddr_t, int);
-extern void	libxfs_putbufr(xfs_buf_t *);
-
 int		libxfs_bwrite(struct xfs_buf *bp);
 extern int	libxfs_readbufr(struct xfs_buftarg *, xfs_daddr_t, xfs_buf_t *, int, int);
 extern int	libxfs_readbufr_map(struct xfs_buftarg *, struct xfs_buf *, int);
diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c
index 29c9dd68..e46f749c 100644
--- a/libxfs/rdwr.c
+++ b/libxfs/rdwr.c
@@ -21,6 +21,8 @@ 
 
 #include "libxfs.h"
 
+static void libxfs_brelse(struct cache_node *node);
+
 /*
  * Important design/architecture note:
  *
@@ -430,7 +432,7 @@  __libxfs_getbufr(int blen)
 	return bp;
 }
 
-xfs_buf_t *
+static xfs_buf_t *
 libxfs_getbufr(struct xfs_buftarg *btp, xfs_daddr_t blkno, int bblen)
 {
 	xfs_buf_t	*bp;
@@ -634,8 +636,11 @@  libxfs_buf_relse(
 
 	if (!list_empty(&bp->b_node.cn_hash))
 		cache_node_put(libxfs_bcache, &bp->b_node);
-	else if (--bp->b_node.cn_count == 0)
-		libxfs_putbufr(bp);
+	else if (--bp->b_node.cn_count == 0) {
+		if (bp->b_flags & LIBXFS_B_DIRTY)
+			libxfs_bwrite(bp);
+		libxfs_brelse(&bp->b_node);
+	}
 }
 
 static struct cache_node *
@@ -1120,15 +1125,6 @@  libxfs_bflush(
 	return bp->b_error;
 }
 
-void
-libxfs_putbufr(xfs_buf_t *bp)
-{
-	if (bp->b_flags & LIBXFS_B_DIRTY)
-		libxfs_bwrite(bp);
-	libxfs_brelse(&bp->b_node);
-}
-
-
 void
 libxfs_bcache_purge(void)
 {