]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
fixup
authorChristoph Hellwig <hch@lst.de>
Mon, 5 Aug 2024 17:50:50 +0000 (10:50 -0700)
committerChristoph Hellwig <hch@lst.de>
Tue, 6 Aug 2024 12:53:49 +0000 (05:53 -0700)
include/xfs_trans.h
libxfs/libxfs_api_defs.h
libxfs/libxfs_io.h
libxfs/rdwr.c
libxfs/trans.c

index d508f8947a301cbc675fc38a2f8ef88d573210a8..248064019a0ab567d0c0ba3022ed10f043d2689b 100644 (file)
@@ -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 *,
index 4e3322ca4ab3aaa1a7bda444f48285f096ba934f..56bdee73f416e69f5f142ef338dc5feecd555068 100644 (file)
 #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
index 82d86f1d1b37bf5e29251407f3cc4ddc18cf15a3..99372eb6d3d13cf0839742cac966fd3c436b2d56 100644 (file)
@@ -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);
index e15d9f17154d03a21a4b871e56652fc280e4bf1c..bd773a7375bcd7f79dd618f59b5b124f6a6f0dea 100644 (file)
@@ -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 =
index e76e4258b1308b69b66073e8d283f0e81a99bd2d..b5f6081a16cb534552b26a731f1309f1b7ab144c 100644 (file)
@@ -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,