Whamcloud - gitweb
LU-4931 ladvise: Add feature of giving file access advices
[fs/lustre-release.git] / lustre / doc / llapi_ladvise.3
1 .TH llapi_ladvise 3 "2015 Dec 15" "Lustre User API"
2 .SH NAME
3 llapi_ladvise \- give IO advices/hints on a Lustre file to the server
4 .SH SYNOPSIS
5 .nf
6 .B #include <lustre/lustreapi.h>
7 .sp
8 .BI "int llapi_ladvise(int " fd ", unsigned long long " flags ", int " num_advise ", struct lu_ladvise *" ladvise ");"
9 .sp
10 .fi
11 .SH DESCRIPTION
12 .LP
13 .B llapi_ladvise()
14 gives advices to a file specified by the file descriptor
15 .IR fd .
16 .IR ladvise
17 points to an array that contains the information of the advices. The number
18 of advices is
19 .IR num_advise ,
20 which should be smaller than
21 .B MAX_NUM_LADVISE.
22 Each of these advises is given in
23 .I lu_ladvise
24 structure, which contains the following fields:
25 .PP
26 .in +4n
27 .nf
28 struct lu_ladvise {
29     __u64 lla_advice;  /* Advice type */
30     __u64 lla_start;   /* Start offset of file */
31     __u64 lla_end;     /* End offset of file(not included) */
32     __u64 lla_padding; /* Not used yet */
33 };
34 .fi
35 .in
36 .LP
37 In addition, zero or more flags can be
38 .RI bitwise-or 'd
39 in
40 .IR flags .
41 The full list of file creation flags and file status flags is as follows:
42 .TP
43 .B LF_ASYNC
44 Client return to userspace immediately after submitting ladvise RPCs, leaving
45 server threads to handle the advices asynchronously.
46 .PP
47 .SH RETURN VALUES
48 .PP
49 .B llapi_ladvise()
50 return 0 on success, or -1 if an error occurred (in which case, errno is set
51 appropriately).
52 .SH ERRORS
53 .TP 15
54 .SM ENOMEM
55 Insufficient memory to complete operation.
56 .TP
57 .SM EINVAL
58 One or more invalid arguments are given.
59 .TP
60 .SM EFAULT
61 memory region pointed by
62 .I ladvise
63 is not properly mapped.
64 .TP
65 .SM ENOTSUPP
66 Advice type is not supported.
67 .SH "SEE ALSO"
68 .BR lfs-ladvise (1),
69 .BR liblustreapi (7)