1 .TH llapi_file_get_stripe 3 "2009 Jul 22" Lustre liblustreapi
3 llapi_file_get_stripe \- get striping information for a file or a directory on a Lustre filesystem
6 .B #include <sys/types.h>
7 .B #include <sys/stat.h>
9 .B #include <liblustre.h>
10 .B #include <lustre/lustre_idl.h>
11 .B #include <lustre/liblustreapi.h>
12 .B #include <lustre/lustre_user.h>
14 .BI "int llapi_file_get_stripe(const char *"path ", void *"lum );
19 .B llapi_file_get_stripe(\|)
20 returns striping information for a file or a directory
24 (which should point to a large enough memory region) in one of the following formats:
27 struct lov_user_md_v1 {
32 __u32 lmm_stripe_size;
33 __u16 lmm_stripe_count;
34 __u16 lmm_stripe_offset;
35 struct lov_user_ost_data_v1 lmm_objects[0];
36 } __attribute__((packed));
38 struct lov_user_md_v3 {
43 __u32 lmm_stripe_size;
44 __u16 lmm_stripe_count;
45 __u16 lmm_stripe_offset;
46 char lmm_pool_name[LOV_MAXPOOLNAME];
47 struct lov_user_ost_data_v1 lmm_objects[0];
48 } __attribute__((packed));
53 specifies the format of the returned striping information.
55 is used for lov_user_md_v1.
57 is used for lov_user_md_v3.
60 holds the striping pattern. Only
62 is possible in this Lustre version.
65 holds the MDS object id.
68 holds the MDS object group.
71 holds the stripe size in bytes.
74 holds the number of OSTs the file is striped across.
77 holds the OST index from which the file starts.
80 holds the OST pool name to which the file belongs.
85 members containing per OST file information in the following format:
88 struct lov_user_ost_data_v1 {
93 } __attribute__((packed));
97 holds the OST object id.
100 holds the OST object group.
103 holds the generation of the OST index.
106 holds the OST index in LOV.
109 .B llapi_file_get_stripe(\|)
118 is set appropriately.
122 failed to allocate memory.
130 does not point to a file or a directory.
134 does not point to a Lustre filesystem.
137 memory region pointed by
139 is not properly mapped.
143 #include <liblustre.h>
144 #include <lnet/lnetctl.h>
146 #include <lustre_lib.h>
147 #include <lustre/liblustreapi.h>
150 static inline int maxint(int a, int b)
152 return a > b ? a : b;
155 static void *alloc_lum()
159 v1 = sizeof(struct lov_user_md_v1) +
160 LOV_MAX_STRIPE_COUNT * sizeof(struct lov_user_ost_data_v1);
161 v3 = sizeof(struct lov_user_md_v3) +
162 LOV_MAX_STRIPE_COUNT * sizeof(struct lov_user_ost_data_v1);
164 return malloc(maxint(v1, v3));
167 int main(int argc, char** argv)
169 struct lov_user_md *lum_file = NULL;
174 fprintf(stderr, "Usage: %s <filename>\\n", argv[0]);
178 lum_file = alloc_lum();
179 if (lum_file == NULL) {
184 rc = llapi_file_get_stripe(argv[1], lum_file);
190 /* stripe_size stripe_count */
192 lum_file->lmm_stripe_size,
193 lum_file->lmm_stripe_count);
196 if (lum_file != NULL)