Blame source/vdo/base/slabDepot.h

Packit Service d40955
/*
Packit Service d40955
 * Copyright (c) 2020 Red Hat, Inc.
Packit Service d40955
 *
Packit Service d40955
 * This program is free software; you can redistribute it and/or
Packit Service d40955
 * modify it under the terms of the GNU General Public License
Packit Service d40955
 * as published by the Free Software Foundation; either version 2
Packit Service d40955
 * of the License, or (at your option) any later version.
Packit Service d40955
 * 
Packit Service d40955
 * This program is distributed in the hope that it will be useful,
Packit Service d40955
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service d40955
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service d40955
 * GNU General Public License for more details.
Packit Service d40955
 * 
Packit Service d40955
 * You should have received a copy of the GNU General Public License
Packit Service d40955
 * along with this program; if not, write to the Free Software
Packit Service d40955
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
Packit Service d40955
 * 02110-1301, USA. 
Packit Service d40955
 *
Packit Service d40955
 * $Id: //eng/vdo-releases/aluminum/src/c++/vdo/base/slabDepot.h#12 $
Packit Service d40955
 */
Packit Service d40955
Packit Service d40955
#ifndef SLAB_DEPOT_H
Packit Service d40955
#define SLAB_DEPOT_H
Packit Service d40955
Packit Service d40955
#include "buffer.h"
Packit Service d40955
Packit Service d40955
#include "adminState.h"
Packit Service d40955
#include "completion.h"
Packit Service d40955
#include "fixedLayout.h"
Packit Service d40955
#include "journalPoint.h"
Packit Service d40955
#include "statistics.h"
Packit Service d40955
#include "types.h"
Packit Service d40955
#include "waitQueue.h"
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * A SlabDepot is responsible for managing all of the slabs and block
Packit Service d40955
 * allocators of a VDO. It has a single array of slabs in order to eliminate
Packit Service d40955
 * the need for additional math in order to compute which physical zone a PBN
Packit Service d40955
 * is in. It also has a BlockAllocator per zone.
Packit Service d40955
 *
Packit Service d40955
 * Load operations are required to be performed on a single thread. Normal
Packit Service d40955
 * operations are assumed to be performed in the appropriate zone. Allocations
Packit Service d40955
 * and reference count updates must be done from the thread of their physical
Packit Service d40955
 * zone. Requests to commit slab journal tail blocks from the recovery journal
Packit Service d40955
 * must be done on the journal zone thread. Save operations are required to be
Packit Service d40955
 * launched from the same thread as the original load operation.
Packit Service d40955
 **/
Packit Service d40955
Packit Service d40955
typedef enum {
Packit Service d40955
  NORMAL_LOAD,
Packit Service d40955
  RECOVERY_LOAD,
Packit Service d40955
  REBUILD_LOAD
Packit Service d40955
} SlabDepotLoadType;
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Calculate the number of slabs a depot would have.
Packit Service d40955
 *
Packit Service d40955
 * @param depot  The depot
Packit Service d40955
 *
Packit Service d40955
 * @return The number of slabs
Packit Service d40955
 **/
Packit Service d40955
SlabCount calculateSlabCount(SlabDepot *depot)
Packit Service d40955
  __attribute__((warn_unused_result));
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Create a slab depot.
Packit Service d40955
 *
Packit Service d40955
 * @param [in]  blockCount        The number of blocks initially available
Packit Service d40955
 * @param [in]  firstBlock        The number of the first block which may be
Packit Service d40955
 *                                allocated
Packit Service d40955
 * @param [in]  slabConfig        The slab configuration
Packit Service d40955
 * @param [in]  threadConfig      The thread configuration of the VDO
Packit Service d40955
 * @param [in]  nonce             The nonce of the VDO
Packit Service d40955
 * @param [in]  vioPoolSize       The size of the VIO pool
Packit Service d40955
 * @param [in]  layer             The physical layer below this depot
Packit Service d40955
 * @param [in]  summaryPartition  The partition which holds the slab summary
Packit Service d40955
 * @param [in]  readOnlyNotifier  The context for entering read-only mode
Packit Service d40955
 * @param [in]  recoveryJournal   The recovery journal of the VDO
Packit Service d40955
 * @param [out] depotPtr          A pointer to hold the depot
