From: Darrick J. Wong <darrick.wong@xxxxxxxxxx> 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@xxxxxxxxxx> Reviewed-by: Christoph Hellwig <hch@xxxxxx> --- libxfs/libxfs_io.h | 3 --- libxfs/rdwr.c | 20 ++++++++------------ 2 files changed, 8 insertions(+), 15 deletions(-) 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 68e8e014..82f15af9 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: * @@ -437,7 +439,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; @@ -641,8 +643,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 * @@ -1127,15 +1132,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) {