]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs_db: access realtime file blocks
authorDarrick J. Wong <djwong@kernel.org>
Tue, 20 Sep 2022 19:37:50 +0000 (12:37 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 22 Nov 2023 23:03:32 +0000 (15:03 -0800)
Now that we have the ability to point the io cursor at the realtime
device, let's make it so that the "dblock" command can walk the contents
of realtime files.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
db/block.c
db/faddr.c

index d064fbed5aaa0cd5544577f0a08e30d5adf034ae..ae8744685b0234d8d357dea5a04351907202027d 100644 (file)
@@ -195,6 +195,13 @@ dblock_help(void)
 ));
 }
 
+static inline bool
+is_rtfile(
+       struct xfs_dinode       *dip)
+{
+       return dip->di_flags & cpu_to_be16(XFS_DIFLAG_REALTIME);
+}
+
 static int
 dblock_f(
        int             argc,
@@ -234,8 +241,14 @@ dblock_f(
        ASSERT(typtab[type].typnm == type);
        if (nex > 1)
                make_bbmap(&bbmap, nex, bmp);
-       set_cur(&typtab[type], (int64_t)XFS_FSB_TO_DADDR(mp, dfsbno),
-               nb * blkbb, DB_RING_ADD, nex > 1 ? &bbmap : NULL);
+       if (is_rtfile(iocur_top->data))
+               set_rt_cur(&typtab[type], (int64_t)XFS_FSB_TO_DADDR(mp, dfsbno),
+                               nb * blkbb, DB_RING_ADD,
+                               nex > 1 ? &bbmap : NULL);
+       else
+               set_cur(&typtab[type], (int64_t)XFS_FSB_TO_DADDR(mp, dfsbno),
+                               nb * blkbb, DB_RING_ADD,
+                               nex > 1 ? &bbmap : NULL);
        free(bmp);
        return 0;
 }
index ec4aae68bb5a8172cc69f9f9186d3f50b454a49f..fd65b86b5e915d4b6414ea1e1387336da9667d36 100644 (file)
@@ -323,7 +323,9 @@ fa_drtbno(
                dbprintf(_("null block number, cannot set new addr\n"));
                return;
        }
-       /* need set_cur to understand rt subvolume */
+
+       set_rt_cur(&typtab[next], (int64_t)XFS_FSB_TO_BB(mp, bno), blkbb,
+                       DB_RING_ADD, NULL);
 }
 
 /*ARGSUSED*/