Packit Service d40955
 *
Packit Service d40955
 * @return A success or error code
Packit Service d40955
 **/
Packit Service d40955
int makeSlabDepot(BlockCount            blockCount,
Packit Service d40955
                  PhysicalBlockNumber   firstBlock,
Packit Service d40955
                  SlabConfig            slabConfig,
Packit Service d40955
                  const ThreadConfig   *threadConfig,
Packit Service d40955
                  Nonce                 nonce,
Packit Service d40955
                  BlockCount            vioPoolSize,
Packit Service d40955
                  PhysicalLayer        *layer,
Packit Service d40955
                  Partition            *summaryPartition,
Packit Service d40955
                  ReadOnlyNotifier     *readOnlyNotifier,
Packit Service d40955
                  RecoveryJournal      *recoveryJournal,
Packit Service d40955
                  SlabDepot           **depotPtr)
Packit Service d40955
  __attribute__((warn_unused_result));
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Destroy a slab depot and null out the reference to it.
Packit Service d40955
 *
Packit Service d40955
 * @param depotPtr  The reference to the depot to destroy
Packit Service d40955
 **/
Packit Service d40955
void freeSlabDepot(SlabDepot **depotPtr);
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Get the size of the encoded state of a slab depot.
Packit Service d40955
 *
Packit Service d40955
 * @return The encoded size of the depot's state
Packit Service d40955
 **/
Packit Service d40955
size_t getSlabDepotEncodedSize(void)
Packit Service d40955
  __attribute__((warn_unused_result));
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Encode the state of a slab depot into a buffer.
Packit Service d40955
 *
Packit Service d40955
 * @param depot   The depot to encode
Packit Service d40955
 * @param buffer  The buffer to encode into
Packit Service d40955
 *
Packit Service d40955
 * @return UDS_SUCCESS or an error
Packit Service d40955
 **/
Packit Service d40955
int encodeSlabDepot(const SlabDepot *depot, Buffer *buffer)
Packit Service d40955
  __attribute__((warn_unused_result));
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Decode the state of a slab depot saved in a buffer.
Packit Service d40955
 *
Packit Service d40955
 * @param [in]  buffer            The buffer containing the saved state
Packit Service d40955
 * @param [in]  threadConfig      The thread config of the VDO
Packit Service d40955
 * @param [in]  nonce             The nonce of the VDO
Packit Service d40955
 * @param [in]  layer             The physical layer below this depot
Packit Service d40955
 * @param [in]  summaryPartition  The partition which holds the slab summary
Packit Service d40955
 * @param [in]  readOnlyNotifier  The context for entering read-only mode
Packit Service d40955
 * @param [in]  recoveryJournal   The recovery journal of the VDO
Packit Service d40955
 * @param [out] depotPtr          A pointer to hold the depot
Packit Service d40955
 *
Packit Service d40955
 * @return A success or error code
Packit Service d40955
 **/
Packit Service d40955
int decodeSodiumSlabDepot(Buffer              *buffer,
Packit Service d40955
                          const ThreadConfig  *threadConfig,
Packit Service d40955
                          Nonce                nonce,
Packit Service d40955
                          PhysicalLayer       *layer,
Packit Service d40955
                          Partition           *summaryPartition,
Packit Service d40955
                          ReadOnlyNotifier    *readOnlyNotifier,
Packit Service d40955
                          RecoveryJournal     *recoveryJournal,
Packit Service d40955
                          SlabDepot          **depotPtr)
Packit Service d40955
  __attribute__((warn_unused_result));
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Decode the state of a slab depot saved in a buffer.
Packit Service d40955
 *
Packit Service d40955
 * @param [in]  buffer            The buffer containing the saved state
Packit Service d40955
 * @param [in]  threadConfig      The thread config of the VDO
Packit Service d40955
 * @param [in]  nonce             The nonce of the VDO
Packit Service d40955
 * @param [in]  layer             The physical layer below this depot
Packit Service d40955
 * @param [in]  summaryPartition  The partition which holds the slab summary
Packit Service d40955
 * @param [in]  readOnlyNotifier  The context for entering read-only mode
Packit Service d40955
 * @param [in]  recoveryJournal   The recovery journal of the VDO
Packit Service d40955
 * @param [out] depotPtr          A pointer to hold the depot
