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