|
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 |
* $Id: //eng/vdo-releases/aluminum/src/c++/vdo/base/logicalZone.h#3 $
|
|
Packit Service |
310c69 |
*/
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
#ifndef LOGICAL_ZONE_H
|
|
Packit Service |
310c69 |
#define LOGICAL_ZONE_H
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
#include "adminState.h"
|
|
Packit Service |
310c69 |
#include "intMap.h"
|
|
Packit Service |
310c69 |
#include "types.h"
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**
|
|
Packit Service |
310c69 |
* Get a logical zone by number.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @param zones A set of logical zones
|
|
Packit Service |
310c69 |
* @param zoneNumber The number of the zone to get
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @return The requested zone
|
|
Packit Service |
310c69 |
**/
|
|
Packit Service |
310c69 |
LogicalZone *getLogicalZone(LogicalZones *zones, ZoneCount zoneNumber)
|
|
Packit Service |
310c69 |
__attribute__((warn_unused_result));
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**
|
|
Packit Service |
310c69 |
* Create a set of logical zones.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @param [in] vdo The VDO to which the zones will belong
|
|
Packit Service |
310c69 |
* @param [out] zonesPtr A pointer to hold the new zones
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @return VDO_SUCCESS or an error code
|
|
Packit Service |
310c69 |
**/
|
|
Packit Service |
310c69 |
int makeLogicalZones(VDO *vdo, LogicalZones **zonesPtr)
|
|
Packit Service |
310c69 |
__attribute__((warn_unused_result));
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**
|
|
Packit Service |
310c69 |
* Free a set of logical zones and null out the reference to it.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @param zonePtr A pointer to the zone to free
|
|
Packit Service |
310c69 |
**/
|
|
Packit Service |
310c69 |
void freeLogicalZones(LogicalZones **zonePtr);
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**
|
|
Packit Service |
310c69 |
* Drain a set of logical zones.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @param zones The logical zones to suspend
|
|
Packit Service |
310c69 |
* @param operation The type of drain to perform
|
|
Packit Service |
310c69 |
* @param completion The object to notify when the zones are suspended
|
|
Packit Service |
310c69 |
**/
|
|
Packit Service |
310c69 |
void drainLogicalZones(LogicalZones *zones,
|
|
Packit Service |
310c69 |
AdminStateCode operation,
|
|
Packit Service |
310c69 |
VDOCompletion *completion);
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**
|
|
Packit Service |
310c69 |
* Resume a set of logical zones.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @param zones The logical zones to resume
|
|
Packit Service |
310c69 |
* @param parent The object to notify when the zones have resumed
|
|
Packit Service |
310c69 |
**/
|
|
Packit Service |
310c69 |
void resumeLogicalZones(LogicalZones *zones, VDOCompletion *parent);
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**
|
|
Packit Service |
310c69 |
* Get the ID of a logical zone's thread.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @param zone The zone
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @return The zone's thread ID
|
|
Packit Service |
310c69 |
**/
|
|
Packit Service |
310c69 |
ThreadID getLogicalZoneThreadID(const LogicalZone *zone)
|
|
Packit Service |
310c69 |
__attribute__((warn_unused_result));
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**
|
|
Packit Service |
310c69 |
* Get the portion of the block map for this zone.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @param zone The zone
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @return The block map zone
|
|
Packit Service |
310c69 |
**/
|
|
Packit Service |
310c69 |
BlockMapZone *getBlockMapForZone(const LogicalZone *zone)
|
|
Packit Service |
310c69 |
__attribute__((warn_unused_result));
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**
|
|
Packit Service |
310c69 |
* Get the logical lock map for this zone.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @param zone The zone
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @return The logical lock map for the zone
|
|
Packit Service |
310c69 |
**/
|
|
Packit Service |
310c69 |
IntMap *getLBNLockMap(const LogicalZone *zone)
|
|
Packit Service |
310c69 |
__attribute__((warn_unused_result));
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**
|
|
Packit Service |
310c69 |
* Get the next-highest-numbered logical zone, or NULL if the
|
|
Packit Service |
310c69 |
* zone is the highest-numbered zone in its VDO.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @param zone The logical zone to query
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @return The logical zone whose zone number is one greater than the given
|
|
Packit Service |
310c69 |
* zone, or NULL if there is no such zone
|
|
Packit Service |
310c69 |
**/
|
|
Packit Service |
310c69 |
LogicalZone *getNextLogicalZone(const LogicalZone *zone)
|
|
Packit Service |
310c69 |
__attribute__((warn_unused_result));
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**
|
|
Packit Service |
310c69 |
* Increment the flush generation in a logical zone.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @param zone The logical zone
|
|
Packit Service |
310c69 |
* @param expectedGeneration The expected value of the flush generation
|
|
Packit Service |
310c69 |
* before the increment
|
|
Packit Service |
310c69 |
**/
|
|
Packit Service |
310c69 |
void incrementFlushGeneration(LogicalZone *zone,
|
|
Packit Service |
310c69 |
SequenceNumber expectedGeneration);
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**
|
|
Packit Service |
310c69 |
* Get the oldest flush generation which is locked by a logical zone.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @param zone The logical zone
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @return The oldest generation locked by the zone
|
|
Packit Service |
310c69 |
**/
|
|
Packit Service |
310c69 |
SequenceNumber getOldestLockedGeneration(const LogicalZone *zone)
|
|
Packit Service |
310c69 |
__attribute__((warn_unused_result));
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**
|
|
Packit Service |
310c69 |
* Acquire the shared lock on a flush generation by a write DataVIO.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @param dataVIO The DataVIO
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @return VDO_SUCCESS or an error code
|
|
Packit Service |
310c69 |
**/
|
|
Packit Service |
310c69 |
int acquireFlushGenerationLock(DataVIO *dataVIO)
|
|
Packit Service |
310c69 |
__attribute__((warn_unused_result));
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**
|
|
Packit Service |
310c69 |
* Release the shared lock on a flush generation held by a write DataVIO. If
|
|
Packit Service |
310c69 |
* there are pending flushes, and this DataVIO completes the oldest generation
|
|
Packit Service |
310c69 |
* active in this zone, an attempt will be made to finish any flushes which may
|
|
Packit Service |
310c69 |
* now be complete.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @param dataVIO The DataVIO whose lock is to be released
|
|
Packit Service |
310c69 |
**/
|
|
Packit Service |
310c69 |
void releaseFlushGenerationLock(DataVIO *dataVIO);
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**
|
|
Packit Service |
310c69 |
* Get the selector for deciding which physical zone should be allocated from
|
|
Packit Service |
310c69 |
* next for activities in a logical zone.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @param zone The logical zone of the operation which needs an allocation
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @return The allocation selector for this zone
|
|
Packit Service |
310c69 |
**/
|
|
Packit Service |
310c69 |
AllocationSelector *getAllocationSelector(LogicalZone *zone)
|
|
Packit Service |
310c69 |
__attribute__((warn_unused_result));
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**
|
|
Packit Service |
310c69 |
* Dump information about a logical zone to the log for debugging, in a
|
|
Packit Service |
310c69 |
* thread-unsafe fashion.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @param zone The zone to dump
|
|
Packit Service |
310c69 |
**/
|
|
Packit Service |
310c69 |
void dumpLogicalZone(const LogicalZone *zone);
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
#endif // LOGICAL_ZONE_H
|