-<?xml version="1.0" encoding="UTF-8"?>
-<chapter version="5.0" xml:lang="en-US" xmlns="http://docbook.org/ns/docbook" xmlns:xl="http://www.w3.org/1999/xlink" xml:id='settinglustreproperties'>
- <info>
- <title xml:id='settinglustreproperties.title'>Setting Lustre Properties in a C Program (llapi)</title>
- </info>
- <para>This chapter describes the llapi library of commands used for setting Lustre file properties within a C program running in a cluster environment, such as a data processing or MPI application. The commands described in this chapter are:</para>
- <itemizedlist><listitem>
- <para><xref linkend="dbdoclet.50438215_30970"/></para>
+<?xml version='1.0' encoding='UTF-8'?>
+<chapter xmlns="http://docbook.org/ns/docbook"
+ xmlns:xl="http://www.w3.org/1999/xlink" version="5.0" xml:lang="en-US"
+ xml:id="settinglustreproperties">
+ <title xml:id="settinglustreproperties.title">Setting Lustre Properties in a C Program (<literal>llapi</literal>)</title>
+ <para>This chapter describes the <literal>llapi</literal> library of commands used for setting Lustre file properties within a C program running in a cluster environment, such as a data processing or MPI application. The commands described in this chapter are:</para>
+ <itemizedlist>
+ <listitem>
+ <para><xref linkend="llapi_file_create"/></para>
</listitem>
-
-<listitem>
- <para><xref linkend="dbdoclet.50438215_50149"/></para>
+ <listitem>
+ <para><xref linkend="llapi_file_get_stripe"/></para>
</listitem>
-
-<listitem>
- <para><xref linkend="dbdoclet.50438215_86607"/></para>
+ <listitem>
+ <para><xref linkend="llapi_file_open"/></para>
</listitem>
-
-<listitem>
- <para><xref linkend="dbdoclet.50438215_12433"/></para>
+ <listitem>
+ <para><xref linkend="llapi_quotactl"/></para>
</listitem>
-
-<listitem>
- <para><xref linkend="dbdoclet.50438215_15718"/></para>
+ <listitem>
+ <para><xref linkend="llapi_path2fid"/></para>
</listitem>
+ </itemizedlist>
+ <note>
+ <para>Lustre programming interface man pages are found in the <literal>lustre/doc</literal> folder.</para>
+ </note>
+ <section xml:id="llapi_file_create">
+ <title>
+ <literal>llapi_file_create</literal>
+ </title>
+ <para>Use <literal>llapi_file_create</literal> to set Lustre properties for a new file.</para>
+ <section remap="h5">
+ <title>Synopsis</title>
+ <screen>#include <lustre/lustreapi.h>
-</itemizedlist>
-
- <note><para>Lustre programming interface man pages are found in the lustre/doc folder.</para></note>
-
- <section xml:id="dbdoclet.50438215_30970">
- <title>34.1 llapi_file_create</title>
- <para>Use llapi_file_create to set Lustre properties for a new file.</para>
- <section remap="h5">
- <title>Synopsis</title>
- <screen>#include <lustre/liblustreapi.h>#include <lustre/lustre_user.h>
-int llapi_file_create(char *name, long stripe_size, int stripe_offset, int \
-stripe_count, int stripe_pattern);
-</screen>
- </section>
- <section remap="h5">
- <title>Description</title>
- <para>The llapi_file_create() function sets a file descriptor's Lustre striping information. The file descriptor is then accessed with open ().</para>
- <informaltable frame="all">
- <tgroup cols="2">
- <colspec colname="c1" colwidth="50*"/>
- <colspec colname="c2" colwidth="50*"/>
- <thead>
- <row>
- <entry><para><emphasis role="bold">Option</emphasis></para></entry>
- <entry><para><emphasis role="bold">Description</emphasis></para></entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><para> <emphasis role="bold">llapi_file_create()</emphasis></para></entry>
- <entry><para> If the file already exists, this parameter returns to 'EEXIST'. If the stripe parameters are invalid, this parameter returns to 'EINVAL'.</para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">stripe_size</emphasis></para></entry>
- <entry><para> This value must be an even multiple of system page size, as shown by getpagesize (). The default Lustre stripe size is 4MB.</para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">stripe_offset</emphasis></para></entry>
- <entry><para> Indicates the starting OST for this file.</para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">stripe_count</emphasis></para></entry>
- <entry><para> Indicates the number of OSTs that this file will be striped across.</para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">stripe_pattern</emphasis></para></entry>
- <entry><para> Indicates the RAID pattern.</para></entry>
- </row>
- </tbody>
- </tgroup>
- </informaltable>
- <note><para>Currently, only RAID 0 is supported. To use the system defaults, set these values: stripe_size = 0, stripe_offset = -1, stripe_count = 0, stripe_pattern = 0</para></note>
- </section>
- <section remap="h5">
- <title>Examples</title>
- <para>System default size is 4 MB.</para>
- <screen>char *tfile = TESTFILE;
-int stripe_size = 65536
+int llapi_file_create(char *name, long stripe_size, int stripe_offset, int stripe_count, int stripe_pattern);
</screen>
- <para>To start at default, run:</para>
- <screen>int stripe_offset = -1
-</screen>
- <para>To start at the default, run:</para>
- <screen>int stripe_count = 1
-</screen>
- <para>To set a single stripe for this example, run:</para>
- <screen>int stripe_pattern = 0
-</screen>
- <para>Currently, only RAID 0 is supported.</para>
- <screen>int stripe_pattern = 0;
+ </section>
+ <section remap="h5">
+ <title>Description</title>
+ <para>The <literal>llapi_file_create()</literal> function sets a file descriptor's Lustre
+ file system striping information. The file descriptor is then accessed with
+ <literal>open()</literal>.</para>
+ <informaltable frame="all">
+ <tgroup cols="2">
+ <colspec colname="c1" colwidth="50*"/>
+ <colspec colname="c2" colwidth="50*"/>
+ <thead>
+ <row>
+ <entry>
+ <para><emphasis role="bold">Option</emphasis></para>
+ </entry>
+ <entry>
+ <para><emphasis role="bold">Description</emphasis></para>
+ </entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <para> <literal>llapi_file_create()</literal></para>
+ </entry>
+ <entry>
+ <para>If the file already exists, this parameter returns to '<literal>EEXIST</literal>'. If the stripe parameters are invalid, this parameter returns to '<literal>EINVAL</literal>'.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>stripe_size</literal></para>
+ </entry>
+ <entry>
+ <para>This value must be an even multiple of system page size, as shown by <literal>getpagesize()</literal>. The default Lustre stripe size is 4MB.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>stripe_offset</literal></para>
+ </entry>
+ <entry>
+ <para>Indicates the starting OST for this file.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>stripe_count</literal></para>
+ </entry>
+ <entry>
+ <para>Indicates the number of OSTs that this file will be striped across.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>stripe_pattern</literal></para>
+ </entry>
+ <entry>
+ <para>Indicates the RAID pattern.</para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ <note>
+ <para>Currently, only RAID 0 is supported. To use the system defaults, set these values: <literal>stripe_size</literal> = 0, <literal>stripe_offset</literal> = -1, <literal>stripe_count</literal> = 0, <literal>stripe_pattern</literal> = 0</para>
+ </note>
+ </section>
+ <section remap="h5">
+ <title>Examples</title>
+ <para>System default size is 4 MB.</para>
+ <screen>char *tfile = TESTFILE;
+int stripe_size = 65536</screen>
+ <para>To start at default, run:</para>
+ <screen>int stripe_offset = -1</screen>
+ <para>To start at the default, run:</para>
+ <screen>int stripe_count = 1</screen>
+ <para>To set a single stripe for this example, run:</para>
+ <screen>int stripe_pattern = 0</screen>
+ <para>Currently, only RAID 0 is supported.</para>
+ <screen>int stripe_pattern = 0;
int rc, fd;
-rc = llapi_file_create(tfile, stripe_size,stripe_offset, stripe_count,strip\
-e_pattern);
-</screen>
- <para>Result code is inverted, you may return with 'EINVAL' or an ioctl error.</para>
- <screen>if (rc) {
-fprintf(stderr,"llapi_file_create failed: %d (%s) 0, rc, strerror(-rc));retu\
-rn -1; }
-</screen>
- <para>llapi_file_create closes the file descriptor. You must re-open the descriptor. To do this, run:</para>
- <screen>fd = open(tfile, O_CREAT | O_RDWR | O_LOV_DELAY_CREATE, 0644); if (fd < 0) \\
- { fprintf(stderr, "Can't open %s file: %s0, tfile,
+rc = llapi_file_create(tfile, stripe_size,stripe_offset, stripe_count,stripe_pattern);</screen>
+ <para>Result code is inverted, you may return with '<literal>EINVAL</literal>' or an ioctl error.</para>
+ <screen>if (rc) {
+fprintf(stderr,"llapi_file_create failed: %d (%s) 0, rc, strerror(-rc));return -1; }</screen>
+ <para><literal>llapi_file_create</literal> closes the file descriptor. You must re-open the descriptor. To do this, run:</para>
+ <screen>fd = open(tfile, O_CREAT | O_RDWR | O_LOV_DELAY_CREATE, 0644); if (fd < 0) \ {
+fprintf(stderr, "Can't open %s file: %s0, tfile,
str-
error(errno));
return -1;
-}
-</screen>
- </section>
+}</screen>
</section>
- <section xml:id="dbdoclet.50438215_50149">
- <title>34.2 llapi_file_get_stripe</title>
- <para>Use llapi_file_get_stripe to get striping information for a file or directory on a Lustre file system.</para>
- <section remap="h5">
- <title>Synopsis</title>
- <screen>#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <liblustre.h>
-#include <lustre/lustre_idl.h>
-#include <lustre/liblustreapi.h>
-#include <lustre/lustre_user.h>
+ </section>
+ <section xml:id="llapi_file_get_stripe">
+ <title>llapi_file_get_stripe</title>
+ <para>Use <literal>llapi_file_get_stripe</literal> to get striping information for a file or directory on a Lustre file system.</para>
+ <section remap="h5">
+ <title>Synopsis</title>
+ <screen>
+#include <lustre/lustreapi.h>
-int llapi_file_get_stripe(const char *<emphasis>path</emphasis>, void *<emphasis>lum</emphasis>);
-</screen>
- </section>
- <section remap="h5">
- <title>Description</title>
- <para>The llapi_file_get_stripe() function returns striping information for a file or directory <emphasis>path</emphasis> in <emphasis>lum</emphasis> (which should point to a large enough memory region) in one of the following formats:</para>
- <screen>struct lov_user_md_v1 {
+int llapi_file_get_stripe(const char *<emphasis>path</emphasis>, void *<emphasis>lum</emphasis>);</screen>
+ </section>
+ <section remap="h5">
+ <title>Description</title>
+ <para>The <literal>llapi_file_get_stripe()</literal> function returns striping information for a file or directory <emphasis>path</emphasis> in <emphasis>lum</emphasis> (which should point to a large enough memory region) in one of the following formats:</para>
+ <screen>struct lov_user_md_v1 {
__u32 lmm_magic;
__u32 lmm_pattern;
__u64 lmm_object_id;
__u16 lmm_stripe_offset;
char lmm_pool_name[LOV_MAXPOOLNAME];
struct lov_user_ost_data_v1 lmm_objects[0];
-} __attribute__((packed));
-</screen>
- <informaltable frame="all">
- <tgroup cols="2">
- <colspec colname="c1" colwidth="50*"/>
- <colspec colname="c2" colwidth="50*"/>
- <thead>
- <row>
- <entry><para><emphasis role="bold">Option</emphasis></para></entry>
- <entry><para><emphasis role="bold">Description</emphasis></para></entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><para> <emphasis role="bold">lmm_magic</emphasis></para></entry>
- <entry><para> Specifies the format of the returned striping information. <emphasis role="bold">LOV_MAGIC_V1</emphasis> isused for lov_user_md_v1. <emphasis role="bold">LOV_MAGIC_V3</emphasis> is used for lov_user_md_v3.</para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">lmm_pattern</emphasis></para></entry>
- <entry><para> Holds the striping pattern. Only <emphasis role="bold">LOV_PATTERN_RAID0</emphasis> is possible in this Lustre version.</para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">lmm_object_id</emphasis></para></entry>
- <entry><para> Holds the MDS object ID.</para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">lmm_object_gr</emphasis></para></entry>
- <entry><para> Holds the MDS object group.</para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">lmm_stripe_size</emphasis></para></entry>
- <entry><para> Holds the stripe size in bytes.</para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">lmm_stripe_count</emphasis></para></entry>
- <entry><para> Holds the number of OSTs over which the file is striped.</para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">lmm_stripe_offset</emphasis></para></entry>
- <entry><para> Holds the OST index from which the file starts.</para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">lmm_pool_name</emphasis></para></entry>
- <entry><para> Holds the OST pool name to which the file belongs.</para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">lmm_objects</emphasis></para></entry>
- <entry><para> An array of lmm_stripe_count members containing per OST file information in</para><para>the following format:</para><para>struct lov_user_ost_data_v1 {</para><para>__u64 l_object_id;</para><para>__u64 l_object_seq;</para><para>__u32 l_ost_gen;</para><para>__u32 l_ost_idx;</para><para>} __attribute__((packed));</para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">l_object_id</emphasis></para></entry>
- <entry><para> Holds the OST's object ID.</para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">l_object_seq</emphasis></para></entry>
- <entry><para> Holds the OST's object group.</para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">l_ost_gen</emphasis></para></entry>
- <entry><para> Holds the OST's index generation.</para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">l_ost_idx</emphasis></para></entry>
- <entry><para> Holds the OST's index in LOV.</para></entry>
- </row>
- </tbody>
- </tgroup>
- </informaltable>
- </section>
- <section remap="h5">
- <title>Return Values</title>
- <para>llapi_file_get_stripe() returns:</para>
- <para><emphasis role="bold">0</emphasis> On success</para>
- <para><emphasis role="bold">!= 0</emphasis> On failure, <emphasis>errno</emphasis> is set appropriately</para>
- </section>
- <section remap="h5">
- <title>Errors</title>
- <informaltable frame="all">
- <tgroup cols="2">
- <colspec colname="c1" colwidth="50*"/>
- <colspec colname="c2" colwidth="50*"/>
- <thead>
- <row>
- <entry><para><emphasis role="bold">Errors</emphasis></para></entry>
- <entry><para><emphasis role="bold">Description</emphasis></para></entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><para> <emphasis role="bold">ENOMEM</emphasis></para></entry>
- <entry><para> <emphasis role="bold">Failed to allocate memory</emphasis></para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">ENAMETOOLONG</emphasis></para></entry>
- <entry><para> Path was too long</para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">ENOENT</emphasis></para></entry>
- <entry><para> Path does not point to a file or directory</para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">ENOTTY</emphasis></para></entry>
- <entry><para> Path does not point to a Lustre file system</para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">EFAULT</emphasis></para></entry>
- <entry><para> Memory region pointed by lum is not properly mapped</para></entry>
- </row>
- </tbody>
- </tgroup>
- </informaltable>
- </section>
- <section remap="h5">
- <title>Examples</title>
- <screen>#include <sys/vfs.h>
-#include <liblustre.h>
-#include <lnet/lnetctl.h>
-#include <obd.h>
-#include <lustre_lib.h>
-#include <lustre/liblustreapi.h>
-#include <obd_lov.h>
+} __attribute__((packed));</screen>
+ <informaltable frame="all">
+ <tgroup cols="2">
+ <colspec colname="c1" colwidth="50*"/>
+ <colspec colname="c2" colwidth="50*"/>
+ <thead>
+ <row>
+ <entry>
+ <para><emphasis role="bold">Option</emphasis></para>
+ </entry>
+ <entry>
+ <para><emphasis role="bold">Description</emphasis></para>
+ </entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <para> <literal>lmm_magic</literal></para>
+ </entry>
+ <entry>
+ <para>Specifies the format of the returned striping information. <literal>LOV_MAGIC_V1</literal> is used for lov_user_md_v1. LOV_MAGIC_V3 is used for <literal>lov_user_md_v3</literal>.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>lmm_pattern</literal></para>
+ </entry>
+ <entry>
+ <para>Holds the striping pattern. Only <literal>LOV_PATTERN_RAID0</literal> is
+ possible in this Lustre software release.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>lmm_object_id</literal></para>
+ </entry>
+ <entry>
+ <para>Holds the MDS object ID.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>lmm_object_gr</literal></para>
+ </entry>
+ <entry>
+ <para>Holds the MDS object group.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>lmm_stripe_size</literal></para>
+ </entry>
+ <entry>
+ <para>Holds the stripe size in bytes.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>lmm_stripe_count</literal></para>
+ </entry>
+ <entry>
+ <para>Holds the number of OSTs over which the file is striped.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>lmm_stripe_offset</literal></para>
+ </entry>
+ <entry>
+ <para>Holds the OST index from which the file starts.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>lmm_pool_name</literal></para>
+ </entry>
+ <entry>
+ <para>Holds the OST pool name to which the file belongs.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>lmm_objects</literal></para>
+ </entry>
+ <entry>
+ <para>An array of <literal>lmm_stripe_count</literal> members containing per OST file information in</para>
+ <para>the following format:</para>
+ <screen>struct lov_user_ost_data_v1 {
+ __u64 l_object_id;
+ __u64 l_object_seq;
+ __u32 l_ost_gen;
+ __u32 l_ost_idx;
+ } __attribute__((packed));</screen>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>l_object_id</literal></para>
+ </entry>
+ <entry>
+ <para>Holds the OST's object ID.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>l_object_seq</literal></para>
+ </entry>
+ <entry>
+ <para>Holds the OST's object group.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>l_ost_gen</literal></para>
+ </entry>
+ <entry>
+ <para>Holds the OST's index generation.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>l_ost_idx</literal></para>
+ </entry>
+ <entry>
+ <para>Holds the OST's index in LOV.</para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </section>
+ <section remap="h5">
+ <title>Return Values</title>
+ <para><literal>llapi_file_get_stripe()</literal> returns:</para>
+ <para><literal>0</literal> On success</para>
+ <para><literal>!= 0</literal> On failure, <literal>errno</literal> is set appropriately</para>
+ </section>
+ <section remap="h5">
+ <title>Errors</title>
+ <informaltable frame="all">
+ <tgroup cols="2">
+ <colspec colname="c1" colwidth="50*"/>
+ <colspec colname="c2" colwidth="50*"/>
+ <thead>
+ <row>
+ <entry>
+ <para><emphasis role="bold">Errors</emphasis></para>
+ </entry>
+ <entry>
+ <para><emphasis role="bold">Description</emphasis></para>
+ </entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <para> <literal>ENOMEM</literal></para>
+ </entry>
+ <entry>
+ <para>Failed to allocate memory</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>ENAMETOOLONG</literal></para>
+ </entry>
+ <entry>
+ <para>Path was too long</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>ENOENT</literal></para>
+ </entry>
+ <entry>
+ <para>Path does not point to a file or directory</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>ENOTTY</literal></para>
+ </entry>
+ <entry>
+ <para>Path does not point to a Lustre file system</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>EFAULT</literal></para>
+ </entry>
+ <entry>
+ <para>Memory region pointed by lum is not properly mapped</para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </section>
+ <section remap="h5">
+ <title>Examples</title>
+ <programlisting>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <lustre/lustreapi.h>
+
static inline int maxint(int a, int b)
{
-return a > b ? a : b;
+ return a > b ? a : b;
}
static void *alloc_lum()
{
-int v1, v3, join;
-v1 = sizeof(struct lov_user_md_v1) +
-LOV_MAX_STRIPE_COUNT * sizeof(struct lov_user_ost_data_v1);
-v3 = sizeof(struct lov_user_md_v3) +
-LOV_MAX_STRIPE_COUNT * sizeof(struct lov_user_ost_data_v1);
-return malloc(maxint(v1, v3));
+ int v1, v3, join;
+ v1 = sizeof(struct lov_user_md_v1) +
+ LOV_MAX_STRIPE_COUNT * sizeof(struct lov_user_ost_data_v1);
+ v3 = sizeof(struct lov_user_md_v3) +
+ LOV_MAX_STRIPE_COUNT * sizeof(struct lov_user_ost_data_v1);
+ return malloc(maxint(v1, v3));
}
int main(int argc, char** argv)
{
-struct lov_user_md *lum_file = NULL;
-int rc;
-int lum_size;
-if (argc != 2) {
-fprintf(stderr, "Usage: %s <filename>\n", argv[0]);
-return 1;
-}
-lum_file = alloc_lum();
-if (lum_file == NULL) {
-rc = ENOMEM;
-goto cleanup;
-}
-rc = llapi_file_get_stripe(argv[1], lum_file);
-if (rc) {
-rc = errno;
-goto cleanup;
-}
-/* stripe_size stripe_count */
-printf("%d %d\n",
-lum_file->lmm_stripe_size,
-lum_file->lmm_stripe_count);
+ struct lov_user_md *lum_file = NULL;
+ int rc;
+ int lum_size;
+ if (argc != 2) {
+ fprintf(stderr, "Usage: %s <filename>\n", argv[0]);
+ return 1;
+ }
+ lum_file = alloc_lum();
+ if (lum_file == NULL) {
+ rc = ENOMEM;
+ goto cleanup;
+ }
+ rc = llapi_file_get_stripe(argv[1], lum_file);
+ if (rc) {
+ rc = errno;
+ goto cleanup;
+ }
+ /* stripe_size stripe_count */
+ printf("%d %d\n",
+ lum_file->lmm_stripe_size,
+ lum_file->lmm_stripe_count);
cleanup:
-if (lum_file != NULL)
-free(lum_file);
-return rc;
+ if (lum_file != NULL)
+ free(lum_file);
+ return rc;
}
-</screen>
- </section>
+</programlisting>
</section>
- <section xml:id="dbdoclet.50438215_86607">
- <title>34.3 llapi_file_open</title>
- <para>The llapi_file_open command opens (or creates) a file or device on a Lustre filesystem.</para>
- <section remap="h5">
- <title>Synopsis</title>
- <screen>#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <liblustre.h>
-#include <lustre/lustre_idl.h>
-#include <lustre/liblustreapi.h>
-#include <lustre/lustre_user.h>
+ </section>
+ <section xml:id="llapi_file_open">
+ <title>
+ <literal>llapi_file_open</literal>
+ </title>
+ <para>The <literal>llapi_file_open</literal> command opens (or creates) a file or device on a
+ Lustre file system.</para>
+ <section remap="h5">
+ <title>Synopsis</title>
+ <screen>#include <lustre/lustreapi.h>
int llapi_file_open(const char *<emphasis>name</emphasis>, int <emphasis>flags</emphasis>, int <emphasis>mode</emphasis>,
unsigned long long <emphasis>stripe_size</emphasis>, int <emphasis>stripe_offset</emphasis>,
int <emphasis>stripe_count</emphasis>, int <emphasis>stripe_pattern</emphasis>);
int <emphasis>stripe_offset</emphasis>, int <emphasis>stripe_count</emphasis>,
int <emphasis>stripe_pattern</emphasis>);
</screen>
- </section>
- <section remap="h5">
- <title>Description</title>
- <para>The llapi_file_create() call is equivalent to the llapi_file_open call with <emphasis>flags</emphasis> equal to O_CREAT|O_WRONLY and <emphasis>mode</emphasis> equal to 0644, followed by file close.</para>
- <para>llapi_file_open() opens a file with a given name on a Lustre filesystem.</para>
- <informaltable frame="all">
- <tgroup cols="2">
- <colspec colname="c1" colwidth="50*"/>
- <colspec colname="c2" colwidth="50*"/>
- <thead>
- <row>
- <entry><para><emphasis role="bold">Option</emphasis></para></entry>
- <entry><para><emphasis role="bold">Description</emphasis></para></entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><para> <emphasis role="bold">flags</emphasis></para></entry>
- <entry><para> Can be a combination of O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND, O_NONBLOCK, O_SYNC, FASYNC, O_DIRECT, O_LARGEFILE, O_DIRECTORY, O_NOFOLLOW, O_NOATIME.</para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">mode</emphasis></para></entry>
- <entry><para> Specifies the permission bits to be used for a new file when O_CREAT is used.</para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">stripe_size</emphasis></para></entry>
- <entry><para> Specifies stripe size (in bytes). Should be multiple of 64 KB, not exceeding 4 GB.</para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">stripe_offset</emphasis></para></entry>
- <entry><para> Specifies an OST index from which the file should start. The default value is -1.</para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">stripe_count</emphasis></para></entry>
- <entry><para> Specifies the number of OSTs to stripe the file across. The default value is -1.</para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">stripe_pattern</emphasis></para></entry>
- <entry><para> Specifies the striping pattern. In this version of Lustre, only LOV_PATTERN_RAID0 is available. The default value is 0.</para></entry>
- </row>
- </tbody>
- </tgroup>
- </informaltable>
- </section>
- <section remap="h5">
- <title>Return Values</title>
- <para>llapi_file_open() and llapi_file_create() return:</para>
- <para><emphasis role="bold">>=0</emphasis> On success, for llapi_file_open the return value is a file descriptor</para>
- <para><emphasis role="bold"><0</emphasis> On failure, the absolute value is an error code</para>
- </section>
- <section remap="h5">
- <title>Errors</title>
- <informaltable frame="all">
- <tgroup cols="2">
- <colspec colname="c1" colwidth="50*"/>
- <colspec colname="c2" colwidth="50*"/>
- <thead>
- <row>
- <entry><para><emphasis role="bold">Errors</emphasis></para></entry>
- <entry><para><emphasis role="bold">Description</emphasis></para></entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><para> <emphasis role="bold">EINVAL</emphasis></para></entry>
- <entry><para> <emphasis role="bold">stripe_size</emphasis> or <emphasis role="bold">stripe_offset</emphasis> or <emphasis role="bold">stripe_count</emphasis> or <emphasis role="bold">stripe_pattern</emphasis> is invalid.</para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">EEXIST</emphasis></para></entry>
- <entry><para> Striping information has already been set and cannot be altered; <emphasis role="bold">name</emphasis> already exists.</para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">EALREADY</emphasis></para></entry>
- <entry><para> Striping information has already been set and cannot be altered</para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">ENOTTY</emphasis></para></entry>
- <entry><para> <emphasis role="bold">name</emphasis> may not point to a Lustre filesystem.</para></entry>
- </row>
- </tbody>
- </tgroup>
- </informaltable>
- </section>
- <section remap="h5">
- <title>Example</title>
- <screen>#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
+ </section>
+ <section remap="h5">
+ <title>Description</title>
+ <para>The <literal>llapi_file_create()</literal> call is equivalent to the <literal>llapi_file_open</literal> call with <emphasis>flags</emphasis> equal to <literal>O_CREAT|O_WRONLY</literal> and <emphasis>mode</emphasis> equal to <literal>0644</literal>, followed by file close.</para>
+ <para><literal>llapi_file_open()</literal> opens a file with a given name on a Lustre file
+ system.</para>
+ <informaltable frame="all">
+ <tgroup cols="2">
+ <colspec colname="c1" colwidth="50*"/>
+ <colspec colname="c2" colwidth="50*"/>
+ <thead>
+ <row>
+ <entry>
+ <para><emphasis role="bold">Option</emphasis></para>
+ </entry>
+ <entry>
+ <para><emphasis role="bold">Description</emphasis></para>
+ </entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <para> <literal>flags</literal></para>
+ </entry>
+ <entry>
+ <para>Can be a combination of <literal>O_RDONLY</literal>, <literal>O_WRONLY</literal>, <literal>O_RDWR</literal>, <literal>O_CREAT</literal>, <literal>O_EXCL</literal>, <literal>O_NOCTTY</literal>, <literal>O_TRUNC</literal>, <literal>O_APPEND</literal>, <literal>O_NONBLOCK</literal>, <literal>O_SYNC</literal>, <literal>FASYNC</literal>, <literal>O_DIRECT</literal>, <literal>O_LARGEFILE</literal>, <literal>O_DIRECTORY</literal>, <literal>O_NOFOLLOW</literal>, <literal>O_NOATIME</literal>.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>mode</literal></para>
+ </entry>
+ <entry>
+ <para>Specifies the permission bits to be used for a new file when <literal>O_CREAT</literal> is used.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>stripe_size</literal></para>
+ </entry>
+ <entry>
+ <para>Specifies stripe size (in bytes). Should be multiple of 64 KB, not exceeding 4 GB.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>stripe_offset</literal></para>
+ </entry>
+ <entry>
+ <para>Specifies an OST index from which the file should start. The default value is -1.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>stripe_count</literal></para>
+ </entry>
+ <entry>
+ <para>Specifies the number of OSTs to stripe the file across. The default value is -1.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>stripe_pattern</literal></para>
+ </entry>
+ <entry>
+ <para>Specifies the striping pattern. In this release of the Lustre software, only
+ <literal>LOV_PATTERN_RAID0</literal> is available. The default value is
+ 0.</para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </section>
+ <section remap="h5">
+ <title>Return Values</title>
+ <para><literal>llapi_file_open()</literal> and <literal>llapi_file_create()</literal> return:</para>
+ <para><literal>>=0</literal> On success, for <literal>llapi_file_open</literal> the return value is a file descriptor</para>
+ <para><literal><0</literal> On failure, the absolute value is an error code</para>
+ </section>
+ <section remap="h5">
+ <title>Errors</title>
+ <informaltable frame="all">
+ <tgroup cols="2">
+ <colspec colname="c1" colwidth="50*"/>
+ <colspec colname="c2" colwidth="50*"/>
+ <thead>
+ <row>
+ <entry>
+ <para><emphasis role="bold">Errors</emphasis></para>
+ </entry>
+ <entry>
+ <para><emphasis role="bold">Description</emphasis></para>
+ </entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <para> <literal>EINVAL</literal></para>
+ </entry>
+ <entry>
+ <para><literal>stripe_size</literal> or <literal>stripe_offset</literal> or <literal>stripe_count</literal> or <literal>stripe_pattern</literal> is invalid.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>EEXIST</literal></para>
+ </entry>
+ <entry>
+ <para>Striping information has already been set and cannot be altered; <literal>name</literal> already exists.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>EALREADY</literal></para>
+ </entry>
+ <entry>
+ <para>Striping information has already been set and cannot be altered</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>ENOTTY</literal></para>
+ </entry>
+ <entry>
+ <para>
+ <literal>name</literal> may not point to a Lustre file system.</para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </section>
+ <section remap="h5">
+ <title>Example</title>
+ <programlisting>
#include <stdio.h>
-#include <liblustre.h>
-#include <lustre/lustre_idl.h>
-#include <lustre/liblustreapi.h>
-#include <lustre/lustre_user.h>
+#include <lustre/lustreapi.h>
+
int main(int argc, char *argv[])
{
- int rc;
- if (argc != 2)
- return -1;
- rc = llapi_file_create(argv[1], 1048576, 0, 2, LOV_PATTERN_RAID0);
- if (rc < 0) {
- fprintf(stderr, "file creation has failed, %s\n", strerror\
-(-rc));
- return -1;
- }
- printf("%s with stripe size 1048576, striped across 2 OSTs,"
- " has been created!\n", argv[1]);
- return 0;
+ int rc;
+ if (argc != 2)
+ return -1;
+ rc = llapi_file_create(argv[1], 1048576, 0, 2, LOV_PATTERN_RAID0);
+ if (rc < 0) {
+ fprintf(stderr, "file creation has failed, %s\n", strerror(-rc));
+ return -1;
+ }
+ printf("%s with stripe size 1048576, striped across 2 OSTs,"
+ " has been created!\n", argv[1]);
+ return 0;
}
-</screen>
- </section>
+</programlisting>
</section>
- <section xml:id="dbdoclet.50438215_12433">
- <title>34.4 llapi_quotactl</title>
- <para>Use llapi_quotactl to manipulate disk quotas on a Lustre file system.</para>
- <section remap="h5">
- <title>Synopsis</title>
- <screen>#include <liblustre.h>
-#include <lustre/lustre_idl.h>
-#include <lustre/liblustreapi.h>
-#include <lustre/lustre_user.h>
+ </section>
+ <section xml:id="llapi_quotactl">
+ <title>
+ <literal>llapi_quotactl</literal>
+ </title>
+ <para>Use <literal>llapi_quotact</literal>l to manipulate disk quotas on a Lustre file system.</para>
+ <section remap="h5">
+ <title>Synopsis</title>
+ <screen>#include <lustre/lustreapi.h>
int llapi_quotactl(char" " *mnt," " struct if_quotactl" " *qctl)
struct if_quotactl {
};
struct obd_uuid {
char uuid[40];
-};
-</screen>
- </section>
- <section remap="h5">
- <title>Description</title>
- <para>The llapi_quotactl() command manipulates disk quotas on a Lustre file system mount. qc_cmd indicates a command to be applied to UID qc_id or GID qc_id.</para>
- <informaltable frame="all">
- <tgroup cols="2">
- <colspec colname="c1" colwidth="50*"/>
- <colspec colname="c2" colwidth="50*"/>
- <thead>
- <row>
- <entry><para><emphasis role="bold">Option</emphasis></para></entry>
- <entry><para><emphasis role="bold">Description</emphasis></para></entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><para> <emphasis role="bold">LUSTRE_Q_QUOTAON</emphasis></para></entry>
- <entry><para> Turns on quotas for a Lustre file system. <emphasis>qc_type</emphasis> is USRQUOTA, GRPQUOTA or UGQUOTA (both user and group quota). The quota files must exist. They are normally created with the llapi_quotacheck call. This call is restricted to the super user privilege.</para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">LUSTRE_Q_QUOTAOFF</emphasis></para></entry>
- <entry><para> Turns off quotas for a Lustre file system. <emphasis>qc_type</emphasis> is USRQUOTA, GRPQUOTA or UGQUOTA (both user and group quota). This call is restricted to the super user privilege.</para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">LUSTRE_Q_GETQUOTA</emphasis></para></entry>
- <entry><para> Gets disk quota limits and current usage for user or group <emphasis>qc_id</emphasis>. <emphasis>qc_type</emphasis> is USRQUOTA or GRPQUOTA. <emphasis>uuid</emphasis> may be filled with OBD UUID string to query quota information from a specific node. <emphasis>dqb_valid</emphasis> may be set nonzero to query information only from MDS. If <emphasis>uuid</emphasis> is an empty string and <emphasis>dqb_valid</emphasis> is zero then cluster-wide limits and usage are returned. On return, <emphasis>obd_dqblk</emphasis> contains the requested information (block limits unit is kilobyte). Quotas must be turned on before using this command.</para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">LUSTRE_Q_SETQUOTA</emphasis></para></entry>
- <entry><para> Sets disk quota limits for user or group <emphasis>qc_id</emphasis>. <emphasis>qc_type</emphasis> is USRQUOTA or GRPQUOTA. <emphasis>dqb_valid</emphasis> must be set to QIF_ILIMITS, QIF_BLIMITS or QIF_LIMITS (both inode limits and block limits) dependent on updating limits. <emphasis>obd_dqblk</emphasis> must be filled with limits values (as set in <emphasis>dqb_valid</emphasis>, block limits unit is kilobyte). Quotas must be turned on before using this command.</para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">LUSTRE_Q_GETINFO</emphasis></para></entry>
- <entry><para> Gets information about quotas. <emphasis>qc_type</emphasis> is either USRQUOTA or GRPQUOTA. On return, <emphasis>dqi_igrace</emphasis> is inode grace time (in seconds), <emphasis>dqi_bgrace</emphasis> is block grace time (in seconds), <emphasis>dqi_flags</emphasis> is not used by the current Lustre version.</para></entry>
- </row>
- <row>
- <entry><para> <emphasis role="bold">LUSTRE_Q_SETINFO</emphasis></para></entry>
- <entry><para> Sets quota information (like grace times). <emphasis>qc_type</emphasis> is either USRQUOTA or GRPQUOTA. <emphasis>dqi_igrace</emphasis> is inode grace time (in seconds), <emphasis>dqi_bgrace</emphasis> is block grace time (in seconds), <emphasis>dqi_flags</emphasis> is not used by the current Lustre version and must be zeroed.</para></entry>
- </row>
- </tbody>
- </tgroup>
- </informaltable>
- </section>
+};</screen>
+ </section>
+ <section remap="h5">
+ <title>Description</title>
+ <para>The <literal>llapi_quotactl()</literal> command manipulates disk quotas on a Lustre file system mount. qc_cmd indicates a command to be applied to UID <literal>qc_id</literal> or GID <literal>qc_id</literal>.</para>
+ <informaltable frame="all">
+ <tgroup cols="2">
+ <colspec colname="c1" colwidth="50*"/>
+ <colspec colname="c2" colwidth="50*"/>
+ <thead>
+ <row>
+ <entry>
+ <para><emphasis role="bold">Option</emphasis></para>
+ </entry>
+ <entry>
+ <para><emphasis role="bold">Description</emphasis></para>
+ </entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <para> <literal>LUSTRE_Q_GETQUOTA</literal></para>
+ </entry>
+ <entry>
+ <para>Gets disk quota limits and current usage for user or group <emphasis>qc_id</emphasis>. <emphasis>qc_type</emphasis> is <literal>USRQUOTA</literal> or <literal>GRPQUOTA</literal>. <emphasis>uuid</emphasis> may be filled with <literal>OBD UUID</literal> string to query quota information from a specific node. <emphasis>dqb_valid</emphasis> may be set nonzero to query information only from MDS. If <emphasis>uuid</emphasis> is an empty string and <emphasis>dqb_valid</emphasis> is zero then cluster-wide limits and usage are returned. On return, <emphasis>obd_dqblk</emphasis> contains the requested information (block limits unit is kilobyte). Quotas must be turned on before using this command.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>LUSTRE_Q_SETQUOTA</literal></para>
+ </entry>
+ <entry>
+ <para>Sets disk quota limits for user or group <emphasis>qc_id</emphasis>. <emphasis>qc_type</emphasis> is <literal>USRQUOTA</literal> or <literal>GRPQUOTA</literal>. <emphasis>dqb_valid</emphasis> must be set to <literal>QIF_ILIMITS</literal>, <literal>QIF_BLIMITS</literal> or <literal>QIF_LIMITS</literal> (both inode limits and block limits) dependent on updating limits. <emphasis>obd_dqblk</emphasis> must be filled with limits values (as set in <emphasis>dqb_valid</emphasis>, block limits unit is kilobyte). Quotas must be turned on before using this command.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>LUSTRE_Q_GETINFO</literal></para>
+ </entry>
+ <entry>
+ <para>Gets information about quotas. <emphasis>qc_type</emphasis> is either
+ <literal>USRQUOTA</literal> or <literal>GRPQUOTA</literal>. On return,
+ <emphasis>dqi_igrace</emphasis> is inode grace time (in seconds),
+ <emphasis>dqi_bgrace</emphasis> is block grace time (in seconds),
+ <emphasis>dqi_flags</emphasis> is not used by the current release of the Lustre
+ software.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>LUSTRE_Q_SETINFO</literal></para>
+ </entry>
+ <entry>
+ <para>Sets quota information (like grace times). <emphasis>qc_type</emphasis> is
+ either <literal>USRQUOTA</literal> or <literal>GRPQUOTA</literal>.
+ <emphasis>dqi_igrace</emphasis> is inode grace time (in seconds),
+ <emphasis>dqi_bgrace</emphasis> is block grace time (in seconds),
+ <emphasis>dqi_flags</emphasis> is not used by the current release of the Lustre
+ software and must be zeroed.</para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </section>
+ <section remap="h5">
+ <title>Return Values</title>
+ <para><literal>llapi_quotactl()</literal> returns:</para>
+ <para><literal>0</literal> On success</para>
+ <para><literal> -1 </literal> On failure and sets error number (<literal>errno</literal>) to indicate the error</para>
+ </section>
+ <section remap="h5">
+ <title>Errors</title>
+ <para><literal>llapi_quotactl</literal> errors are described below.</para>
+ <informaltable frame="all">
+ <tgroup cols="2">
+ <colspec colname="c1" colwidth="50*"/>
+ <colspec colname="c2" colwidth="50*"/>
+ <thead>
+ <row>
+ <entry>
+ <para><emphasis role="bold">Errors</emphasis></para>
+ </entry>
+ <entry>
+ <para><emphasis role="bold">Description</emphasis></para>
+ </entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <para> <literal>EFAULT</literal></para>
+ </entry>
+ <entry>
+ <para><emphasis>qctl</emphasis> is invalid.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>ENOSYS</literal></para>
+ </entry>
+ <entry>
+ <para>Kernel or Lustre modules have not been compiled with the <literal>QUOTA</literal> option.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>ENOMEM</literal></para>
+ </entry>
+ <entry>
+ <para>Insufficient memory to complete operation.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>ENOTTY</literal></para>
+ </entry>
+ <entry>
+ <para> <emphasis>qc_cmd</emphasis> is invalid.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>ENOENT</literal></para>
+ </entry>
+ <entry>
+ <para> <emphasis>uuid</emphasis> does not correspond to OBD or <emphasis>mnt</emphasis> does not exist.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>EPERM</literal></para>
+ </entry>
+ <entry>
+ <para>The call is privileged and the caller is not the super user.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>ESRCH</literal></para>
+ </entry>
+ <entry>
+ <para>No disk quota is found for the indicated user. Quotas have not been turned on for this file system.</para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </section>
+ </section>
+ <section xml:id="llapi_path2fid">
+ <title>
+ <literal>llapi_path2fid</literal>
+ </title>
+ <para>Use <literal>llapi_path2fid</literal> to get the FID from the pathname.</para>
+ <section remap="h5">
+ <title>Synopsis</title>
+ <screen>#include <lustre/lustreapi.h>
+
+int llapi_path2fid(const char *path, unsigned long long *seq, unsigned long *oid, unsigned long *ver)</screen>
+ </section>
+ <section remap="h5">
+ <title>Description</title>
+ <para>The <literal>llapi_path2fid</literal> function returns the FID (sequence : object ID : version) for the pathname.</para>
+ </section>
+ <section remap="h5">
+ <title>Return Values</title>
+ <para><literal>llapi_path2fid</literal> returns:</para>
+ <para><literal>0</literal> On success</para>
+ <para>non-zero value On failure</para>
+ </section>
+ </section>
+ <section condition="l29">
+ <title>
+ <literal>llapi_ladvise</literal>
+ </title>
+ <para>Use <literal>llapi_ladvise</literal> to give IO advice/hints on a
+ Lustre file to the server.</para>
<section remap="h5">
- <title>Return Values</title>
- <para>llapi_quotactl() returns:</para>
- <para><emphasis role="bold">0</emphasis> On success</para>
- <para><emphasis role="bold">-1</emphasis> On failure and sets error number (errno) to indicate the error</para>
+ <title>Synopsis</title>
+ <screen>
+#include <lustre/lustreapi.h>
+int llapi_ladvise(int fd, unsigned long long flags,
+ int num_advise, struct llapi_lu_ladvise *ladvise);
+
+struct llapi_lu_ladvise {
+ __u16 lla_advice; /* advice type */
+ __u16 lla_value1; /* values for different advice types */
+ __u32 lla_value2;
+ __u64 lla_start; /* first byte of extent for advice */
+ __u64 lla_end; /* last byte of extent for advice */
+ __u32 lla_value3;
+ __u32 lla_value4;
+};
+ </screen>
</section>
<section remap="h5">
- <title>Errors</title>
- <para>llapi_quotactl errors are described below.</para>
- <informaltable frame="all">
- <tgroup cols="2">
- <colspec colname="c1" colwidth="50*"/>
- <colspec colname="c2" colwidth="50*"/>
- <thead>
- <row>
- <entry><para><emphasis role="bold">Errors</emphasis></para></entry>
- <entry><para><emphasis role="bold">Description</emphasis></para></entry>
- </row>
- </thead>
- <tbody>
+ <title>Description</title>
+ <para>The <literal>llapi_ladvise</literal> function passes an array of
+ <emphasis>num_advise</emphasis> I/O hints (up to a maximum of
+ <emphasis>LAH_COUNT_MAX</emphasis> items) in ladvise for the file
+ descriptor <emphasis>fd</emphasis> from an application to one or more
+ Lustre servers. Optionally, <emphasis>flags</emphasis> can modify how
+ the advice will be processed via bitwise-or'd values:</para>
+ <itemizedlist>
+ <listitem>
+ <para><literal>LF_ASYNC</literal>: Clients return to userspace
+ immediately after submitting ladvise RPCs, leaving server threads to
+ handle the advices asynchronously.</para>
+ </listitem>
+ <listitem>
+ <para><literal>LF_UNSET</literal>: Unset/clear a previous advice
+ (Currently only supports LU_ADVISE_LOCKNOEXPAND).</para>
+ </listitem>
+ </itemizedlist>
+ <para>Each of the <emphasis>ladvise</emphasis> elements is an
+ <emphasis>llapi_lu_ladvise</emphasis> structure, which contains the
+ following fields:
+ <informaltable frame="all">
+ <tgroup cols="2">
+ <colspec colname="c1" colwidth="50*"/>
+ <colspec colname="c2" colwidth="50*"/>
+ <thead>
+ <row>
+ <entry>
+ <para><emphasis role="bold">Field</emphasis></para>
+ </entry>
+ <entry>
+ <para><emphasis role="bold">Description</emphasis></para>
+ </entry>
+ </row>
+ </thead>
+ <tbody>
<row>
- <entry><para> <emphasis role="bold">EFAULT</emphasis></para></entry>
- <entry><para> <emphasis>qctl</emphasis> is invalid.</para></entry>
+ <entry>
+ <para> <literal>lla_ladvice</literal></para>
+ </entry>
+ <entry>
+ <para>Specifies the advice for the given file range, currently
+ one of:</para>
+ <para><literal>LU_LADVISE_WILLREAD</literal>: Prefetch data
+ into server cache using optimum I/O size for the server.</para>
+ <para><literal>LU_LADVISE_DONTNEED</literal>: Clean cached data
+ for the specified file range(s) on the server.</para>
+ </entry>
</row>
<row>
- <entry><para> <emphasis role="bold">ENOSYS</emphasis></para></entry>
- <entry><para> Kernel or Lustre modules have not been compiled with the QUOTA option.</para></entry>
+ <entry>
+ <para> <literal>lla_start</literal></para>
+ </entry>
+ <entry>
+ <para>The offset in bytes for the start of this advice.</para>
+ </entry>
</row>
<row>
- <entry><para> <emphasis role="bold">ENOMEM</emphasis></para></entry>
- <entry><para> Insufficient memory to complete operation.</para></entry>
+ <entry>
+ <para> <literal>lla_end</literal></para>
+ </entry>
+ <entry>
+ <para>The offset in bytes (non-inclusive) for the end of this
+ advice.</para>
+ </entry>
</row>
<row>
- <entry><para> <emphasis role="bold">ENOTTY</emphasis></para></entry>
- <entry><para> <emphasis>qc_cmd</emphasis> is invalid.</para></entry>
+ <entry>
+ <para> <literal>lla_value1</literal></para>
+ <para> <literal>lla_value2</literal></para>
+ <para> <literal>lla_value3</literal></para>
+ <para> <literal>lla_value4</literal></para>
+ </entry>
+ <entry>
+ <para>Additional arguments for future advice types and
+ should be set to zero if not explicitly required for a given
+ advice type. Advice-specific names for these fields
+ follow.</para>
+ </entry>
</row>
<row>
- <entry><para> <emphasis role="bold">EBUSY</emphasis></para></entry>
- <entry><para> Cannot process during quotacheck.</para></entry>
+ <entry>
+ <para> <literal>lla_lockahead_mode</literal></para>
+ </entry>
+ <entry>
+ <para>When using LU_ADVISE_LOCKAHEAD, the 'lla_value1' field
+ is used to communicate the requested lock mode, and can be
+ referred to as lla_lockahead_mode.</para>
+ </entry>
</row>
<row>
- <entry><para> <emphasis role="bold">ENOENT</emphasis></para></entry>
- <entry><para> <emphasis>uuid</emphasis> does not correspond to OBD or <emphasis>mnt</emphasis> does not exist.</para></entry>
+ <entry>
+ <para> <literal>lla_peradvice_flags</literal></para>
+ </entry>
+ <entry>
+ <para>When using advices which support them, the 'lla_value2'
+ field is used to communicate per-advice flags and can be
+ referred to as 'lla_peradvice_flags'. Both LF_ASYNC and
+ LF_UNSET are supported as peradvice flags.</para>
+ </entry>
</row>
<row>
- <entry><para> <emphasis role="bold">EPERM</emphasis></para></entry>
- <entry><para> The call is privileged and the caller is not the super user.</para></entry>
+ <entry>
+ <para> <literal>lla_lockahead_result</literal></para>
+ </entry>
+ <entry>
+ <para>When using LU_ADVISE_LOCKAHEAD, the 'lla_value3' field
+ is used to communicate the result of the request, and can be
+ referred to as lla_lockahead_result.</para>
+ </entry>
</row>
- <row>
- <entry><para> <emphasis role="bold">ESRCH</emphasis></para></entry>
- <entry><para> No disk quota is found for the indicated user. Quotas have not been turned on for this file system.</para></entry>
- </row>
- </tbody>
- </tgroup>
- </informaltable>
- </section>
- </section>
- <section xml:id="dbdoclet.50438215_15718">
- <title>34.5 llapi_path2fid</title>
- <para>Use llapi_path2fid to get the FID from the pathname.</para>
- <section remap="h5">
- <title>Synopsis</title>
- <screen>#include <lustre/liblustreapi.h>
-#include <lustre/lustre_user.h>
-
-int llapi_path2fid(const char *path, unsigned long long *seq, unsigned long\
- *oid, unsigned long *ver)
-</screen>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </para>
+ <para><literal>llapi_ladvise()</literal> forwards the advice to Lustre
+ servers without guaranteeing how and when servers will react to the
+ advice. Actions may or may not be triggered when the advices are
+ received, depending on the type of the advice as well as the real-time
+ decision of the affected server-side components.
+ </para>
+ <para> A typical usage of <literal>llapi_ladvise()</literal> is to
+ enable applications and users (via <literal>lfs ladvise</literal>)
+ with external knowledge about application I/O patterns to intervene in
+ server-side I/O handling. For example, if a group of different clients
+ are doing small random reads of a file, prefetching pages into OSS
+ cache with big linear reads before the random IO is an overall net
+ benefit. Fetching that data into each client cache with
+ <emphasis>fadvise()</emphasis> may not be beneficial, due to much more
+ data being sent to the clients.
+ </para>
+ <para>
+ LU_LADVISE_LOCKAHEAD merits a special comment. While it is possible
+ and encouraged to use it directly in your application to avoid lock
+ contention (primarily for writing to a single file from multiple
+ clients), it will also be available in the MPI-I/O / MPICH library
+ from ANL for use with the i/o aggregation mode of that library. This
+ is intended (eventually) to be the primary way this feature is used.
+ </para>
+ <para>
+ At the time of writing, this support is proposed as a patch but is
+ not yet merged in to the public ANL code base. Users are encouraged
+ to check their MPICH documentation and/or check with their library
+ provider about support.
+ </para>
+ <para>While conceptually similar to the
+ <emphasis>posix_fadvise</emphasis> and Linux
+ <emphasis>fadvise</emphasis> system calls, the main difference of
+ <literal>llapi_ladvise()</literal> is that
+ <emphasis>fadvise() / posix_fadvise()</emphasis> are client side
+ mechanisms that do not pass advice to the filesystem, while
+ <literal>llapi_ladvise()</literal> sends advice or hints to one or
+ more Lustre servers on which the file is stored. In some cases it may
+ be desirable to use both interfaces.
+ </para>
</section>
<section remap="h5">
- <title>Description</title>
- <para>The llapi_path2fid function returns the FID (sequence : object ID : version) for the pathname.</para>
+ <title>Return Values</title>
+ <para><literal>llapi_ladvise</literal> returns:</para>
+ <para><literal>0</literal> On success</para>
+ <para><literal>-1</literal> if an error occurred (in which case, errno
+ is set appropriately).</para>
</section>
<section remap="h5">
- <title>Return Values</title>
- <para>llapi_path2fid returns:</para>
- <para><emphasis role="bold">0</emphasis> On success</para>
- <para>non-zero value On failure</para>
+ <title>Errors</title>
+ <para>
+ <informaltable frame="all">
+ <tgroup cols="2">
+ <colspec colname="c1" colwidth="50*"/>
+ <colspec colname="c2" colwidth="50*"/>
+ <thead>
+ <row>
+ <entry>
+ <para><emphasis role="bold">Error</emphasis></para>
+ </entry>
+ <entry>
+ <para><emphasis role="bold">Description</emphasis></para>
+ </entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <para> <literal>ENOMEM</literal></para>
+ </entry>
+ <entry>
+ <para>Insufficient memory to complete operation.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>EINVAL</literal></para>
+ </entry>
+ <entry>
+ <para>One or more invalid arguments are given.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>EFAULT</literal></para>
+ </entry>
+ <entry>
+ <para>Memory region pointed by
+ <literal>ladvise</literal> is not properly mapped.
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para> <literal>ENOTSUPP</literal></para>
+ </entry>
+ <entry>
+ <para>Advice type is not supported.</para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </para>
</section>
- </section>
- <section xml:id="dbdoclet.50438215_marker-1297700">
- <title>34.6 Example Using the llapi Library</title>
- <para>Use llapi_file_create to set Lustre properties for a new file. For a synopsis and description of llapi_file_create and examples of how to use it, see <xref linkend="configurationfilesmoduleparameters"/>.</para>
- <para>You can set striping from inside programs like ioctl. To compile the sample program, you need to download libtest.c and liblustreapi.c files from the Lustre source tree.</para>
- <para><emphasis role="bold">A simple C program to demonstrate striping API - libtest.c</emphasis></para>
- <screen>/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ </section>
+ <section xml:id="example_using_llapi">
+ <title>Example Using the <literal>llapi</literal> Library</title>
+ <para>Use <literal>llapi_file_create</literal> to set Lustre software properties for a new file.
+ For a synopsis and description of <literal>llapi_file_create</literal> and examples of how to
+ use it, see <xref linkend="configurationfilesmoduleparameters"/>.</para>
+ <para>You can set striping from inside programs like <literal>ioctl</literal>. To compile the sample program, you need to install the Lustre client source RPM.</para>
+ <para><emphasis role="bold">A simple C program to demonstrate striping API - libtest.c</emphasis></para>
+ <programlisting>
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
* vim:expandtab:shiftwidth=8:tabstop=8:
*
- * lustredemo - simple code examples of liblustreapi functions
+ * lustredemo - a simple example of lustreapi functions
*/
-
#include <stdio.h>
#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
#include <dirent.h>
#include <errno.h>
-#include <string.h>
-#include <unistd.h>
#include <stdlib.h>
-#include <lustre/liblustreapi.h>
-#include <lustre/lustre_user.h>
+#include <lustre/lustreapi.h>
#define MAX_OSTS 1024
-#define LOV_EA_SIZE(lum, num) (sizeof(*lum) + num * sizeof(*lum->lmm_objects\
-))
+#define LOV_EA_SIZE(lum, num) (sizeof(*lum) + num * sizeof(*lum->lmm_objects))
#define LOV_EA_MAX(lum) LOV_EA_SIZE(lum, MAX_OSTS)
-
-/*
-This program provides crude examples of using the liblustre API functions
-*/
-
+
+/*
+ * This program provides crude examples of using the lustreapi API functions
+ */
/* Change these definitions to suit */
-
-#define TESTDIR "/tmp" /* R\
-esults directory */
-#define TESTFILE "lustre_dummy" \
- /* Name for the file we create/destroy */
-#define FILESIZE 262144 \
-/* Size of the file in words */
-#define DUMWORD "DEADBEEF" \
- /* Dummy word used to fill files */
-#define MY_STRIPE_WIDTH 2 \
-/* Set this to the number of OST required */
+
+#define TESTDIR "/tmp" /* Results directory */
+#define TESTFILE "lustre_dummy" /* Name for the file we create/destroy */
+#define FILESIZE 262144 /* Size of the file in words */
+#define DUMWORD "DEADBEEF" /* Dummy word used to fill files */
+#define MY_STRIPE_WIDTH 2 /* Set this to the number of OST required */
#define MY_LUSTRE_DIR "/mnt/lustre/ftest"
-
-
+
int close_file(int fd)
-{
- if (close(fd) < 0) {
- fprintf(stderr, "File close failed: %d (%s)\n", errno, strerror(er\
-rno));
- return -1;
- }
- return 0;
+{
+ if (close(fd) < 0) {
+ fprintf(stderr, "File close failed: %d (%s)\n", errno, strerror(errno));
+ return -1;
+ }
+ return 0;
}
-
+
int write_file(int fd)
{
- char *stng = DUMWORD;
- int cnt = 0;
-
- for( cnt = 0; cnt < FILESIZE; cnt++) {
+ char *stng = DUMWORD;
+ int cnt = 0;
+
+ for( cnt = 0; cnt < FILESIZE; cnt++) {
write(fd, stng, sizeof(stng));
- }
- return 0;
+ }
+ return 0;
}
/* Open a file, set a specific stripe count, size and starting OST
- Adjust the parameters to suit */
-
+ * Adjust the parameters to suit */
int open_stripe_file()
{
- char *tfile = TESTFILE;
- int stripe_size = 65536; \
- /* System default is 4M */
- int stripe_offset = -1; \
- /* Start at default */
- int stripe_count = MY_STRIPE_WIDTH; \
- /*Single stripe for this demo*/
- int stripe_pattern = 0; \
- /* only RAID 0 at this time */
- int rc, fd;
- /*
- */
- rc = llapi_file_create(tfile,
-stripe_size,stripe_offset,stripe_count,stripe_pattern);
- /* result code is inverted, we may return -EINVAL or an ioctl error.
- We borrow an error message from sanity.c
- */
- if (rc) {
- fprintf(stderr,"llapi_file_create failed: %d (%s) \n", rc, st\
-rerror(-rc));
+ char *tfile = TESTFILE;
+ int stripe_size = 65536; /* System default is 4M */
+ int stripe_offset = -1; /* Start at default */
+ int stripe_count = MY_STRIPE_WIDTH; /*Single stripe for this demo*/
+ int stripe_pattern = 0; /* only RAID 0 at this time */
+ int rc, fd;
+
+ rc = llapi_file_create(tfile,
+ stripe_size,stripe_offset,stripe_count,stripe_pattern);
+ /* result code is inverted, we may return -EINVAL or an ioctl error.
+ * We borrow an error message from sanity.c
+ */
+ if (rc) {
+ fprintf(stderr,"llapi_file_create failed: %d (%s) \n", rc, strerror(-rc));
return -1;
}
/* llapi_file_create closes the file descriptor, we must re-open */
fd = open(tfile, O_CREAT | O_RDWR | O_LOV_DELAY_CREATE, 0644);
if (fd < 0) {
- fprintf(stderr, "Can't open %s file: %d (%s)\n", tfile, errno\
-, strerror(errno));
- return -1;
+ fprintf(stderr, "Can't open %s file: %d (%s)\n", tfile, errno, strerror(errno));
+ return -1;
}
return fd;
}
-
+
/* output a list of uuids for this file */
int get_my_uuids(int fd)
{
- struct obd_uuid uuids[1024], *uuidp; \
- /* Output var */
- int obdcount = 1024;
- int rc,i;
-
- rc = llapi_lov_get_uuids(fd, uuids, &obdcount);
- if (rc != 0) {
- fprintf(stderr, "get uuids failed: %d (%s)\n",errno, strerror(errn\
-o));
+ struct obd_uuid uuids[1024], *uuidp; /* Output var */
+ int obdcount = 1024;
+ int rc,i;
+
+ rc = llapi_lov_get_uuids(fd, uuids, &obdcount);
+ if (rc != 0) {
+ fprintf(stderr, "get uuids failed: %d (%s)\n",errno, strerror(errno));
}
printf("This file system has %d obds\n", obdcount);
for (i = 0, uuidp = uuids; i < obdcount; i++, uuidp++) {
- printf("UUID %d is %s\n",i, uuidp->uuid);
+ printf("UUID %d is %s\n",i, uuidp->uuid);
}
return 0;
}
-
+
/* Print out some LOV attributes. List our objects */
int get_file_info(char *path)
{
-
- struct lov_user_md *lump;
- int rc;
- int i;
-
- lump = malloc(LOV_EA_MAX(lump));
- if (lump == NULL) {
- return -1;
+
+ struct lov_user_md *lump;
+ int rc;
+ int i;
+
+ lump = malloc(LOV_EA_MAX(lump));
+ if (lump == NULL) {
+ return -1;
}
-
+
rc = llapi_file_get_stripe(path, lump);
-
+
if (rc != 0) {
- fprintf(stderr, "get_stripe failed: %d (%s)\n",errno, strerror(err\
-no));
- return -1;
+ fprintf(stderr, "get_stripe failed: %d (%s)\n",errno, strerror(errno));
+ return -1;
}
-
- printf("Lov magic %u\n", lump->lmm_magic);
- printf("Lov pattern %u\n", lump->lmm_pattern);
- printf("Lov object id %llu\n", lump->lmm_object_id);
- printf("Lov object group %llu\n", lump->lmm_object_gr);
- printf("Lov stripe size %u\n", lump->lmm_stripe_size);
- printf("Lov stripe count %hu\n", lump->lmm_stripe_count);
- printf("Lov stripe offset %u\n", lump->lmm_stripe_offset);
- for (i = 0; i < lump->lmm_stripe_count; i++) {
- printf("Object index %d Objid %llu\n", lump->lmm_objects[i].l_ost_i\
-dx, lump->lmm_objects[i].l_object_id);
+
+ printf("Lov magic %u\n", lump->lmm_magic);
+ printf("Lov pattern %u\n", lump->lmm_pattern);
+ printf("Lov object id %llu\n", lump->lmm_object_id);
+ printf("Lov stripe size %u\n", lump->lmm_stripe_size);
+ printf("Lov stripe count %hu\n", lump->lmm_stripe_count);
+ printf("Lov stripe offset %u\n", lump->lmm_stripe_offset);
+ for (i = 0; i < lump->lmm_stripe_count; i++) {
+ printf("Object index %d Objid %llu\n", lump->lmm_objects[i].l_ost_idx, lump->lmm_objects[i].l_object_id);
}
-
-
- free(lump);
- return rc;
-
+
+ free(lump);
+ return rc;
+
}
-/* Ping all OSTs that belong to this filesysem */
-
+
+/* Ping all OSTs that belong to this filesystem */
int ping_osts()
{
- DIR *dir;
- struct dirent *d;
- char osc_dir[100];
- int rc;
-
- sprintf(osc_dir, "/proc/fs/lustre/osc");
- dir = opendir(osc_dir);
- if (dir == NULL) {
- printf("Can't open dir\n");
- return -1;
- }
- while((d = readdir(dir)) != NULL) {
- if ( d->d_type == DT_DIR ) {
- if (! strncmp(d->d_name, "OSC", 3)) {
- printf("Pinging OSC %s ", d->d_name);
- rc = llapi_ping("osc", d->d_name);
- if (rc) {
- printf(" bad\n");
- } else {
- printf(" good\n");
- }
- }
- }
- }
- return 0;
-
+ DIR *dir;
+ struct dirent *d;
+ char osc_dir[100];
+ int rc;
+
+ sprintf(osc_dir, "/proc/fs/lustre/osc");
+ dir = opendir(osc_dir);
+ if (dir == NULL) {
+ printf("Can't open dir\n");
+ return -1;
+ }
+ while((d = readdir(dir)) != NULL) {
+ if ( d->d_type == DT_DIR ) {
+ if (! strncmp(d->d_name, "OSC", 3)) {
+ printf("Pinging OSC %s ", d->d_name);
+ rc = llapi_ping("osc", d->d_name);
+ if (rc) {
+ printf(" bad\n");
+ } else {
+ printf(" good\n");
+ }
+ }
+ }
+ }
+ return 0;
+
}
-
+
int main()
{
- int file;
- int rc;
- char filename[100];
- char sys_cmd[100];
-
- sprintf(filename, "%s/%s",MY_LUSTRE_DIR, TESTFILE);
-
- printf("Open a file with striping\n");
- file = open_stripe_file();
- if ( file < 0 ) {
- printf("Exiting\n");
- exit(1);
-
-
-
-
- }
- printf("Getting uuid list\n");
- rc = get_my_uuids(file);
- rintf("Write to the file\n");
- rc = write_file(file);
- rc = close_file(file);
- printf("Listing LOV data\n");
- rc = get_file_info(filename);
- printf("Ping our OSTs\n");
- rc = ping_osts();
-
- /* the results should match lfs getstripe */
- printf("Confirming our results with lfs getsrtipe\n");
- sprintf(sys_cmd, "/usr/bin/lfs getstripe %s/%s", MY_LUSTRE_DIR, TESTFILE);
- system(sys_cmd);
-
- printf("All done\n");
- exit(rc);
-}
-</screen>
- <para><emphasis role="bold">Makefile for sample application:</emphasis></para>
- <screen>
+ int file;
+ int rc;
+ char filename[100];
+ char sys_cmd[100];
+
+ sprintf(filename, "%s/%s",MY_LUSTRE_DIR, TESTFILE);
+
+ printf("Open a file with striping\n");
+ file = open_stripe_file();
+ if ( file < 0 ) {
+ printf("Exiting\n");
+ exit(1);
+ }
+ printf("Getting uuid list\n");
+ rc = get_my_uuids(file);
+ printf("Write to the file\n");
+ rc = write_file(file);
+ rc = close_file(file);
+ printf("Listing LOV data\n");
+ rc = get_file_info(filename);
+ printf("Ping our OSTs\n");
+ rc = ping_osts();
+
+ /* the results should match lfs getstripe */
+ printf("Confirming our results with lfs getstripe\n");
+ sprintf(sys_cmd, "/usr/bin/lfs getstripe %s/%s", MY_LUSTRE_DIR, TESTFILE);
+ system(sys_cmd);
+
+ printf("All done\n");
+ exit(rc);
+}
+</programlisting>
+ <para><emphasis role="bold">Makefile for sample application:</emphasis></para>
+ <screen>
gcc -g -O2 -Wall -o lustredemo libtest.c -llustreapi
clean:
rm -f core lustredemo *.o
rm -f /mnt/lustre/ftest/lustre_dummy
cp lustredemo /mnt/lustre/ftest/
</screen>
- <section remap="h5">
- <title>See Also</title>
- <para>
- <xref linkend="dbdoclet.50438215_30970"/>llapi_file_create,
- <xref linkend="dbdoclet.50438215_50149"/>llapi_file_get_stripe,
- <xref linkend="dbdoclet.50438215_86607"/>llapi_file_open,
- <xref linkend="dbdoclet.50438215_12433"/>llapi_quotactl</para>
- </section>
+ <section remap="h5">
+ <title>See Also</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <xref linkend="llapi_file_create"/>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <xref linkend="llapi_file_get_stripe"/>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <xref linkend="llapi_file_open"/>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <xref linkend="llapi_quotactl"/>
+ </para>
+ </listitem>
+ </itemizedlist>
</section>
+ </section>
</chapter>
+<!--
+ vim:expandtab:shiftwidth=2:tabstop=8:
+ -->