Whamcloud - gitweb
LUDOC-394 manual: Remove extra 'held' word
[doc/manual.git] / ManagingFileSystemIO.xml
1 <?xml version='1.0' encoding='utf-8'?>
2 <chapter xmlns="http://docbook.org/ns/docbook"
3  xmlns:xl="http://www.w3.org/1999/xlink" version="5.0" xml:lang="en-US"
4  xml:id="managingfilesystemio">
5   <title xml:id="managingfilesystemio.title">Managing the File System and
6   I/O</title>
7   <section xml:id="handling_full_ost">
8     <title>
9     <indexterm>
10       <primary>I/O</primary>
11     </indexterm>
12     <indexterm>
13       <primary>I/O</primary>
14       <secondary>full OSTs</secondary>
15     </indexterm>Handling Full OSTs</title>
16     <para>Sometimes a Lustre file system becomes unbalanced, often due to
17     incorrectly-specified stripe settings, or when very large files are created
18     that are not striped over all of the OSTs. Lustre will automatically avoid
19     allocating new files on OSTs that are full. If an OST is completely full and
20     more data is written to files already located on that OST, an error occurs.
21     The procedures below describe how to handle a full OST.</para>
22     <para>The MDS will normally handle space balancing automatically at file
23     creation time, and this procedure is normally not needed, but manual data
24     migration may be desirable in some cases (e.g. creating very large files
25     that would consume more than the total free space of the full OSTs).</para>
26     <section remap="h3">
27       <title>
28       <indexterm>
29         <primary>I/O</primary>
30         <secondary>OST space usage</secondary>
31       </indexterm>Checking OST Space Usage</title>
32       <para>The example below shows an unbalanced file system:</para>
33       <screen>
34 client# lfs df -h
35 UUID                       bytes           Used            Available       \
36 Use%            Mounted on
37 testfs-MDT0000_UUID        4.4G            214.5M          3.9G            \
38 4%              /mnt/testfs[MDT:0]
39 testfs-OST0000_UUID        2.0G            751.3M          1.1G            \
40 37%             /mnt/testfs[OST:0]
41 testfs-OST0001_UUID        2.0G            755.3M          1.1G            \
42 37%             /mnt/testfs[OST:1]
43 testfs-OST0002_UUID        2.0G            1.7G            155.1M          \
44 86%             /mnt/testfs[OST:2] ****
45 testfs-OST0003_UUID        2.0G            751.3M          1.1G            \
46 37%             /mnt/testfs[OST:3]
47 testfs-OST0004_UUID        2.0G            747.3M          1.1G            \
48 37%             /mnt/testfs[OST:4]
49 testfs-OST0005_UUID        2.0G            743.3M          1.1G            \
50 36%             /mnt/testfs[OST:5]
51  
52 filesystem summary:        11.8G           5.4G            5.8G            \
53 45%             /mnt/testfs
54 </screen>
55       <para>In this case, OST0002 is almost full and when an attempt is made to
56       write additional information to the file system (even with uniform
57       striping over all the OSTs), the write command fails as follows:</para>
58       <screen>
59 client# lfs setstripe /mnt/testfs 4M 0 -1
60 client# dd if=/dev/zero of=/mnt/testfs/test_3 bs=10M count=100
61 dd: writing '/mnt/testfs/test_3': No space left on device
62 98+0 records in
63 97+0 records out
64 1017192448 bytes (1.0 GB) copied, 23.2411 seconds, 43.8 MB/s
65 </screen>
66     </section>
67     <section remap="h3">
68       <title>
69       <indexterm>
70         <primary>I/O</primary>
71         <secondary>disabling OST creates</secondary>
72       </indexterm>Disabling creates on a Full OST</title>
73       <para>To avoid running out of space in the file system, if the OST usage
74       is imbalanced and one or more OSTs are close to being full while there
75       are others that have a lot of space, the MDS will typically avoid file
76       creation on the full OST(s) automatically.  The full OSTs may optionally
77       be deactivated manually on the MDS to ensure the MDS will not allocate
78       new objects there.</para>
79       <orderedlist>
80         <listitem>
81           <para>Log into the MDS server and use the <literal>lctl</literal>
82           command to stop new object creation on the full OST(s):
83           </para>
84           <screen>
85 mds# lctl set_param osp.<replaceable>fsname</replaceable>-OST<replaceable>nnnn</replaceable>*.max_create_count=0
86 </screen>
87         </listitem>
88       </orderedlist>
89       <para>When new files are created in the file system, they will only use
90       the remaining OSTs. Either manual space rebalancing can be done by
91       migrating data to other OSTs, as shown in the next section, or normal
92       file deletion and creation can passively rebalance the space usage.</para>
93     </section>
94     <section remap="h3">
95       <title>
96       <indexterm>
97         <primary>I/O</primary>
98         <secondary>migrating data</secondary>
99       </indexterm>
100       <indexterm>
101         <primary>maintenance</primary>
102         <secondary>full OSTs</secondary>
103       </indexterm>Migrating Data within a File System</title>
104
105       <para>If there is a need to move the file data from the current
106       OST(s) to new OST(s), the data must be migrated (copied)
107       to the new location.  The simplest way to do this is to use the
108       <literal>lfs_migrate</literal> command, as described in
109       <xref linkend="lustremaint.adding_new_ost" />.</para>
110     </section>
111     <section remap="h3">
112       <title>
113       <indexterm>
114         <primary>I/O</primary>
115         <secondary>bringing OST online</secondary>
116       </indexterm>
117       <indexterm>
118         <primary>maintenance</primary>
119         <secondary>bringing OST online</secondary>
120       </indexterm>Returning an Inactive OST Back Online</title>
121       <para>Once the full OST(s) no longer are severely imbalanced, due
122       to either active or passive data redistribution, they should be
123       reactivated so they will again have new files allocated on them.</para>
124       <screen>
125 [mds]# lctl set_param osp.testfs-OST0002.max_create_count=20000
126 </screen>
127     </section>
128     <section remap="h3">
129       <title><indexterm>
130         <primary>migrating metadata</primary>
131       </indexterm>Migrating Metadata within a Filesystem</title>
132       <section remap="h3" condition='l28'>
133         <title><indexterm>
134           <primary>migrating metadata</primary>
135         </indexterm>Whole Directory Migration</title>
136         <para>Lustre software version 2.8 includes a feature
137           to migrate metadata (directories and inodes therein) between MDTs.
138           This migration can only be performed on whole directories. Striped
139           directories are not supported until Lustre 2.12. For example, to
140           migrate the contents of the <literal>/testfs/remotedir</literal>
141           directory from the MDT where it currently is located to MDT0000 to
142           allow that MDT to be removed, the sequence of commands is as follows:
143         </para>
144         <screen>$ cd /testfs
145 $ lfs getdirstripe -m ./remotedir <lineannotation>which MDT is dir on?</lineannotation>
146 1
147 $ touch ./remotedir/file.{1,2,3}.txt<lineannotation>create test files</lineannotation>
148 $ lfs getstripe -m ./remotedir/file.*.txt<lineannotation>check files are on MDT0001</lineannotation>
149 1
150 1
151 1
152 $ lfs migrate -m 0 ./remotedir <lineannotation>migrate testremote to MDT0000</lineannotation>
153 $ lfs getdirstripe -m ./remotedir <lineannotation>which MDT is dir on now?</lineannotation>
154 0
155 $ lfs getstripe -m ./remotedir/file.*.txt<lineannotation>check files are on MDT0000</lineannotation>
156 0
157 0
158 0</screen>
159         <para>For more information, see <literal>man lfs-migrate</literal>.
160         </para>
161          <warning><para>During migration each file receives a new identifier
162            (FID). As a consequence, the file will report a new inode number to
163            userspace applications. Some system tools (for example, backup and
164            archiving tools, NFS, Samba) that identify files by inode number may
165            consider the migrated files to be new, even though the contents are
166            unchanged.  If a Lustre system is re-exporting to NFS, the migrated
167            files may become inaccessible during and after migration if the
168            client or server are caching a stale file handle with the old FID.
169            Restarting the NFS service will flush the local file handle cache,
170            but clients may also need to be restarted as they may cache stale
171            file handles as well.
172         </para></warning>
173       </section>
174       <section remap="h3" condition='l2C'>
175         <title><indexterm>
176           <primary>migrating metadata</primary>
177         </indexterm>Striped Directory Migration</title>
178         <para>Lustre 2.8 included a feature to migrate metadata (directories
179           and inodes therein) between MDTs, however it did not support migration
180           of striped directories, or changing the stripe count of an existing
181           directory. Lustre 2.12 adds support for migrating and restriping
182           directories. The <literal>lfs migrate -m</literal> command can only
183           only be performed on whole directories, though it will migrate both
184           the specified directory and its sub-entries recursively.
185           For example, to migrate the contents of a large directory
186           <literal>/testfs/largedir</literal> from its current location on
187           MDT0000 to MDT0001 and MDT0003, run the following command:</para>
188           <screen>$ lfs migrate -m 1,3 /testfs/largedir</screen>
189         <para>Metadata migration will migrate file dirent and inode to other
190           MDTs, but it won't touch file data.  During migration, directory and
191           its sub-files can be accessed like normal ones, though the same
192           warning above applies to tools that depend on the file inode number.
193           Migration may fail for various reasons such as MDS restart, or disk
194           full.  In those cases, some of the sub-files may have been migrated to
195           the new MDTs, while others are still on the original MDT.  The files
196           can be accessed normally. The same <literal>lfs migrate -m</literal>
197           command should be executed again when these issues are fixed to finish
198           this migration.  However, you cannot abort a failed migration, or
199           migrate to different MDTs from previous migration command.</para>
200       </section>
201       <section remap="h3" condition='l2C'>
202         <title><indexterm>
203           <primary>migrating metadata</primary>
204         </indexterm>Directory Restriping</title>
205         <para>Lustre 2.14 includs a feature to change the stripe count of an
206           existing directory. The <literal>lfs setdirstripe -c</literal> command
207           can be performed on an existing directory to change its stripe count.
208           For example, a directory <literal>/testfs/testdir</literal> is becoming
209           large, run the following command to increase its stripe count to
210           <literal>2</literal>:</para>
211           <screen>$ lfs setdirstripe -c 2 /testfs/testdir</screen>
212         <para>By default directory restriping will migrate sub-file dirents only,
213           but it won't move inodes. To enable moving both dirents and inodes, run
214           the following command on all MDS's:</para>
215           <screen>mds$ lctl set_param mdt.*.dir_restripe_nsonly=0</screen>
216         <para>It's not allowed to specify MDTs in directory restriping, instead
217           server will pick MDTs for the added stripes by space and inode usages.
218           During restriping, directory and its sub-files can be accessed like
219           normal ones, which is the same as directory migration. Similarly you
220           cannot abort a failed restriping, and server will resume the failed
221           restriping automatically when it notices an unfinished restriping.</para>
222       </section>
223       <section remap="h3" condition='l2C'>
224         <title><indexterm>
225           <primary>migrating metadata</primary>
226         </indexterm>Directory Auto-Split</title>
227         <para>Lustre 2.14 includs a feature to automatically increase the stripe
228           count of a directory when it becomes large. This can be enabled by the
229           following command:</para>
230           <screen>mds$ lctl set_param mdt.*.enable_dir_auto_split=1</screen>
231         <para>The sub file count that triggers directory auto-split is 50k, and
232           it can be changed by the following command:</para>
233           <screen>mds$ lctl set_param mdt.*.dir_split_count=value</screen>
234         <para>The directory stripe count will be increased from 0 to 4 if it's a
235           plain directory, and from 4 to 8 upon the second split, and so on.
236           However the final stripe count won't exceed total MDT count, and it will
237           stop splitting when it's distributed among all MDTs. This delta value
238           can be changed by the following command:</para>
239           <screen>mds$ lctl set_param mdt.*.dir_split_delta=value</screen>
240       </section>
241     </section>
242   </section>
243   <section xml:id="managingfilesystemio.managing_ost_pools">
244     <title>
245     <indexterm>
246       <primary>I/O</primary>
247       <secondary>pools</secondary>
248     </indexterm>
249     <indexterm>
250       <primary>maintenance</primary>
251       <secondary>pools</secondary>
252     </indexterm>
253     <indexterm>
254       <primary>pools</primary>
255     </indexterm>Creating and Managing OST Pools</title>
256     <para>The OST pools feature enables users to group OSTs together to make
257     object placement more flexible. A 'pool' is the name associated with an
258     arbitrary subset of OSTs in a Lustre cluster.</para>
259     <para>OST pools follow these rules:</para>
260     <itemizedlist>
261       <listitem>
262         <para>An OST can be a member of multiple pools.</para>
263       </listitem>
264       <listitem>
265         <para>No ordering of OSTs in a pool is defined or implied.</para>
266       </listitem>
267       <listitem>
268         <para>Stripe allocation within a pool follows the same rules as the
269         normal stripe allocator.</para>
270       </listitem>
271       <listitem>
272         <para>OST membership in a pool is flexible, and can change over
273         time.</para>
274       </listitem>
275     </itemizedlist>
276     <para>When an OST pool is defined, it can be used to allocate files. When
277     file or directory striping is set to a pool, only OSTs in the pool are
278     candidates for striping. If a stripe_index is specified which refers to an
279     OST that is not a member of the pool, an error is returned.</para>
280     <para>OST pools are used only at file creation. If the definition of a pool
281     changes (an OST is added or removed or the pool is destroyed),
282     already-created files are not affected.</para>
283     <note>
284       <para>An error (
285       <literal>EINVAL</literal>) results if you create a file using an empty
286       pool.</para>
287     </note>
288     <note>
289       <para>If a directory has pool striping set and the pool is subsequently
290       removed, the new files created in this directory have the (non-pool)
291       default striping pattern for that directory applied and no error is
292       returned.</para>
293     </note>
294     <section remap="h3">
295       <title>Working with OST Pools</title>
296       <para>OST pools are defined in the configuration log on the MGS. Use the
297       lctl command to:</para>
298       <itemizedlist>
299         <listitem>
300           <para>Create/destroy a pool</para>
301         </listitem>
302         <listitem>
303           <para>Add/remove OSTs in a pool</para>
304         </listitem>
305         <listitem>
306           <para>List pools and OSTs in a specific pool</para>
307         </listitem>
308       </itemizedlist>
309       <para>The lctl command MUST be run on the MGS. Another requirement for
310       managing OST pools is to either have the MDT and MGS on the same node or
311       have a Lustre client mounted on the MGS node, if it is separate from the
312       MDS. This is needed to validate the pool commands being run are
313       correct.</para>
314       <caution>
315         <para>Running the 
316         <literal>writeconf</literal> command on the MDS erases all pools
317         information (as well as any other parameters set using 
318         <literal>lctl conf_param</literal>). We recommend that the pools
319         definitions (and 
320         <literal>conf_param</literal> settings) be executed using a script, so
321         they can be reproduced easily after a 
322         <literal>writeconf</literal> is performed.</para>
323       </caution>
324       <para>To create a new pool, run:</para>
325       <screen>
326 mgs# lctl pool_new <replaceable>fsname</replaceable>.<replaceable>poolname</replaceable>
327 </screen>
328       <note>
329         <para>The pool name is an ASCII string up to 15 characters.</para>
330       </note>
331       <para>To add the named OST to a pool, run:</para>
332       <screen>
333 mgs# lctl pool_add <replaceable>fsname</replaceable>.<replaceable>poolname</replaceable> <replaceable>ost_list</replaceable>
334 </screen>
335       <para>Where:</para>
336       <itemizedlist>
337         <listitem>
338           <para>
339             <literal>
340             <replaceable>ost_list</replaceable>is 
341             <replaceable>fsname</replaceable>-OST
342             <replaceable>index_range</replaceable></literal>
343           </para>
344         </listitem>
345         <listitem>
346           <para>
347           <literal>
348           <replaceable>index_range</replaceable>is 
349           <replaceable>ost_index_start</replaceable>-
350           <replaceable>ost_index_end[,index_range]</replaceable></literal> or 
351           <literal>
352           <replaceable>ost_index_start</replaceable>-
353           <replaceable>ost_index_end/step</replaceable></literal></para>
354         </listitem>
355       </itemizedlist>
356       <para>If the leading 
357       <literal>
358         <replaceable>fsname</replaceable>
359       </literal> and/or ending 
360       <literal>_UUID</literal> are missing, they are automatically added.</para>
361       <para>For example, to add even-numbered OSTs to 
362       <literal>pool1</literal> on file system 
363       <literal>testfs</literal>, run a single command (
364       <literal>pool_add</literal>) to add many OSTs to the pool at one
365       time:</para>
366       <para>
367         <screen>
368 lctl pool_add testfs.pool1 OST[0-10/2]
369 </screen>
370       </para>
371       <note>
372         <para>Each time an OST is added to a pool, a new 
373         <literal>llog</literal> configuration record is created. For
374         convenience, you can run a single command.</para>
375       </note>
376       <para>To remove a named OST from a pool, run:</para>
377       <screen>
378 mgs# lctl pool_remove 
379 <replaceable>fsname</replaceable>.
380 <replaceable>poolname</replaceable> 
381 <replaceable>ost_list</replaceable>
382 </screen>
383       <para>To destroy a pool, run:</para>
384       <screen>
385 mgs# lctl pool_destroy 
386 <replaceable>fsname</replaceable>.
387 <replaceable>poolname</replaceable>
388 </screen>
389       <note>
390         <para>All OSTs must be removed from a pool before it can be
391         destroyed.</para>
392       </note>
393       <para>To list pools in the named file system, run:</para>
394       <screen>
395 mgs# lctl pool_list 
396 <replaceable>fsname|pathname</replaceable>
397 </screen>
398       <para>To list OSTs in a named pool, run:</para>
399       <screen>
400 lctl pool_list 
401 <replaceable>fsname</replaceable>.
402 <replaceable>poolname</replaceable>
403 </screen>
404       <section remap="h4">
405         <title>Using the lfs Command with OST Pools</title>
406         <para>Several lfs commands can be run with OST pools. Use the 
407         <literal>lfs setstripe</literal> command to associate a directory with
408         an OST pool. This causes all new regular files and directories in the
409         directory to be created in the pool. The lfs command can be used to
410         list pools in a file system and OSTs in a named pool.</para>
411         <para>To associate a directory with a pool, so all new files and
412         directories will be created in the pool, run:</para>
413         <screen>
414 client# lfs setstripe --pool|-p pool_name 
415 <replaceable>filename|dirname</replaceable> 
416 </screen>
417         <para>To set striping patterns, run:</para>
418         <screen>
419 client# lfs setstripe [--size|-s stripe_size] [--offset|-o start_ost]
420            [--stripe-count|-c stripe_count] [--overstripe-count|-C stripe_count]
421            [--pool|-p pool_name]
422            
423 <replaceable>dir|filename</replaceable>
424 </screen>
425         <note>
426           <para>If you specify striping with an invalid pool name, because the
427           pool does not exist or the pool name was mistyped, 
428           <literal>lfs setstripe</literal> returns an error. Run 
429           <literal>lfs pool_list</literal> to make sure the pool exists and the
430           pool name is entered correctly.</para>
431         </note>
432         <note>
433           <para>The 
434           <literal>--pool</literal> option for lfs setstripe is compatible with
435           other modifiers. For example, you can set striping on a directory to
436           use an explicit starting index.</para>
437         </note>
438       </section>
439     </section>
440     <section remap="h3">
441       <title>
442       <indexterm>
443         <primary>pools</primary>
444         <secondary>usage tips</secondary>
445       </indexterm>Tips for Using OST Pools</title>
446       <para>Here are several suggestions for using OST pools.</para>
447       <itemizedlist>
448         <listitem>
449           <para>A directory or file can be given an extended attribute (EA),
450           that restricts striping to a pool.</para>
451         </listitem>
452         <listitem>
453           <para>Pools can be used to group OSTs with the same technology or
454           performance (slower or faster), or that are preferred for certain
455           jobs. Examples are SATA OSTs versus SAS OSTs or remote OSTs versus
456           local OSTs.</para>
457         </listitem>
458         <listitem>
459           <para>A file created in an OST pool tracks the pool by keeping the
460           pool name in the file LOV EA.</para>
461         </listitem>
462       </itemizedlist>
463     </section>
464   </section>
465   <section xml:id="adding_ost">
466     <title>
467     <indexterm>
468       <primary>I/O</primary>
469       <secondary>adding an OST</secondary>
470     </indexterm>Adding an OST to a Lustre File System</title>
471     <para>To add an OST to existing Lustre file system:</para>
472     <orderedlist>
473       <listitem>
474         <para>Add a new OST by passing on the following commands, run:</para>
475         <screen>
476 oss# mkfs.lustre --fsname=testfs --mgsnode=mds16@tcp0 --ost --index=12 /dev/sda
477 oss# mkdir -p /mnt/testfs/ost12
478 oss# mount -t lustre /dev/sda /mnt/testfs/ost12
479 </screen>
480       </listitem>
481       <listitem>
482         <para>Migrate the data (possibly).</para>
483         <para>The file system is quite unbalanced when new empty OSTs are
484         added. New file creations are automatically balanced. If this is a
485         scratch file system or files are pruned at a regular interval, then no
486         further work may be needed. Files existing prior to the expansion can
487         be rebalanced with an in-place copy, which can be done with a simple
488         script.</para>
489         <para>The basic method is to copy existing files to a temporary file,
490         then move the temp file over the old one. This should not be attempted
491         with files which are currently being written to by users or
492         applications. This operation redistributes the stripes over the entire
493         set of OSTs.</para>
494         <para>A very clever migration script would do the following:</para>
495         <itemizedlist>
496           <listitem>
497             <para>Examine the current distribution of data.</para>
498           </listitem>
499           <listitem>
500             <para>Calculate how much data should move from each full OST to the
501             empty ones.</para>
502           </listitem>
503           <listitem>
504             <para>Search for files on a given full OST (using 
505             <literal>lfs getstripe</literal>).</para>
506           </listitem>
507           <listitem>
508             <para>Force the new destination OST (using 
509             <literal>lfs setstripe</literal>).</para>
510           </listitem>
511           <listitem>
512             <para>Copy only enough files to address the imbalance.</para>
513           </listitem>
514         </itemizedlist>
515       </listitem>
516     </orderedlist>
517     <para>If a Lustre file system administrator wants to explore this approach
518     further, per-OST disk-usage statistics can be found in the
519     <literal>osc.*.rpc_stats</literal> parameter file.</para>
520   </section>
521   <section xml:id="performing_directio">
522     <title>
523     <indexterm>
524       <primary>I/O</primary>
525       <secondary>direct</secondary>
526     </indexterm>Performing Direct I/O</title>
527     <para>The Lustre software supports the 
528     <literal>O_DIRECT</literal> flag to open.</para>
529     <para>Applications using the 
530     <literal>read()</literal> and 
531     <literal>write()</literal> calls must supply buffers aligned on a page
532     boundary (usually 4 K). If the alignment is not correct, the call returns 
533     <literal>-EINVAL</literal>. Direct I/O may help performance in cases where
534     the client is doing a large amount of I/O and is CPU-bound (CPU utilization
535     100%).</para>
536     <section remap="h3">
537       <title>Making File System Objects Immutable</title>
538       <para>An immutable file or directory is one that cannot be modified,
539       renamed or removed. To do this:</para>
540       <screen>
541 chattr +i 
542 <replaceable>file</replaceable>
543 </screen>
544       <para>To remove this flag, use 
545       <literal>chattr -i</literal></para>
546     </section>
547   </section>
548   <section xml:id="other_io_options">
549     <title>Other I/O Options</title>
550     <para>This section describes other I/O options, including checksums, and
551     the ptlrpcd thread pool.</para>
552     <section remap="h3">
553       <title>Lustre Checksums</title>
554       <para>To guard against network data corruption, a Lustre client can
555       perform two types of data checksums: in-memory (for data in client
556       memory) and wire (for data sent over the network). For each checksum
557       type, a 32-bit checksum of the data read or written on both the client
558       and server is computed, to ensure that the data has not been corrupted in
559       transit over the network. The 
560       <literal>ldiskfs</literal> backing file system does NOT do any persistent
561       checksumming, so it does not detect corruption of data in the OST file
562       system.</para>
563       <para>The checksumming feature is enabled, by default, on individual
564       client nodes. If the client or OST detects a checksum mismatch, then an
565       error is logged in the syslog of the form:</para>
566       <screen>
567 LustreError: BAD WRITE CHECKSUM: changed in transit before arrival at OST: \
568 from 192.168.1.1@tcp inum 8991479/2386814769 object 1127239/0 extent [10240\
569 0-106495]
570 </screen>
571       <para>If this happens, the client will re-read or re-write the affected
572       data up to five times to get a good copy of the data over the network. If
573       it is still not possible, then an I/O error is returned to the
574       application.</para>
575       <para>To enable both types of checksums (in-memory and wire), run:</para>
576       <screen>
577 lctl set_param llite.*.checksum_pages=1
578 </screen>
579       <para>To disable both types of checksums (in-memory and wire),
580       run:</para>
581       <screen>
582 lctl set_param llite.*.checksum_pages=0
583 </screen>
584       <para>To check the status of a wire checksum, run:</para>
585       <screen>
586 lctl get_param osc.*.checksums
587 </screen>
588       <section remap="h4">
589         <title>Changing Checksum Algorithms</title>
590         <para>By default, the Lustre software uses the adler32 checksum
591         algorithm, because it is robust and has a lower impact on performance
592         than crc32. The Lustre file system administrator can change the
593         checksum algorithm via 
594         <literal>lctl get_param</literal>, depending on what is supported in
595         the kernel.</para>
596         <para>To check which checksum algorithm is being used by the Lustre
597         software, run:</para>
598         <screen>
599 $ lctl get_param osc.*.checksum_type
600 </screen>
601         <para>To change the wire checksum algorithm, run:</para>
602         <screen>
603 $ lctl set_param osc.*.checksum_type=
604 <replaceable>algorithm</replaceable>
605 </screen>
606         <note>
607           <para>The in-memory checksum always uses the adler32 algorithm, if
608           available, and only falls back to crc32 if adler32 cannot be
609           used.</para>
610         </note>
611         <para>In the following example, the 
612         <literal>lctl get_param</literal> command is used to determine that the
613         Lustre software is using the adler32 checksum algorithm. Then the 
614         <literal>lctl set_param</literal> command is used to change the checksum
615         algorithm to crc32. A second 
616         <literal>lctl get_param</literal> command confirms that the crc32
617         checksum algorithm is now in use.</para>
618         <screen>
619 $ lctl get_param osc.*.checksum_type
620 osc.testfs-OST0000-osc-ffff81012b2c48e0.checksum_type=crc32 [adler]
621 $ lctl set_param osc.*.checksum_type=crc32
622 osc.testfs-OST0000-osc-ffff81012b2c48e0.checksum_type=crc32
623 $ lctl get_param osc.*.checksum_type
624 osc.testfs-OST0000-osc-ffff81012b2c48e0.checksum_type=[crc32] adler
625 </screen>
626       </section>
627     </section>
628     <section remap="h3">
629       <title>PtlRPC Client Thread Pool</title>
630       <para>The use of large SMP nodes for Lustre clients
631       requires significant parallelism within the kernel to avoid
632       cases where a single CPU would be 100% utilized and other CPUs would be
633       relativity idle. This is especially noticeable when a single thread
634       traverses a large directory.</para>
635       <para>The Lustre client implements a PtlRPC daemon thread pool, so that
636       multiple threads can be created to serve asynchronous RPC requests, even
637       if only a single userspace thread is running.  The number of ptlrpcd
638       threads spawned is controlled at module load time using module options.
639       By default two service threads are spawned per CPU socket.</para>
640       <para>One of the issues with thread operations is the cost of moving a
641       thread context from one CPU to another with the resulting loss of CPU
642       cache warmth. To reduce this cost, PtlRPC threads can be bound to a CPU.
643       However, if the CPUs are busy, a bound thread may not be able to respond
644       quickly, as the bound CPU may be busy with other tasks and the thread
645       must wait to schedule.</para>
646       <para>Because of these considerations, the pool of ptlrpcd threads can be
647       a mixture of bound and unbound threads. The system operator can balance
648       the thread mixture based on system size and workload.</para>
649       <section>
650         <title>ptlrpcd parameters</title>
651         <para>These parameters should be set in 
652         <literal>/etc/modprobe.conf</literal> or in the 
653         <literal>etc/modprobe.d</literal> directory, as options for the ptlrpc
654         module. 
655         <screen>
656 options ptlrpcd ptlrpcd_per_cpt_max=XXX
657 </screen></para>
658         <para>Sets the number of ptlrpcd threads created per socket.
659         The default if not specified is two threads per CPU socket, including
660         hyper-threaded CPUs. The lower bound is 2 threads per socket.
661         <screen>
662 options ptlrpcd ptlrpcd_bind_policy=[1-4]
663 </screen></para>
664         <para>Controls the binding of threads to CPUs. There are four policy
665         options.</para>
666         <itemizedlist>
667           <listitem>
668             <para>
669             <literal role="bold">
670             PDB_POLICY_NONE</literal>(ptlrpcd_bind_policy=1) All threads are
671             unbound.</para>
672           </listitem>
673           <listitem>
674             <para>
675             <literal role="bold">
676             PDB_POLICY_FULL</literal>(ptlrpcd_bind_policy=2) All threads
677             attempt to bind to a CPU.</para>
678           </listitem>
679           <listitem>
680             <para>
681             <literal role="bold">
682             PDB_POLICY_PAIR</literal>(ptlrpcd_bind_policy=3) This is the
683             default policy. Threads are allocated as a bound/unbound pair. Each
684             thread (bound or free) has a partner thread. The partnering is used
685             by the ptlrpcd load policy, which determines how threads are
686             allocated to CPUs.</para>
687           </listitem>
688           <listitem>
689             <para>
690             <literal role="bold">
691             PDB_POLICY_NEIGHBOR</literal>(ptlrpcd_bind_policy=4) Threads are
692             allocated as a bound/unbound pair. Each thread (bound or free) has
693             two partner threads.</para>
694           </listitem>
695         </itemizedlist>
696       </section>
697     </section>
698   </section>
699 </chapter>
700 <!--
701   vim:expandtab:shiftwidth=2:tabstop=8:
702   -->