All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: sandeen@sandeen.net, darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH 11/18] libxlog: use uncached buffers instead of open-coding them
Date: Wed, 19 Feb 2020 17:43:43 -0800	[thread overview]
Message-ID: <158216302373.602314.13809511355239867956.stgit@magnolia> (raw)
In-Reply-To: <158216295405.602314.2094526611933874427.stgit@magnolia>

From: Darrick J. Wong <darrick.wong@oracle.com>

Use the new uncached buffer functions to manage buffers instead of
open-coding the logic.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 include/libxlog.h         |    1 -
 libxlog/xfs_log_recover.c |   35 ++++++++++++++---------------------
 logprint/log_print_all.c  |    2 +-
 3 files changed, 15 insertions(+), 23 deletions(-)


diff --git a/include/libxlog.h b/include/libxlog.h
index 4b785507..5e94fa1e 100644
--- a/include/libxlog.h
+++ b/include/libxlog.h
@@ -75,7 +75,6 @@ extern libxfs_init_t	x;
 extern int xlog_is_dirty(struct xfs_mount *, struct xlog *, libxfs_init_t *,
 			 int);
 extern struct xfs_buf *xlog_get_bp(struct xlog *, int);
-extern void	xlog_put_bp(struct xfs_buf *);
 extern int	xlog_bread(struct xlog *log, xfs_daddr_t blk_no, int nbblks,
 				xfs_buf_t *bp, char **offset);
 extern int	xlog_bread_noalign(struct xlog *log, xfs_daddr_t blk_no,
diff --git a/libxlog/xfs_log_recover.c b/libxlog/xfs_log_recover.c
index 9324a213..e7e57bd2 100644
--- a/libxlog/xfs_log_recover.c
+++ b/libxlog/xfs_log_recover.c
@@ -67,14 +67,7 @@ xlog_get_bp(
 		nbblks += log->l_sectBBsize;
 	nbblks = round_up(nbblks, log->l_sectBBsize);
 
-	return libxfs_getbufr(log->l_dev, (xfs_daddr_t)-1, nbblks);
-}
-
-void
-xlog_put_bp(
-	xfs_buf_t	*bp)
-{
-	libxfs_putbufr(bp);
+	return libxfs_buf_get_uncached(log->l_dev, nbblks, 0);
 }
 
 /*
@@ -274,7 +267,7 @@ xlog_find_verify_cycle(
 	*new_blk = -1;
 
 out:
-	xlog_put_bp(bp);
+	libxfs_buf_relse(bp);
 	return error;
 }
 
@@ -383,7 +376,7 @@ xlog_find_verify_log_record(
 		*last_blk = i;
 
 out:
-	xlog_put_bp(bp);
+	libxfs_buf_relse(bp);
 	return error;
 }
 
@@ -634,7 +627,7 @@ xlog_find_head(
 			goto bp_err;
 	}
 
-	xlog_put_bp(bp);
+	libxfs_buf_relse(bp);
 	if (head_blk == log_bbnum)
 		*return_head_blk = 0;
 	else
@@ -648,7 +641,7 @@ xlog_find_head(
 	return 0;
 
  bp_err:
-	xlog_put_bp(bp);
+	libxfs_buf_relse(bp);
 
 	if (error)
 		xfs_warn(log->l_mp, "failed to find log head");
@@ -745,7 +738,7 @@ xlog_find_tail(
 	}
 	if (!found) {
 		xfs_warn(log->l_mp, "%s: couldn't find sync record", __func__);
-		xlog_put_bp(bp);
+		libxfs_buf_relse(bp);
 		ASSERT(0);
 		return XFS_ERROR(EIO);
 	}
@@ -858,7 +851,7 @@ xlog_find_tail(
 		error = xlog_clear_stale_blocks(log, tail_lsn);
 
 done:
-	xlog_put_bp(bp);
+	libxfs_buf_relse(bp);
 
 	if (error)
 		xfs_warn(log->l_mp, "failed to locate log tail");
@@ -906,7 +899,7 @@ xlog_find_zeroed(
 	first_cycle = xlog_get_cycle(offset);
 	if (first_cycle == 0) {		/* completely zeroed log */
 		*blk_no = 0;
-		xlog_put_bp(bp);
+		libxfs_buf_relse(bp);
 		return -1;
 	}
 
