From db4acad09f0092aff4e8901f9069ee2cf23ffce2 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Mon, 5 Aug 2024 10:50:50 -0700 Subject: [PATCH] fixup --- include/xfs_trans.h | 1 + libxfs/libxfs_api_defs.h | 1 + libxfs/libxfs_io.h | 1 + libxfs/rdwr.c | 17 +++++++++++++++++ libxfs/trans.c | 29 +++++++++++++++++++++++++++++ 5 files changed, 49 insertions(+) diff --git a/include/xfs_trans.h b/include/xfs_trans.h index d508f8947..248064019 100644 --- a/include/xfs_trans.h +++ b/include/xfs_trans.h @@ -108,6 +108,7 @@ int libxfs_trans_reserve_more(struct xfs_trans *tp, uint blocks, void xfs_defer_cancel(struct xfs_trans *); struct xfs_buf *libxfs_trans_getsb(struct xfs_trans *); +struct xfs_buf *libxfs_trans_getrtsb(struct xfs_trans *tp); void libxfs_trans_ijoin(struct xfs_trans *, struct xfs_inode *, uint); void libxfs_trans_log_inode (struct xfs_trans *, struct xfs_inode *, diff --git a/libxfs/libxfs_api_defs.h b/libxfs/libxfs_api_defs.h index 4e3322ca4..56bdee73f 100644 --- a/libxfs/libxfs_api_defs.h +++ b/libxfs/libxfs_api_defs.h @@ -319,6 +319,7 @@ #define xfs_trans_dirty_buf libxfs_trans_dirty_buf #define xfs_trans_get_buf libxfs_trans_get_buf #define xfs_trans_get_buf_map libxfs_trans_get_buf_map +#define xfs_trans_getrtsb libxfs_trans_getrtsb #define xfs_trans_getsb libxfs_trans_getsb #define xfs_trans_ichgtime libxfs_trans_ichgtime #define xfs_trans_ijoin libxfs_trans_ijoin diff --git a/libxfs/libxfs_io.h b/libxfs/libxfs_io.h index 82d86f1d1..99372eb6d 100644 --- a/libxfs/libxfs_io.h +++ b/libxfs/libxfs_io.h @@ -208,6 +208,7 @@ libxfs_buf_read( int libxfs_readbuf_verify(struct xfs_buf *bp, const struct xfs_buf_ops *ops); struct xfs_buf *libxfs_getsb(struct xfs_mount *mp); +struct xfs_buf *libxfs_getrtsb(struct xfs_mount *mp); extern void libxfs_bcache_purge(struct xfs_mount *mp); extern void libxfs_bcache_free(void); extern void libxfs_bcache_flush(struct xfs_mount *mp); diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c index e15d9f171..bd773a737 100644 --- a/libxfs/rdwr.c +++ b/libxfs/rdwr.c @@ -165,6 +165,23 @@ libxfs_getsb( return bp; } +struct xfs_buf * +libxfs_getrtsb( + struct xfs_mount *mp) +{ + struct xfs_buf *bp; + int error; + + if (!mp->m_rtdev_targp->bt_bdev) + return NULL; + + error = libxfs_buf_read_uncached(mp->m_rtdev_targp, XFS_RTSB_DADDR, + XFS_FSB_TO_BB(mp, 1), 0, &bp, &xfs_rtsb_buf_ops); + if (error) + return NULL; + return bp; +} + struct kmem_cache *xfs_buf_cache; static struct cache_mru xfs_buf_freelist = diff --git a/libxfs/trans.c b/libxfs/trans.c index e76e4258b..b5f6081a1 100644 --- a/libxfs/trans.c +++ b/libxfs/trans.c @@ -512,6 +512,35 @@ libxfs_trans_getsb( return bp; } +struct xfs_buf * +libxfs_trans_getrtsb( + struct xfs_trans *tp) +{ + struct xfs_mount *mp = tp->t_mountp; + struct xfs_buf *bp; + struct xfs_buf_log_item *bip; + int len = XFS_FSS_TO_BB(mp, 1); + DEFINE_SINGLE_BUF_MAP(map, XFS_SB_DADDR, len); + + bp = xfs_trans_buf_item_match(tp, mp->m_rtdev, &map, 1); + if (bp != NULL) { + ASSERT(bp->b_transp == tp); + bip = bp->b_log_item; + ASSERT(bip != NULL); + bip->bli_recur++; + trace_xfs_trans_getsb_recur(bip); + return bp; + } + + bp = libxfs_getrtsb(mp); + if (bp == NULL) + return NULL; + + _libxfs_trans_bjoin(tp, bp, 1); + trace_xfs_trans_getsb(bp->b_log_item); + return bp; +} + int libxfs_trans_read_buf_map( struct xfs_mount *mp, -- 2.50.1