]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libxlog: use uncached buffers instead of open-coding them
authorDarrick J. Wong <darrick.wong@oracle.com>
Sun, 1 Mar 2020 17:34:10 +0000 (12:34 -0500)
committerEric Sandeen <sandeen@sandeen.net>
Sun, 1 Mar 2020 17:34:10 +0000 (12:34 -0500)
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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
include/libxlog.h
libxlog/xfs_log_recover.c
logprint/log_print_all.c

index 4b7855077b128625943abfc270d4df75b03c35c4..5e94fa1e0be8069aed118fa4988ca4945ab395aa 100644 (file)
@@ -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,
index 9324a21300dc80158a6211773f0a8b422472d4f4..e7e57bd2446856f67d58dcaeb886d1819dd87f8e 100644 (file)
@@ -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 @@ validate_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 @@ validate_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;
 }
index d3d4c07b4bf76e412ce0bd49d1f2bc164cbe08e1..32d13719a088aac5484fe73d30b6aa42a4a0ac06 100644 (file)
@@ -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;
 }