Whamcloud - gitweb
LU-14286 osd-ldiskfs: fallocate() should zero new blocks
[fs/lustre-release.git] / lustre / doc / llapi_layout_ost_index_get.3
1 .TH llapi_layout_ost_index_get 3 "2013 Oct 31" "Lustre User API"
2 .SH NAME
3 llapi_layout_ost_index_get, llapi_layout_ost_index_set \- get or set the
4 OST index of a stripe of a Lustre file
5 .SH SYNOPSIS
6 .nf
7 .B #include <lustre/lustreapi.h>
8 .PP
9 .BI "int llapi_layout_ost_index_get(const struct llapi_layout *" layout ,
10 .BI "                               int " stripe_number ", uint64_t *" ost_index );
11 .PP
12 .BI "int llapi_layout_ost_index_set(struct llapi_layout *" layout ,
13 .BI "                               int " stripe_number ", uint64_t " ost_index );
14 .fi
15 .SH DESCRIPTION
16 .PP
17 .B llapi_layout_ost_index_get()
18 stores into
19 .I ost_index
20 the index number of the Lustre OST associated with
21 .I stripe_number
22 in
23 .IR layout .
24 .PP
25 .B llapi_layout_ost_index_set()
26 sets the OST index of
27 .I stripe_number
28 in
29 .I layout
30 to
31 .IR ost_index .
32 This allows an application to control which OSTs will be used to
33 allocate storage for a file.  Setting the starting OST index for a file
34 .RI ( stripe_number =0)
35 is supported with all versions of Lustre, and other stripes in the file
36 will be assigned sequentially by the filesystem.  Setting the OST indices
37 other than stripe 0 is only supported with Lustre 2.7 and later, and will
38 return an error at file creation time for 2.6 and earlier.
39 .PP
40 It is an error to call
41 .B llapi_layout_ost_index_get()
42 with a
43 .I layout
44 that was not initialized with with one of
45 .BR llapi_layout_get_by_fd() ,
46 .BR llapi_layout_get_by_fid() ,
47 or
48 .BR llapi_layout_get_by_path() .
49 .PP
50 An
51 .I ost_index
52 value of
53 .B LLAPI_LAYOUT_DEFAULT
54 is only valid for
55 .IR stripe_number =0
56 and means that an OST index will be automatically assigned by the
57 filesystem and will reset previously-set
58 .I stripe_number
59 assignments.
60 .SH RETURN VALUES
61 .LP
62 .B llapi_layout_ost_index_get()
63 and
64 .B llapi_layout_ost_index_set()
65 return 0 on success, or -1 if an error occurred (in which case, errno is
66 set appropriately).
67 .SH ERRORS
68 .TP 15
69 .SM EINVAL
70 An invalid argument was specified.
71 .TP 15
72 .SM EOPNOTSUPP
73 Attempted to set index of a stripe other than stripe 0.
74 .SH "SEE ALSO"
75 .BR llapi_layout_alloc (3),
76 .BR llapi_layout_file_open (3),
77 .BR llapi_layout (7),
78 .BR lustreapi (7)