mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-15 16:36:42 +07:00
a205f0c974
- Strengthen metadata checking to avoid ASSERTing on bad disk contents - Validate btree records that are being retrieved for clients - Strengthen root inode verification - Convert license blurbs to SPDX tags - Enable changing DAX flag on directories - Fix some writeback deadlocks in reflink - Refactor out some old xfs helpers - Move type verifiers to a separate file - Fix some fuzzer crashes - Various other bug fixes -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEUzaAxoMeQq6m2jMV+H93GTRKtOsFAlsfUegACgkQ+H93GTRK tOv0sw/9HW63zhuzGs9uihmyGvtqNeeUBfKc+3ovJ80wnhYOa0n8yYCBORS1EaMS YPk74IbD0yAak0H9ePdOpont43gGVTDox6/K8+6rPFnWtX30Z2/ckb6BWE4UfoW8 QeojpB2+aS6fqfO1wcSb3i//XRu4h90ORQY0xNkHYcN4GWwIDwPCyBf+AT9HH1E+ GFHtB3QWANZg6LRT7X0GVgz5r68lzyxX1WisJ4uAm0NwKR5zVb9NWFCcOszQ45Ky +YFw4kfgithbIHlwTpo3LrvQk7+cBhlSpWuASZOYjugxcQ2d85B/+9mF/QDnLOey ddbO6WK+wo0KZImpFvOOQZY07cO7vtWwkWHraz0PkUdaEab5rcnooLoJg9UTMZa4 WT8wM8CrX1kkFvJQCuAMV9jblovjETeYhHfG8ak8Z/lWc3WEnEBUFQiO9ZVQdiAv B02xMmpOkfi0fqRCg6li9u3CJtN+2vxPiNEME3lz5zdY5aE2aXSmCspvP3aPVZMt y1fZ90u5NONz6Q9WrIh0plEru4oynhwVuqRrnVRDPCT4X64IZXuf/fBmYqrfZGmJ K45P/LQDvfcHj3xBLhfkKv5OpXtyYgDtLSBNqYAYrcGS4sW7Z4Ts8ohqcOhF1OqR g3mFp75aO4Ekw6hFbg9CRX13G4mu80BmnRKDVwFjThkl6d0Xyxw= =SD3u -----END PGP SIGNATURE----- Merge tag 'xfs-4.18-merge-10' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux Pull more xfs updates from Darrick Wong: "Here's the second round of patches for XFS for 4.18. Most of the commits are small cleanups, bug fixes, and continued strengthening of metadata verifiers; the bulk of the diff is the conversion of the fs/xfs/ tree to use SPDX tags. This series has been run through a full xfstests run over the weekend and through a quick xfstests run against this morning's master, with no major failures reported. Summary: - Strengthen metadata checking to avoid ASSERTing on bad disk contents - Validate btree records that are being retrieved for clients - Strengthen root inode verification - Convert license blurbs to SPDX tags - Enable changing DAX flag on directories - Fix some writeback deadlocks in reflink - Refactor out some old xfs helpers - Move type verifiers to a separate file - Fix some fuzzer crashes - Various other bug fixes" * tag 'xfs-4.18-merge-10' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: (31 commits) xfs: update incore per-AG inode count xfs: replace do_mod with native operations xfs: don't call xfs_da_shrink_inode with NULL bp xfs: clean up MIN/MAX xfs: move various type verifiers to common file xfs: xfs_reflink_convert_cow() memory allocation deadlock xfs: setup VFS i_rwsem lockdep state correctly xfs: fix string handling in label get/set functions xfs: convert to SPDX license tags xfs: validate btree records on retrieval xfs: push corruption -> ESTALE conversion to xfs_nfs_get_inode() xfs: verify root inode more thoroughly xfs: verify COW extent size hint is valid in inode verifier xfs: verify extent size hint is valid in inode verifier xfs: catch bad stripe alignment configurations iomap: fsync swap files before iterating mappings xfs: use xfs_trans_getsb in xfs_sync_sb_buf xfs: don't assert on corrupted unlinked inode list xfs: explicitly pass buffer size to xfs_corruption_error xfs: don't assert when on-disk btree pointers are garbage ...
158 lines
4.0 KiB
C
158 lines
4.0 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
|
|
* All Rights Reserved.
|
|
*/
|
|
#include "xfs.h"
|
|
#include <linux/proc_fs.h>
|
|
|
|
struct xstats xfsstats;
|
|
|
|
static int counter_val(struct xfsstats __percpu *stats, int idx)
|
|
{
|
|
int val = 0, cpu;
|
|
|
|
for_each_possible_cpu(cpu)
|
|
val += *(((__u32 *)per_cpu_ptr(stats, cpu) + idx));
|
|
return val;
|
|
}
|
|
|
|
int xfs_stats_format(struct xfsstats __percpu *stats, char *buf)
|
|
{
|
|
int i, j;
|
|
int len = 0;
|
|
uint64_t xs_xstrat_bytes = 0;
|
|
uint64_t xs_write_bytes = 0;
|
|
uint64_t xs_read_bytes = 0;
|
|
|
|
static const struct xstats_entry {
|
|
char *desc;
|
|
int endpoint;
|
|
} xstats[] = {
|
|
{ "extent_alloc", XFSSTAT_END_EXTENT_ALLOC },
|
|
{ "abt", XFSSTAT_END_ALLOC_BTREE },
|
|
{ "blk_map", XFSSTAT_END_BLOCK_MAPPING },
|
|
{ "bmbt", XFSSTAT_END_BLOCK_MAP_BTREE },
|
|
{ "dir", XFSSTAT_END_DIRECTORY_OPS },
|
|
{ "trans", XFSSTAT_END_TRANSACTIONS },
|
|
{ "ig", XFSSTAT_END_INODE_OPS },
|
|
{ "log", XFSSTAT_END_LOG_OPS },
|
|
{ "push_ail", XFSSTAT_END_TAIL_PUSHING },
|
|
{ "xstrat", XFSSTAT_END_WRITE_CONVERT },
|
|
{ "rw", XFSSTAT_END_READ_WRITE_OPS },
|
|
{ "attr", XFSSTAT_END_ATTRIBUTE_OPS },
|
|
{ "icluster", XFSSTAT_END_INODE_CLUSTER },
|
|
{ "vnodes", XFSSTAT_END_VNODE_OPS },
|
|
{ "buf", XFSSTAT_END_BUF },
|
|
{ "abtb2", XFSSTAT_END_ABTB_V2 },
|
|
{ "abtc2", XFSSTAT_END_ABTC_V2 },
|
|
{ "bmbt2", XFSSTAT_END_BMBT_V2 },
|
|
{ "ibt2", XFSSTAT_END_IBT_V2 },
|
|
{ "fibt2", XFSSTAT_END_FIBT_V2 },
|
|
{ "rmapbt", XFSSTAT_END_RMAP_V2 },
|
|
{ "refcntbt", XFSSTAT_END_REFCOUNT },
|
|
/* we print both series of quota information together */
|
|
{ "qm", XFSSTAT_END_QM },
|
|
};
|
|
|
|
/* Loop over all stats groups */
|
|
|
|
for (i = j = 0; i < ARRAY_SIZE(xstats); i++) {
|
|
len += snprintf(buf + len, PATH_MAX - len, "%s",
|
|
xstats[i].desc);
|
|
/* inner loop does each group */
|
|
for (; j < xstats[i].endpoint; j++)
|
|
len += snprintf(buf + len, PATH_MAX - len, " %u",
|
|
counter_val(stats, j));
|
|
len += snprintf(buf + len, PATH_MAX - len, "\n");
|
|
}
|
|
/* extra precision counters */
|
|
for_each_possible_cpu(i) {
|
|
xs_xstrat_bytes += per_cpu_ptr(stats, i)->s.xs_xstrat_bytes;
|
|
xs_write_bytes += per_cpu_ptr(stats, i)->s.xs_write_bytes;
|
|
xs_read_bytes += per_cpu_ptr(stats, i)->s.xs_read_bytes;
|
|
}
|
|
|
|
len += snprintf(buf + len, PATH_MAX-len, "xpc %Lu %Lu %Lu\n",
|
|
xs_xstrat_bytes, xs_write_bytes, xs_read_bytes);
|
|
len += snprintf(buf + len, PATH_MAX-len, "debug %u\n",
|
|
#if defined(DEBUG)
|
|
1);
|
|
#else
|
|
0);
|
|
#endif
|
|
|
|
return len;
|
|
}
|
|
|
|
void xfs_stats_clearall(struct xfsstats __percpu *stats)
|
|
{
|
|
int c;
|
|
uint32_t vn_active;
|
|
|
|
xfs_notice(NULL, "Clearing xfsstats");
|
|
for_each_possible_cpu(c) {
|
|
preempt_disable();
|
|
/* save vn_active, it's a universal truth! */
|
|
vn_active = per_cpu_ptr(stats, c)->s.vn_active;
|
|
memset(per_cpu_ptr(stats, c), 0, sizeof(*stats));
|
|
per_cpu_ptr(stats, c)->s.vn_active = vn_active;
|
|
preempt_enable();
|
|
}
|
|
}
|
|
|
|
#ifdef CONFIG_PROC_FS
|
|
/* legacy quota interfaces */
|
|
#ifdef CONFIG_XFS_QUOTA
|
|
static int xqm_proc_show(struct seq_file *m, void *v)
|
|
{
|
|
/* maximum; incore; ratio free to inuse; freelist */
|
|
seq_printf(m, "%d\t%d\t%d\t%u\n",
|
|
0, counter_val(xfsstats.xs_stats, XFSSTAT_END_XQMSTAT),
|
|
0, counter_val(xfsstats.xs_stats, XFSSTAT_END_XQMSTAT + 1));
|
|
return 0;
|
|
}
|
|
|
|
/* legacy quota stats interface no 2 */
|
|
static int xqmstat_proc_show(struct seq_file *m, void *v)
|
|
{
|
|
int j;
|
|
|
|
seq_printf(m, "qm");
|
|
for (j = XFSSTAT_END_IBT_V2; j < XFSSTAT_END_XQMSTAT; j++)
|
|
seq_printf(m, " %u", counter_val(xfsstats.xs_stats, j));
|
|
seq_putc(m, '\n');
|
|
return 0;
|
|
}
|
|
#endif /* CONFIG_XFS_QUOTA */
|
|
|
|
int
|
|
xfs_init_procfs(void)
|
|
{
|
|
if (!proc_mkdir("fs/xfs", NULL))
|
|
return -ENOMEM;
|
|
|
|
if (!proc_symlink("fs/xfs/stat", NULL,
|
|
"/sys/fs/xfs/stats/stats"))
|
|
goto out;
|
|
|
|
#ifdef CONFIG_XFS_QUOTA
|
|
if (!proc_create_single("fs/xfs/xqmstat", 0, NULL, xqmstat_proc_show))
|
|
goto out;
|
|
if (!proc_create_single("fs/xfs/xqm", 0, NULL, xqm_proc_show))
|
|
goto out;
|
|
#endif
|
|
return 0;
|
|
|
|
out:
|
|
remove_proc_subtree("fs/xfs", NULL);
|
|
return -ENOMEM;
|
|
}
|
|
|
|
void
|
|
xfs_cleanup_procfs(void)
|
|
{
|
|
remove_proc_subtree("fs/xfs", NULL);
|
|
}
|
|
#endif /* CONFIG_PROC_FS */
|