summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2021-01-05 17:45:05 -0800
committerDarrick J. Wong <djwong@kernel.org>2021-03-25 17:08:26 -0700
commit40aedba26aa8dfe02b941c27a955e3ac2c5245e0 (patch)
tree34115aebaf1d6769dc4ef1b563ff5b1865dc9143
parent11cb8ced0b2fdf0be0cc133edbe70654663fd012 (diff)
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>
-rw-r--r--fs/xfs/libxfs/xfs_bmap.c36
-rw-r--r--fs/xfs/libxfs/xfs_log_format.h4
-rw-r--r--fs/xfs/xfs_bmap_item.c8
-rw-r--r--fs/xfs/xfs_trace.h8
4 files changed, 37 insertions, 19 deletions
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index 3565e2800ea1..8440f6dede00 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -6315,14 +6315,20 @@ __xfs_bmap_add(
{
struct xfs_bmap_intent *bi;
- trace_xfs_bmap_defer(tp->t_mountp,
- XFS_FSB_TO_AGNO(tp->t_mountp, bmap->br_startblock),
- type,
- XFS_FSB_TO_AGBNO(tp->t_mountp, bmap->br_startblock),
- ip->i_ino, whichfork,
- bmap->br_startoff,
- bmap->br_blockcount,
- bmap->br_state);
+ if (xfs_ifork_is_realtime(ip, whichfork))
+ trace_xfs_bmap_defer(tp->t_mountp, NULLAGNUMBER, type,
+ bmap->br_startblock, ip->i_ino, whichfork,
+ bmap->br_startoff, bmap->br_blockcount,
+ bmap->br_state);
+ else
+ trace_xfs_bmap_defer(tp->t_mountp,
+ XFS_FSB_TO_AGNO(tp->t_mountp,
+ bmap->br_startblock),
+ type,
+ XFS_FSB_TO_AGBNO(tp->t_mountp,
+ bmap->br_startblock),
+ ip->i_ino, whichfork, bmap->br_startoff,
+ bmap->br_blockcount, bmap->br_state);
bi = kmem_alloc(sizeof(struct xfs_bmap_intent), KM_NOFS);
INIT_LIST_HEAD(&bi->bi_list);
@@ -6380,10 +6386,16 @@ xfs_bmap_finish_one(
ASSERT(tp->t_firstblock == NULLFSBLOCK);
- trace_xfs_bmap_deferred(tp->t_mountp,
- XFS_FSB_TO_AGNO(tp->t_mountp, startblock), type,
- XFS_FSB_TO_AGBNO(tp->t_mountp, startblock),
- ip->i_ino, whichfork, startoff, *blockcount, state);
+ if (xfs_ifork_is_realtime(ip, whichfork))
+ trace_xfs_bmap_deferred(tp->t_mountp, NULLAGNUMBER, type,
+ startblock, ip->i_ino, whichfork, startoff,
+ *blockcount, state);
+ else
+ trace_xfs_bmap_deferred(tp->t_mountp,
+ XFS_FSB_TO_AGNO(tp->t_mountp, startblock), type,
+ XFS_FSB_TO_AGBNO(tp->t_mountp, startblock),
+ ip->i_ino, whichfork, startoff, *blockcount,
+ state);
if (WARN_ON_ONCE(whichfork != XFS_DATA_FORK)) {
xfs_bmap_mark_sick(ip, whichfork);
diff --git a/fs/xfs/libxfs/xfs_log_format.h b/fs/xfs/libxfs/xfs_log_format.h
index 8bd00da6d2a4..6107dac4bd6b 100644
--- a/fs/xfs/libxfs/xfs_log_format.h
+++ b/fs/xfs/libxfs/xfs_log_format.h
@@ -744,10 +744,12 @@ struct xfs_cud_log_format {
#define XFS_BMAP_EXTENT_ATTR_FORK (1U << 31)
#define XFS_BMAP_EXTENT_UNWRITTEN (1U << 30)
+#define XFS_BMAP_EXTENT_REALTIME (1U << 29)
#define XFS_BMAP_EXTENT_FLAGS (XFS_BMAP_EXTENT_TYPE_MASK | \
XFS_BMAP_EXTENT_ATTR_FORK | \
- XFS_BMAP_EXTENT_UNWRITTEN)
+ XFS_BMAP_EXTENT_UNWRITTEN | \
+ XFS_BMAP_EXTENT_REALTIME)
/*
* This is the structure used to lay out an bui log item in the
diff --git a/fs/xfs/xfs_bmap_item.c b/fs/xfs/xfs_bmap_item.c
index 2344757ede63..d7165de24f4b 100644
--- a/fs/xfs/xfs_bmap_item.c
+++ b/fs/xfs/xfs_bmap_item.c
@@ -282,7 +282,8 @@ xfs_trans_set_bmap_flags(
struct xfs_map_extent *bmap,
enum xfs_bmap_intent_type type,
int whichfork,
- xfs_exntst_t state)
+ xfs_exntst_t state,
+ bool rtfile)
{
bmap->me_flags = 0;
switch (type) {
@@ -297,6 +298,8 @@ xfs_trans_set_bmap_flags(
bmap->me_flags |= XFS_BMAP_EXTENT_UNWRITTEN;
if (whichfork == XFS_ATTR_FORK)
bmap->me_flags |= XFS_BMAP_EXTENT_ATTR_FORK;
+ if (rtfile && whichfork == XFS_DATA_FORK)
+ bmap->me_flags |= XFS_BMAP_EXTENT_REALTIME;
}
/* Log bmap updates in the intent item. */
@@ -325,7 +328,8 @@ xfs_bmap_update_log_item(
map->me_startoff = bmap->bi_bmap.br_startoff;
map->me_len = bmap->bi_bmap.br_blockcount;
xfs_trans_set_bmap_flags(map, bmap->bi_type, bmap->bi_whichfork,
- bmap->bi_bmap.br_state);
+ bmap->bi_bmap.br_state,
+ XFS_IS_REALTIME_INODE(bmap->bi_owner));
}
static struct xfs_log_item *
diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
index 64953eafe327..e5cc6f2a4fa8 100644
--- a/fs/xfs/xfs_trace.h
+++ b/fs/xfs/xfs_trace.h
@@ -2494,7 +2494,7 @@ DEFINE_EVENT(xfs_phys_extent_deferred_class, name, \
DECLARE_EVENT_CLASS(xfs_map_extent_deferred_class,
TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
int op,
- xfs_agblock_t agbno,
+ xfs_fsblock_t agbno,
xfs_ino_t ino,
int whichfork,
xfs_fileoff_t offset,
@@ -2505,7 +2505,7 @@ DECLARE_EVENT_CLASS(xfs_map_extent_deferred_class,
__field(dev_t, dev)
__field(xfs_agnumber_t, agno)
__field(xfs_ino_t, ino)
- __field(xfs_agblock_t, agbno)
+ __field(xfs_fsblock_t, agbno)
__field(int, whichfork)
__field(xfs_fileoff_t, l_loff)
__field(xfs_filblks_t, l_len)
@@ -2523,7 +2523,7 @@ DECLARE_EVENT_CLASS(xfs_map_extent_deferred_class,
__entry->l_state = state;
__entry->op = op;
),
- TP_printk("dev %d:%d op %d agno %u agbno %u owner %lld %s offset %llu len %llu state %d",
+ TP_printk("dev %d:%d op %d agno %u agbno %llu owner %lld %s offset %llu len %llu state %d",
MAJOR(__entry->dev), MINOR(__entry->dev),
__entry->op,
__entry->agno,
@@ -2538,7 +2538,7 @@ DECLARE_EVENT_CLASS(xfs_map_extent_deferred_class,
DEFINE_EVENT(xfs_map_extent_deferred_class, name, \
TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
int op, \
- xfs_agblock_t agbno, \
+ xfs_fsblock_t agbno, \
xfs_ino_t ino, \
int whichfork, \
xfs_fileoff_t offset, \