Packit Service d40955
 *
Packit Service d40955
 * @return A success or error code
Packit Service d40955
 **/
Packit Service d40955
int decodeSlabDepot(Buffer              *buffer,
Packit Service d40955
                    const ThreadConfig  *threadConfig,
Packit Service d40955
                    Nonce                nonce,
Packit Service d40955
                    PhysicalLayer       *layer,
Packit Service d40955
                    Partition           *summaryPartition,
Packit Service d40955
                    ReadOnlyNotifier    *readOnlyNotifier,
Packit Service d40955
                    RecoveryJournal     *recoveryJournal,
Packit Service d40955
                    SlabDepot          **depotPtr)
Packit Service d40955
  __attribute__((warn_unused_result));
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Allocate the RefCounts for all slabs in the depot. This method may be called
Packit Service d40955
 * only before entering normal operation from the load thread.
Packit Service d40955
 *
Packit Service d40955
 * @param depot  The depot whose RefCounts need allocation
Packit Service d40955
 *
Packit Service d40955
 * @return VDO_SUCCESS or an error
Packit Service d40955
 **/
Packit Service d40955
int allocateSlabRefCounts(SlabDepot *depot)
Packit Service d40955
  __attribute__((warn_unused_result));
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Get the block allocator for a specified physical zone from a depot.
Packit Service d40955
 *
Packit Service d40955
 * @param depot       The depot
Packit Service d40955
 * @param zoneNumber  The physical zone
Packit Service d40955
 *
Packit Service d40955
 * @return The block allocator for the specified zone
Packit Service d40955
 **/
Packit Service d40955
BlockAllocator *getBlockAllocatorForZone(SlabDepot *depot,
Packit Service d40955
                                         ZoneCount  zoneNumber)
Packit Service d40955
  __attribute__((warn_unused_result));
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Get the number of the slab that contains a specified block.
Packit Service d40955
 *
Packit Service d40955
 * @param depot          The slab depot
Packit Service d40955
 * @param pbn            The physical block number
Packit Service d40955
 * @param slabNumberPtr  A pointer to hold the slab number
Packit Service d40955
 *
Packit Service d40955
 * @return VDO_SUCCESS or an error
Packit Service d40955
 **/
Packit Service d40955
int getSlabNumber(const SlabDepot     *depot,
Packit Service d40955
                  PhysicalBlockNumber  pbn,
Packit Service d40955
                  SlabCount           *slabNumberPtr)
Packit Service d40955
  __attribute__((warn_unused_result));
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Get the slab object for the slab that contains a specified block. Will put
Packit Service d40955
 * the VDO in read-only mode if the PBN is not a valid data block nor the zero
Packit Service d40955
 * block.
Packit Service d40955
 *
Packit Service d40955
 * @param depot  The slab depot
Packit Service d40955
 * @param pbn    The physical block number
Packit Service d40955
 *
Packit Service d40955
 * @return The slab containing the block, or NULL if the block number is the
Packit Service d40955
 *         zero block or otherwise out of range
Packit Service d40955
 **/
Packit Service d40955
Slab *getSlab(const SlabDepot *depot, PhysicalBlockNumber pbn)
Packit Service d40955
  __attribute__((warn_unused_result));
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Get the slab journal for the slab that contains a specified block.
Packit Service d40955
 *
Packit Service d40955
 * @param depot  The slab depot
Packit Service d40955
 * @param pbn    The physical block number within the block depot partition
Packit Service d40955
 *               of any block in the slab
Packit Service d40955
 *
Packit Service d40955
 * @return The slab journal of the slab containing the block, or NULL if the
Packit Service d40955
 *         block number is for the zero block or otherwise out of range
Packit Service d40955
 **/
Packit Service d40955
SlabJournal *getSlabJournal(const SlabDepot *depot, PhysicalBlockNumber pbn)
Packit Service d40955
  __attribute__((warn_unused_result));
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Determine how many new references a block can acquire. This method must be
Packit Service d40955
 * called from the the physical zone thread of the PBN.
Packit Service d40955
 *
Packit Service d40955
 * @param depot  The slab depot
Packit Service d40955
 * @param pbn    The physical block number that is being queried
Packit Service d40955
 *
Packit Service d40955
 * @return the number of available references
