9 #define _XOPEN_SOURCE 700 17 #include <sys/types.h> 25 #include "sion_hints_gpfs.h" 27 #ifdef SION_HINTS_GPFS 28 #include <gpfs_fcntl.h> 42 int _sion_apply_hint_gpfs_access_range(
int fd,
long long start,
long long length,
int iswrite ) {
46 #ifdef SION_HINTS_GPFS 50 gpfsFcntlHeader_t hdr;
51 gpfsAccessRange_t acc;
55 DPRINTFP((2,
"_sion_apply_hint_gpfs_access_range", -1,
"start fd=%d start=%lld length=%lld\n",
59 #ifdef SION_HINTS_GPFS 60 DPRINTFP((2,
"_sion_apply_hint_gpfs_access_range", -1,
"do apply\n"));
63 accHint.hdr.totalLength =
sizeof(accHint);
64 accHint.hdr.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION;
65 accHint.hdr.fcntlReserved = 0;
66 accHint.acc.structLen =
sizeof(accHint.acc);
67 accHint.acc.structType = GPFS_ACCESS_RANGE;
68 accHint.acc.start = start;
69 accHint.acc.length = length;
70 accHint.acc.isWrite = iswrite;
71 grc = gpfs_fcntl(fd, &accHint);
73 return(_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN,
"cannot set GPFS hint (access) for file fd=%d start=%lld length=%lld ... rc=%d\n",
74 fd, start, length, rc));
76 DPRINTFP((2,
"_sion_apply_hint_gpfs_access_range", -1,
"apply done rc=%d\n",rc));
94 int _sion_apply_hint_gpfs_free_range(
int fd,
long long start,
long long length,
int iswrite ) {
98 #ifdef SION_HINTS_GPFS 102 gpfsFcntlHeader_t hdr;
103 gpfsFreeRange_t free;
107 DPRINTFP((2,
"_sion_apply_hint_gpfs_free_range", -1,
"start fd=%d start=%lld length=%lld\n",
111 #ifdef SION_HINTS_GPFS 112 DPRINTFP((2,
"_sion_apply_hint_gpfs_free_range", -1,
"do apply\n"));
115 freeHint.hdr.totalLength =
sizeof(freeHint);
116 freeHint.hdr.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION;
117 freeHint.hdr.fcntlReserved = 0;
118 freeHint.free.structLen =
sizeof(freeHint.free);
119 freeHint.free.structType = GPFS_FREE_RANGE;
120 freeHint.free.start = start;
121 freeHint.free.length = length;
122 grc = gpfs_fcntl(fd, &freeHint);
124 _sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN,
"cannot set GPFS hint (free) for file fd=%d start=%lld length=%lld ... rc=%d\n",
125 fd, start, length, rc);
128 DPRINTFP((2,
"_sion_apply_hint_gpfs_free_range", -1,
"apply done rc=%d\n",rc));