@@ -917,7 +910,7 @@ xlog_find_zeroed(
 
 	last_cycle = xlog_get_cycle(offset);
 	if (last_cycle != 0) {		/* log completely written to */
-		xlog_put_bp(bp);
+		libxfs_buf_relse(bp);
 		return 0;
 	} else if (first_cycle != 1) {
 		/*
@@ -974,7 +967,7 @@ xlog_find_zeroed(
 
 	*blk_no = last_blk;
 bp_err:
-	xlog_put_bp(bp);
+	libxfs_buf_relse(bp);
 	if (error)
 		return error;
 	return -1;
@@ -1457,7 +1450,7 @@ xlog_do_recovery_pass(
 			hblks = h_size / XLOG_HEADER_CYCLE_SIZE;
 			if (h_size % XLOG_HEADER_CYCLE_SIZE)
 				hblks++;
-			xlog_put_bp(hbp);
+			libxfs_buf_relse(hbp);
 			hbp = xlog_get_bp(log, hblks);
 		} else {
 			hblks = 1;
@@ -1473,7 +1466,7 @@ xlog_do_recovery_pass(
 		return ENOMEM;
 	dbp = xlog_get_bp(log, BTOBB(h_size));
 	if (!dbp) {
-		xlog_put_bp(hbp);
+		libxfs_buf_relse(hbp);
 		return ENOMEM;
 	}
 
@@ -1657,8 +1650,8 @@ xlog_do_recovery_pass(
 	}
 
  bread_err2:
-	xlog_put_bp(dbp);
+	libxfs_buf_relse(dbp);
  bread_err1:
-	xlog_put_bp(hbp);
+	libxfs_buf_relse(hbp);
 	return error;
 }
diff --git a/logprint/log_print_all.c b/logprint/log_print_all.c
index d3d4c07b..32d13719 100644
--- a/logprint/log_print_all.c
+++ b/logprint/log_print_all.c
@@ -39,7 +39,7 @@ xlog_print_find_oldest(
 		error = xlog_find_cycle_start(log, bp, first_blk,
 					      last_blk, last_half_cycle);
 
-	xlog_put_bp(bp);
+	libxfs_buf_relse(bp);
 	return error;
 }
 


  parent reply	other threads:[~2020-02-20  1:43 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-20  1:42 [PATCH 00/18] xfsprogs: refactor buffer function names Darrick J. Wong
2020-02-20  1:42 ` [PATCH 01/18] libxfs: clean up readbuf flags Darrick J. Wong
2020-02-21 14:42   ` Christoph Hellwig
2020-02-21 15:55     ` Darrick J. Wong
2020-02-20  1:42 ` [PATCH 02/18] libxfs: clean up writebuf flags Darrick J. Wong
2020-02-20  1:42 ` [PATCH 03/18] libxfs: remove LIBXFS_EXIT_ON_FAILURE Darrick J. Wong
2020-02-20  1:43 ` [PATCH 04/18] libxfs: replace libxfs_putbuf with libxfs_buf_relse Darrick J. Wong
2020-02-21 14:43   ` Christoph Hellwig
2020-02-21 15:01   ` Eric Sandeen
2020-02-20  1:43 ` [PATCH 05/18] libxfs: replace libxfs_getbuf with libxfs_buf_get Darrick J. Wong
2020-02-21 14:43   ` Christoph Hellwig
2020-02-20  1:43 ` [PATCH 06/18] libxfs: replace libxfs_readbuf with libxfs_buf_read Darrick J. Wong
2020-02-21 14:44   ` Christoph Hellwig
2020-02-20  1:43 ` [PATCH 07/18] libxfs: make libxfs_bwrite do what libxfs_writebufr does Darrick J. Wong
2020-02-21 14:45   ` Christoph Hellwig
2020-02-21 20:43     ` Darrick J. Wong
2020-02-20  1:43 ` [PATCH 08/18] libxfs: make libxfs_readbuf_verify return an error code Darrick J. Wong
2020-02-21 14:46   ` Christoph Hellwig
2020-02-20  1:43 ` [PATCH 09/18] libxfs: make libxfs_readbufr stash the error value in b_error Darrick J. Wong
2020-02-21 14:46   ` Christoph Hellwig
2020-02-20  1:43 ` [PATCH 10/18] libxfs: introduce libxfs_buf_read_uncached Darrick J. Wong
2020-02-21 14:48   ` Christoph Hellwig
2020-02-21 20:50     ` Darrick J. Wong
2020-02-21 20:59       ` Darrick J. Wong
2020-02-20  1:43 ` Darrick J. Wong [this message]
2020-02-21 14:49   ` [PATCH 11/18] libxlog: use uncached buffers instead of open-coding them Christoph Hellwig
2020-02-21 15:51     ` Darrick J. Wong
2020-02-20  1:43 ` [PATCH 12/18] libxfs: use uncached buffers for initial mkfs writes Darrick J. Wong
2020-02-21 14:51   ` Christoph Hellwig
2020-02-21 15:52     ` Darrick J. Wong
2020-02-20  1:43 ` [PATCH 13/18] libxfs: straighten out libxfs_writebuf confusion Darrick J. Wong
2020-02-21 14:53   ` Christoph Hellwig
2020-02-21 15:54     ` Darrick J. Wong
2020-02-20  1:44 ` [PATCH 14/18] libxfs: remove libxfs_writebuf_int Darrick J. Wong
2020-02-21 14:53   ` Christoph Hellwig
2020-02-20  1:44 ` [PATCH 15/18] libxfs: hide libxfs_{get,put}bufr Darrick J. Wong
2020-02-21 14:53   ` Christoph Hellwig
2020-02-21 16:00     ` Darrick J. Wong
2020-02-20  1:44 ` [PATCH 16/18] libxfs: hide libxfs_getbuf_flags Darrick J. Wong
2020-02-21 14:54   ` Christoph Hellwig
2020-02-20  1:44 ` [PATCH 17/18] libxfs: rename libxfs_readbuf_map to libxfs_buf_read_map Darrick J. Wong
2020-02-21 14:54   ` Christoph Hellwig
2020-02-20  1:44 ` [PATCH 18/18] libxfs: rename libxfs_getbuf_map to libxfs_buf_get_map Darrick J. Wong
2020-02-21 14:55   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=158216302373.602314.13809511355239867956.stgit@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.