1 | /* IBM_PROLOG_BEGIN_TAG */ |
---|
2 | /* This is an automatically generated prolog. */ |
---|
3 | /* */ |
---|
4 | /* */ |
---|
5 | /* */ |
---|
6 | /* Licensed Materials - Property of IBM */ |
---|
7 | /* */ |
---|
8 | /* Restricted Materials of IBM */ |
---|
9 | /* */ |
---|
10 | /* (C) COPYRIGHT International Business Machines Corp. 1999,2006 */ |
---|
11 | /* All Rights Reserved */ |
---|
12 | /* */ |
---|
13 | /* US Government Users Restricted Rights - Use, duplication or */ |
---|
14 | /* disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ |
---|
15 | /* */ |
---|
16 | /* IBM_PROLOG_END_TAG */ |
---|
17 | /* @(#)51 1.14 src/avs/fs/mmfs/ts/kernext/gpfs_fcntl.h, mmfs, avs_rgpfs24, rgpfs24s001a 3/24/06 19:37:40 */ |
---|
18 | |
---|
19 | /* |
---|
20 | * GPFS interface definitions for supporting I/O hints and directives. |
---|
21 | * |
---|
22 | * Usage: The argument to gpfs_fcntl is composed of the concatenation of |
---|
23 | * structures defined in this file. The first structure must be of type |
---|
24 | * gpfsFcntlHeader_t. This is immediately followed by additional |
---|
25 | * structures, one for each hint or directive supplied. The totalLength |
---|
26 | * field of the header contains the length of all of the structures, |
---|
27 | * including the header itself. Each structure is defined to be a multiple |
---|
28 | * of 8 bytes in length, and the highest alignment requirement of any of the |
---|
29 | * data types is also 8 bytes, so the compiler will not insert padding when |
---|
30 | * several structures are declared within an outer structure. This makes |
---|
31 | * it easier to build up the necessary area before calling gpfs_fcntl. |
---|
32 | * |
---|
33 | * For example, the following code fragment first releases all cached data |
---|
34 | * held on behalf of a file, then tells GPFS that this node will write |
---|
35 | * the portion of the file with file offsets between 2G and 3G-1: |
---|
36 | * struct |
---|
37 | * { |
---|
38 | * gpfsFcntlHeader_t hdr; |
---|
39 | * gpfsClearFileCache_t rel; |
---|
40 | * gpfsAccessRange_t acc; |
---|
41 | * } arg; |
---|
42 | * |
---|
43 | * arg.hdr.totalLength = sizeof(arg); |
---|
44 | * arg.hdr.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; |
---|
45 | * arg.hdr.fcntlReserved = 0; |
---|
46 | * arg.rel.structLen = sizeof(arg.rel); |
---|
47 | * arg.rel.structType = GPFS_CLEAR_FILE_CACHE; |
---|
48 | * arg.acc.structLen = sizeof(arg.acc); |
---|
49 | * arg.acc.structType = GPFS_ACCESS_RANGE; |
---|
50 | * arg.acc.start = 2LL * 1024LL * 1024LL * 1024LL; |
---|
51 | * arg.acc.length = 1024 * 1024 * 1024; |
---|
52 | * arg.acc.isWrite = 1; |
---|
53 | * rc = gpfs_fcntl(handle, &arg); |
---|
54 | * |
---|
55 | * If gpfs_fcntl returns an error (rc -1), errno will contain the error |
---|
56 | * reason, and the errorOffset field of the header will contain the offset |
---|
57 | * of the offending structure within the argument area. |
---|
58 | * |
---|
59 | * In general, the structures within the argument are processed in order, |
---|
60 | * except that data shipping directives are performed after all other hints |
---|
61 | * and directives. |
---|
62 | */ |
---|
63 | |
---|
64 | #ifndef _h_gpfs_fcntl |
---|
65 | #define _h_gpfs_fcntl |
---|
66 | |
---|
67 | /* Header of the parameter area passed to gpfs_fcntl */ |
---|
68 | typedef struct |
---|
69 | { |
---|
70 | int totalLength; /* length of this structure plus the sum of |
---|
71 | the lengths of all structures in this |
---|
72 | gpfs_fcntl argument */ |
---|
73 | int fcntlVersion; /* version number: GPFS_FCNTL_CURRENT_VERSION */ |
---|
74 | int errorOffset; /* Returned value giving offset into parameter |
---|
75 | area of the structure to which errno |
---|
76 | pertains. Only set if errno is set. */ |
---|
77 | int fcntlReserved; /* not used, should be set to 0 */ |
---|
78 | } gpfsFcntlHeader_t; |
---|
79 | |
---|
80 | |
---|
81 | /* Interface version number (fcntlVersion field of gpfsFcntlHeader_t) */ |
---|
82 | #define GPFS_FCNTL_CURRENT_VERSION 1 |
---|
83 | |
---|
84 | /* Maximum length of argument to gpfs_fcntl */ |
---|
85 | #define GPFS_MAX_FCNTL_LENGTH 65536 |
---|
86 | |
---|
87 | /* Maximum length of a name arguement passed to or returned from gpfs_fcntl. |
---|
88 | Length of buffer must be a multiple of 8. */ |
---|
89 | #define GPFS_FCNTL_MAX_NAME_BUFFER 256 |
---|
90 | #define GPFS_FCNTL_MIN_NAME_BUFFER 8 |
---|
91 | |
---|
92 | |
---|
93 | /* Definitions of structType fields for GPFS hints. Hints can be ignored |
---|
94 | by GPFS without affecting correct operation, although performance might |
---|
95 | suffer. */ |
---|
96 | #define GPFS_ACCESS_RANGE 1001 |
---|
97 | #define GPFS_FREE_RANGE 1002 |
---|
98 | #define GPFS_MULTIPLE_ACCESS_RANGE 1003 |
---|
99 | #define GPFS_CLEAR_FILE_CACHE 1004 |
---|
100 | |
---|
101 | /* Definitions of structType fields for GPFS directives. GPFS must honor |
---|
102 | directives, or return an error saying why a directive could not be |
---|
103 | honored. */ |
---|
104 | #define GPFS_CANCEL_HINTS 2001 |
---|
105 | #define GPFS_DATA_SHIP_START 2002 |
---|
106 | #define GPFS_DATA_SHIP_MAP 2003 |
---|
107 | #define GPFS_DATA_SHIP_STOP 2004 |
---|
108 | #define GPFS_FCNTL_SET_REPLICATION 2005 |
---|
109 | #define GPFS_FCNTL_SET_STORAGEPOOL 2006 |
---|
110 | #define GPFS_FCNTL_RESTRIPE_DATA 2007 |
---|
111 | |
---|
112 | |
---|
113 | /* Definitions of structType fileds for GPFS inquiries. Inquiries merely |
---|
114 | return GPFS attributes of existing files. */ |
---|
115 | #define GPFS_FCNTL_GET_REPLICATION 3001 |
---|
116 | #define GPFS_FCNTL_GET_STORAGEPOOL 3002 |
---|
117 | #define GPFS_FCNTL_GET_FILESETNAME 3003 |
---|
118 | #define GPFS_FCNTL_GET_SNAPSHOTNAME 3004 |
---|
119 | |
---|
120 | |
---|
121 | |
---|
122 | /* Structures for specifying the various gpfs_fnctl hints */ |
---|
123 | |
---|
124 | /* Access range hint: The application will soon access file offsets within |
---|
125 | the given range, and will not access offsets outside the range. Violating |
---|
126 | this hint may produce worse performance than if no hint was specified. */ |
---|
127 | typedef struct |
---|
128 | { |
---|
129 | int structLen; /* length of this structure */ |
---|
130 | int structType; /* hint identifier: GPFS_ACCESS_RANGE */ |
---|
131 | long long start; /* start offset in bytes from beginning of file */ |
---|
132 | long long length; /* length of range; 0 indicates to end of file */ |
---|
133 | int isWrite; /* 0 - read access, 1 - write access */ |
---|
134 | char padding[4]; |
---|
135 | } gpfsAccessRange_t; |
---|
136 | |
---|
137 | |
---|
138 | /* Free range hint: the application will no longer access file offsets |
---|
139 | within the given range, so GPFS is free to flush those file offsets from |
---|
140 | its cache. */ |
---|
141 | typedef struct |
---|
142 | { |
---|
143 | int structLen; /* length of this structure */ |
---|
144 | int structType; /* hint identifier: GPFS_FREE_RANGE */ |
---|
145 | long long start; /* start offset in bytes from beginning of file */ |
---|
146 | long long length; /* length of range; 0 indicates to end of file */ |
---|
147 | } gpfsFreeRange_t; |
---|
148 | |
---|
149 | |
---|
150 | /* Format of accRangeArray and relRangeArray entries used by |
---|
151 | GPFS_MULTIPLE_ACCESS_RANGE hint */ |
---|
152 | typedef struct |
---|
153 | { |
---|
154 | long long blockNumber; /* data block number to access */ |
---|
155 | int start; /* start of range (from beginning of block) */ |
---|
156 | int length; /* number of bytes in the range */ |
---|
157 | int isWrite; /* 0 - read access, 1 - write access */ |
---|
158 | char padding[4]; |
---|
159 | } gpfsRangeArray_t; |
---|
160 | |
---|
161 | /* Multiple access range hint: This hint is used to drive application-defined |
---|
162 | prefetching and writebehind. The application will soon access the |
---|
163 | portions of the blocks specified in accRangeArray, and has finished |
---|
164 | accessing the ranges listed in relRangeArray. The size of a block is |
---|
165 | returned by stat in the st_blksize field, so offset OFF of a file is in |
---|
166 | block OFF/st_blksize. Up to GPFS_MAX_RANGE_COUNT blocks may be given in |
---|
167 | one multiple access range hint. Depending on the current load, GPFS may |
---|
168 | initiate prefetching of some or all of these. Each range named in |
---|
169 | accRangeArray that is accepted for prefetching should eventually be |
---|
170 | released via relRangeArray, or else GPFS will stop prefetching blocks |
---|
171 | for this file. */ |
---|
172 | #define GPFS_MAX_RANGE_COUNT 8 |
---|
173 | typedef struct |
---|
174 | { |
---|
175 | int structLen; /* length of this structure */ |
---|
176 | int structType; /* hint identifier: GPFS_MULTIPLE_ACCESS_RANGE */ |
---|
177 | int accRangeCnt; /* on input, number of ranges in accRangeArray |
---|
178 | on output, number of processed ranges (the |
---|
179 | first n of the given ranges) */ |
---|
180 | int relRangeCnt; /* number of ranges in relRangeArray */ |
---|
181 | gpfsRangeArray_t accRangeArray[GPFS_MAX_RANGE_COUNT]; /* requested ranges */ |
---|
182 | gpfsRangeArray_t relRangeArray[GPFS_MAX_RANGE_COUNT]; /* ranges to release */ |
---|
183 | } gpfsMultipleAccessRange_t; |
---|
184 | |
---|
185 | |
---|
186 | /* Clear file cache hint: the application expects to no longer access any |
---|
187 | portion of the file, so GPFS should flush and invalidate any cached |
---|
188 | data belonging to this file. This may avoid synchronous cache invalidations |
---|
189 | on later uses of the file by other nodes. */ |
---|
190 | typedef struct |
---|
191 | { |
---|
192 | int structLen; /* length of this structure */ |
---|
193 | int structType; /* hint identifier: GPFS_CLEAR_FILE_CACHE */ |
---|
194 | } gpfsClearFileCache_t; |
---|
195 | |
---|
196 | |
---|
197 | |
---|
198 | /* Structures for specifying the various gpfs_fnctl directives */ |
---|
199 | |
---|
200 | /* Cancel all hints: GPFS removes any hints that may have been issued |
---|
201 | against this file. Does not affect the contents of the GPFS file cache. |
---|
202 | Note that this directive does not cancel the effect of other directives, |
---|
203 | such as GPFS_DATA_SHIP_START. */ |
---|
204 | typedef struct /* cancelAccessHints hint */ |
---|
205 | { |
---|
206 | int structLen; /* length of this structure */ |
---|
207 | int structType; /* hint identifier: GPFS_CANCEL_HINTS */ |
---|
208 | } gpfsCancelHints_t; |
---|
209 | |
---|
210 | |
---|
211 | /* Initiate data shipping mode: once all participating threads have issued |
---|
212 | this hint for a file, GPFS enters a mode where it partitions the blocks |
---|
213 | of the file among a group of agent nodes. In data shipping mode, all |
---|
214 | file accesses result in GPFS messages to the appropriate agent(s) to read |
---|
215 | or write the requested data. Applications that perform fine-grained |
---|
216 | write sharing should benefit most from data shipping, since GPFS cache |
---|
217 | invalidations will be avoided. Because an application level read or |
---|
218 | write may be split across several agents, Posix read/write file atomicity |
---|
219 | is not enforced while in data shipping mode. */ |
---|
220 | typedef struct |
---|
221 | { |
---|
222 | int structLen; /* length of this structure */ |
---|
223 | int structType; /* directive identifier: GPFS_DATA_SHIP_START */ |
---|
224 | int numInstances; /* number of open file instances collaborating |
---|
225 | to operate on the file. These may be on |
---|
226 | any number of nodes. */ |
---|
227 | int reserved; /* not used, should be set to 0 */ |
---|
228 | } gpfsDataShipStart_t; |
---|
229 | |
---|
230 | |
---|
231 | /* Specify the agent mapping for data shipping: tells GPFS which agent |
---|
232 | nodes to use for data shipping. This directive can only appear in a |
---|
233 | gpfs_fcntl call that also gives the GPFS_DATA_SHIP_START directive. If |
---|
234 | this directive is not used, the agents will be exactly the nodes on which |
---|
235 | the GPFS_DATA_SHIP_START directive was given, and the partition will be a |
---|
236 | round-robin distribution of the blocks of the file to the agent nodes. |
---|
237 | There are two forms of this directive. The gpfsDataShipMap_t structure |
---|
238 | contains enough room for up to GPFS_MAX_DS_AGENT_NODES agent nodes. If |
---|
239 | this is insufficient, the variable-size structure gpfsDataShipMapVariable_t |
---|
240 | may be used instead. GPFS will infer the actual size of the agentNodeNumber |
---|
241 | array in the gpfsDataShipMapVariable_t structure from its structLen |
---|
242 | field. To build the argument to gpfs_fcntl when gpfsDataShipMapVariable_t |
---|
243 | is used, the application needs to dynamically allocate space for all of |
---|
244 | the contiguous structures to be passed to gpfs_fcntl. The following code |
---|
245 | fragment illustrates how this might be done: |
---|
246 | |
---|
247 | char * p; |
---|
248 | gpfsFcntlHeader_t * hdrP; |
---|
249 | gpfsDataShipStart_t * startP; |
---|
250 | gpfsDataShipMapVariable_t * mapP; |
---|
251 | int mapSize = GPFS_DATA_SHIP_MAP_VARIABLE_SIZE(nAgents); |
---|
252 | |
---|
253 | p = malloc(sizeof(gpfsFcntlHeader_t) + sizeof(gpfsDataShipStart_t) + mapSize); |
---|
254 | hdrP = (gpfsFcntlHeader_t *) p; |
---|
255 | startP = (gpfsDataShipStart_t *) (p + sizeof(gpfsFcntlHeader_t)); |
---|
256 | mapP = (gpfsDataShipMapVariable_t *) (p + sizeof(gpfsFcntlHeader_t) + |
---|
257 | sizeof(gpfsDataShipStart_t)); |
---|
258 | hdrP->totalLength = sizeof(gpfsFcntlHeader_t) + |
---|
259 | sizeof(gpfsDataShipStart_t) + mapSize; |
---|
260 | ... fill in other fields in *hdrP |
---|
261 | startP->structLen = sizeof(gpfsDataShipStart_t); |
---|
262 | ... fill in other fields in *startP |
---|
263 | mapP->structLen = mapSize; |
---|
264 | ... fill in other fields in mapP, including nAgents entries in the |
---|
265 | mapP->agentNodeNumber array |
---|
266 | rc = gpfs_fcntl(handle, hdrP); |
---|
267 | free(p); |
---|
268 | |
---|
269 | As the example code shows, using gpfsDataShipMapVariable_t is more awkward |
---|
270 | than using gpfsDataShipMap_t, since the latter can simply be embedded |
---|
271 | within a larger structure that contains the necessary gpfsFcntlHeader_t |
---|
272 | and gpfsDataShipStart_t structures. */ |
---|
273 | #define GPFS_MAX_DS_AGENT_NODES 2048 |
---|
274 | typedef struct |
---|
275 | { |
---|
276 | int structLen; /* length of this structure */ |
---|
277 | int structType; /* directive identifier: GPFS_DATA_SHIP_MAP */ |
---|
278 | int partitionSize; /* number of contiguous bytes per server */ |
---|
279 | int agentCount; /* number of entries used in the |
---|
280 | agentNodeNumber array */ |
---|
281 | int agentNodeNumber[GPFS_MAX_DS_AGENT_NODES]; |
---|
282 | /* data ship agent node numbers, using |
---|
283 | GPFS configuration data repository |
---|
284 | node numbers */ |
---|
285 | } gpfsDataShipMap_t; |
---|
286 | |
---|
287 | typedef struct |
---|
288 | { |
---|
289 | int structLen; /* length of this structure */ |
---|
290 | int structType; /* directive identifier: GPFS_DATA_SHIP_MAP */ |
---|
291 | int partitionSize; /* number of contiguous bytes per server */ |
---|
292 | int agentCount; /* number of entries used in the |
---|
293 | agentNodeNumber array */ |
---|
294 | int agentNodeNumber[2]; |
---|
295 | /* data ship agent node numbers, using |
---|
296 | GPFS configuration data repository |
---|
297 | node numbers. The actual size of this |
---|
298 | array will be inferred from structLen. |
---|
299 | The number of elements in the array must |
---|
300 | be even, so that the total structure size |
---|
301 | is a multiple of 8. The number of |
---|
302 | entries used in the array is given by |
---|
303 | agentCount, and may be any positive value |
---|
304 | less than or equal to the size of the |
---|
305 | array. */ |
---|
306 | } gpfsDataShipMapVariable_t; |
---|
307 | |
---|
308 | /* Compute the size in bytes of a gpfsDataShipMapVariable_t structure large |
---|
309 | enough to hold _nAgents data shipping agent node numbers */ |
---|
310 | #define GPFS_DATA_SHIP_MAP_VARIABLE_SIZE(_nAgents) \ |
---|
311 | ( sizeof(gpfsDataShipMapVariable_t) - 2*sizeof(int) + \ |
---|
312 | ((((_nAgents)+1)/2)*2)*sizeof(int) ) |
---|
313 | |
---|
314 | |
---|
315 | /* Terminate data shipping: waits for all threads that issued the |
---|
316 | GPFS_DATA_SHIP_START directive to issue this directive, then leaves data |
---|
317 | shipping mode. */ |
---|
318 | typedef struct |
---|
319 | { |
---|
320 | int structLen; /* length of this structure */ |
---|
321 | int structType; /* directive identifier: GPFS_DATA_SHIP_STOP */ |
---|
322 | } gpfsDataShipStop_t; |
---|
323 | |
---|
324 | |
---|
325 | /* This directive is used to set a file's replication factors. |
---|
326 | However, the directive does not cause the file data to be restriped |
---|
327 | immediately. Instead the caller must append a gpfsRestripeData_t directive |
---|
328 | or invoke a mmrestripefs or a mmrestripefile command. */ |
---|
329 | typedef struct |
---|
330 | { |
---|
331 | int structLen; /* length of this structure */ |
---|
332 | int structType; /* directive identifier: |
---|
333 | GPFS_FCNTL_SET_REPLICATION */ |
---|
334 | int metadataReplicas; /* Set the number of copies of the file's |
---|
335 | indirect blocks. Valid values are 1 or 2, |
---|
336 | but not greater than the value of |
---|
337 | maxMetadataReplicas. A value of 0 indicates |
---|
338 | not to change the current value. */ |
---|
339 | int maxMetadataReplicas; /* Set the maximum number of copies of a file's |
---|
340 | indirect blocks. Space in the file's inode |
---|
341 | and indirect blocks is reserved for the |
---|
342 | maximum number of copies, regardless of the |
---|
343 | current value. Valid values are 1 or 2. |
---|
344 | A value of 0 indicates not to change the |
---|
345 | current value. */ |
---|
346 | int dataReplicas; /* Set the number of copies of the file's |
---|
347 | data blocks. Valid values are 1 or 2, |
---|
348 | but cannot be greater than the value of |
---|
349 | maxDataReplicas. A value of 0 indicates |
---|
350 | not to change the current value. */ |
---|
351 | int maxDataReplicas; /* Set the maximum number of copies of a file's |
---|
352 | data blocks. Space in the file's inode |
---|
353 | and indirect blocks is reserved for the |
---|
354 | maximum number of copues, regardless of the |
---|
355 | current value. Valid values are 1 or 2. |
---|
356 | A value of 0 indicates not the change the |
---|
357 | current value. */ |
---|
358 | int errReason; /* returned reason request failed. |
---|
359 | Defined below. */ |
---|
360 | int errValue1; /* returned value depending upon errReason */ |
---|
361 | int errValue2; /* returned value depending upon errReason */ |
---|
362 | int reserved; /* unused, but should be set to 0 */ |
---|
363 | } gpfsSetReplication_t; |
---|
364 | |
---|
365 | |
---|
366 | |
---|
367 | /* Values that may be returned by errReason */ |
---|
368 | |
---|
369 | /* No reason information was returned. */ |
---|
370 | #define GPFS_FCNTL_ERR_NONE 0 |
---|
371 | |
---|
372 | /* MetadataReplicas is out of range. |
---|
373 | errValue1 and errValue2 contain the valid lower and upper range boundaries. */ |
---|
374 | #define GPFS_FCNTL_ERR_METADATA_REPLICAS_RANGE 1 |
---|
375 | |
---|
376 | /* MaxMetadataReplicas is out of range. |
---|
377 | errValue1 and errValue2 contain the valid lower and upper range boundaries. */ |
---|
378 | #define GPFS_FCNTL_ERR_MAXMETADATA_REPLICAS_RANGE 2 |
---|
379 | |
---|
380 | /* DataReplicas is out of range. |
---|
381 | errValue1 and errValue2 contain the valid lower and upper range boundaries. */ |
---|
382 | #define GPFS_FCNTL_ERR_DATA_REPLICAS_RANGE 3 |
---|
383 | |
---|
384 | /* MaxDataReplicas is out of range. |
---|
385 | errValue1 and errValue2 contain the valid lower and upper range boundaries. */ |
---|
386 | #define GPFS_FCNTL_ERR_MAXDATA_REPLICAS_RANGE 4 |
---|
387 | |
---|
388 | /* An attempt to change maxMetadataReplicas or maxDataReplicas or both |
---|
389 | was made on a file that is not empty. */ |
---|
390 | #define GPFS_FCNTL_ERR_FILE_NOT_EMPTY 5 |
---|
391 | |
---|
392 | /* MetadataReplicas or dataReplicas or both exceed the number of failure groups. |
---|
393 | errValue1 contains the maximum number of metadata failure groups. |
---|
394 | errValue2 contains the maximum number of data failure groups. */ |
---|
395 | #define GPFS_FCNTL_ERR_REPLICAS_EXCEED_FGMAX 6 |
---|
396 | |
---|
397 | |
---|
398 | |
---|
399 | /* This directive is used to set a file's assigned storage pool. |
---|
400 | However, the directive does not cause the file data to be migrated |
---|
401 | immediately. Instead the caller must append a gpfsRestripeData_t |
---|
402 | directive or invoke a mmrestripefs or mmrestripefile command. |
---|
403 | The caller must have root privileges to change a file's storage pool. */ |
---|
404 | typedef struct |
---|
405 | { |
---|
406 | int structLen; /* length of this structure */ |
---|
407 | int structType; /* directive identifier: |
---|
408 | GPFS_FCNTL_SET_STORAGEPOOL */ |
---|
409 | int errReason; /* returned reason request failed. |
---|
410 | Defined below. */ |
---|
411 | int errValue1; /* returned value depending upon errReason */ |
---|
412 | int errValue2; /* returned value depending upon errReason */ |
---|
413 | int reserved; /* unused, but should be set to 0 */ |
---|
414 | char buffer[GPFS_FCNTL_MAX_NAME_BUFFER]; /* Null-terminated name of |
---|
415 | storage pool to be assigned */ |
---|
416 | } gpfsSetStoragePool_t; |
---|
417 | |
---|
418 | |
---|
419 | /* Values that may be returned by errReason */ |
---|
420 | |
---|
421 | /* Invalid storage pool name was given. */ |
---|
422 | #define GPFS_FCNTL_ERR_INVALID_STORAGE_POOL 7 |
---|
423 | |
---|
424 | /* Invalid storage pool. File cannot be assigned to given pool. */ |
---|
425 | #define GPFS_FCNTL_ERR_INVALID_STORAGE_POOL_TYPE 8 |
---|
426 | |
---|
427 | /* Invalid storage pool. Directories cannot be assigned to given pool. */ |
---|
428 | #define GPFS_FCNTL_ERR_INVALID_STORAGE_POOL_ISDIR 9 |
---|
429 | |
---|
430 | /* Invalid storage pool. System files cannot be assigned to given pool. */ |
---|
431 | #define GPFS_FCNTL_ERR_INVALID_STORAGE_POOL_ISLNK 10 |
---|
432 | |
---|
433 | /* Invalid storage pool. System files cannot be assigned to given pool. */ |
---|
434 | #define GPFS_FCNTL_ERR_INVALID_STORAGE_POOL_ISSYS 11 |
---|
435 | |
---|
436 | /* File system has not been upgraded to support storage pools */ |
---|
437 | #define GPFS_FCNTL_ERR_STORAGE_POOL_NOTENABLED 12 |
---|
438 | |
---|
439 | /* User does not have permission to perform the requested operation */ |
---|
440 | #define GPFS_FCNTL_ERR_NOPERM 13 |
---|
441 | |
---|
442 | |
---|
443 | |
---|
444 | |
---|
445 | /* This directive is used to restripe a file's data blocks to update |
---|
446 | its replication and/or migrate its data. The data movement is always |
---|
447 | done immediately. */ |
---|
448 | typedef struct |
---|
449 | { |
---|
450 | int structLen; /* length of this structure */ |
---|
451 | int structType; /* directive identifier: |
---|
452 | GPFS_FCNTL_RESTRIPE_FILE */ |
---|
453 | int options; /* options for restripe command. Defined below. |
---|
454 | See mmrestripefs command for details. */ |
---|
455 | int errReason; /* returned reason request failed. |
---|
456 | Defined below. */ |
---|
457 | int errValue1; /* returned value depending upon errReason */ |
---|
458 | int errValue2; /* returned value depending upon errReason */ |
---|
459 | int reserved; /* unused, but should be set to 0 */ |
---|
460 | int reserved2; /* unused, but should be set to 0 */ |
---|
461 | } gpfsRestripeData_t; |
---|
462 | |
---|
463 | |
---|
464 | /* Define values for restripe options. |
---|
465 | See mmrestripefs command for complete definitions. */ |
---|
466 | |
---|
467 | /* Migrate critical data off of suspended disks. */ |
---|
468 | #define GPFS_FCNTL_RESTRIPE_M 0x0001 |
---|
469 | |
---|
470 | /* Replicate data against subsequent failure. */ |
---|
471 | #define GPFS_FCNTL_RESTRIPE_R 0x0002 |
---|
472 | |
---|
473 | /* Place file data in assigned storage pool. */ |
---|
474 | #define GPFS_FCNTL_RESTRIPE_P 0x0004 |
---|
475 | |
---|
476 | /* Rebalance file data */ |
---|
477 | #define GPFS_FCNTL_RESTRIPE_B 0x0008 |
---|
478 | |
---|
479 | |
---|
480 | /* Values that may be returned by errReason */ |
---|
481 | |
---|
482 | /* Not enough replicas could be created because the desired degree |
---|
483 | of replication is larger than the number of failure groups. */ |
---|
484 | #define GPFS_FCNTL_ERR_NO_REPLICA_GROUP 14 |
---|
485 | |
---|
486 | /* Not enough replicas could be created because there was not |
---|
487 | enough space left in one of the failure groups. */ |
---|
488 | #define GPFS_FCNTL_ERR_NO_REPLICA_SPACE 15 |
---|
489 | |
---|
490 | /* There was not enough space left on one of the disks to properly |
---|
491 | balance the file according to the current stripe method. */ |
---|
492 | #define GPFS_FCNTL_ERR_NO_BALANCE_SPACE 16 |
---|
493 | |
---|
494 | /* The file could not be properly balanced because one or more |
---|
495 | disks are unavailable. */ |
---|
496 | #define GPFS_FCNTL_ERR_NO_BALANCE_AVAILABLE 17 |
---|
497 | |
---|
498 | /* All replicas were on disks that have since been deleted |
---|
499 | from the stripe group. */ |
---|
500 | #define GPFS_FCNTL_ERR_ADDR_BROKEN 18 |
---|
501 | |
---|
502 | |
---|
503 | |
---|
504 | |
---|
505 | /* Structures for specifying the various gpfs_fnctl inquiries. |
---|
506 | The inquiry directives may be used to obtain attributes of a files |
---|
507 | such as the file's replication factors, storage pool name, |
---|
508 | fileset name or snapshot name. */ |
---|
509 | |
---|
510 | /* This inquiry is used to obtain a file's replication factors. */ |
---|
511 | typedef struct |
---|
512 | { |
---|
513 | int structLen; /* length of this structure */ |
---|
514 | int structType; /* inquiry identifier: |
---|
515 | GPFS_FCNTL_GET_REPLICATION */ |
---|
516 | int metadataReplicas; /* returns the current number of copies |
---|
517 | of indirect blocks for the file. */ |
---|
518 | int maxMetadataReplicas; /* returns the maximum number of copies |
---|
519 | of indirect blocks for the file. */ |
---|
520 | int dataReplicas; /* returns the current number of copies |
---|
521 | of data blocks for the file. */ |
---|
522 | int maxDataReplicas; /* returns the maximum number of copies |
---|
523 | of data blocks for the file. */ |
---|
524 | int status; /* returns the status of the file. |
---|
525 | Status values defined below. */ |
---|
526 | int reserved; /* unused, but should be set to 0 */ |
---|
527 | } gpfsGetReplication_t; |
---|
528 | |
---|
529 | |
---|
530 | /* Flag definitions */ |
---|
531 | |
---|
532 | /* If set this file may have some data where the only replicas are |
---|
533 | on suspended disks; implies some data may be lost if suspended |
---|
534 | disks are removed. */ |
---|
535 | #define GPFS_FCNTL_STATUS_EXPOSED 0x40000000 |
---|
536 | |
---|
537 | /* If set this file may not be properly replicated, i.e. some data |
---|
538 | may have fewer or more than the desired number of replicas, |
---|
539 | or some replicas may be on suspended disks. */ |
---|
540 | #define GPFS_FCNTL_STATUS_ILLREPLICATED 0x20000000 |
---|
541 | |
---|
542 | /* If set this file may not be properly balanced. */ |
---|
543 | #define GPFS_FCNTL_STATUS_UNBALANCED 0x10000000 |
---|
544 | |
---|
545 | /* If set this file has stale data blocks on at least one of the disks |
---|
546 | that are marked as unavailable or recovering in the stripe group |
---|
547 | descriptor. */ |
---|
548 | #define GPFS_FCNTL_STATUS_DATAUPDATEMISS 0x08000000 |
---|
549 | |
---|
550 | /* If set this file has stale indirect blocks on at least one |
---|
551 | unavailable or recovering disk. */ |
---|
552 | #define GPFS_FCNTL_STATUS_METAUPDATEMISS 0x04000000 |
---|
553 | |
---|
554 | /* If set this file may not be properly placed, i.e. some data may |
---|
555 | be stored in an incorrect storage pool */ |
---|
556 | #define GPFS_FCNTL_STATUS_ILLPLACED 0x02000000 |
---|
557 | |
---|
558 | |
---|
559 | |
---|
560 | /* This inquiry is used to obtain the name of the storage assigned |
---|
561 | for the file's data. The size of the buffer may vary, but it must be |
---|
562 | a multiple of 8. Upon successful completion of the call, the buffer |
---|
563 | will contain a null-terminated character string for the name of the |
---|
564 | file's storage pool. */ |
---|
565 | typedef struct |
---|
566 | { |
---|
567 | int structLen; /* length of this structure */ |
---|
568 | int structType; /* inquiry identifier: |
---|
569 | GPFS_FCNTL_GET_STORAGEPOOL */ |
---|
570 | char buffer[GPFS_FCNTL_MAX_NAME_BUFFER]; /* returns with the file's |
---|
571 | storage pool name */ |
---|
572 | } gpfsGetStoragePool_t; |
---|
573 | |
---|
574 | |
---|
575 | /* This inquiry is used to obtain the name of the fileset to which this |
---|
576 | file has been assigned. The size of the buffer may vary, but it must be |
---|
577 | a multiple of 8. Upon successful completion of the call, the buffer |
---|
578 | will contain a null-terminated character string for the name of the |
---|
579 | file's fileset. */ |
---|
580 | typedef struct |
---|
581 | { |
---|
582 | int structLen; /* length of this structure */ |
---|
583 | int structType; /* inquiry identifier: |
---|
584 | GPFS_FCNTL_GET_FILESETNAME */ |
---|
585 | char buffer[GPFS_FCNTL_MAX_NAME_BUFFER]; /* returns with the file's |
---|
586 | fileset name */ |
---|
587 | } gpfsGetFilesetName_t; |
---|
588 | |
---|
589 | |
---|
590 | /* This inquiry is used to obtain the name of the snapshot that includes |
---|
591 | this file. If the file is not part of a snapshot, then a zero-length |
---|
592 | string will be returned. The size of the buffer may vary, but it must be |
---|
593 | a multiple of 8. Upon successful completion of the call, the buffer |
---|
594 | will contain a null-terminated character string for the name of the |
---|
595 | snapshot that includes this file. */ |
---|
596 | typedef struct { |
---|
597 | int structLen; /* length of this structure */ |
---|
598 | int structType; /* inquiry identifier: |
---|
599 | GPFS_FCNTL_GET_SNAPSHOTNAME */ |
---|
600 | char buffer[GPFS_FCNTL_MAX_NAME_BUFFER]; /* returns with the file's |
---|
601 | snapshot name */ |
---|
602 | } gpfsGetSnapshotName_t; |
---|
603 | |
---|
604 | |
---|
605 | |
---|
606 | |
---|
607 | |
---|
608 | |
---|
609 | |
---|
610 | /* NAME: gpfs_fcntl() |
---|
611 | * |
---|
612 | * FUNCTION: Pass hints and directives to GPFS on behalf of an open file |
---|
613 | * |
---|
614 | * Returns: 0 Successful |
---|
615 | * -1 Failure |
---|
616 | * |
---|
617 | * Errno: ENOSYS Function not available |
---|
618 | * EBADF Bad file handle |
---|
619 | * EINVAL Not a GPFS file |
---|
620 | * EINVAL Not a regular file |
---|
621 | * EINVAL Ill-formed hint or directive |
---|
622 | * E2BIG Argument longer than GPFS_MAX_FCNTL_LENGTH |
---|
623 | */ |
---|
624 | #ifdef __cplusplus |
---|
625 | extern "C" |
---|
626 | { |
---|
627 | #endif |
---|
628 | int gpfs_fcntl(int fileDesc, /* Open file descriptor */ |
---|
629 | void* fcntlArgP); /* argument list */ |
---|
630 | #ifdef __cplusplus |
---|
631 | } |
---|
632 | #endif |
---|
633 | |
---|
634 | #endif /* _h_gpfs_fcntl */ |
---|