Packit Service d40955
 **/
Packit Service d40955
uint8_t getIncrementLimit(SlabDepot *depot, PhysicalBlockNumber pbn)
Packit Service d40955
  __attribute__((warn_unused_result));
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Determine whether the given PBN refers to a data block.
Packit Service d40955
 *
Packit Service d40955
 * @param depot  The depot
Packit Service d40955
 * @param pbn    The physical block number to ask about
Packit Service d40955
 *
Packit Service d40955
 * @return True if the PBN corresponds to a data block
Packit Service d40955
 **/
Packit Service d40955
bool isPhysicalDataBlock(const SlabDepot *depot, PhysicalBlockNumber pbn)
Packit Service d40955
  __attribute__((warn_unused_result));
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Get the total number of data blocks allocated across all the slabs in the
Packit Service d40955
 * depot, which is the total number of blocks with a non-zero reference count.
Packit Service d40955
 * This may be called from any thread.
Packit Service d40955
 *
Packit Service d40955
 * @param depot  The slab depot
Packit Service d40955
 *
Packit Service d40955
 * @return The total number of blocks with a non-zero reference count
Packit Service d40955
 **/
Packit Service d40955
BlockCount getDepotAllocatedBlocks(const SlabDepot *depot)
Packit Service d40955
  __attribute__((warn_unused_result));
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Get the total of the statistics from all the block allocators in the depot.
Packit Service d40955
 *
Packit Service d40955
 * @param depot  The slab depot
Packit Service d40955
 *
Packit Service d40955
 * @return The statistics from all block allocators in the depot
Packit Service d40955
 **/
Packit Service d40955
BlockAllocatorStatistics
Packit Service d40955
getDepotBlockAllocatorStatistics(const SlabDepot *depot)
Packit Service d40955
  __attribute__((warn_unused_result));
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Get the total number of data blocks in all the slabs in the depot. This may
Packit Service d40955
 * be called from any thread.
Packit Service d40955
 *
Packit Service d40955
 * @param depot  The slab depot
Packit Service d40955
 *
Packit Service d40955
 * @return The total number of data blocks in all slabs
Packit Service d40955
 **/
Packit Service d40955
BlockCount getDepotDataBlocks(const SlabDepot *depot)
Packit Service d40955
  __attribute__((warn_unused_result));
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Get the total number of free blocks remaining in all the slabs in the
Packit Service d40955
 * depot, which is the total number of blocks that have a zero reference
Packit Service d40955
 * count. This may be called from any thread.
Packit Service d40955
 *
Packit Service d40955
 * @param depot  The slab depot
Packit Service d40955
 *
Packit Service d40955
 * @return The total number of blocks with a zero reference count
Packit Service d40955
 **/
Packit Service d40955
BlockCount getDepotFreeBlocks(const SlabDepot *depot)
Packit Service d40955
  __attribute__((warn_unused_result));
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Get the total number of slabs in the depot
Packit Service d40955
 *
Packit Service d40955
 * @param depot  The slab depot
Packit Service d40955
 *
Packit Service d40955
 * @return The total number of slabs
Packit Service d40955
 **/
Packit Service d40955
SlabCount getDepotSlabCount(const SlabDepot *depot)
Packit Service d40955
  __attribute__((warn_unused_result));
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Get the total number of unrecovered slabs in the depot, which is the total
Packit Service d40955
 * number of unrecovered slabs from all zones. This may be called from any
Packit Service d40955
 * thread.
Packit Service d40955
 *
Packit Service d40955
 * @param depot  The slab depot
Packit Service d40955
 *
Packit Service d40955
 * @return The total number of slabs that are unrecovered
Packit Service d40955
 **/
Packit Service d40955
SlabCount getDepotUnrecoveredSlabCount(const SlabDepot *depot)
Packit Service d40955
  __attribute__((warn_unused_result));
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Get the aggregated slab journal statistics for the depot.
Packit Service d40955
 *
Packit Service d40955
 * @param depot  The slab depot
Packit Service d40955
 *
Packit Service d40955
 * @return The aggregated statistics for all slab journals in the depot
Packit Service d40955
 **/
Packit Service d40955
SlabJournalStatistics getDepotSlabJournalStatistics(const SlabDepot *depot)
Packit Service d40955
  __attribute__((warn_unused_result));
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Get the cumulative RefCounts statistics for the depot.
Packit Service d40955
 *
