mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 04:33:26 +02:00
xfs: pass perag to filestreams tracing
Pass perags instead of raw ag numbers, avoiding the need for the special peek function for the tracing code. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org>
This commit is contained in:
@@ -31,25 +31,6 @@ enum xfs_fstrm_alloc {
|
|||||||
XFS_PICK_LOWSPACE = 2,
|
XFS_PICK_LOWSPACE = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
* Allocation group filestream associations are tracked with per-ag atomic
|
|
||||||
* counters. These counters allow xfs_filestream_pick_ag() to tell whether a
|
|
||||||
* particular AG already has active filestreams associated with it.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
xfs_filestream_peek_ag(
|
|
||||||
xfs_mount_t *mp,
|
|
||||||
xfs_agnumber_t agno)
|
|
||||||
{
|
|
||||||
struct xfs_perag *pag;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
pag = xfs_perag_get(mp, agno);
|
|
||||||
ret = atomic_read(&pag->pagf_fstrms);
|
|
||||||
xfs_perag_put(pag);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xfs_fstrm_free_func(
|
xfs_fstrm_free_func(
|
||||||
void *data,
|
void *data,
|
||||||
@@ -59,7 +40,7 @@ xfs_fstrm_free_func(
|
|||||||
container_of(mru, struct xfs_fstrm_item, mru);
|
container_of(mru, struct xfs_fstrm_item, mru);
|
||||||
struct xfs_perag *pag = item->pag;
|
struct xfs_perag *pag = item->pag;
|
||||||
|
|
||||||
trace_xfs_filestream_free(pag->pag_mount, mru->key, pag->pag_agno);
|
trace_xfs_filestream_free(pag, mru->key);
|
||||||
atomic_dec(&pag->pagf_fstrms);
|
atomic_dec(&pag->pagf_fstrms);
|
||||||
xfs_perag_rele(pag);
|
xfs_perag_rele(pag);
|
||||||
|
|
||||||
@@ -99,7 +80,7 @@ xfs_filestream_pick_ag(
|
|||||||
|
|
||||||
restart:
|
restart:
|
||||||
for_each_perag_wrap(mp, start_agno, agno, pag) {
|
for_each_perag_wrap(mp, start_agno, agno, pag) {
|
||||||
trace_xfs_filestream_scan(mp, ip->i_ino, agno);
|
trace_xfs_filestream_scan(pag, ip->i_ino);
|
||||||
*longest = 0;
|
*longest = 0;
|
||||||
err = xfs_bmap_longest_free_extent(pag, NULL, longest);
|
err = xfs_bmap_longest_free_extent(pag, NULL, longest);
|
||||||
if (err) {
|
if (err) {
|
||||||
@@ -169,7 +150,7 @@ restart:
|
|||||||
*/
|
*/
|
||||||
if (!max_pag) {
|
if (!max_pag) {
|
||||||
*agp = NULLAGNUMBER;
|
*agp = NULLAGNUMBER;
|
||||||
trace_xfs_filestream_pick(ip, *agp, free, 0);
|
trace_xfs_filestream_pick(ip, NULL, free);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
pag = max_pag;
|
pag = max_pag;
|
||||||
@@ -179,7 +160,7 @@ restart:
|
|||||||
xfs_perag_rele(max_pag);
|
xfs_perag_rele(max_pag);
|
||||||
}
|
}
|
||||||
|
|
||||||
trace_xfs_filestream_pick(ip, pag->pag_agno, free, 0);
|
trace_xfs_filestream_pick(ip, pag, free);
|
||||||
|
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
item = kmem_alloc(sizeof(*item), KM_MAYFAIL);
|
item = kmem_alloc(sizeof(*item), KM_MAYFAIL);
|
||||||
@@ -258,7 +239,7 @@ xfs_filestream_select_ag_mru(
|
|||||||
pag = container_of(mru, struct xfs_fstrm_item, mru)->pag;
|
pag = container_of(mru, struct xfs_fstrm_item, mru)->pag;
|
||||||
xfs_mru_cache_done(mp->m_filestream);
|
xfs_mru_cache_done(mp->m_filestream);
|
||||||
|
|
||||||
trace_xfs_filestream_lookup(mp, ap->ip->i_ino, pag->pag_agno);
|
trace_xfs_filestream_lookup(pag, ap->ip->i_ino);
|
||||||
|
|
||||||
ap->blkno = XFS_AGB_TO_FSB(args->mp, pag->pag_agno, 0);
|
ap->blkno = XFS_AGB_TO_FSB(args->mp, pag->pag_agno, 0);
|
||||||
xfs_bmap_adjacent(ap);
|
xfs_bmap_adjacent(ap);
|
||||||
|
@@ -14,7 +14,6 @@ struct xfs_alloc_arg;
|
|||||||
int xfs_filestream_mount(struct xfs_mount *mp);
|
int xfs_filestream_mount(struct xfs_mount *mp);
|
||||||
void xfs_filestream_unmount(struct xfs_mount *mp);
|
void xfs_filestream_unmount(struct xfs_mount *mp);
|
||||||
void xfs_filestream_deassociate(struct xfs_inode *ip);
|
void xfs_filestream_deassociate(struct xfs_inode *ip);
|
||||||
int xfs_filestream_peek_ag(struct xfs_mount *mp, xfs_agnumber_t agno);
|
|
||||||
int xfs_filestream_select_ag(struct xfs_bmalloca *ap,
|
int xfs_filestream_select_ag(struct xfs_bmalloca *ap,
|
||||||
struct xfs_alloc_arg *args, xfs_extlen_t *blen);
|
struct xfs_alloc_arg *args, xfs_extlen_t *blen);
|
||||||
|
|
||||||
|
@@ -74,6 +74,7 @@ struct xfs_inobt_rec_incore;
|
|||||||
union xfs_btree_ptr;
|
union xfs_btree_ptr;
|
||||||
struct xfs_dqtrx;
|
struct xfs_dqtrx;
|
||||||
struct xfs_icwalk;
|
struct xfs_icwalk;
|
||||||
|
struct xfs_perag;
|
||||||
|
|
||||||
#define XFS_ATTR_FILTER_FLAGS \
|
#define XFS_ATTR_FILTER_FLAGS \
|
||||||
{ XFS_ATTR_ROOT, "ROOT" }, \
|
{ XFS_ATTR_ROOT, "ROOT" }, \
|
||||||
@@ -638,8 +639,8 @@ DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release);
|
|||||||
DEFINE_BUF_ITEM_EVENT(xfs_trans_binval);
|
DEFINE_BUF_ITEM_EVENT(xfs_trans_binval);
|
||||||
|
|
||||||
DECLARE_EVENT_CLASS(xfs_filestream_class,
|
DECLARE_EVENT_CLASS(xfs_filestream_class,
|
||||||
TP_PROTO(struct xfs_mount *mp, xfs_ino_t ino, xfs_agnumber_t agno),
|
TP_PROTO(struct xfs_perag *pag, xfs_ino_t ino),
|
||||||
TP_ARGS(mp, ino, agno),
|
TP_ARGS(pag, ino),
|
||||||
TP_STRUCT__entry(
|
TP_STRUCT__entry(
|
||||||
__field(dev_t, dev)
|
__field(dev_t, dev)
|
||||||
__field(xfs_ino_t, ino)
|
__field(xfs_ino_t, ino)
|
||||||
@@ -647,10 +648,10 @@ DECLARE_EVENT_CLASS(xfs_filestream_class,
|
|||||||
__field(int, streams)
|
__field(int, streams)
|
||||||
),
|
),
|
||||||
TP_fast_assign(
|
TP_fast_assign(
|
||||||
__entry->dev = mp->m_super->s_dev;
|
__entry->dev = pag->pag_mount->m_super->s_dev;
|
||||||
__entry->ino = ino;
|
__entry->ino = ino;
|
||||||
__entry->agno = agno;
|
__entry->agno = pag->pag_agno;
|
||||||
__entry->streams = xfs_filestream_peek_ag(mp, agno);
|
__entry->streams = atomic_read(&pag->pagf_fstrms);
|
||||||
),
|
),
|
||||||
TP_printk("dev %d:%d ino 0x%llx agno 0x%x streams %d",
|
TP_printk("dev %d:%d ino 0x%llx agno 0x%x streams %d",
|
||||||
MAJOR(__entry->dev), MINOR(__entry->dev),
|
MAJOR(__entry->dev), MINOR(__entry->dev),
|
||||||
@@ -660,39 +661,41 @@ DECLARE_EVENT_CLASS(xfs_filestream_class,
|
|||||||
)
|
)
|
||||||
#define DEFINE_FILESTREAM_EVENT(name) \
|
#define DEFINE_FILESTREAM_EVENT(name) \
|
||||||
DEFINE_EVENT(xfs_filestream_class, name, \
|
DEFINE_EVENT(xfs_filestream_class, name, \
|
||||||
TP_PROTO(struct xfs_mount *mp, xfs_ino_t ino, xfs_agnumber_t agno), \
|
TP_PROTO(struct xfs_perag *pag, xfs_ino_t ino), \
|
||||||
TP_ARGS(mp, ino, agno))
|
TP_ARGS(pag, ino))
|
||||||
DEFINE_FILESTREAM_EVENT(xfs_filestream_free);
|
DEFINE_FILESTREAM_EVENT(xfs_filestream_free);
|
||||||
DEFINE_FILESTREAM_EVENT(xfs_filestream_lookup);
|
DEFINE_FILESTREAM_EVENT(xfs_filestream_lookup);
|
||||||
DEFINE_FILESTREAM_EVENT(xfs_filestream_scan);
|
DEFINE_FILESTREAM_EVENT(xfs_filestream_scan);
|
||||||
|
|
||||||
TRACE_EVENT(xfs_filestream_pick,
|
TRACE_EVENT(xfs_filestream_pick,
|
||||||
TP_PROTO(struct xfs_inode *ip, xfs_agnumber_t agno,
|
TP_PROTO(struct xfs_inode *ip, struct xfs_perag *pag,
|
||||||
xfs_extlen_t free, int nscan),
|
xfs_extlen_t free),
|
||||||
TP_ARGS(ip, agno, free, nscan),
|
TP_ARGS(ip, pag, free),
|
||||||
TP_STRUCT__entry(
|
TP_STRUCT__entry(
|
||||||
__field(dev_t, dev)
|
__field(dev_t, dev)
|
||||||
__field(xfs_ino_t, ino)
|
__field(xfs_ino_t, ino)
|
||||||
__field(xfs_agnumber_t, agno)
|
__field(xfs_agnumber_t, agno)
|
||||||
__field(int, streams)
|
__field(int, streams)
|
||||||
__field(xfs_extlen_t, free)
|
__field(xfs_extlen_t, free)
|
||||||
__field(int, nscan)
|
|
||||||
),
|
),
|
||||||
TP_fast_assign(
|
TP_fast_assign(
|
||||||
__entry->dev = VFS_I(ip)->i_sb->s_dev;
|
__entry->dev = VFS_I(ip)->i_sb->s_dev;
|
||||||
__entry->ino = ip->i_ino;
|
__entry->ino = ip->i_ino;
|
||||||
__entry->agno = agno;
|
if (pag) {
|
||||||
__entry->streams = xfs_filestream_peek_ag(ip->i_mount, agno);
|
__entry->agno = pag->pag_agno;
|
||||||
|
__entry->streams = atomic_read(&pag->pagf_fstrms);
|
||||||
|
} else {
|
||||||
|
__entry->agno = NULLAGNUMBER;
|
||||||
|
__entry->streams = 0;
|
||||||
|
}
|
||||||
__entry->free = free;
|
__entry->free = free;
|
||||||
__entry->nscan = nscan;
|
|
||||||
),
|
),
|
||||||
TP_printk("dev %d:%d ino 0x%llx agno 0x%x streams %d free %d nscan %d",
|
TP_printk("dev %d:%d ino 0x%llx agno 0x%x streams %d free %d",
|
||||||
MAJOR(__entry->dev), MINOR(__entry->dev),
|
MAJOR(__entry->dev), MINOR(__entry->dev),
|
||||||
__entry->ino,
|
__entry->ino,
|
||||||
__entry->agno,
|
__entry->agno,
|
||||||
__entry->streams,
|
__entry->streams,
|
||||||
__entry->free,
|
__entry->free)
|
||||||
__entry->nscan)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
DECLARE_EVENT_CLASS(xfs_lock_class,
|
DECLARE_EVENT_CLASS(xfs_lock_class,
|
||||||
|
Reference in New Issue
Block a user