|
Packit Service |
75d76b |
/*
|
|
Packit Service |
75d76b |
* Copyright (c) 2020 Red Hat, Inc.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* This program is free software; you can redistribute it and/or
|
|
Packit Service |
75d76b |
* modify it under the terms of the GNU General Public License
|
|
Packit Service |
75d76b |
* as published by the Free Software Foundation; either version 2
|
|
Packit Service |
75d76b |
* of the License, or (at your option) any later version.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* This program is distributed in the hope that it will be useful,
|
|
Packit Service |
75d76b |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
75d76b |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Service |
75d76b |
* GNU General Public License for more details.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* You should have received a copy of the GNU General Public License
|
|
Packit Service |
75d76b |
* along with this program; if not, write to the Free Software
|
|
Packit Service |
75d76b |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
Packit Service |
75d76b |
* 02110-1301, USA.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* $Id: //eng/vdo-releases/aluminum/src/c++/vdo/base/recoveryJournal.h#5 $
|
|
Packit Service |
75d76b |
*/
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
#ifndef RECOVERY_JOURNAL_H
|
|
Packit Service |
75d76b |
#define RECOVERY_JOURNAL_H
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
#include "buffer.h"
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
#include "adminState.h"
|
|
Packit Service |
75d76b |
#include "completion.h"
|
|
Packit Service |
75d76b |
#include "fixedLayout.h"
|
|
Packit Service |
75d76b |
#include "flush.h"
|
|
Packit Service |
75d76b |
#include "readOnlyNotifier.h"
|
|
Packit Service |
75d76b |
#include "statistics.h"
|
|
Packit Service |
75d76b |
#include "trace.h"
|
|
Packit Service |
75d76b |
#include "types.h"
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* The RecoveryJournal provides a log of all block mapping changes
|
|
Packit Service |
75d76b |
* which have not yet been stably written to the block map. It exists
|
|
Packit Service |
75d76b |
* to help provide resiliency guarantees by allowing synchronous
|
|
Packit Service |
75d76b |
* writes to be acknowledged as soon as the corresponding journal
|
|
Packit Service |
75d76b |
* entry is committed instead of having to wait for the block map
|
|
Packit Service |
75d76b |
* update. For asynchronous writes, the journal aids in meeting the
|
|
Packit Service |
75d76b |
* five second data loss window by ensuring that writes will not be
|
|
Packit Service |
75d76b |
* lost as long as they are committed to the journal before the window
|
|
Packit Service |
75d76b |
* expires. This should be less work than committing all of the
|
|
Packit Service |
75d76b |
* required block map pages.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* The journal consists of a set of on-disk blocks arranged as a
|
|
Packit Service |
75d76b |
* circular log with monotonically increasing sequence numbers. Three
|
|
Packit Service |
75d76b |
* sequence numbers serve to define the active extent of the
|
|
Packit Service |
75d76b |
* journal. The 'head' is the oldest active block in the journal. The
|
|
Packit Service |
75d76b |
* 'tail' is the end of the half-open interval containing the active
|
|
Packit Service |
75d76b |
* blocks. 'active' is the number of the block actively receiving
|
|
Packit Service |
75d76b |
* entries. In an empty journal, head == active == tail. Once any
|
|
Packit Service |
75d76b |
* entries are added, tail = active + 1, and head may be any value in
|
|
Packit Service |
75d76b |
* the interval [tail - size, active].
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* The journal also contains a set of in-memory blocks which are used
|
|
Packit Service |
75d76b |
* to buffer up entries until they can be committed. In general the
|
|
Packit Service |
75d76b |
* number of in-memory blocks ('tailBufferCount') will be less than
|
|
Packit Service |
75d76b |
* the on-disk size. Each in-memory block is also a VDOCompletion.
|
|
Packit Service |
75d76b |
* Each in-memory block has a VDOExtent which is used to commit that
|
|
Packit Service |
75d76b |
* block to disk. The extent's data is a PackedJournalBlock (which is a
|
|
Packit Service |
75d76b |
* formatted journal block). In addition each in-memory block has a
|
|
Packit Service |
75d76b |
* buffer which is used to accumulate entries while a partial commit
|
|
Packit Service |
75d76b |
* of the block is in progress. In-memory blocks are kept on two
|
|
Packit Service |
75d76b |
* rings. Free blocks live on the 'freeTailBlocks' ring. When a block
|
|
Packit Service |
75d76b |
* becomes active (see below) it is moved to the 'activeTailBlocks'
|
|
Packit Service |
75d76b |
* ring. When a block is fully committed, it is moved back to the
|
|
Packit Service |
75d76b |
* 'freeTailBlocks' ring.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* When entries are added to the journal, they are added to the active
|
|
Packit Service |
75d76b |
* in-memory block, as indicated by the 'activeBlock' field. If the
|
|
Packit Service |
75d76b |
* caller wishes to wait for the entry to be committed, the requesting
|
|
Packit Service |
75d76b |
* VIO will be attached to the in-memory block to which the caller's
|
|
Packit Service |
75d76b |
* entry was added. If the caller does wish to wait, or if the entry
|
|
Packit Service |
75d76b |
* filled the active block, an attempt will be made to commit that
|
|
Packit Service |
75d76b |
* block to disk. If there is already another commit in progress, the
|
|
Packit Service |
75d76b |
* attempt will be ignored and then automatically retried when the
|
|
Packit Service |
75d76b |
* in-progress commit completes. If there is no commit in progress,
|
|
Packit Service |
75d76b |
* any VIOs waiting on the block are transferred to the extent. The
|
|
Packit Service |
75d76b |
* extent is then written, automatically waking all of the waiters
|
|
Packit Service |
75d76b |
* when it completes. When the extent completes, any entries which
|
|
Packit Service |
75d76b |
* accumulated in the block are copied to the extent's data buffer.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* Finally, the journal maintains a set of counters, one for each on
|
|
Packit Service |
75d76b |
* disk journal block. These counters are used as locks to prevent
|
|
Packit Service |
75d76b |
* premature reaping of journal blocks. Each time a new sequence
|
|
Packit Service |
75d76b |
* number is used, the counter for the corresponding block is
|
|
Packit Service |
75d76b |
* incremented. The counter is subsequently decremented when that
|
|
Packit Service |
75d76b |
* block is filled and then committed for the last time. This prevents
|
|
Packit Service |
75d76b |
* blocks from being reaped while they are still being updated. The
|
|
Packit Service |
75d76b |
* counter is also incremented once for each entry added to a block,
|
|
Packit Service |
75d76b |
* and decremented once each time the block map is updated in memory
|
|
Packit Service |
75d76b |
* for that request. This prevents blocks from being reaped while
|
|
Packit Service |
75d76b |
* their VIOs are still active. Finally, each in-memory block map page
|
|
Packit Service |
75d76b |
* tracks the oldest journal block that contains entries corresponding to
|
|
Packit Service |
75d76b |
* uncommitted updates to that block map page. Each time an in-memory block
|
|
Packit Service |
75d76b |
* map page is updated, it checks if the journal block for the VIO
|
|
Packit Service |
75d76b |
* is earlier than the one it references, in which case it increments
|
|
Packit Service |
75d76b |
* the count on the earlier journal block and decrements the count on the
|
|
Packit Service |
75d76b |
* later journal block, maintaining a lock on the oldest journal block
|
|
Packit Service |
75d76b |
* containing entries for that page. When a block map page has been flushed
|
|
Packit Service |
75d76b |
* from the cache, the counter for the journal block it references is
|
|
Packit Service |
75d76b |
* decremented. Whenever the counter for the head block goes to 0, the
|
|
Packit Service |
75d76b |
* head is advanced until it comes to a block whose counter is not 0
|
|
Packit Service |
75d76b |
* or until it reaches the active block. This is the mechanism for
|
|
Packit Service |
75d76b |
* reclaiming journal space on disk.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* If there is no in-memory space when a VIO attempts to add an entry,
|
|
Packit Service |
75d76b |
* the VIO will be attached to the 'commitCompletion' and will be
|
|
Packit Service |
75d76b |
* woken the next time a full block has committed. If there is no
|
|
Packit Service |
75d76b |
* on-disk space when a VIO attempts to add an entry, the VIO will be
|
|
Packit Service |
75d76b |
* attached to the 'reapCompletion', and will be woken the next time a
|
|
Packit Service |
75d76b |
* journal block is reaped.
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Return whether a given JournalOperation is an increment type.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @param operation The operation in question
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @return true if the type is an increment type
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
static inline bool isIncrementOperation(JournalOperation operation)
|
|
Packit Service |
75d76b |
{
|
|
Packit Service |
75d76b |
return ((operation == DATA_INCREMENT) || (operation == BLOCK_MAP_INCREMENT));
|
|
Packit Service |
75d76b |
}
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Get the name of a journal operation.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @param operation The operation to name
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @return The name of the operation
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
const char *getJournalOperationName(JournalOperation operation)
|
|
Packit Service |
75d76b |
__attribute__((warn_unused_result));
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Create a recovery journal.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @param [in] nonce the nonce of the VDO
|
|
Packit Service |
75d76b |
* @param [in] layer the physical layer for the journal
|
|
Packit Service |
75d76b |
* @param [in] partition the partition for the journal
|
|
Packit Service |
75d76b |
* @param [in] recoveryCount The VDO's number of completed recoveries
|
|
Packit Service |
75d76b |
* @param [in] journalSize the number of blocks in the journal on disk
|
|
Packit Service |
75d76b |
* @param [in] tailBufferSize the number of blocks for tail buffer
|
|
Packit Service |
75d76b |
* @param [in] readOnlyNotifier the read-only mode notifier
|
|
Packit Service |
75d76b |
* @param [in] threadConfig the thread configuration of the VDO
|
|
Packit Service |
75d76b |
* @param [out] journalPtr the pointer to hold the new recovery journal
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @return a success or error code
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
int makeRecoveryJournal(Nonce nonce,
|
|
Packit Service |
75d76b |
PhysicalLayer *layer,
|
|
Packit Service |
75d76b |
Partition *partition,
|
|
Packit Service |
75d76b |
uint64_t recoveryCount,
|
|
Packit Service |
75d76b |
BlockCount journalSize,
|
|
Packit Service |
75d76b |
BlockCount tailBufferSize,
|
|
Packit Service |
75d76b |
ReadOnlyNotifier *readOnlyNotifier,
|
|
Packit Service |
75d76b |
const ThreadConfig *threadConfig,
|
|
Packit Service |
75d76b |
RecoveryJournal **journalPtr)
|
|
Packit Service |
75d76b |
__attribute__((warn_unused_result));
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Free a recovery journal and null out the reference to it.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @param [in,out] journalPtr The reference to the recovery journal to free
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
void freeRecoveryJournal(RecoveryJournal **journalPtr);
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Move the backing partition pointer of the recovery journal.
|
|
Packit Service |
75d76b |
* Assumes that the data in the old and the new partitions is identical.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @param journal the journal being moved
|
|
Packit Service |
75d76b |
* @param partition the new journal partition
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
void setRecoveryJournalPartition(RecoveryJournal *journal,
|
|
Packit Service |
75d76b |
Partition *partition);
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Initialize the journal after a recovery.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @param journal The journal in question
|
|
Packit Service |
75d76b |
* @param recoveryCount The number of completed recoveries
|
|
Packit Service |
75d76b |
* @param tail The new tail block sequence number
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
void initializeRecoveryJournalPostRecovery(RecoveryJournal *journal,
|
|
Packit Service |
75d76b |
uint64_t recoveryCount,
|
|
Packit Service |
75d76b |
SequenceNumber tail);
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Initialize the journal after a rebuild.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @param journal The journal in question
|
|
Packit Service |
75d76b |
* @param recoveryCount The number of completed recoveries
|
|
Packit Service |
75d76b |
* @param tail The new tail block sequence number
|
|
Packit Service |
75d76b |
* @param logicalBlocksUsed The new number of logical blocks used
|
|
Packit Service |
75d76b |
* @param blockMapDataBlocks The new number of block map data blocks
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
void initializeRecoveryJournalPostRebuild(RecoveryJournal *journal,
|
|
Packit Service |
75d76b |
uint64_t recoveryCount,
|
|
Packit Service |
75d76b |
SequenceNumber tail,
|
|
Packit Service |
75d76b |
BlockCount logicalBlocksUsed,
|
|
Packit Service |
75d76b |
BlockCount blockMapDataBlocks);
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Get the number of block map pages, allocated from data blocks, currently
|
|
Packit Service |
75d76b |
* in use.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @param journal The journal in question
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @return The number of block map pages allocated from slabs
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
BlockCount getJournalBlockMapDataBlocksUsed(RecoveryJournal *journal)
|
|
Packit Service |
75d76b |
__attribute__((warn_unused_result));
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Set the number of block map pages, allocated from data blocks, currently
|
|
Packit Service |
75d76b |
* in use.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @param journal The journal in question
|
|
Packit Service |
75d76b |
* @param pages The number of block map pages allocated from slabs
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
void setJournalBlockMapDataBlocksUsed(RecoveryJournal *journal,
|
|
Packit Service |
75d76b |
BlockCount pages);
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Get the ID of a recovery journal's thread.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @param journal The journal to query
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @return The ID of the journal's thread.
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
ThreadID getRecoveryJournalThreadID(RecoveryJournal *journal)
|
|
Packit Service |
75d76b |
__attribute__((warn_unused_result));
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Prepare the journal for new entries.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @param journal The journal in question
|
|
Packit Service |
75d76b |
* @param depot The slab depot for this VDO
|
|
Packit Service |
75d76b |
* @param blockMap The block map for this VDO
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
void openRecoveryJournal(RecoveryJournal *journal,
|
|
Packit Service |
75d76b |
SlabDepot *depot,
|
|
Packit Service |
75d76b |
BlockMap *blockMap);
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Obtain the recovery journal's current sequence number. Exposed only so
|
|
Packit Service |
75d76b |
* the block map can be initialized therefrom.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @param journal The journal in question
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @return the sequence number of the tail block
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
SequenceNumber getCurrentJournalSequenceNumber(RecoveryJournal *journal);
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Get the number of usable recovery journal blocks.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @param journalSize The size of the recovery journal in blocks
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @return the number of recovery journal blocks usable for entries
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
BlockCount getRecoveryJournalLength(BlockCount journalSize)
|
|
Packit Service |
75d76b |
__attribute__((warn_unused_result));
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Get the size of the encoded state of a recovery journal.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @return the encoded size of the journal's state
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
size_t getRecoveryJournalEncodedSize(void)
|
|
Packit Service |
75d76b |
__attribute__((warn_unused_result));
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Encode the state of a recovery journal.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @param journal the recovery journal
|
|
Packit Service |
75d76b |
* @param buffer the buffer to encode into
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @return VDO_SUCCESS or an error code
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
int encodeRecoveryJournal(RecoveryJournal *journal, Buffer *buffer)
|
|
Packit Service |
75d76b |
__attribute__((warn_unused_result));
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Decode the state of a recovery journal saved in a buffer.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @param journal the recovery journal
|
|
Packit Service |
75d76b |
* @param buffer the buffer containing the saved state
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @return VDO_SUCCESS or an error code
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
int decodeRecoveryJournal(RecoveryJournal *journal, Buffer *buffer)
|
|
Packit Service |
75d76b |
__attribute__((warn_unused_result));
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Decode the state of a Sodium recovery journal saved in a buffer.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @param journal the recovery journal
|
|
Packit Service |
75d76b |
* @param buffer the buffer containing the saved state
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @return VDO_SUCCESS or an error code
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
int decodeSodiumRecoveryJournal(RecoveryJournal *journal, Buffer *buffer)
|
|
Packit Service |
75d76b |
__attribute__((warn_unused_result));
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Add an entry to a recovery journal. This method is asynchronous. The DataVIO
|
|
Packit Service |
75d76b |
* will not be called back until the entry is committed to the on-disk journal.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @param journal The journal in which to make an entry
|
|
Packit Service |
75d76b |
* @param dataVIO The DataVIO for which to add the entry. The entry will be
|
|
Packit Service |
75d76b |
* taken from the logical and newMapped fields of the
|
|
Packit Service |
75d76b |
* DataVIO. The DataVIO's recoverySequenceNumber field will
|
|
Packit Service |
75d76b |
* be set to the sequence number of the journal block in
|
|
Packit Service |
75d76b |
* which the entry was made.
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
void addRecoveryJournalEntry(RecoveryJournal *journal, DataVIO *dataVIO);
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Acquire a reference to a recovery journal block from somewhere other than
|
|
Packit Service |
75d76b |
* the journal itself.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @param journal The recovery journal
|
|
Packit Service |
75d76b |
* @param sequenceNumber The journal sequence number of the referenced block
|
|
Packit Service |
75d76b |
* @param zoneType The type of the zone making the adjustment
|
|
Packit Service |
75d76b |
* @param zoneID The ID of the zone making the adjustment
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
void acquireRecoveryJournalBlockReference(RecoveryJournal *journal,
|
|
Packit Service |
75d76b |
SequenceNumber sequenceNumber,
|
|
Packit Service |
75d76b |
ZoneType zoneType,
|
|
Packit Service |
75d76b |
ZoneCount zoneID);
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Release a reference to a recovery journal block from somewhere other than
|
|
Packit Service |
75d76b |
* the journal itself. If this is the last reference for a given zone type,
|
|
Packit Service |
75d76b |
* an attempt will be made to reap the journal.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @param journal The recovery journal
|
|
Packit Service |
75d76b |
* @param sequenceNumber The journal sequence number of the referenced block
|
|
Packit Service |
75d76b |
* @param zoneType The type of the zone making the adjustment
|
|
Packit Service |
75d76b |
* @param zoneID The ID of the zone making the adjustment
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
void releaseRecoveryJournalBlockReference(RecoveryJournal *journal,
|
|
Packit Service |
75d76b |
SequenceNumber sequenceNumber,
|
|
Packit Service |
75d76b |
ZoneType zoneType,
|
|
Packit Service |
75d76b |
ZoneCount zoneID);
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Release a single per-entry reference count for a recovery journal block. This
|
|
Packit Service |
75d76b |
* method may be called from any zone (but shouldn't be called from the journal
|
|
Packit Service |
75d76b |
* zone as it would be inefficient).
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @param journal The recovery journal
|
|
Packit Service |
75d76b |
* @param sequenceNumber The journal sequence number of the referenced block
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
void releasePerEntryLockFromOtherZone(RecoveryJournal *journal,
|
|
Packit Service |
75d76b |
SequenceNumber sequenceNumber);
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Drain recovery journal I/O. All uncommitted entries will be written out.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @param journal The journal to drain
|
|
Packit Service |
75d76b |
* @param operation The drain operation (suspend or save)
|
|
Packit Service |
75d76b |
* @param parent The completion to finish once the journal is drained
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
void drainRecoveryJournal(RecoveryJournal *journal,
|
|
Packit Service |
75d76b |
AdminStateCode operation,
|
|
Packit Service |
75d76b |
VDOCompletion *parent);
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Resume a recovery journal which has been drained.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @param journal The journal to resume
|
|
Packit Service |
75d76b |
* @param parent The completion to finish once the journal is resumed
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @return VDO_SUCCESS or an error
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
void resumeRecoveryJournal(RecoveryJournal *journal, VDOCompletion *parent);
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Get the number of logical blocks in use by the VDO
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @param journal the journal
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @return the number of logical blocks in use by the VDO
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
BlockCount getJournalLogicalBlocksUsed(const RecoveryJournal *journal)
|
|
Packit Service |
75d76b |
__attribute__((warn_unused_result));
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Get the current statistics from the recovery journal.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @param journal The recovery journal to query
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @return a copy of the current statistics for the journal
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
RecoveryJournalStatistics
|
|
Packit Service |
75d76b |
getRecoveryJournalStatistics(const RecoveryJournal *journal)
|
|
Packit Service |
75d76b |
__attribute__((warn_unused_result));
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Dump some current statistics and other debug info from the recovery
|
|
Packit Service |
75d76b |
* journal.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @param journal The recovery journal to dump
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
void dumpRecoveryJournalStatistics(const RecoveryJournal *journal);
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
#endif // RECOVERY_JOURNAL_H
|