Packit Service d40955
 * @param depot  The slab depot
Packit Service d40955
 *
Packit Service d40955
 * @return The cumulative statistics for all RefCounts in the depot
Packit Service d40955
 **/
Packit Service d40955
RefCountsStatistics getDepotRefCountsStatistics(const SlabDepot *depot)
Packit Service d40955
  __attribute__((warn_unused_result));
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Asynchronously load any slab depot state that isn't included in the
Packit Service d40955
 * SuperBlock component. This method may be called only before entering normal
Packit Service d40955
 * operation from the load thread.
Packit Service d40955
 *
Packit Service d40955
 * @param depot        The depot to load
Packit Service d40955
 * @param operation    The type of load to perform
Packit Service d40955
 * @param parent       The completion to finish when the load is complete
Packit Service d40955
 * @param context      Additional context for the load operation; may be NULL
Packit Service d40955
 **/
Packit Service d40955
void loadSlabDepot(SlabDepot         *depot,
Packit Service d40955
                   AdminStateCode     operation,
Packit Service d40955
                   VDOCompletion     *parent,
Packit Service d40955
                   void              *context);
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Prepare the slab depot to come online and start allocating blocks. This
Packit Service d40955
 * method may be called only before entering normal operation from the load
Packit Service d40955
 * thread. It must be called before allocation may proceed.
Packit Service d40955
 *
Packit Service d40955
 * @param depot     The depot to prepare
Packit Service d40955
 * @param loadType  The load type
Packit Service d40955
 * @param parent    The completion to finish when the operation is complete
Packit Service d40955
 **/
Packit Service d40955
void prepareToAllocate(SlabDepot         *depot,
Packit Service d40955
                       SlabDepotLoadType  loadType,
Packit Service d40955
                       VDOCompletion     *parent);
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Update the slab depot to reflect its new size in memory. This size is saved
Packit Service d40955
 * to disk as part of the super block.
Packit Service d40955
 *
Packit Service d40955
 * @param depot  The depot to update
Packit Service d40955
 **/
Packit Service d40955
void updateSlabDepotSize(SlabDepot *depot);
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Allocate new memory needed for a resize of a slab depot to the given size.
Packit Service d40955
 *
Packit Service d40955
 * @param depot    The depot to prepare to resize
Packit Service d40955
 * @param newSize  The number of blocks in the new depot
Packit Service d40955
 *
Packit Service d40955
 * @return VDO_SUCCESS or an error
Packit Service d40955
 **/
Packit Service d40955
int prepareToGrowSlabDepot(SlabDepot *depot, BlockCount newSize)
Packit Service d40955
  __attribute__((warn_unused_result));
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Use the new slabs allocated for resize.
Packit Service d40955
 *
Packit Service d40955
 * @param depot   The depot
Packit Service d40955
 * @param parent  The object to notify when complete
Packit Service d40955
 **/
Packit Service d40955
void useNewSlabs(SlabDepot *depot, VDOCompletion *parent);
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Abandon any new slabs in this depot, freeing them as needed.
Packit Service d40955
 *
Packit Service d40955
 * @param depot  The depot
Packit Service d40955
 **/
Packit Service d40955
void abandonNewSlabs(SlabDepot *depot);
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Drain all slab depot I/O. If saving, or flushing, all dirty depot metadata
Packit Service d40955
 * will be written out. If saving or suspending, the depot will be left in a
Packit Service d40955
 * suspended state.
Packit Service d40955
 *
Packit Service d40955
 * @param depot      The depot to drain
Packit Service d40955
 * @param operation  The drain operation (flush, rebuild, suspend, or save)
Packit Service d40955
 * @param parent     The completion to finish when the drain is complete
Packit Service d40955
 **/
Packit Service d40955
void drainSlabDepot(SlabDepot      *depot,
Packit Service d40955
                    AdminStateCode  operation,
Packit Service d40955
                    VDOCompletion  *parent);
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Resume a suspended slab depot.
Packit Service d40955
 *
Packit Service d40955
 * @param depot   The depot to resume
Packit Service d40955
 * @param parent  The completion to finish when the depot has resumed
Packit Service d40955
 **/
