void gpfs_free_all_locks(int fd) { int rc; struct { gpfsFcntlHeader_t header; gpfsFreeRange_t release; } release_all; release_all.header.totalLength = sizeof(release_all); release_all.header.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; release_all.header.fcntlReserved = 0; release_all.release.structLen = sizeof(release_all.release); release_all.release.structType = GPFS_FREE_RANGE; release_all.release.start = 0; release_all.release.length = 0; rc = gpfs_fcntl(fd, &release_all); if (verbose >= VERBOSE_0 && rc != 0) { EWARN("gpfs_fcntl release all locks hint failed."); } }
static void gpfs_free_all_locks(int fd) { int rc; struct { gpfsFcntlHeader_t header; gpfsFreeRange_t release; } release_all; release_all.header.totalLength = sizeof(release_all); release_all.header.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; release_all.header.fcntlReserved = 0; release_all.release.structLen = sizeof(release_all.release); release_all.release.structType = GPFS_FREE_RANGE; release_all.release.start = 0; release_all.release.length = 0; rc = gpfs_fcntl(fd, &release_all); if (rc != 0) { DBGV_FPRINTF(stderr,"GPFS fcntl release failed with rc=%d, errno=%d\n", rc,errno); } }
void gpfs_access_start(int fd, IOR_offset_t length, IOR_param_t *param, int access) { int rc; struct { gpfsFcntlHeader_t header; gpfsAccessRange_t access; } take_locks; take_locks.header.totalLength = sizeof(take_locks); take_locks.header.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; take_locks.header.fcntlReserved = 0; take_locks.access.structLen = sizeof(take_locks.access); take_locks.access.structType = GPFS_ACCESS_RANGE; take_locks.access.start = param->offset; take_locks.access.length = length; take_locks.access.isWrite = (access == WRITE); rc = gpfs_fcntl(fd, &take_locks); if (verbose >= VERBOSE_2 && rc != 0) { EWARN("gpfs_fcntl access range hint failed."); } }
void gpfs_access_end(int fd, IOR_offset_t length, IOR_param_t *param, int access) { int rc; struct { gpfsFcntlHeader_t header; gpfsFreeRange_t free; } free_locks; free_locks.header.totalLength = sizeof(free_locks); free_locks.header.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; free_locks.header.fcntlReserved = 0; free_locks.free.structLen = sizeof(free_locks.free); free_locks.free.structType = GPFS_FREE_RANGE; free_locks.free.start = param->offset; free_locks.free.length = length; rc = gpfs_fcntl(fd, &free_locks); if (verbose >= VERBOSE_2 && rc != 0) { EWARN("gpfs_fcntl free range hint failed."); } }
static void * process_request(void *arg) { unsigned long long end_byte, bytes_written; struct thread_info *tinfo = (struct thread_info *) arg; /* Open a fileHandle to the file for this thread */ /* Declare a new range for the chunk and make GPFS aware of this */ //gpfsAccessRange_t *rinfo = (gpfsAccessRange_t *)malloc(sizeof(gpfsAccessRange_t)); /* Fill the range information */ //rinfo->length = tinfo->num_bytes; //rinfo->isWrite = 1; /* Write access */ gpfs_access_t *fileAccess = (gpfs_access_t *)malloc(sizeof(gpfs_access_t)); fileAccess.header.totalLength = sizeof(gpfsFileArg); fileAccess.header.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; fileAccess.header.fcntlReserved = 0; fileAccess.release.structLen = sizeof(gpfsFileArg.release); fileAccess.release.structType = GPFS_CLEAR_FILE_CACHE; fileAccess.access.structLen = sizeof(gpfsFileArg.access); fileAccess.access.structType = GPFS_ACCESS_RANGE; fileAccess.access.start = 2LL * 1024LL * 1024LL * 1024LL; fileAccess.access.length = 1024 * 1024 * 1024; fileAccess.access.isWrite = 1; /* Apply the range information */ if (gpfs_fcntl(fileHandle, &gpfsFileArg) != 0) { fprintf(stderr, "gpfs_fcntl free range failed for range %d:%d. errno=%d errorOffset=%d\n", start, length, errno, free_range.hdr.errorOffset); exit(EXIT_FAILURE); } end_byte = tinfo->start_byte + tinfo->num_bytes; fprintf(stdout, "tn: %d\tStart: %d\tEnd: %d\n", tinfo->thread_num, tinfo->start_byte, end_byte); // start timer // open the file at startBlock // zeroFill the file until startBlock + fillSize // stop timer // print stats //fprintf(stdout, "Thread %d wrote %d bytes in %d seconds (%d MB/sec)", zerofFillRequestProcess, , , ); /* Free the GPFS access range */ return (NULL); }