diff mbox series

[14/26] libxfs: convert libxfs_log_clear to use uncached buffers

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

Commit Message

Darrick J. Wong Feb. 28, 2020, 11:37 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

Convert the log clearing function to use uncached buffers like
everything else, instead of using the raw buffer get/put functions.
This will eventually enable us to hide them more effectively.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 libxfs/rdwr.c |   16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

Comments

Eric Sandeen Feb. 29, 2020, 10:45 p.m. UTC | #1
On 2/28/20 3:37 PM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Convert the log clearing function to use uncached buffers like
> everything else, instead of using the raw buffer get/put functions.
> This will eventually enable us to hide them more effectively.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

hch had a question about using libxfs_buf_get_uncached instead but
that can be addressed/tidied up in another patch, trying to keep things
moving and this doesn't really seem terribly problematic to me.

Reviewed-by: Eric Sandeen <sandeen@redhat.com>
diff mbox series

Patch

diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c
index f76ac228..cc7db73b 100644
--- a/libxfs/rdwr.c
+++ b/libxfs/rdwr.c
@@ -1420,15 +1420,13 @@  libxfs_log_clear(
 	/* write out the first log record */
 	ptr = dptr;
 	if (btp) {
-		bp = libxfs_getbufr(btp, start, len);
+		bp = libxfs_getbufr_uncached(btp, start, len);
 		ptr = bp->b_addr;
 	}
 	libxfs_log_header(ptr, fs_uuid, version, sunit, fmt, lsn, tail_lsn,
 			  next, bp);
-	if (bp) {
-		bp->b_flags |= LIBXFS_B_DIRTY;
-		libxfs_putbufr(bp);
-	}
+	if (bp)
+		libxfs_writebuf(bp, 0);
 
 	/*
 	 * There's nothing else to do if this is a log reset. The kernel detects
@@ -1468,7 +1466,7 @@  libxfs_log_clear(
 
 		ptr = dptr;
 		if (btp) {
-			bp = libxfs_getbufr(btp, blk, len);
+			bp = libxfs_getbufr_uncached(btp, blk, len);
 			ptr = bp->b_addr;
 		}
 		/*
@@ -1477,10 +1475,8 @@  libxfs_log_clear(
 		 */
 		libxfs_log_header(ptr, fs_uuid, version, BBTOB(len), fmt, lsn,
 				  tail_lsn, next, bp);
-		if (bp) {
-			bp->b_flags |= LIBXFS_B_DIRTY;
-			libxfs_putbufr(bp);
-		}
+		if (bp)
+			libxfs_writebuf(bp, 0);
 
 		blk += len;
 		if (dptr)