fence - Allows you to request and change the virtual shared disk fence map. The fence map controls whether virtual shared disks can send or satisfy requests from virtual shared disks at remote nodes.
#include <vsd_ioctl.h> int ioctl(FileDescriptor, Command, Argument) int FileDescriptor, Command; void *Argument;
The flags field of the vsd_fence_map structure determines the type of operation that is performed. The flags could be set with one or more options using the OR operator. These options are as follows:
The fence-map is an array with the following definition:
typedef struct unsigned int nvsds; /* number of elements in the vsd_Fence array */ ulong flags; /* specifies the type of request */ vsd_Fence_t *Map; /* array of vsd_Fence structures */ } vsd_FenceMap_t;
nvsds represents the number of elements in the vsd_Fence array. The flags specify the type of request. The map is an array of the following structure:
typedef struct { unsigned int vsd_minor; /* The bitmap is associated with this minor */ vsd_Fence_Bitmap node_FenceMap; /* Nodes status - fenced or unfenced */ vsd_Fence_Bitmap node_FenceMask; /* Determine how node_FenceMap is used */ } vsd_Fence_t;
The vsd_minor represents the virtual shared disk device's minor number. The node_FenceMap bitmap denotes which nodes are fenced (bit turned on) or unfenced (bit turned off) from the virtual shared disk. You could use the MAP_SET and MAP_CLR macros defined in vsd_ioctl.h to turn a given bit in the map on or off. The node_FenceMask is used to interpret the node_FenceMap bitmap, depending on the flags field.
You can submit a fence map that changes the current virtual shared disk map (maintained by the IBM Virtual Shared Disk subsystem) according to the flags set in the vsd_fence_map structure. The request is considered a delta to the current virtual shared disk map. You can also utilize this ioctl to query the current virtual shared disk map.
If the request succeeds, the ioctl returns 0. In the case of an error, a value of -1 is returned with the global variable errno set to identify the error.
The fence ioctl subroutine can return the following error codes:
The following is an example of how to fence a virtual shared disk with a minor number of 7 from node 4 and 5, and to unfence a virtual shared disk with a minor number of 5 from node 1:
int fd; vsd_FenceMap_t FenceMap; /* two VSDs to work with */ FenceMap.Map=(vsd_Fence *) malloc (2*sizeof(vsd_Fence)); FenceMap.nvsds = 2; /* Clear the Map and Mask*/ MAP_ZERO(FenceMap.Map[0].node_FenceMap); MAP_ZERO(FenceMap.Map[0].node_FenceMask); MAP_ZERO(FenceMap.Map[1].node_FenceMap); MAP_ZERO(FenceMap.Map[1].node_FenceMask); FenceMap.flags = VSD_FENCE_SET | VSD_FENCE_FORCE | VSD_FENCE_SWAP; /* fence nodes 4,5 from minor 7 */ FenceMap.Map[0].vsd_minor = 7; MAP_SET(4, FenceMap.Map[0]node_FenceMap); MAP_SET(4, FenceMap.Map[0].node_FenceMask); MAP_SET(5, FenceMap.Map[0].node_FenceMap); MAP_SET(5, FenceMap.Map[0].node_FenceMask) /* Unfence node 1 from minor 5*/ FenceMap.Map[1].vsd_minor = 5; MAP_SET(1, FenceMap.Map[1].node_FenceMask); /* Issue the fence request */ ioctl(fd,GIOCFENCE,&FenceMap);