openfam::fam::fam_resize_region
Resize an existing region in FAM
Synopsis
int fam_resize_region(Fam_Region_Descriptor *descriptor, uint64_t nbytes);
Description
This method resizes a region in FAM.
Input Arguments
Name | Description |
---|---|
Descriptor | Descriptor of the region to be resized. |
Nbytes | New requested size of the region. |
Return Values
Returns 0 on Success. Throws an exception on error.
Exceptions
Exception | Description |
---|---|
FAM_ERR_NOPERM | Caller does not have access rights |
FAM_ERR_NOTFOUND | the region name is not present in FAM |
FAM_ERR_GRPC | there is a communication error with memory server |
FAM_ERR_RPC_CLIENT_NOTFOUND | Memory server initialization failure |
Notes
Regions may safely be increased in size (subject to system-wide limits). Reducing the region size (although allowed) implies that any data items in the truncated part of the region will be lost. The behavior of the library if those items are accessed later is implementation dependent.
Example
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <fam/fam.h> #include <fam/fam_exception.h> using namespace std; using namespace openfam; int main(void) { fam *myFam = new fam(); // .. initialization code here try { // create a 10 GB region with 0777 permissions and RAID5 redundancy Fam_Region_Descriptor *rd = myFam->fam_create_region("myRegion", (uint64_t)10000000000, 0777, RAID5); // use the created region... printf("fam_create_region successful\n"); // resize the region to 20 GB myFam->fam_resize_region(rd, (uint64_t)20000000000); // use the re-sized region printf("fam_resize_region successful\n"); // ... continuation code here // we are finished. Destroy the region and everything in it myFam->fam_destroy_region(rd); printf("fam_destroy_region successful\n"); } catch (Fam_Allocator_Exception &e) { printf("Create/Destroy region failed: %d: %s\n", e.fam_error(), e.fam_error_msg()); } // ... finalization code here }