|
Packit Service |
b3514a |
/*
|
|
Packit Service |
b3514a |
* Copyright (c) 2020 Red Hat, Inc.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* This program is free software; you can redistribute it and/or
|
|
Packit Service |
b3514a |
* modify it under the terms of the GNU General Public License
|
|
Packit Service |
b3514a |
* as published by the Free Software Foundation; either version 2
|
|
Packit Service |
b3514a |
* of the License, or (at your option) any later version.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* This program is distributed in the hope that it will be useful,
|
|
Packit Service |
b3514a |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
b3514a |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Service |
b3514a |
* GNU General Public License for more details.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* You should have received a copy of the GNU General Public License
|
|
Packit Service |
b3514a |
* along with this program; if not, write to the Free Software
|
|
Packit Service |
b3514a |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
Packit Service |
b3514a |
* 02110-1301, USA.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* $Id: //eng/vdo-releases/aluminum/src/c++/vdo/base/vdoPageCache.h#7 $
|
|
Packit Service |
b3514a |
*/
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
#ifndef VDO_PAGE_CACHE_H
|
|
Packit Service |
b3514a |
#define VDO_PAGE_CACHE_H
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
#include "adminState.h"
|
|
Packit Service |
b3514a |
#include "atomic.h"
|
|
Packit Service |
b3514a |
#include "completion.h"
|
|
Packit Service |
b3514a |
#include "types.h"
|
|
Packit Service |
b3514a |
#include "waitQueue.h"
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
/**
|
|
Packit Service |
b3514a |
* Structure describing page meta data (defined internally).
|
|
Packit Service |
b3514a |
**/
|
|
Packit Service |
b3514a |
typedef struct pageInfo PageInfo;
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
/**
|
|
Packit Service |
b3514a |
* Structure describing entire page cache.
|
|
Packit Service |
b3514a |
* (Unfortunately the name "PageCache" is already taken by Albireo.)
|
|
Packit Service |
b3514a |
**/
|
|
Packit Service |
b3514a |
typedef struct vdoPageCache VDOPageCache;
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
/**
|
|
Packit Service |
b3514a |
* Generation counter for page references.
|
|
Packit Service |
b3514a |
**/
|
|
Packit Service |
b3514a |
typedef uint32_t VDOPageGeneration;
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
/**
|
|
Packit Service |
b3514a |
* Page-state count statistics sub-structure.
|
|
Packit Service |
b3514a |
**/
|
|
Packit Service |
b3514a |
typedef struct {
|
|
Packit Service |
b3514a |
/* free pages */
|
|
Packit Service |
b3514a |
Atomic64 freePages;
|
|
Packit Service |
b3514a |
/* clean (resident) pages */
|
|
Packit Service |
b3514a |
Atomic64 cleanPages;
|
|
Packit Service |
b3514a |
/* dirty pages per era */
|
|
Packit Service |
b3514a |
Atomic64 dirtyPages;
|
|
Packit Service |
b3514a |
/* pages incoming */
|
|
Packit Service |
b3514a |
Atomic64 incomingPages;
|
|
Packit Service |
b3514a |
/* pages outgoing */
|
|
Packit Service |
b3514a |
Atomic64 outgoingPages;
|
|
Packit Service |
b3514a |
/* pages in failed state */
|
|
Packit Service |
b3514a |
Atomic64 failedPages;
|
|
Packit Service |
b3514a |
} AtomicPageStateCounts;
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
/**
|
|
Packit Service |
b3514a |
* Statistics and debugging fields for the page cache.
|
|
Packit Service |
b3514a |
*/
|
|
Packit Service |
b3514a |
typedef struct {
|
|
Packit Service |
b3514a |
/* counts of how many pages are in each state */
|
|
Packit Service |
b3514a |
AtomicPageStateCounts counts;
|
|
Packit Service |
b3514a |
/* how many times free page not available */
|
|
Packit Service |
b3514a |
Atomic64 cachePressure;
|
|
Packit Service |
b3514a |
/* number of getVDOPageAsync() for read */
|
|
Packit Service |
b3514a |
Atomic64 readCount;
|
|
Packit Service |
b3514a |
/* number or getVDOPageAsync() for write */
|
|
Packit Service |
b3514a |
Atomic64 writeCount;
|
|
Packit Service |
b3514a |
/* number of times pages failed to read */
|
|
Packit Service |
b3514a |
Atomic64 failedReads;
|
|
Packit Service |
b3514a |
/* number of times pages failed to write */
|
|
Packit Service |
b3514a |
Atomic64 failedWrites;
|
|
Packit Service |
b3514a |
/* number of gets that are reclaimed */
|
|
Packit Service |
b3514a |
Atomic64 reclaimed;
|
|
Packit Service |
b3514a |
/* number of gets for outgoing pages */
|
|
Packit Service |
b3514a |
Atomic64 readOutgoing;
|
|
Packit Service |
b3514a |
/* number of gets that were already there */
|
|
Packit Service |
b3514a |
Atomic64 foundInCache;
|
|
Packit Service |
b3514a |
/* number of gets requiring discard */
|
|
Packit Service |
b3514a |
Atomic64 discardRequired;
|
|
Packit Service |
b3514a |
/* number of gets enqueued for their page */
|
|
Packit Service |
b3514a |
Atomic64 waitForPage;
|
|
Packit Service |
b3514a |
/* number of gets that have to fetch */
|
|
Packit Service |
b3514a |
Atomic64 fetchRequired;
|
|
Packit Service |
b3514a |
/* number of page fetches */
|
|
Packit Service |
b3514a |
Atomic64 pagesLoaded;
|
|
Packit Service |
b3514a |
/* number of page saves */
|
|
Packit Service |
b3514a |
Atomic64 pagesSaved;
|
|
Packit Service |
b3514a |
/* number of flushes initiated */
|
|
Packit Service |
b3514a |
Atomic64 flushCount;
|
|
Packit Service |
b3514a |
} AtomicPageCacheStatistics;
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
/**
|
|
Packit Service |
b3514a |
* Signature for a function to call when a page is read into the cache.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* If specified, this function is called when a page is fetched from disk.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @param rawPage The raw memory of the freshly-fetched page
|
|
Packit Service |
b3514a |
* @param pbn The absolute physical block number of the page
|
|
Packit Service |
b3514a |
* @param zone The block map zone to which the cache belongs
|
|
Packit Service |
b3514a |
* @param pageContext A pointer to client-specific data for the new page
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @return VDO_SUCCESS on success or VDO_BAD_PAGE if the page is incorrectly
|
|
Packit Service |
b3514a |
* formatted
|
|
Packit Service |
b3514a |
**/
|
|
Packit Service |
b3514a |
typedef int VDOPageReadFunction(void *rawPage,
|
|
Packit Service |
b3514a |
PhysicalBlockNumber pbn,
|
|
Packit Service |
b3514a |
BlockMapZone *zone,
|
|
Packit Service |
b3514a |
void *pageContext);
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
/**
|
|
Packit Service |
b3514a |
* Signature for a function to call when a page is written from the cache.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* If specified, this function is called when a page is written to disk.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @param rawPage The raw memory of the freshly-written page
|
|
Packit Service |
b3514a |
* @param zone The block map zone to which the cache belongs
|
|
Packit Service |
b3514a |
* @param pageContext A pointer to client-specific data for the new page
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @return whether the page needs to be rewritten
|
|
Packit Service |
b3514a |
**/
|
|
Packit Service |
b3514a |
typedef bool VDOPageWriteFunction(void *rawPage,
|
|
Packit Service |
b3514a |
BlockMapZone *zone,
|
|
Packit Service |
b3514a |
void *pageContext);
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
/**
|
|
Packit Service |
b3514a |
* Construct a PageCache.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @param [in] layer The physical layer to read and write
|
|
Packit Service |
b3514a |
* @param [in] pageCount The number of cache pages to hold
|
|
Packit Service |
b3514a |
* @param [in] readHook The function to be called when a page is read
|
|
Packit Service |
b3514a |
* into the cache
|
|
Packit Service |
b3514a |
* @param [in] writeHook The function to be called after a page is
|
|
Packit Service |
b3514a |
* written from the cache
|
|
Packit Service |
b3514a |
* @param [in] pageContextSize The size of the per-page context that will be
|
|
Packit Service |
b3514a |
* passed to the read and write hooks
|
|
Packit Service |
b3514a |
* @param [in] maximumAge The number of journal blocks before a dirtied
|
|
Packit Service |
b3514a |
* page is considered old and must be written
|
|
Packit Service |
b3514a |
* out
|
|
Packit Service |
b3514a |
* @param [in] zone The block map zone which owns this cache
|
|
Packit Service |
b3514a |
* @param [out] cachePtr A pointer to hold the cache
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @return a success or error code
|
|
Packit Service |
b3514a |
**/
|
|
Packit Service |
b3514a |
int makeVDOPageCache(PhysicalLayer *layer,
|
|
Packit Service |
b3514a |
PageCount pageCount,
|
|
Packit Service |
b3514a |
VDOPageReadFunction *readHook,
|
|
Packit Service |
b3514a |
VDOPageWriteFunction *writeHook,
|
|
Packit Service |
b3514a |
size_t pageContextSize,
|
|
Packit Service |
b3514a |
BlockCount maximumAge,
|
|
Packit Service |
b3514a |
BlockMapZone *zone,
|
|
Packit Service |
b3514a |
VDOPageCache **cachePtr)
|
|
Packit Service |
b3514a |
__attribute__((warn_unused_result));
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
/**
|
|
Packit Service |
b3514a |
* Free the page cache structure and null out the reference to it.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @param cachePtr a pointer to the cache to free
|
|
Packit Service |
b3514a |
**/
|
|
Packit Service |
b3514a |
void freeVDOPageCache(VDOPageCache **cachePtr);
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
/**
|
|
Packit Service |
b3514a |
* Set the initial dirty period for a page cache.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @param cache The cache
|
|
Packit Service |
b3514a |
* @param period The initial dirty period to set
|
|
Packit Service |
b3514a |
**/
|
|
Packit Service |
b3514a |
void setVDOPageCacheInitialPeriod(VDOPageCache *cache, SequenceNumber period);
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
/**
|
|
Packit Service |
b3514a |
* Switch the page cache into or out of read-only rebuild mode.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @param cache The cache
|
|
Packit Service |
b3514a |
* @param rebuilding true if the cache should be put into
|
|
Packit Service |
b3514a |
* read-only rebuild mode, false otherwise
|
|
Packit Service |
b3514a |
**/
|
|
Packit Service |
b3514a |
void setVDOPageCacheRebuildMode(VDOPageCache *cache, bool rebuilding);
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
/**
|
|
Packit Service |
b3514a |
* Check whether a page cache is active (i.e. has any active lookups,
|
|
Packit Service |
b3514a |
* outstanding I/O, or pending I/O).
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @param cache The cache to check
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @return true if the cache is active
|
|
Packit Service |
b3514a |
**/
|
|
Packit Service |
b3514a |
bool isPageCacheActive(VDOPageCache *cache)
|
|
Packit Service |
b3514a |
__attribute__((warn_unused_result));
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
/**
|
|
Packit Service |
b3514a |
* Advance the dirty period for a page cache.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @param cache The cache to advance
|
|
Packit Service |
b3514a |
* @param period The new dirty period
|
|
Packit Service |
b3514a |
**/
|
|
Packit Service |
b3514a |
void advanceVDOPageCachePeriod(VDOPageCache *cache, SequenceNumber period);
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
/**
|
|
Packit Service |
b3514a |
* Write one or more batches of dirty pages.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* All writable pages in the ancient era and some number in the old era
|
|
Packit Service |
b3514a |
* are scheduled for writing.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @param cache the VDO page cache
|
|
Packit Service |
b3514a |
* @param batches how many batches to write now
|
|
Packit Service |
b3514a |
* @param total how many batches (including those being written now) remain
|
|
Packit Service |
b3514a |
* in this era
|
|
Packit Service |
b3514a |
**/
|
|
Packit Service |
b3514a |
void writeVDOPageCachePages(VDOPageCache *cache,
|
|
Packit Service |
b3514a |
size_t batches,
|
|
Packit Service |
b3514a |
size_t total);
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
/**
|
|
Packit Service |
b3514a |
* Rotate the dirty page eras.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* Move all pages in the old era to the ancient era and then move
|
|
Packit Service |
b3514a |
* the current era bin into the old era.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @param cache the VDO page cache
|
|
Packit Service |
b3514a |
**/
|
|
Packit Service |
b3514a |
void rotateVDOPageCacheEras(VDOPageCache *cache);
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
// ASYNC
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
/**
|
|
Packit Service |
b3514a |
* A completion awaiting a specific page. Also a live reference into the
|
|
Packit Service |
b3514a |
* page once completed, until freed.
|
|
Packit Service |
b3514a |
**/
|
|
Packit Service |
b3514a |
typedef struct {
|
|
Packit Service |
b3514a |
/** The generic completion */
|
|
Packit Service |
b3514a |
VDOCompletion completion;
|
|
Packit Service |
b3514a |
/** The cache involved */
|
|
Packit Service |
b3514a |
VDOPageCache *cache;
|
|
Packit Service |
b3514a |
/** The waiter for the pending list */
|
|
Packit Service |
b3514a |
Waiter waiter;
|
|
Packit Service |
b3514a |
/** The absolute physical block number of the page on disk */
|
|
Packit Service |
b3514a |
PhysicalBlockNumber pbn;
|
|
Packit Service |
b3514a |
/** Whether the page may be modified */
|
|
Packit Service |
b3514a |
bool writable;
|
|
Packit Service |
b3514a |
/** Whether the page is available */
|
|
Packit Service |
b3514a |
bool ready;
|
|
Packit Service |
b3514a |
/** The info structure for the page, only valid when ready */
|
|
Packit Service |
b3514a |
PageInfo *info;
|
|
Packit Service |
b3514a |
} VDOPageCompletion;
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
/**
|
|
Packit Service |
b3514a |
* Initialize a VDO Page Completion, requesting a particular page from the
|
|
Packit Service |
b3514a |
* cache.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @param pageCompletion The VDOPageCompletion to initialize
|
|
Packit Service |
b3514a |
* @param cache The VDO page cache
|
|
Packit Service |
b3514a |
* @param pbn The absolute physical block of the desired page
|
|
Packit Service |
b3514a |
* @param writable Whether the page can be modified
|
|
Packit Service |
b3514a |
* @param parent The parent object
|
|
Packit Service |
b3514a |
* @param callback The completion callback
|
|
Packit Service |
b3514a |
* @param errorHandler The handler for page errors
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @note Once a completion has occurred for the getVDOPageAsync operation,
|
|
Packit Service |
b3514a |
* the underlying page shall be busy (stuck in memory) until the
|
|
Packit Service |
b3514a |
* VDOCompletion returned by this operation has been released.
|
|
Packit Service |
b3514a |
**/
|
|
Packit Service |
b3514a |
void initVDOPageCompletion(VDOPageCompletion *pageCompletion,
|
|
Packit Service |
b3514a |
VDOPageCache *cache,
|
|
Packit Service |
b3514a |
PhysicalBlockNumber pbn,
|
|
Packit Service |
b3514a |
bool writable,
|
|
Packit Service |
b3514a |
void *parent,
|
|
Packit Service |
b3514a |
VDOAction *callback,
|
|
Packit Service |
b3514a |
VDOAction *errorHandler);
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
/**
|
|
Packit Service |
b3514a |
* Release a VDO Page Completion.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* The page referenced by this completion (if any) will no longer be
|
|
Packit Service |
b3514a |
* held busy by this completion. If a page becomes discardable and
|
|
Packit Service |
b3514a |
* there are completions awaiting free pages then a new round of
|
|
Packit Service |
b3514a |
* page discarding is started.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @param completion The completion to release
|
|
Packit Service |
b3514a |
**/
|
|
Packit Service |
b3514a |
void releaseVDOPageCompletion(VDOCompletion *completion);
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
/**
|
|
Packit Service |
b3514a |
* Asynchronous operation to get a VDO page.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* May cause another page to be discarded (potentially writing a dirty page)
|
|
Packit Service |
b3514a |
* and the one nominated by the completion to be loaded from disk.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* When the page becomes available the callback registered in the completion
|
|
Packit Service |
b3514a |
* provided is triggered. Once triggered the page is marked busy until
|
|
Packit Service |
b3514a |
* the completion is destroyed.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @param completion the completion initialized my initVDOPageCompletion().
|
|
Packit Service |
b3514a |
**/
|
|
Packit Service |
b3514a |
void getVDOPageAsync(VDOCompletion *completion);
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
/**
|
|
Packit Service |
b3514a |
* Mark a VDO page referenced by a completed VDOPageCompletion as dirty.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @param completion a VDO Page Completion whose callback has been called
|
|
Packit Service |
b3514a |
* @param oldDirtyPeriod the period in which the page was already dirty (0 if
|
|
Packit Service |
b3514a |
* it wasn't)
|
|
Packit Service |
b3514a |
* @param newDirtyPeriod the period in which the page is now dirty
|
|
Packit Service |
b3514a |
**/
|
|
Packit Service |
b3514a |
void markCompletedVDOPageDirty(VDOCompletion *completion,
|
|
Packit Service |
b3514a |
SequenceNumber oldDirtyPeriod,
|
|
Packit Service |
b3514a |
SequenceNumber newDirtyPeriod);
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
/**
|
|
Packit Service |
b3514a |
* Request that a VDO page be written out as soon as it is not busy.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @param completion the VDOPageCompletion containing the page
|
|
Packit Service |
b3514a |
**/
|
|
Packit Service |
b3514a |
void requestVDOPageWrite(VDOCompletion *completion);
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
/**
|
|
Packit Service |
b3514a |
* Access the raw memory for a read-only page of a completed VDOPageCompletion.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @param completion a vdo page completion whose callback has been called
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @return a pointer to the raw memory at the beginning of the page, or
|
|
Packit Service |
b3514a |
* NULL if the page is not available.
|
|
Packit Service |
b3514a |
**/
|
|
Packit Service |
b3514a |
const void *dereferenceReadableVDOPage(VDOCompletion *completion);
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
/**
|
|
Packit Service |
b3514a |
* Access the raw memory for a writable page of a completed VDOPageCompletion.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @param completion a vdo page completion whose callback has been called
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @return a pointer to the raw memory at the beginning of the page, or
|
|
Packit Service |
b3514a |
* NULL if the page is not available, or if the page is read-only
|
|
Packit Service |
b3514a |
**/
|
|
Packit Service |
b3514a |
void *dereferenceWritableVDOPage(VDOCompletion *completion);
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
/**
|
|
Packit Service |
b3514a |
* Get the per-page client context for the page in a page completion whose
|
|
Packit Service |
b3514a |
* callback has been invoked. Should only be called after dereferencing the
|
|
Packit Service |
b3514a |
* page completion to validate the page.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @param completion a vdo page completion whose callback has been invoked
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @return a pointer to the per-page client context, or NULL if
|
|
Packit Service |
b3514a |
* the page is not available
|
|
Packit Service |
b3514a |
**/
|
|
Packit Service |
b3514a |
void *getVDOPageCompletionContext(VDOCompletion *completion);
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
/**
|
|
Packit Service |
b3514a |
* Drain I/O for a page cache.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @param cache The cache to drain
|
|
Packit Service |
b3514a |
**/
|
|
Packit Service |
b3514a |
void drainVDOPageCache(VDOPageCache *cache);
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
/**
|
|
Packit Service |
b3514a |
* Invalidate all entries in the VDO page cache. There must not be any
|
|
Packit Service |
b3514a |
* dirty pages in the cache.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @param cache the cache to invalidate
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @return a success or error code
|
|
Packit Service |
b3514a |
**/
|
|
Packit Service |
b3514a |
int invalidateVDOPageCache(VDOPageCache *cache)
|
|
Packit Service |
b3514a |
__attribute__((warn_unused_result));
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
// STATISTICS & TESTING
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
/**
|
|
Packit Service |
b3514a |
* Get current cache statistics.
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @param cache the page cache
|
|
Packit Service |
b3514a |
*
|
|
Packit Service |
b3514a |
* @return the statistics
|
|
Packit Service |
b3514a |
**/
|
|
Packit Service |
b3514a |
AtomicPageCacheStatistics *getVDOPageCacheStatistics(VDOPageCache *cache)
|
|
Packit Service |
b3514a |
__attribute__((warn_unused_result));
|
|
Packit Service |
b3514a |
|
|
Packit Service |
b3514a |
#endif // VDO_PAGE_CACHE_H
|