Skip to content

Commit 7302cda

Browse files
author
Darrick J. Wong
committed
xfs: add a realtime flag to the bmap update log redo items
Extend the bmap update (BUI) log items with a new realtime flag that indicates that the updates apply against a realtime file's data fork. We'll wire up the actual code later. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
1 parent 2b6a5ec commit 7302cda

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

fs/xfs/libxfs/xfs_log_format.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,10 +838,12 @@ struct xfs_cud_log_format {
838838

839839
#define XFS_BMAP_EXTENT_ATTR_FORK (1U << 31)
840840
#define XFS_BMAP_EXTENT_UNWRITTEN (1U << 30)
841+
#define XFS_BMAP_EXTENT_REALTIME (1U << 29)
841842

842843
#define XFS_BMAP_EXTENT_FLAGS (XFS_BMAP_EXTENT_TYPE_MASK | \
843844
XFS_BMAP_EXTENT_ATTR_FORK | \
844-
XFS_BMAP_EXTENT_UNWRITTEN)
845+
XFS_BMAP_EXTENT_UNWRITTEN | \
846+
XFS_BMAP_EXTENT_REALTIME)
845847

846848
/*
847849
* This is the structure used to lay out an bui log item in the

fs/xfs/xfs_bmap_item.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,8 @@ xfs_bmap_update_log_item(
275275
map->me_flags |= XFS_BMAP_EXTENT_UNWRITTEN;
276276
if (bi->bi_whichfork == XFS_ATTR_FORK)
277277
map->me_flags |= XFS_BMAP_EXTENT_ATTR_FORK;
278+
if (xfs_ifork_is_realtime(bi->bi_owner, bi->bi_whichfork))
279+
map->me_flags |= XFS_BMAP_EXTENT_REALTIME;
278280
}
279281

280282
static struct xfs_log_item *
@@ -324,6 +326,9 @@ xfs_bmap_update_get_group(
324326
{
325327
xfs_agnumber_t agno;
326328

329+
if (xfs_ifork_is_realtime(bi->bi_owner, bi->bi_whichfork))
330+
return;
331+
327332
agno = XFS_FSB_TO_AGNO(mp, bi->bi_bmap.br_startblock);
328333

329334
/*
@@ -353,6 +358,9 @@ static inline void
353358
xfs_bmap_update_put_group(
354359
struct xfs_bmap_intent *bi)
355360
{
361+
if (xfs_ifork_is_realtime(bi->bi_owner, bi->bi_whichfork))
362+
return;
363+
356364
xfs_perag_intent_put(bi->bi_pag);
357365
}
358366

fs/xfs/xfs_trace.h

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2955,9 +2955,11 @@ DECLARE_EVENT_CLASS(xfs_bmap_deferred_class,
29552955
TP_ARGS(bi),
29562956
TP_STRUCT__entry(
29572957
__field(dev_t, dev)
2958+
__field(dev_t, opdev)
29582959
__field(xfs_agnumber_t, agno)
29592960
__field(xfs_ino_t, ino)
29602961
__field(xfs_agblock_t, agbno)
2962+
__field(xfs_fsblock_t, rtbno)
29612963
__field(int, whichfork)
29622964
__field(xfs_fileoff_t, l_loff)
29632965
__field(xfs_filblks_t, l_len)
@@ -2968,23 +2970,34 @@ DECLARE_EVENT_CLASS(xfs_bmap_deferred_class,
29682970
struct xfs_inode *ip = bi->bi_owner;
29692971

29702972
__entry->dev = ip->i_mount->m_super->s_dev;
2971-
__entry->agno = XFS_FSB_TO_AGNO(ip->i_mount,
2972-
bi->bi_bmap.br_startblock);
2973+
if (xfs_ifork_is_realtime(ip, bi->bi_whichfork)) {
2974+
__entry->agno = 0;
2975+
__entry->agbno = 0;
2976+
__entry->rtbno = bi->bi_bmap.br_startblock;
2977+
__entry->opdev = ip->i_mount->m_rtdev_targp->bt_dev;
2978+
} else {
2979+
__entry->agno = XFS_FSB_TO_AGNO(ip->i_mount,
2980+
bi->bi_bmap.br_startblock);
2981+
__entry->agbno = XFS_FSB_TO_AGBNO(ip->i_mount,
2982+
bi->bi_bmap.br_startblock);
2983+
__entry->rtbno = 0;
2984+
__entry->opdev = __entry->dev;
2985+
}
29732986
__entry->ino = ip->i_ino;
2974-
__entry->agbno = XFS_FSB_TO_AGBNO(ip->i_mount,
2975-
bi->bi_bmap.br_startblock);
29762987
__entry->whichfork = bi->bi_whichfork;
29772988
__entry->l_loff = bi->bi_bmap.br_startoff;
29782989
__entry->l_len = bi->bi_bmap.br_blockcount;
29792990
__entry->l_state = bi->bi_bmap.br_state;
29802991
__entry->op = bi->bi_type;
29812992
),
2982-
TP_printk("dev %d:%d op %s ino 0x%llx agno 0x%x agbno 0x%x %s fileoff 0x%llx fsbcount 0x%llx state %d",
2993+
TP_printk("dev %d:%d op %s opdev %d:%d ino 0x%llx agno 0x%x agbno 0x%x rtbno 0x%llx %s fileoff 0x%llx fsbcount 0x%llx state %d",
29832994
MAJOR(__entry->dev), MINOR(__entry->dev),
29842995
__print_symbolic(__entry->op, XFS_BMAP_INTENT_STRINGS),
2996+
MAJOR(__entry->opdev), MINOR(__entry->opdev),
29852997
__entry->ino,
29862998
__entry->agno,
29872999
__entry->agbno,
3000+
__entry->rtbno,
29883001
__print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
29893002
__entry->l_loff,
29903003
__entry->l_len,

0 commit comments

Comments
 (0)