Files
mars-nwe/include/nwnss/include/volume.h

1674 lines
62 KiB
C

/****************************************************************************
|
| (C) Copyright 1995-2003 Novell, Inc.
| All Rights Reserved.
|
| This program is free software; you can redistribute it and/or
| modify it under the terms of version 2 of the GNU General Public
| License as published by the Free Software Foundation.
|
| This program is distributed in the hope that it will be useful,
| but WITHOUT ANY WARRANTY; without even the implied warranty of
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
| GNU General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with this program; if not, contact Novell, Inc.
|
| To contact Novell about this file by physical or electronic mail,
| you may find current contact information at www.novell.com
|
|***************************************************************************
|
| NetWare Advance File Services (NSS) module
|
|---------------------------------------------------------------------------
|
| $Author: cteerlink $
| $Date: 2008-04-18 03:39:54 +0530 (Fri, 18 Apr 2008) $
|
| $RCSfile$
| $Revision: 2319 $
|
|---------------------------------------------------------------------------
| This module is used to:
| This defines all of the primitive BEASTS inside of PSS
|
| WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
|
| This header file should ONLY be used for NSS internal development.
| This includes Semantic Agents (SA) and Loadable Storage Services (LSS).
| Any other use may cause conflicts which NSS will NOT fix.
+-------------------------------------------------------------------------*/
#ifndef _VOLUME_H_
#define _VOLUME_H_
#include <xUnicode.h>
#if zNETWARE || (zLINUX && (defined(__KERNEL__) || defined(MARS_NWE_NWNSS_USERSPACE)))
#ifndef _COMNPARAMS_H_
# include <comnParams.h>
#endif
#ifndef _COMNBEASTS_H_
# include <comnBeasts.h>
#endif
#ifndef _CM_CONTROL_H_
#include "cmControl.h"
#endif /* _CM_CONTROL_H_ */
#ifndef _SCHEDULE_H_
#include "schedule.h"
#endif
#ifndef _EVS_H_
#include "evs.h"
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if zNETWARE || (zLINUX && (defined(__KERNEL__) || defined(MARS_NWE_NWNSS_USERSPACE)))
/****************************************************************************
* Queue of volumes and pools known to the system
*****************************************************************************/
extern SEThead_t NSSMasterVolumeList;
extern SEThead_t NSSMasterPoolList;
#endif
/****************************************************************************
* Volume Defines
*****************************************************************************/
//#define VOL_BLK_SHIFT 12 /* block shift factor for VOLUMES */
/*---------------------------------------------------------------------------
* These are defines are used by COMN_ChangeVolumeState
*---------------------------------------------------------------------------*/
#define VOLMODE_DISABLE 0x0001 /* Disable the volume. Set this bit to
* indicate that a serious ERROR has
* occurred with the volume. This
* bit will cause the v_ioFlag DISABLE
* bit to be set. LSSes can use the
* v_ioFlag bit to determine if we
* are in the process of trying to
* cleanup because of a serious error.
*/
#define VOLMODE_VERBOSE 0x0002 /* Indicates that progress messages
* should be displayed on the system
* console.
*/
#define VOLMODE_OVERRIDE 0x0004 /* When set the change volume code will
* do exactly what was requested. In
* normal cases when a volume is
* activated the volume can be placed
* in the MAINTENANCE state due to
* the stateAttribute in the Volume_s.
* E.G. if the volume is CORUUPTED then
* we will force into MAINTENANCE state.
* This override bit is provided so
* that the user can force the volume
* into any state.
*/
#define VOLMODE_USER_ABORTABLE 0x0008 /* Set this bit if the request is
* being made by the user via a
* console command. This informs the
* code that it is ok to prompt the
* user if they really want to do the
* change state. This is usually
* only done when there is a DEACTIVE
* attempt with open files.
*/
#define VOLMODE_NO_ERR_MSG 0x0010 /* If this bit is set, error
* messages should not be prinited if
* the volume does not exist in NSS
*/
#define iVOLMODE_LOWER_ONLY 0x0020 /* (internal) Set this bit to indicate
* that the
* volume should do a state change
* only if the requested state is
* lower than the volumes current
* state. This is used to sync
* LVs with state changes that their
* pools are doing. This bit must
* only be set if the request is coming
* from a POOL change volume state AND
* the pool cvsLatch is owned. Not
* allowed to be set when VOLMODE_
* DISABLE is set.
*/
#define iVOLMODE_POOL_LACTHED 0x0040 /* Set this bit to indicate
* that the POOL that owns this volume
* has already been latched.
*/
#define VOLMODE_OVERRIDE_SHARED 0x0080 /* Set to force an action on a
* SHARED pool/volume that would not
* normally be done because the cluster
* software is not present. This is
* used when going into ACTIVE or
* MAINTENANCE state. These states
* are important as these are the
* only states where a pool/volume
* can be written to.
*/
#define VOLMODE_LEGAL_BITS (VOLMODE_DISABLE|VOLMODE_VERBOSE|\
VOLMODE_NO_ERR_MSG|\
VOLMODE_OVERRIDE|VOLMODE_USER_ABORTABLE|\
iVOLMODE_LOWER_ONLY|iVOLMODE_POOL_LACTHED|\
iVOLMODE_NSS_UNLOADING|VOLMODE_OVERRIDE_SHARED)
/* VOLMODE_LEGAL_BITS is the mask of LEGAL
* bits when calling COMN_ChangePoolState
* or COMN_ChnageVolumeState.
*/
#define iVOLMODE_UNDO 0x1000 /* Internal - COMN_ChangeVolumeState
* uses to inform volumes comn op
* that it is now being requested to
* UNDO a partial state change.
*/
#define iVOLMODE_MUST_SUCCEED 0x2000 /* Internal - COMN_ChangeVolumeState
* uses to inform LSSes that they are
* not allowed to fail the state change.
*/
#ifdef zVOLMODE_MUST_SUCCEED
#if zVOLMODE_MUST_SUCCEED != iVOLMODE_MUST_SUCCEED
#error zVOLMODE_MUST_SUCCEED must match iVOLMODE_MUST_SUCCEED (neither should be changed as part of event API)
#endif
#endif
#define iVOLMODE_NSS_UNLOADING 0x4000 /* Internal - COMN_ChangeVolumeState
* uses to inform LSSes that this
* volume state change was caused by
* NSS being unloaded
*/
#define iVOLMODE_ATTRIBUTE_CHANGE 0x8000 /* Internal - OES code uses to indicate
* that the event we are generating is being
* done because some 'attribute' of the volume
* may have changed.
*/
#ifdef zVOLMODE_ATTRIBUTE_CHANGE
#if zVOLMODE_ATTRIBUTE_CHANGE != iVOLMODE_ATTRIBUTE_CHANGE
#error zVOLMODE_ATTRIBUTE_CHANGE must match iVOLMODE_ATTRIBUTE_CHANGE (neither should be changed as part of event API)
#endif
#endif
#define VOL_DOES_ROOTDIR FALSE // Set to TRUE to switch back to the
// volume doing all rootdir work.
#define VOL_HAS_SYSTEM_BEASTS VOL_DOES_ROOTDIR
// Set to TRUE if the Volume_s beasts
// has system beasts.
#define VOLEVENT_LOAD 1
#if zNETWARE || (zLINUX && (defined(__KERNEL__) || defined(MARS_NWE_NWNSS_USERSPACE)))
/****************************************************************************
* VOLUME Beast
*
* This is used to define all VOLUMES in the SYSTEM.
*
* Volume is a virtual class used to derive the storage system
* specific volumes.
*****************************************************************************/
/*-------------------------------------------------------------------------
* This defines all of the univeral persistent volume information.
* Because this information is stored differently on different storage
* systems we do not put this inline in the VOLUME beasts. We have a
* pointer to this information in the volume beasts and the system can
* decide where this is pointed too.
*-------------------------------------------------------------------------*/
/* NOTE--If this structure needs to grow, keep it QUAD aligned, and steal
* equivalent space from the reserved field in the PersistentVolume_s struct */
typedef struct LoggedPersistentVolume_s
{
Zid_t nextZid; /* next ZID to use on volume */
QUAD numFiles; /* how many files are on the volume */
QUAD numObjects; /* how many objects are on the volume */
QUAD totalBlocks; /* total number of blocks allowed on volume*/
QUAD inUseBlocks; /* number of blocks being used by this volume */
QUAD purgeableBlocks; /* number of purgeable blocks in the salvage system */
QUAD nonPurgeableBlocks; /* number of non-purgeable blocks in the salvage system */
QUAD numDeletedFiles; /* number of deleted files on the volume */
LONG renameSeqNum; /* Sequence number to prevent wildcard rename recursion*/
LONG reserved1;
QUAD numCompressedFiles; /* number of compressed-not-deleted files */
QUAD numCompDelFiles; /* number of deleted-and-compressed files */
QUAD numUncompressibleFiles; /* number of uncompressible files */
QUAD numCompressedFileBlocks; /* number of file blocks occupied by
* compressed files */
QUAD numPreCompressedFileBlocks; /* FixFixFix find out what this
* means */
Time_t epoch; /* Volume backup/COW epoch timestamp */
LONG reservedEpoch; /* reserved for expansion of epoch to 64 bits */
/* LSSs do not need to write the reserved area.
* If you have an LSS that does not do logging (e.g.
* DOS and CDROM LSS) you might be better off writing the reserved
* area. If you do this you will not have change your LSS if
* NSS uses this reserved area. This does not apply to
* logging LSSs because they will have to change to LOG
* the new data.
*/
LONG LPV_reserved[32-30]; /* QUAD ALIGN and Filler for future growth */
/* The logged data is 128 bytes long */
} NSS_MEDIA_STRUCTURE(LoggedPersistentVolume_s,LPV_reserved[32-30]) LoggedPersistentVolume_s;
typedef struct VolInfoLog_s /* structure for transaction logging */
{
LONG action;
SLONG delta; /* the amount the field has changed */
QUAD VIL_value; /* Value of field - currently used to help
* find a bug where the nextZid is not correct.
* Can be used only for values that do not
* ever decrement.
*/
} NSS_MEDIA_STRUCTURE(VolInfoLog_s,VIL_value) VolInfoLog_s;
/* logged vol info actions */
#define VOLINFO_CHANGE_NUM_OBJECTS 1
#define VOLINFO_CHANGE_NUM_FILES 2
#define VOLINFO_CHANGE_NUM_BLOCKS 3
#define VOLINFO_CHANGE_TOT_BLOCKS 4
#define VOLINFO_CHANGE_NEXT_ZID 5
#define VOLINFO_CHANGE_PURGEABLE_BLOCKS 6
#define VOLINFO_CHANGE_NON_PURGEABLE_BLOCKS 7
#define VOLINFO_CHANGE_NUM_DELETED_FILES 8
#define VOLINFO_CHANGE_REN_SEQ_NUM 9
#define VOLINFO_CHANGE_NUM_COMPRESSED_FILES 10
#define VOLINFO_CHANGE_NUM_COMP_DELETED_FILES 11
#define VOLINFO_CHANGE_NUM_UNCOMPRESSIBLE_FILES 12
#define VOLINFO_CHANGE_NUM_COMPRESSED_FILE_BLOCKS 13
#define VOLINFO_CHANGE_NUM_PRECOMPRESSED_FILE_BLOCKS 14
/* Legal values for stateAttribute of PersistentVolume_s */
#define VOLSTATEATTR_CORRUPT 0x00000001 /* The volume has corrupted
* metadata. This will force the volume
* into MAINTENANCE state when
* the volume is activated. The LSS
* sets and resets this bit.
*/
#define VOLSTATEATTR_WARNING 0x00000002 /* The volume has some metadata
* problems, but nothing that is critical.
* The volume can be successfully placed
* into ACTIVE state. The LSS sets and
* resets this bit.
*/
#define VOLSTATEATTR_REPAIRING 0x00000004 /* The volume is currently being
* repaired. This bit is usually used so
* that repair can be informed after a
* crash that it was running. LSS sets
* and resets this bit.
*/
#define VOLSTATEATTR_CHECKING 0x00000008 /* The volume is currently being
* checked. This bit is usually used so
* that checker can be informed after a
* crash that it was running. LSS sets
* and resets this bit.
*/
#define VOLSTATEATTR_FIXEDATTR 0x00000010 /* There is a bug which can cause
* the volAttributes to be corrupt with
* only the salvage bit being valid.
* We've fixed the bug to not corrupt, but
* we zero out the rest of the bits one
* time and set this flag. (This was done
* in SP4). In 6-pack when we upgrade the
* volume from SP4 we need to take this into
* consideration.
* This bit is not used in 6-pack after
* the volume has beed upgraded to 6-pack
* media format.
*/
#define VOLSTATEATTR_REZID 0x00000020 /* This is set when rezid has been
* started but not completed. We keep this
* field persistently so that if we crash
* in the middle of rezid, we can continue
* where we left off.
*/
typedef struct PersistentVolume_s
{
VolumeID_t NUvolumeID; /* Not Used!!!! unique volume ID (guid)*/
QUAD beastVersionMask; /* bitmask of which beast versions are in volume.*/
LONG blockSize; /* size of a block on this volume*/
LONG blockShift; /* shift factor for block size*/
LONG oldVolAttributes; /* This should no longer be used.
* The first time we come up, if enabledAttributes
* is 0, we upgrade this field to the
* enabledAttributes field. */
LONG nameSpaceMask; /* bitmask of which namespaces are supported */
BYTE mac[32]; /* Mandatory Access Control Area*/
LONG authModelID; /* ID of the authorization system for this volume */
LONG minKeepSeconds; /* Salvage: Min number of seconds before auto purge */
LONG maxKeepSeconds; /* Salvage: Max number of seconds before auto purge */
BYTE lowWaterMark; /* Salvage: Start auto purging when % free space goes below this */
BYTE highWaterMark; /* Salvage: Stop auto purging when % free space goes above this */
WORD beastVersion; /* If this version does not match CURRENT_BEAST_VERSION
* then the volume object needs to be upgraded. */
LONG stateAttributes; /* Attributes that apply to the volumes
* current volume state.
*/
LONG rebuildCount; /* Number of times the volume has been
* rebuilt.
*/
NDSid_t ndsObjectID; /* NDS's object ID for this volume. */
QUAD enabledAttributes; /* This bit mask contains a bit for each
* feature which is enabled on the volume */
VolumeCompAttr_s compAttributes; /* Compression-related attributes */
/**
* The media format has been placed into Volume_s so that
* the comon layer 'could' return the information in a generic
* way. We use LONGs because each LSS may have slightly
* different requirements.
*/
LONG PV_mediaFormatMajor; /*** LSS should fill in ***/
/* Zero indicates that minor has special
* meaning.
*/
LONG PV_mediaFormatMinor; /*** LSS should fill in ***/
/* If major is zero then
* 0 - media format not supported
* 1 - media format not known yet.
*/
LONG PV_mediaFormatMajorCreate; /*** LSS should fill in ***/
/* Zero indicates that minor has special
* meaning.
*/
LONG PV_mediaFormatMinorCreate; /*** LSS should fill in ***/
/* If major is zero then
* 0 - create media format not supported
* 1 - create media format not known yet.
*/
LONG PV_createTimeUTC; /*** LSS should fill in ***/
LONG PV_verifyTimeUTC; /*** LSS should fill in ***/
LONG PV_rebuildTimeUTC; /*** LSS should fill in ***/
LONG PV_activationTimeUTC; /*** LSS should fill in ***/
/**
* The above times are for FYI for the admin. They may become
* useful when LVs start to appear in great numbers. For example,
* verify could run on volumes that have not been verified
* for a week. Currently, most apps use the rootdir of the volume
* to determine the create time of the volume.
*/
LONG PV_shredCount; /* Number of times to shred data */
#define MAX_DATA_SHRED_PATTERNS 7
LONG PV_reserved2;
#ifdef COMPILER_NO_INCOMPLETE_OFFSETOF
LONG PV_reserved3[18];
#else
LONG PV_reserved3[64 - (offsetof(struct PersistentVolume_s, PV_reserved2)/sizeof(LONG) + 1)];
#endif
/* QUAD align and future growth of
* NON-LOGGED data */
/* The above data is 256 bytes in length */
} NSS_MEDIA_STRUCTURE(PersistentVolume_s,PV_reserved3[18]) PersistentVolume_s;
/* Definitions for volAttributes are in zParams.h */
#define VOL_DISABLE_USE_SYSTEMS_WORK_TO_DO TRUE
/*
This structure hosts "meta-data" about the structure of a user transaction
log file. This was originally defined in UXAction.h, but at that time user
transactions were only supported on a single active volume (so the single
instance of this structure was a global). The need to support transactions
on multiple volumes required that each active volume have an instance of this
structure. #including UXAction.h does not work because it effectively #includes
comnPublics.h which requires definitions in this file. Therefore it was
decided to move this structure here.
*/
typedef struct UserXactionLogMetaData_s
{
Seq_t lastLSN; /* log sequence number of next UserXactionLogRecord */
LONG curBlk; /* buffer address (in blocks) of next buffer to write */
LONG lastBlk; /* buffer address (in blocks) of oldest block
* containing log data
* if next == last, the log is empty,
* if incrementing next gives you last,
* the log is full
*/
LONG insertOffset; /* byte address within the buffer where the next record starts */
LONG logFileBlockSize;
LONG logFileSizeInBlocks; /* size of log file in 4k blocks */
LONG logFileBlockSizeShiftFactor;
} UserXactionLogMetaData_s;
#ifndef _COMNPARAMS_H_
typedef struct Volume_s Volume_s;
#endif /* _COMNPARAMS_H_ */
struct Volume_s
{
AdminVolFile_s avfile; /* derived from a file*/
PersistentVolume_s p; /* holds persistent volume information*/
LoggedPersistentVolume_s logged;/* contains persistent information that is logged*/
QUAD supportedAttributes;/* Attributes this volume is capable of supporting */
QUAD maximumFileSize; /* Maximum size for any file on this volume */
Zid_t zidInProcess; /* Used when enabling user space restrictions to indicate the zid being processed */
NINT storageIndex; /* index for storage system specific routines */
NINT authModelIndex; /* index into the Auth model ID map*/
struct AuthModelBeast_s *authModel; /* authModel for volume*/
File_s *rootdir; /* pointer to root dir*/
VolumeID_t volumeID; /* unique volume ID (guid)*/
SETlink_t masterVolLink; /* link for all volumes in system*/
DQhead_t beastList; /* list of all memory resident beasts on this volume*/
NINT state; /* current state of volume
*
* See COMN_ChangeVolumeState for a detailed
* description of the STATEs.
*
* The state is protected by two latches
*
* 1) cvsLatch - must be owned to change
* the value of the state.
* 2) stateLatch - must be owned to access
* the value of the state.
*
* Note that both latches are required to
* change the state. The cvsLatch must be
* obtained first. The only code that
* should change the state is the
* COMN_ChangeVolumeState function.
*
* The stateLatch is required for read
* access of the state because the state
* is not VALID when the state is changing.
*
* Two latches are used for changing the
* state so that certain things (like
* prompting the user becuase of open
* files) can be done without owning the
* stateLatch. This allows callers who
* just neeed to view the state to latch
* stateLatch and be assurred that they
* will not block for a LONG time.
*
* FixFixFix6 - There is code that does
* not obtain the stateLatch when checking
* the state. Note that the Volume's in
* use count only ensures that the beast
* will not be tossed it ensures NOTHING
* about the volume's state.
*/
NINT maxBeastSize; /* the largest allowable beast for this volume -- filled in by the storage system volume constructor*/
Agent_s agent; /* used to create bonds*/
Latch_s cvsLatch; /* Changes Volume State Latch. Serializes
* the changing of the volume state.
*/
Latch_s stateLatch; /* Latch for when we are changing the
* volumes state. This is slightly less
* restrictive than the cvsLatch in that
* the stateLatch does not include the
* state event and any prompting of the
* admin because of open files ...
*/
NINT maintenanceStatus; /* current maintenance status */
Time_t maintenanceTime; /* time current maintenance mode started */
NINT freeBlockAdjustment;/* number of blocks the free blocks needs to be adjusted by -- filled in by the storage system volume constructor */
BOOL storageAlertHasBeenSent;/* set when an alert has been sent -- reset when enough space has been freed */
NINT nextTimeToCheck; /* the next time to check to see if the disk is still full */
NINT v_statusFlag; /* Bitmask to be used by anyone needing
* non-persistent state information. Bits
* definitions start with VOL_SF_xxx.
*/
NINT v_keepActiveUseCount; /* Count of how many current APIs and/or
* asynchronous threads are currently
* running on this volume. We need to set
* the VOL_SF_LEAVING_ACTIVE_STATE_CLEANUP
* bit in v_statusFlag and then wait for
* this count to go to zero before removing
* a volume from the active state.
*/
NINT v_keepDeactiveUseCount; /* Count of how many current APIs and/or
* asynchronous threads are currently
* running on this volume. We need to set
* the VOL_SF_LEAVING_DEACTIVE_STATE_CLEANUP
* bit in v_statusFlag and then wait for
* this count to go to zero before removing
* a volume from the deactive state. This
* count can be though as the useCount of
* the volume in the DEACTIVE state.
*/
NINT v_ioFlag; /* Internal Flags used to give IO specific
* information to the LSS.
*/
STATUS v_disableVolumeStatus;/* STATUS for LSS to return when asked
* to write when in stopWrite mode.
*/
LONG v_alertUTCOfLNextUserWriteAlert; /* UTC of next user write
* error ALERT sent. Used because we
* do not have the STATION of the
* user who should get the ALERT. This
* is the time at which another ALERT can
* be sent.
*/
#if VOL_DISABLE_USE_SYSTEMS_WORK_TO_DO
zWorkProc_s v_disableWorkToDoStructure;
/* Protected by disable schedule bit in v_statusFlag.
* WorkToDo for NSS Library schedule API - ScheduleWork().
*/
#else
FsmLite_s v_disableWorkToDoFsm;
/* Protected by disable schedule bit in v_statusFlag.
* Lite FSM to pass to WORK_Schedule().
*/
#endif
LONG v_restartCount; /* A number that should be different each
* time NSS is brought up and down.
* This field MUST be acccurate on volumes
* that support the ZAS auth model.
* The Volume_s constructor will init
* to 0.
* ZLSS sets based on a number stored
* in its checkpoints. This is done verses
* using the volumes PZV_ActivationCount
* simply because it make life easier
* on rebuild. I.E. Rebuild wiil not be
* able to run if checkpoints bad verses
* rebuild must handle is VDB bad. I.E.
* this means that rebuild does not need
* to worry about setting activation count
* correctly.
*/
NINT v_alertListCount; /* Number of alerts that are queued. Used
* to limit maximum count to 40. This is
* done to limit resource usage.
*/
DQhead_t v_alertList; /* List of all ALERTs that are queued
* for the ALERT work-to-do to
* perform. The work-to-do is for
* this volume only. Protected by
* NSS_LOCK();
*/
FsmLite_s v_alertWorkToDoFsm;
/* Protected by alert schedule bit in v_statusFlag.
* Lite FSM to pass to WORK_Schedule().
*/
DQlink_t v_poolVolLink; /* Link of all resident volumes within
* a pool. This is is protected via
* the cvsLatch of the Pool_s that
* owns the LV.
*/
// struct ZlssPool_s *ZP_ZlssPool; /* Points to the pool */
struct Pool_s *v_pool; /* Points to the pool that owns the
* volume. Only valid for volumes
* marked as VOL_SF_LOGICAL_VOLUME.
*/
struct
{
QUAD IO_user_readSize; /* IO read size (user data) */
LONG IO_user_read_success; /* IO read success count (user data) */
QUAD IO_user_writeSize; /* IO write size (user data) */
LONG IO_user_write_success; /* IO write success count (user data) */
#if NSS_DEBUG IS_ENABLED /* for debug */
QUAD IO_system_readSize; /* IO read size (system data) */
LONG IO_system_read_success; /* IO read success count (system data)*/
QUAD IO_system_writeSize; /* IO write size (system data) */
LONG IO_system_write_success;/* IO write success count */
/* (system data) */
LONG IO_user_read_failure; /* IO read failure count (user data) */
LONG IO_user_write_failure; /* IO write failure count (user data) */
LONG IO_system_read_failure; /* IO read failure count (system data)*/
LONG IO_system_write_failure;/* IO write failure count */
/* (system data) */
#endif
}v_stats;
CMVolumeState_s cmVolumeState; /* Per-volume Non-persistent
* compression mgmt state */
LONG v_pState; /* Persistent volume state that MUST BE
* VALID ALL THE TIME. This means just
* not when the volume is ACTIVE. The LSS
* must set. For legal values check out
* the zVOL_PSTATE_xxx defines. For volumes
* that only support zVOL_PSTATE_CREATED
* the common layer handles. This is done
* by setting state during VOL_BstNew()
* to zVOL_PSTATE_CREATED
*/
Time_t decompFreeSpaceWarningTime; /* The time we issued last warning
* message that compressed file
* can't be converted to
* uncompressed status permanently
* due to insufficient resource
*/
FileHandleIDP_s UXactionLogFileHandleIDP; /* file handle for
* xaction logfile*/
UserXactionLogMetaData_s UXMetaData; /* Meta-data for user
* transaction log file */
DQhead_t HomeTimeOrderList; /* Homed transaction list */
NINT readAheadBlocks; /* how many blocks to read
* ahead if lss supports
* this feature
*/
struct CsaVolumeInfo_s *v_csaVolInfo; /* Contains keys that
* reference active slave
* volumes
*/
struct CroVolumeDoor_s *v_croVolDoor; /* This is a Cluster
* Read Only volume, and
* has reference to a
* Master Volume.
*/
unicode_t *v_volumeName; /* Name of volume protected by NSS
* Spin Lock. This makes the function
* COMN_VolumeNameLookup much faster.
*/
VolumeKey_s v_key; /* structure for encryption data if it is present */
};
#define CSA_SLAVE_VOLUMES_FOUND(_volume) ((_volume)->v_csaVolInfo != NULL)
#define CRO_HAS_MASTER_VOLUME(_volume) ((_volume)->v_croVolObj != NULL)
/* Definitions for statusFlag (VOL_SF_xxx flags) */
#define VOL_SF_DISABLE_THREAD_SCHEDULED 0x00000001
#define VOL_SF_ALERT_THREAD_SCHEDULED 0x00000002
#define VOL_SF_PURGE_ALL_THREAD_SCHEDULED 0x00000004
#define VOL_SF_LEAVING_ACTIVE_STATE_CLEANUP 0x00000008
#define VOL_SF_USER_SPACE_REST_SCHEDULED 0x00000010
#define VOL_SF_INTERNAL_VOLUME 0x00000020 /* This is a internal
* hidden volume. Lookup of this volume
* will fail unless the genMsg has the
* bit GM_FLAGS_INTERNAL_VOLUME set. ZLSS
* uses to hide the Pool's internal volume.
* ZLSS also uses to hide volumes that are
* being deleted/purged.
*/
#define VOL_SF_LOGICAL_VOLUME 0x00000040 /* This is a logical
* volume. The common layer uses in several
* places where the fact that a pool owns
* the volume is important. For example,
* the Change Volume State code will fail
* specific requests if the volume's pool
* is not im an acceptable pool state.
*/
#define VOL_SF_LEAVING_DEACTIVE_STATE_CLEANUP 0x0000080 /* Indicates that
* a volume is leaving the DEACTIVE state.
* There is NO implied destination state.
* I.E. we could be going to ACTIVE,
* UNKNOWN or MAINTENANCE. This bit
* is NOT set when going to DEACTIVE
* because the volume is already in that
* state.
*/
#define VOL_SF_UNLOADING 0x00000100 /* Indicates that
* the volume/pool is being unloaded.
* CVS/CPS use to prevent ALL requests
* that do not lower the volume/pool's
* STATE.
*/
#define VOL_SF_OBJECT_ID_SCAN_SCHEDULED 0x00000200 /* Indicates that the
* volume is currently initializing the
* object ID data.
*/
#define VOL_SF_CLEAN_VIS_SCHEDULED 0x00000400 /* Indicated that the
* visibility is being rebuilt for the
* volume.
*/
#define VOL_SF_CLEAN_VIS_REBUILD 0x00000800 /* Indicates that we
* are in the rebuild pass of the visibility
* rebuild for the volume.
*/
#define VOL_SF_CHECK_EDIR_TREE 0x00001000 /* Indicates that we
* need to check to see if the directory
* tree changed.
*/
#define VOL_SF_RECONNECT 0x00002000 /* Indicates the volume
* is being activated, and we are in the
* reconnect stages. Slave volumes can
* attempt to reconnect, while this
* bit is set. After the bit is cleared
* slaves can connect to this volume only
* if they are newly activated (in sync)
*/
#define VOL_SF_KEYPRESENT 0x00004000 /* indicates a key is
* present and usable in the structure
*/
#define VOL_SF_KEY_INFO_TO_WRITE 0x00008000 /* indicates that the
* data in the PersistentZfsVolumeCrypt_s needs
* to be written */
/* The VOL_ACCESSIBLE macros are used to determine if a
* volume is accessible. Internal volumes are not accessible
* unless the caller has set a specical bit in the genMsg. This
* can be done with the Macro COMN_INCLUDE_INTERNAL_VOLUMES(GeneralMsg_s *)
*/
/* Returns TRUE if caller has access to internal volume OR if not a internal volume */
#define VOL_ACCESSIBLE2(_vol, _genMsg ) \
(VOL_ACCESSIBLE1(_vol) || ((_genMsg)->flags & GM_FLAGS_INTERNAL_VOLUME))
/* Returns TRUE if not a internal volume */
#define VOL_ACCESSIBLE1(_vol) \
(!(_vol->VOLv_statusFlag & VOL_SF_INTERNAL_VOLUME))
/* For common layer APIs to work on INTERNAL VOLUMEs the following
* macro must be used to set up the genMsg correctly. The EXCLUDE
* macro can be used to turn off this feature.
*/
#define COMN_INCLUDE_INTERNAL_VOLUMES( _genMsg ) \
((_genMsg)->flags |= GM_FLAGS_INTERNAL_VOLUME)
#define COMN_EXCLUDE_INTERNAL_VOLUMES( _genMsg ) \
((_genMsg)->flags &= ~GM_FLAGS_INTERNAL_VOLUME)
/* Definitions for v_ioFlag */
#define VOL_IOF_DISABLE 0x0004 /* The COMN LAYER sets when someone wishes
* to disable the volume because
* of a critical error. This bit will
* be reset by the COMN LAYER when the
* volume has reached the DEACTIVE state.
*/
#define VOL_IOF_READ_ONLY 0x0008 /* The volume is logically set
* to Read Only. The LSS must
* not do any more writes. The
* common layer will not request
* write requests. !!!Not currently
* supported!!!
*/
/* Definitions for maintenanceStatus */
//g#define VOLMAINTSTATUS_SCHEDULED 0x01
#define VOLMAINTSTATUS_CHECKING 0x02
#define VOLMAINTSTATUS_REPAIRING 0x04
//g#define VOLMAINTSTATUS_TERMINATED 0x08
/* This next item is used because ONLY one of the above 4 bits can
* be on at a time. It is required that the repair/checking bits
* are only on when repair or checking is ocurring.
*/
#define VOLMAINTSTATUS_STATE (VOLMAINTSTATUS_CHECKING|VOLMAINTSTATUS_REPAIRING)
//g#define VOLMAINTSTATUS_STATE (VOLMAINTSTATUS_SCHEDULED|VOLMAINTSTATUS_CHECKING|VOLMAINTSTATUS_REPAIRING|VOLMAINTSTATUS_TERMINATED)
//#define VOLMAINTSTATUS_COMPLETED 0X10
#define VOLMAINTSTATUS_CAN_RUN_ACTIVE 0x20
#define VOLroot avfile.file.auth.named.root
#define VOLnamed avfile.file.auth.named
#define VOLauth avfile.file.auth
#define VOLfile avfile.file
#define VOLavfile avfile
#define VOLzid VOLroot.zid
#define VOLbeastLatch VOLroot.mycache.agent.latch
#define VOLstorage VOLroot.storage
#define VOLbeastClass VOLroot.beastClass
#define VOLcomnBeastOps VOLbeastClass->comnOps
#define VOLcomnVolOps VOLbeastClass->comnVolOps
#define VOLattributes VOLnamed.p.attributes
#define VOLfirstParentZid VOLnamed.firstParent.p.zid
#define VOLfirstParentNameUniquifier VOLnamed.firstParent.p.nameUniquifier
#define VOLmayIDoThis VOLauth.mayIDoThis
#define VOLzidInProcess zidInProcess
#define VOLstorageIndex storageIndex
#define VOLstate state
#define VOLfreeBlockAdjustment freeBlockAdjustment
#define VOLstorageAlertHasBeenSent storageAlertHasBeenSent
#define VOLnextTimeToCheck nextTimeToCheck
#define VOLvolumeID volumeID
#define VOLpState v_pState
#define VOLv_statusFlag v_statusFlag
#define VOLv_keepActiveUseCount v_keepActiveUseCount
#define VOLv_keepDeactiveUseCount v_keepDeactiveUseCount
#define VOLsupportedAttributes supportedAttributes
#define VOLmaximumFileSize maximumFileSize
#define VOLoldVolAttributes p.oldVolAttributes
#define VOLenabledAttributes p.enabledAttributes
#define VOLbeastVersionMask p.beastVersionMask
#define VOLnameSpaceMask p.nameSpaceMask
#define VOLbeastVersion p.beastVersion
#define VOLblockSize p.blockSize
#define VOLblockShift p.blockShift
#define VOLauthModelID p.authModelID
#define VOLminKeepSeconds p.minKeepSeconds
#define VOLmaxKeepSeconds p.maxKeepSeconds
#define VOLlowWaterMark p.lowWaterMark
#define VOLhighWaterMark p.highWaterMark
#define VOLndsObjectID p.ndsObjectID
#define VOLcompAttributes p.compAttributes
//#define VOLalarmThreshold p.alarmThreshold
//#define VOLresetThreshold p.resetThreshold
#define VOLmediaFormatMajor p.PV_mediaFormatMajor
#define VOLmediaFormatMinor p.PV_mediaFormatMinor
#define VOLmediaFormatMajorCreate p.PV_mediaFormatMajorCreate
#define VOLmediaFormatMinorCreate p.PV_mediaFormatMinorCreate
#define VOLcreateTimeUTC p.PV_createTimeUTC;
#define VOLverifyTimeUTC p.PV_verifyTimeUTC;
#define VOLrebuildTimeUTC p.PV_rebuildTimeUTC;
#define VOLactivationTimeUTC p.PV_activationTimeUTC;
#define VOLshredCount p.PV_shredCount;
#define VOLtotalBlocks logged.totalBlocks
#define VOLinUseBlocks logged.inUseBlocks
#define VOLnumFiles logged.numFiles
#define VOLnumObjects logged.numObjects
#define VOLnextZid logged.nextZid
#define VOLrenameSeqNum logged.renameSeqNum
#define VOLpurgeableBlocks logged.purgeableBlocks
#define VOLnonPurgeableBlocks logged.nonPurgeableBlocks
#define VOLnumDeletedFiles logged.numDeletedFiles
#define VOLnumCompressedFiles logged.numCompressedFiles
#define VOLnumCompDelFiles logged.numCompDelFiles
#define VOLnumUncompressibleFiles logged.numUncompressibleFiles
#define VOLnumCompressedFileBlocks logged.numCompressedFileBlocks
#define VOLnumPreCompressedFileBlocks logged.numPreCompressedFileBlocks
#define VOLepoch logged.epoch
#define CVA_SYSTEM_DATA 0x00000001 /* Else USER data */
#define CVA_VOLUME_DISABLE 0x00000002 /* Else do not disable volume */
#define CVA_POOL_DISABLE 0x00000004 /* Else do not disable pool */
#define CVA_NON_IO 0x00000008 /* Else I/O related. Used
* to send a I/O Error alert
* or an non-I/O alert.
*/
#define CVA_VOLUME_ALERT 0x00000010 /* Else No volume ALERT */
#define CVA_POOL_ALERT 0x00000020 /* Else No pool ALERT */
#define CVA_REZID_NEEDED 0x00000040 /* We are out of zids in
* the 32-bit range, so
* volume needs to be
* re-zid.
*/
#define CVA_CLUSTER_RO_ERROR 0x00000080 /* The slave volume has
* trouble communicating with
* its master
*/
/*
* This is the structure used to do ALERTs on a specific volume. The
* routine COMN_VolumeAlert() allocates and fills in. Then the Volume's
* alert thread will generate the needed alerts.
*/
typedef struct NSSVolumeAlert_s
{
Zid_t nva_volumeZID; /* Defined and filled in just in case
* we decide to make the volume alert
* code global and therefore will need
* to know the volume's ZID. Currently,
* we use the Volume_s pointer.
*/
Zid_t nva_beastZID; /* ZID of beast that was directly effected
* by the ALERT.
*/
Blknum_t nva_fileBlock; /* File block */
Blknum_t nva_volumeBlock; /* Volume block */
DQlink_t nva_alertList; /* Used to keep track of all Alerts
* on a given volume.
*/
STATUS nva_status; /* Standard error status */
char *nva_statusSetter; /* Standard error status setter */
LONG nva_station; /* Station that ALERT should be given to.
* Does not need to be filled in if
* NVA_FLAG_UNKNOWN_STATION is set.
*/
NINT nva_flags; /* Flags
* - Note that current
* NVA_FLAG_UNKNOWN_STATION is always
* set because the CACHEING system
* does not track station.
*/
} NSSVolumeAlert_s;
/* nva_flags defines */
#define NVA_FLAG_UNKNOWN_STATION 0x80000000L
extern BOOL COMN_CheckQuotas;
/*---------------------------------------------------------------------------
* Volumes APIs
*---------------------------------------------------------------------------*/
extern STATUS VOL_AddVolumeToSystem(
struct GeneralMsg_s *genMsg,
void *volume,
unicode_t *name);
extern STATUS VOL_Rename(
struct GeneralMsg_s *genMsg,
Volume_s *volume,
unicode_t *name,
unicode_t *nameNew);
extern void VOL_RemoveVolumeFromSystem(
void *volume);
extern void VOL_VolumeSignalHandler(
struct Agent_s *agent);
extern STATUS VOL_FlushAndTossVolume(
GeneralMsg_s *genMsg,
void *volume);
extern STATUS VOL_TossVolume(
GeneralMsg_s *genMsg,
int volume);
extern void VOL_SendDeactivateEventToSAgents(
void *volume);
extern STATUS VOL_FlushVolume(
struct GeneralMsg_s *genMsg,
void *volume);
extern STATUS VOL_Activate(
GeneralMsg_s *genMsg,
Volume_s *vol,
NINT mode );
extern STATUS VOL_Deactivate(
GeneralMsg_s *genMsg,
Volume_s *vol,
NINT mode );
extern STATUS VOL_VolumeMaintenance(
GeneralMsg_s *genMsg,
Volume_s *volume,
NINT maintenanceCommand,
NINT maintenanceFlags);
extern STATUS VOL_DoFlushSystemBeasts(
GeneralMsg_s *genMsg,
Volume_s *vol,
BOOL deactivating); /* if TRUE we are deactivating the pool, else flushing*/
extern void *VOL_BstNew(
GeneralMsg_s *genMsg,
NINT beastClassID,
void *voidOwnerVol,
unicode_t *volumeName,
VolumeID_t *volumeID,
NINT lssID);
/* These are the value of the persistent state of a volume. Do not
* confuss with the non-persistent STATEs of ACTIVE, DEACTIVE and etc.
*/
#define zVOL_PSTATE_UNKNOWN 0 /* Volume persistent state is unknown */
#define zVOL_PSTATE_CREATION 1 /* Volume is being created */
#define zVOL_PSTATE_CREATED 2 /* Volume is created (this is the normal
* persistent state of a LV)
*/
#define zVOL_PSTATE_DELETION 3 /* Volume is being deleted */
extern void *VOL_BstNew2(
GeneralMsg_s *genMsg,
NINT beastClassID,
void *voidOwnerVol,
unicode_t *volumeName,
VolumeID_t *volumeID,
NINT lssID,
NINT authModelID,
LONG persistentState );
extern void VOL_DisplayVolumes(void);
extern void VOL_DisplaySpaceInfo(void);
extern void formattedSize(
QUAD bytes,
LONG *size,
LONG *sized,
BYTE **byteval);
void POOL_DisplayPools(void);
STATUS POOL_FlushPool(
struct GeneralMsg_s *genMsg,
struct Pool_s *pool);
STATUS POOL_Rename(
GeneralMsg_s *genMsg,
unicode_t *oldPoolName,
unicode_t *newPoolName);
void *POOL_BstNew(
GeneralMsg_s *genMsg,
NINT beastClassID,
void *voidOwnerPool,
unicode_t *poolName,
VolumeID_t *poolID,
NINT lssID );
extern void COMN_CheckLowSpace(
Volume_s *volume,
Blkcnt_t numFreeBlocks);
STATUS VOL_DisableVolume(
struct GeneralMsg_s *genMsg,
struct Volume_s *volume );
STATUS POOL_DisablePool(
struct GeneralMsg_s *genMsg,
struct Pool_s *pool );
extern BOOL NW_PurgeImmediateFlag;
extern void VOL_PurgeImmediateFlagSet(void);
#endif
STATUS LB_PoolNameAcceptable( unicode_t *volumeName );
STATUS LB_VolumeNameAcceptable( unicode_t *volumeName );
STATUS LB_VolumeNameAcceptableWithFlag( unicode_t *volumeName, BOOL flag );
NINT LB_VolumeFindMMVolume( unicode_t *volumeName );
#define LB_VOLUME_NOT_FOUND 0
#define LB_VOLUME_NOT_MOUNTED 1
#define LB_VOLUME_MOUNTED 2
STATUS LB_VolumeNameValid( unicode_t *volumeName );
STATUS LB_VolumeRenameOK( unicode_t *volumeName );
STATUS LB_VolumeNameToPoolName(
CONST unicode_t *volName, /* Current pool name */
NINT *mangleKey, /* (input/output)Mangle key pointer, must point to 0 on first call */
NINT uniSize, /* Number of unicode poolName can hold */
unicode_t *poolName ); /* (output)New mangled name */
STATUS LB_VolumeNameToAutoRenameName(
CONST unicode_t *volName, /* Current volume name */
NINT *mangleKey, /* (input/output)Mangle key pointer, must point to 0 on first call */
NINT uniSize, /* Number of unicode newName can hold */
unicode_t *newName ); /* (output)New mangled name */
STATUS LB_VolumeNameToSnapshotName(
CONST unicode_t *volName, /* Current volume name */
NINT *mangleKey, /* (input/output)Mangle key pointer, must point to 0 on first call */
NINT uniSize, /* Number of unicode snapName can hold */
unicode_t *snapName ); /* (output)New mangled name */
STATUS LB_VolumeNameToQSName(
CONST unicode_t *volName, /* Current volume name */
NINT *mangleKey, /* (input/output)Mangle key pointer, must point to 0 on first call */
NINT uniSize, /* Number of unicode newName can hold */
unicode_t *newName ); /* (output)New mangled name */
#if zNETWARE || (zLINUX && (defined(__KERNEL__) || defined(MARS_NWE_NWNSS_USERSPACE)))
extern void VOL_ChangeVolumeExtendedMacByName(
GeneralMsg_s *genMsg,
unicode_t *name,
BOOL salvageOn);
extern STATUS VOL_ChangeSingleVolumeSalvageByName(
GeneralMsg_s *genMsg,
unicode_t *name,
BOOL salvageOn);
extern void VOL_ChangeVolumeSalvageByName(
GeneralMsg_s *genMsg,
unicode_t *name,
BOOL salvageOn);
extern void VOL_ChangeVolumeHardlinksByName(
GeneralMsg_s *genMsg,
unicode_t *name,
BOOL LinksOn);
extern void VOL_ChangeVolumeTransactionByName(
GeneralMsg_s *genMsg,
unicode_t *name,
BOOL transactionOn);
extern void VOL_ChangeVolumeMigrationByName(
GeneralMsg_s *genMsg,
unicode_t *name,
BOOL migrationOn);
extern NINT NW_MinimumFileDeleteWaitTime;
extern STATUS VOL_ChangeSalvageMinKeepSeconds(
GeneralMsg_s *genMsg,
NINT minKeepSeconds);
extern STATUS VOL_GetUserSpaceInfo(
GeneralMsg_s *genMsg,
Volume_s *volume,
UserID_t *userID,
SQUAD *usedAmount,
SQUAD *restrictionAmount);
extern STATUS VOL_BrowseUsersInVolume(
GeneralMsg_s *genMsg,
Volume_s *volume,
NINT numEntriesRequested,
UserID_t *lastUserReturned,
COMNUserRest_s *userEntries,
NINT *numEntriesReturned,
LONG allUsersFlag);
extern void VOL_AdjustUsedUserSpace(
Xaction_s *xaction,
RootBeast_s *beast,
SQUAD amountToAdjust);
extern STATUS VOL_CheckUserSpace(
GeneralMsg_s *genMsg,
RootBeast_s *beast,
SQUAD amount);
extern STATUS VOL_SetUserSpaceRestriction(
GeneralMsg_s *genMsg,
Volume_s *volume,
UserID_t *userID,
SQUAD restrictionAmount);
extern void VOL_ChangeVolumeUserSpaceRestrictionsByName(
GeneralMsg_s *genMsg,
unicode_t *name,
BOOL enableRestrictions);
extern STATUS VOL_ChangeVolumeCompressionByName(
GeneralMsg_s *genMsg,
unicode_t *name,
BOOL compressionOn);
extern void VOL_ChangeVolumeATimeByName(
GeneralMsg_s *genMsg,
unicode_t *name,
BOOL turnATimeOff);
extern STATUS VOL_ChangeVolumeMFLByName(
GeneralMsg_s *genMsg,
unicode_t *name,
BOOL mflOn);
extern STATUS VOL_administerMFLByName(
GeneralMsg_s *genMsg,
unicode_t *name,
NINT opCode);
extern STATUS VOL_insertEFLEntry(
GeneralMsg_s *genMsg,
RootBeast_s *beast,
NINT action,
unicode_t *name,
Xaction_s *xaction);
extern STATUS VOL_DisableUserSpaceRestrictions(
GeneralMsg_s *genMsg,
Volume_s *vol);
extern STATUS VOL_ChangeUserSpaceAttribute(
GeneralMsg_s *genMsg,
Volume_s *vol,
BOOL enableRestrictions);
extern STATUS VOL_ChangeVolumeDataShredByName(
GeneralMsg_s *genMsg,
unicode_t *name,
BOOL enableShredding);
//extern STATUS VOL_ChangePoolSharedByName(
// GeneralMsg_s *genMsg,
// unicode_t *name,
// BOOL enableShared);
extern STATUS VOL_ChangeVolumeHighIntegrityByName(
GeneralMsg_s *genMsg,
unicode_t *name,
BOOL enableHighIntegrity);
extern STATUS VOL_ChangeVolumeCFSMasterByName(
GeneralMsg_s *genMsg,
unicode_t *name,
BOOL enableCFSMasterommunal);
extern STATUS VOL_ChangeVolumeCOWByName(
GeneralMsg_s *genMsg,
unicode_t *name,
BOOL cowOn);
extern STATUS VOL_ChangeVolumeReadAheadByName(
GeneralMsg_s *genMsg,
unicode_t *name);
extern STATUS VOL_InitUserSpaceRestrictionData(
GeneralMsg_s *genMsg,
Volume_s *vol);
extern void VOL_UpgradeBeastsOnVolumeByName(
GeneralMsg_s *genMsg,
unicode_t *name);
extern STATUS VOL_UpgradeBeastsOnVolume(
GeneralMsg_s *genMsg,
Volume_s *vol,
unicode_t *name,
STATUS (*callBack)(NINT proessedCount, NINT updatedCount),
NINT *processedCount,
NINT *upgradedCount);
/*---------------------------------------------------------------------------
* Internal Volumes APIs
*---------------------------------------------------------------------------*/
void vol_AlertWorkToDoRoutine(
struct FsmLite_s *workToDoFsm );
void vol_DisableWorkToDoRoutine(
#if VOL_DISABLE_USE_SYSTEMS_WORK_TO_DO
struct zWorkProc_s *work);
#else
struct FsmLite_s *workToDoFsm );
#endif
STATUS comn_VolumeAlert(
GeneralMsg_s *genMsg,
RootBeast_s *beast,
Volume_s *volume,
Buffer_s *buffer,
Blknum_t fileBlock,
Blknum_t volumeBlock,
STATUS iStatus,
char *iStatusSetter,
LONG flags );
/*
* Structure used to track 'owners' of a pool. Ownership is only
* valid when the pool is in MAINTENANCE state. See zPoolOwnershipGet()
* and zPoolOwnershipRelease() for more information.
*/
typedef struct PoolOwnership_s {
LONG PO_signature;
#define PO_SIGNATURE 0x48494352
struct Pool_s *PO_pool;
char PO_who[128-4*3];
} PoolOwnership_s;
typedef struct PersistentPool_s
{
/**
* This is the persistent area of the pool.
*/
LONG PP_blockSize; /* size of a block on this pool */
LONG PP_blockShift; /* size of a block on this pool */
LONG PP_rebuildCount; /* Number of times the pool has been
* rebuilt.
*/
LONG PP_reserved0;
BYTE PP_mac[32]; /* Mandatory Access Control Area*/
LONG PP_minKeepSeconds; /* Salvage: Min number of seconds before auto purge */
LONG PP_maxKeepSeconds; /* Salvage: Max number of seconds before auto purge */
BYTE PP_lowWaterMark; /* Salvage: Start auto purging when % free space goes below this */
BYTE PP_highWaterMark; /* Salvage: Stop auto purging when % free space goes above this */
WORD PP_reserved2;
LONG PP_stateAttributes; /* Attributes that apply to the pool's
* current pool state.
*/
QUAD PP_freeToUse; /* Will be zero on all pools. Was the NDS
* object ID when we had it a QUAD. We never
* used so will be zero on all volumes.
*/
QUAD PP_enabledFeatures; /* This bit mask contains a bit for each
* feature which is enabled on the pool */
LONG PP_mediaFormatMajor;/* Zero indicates that minor has special
* meaning.
*/
LONG PP_mediaFormatMinor; /* If major is zero then
0 - media format not supported
1 - media format not known yet.
*/
NDSid_t PP_ndsObjectID; /* NDS's object ID for this pool. */
LONG PP_reserved[64-22-4]; /* QUAD align and future growth of data */
/* The above data is 256 bytes in length */
/*
* End of the persistent area of the pool.
**/
} NSS_MEDIA_STRUCTURE(PersistentPool_s,PP_reserved[64-22-4]) PersistentPool_s;
typedef struct LoggedPersistentPool_s
{
/**
* This is the persistent area of the pool.
*/
// LONG LPP_reserved0; /*stateAttributes; Attributes that apply to the pool's current volume state. */
// LONG LPP_blockSize; /* size of a block on this pool */
// QUAD LPP_numFiles; /* how many files are on the pool */
// QUAD LPP_numObjects; /* how many objects are on the pool */
QUAD LPP_totalBlocks; /* total number of blocks in pool */
QUAD LPP_inUseBlocks; /* number of blocks used in this pool */
QUAD LPP_purgeableBlocks; /* number of purgeable blocks in the salvage system */
QUAD LPP_nonPurgeableBlocks; /* number of non-purgeable blocks in the salvage system */
// QUAD LPP_numDeletedFiles; /* number of deleted files on the pool */
// QUAD LPP_numLogicalVolumes; /* Number of logical volumes in pool. Shoud we track????? */
// LONG LPP_renameSeqNum; /* Sequence number to prevent wildcard rename recursion*/
LONG LPP_reserved[64-8]; /* QUAD align and future growth of LOGGED data */
/* The above data is 256 bytes in length */
/*
* End of the logged persistent area of the pool.
**/
} NSS_MEDIA_STRUCTURE(LoggedPersistentPool_s,LPP_reserved[64-8]) LoggedPersistentPool_s;
// FixFixFix - this belongs in NSS somewhere
typedef struct Pool_s
{
AdminVolFile_s avfile; /* derived from a file*/
PersistentPool_s p; /* holds persistent pool information*/
LoggedPersistentPool_s logged; /* contains persistent information that is logged*/
QUAD supportedFeatures; /* Features this pool is capable of supporting */
// QUAD maximumFileSize; /* Maximum size for any file on this volume */
NINT storageIndex; /* index for storage system specific routines */
// NINT authModelIndex; /* index into the Auth model ID map*/
// struct AuthModelBeast_s *authModel; /* authModel for volume*/
// File_s *rootdir; /* pointer to root dir*/
VolumeID_t volumeID; /* unique volume ID (guid)*/
SETlink_t masterPoolLink; /* link for all pools in the system */
// DQhead_t beastList; /* list of all memory resident beasts on this volume*/
NINT state; /* current state of pool
*
* See COMN_ChangeVolumeState for a detailed
* description of the STATEs.
*
* The state is protected by two latches
*
* 1) cvsLatch - must be owned to change
* the value of the state.
* 2) stateLatch - must be owned to access
* the value of the state.
*
* Note that both latches are required to
* change the state. The cvsLatch must be
* obtained first. The only code that
* should change the state is the
* COMN_ChangeVolumeState function.
*
* The stateLatch is required for read
* access of the state because the state
* is not VALID when the state is changing.
*
* Two latches are used for changing the
* state so that certain things (like
* prompting the user becuase of open
* files) can be done without owning the
* stateLatch. This allows callers who
* just neeed to view the state to latch
* stateLatch and be assurred that they
* will not block for a LONG time.
*
* FixFixFix6 - There is code that does
* not obtain the stateLatch when checking
* the state. Note that the Volume's in
* use count only ensures that the beast
* will not be tossed it ensures NOTHING
* about the volume's state.
*/
// NINT maxBeastSize; /* the largest allowable beast for this volume -- filled in by the storage system volume constructor*/
Agent_s agent; /* used to create bonds*/
Latch_s cvsLatch; /* Changes Volume State Latch. Serializes
* the changing of the volume state.
*/
Latch_s stateLatch; /* Latch for when we are changing the
* volumes state. This is slightly less
* restrictive than the cvsLatch in that
* the stateLatch does not include the
* state event and any prompting of the
* admin because of open files ...
*/
Latch_s rsrcLatch; /* This is a latch to ensure resources
* are allocated in the order requested
* during creates
*/
NINT maintenanceStatus; /* current maintenance status */
Time_t maintenanceTime; /* time current maintenance mode started */
NINT freeBlockAdjustment;/* number of blocks the free blocks needs to be adjusted by -- filled in by the storage system volume constructor */
// BOOL storageAlertHasBeenSent;/* set when an alert has been sent -- reset when enough space has been freed */
NINT nextTimeToCheck; /* the next time to check to see if the disk is still full */
NINT v_statusFlag; /* Bitmask to be used by anyone needing
* non-persistent state information. Bits
* definitions start with VOL_SF_xxx.
*/
NINT v_keepActiveUseCount;
/* Count of how many current APIs and/or
* asynchronous threads are currently
* running on this volume. We need to set
* the VOL_SF_LEAVING_ACTIVE_STATE_CLEANUP
* bit in v_statusFlag and then wait for
* this count to go to zero before removing
* a volume from the active state.
*/
NINT v_ioFlag;
/* Internal Flags used to give IO specific
* information to the LSS.
*/
STATUS v_disableVolumeStatus;
/* STATUS for LSS to return when asked
* to write when in stopWrite mode.
*/
LONG v_alertUTCOfLNextUserWriteAlert;
/* UTC of next user write
* error ALERT sent. Used because we
* do not have the STATION of the
* user who should get the ALERT. This
* is the time at which another ALERT can
* be sent.
*/
#if VOL_DISABLE_USE_SYSTEMS_WORK_TO_DO
zWorkProc_s v_disableWorkToDoStructure;
/* Protected by disable schedule bit in v_statusFlag.
* WorkToDo for NSS Library schedule API - ScheduleWork().
*/
#else
FsmLite_s v_disableWorkToDoFsm;
/* Protected by disable schedule bit in v_statusFlag.
* Lite FSM to pass to WORK_Schedule().
*/
#endif
/* LONG v_activationCount; */ /* Number of times this volume has been
* activated. This field MUST be
* acccurate on volumes that support
* the ZAS auth model. This field should
* be accurate on all writable media.
* The Volume_s constructor will init
* to 0. This field would have been placed
* in the persistent area, but we
* did not wish to do a media change.
*/
NINT v_alertListCount;
/* Number of alerts that are queued. Used
* to limit maximum count to 40. This is
* done to limit resource usage.
*/
DQhead_t v_alertList;
/* List of all ALERTs that are queued
* for the ALERT work-to-do to
* perform. The work-to-do is for
* this pool only. Protected by
* NSS_LOCK();
*/
FsmLite_s v_alertWorkToDoFsm;
/* Protected by alert schedule bit in v_statusFlag.
* Lite FSM to pass to WORK_Schedule().
*/
DQhead_t P_VolumeList; /* List of all memory resident volumes on
* this pool. The pool's cvsLatch must be
* owned when this list is accessed. We
* do NOT use the stateLatch because one
* of the main reasons to access list is
* in the middle of a POOL change state
* when we have to also change the state
* of all the pool's LVs. In this cause
* we can not own the stateLatch of the
* pool.
*/
Volume_s *P_VolumeInternal; /* Vandana and Greg added in Nakoma so
* that we could flush a complete pool
* from the common layer. This field
* can be zero if the LSS does not support
* Pools via a internal volume. The LSS
* must fill in after in news the pool.
*/
Latch_s P_FreezeThawLatch; /* This is the latch to serialize zPoolFreeze/
* zPoolThaw calls on a pool. We do this because
* the specification tells the freeze/thaw
* NEB consumer that only one freeze per pool
* can be outstanding at a time.
*/
void *P_FreezeThawKey; /* This the the key to access the freeze/thaw
* structure. This field will be used by
* zPoolThawByName().
*/
Latch_s P_MaintenaceLatch; /* This is the latch to serialize I/O to a pool
* in MAINTENANCE state. If a NLM/Code wishes
* to do I/O when the Pool is in MAINTENANCE state
* then it is requiresd to call zPoolOwnership...
* APIs.
*/
PoolOwnership_s *P_Owner; /* Who owns the pool. Used by code that does
* maintenance on the pool. This includes 3rd
* party vendors.
*/
struct inode *P_Inode; /* The inode that is used to hold the mappings
* to our high Linux memory pages. See cache.c.
*/
DQhead_t P_MDHimemList; /* Head of all meta-data himem we are using for
this pool. Used to toss pages on 'deactivate'.
*/
} Pool_s;
#define POOLroot avfile.file.auth.named.root
#define POOLnamed avfile.file.auth.named
#define POOLauth avfile.file.auth
#define POOLfile avfile.file
#define POOLavfile avfile
#define POOLbeastLatch POOLroot.mycache.agent.latch
#define POOLstate state
#define POOLvolumeID volumeID
#define POOLsupportedFeatures supportedFeatures
#define POOLfreeBlockAdjustment freeBlockAdjustment
#define POOLbeastClass POOLroot.beastClass
#define POOLcomnBeastOps POOLbeastClass->comnOps
#define POOLcomnVolOps POOLbeastClass->comnVolOps
#define POOLfirstParentZid POOLnamed.firstParent.p.zid
#define POOLfirstParentNameUniquifier POOLnamed.firstParent.p.nameUniquifier
#define POOLblockSize p.PP_blockSize
#define POOLblockShift p.PP_blockShift
#define POOLrebuildCount p.PP_rebuildCount
#define POOLminKeepSeconds p.PP_minKeepSeconds
#define POOLmaxKeepSeconds p.PP_maxKeepSeconds
#define POOLlowWaterMark p.PP_lowWaterMark
#define POOLhighWaterMark p.PP_highWaterMark
#define POOLreserved2 p.PP_reserved2
#define POOLstateAttributes p.PP_stateAttributes
#define POOLndsObjectID p.PP_ndsObjectID
#define POOLenabledFeatures p.PP_enabledFeatures
#define POOLmediaFormatMajor p.PP_mediaFormatMajor
#define POOLmediaFormatMinor p.PP_mediaFormatMinor
#define POOLattributes POOLavfile.AVFILEattributes
#define POOLnameSpaceMask POOLavfile.AVFILEnameSpaceMask
//#define POOLnumFiles logged.LPP_numFiles
//#define POOLnumObjects logged.LPP_numObjects
#define POOLtotalBlocks logged.LPP_totalBlocks
#define POOLinUseBlocks logged.LPP_inUseBlocks
#define POOLpurgeableBlocks logged.LPP_purgeableBlocks
#define POOLnonPurgeableBlocks logged.LPP_nonPurgeableBlocks
//#define POOLnumDeletedFiles logged.LPP_numDeletedFiles
//#define POOLnumLogicalVolumes logged.LPP_numLogicalVolumes
#define POOLkeepActiveUseCount v_keepActiveUseCount
#define POOLstatusFlag v_statusFlag
/*
* Macro to look at each loaded Logical Volume that a pool owns. Caller
* must ensure that the pools cvsLatch is owned.
*/
#define POOL_FOR_EACH_LOADED_VOLUME( _pool, _lv ) \
ASSERT_XLATCH( &_pool->cvsLatch ); \
DQ_FOREACH( &(_pool)->P_VolumeList, _lv, Volume_s, v_poolVolLink )
/*
* Macro to look at each loaded Logical Volume that a pool owns. Caller
* must ensure that there is NO BLOCKING code in loop.
*/
#define POOL_FOR_EACH_LOADED_VOLUME_NO_BLOCKING( _pool, _lv ) \
DQ_FOREACH( &(_pool)->P_VolumeList, _lv, Volume_s, v_poolVolLink )
/*---------------------------------------------------------------------------
* Internal Pool APIs
*---------------------------------------------------------------------------*/
void pool_AlertWorkToDoRoutine(
struct FsmLite_s *workToDoFsm );
void pool_DisableWorkToDoRoutine(
#if VOL_DISABLE_USE_SYSTEMS_WORK_TO_DO
struct zWorkProc_s *work);
#else
struct FsmLite_s *workToDoFsm );
#endif
STATUS comn_PoolAlert(
GeneralMsg_s *genMsg,
RootBeast_s *beast,
Volume_s *volume,
Pool_s *pool,
Buffer_s *buffer,
Blknum_t fileBlock,
Blknum_t volumeBlock,
STATUS iStatus,
char *iStatusSetter,
LONG flags );
STATUS POOL_ChangePoolMSAPByName(
GeneralMsg_s *genMsg,
unicode_t *name,
BOOL localOn);
STATUS POOL_ChangePoolWaterMarksByName(
GeneralMsg_s *genMsg,
unicode_t *name,
BOOL highWaterFlag);
STATUS xPoolOwnershipRelease (
struct PoolOwnership_s *cookie,
char *who );
STATUS xPoolOwnershipGet(
unicode_t *poolName,
char *who,
struct PoolOwnership_s **cookie );
#endif
#ifdef __cplusplus
}
#endif
#endif