Packit Service d40955
void resumeSlabDepot(SlabDepot *depot, VDOCompletion *parent);
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Commit all dirty tail blocks which are locking a given recovery journal
Packit Service d40955
 * block. This method must be called from the journal zone thread.
Packit Service d40955
 *
Packit Service d40955
 * @param depot                The depot
Packit Service d40955
 * @param recoveryBlockNumber  The sequence number of the recovery journal
Packit Service d40955
 *                             block whose locks should be released
Packit Service d40955
 **/
Packit Service d40955
void commitOldestSlabJournalTailBlocks(SlabDepot      *depot,
Packit Service d40955
                                       SequenceNumber  recoveryBlockNumber);
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Get the SlabConfig of a depot.
Packit Service d40955
 *
Packit Service d40955
 * @param depot  The slab depot
Packit Service d40955
 *
Packit Service d40955
 * @return The slab configuration of the specified depot
Packit Service d40955
 **/
Packit Service d40955
const SlabConfig *getSlabConfig(const SlabDepot *depot)
Packit Service d40955
  __attribute__((warn_unused_result));
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Get the slab summary.
Packit Service d40955
 *
Packit Service d40955
 * @param depot  The slab depot
Packit Service d40955
 *
Packit Service d40955
 * @return The slab summary
Packit Service d40955
 **/
Packit Service d40955
SlabSummary *getSlabSummary(const SlabDepot *depot)
Packit Service d40955
  __attribute__((warn_unused_result));
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Get the portion of the slab summary for a given physical zone.
Packit Service d40955
 *
Packit Service d40955
 * @param depot  The slab depot
Packit Service d40955
 * @param zone   The zone
Packit Service d40955
 *
Packit Service d40955
 * @return The portion of the slab summary for the specified zone
Packit Service d40955
 **/
Packit Service d40955
SlabSummaryZone *getSlabSummaryForZone(const SlabDepot *depot, ZoneCount zone)
Packit Service d40955
  __attribute__((warn_unused_result));
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Scrub all unrecovered slabs.
Packit Service d40955
 *
Packit Service d40955
 * @param depot         The depot to scrub
Packit Service d40955
 * @param parent        The object to notify when scrubbing is complete
Packit Service d40955
 * @param callback      The function to call when scrubbing is complete
Packit Service d40955
 * @param errorHandler  The handler for scrubbing errors
Packit Service d40955
 * @param threadID      The thread on which to run the callback
Packit Service d40955
 * @param launchParent  The object to notify when scrubbing has been launched
Packit Service d40955
 *                      for all zones
Packit Service d40955
 **/
Packit Service d40955
void scrubAllUnrecoveredSlabs(SlabDepot     *depot,
Packit Service d40955
                              void          *parent,
Packit Service d40955
                              VDOAction     *callback,
Packit Service d40955
                              VDOAction     *errorHandler,
Packit Service d40955
                              ThreadID       threadID,
Packit Service d40955
                              VDOCompletion *launchParent);
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Check whether there are outstanding unrecovered slabs.
Packit Service d40955
 *
Packit Service d40955
 * @param depot  The slab depot
Packit Service d40955
 *
Packit Service d40955
 * @return Whether there are outstanding unrecovered slabs
Packit Service d40955
 **/
Packit Service d40955
bool hasUnrecoveredSlabs(SlabDepot *depot);
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Get the physical size to which this depot is prepared to grow.
Packit Service d40955
 *
Packit Service d40955
 * @param depot  The slab depot
Packit Service d40955
 *
Packit Service d40955
 * @return The new number of blocks the depot will be grown to, or 0 if the
Packit Service d40955
 *         depot is not prepared to grow
Packit Service d40955
 **/
Packit Service d40955
BlockCount getNewDepotSize(const SlabDepot *depot)
Packit Service d40955
  __attribute__((warn_unused_result));
Packit Service d40955
Packit Service d40955
/**
Packit Service d40955
 * Dump the slab depot, in a thread-unsafe fashion.
Packit Service d40955
 *
Packit Service d40955
 * @param depot  The slab depot
Packit Service d40955
 **/
Packit Service d40955
void dumpSlabDepot(const SlabDepot *depot);
Packit Service d40955
Packit Service d40955
#endif // SLAB_DEPOT_H