|
Packit Service |
310c69 |
/*
|
|
Packit Service |
310c69 |
* Copyright (c) 2020 Red Hat, Inc.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* This program is free software; you can redistribute it and/or
|
|
Packit Service |
310c69 |
* modify it under the terms of the GNU General Public License
|
|
Packit Service |
310c69 |
* as published by the Free Software Foundation; either version 2
|
|
Packit Service |
310c69 |
* of the License, or (at your option) any later version.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* This program is distributed in the hope that it will be useful,
|
|
Packit Service |
310c69 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
310c69 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Service |
310c69 |
* GNU General Public License for more details.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* You should have received a copy of the GNU General Public License
|
|
Packit Service |
310c69 |
* along with this program; if not, write to the Free Software
|
|
Packit Service |
310c69 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
Packit Service |
310c69 |
* 02110-1301, USA.
|
|
Packit Service |
310c69 |
*/
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
#ifndef STATISTICS_H
|
|
Packit Service |
310c69 |
#define STATISTICS_H
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
#include "header.h"
|
|
Packit Service |
310c69 |
#include "types.h"
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
enum {
|
|
Packit Service |
310c69 |
STATISTICS_VERSION = 31,
|
|
Packit Service |
310c69 |
};
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
typedef struct {
|
|
Packit Service |
310c69 |
/** The total number of slabs from which blocks may be allocated */
|
|
Packit Service |
310c69 |
uint64_t slabCount;
|
|
Packit Service |
310c69 |
/** The total number of slabs from which blocks have ever been allocated */
|
|
Packit Service |
310c69 |
uint64_t slabsOpened;
|
|
Packit Service |
310c69 |
/** The number of times since loading that a slab has been re-opened */
|
|
Packit Service |
310c69 |
uint64_t slabsReopened;
|
|
Packit Service |
310c69 |
} BlockAllocatorStatistics;
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**
|
|
Packit Service |
310c69 |
* Counters for tracking the number of items written (blocks, requests, etc.)
|
|
Packit Service |
310c69 |
* that keep track of totals at steps in the write pipeline. Three counters
|
|
Packit Service |
310c69 |
* allow the number of buffered, in-memory items and the number of in-flight,
|
|
Packit Service |
310c69 |
* unacknowledged writes to be derived, while still tracking totals for
|
|
Packit Service |
310c69 |
* reporting purposes
|
|
Packit Service |
310c69 |
**/
|
|
Packit Service |
310c69 |
typedef struct {
|
|
Packit Service |
310c69 |
/** The total number of items on which processing has started */
|
|
Packit Service |
310c69 |
uint64_t started;
|
|
Packit Service |
310c69 |
/** The total number of items for which a write operation has been issued */
|
|
Packit Service |
310c69 |
uint64_t written;
|
|
Packit Service |
310c69 |
/** The total number of items for which a write operation has completed */
|
|
Packit Service |
310c69 |
uint64_t committed;
|
|
Packit Service |
310c69 |
} CommitStatistics;
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/** Counters for events in the recovery journal */
|
|
Packit Service |
310c69 |
typedef struct {
|
|
Packit Service |
310c69 |
/** Number of times the on-disk journal was full */
|
|
Packit Service |
310c69 |
uint64_t diskFull;
|
|
Packit Service |
310c69 |
/** Number of times the recovery journal requested slab journal commits. */
|
|
Packit Service |
310c69 |
uint64_t slabJournalCommitsRequested;
|
|
Packit Service |
310c69 |
/** Write/Commit totals for individual journal entries */
|
|
Packit Service |
310c69 |
CommitStatistics entries;
|
|
Packit Service |
310c69 |
/** Write/Commit totals for journal blocks */
|
|
Packit Service |
310c69 |
CommitStatistics blocks;
|
|
Packit Service |
310c69 |
} RecoveryJournalStatistics;
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/** The statistics for the compressed block packer. */
|
|
Packit Service |
310c69 |
typedef struct {
|
|
Packit Service |
310c69 |
/** Number of compressed data items written since startup */
|
|
Packit Service |
310c69 |
uint64_t compressedFragmentsWritten;
|
|
Packit Service |
310c69 |
/** Number of blocks containing compressed items written since startup */
|
|
Packit Service |
310c69 |
uint64_t compressedBlocksWritten;
|
|
Packit Service |
310c69 |
/** Number of VIOs that are pending in the packer */
|
|
Packit Service |
310c69 |
uint64_t compressedFragmentsInPacker;
|
|
Packit Service |
310c69 |
} PackerStatistics;
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/** The statistics for the slab journals. */
|
|
Packit Service |
310c69 |
typedef struct {
|
|
Packit Service |
310c69 |
/** Number of times the on-disk journal was full */
|
|
Packit Service |
310c69 |
uint64_t diskFullCount;
|
|
Packit Service |
310c69 |
/** Number of times an entry was added over the flush threshold */
|
|
Packit Service |
310c69 |
uint64_t flushCount;
|
|
Packit Service |
310c69 |
/** Number of times an entry was added over the block threshold */
|
|
Packit Service |
310c69 |
uint64_t blockedCount;
|
|
Packit Service |
310c69 |
/** Number of times a tail block was written */
|
|
Packit Service |
310c69 |
uint64_t blocksWritten;
|
|
Packit Service |
310c69 |
/** Number of times we had to wait for the tail to write */
|
|
Packit Service |
310c69 |
uint64_t tailBusyCount;
|
|
Packit Service |
310c69 |
} SlabJournalStatistics;
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/** The statistics for the slab summary. */
|
|
Packit Service |
310c69 |
typedef struct {
|
|
Packit Service |
310c69 |
/** Number of blocks written */
|
|
Packit Service |
310c69 |
uint64_t blocksWritten;
|
|
Packit Service |
310c69 |
} SlabSummaryStatistics;
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/** The statistics for the reference counts. */
|
|
Packit Service |
310c69 |
typedef struct {
|
|
Packit Service |
310c69 |
/** Number of reference blocks written */
|
|
Packit Service |
310c69 |
uint64_t blocksWritten;
|
|
Packit Service |
310c69 |
} RefCountsStatistics;
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/** The statistics for the block map. */
|
|
Packit Service |
310c69 |
typedef struct {
|
|
Packit Service |
310c69 |
/** number of dirty (resident) pages */
|
|
Packit Service |
310c69 |
uint32_t dirtyPages;
|
|
Packit Service |
310c69 |
/** number of clean (resident) pages */
|
|
Packit Service |
310c69 |
uint32_t cleanPages;
|
|
Packit Service |
310c69 |
/** number of free pages */
|
|
Packit Service |
310c69 |
uint32_t freePages;
|
|
Packit Service |
310c69 |
/** number of pages in failed state */
|
|
Packit Service |
310c69 |
uint32_t failedPages;
|
|
Packit Service |
310c69 |
/** number of pages incoming */
|
|
Packit Service |
310c69 |
uint32_t incomingPages;
|
|
Packit Service |
310c69 |
/** number of pages outgoing */
|
|
Packit Service |
310c69 |
uint32_t outgoingPages;
|
|
Packit Service |
310c69 |
/** how many times free page not avail */
|
|
Packit Service |
310c69 |
uint32_t cachePressure;
|
|
Packit Service |
310c69 |
/** number of getVDOPageAsync() for read */
|
|
Packit Service |
310c69 |
uint64_t readCount;
|
|
Packit Service |
310c69 |
/** number or getVDOPageAsync() for write */
|
|
Packit Service |
310c69 |
uint64_t writeCount;
|
|
Packit Service |
310c69 |
/** number of times pages failed to read */
|
|
Packit Service |
310c69 |
uint64_t failedReads;
|
|
Packit Service |
310c69 |
/** number of times pages failed to write */
|
|
Packit Service |
310c69 |
uint64_t failedWrites;
|
|
Packit Service |
310c69 |
/** number of gets that are reclaimed */
|
|
Packit Service |
310c69 |
uint64_t reclaimed;
|
|
Packit Service |
310c69 |
/** number of gets for outgoing pages */
|
|
Packit Service |
310c69 |
uint64_t readOutgoing;
|
|
Packit Service |
310c69 |
/** number of gets that were already there */
|
|
Packit Service |
310c69 |
uint64_t foundInCache;
|
|
Packit Service |
310c69 |
/** number of gets requiring discard */
|
|
Packit Service |
310c69 |
uint64_t discardRequired;
|
|
Packit Service |
310c69 |
/** number of gets enqueued for their page */
|
|
Packit Service |
310c69 |
uint64_t waitForPage;
|
|
Packit Service |
310c69 |
/** number of gets that have to fetch */
|
|
Packit Service |
310c69 |
uint64_t fetchRequired;
|
|
Packit Service |
310c69 |
/** number of page fetches */
|
|
Packit Service |
310c69 |
uint64_t pagesLoaded;
|
|
Packit Service |
310c69 |
/** number of page saves */
|
|
Packit Service |
310c69 |
uint64_t pagesSaved;
|
|
Packit Service |
310c69 |
/** the number of flushes issued */
|
|
Packit Service |
310c69 |
uint64_t flushCount;
|
|
Packit Service |
310c69 |
} BlockMapStatistics;
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/** The dedupe statistics from hash locks */
|
|
Packit Service |
310c69 |
typedef struct {
|
|
Packit Service |
310c69 |
/** Number of times the UDS advice proved correct */
|
|
Packit Service |
310c69 |
uint64_t dedupeAdviceValid;
|
|
Packit Service |
310c69 |
/** Number of times the UDS advice proved incorrect */
|
|
Packit Service |
310c69 |
uint64_t dedupeAdviceStale;
|
|
Packit Service |
310c69 |
/** Number of writes with the same data as another in-flight write */
|
|
Packit Service |
310c69 |
uint64_t concurrentDataMatches;
|
|
Packit Service |
310c69 |
/** Number of writes whose hash collided with an in-flight write */
|
|
Packit Service |
310c69 |
uint64_t concurrentHashCollisions;
|
|
Packit Service |
310c69 |
} HashLockStatistics;
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/** Counts of error conditions in VDO. */
|
|
Packit Service |
310c69 |
typedef struct {
|
|
Packit Service |
310c69 |
/** number of times VDO got an invalid dedupe advice PBN from UDS */
|
|
Packit Service |
310c69 |
uint64_t invalidAdvicePBNCount;
|
|
Packit Service |
310c69 |
/** number of times a VIO completed with a VDO_NO_SPACE error */
|
|
Packit Service |
310c69 |
uint64_t noSpaceErrorCount;
|
|
Packit Service |
310c69 |
/** number of times a VIO completed with a VDO_READ_ONLY error */
|
|
Packit Service |
310c69 |
uint64_t readOnlyErrorCount;
|
|
Packit Service |
310c69 |
} ErrorStatistics;
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/** The statistics of the vdo service. */
|
|
Packit Service |
310c69 |
struct vdoStatistics {
|
|
Packit Service |
310c69 |
uint32_t version;
|
|
Packit Service |
310c69 |
uint32_t releaseVersion;
|
|
Packit Service |
310c69 |
/** Number of blocks used for data */
|
|
Packit Service |
310c69 |
uint64_t dataBlocksUsed;
|
|
Packit Service |
310c69 |
/** Number of blocks used for VDO metadata */
|
|
Packit Service |
310c69 |
uint64_t overheadBlocksUsed;
|
|
Packit Service |
310c69 |
/** Number of logical blocks that are currently mapped to physical blocks */
|
|
Packit Service |
310c69 |
uint64_t logicalBlocksUsed;
|
|
Packit Service |
310c69 |
/** number of physical blocks */
|
|
Packit Service |
310c69 |
BlockCount physicalBlocks;
|
|
Packit Service |
310c69 |
/** number of logical blocks */
|
|
Packit Service |
310c69 |
BlockCount logicalBlocks;
|
|
Packit Service |
310c69 |
/** Size of the block map page cache, in bytes */
|
|
Packit Service |
310c69 |
uint64_t blockMapCacheSize;
|
|
Packit Service |
310c69 |
/** String describing the active write policy of the VDO */
|
|
Packit Service |
310c69 |
char writePolicy[15];
|
|
Packit Service |
310c69 |
/** The physical block size */
|
|
Packit Service |
310c69 |
uint64_t blockSize;
|
|
Packit Service |
310c69 |
/** Number of times the VDO has successfully recovered */
|
|
Packit Service |
310c69 |
uint64_t completeRecoveries;
|
|
Packit Service |
310c69 |
/** Number of times the VDO has recovered from read-only mode */
|
|
Packit Service |
310c69 |
uint64_t readOnlyRecoveries;
|
|
Packit Service |
310c69 |
/** String describing the operating mode of the VDO */
|
|
Packit Service |
310c69 |
char mode[15];
|
|
Packit Service |
310c69 |
/** Whether the VDO is in recovery mode */
|
|
Packit Service |
310c69 |
bool inRecoveryMode;
|
|
Packit Service |
310c69 |
/** What percentage of recovery mode work has been completed */
|
|
Packit Service |
310c69 |
uint8_t recoveryPercentage;
|
|
Packit Service |
310c69 |
/** The statistics for the compressed block packer */
|
|
Packit Service |
310c69 |
PackerStatistics packer;
|
|
Packit Service |
310c69 |
/** Counters for events in the block allocator */
|
|
Packit Service |
310c69 |
BlockAllocatorStatistics allocator;
|
|
Packit Service |
310c69 |
/** Counters for events in the recovery journal */
|
|
Packit Service |
310c69 |
RecoveryJournalStatistics journal;
|
|
Packit Service |
310c69 |
/** The statistics for the slab journals */
|
|
Packit Service |
310c69 |
SlabJournalStatistics slabJournal;
|
|
Packit Service |
310c69 |
/** The statistics for the slab summary */
|
|
Packit Service |
310c69 |
SlabSummaryStatistics slabSummary;
|
|
Packit Service |
310c69 |
/** The statistics for the reference counts */
|
|
Packit Service |
310c69 |
RefCountsStatistics refCounts;
|
|
Packit Service |
310c69 |
/** The statistics for the block map */
|
|
Packit Service |
310c69 |
BlockMapStatistics blockMap;
|
|
Packit Service |
310c69 |
/** The dedupe statistics from hash locks */
|
|
Packit Service |
310c69 |
HashLockStatistics hashLock;
|
|
Packit Service |
310c69 |
/** Counts of error conditions */
|
|
Packit Service |
310c69 |
ErrorStatistics errors;
|
|
Packit Service |
310c69 |
};
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**
|
|
Packit Service |
310c69 |
* Get the proc file path for reading VDOStatistics.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @return The proc file path
|
|
Packit Service |
310c69 |
**/
|
|
Packit Service |
310c69 |
static inline const char *getVDOStatisticsProcFile(void) {
|
|
Packit Service |
310c69 |
return "dedupe_stats";
|
|
Packit Service |
310c69 |
}
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
#endif /* not STATISTICS_H */
|