Whamcloud - gitweb
Branch HEAD
authorbobijam <bobijam>
Thu, 22 Mar 2007 06:00:31 +0000 (06:00 +0000)
committerbobijam <bobijam>
Thu, 22 Mar 2007 06:00:31 +0000 (06:00 +0000)
b=10997
r=adilger

Description: lfs setstripe use optional parameters instead of postional parameters.

lustre/ChangeLog
lustre/doc/lfs.1
lustre/doc/lfs.lyx
lustre/tests/Makefile.am
lustre/tests/ll_getstripe_info.c [new file with mode: 0644]
lustre/tests/sanity.sh
lustre/utils/lfs.c

index 1200829..fd6b5f1 100644 (file)
@@ -245,6 +245,11 @@ Description: versioning check is incomplete
 Details    : Checking the version difference of client vs. server, report
              error if the gap is too big.
 
 Details    : Checking the version difference of client vs. server, report
              error if the gap is too big.
 
+Severity   : enhancement
+Bugzilla   : 10997
+Description: lfs setstripe use optional parameters instead of postional 
+             parameters.
+
 ------------------------------------------------------------------------------
 
 TBD         Cluster File Systems, Inc. <info@clusterfs.com>
 ------------------------------------------------------------------------------
 
 TBD         Cluster File Systems, Inc. <info@clusterfs.com>
index 959d7b5..bd673da 100644 (file)
@@ -13,7 +13,11 @@ lfs \- Lustre utility to create a file with specific striping pattern, find the
 .B lfs getstripe [--obd|-O <uuid>] [--quiet|-q] [--verbose|-v] 
               \fB[--recursive|-r] <dir/file>\fR
 .br
 .B lfs getstripe [--obd|-O <uuid>] [--quiet|-q] [--verbose|-v] 
               \fB[--recursive|-r] <dir/file>\fR
 .br
-.B lfs setstripe <filename> <stripe-size> <start-ost> <stripe-cnt>
+.B lfs setstripe <filename|dirname> <stripe-size> <start-ost> <stripe-cnt> 
+.br
+.B lfs setstripe <filename|dirname> [--size|-s stripe-size] [--index|-i start-ost] [--count|-c stripe-cnt]
+.br
+.B lfs setstripe -d <dirname>
 .br
 .B lfs quotachown [-i] <filesystem>
 .br
 .br
 .B lfs quotachown [-i] <filesystem>
 .br
@@ -28,8 +32,6 @@ lfs \- Lustre utility to create a file with specific striping pattern, find the
 .br
 .B lfs quota [-o obd_uuid] [-u|-g] <name> <filesystem>
 .br
 .br
 .B lfs quota [-o obd_uuid] [-u|-g] <name> <filesystem>
 .br
-.B lfs setstripe <filename> <stripe-size> <start-ost> <stripe-cnt>
-.br
 .B lfs check <mds| osts| servers>
 .br
 .B lfs df [-i] [-h] [path]
 .B lfs check <mds| osts| servers>
 .br
 .B lfs df [-i] [-h] [path]
@@ -90,6 +92,9 @@ Quit the interactive lfs session
 .B $ lfs setstripe /mnt/lustre/file1 131072 -1 2
 This creats a file striped on two OSTs with 128kB on each stripe.
 .TP
 .B $ lfs setstripe /mnt/lustre/file1 131072 -1 2
 This creats a file striped on two OSTs with 128kB on each stripe.
 .TP
+.B $ lfs setstripe -d /mnt/lustre/dir
+This deletes a default stripe pattern on dir. New files will use the default striping pattern created therein.
+.TP
 .B $ lfs find /mnt/lustre/file1
 Lists the object allocation of a given file
 .TP
 .B $ lfs find /mnt/lustre/file1
 Lists the object allocation of a given file
 .TP
index 3b4588f..a6f2ebb 100644 (file)
-#LyX 1.3 created this file. For more info see http://www.lyx.org/
-\lyxformat 221
+#LyX 1.4.4 created this file. For more info see http://www.lyx.org/
+\lyxformat 245
+\begin_document
+\begin_header
 \textclass amsart
 \language english
 \inputencoding auto
 \fontscheme times
 \graphics default
 \paperfontsize default
 \textclass amsart
 \language english
 \inputencoding auto
 \fontscheme times
 \graphics default
 \paperfontsize default
-\spacing single 
+\spacing single
 \papersize letterpaper
 \papersize letterpaper
-\paperpackage a4
-\use_geometry 0
-\use_amsmath 0
-\use_natbib 0
-\use_numerical_citations 0
+\use_geometry false
+\use_amsmath 1
+\cite_engine basic
+\use_bibtopic false
 \paperorientation portrait
 \secnumdepth 3
 \tocdepth 3
 \paragraph_separation skip
 \defskip medskip
 \quotes_language english
 \paperorientation portrait
 \secnumdepth 3
 \tocdepth 3
 \paragraph_separation skip
 \defskip medskip
 \quotes_language english
-\quotes_times 2
 \papercolumns 1
 \papersides 1
 \paperpagestyle default
 \papercolumns 1
 \papersides 1
 \paperpagestyle default
+\tracking_changes false
+\output_changes true
+\end_header
 
 
-\layout Section
+\begin_body
 
 
+\begin_layout Section
 LFS
 LFS
-\layout Subsection
+\end_layout
 
 
+\begin_layout Subsection
 NAME
 NAME
-\layout Description
+\end_layout
 
 
+\begin_layout Description
 lfs Lustre utility to create a file with specific striping pattern and manipulat
 e disk quotas
 lfs Lustre utility to create a file with specific striping pattern and manipulat
 e disk quotas
-\layout Subsection
+\end_layout
 
 
+\begin_layout Subsection
 SYNOPSIS
 SYNOPSIS
-\layout Standard
+\end_layout
 
 
+\begin_layout Standard
 
 
-\series bold 
+\series bold
 lfs
 lfs
-\layout Standard
+\end_layout
 
 
+\begin_layout Standard
 
 
-\series bold 
-lfs\SpecialChar ~
+\series bold
+lfs\InsetSpace ~
 find [--atime|-A N] [--mtime|-M N] [--ctime|-C N] [--maxdepth|-D N] [--print0
 |-P] [--print|-p] [--obd|-O <uuid>] <dir/file>
 find [--atime|-A N] [--mtime|-M N] [--ctime|-C N] [--maxdepth|-D N] [--print0
 |-P] [--print|-p] [--obd|-O <uuid>] <dir/file>
-\layout Standard
+\end_layout
 
 
+\begin_layout Standard
 
 
-\series bold 
-lfs\SpecialChar ~
+\series bold
+lfs\InsetSpace ~
 find [--quiet|-q] [--verbose|-v] [--recursive|-r] <dir/file>
 find [--quiet|-q] [--verbose|-v] [--recursive|-r] <dir/file>
-\layout Standard
+\end_layout
 
 
+\begin_layout Standard
 
 
-\series bold 
-lfs\SpecialChar ~
+\series bold
+lfs\InsetSpace ~
 getstripe [--obd|-O <uuid>] [--quiet|-q] [--verbose|-v] [--recursive|-r]
  <dir/file>
 getstripe [--obd|-O <uuid>] [--quiet|-q] [--verbose|-v] [--recursive|-r]
  <dir/file>
-\layout Standard
+\end_layout
 
 
+\begin_layout Standard
 
 
-\series bold 
-lfs\SpecialChar ~
+\series bold
+lfs\InsetSpace ~
 setstripe <filename|dirname> <stripe_size> <start_ost> <stripe_cnt>
 setstripe <filename|dirname> <stripe_size> <start_ost> <stripe_cnt>
-\layout Standard
+\end_layout
 
 
+\begin_layout Standard
 
 
-\series bold 
-lfs\SpecialChar ~
+\series bold
+lfs\InsetSpace \space{}
+setstripe <filename|dirname> [--size|-s stripe_size] [--index|-i start_ost]
+ [--count|-c stripe_cnt]
+\end_layout
+
+\begin_layout Standard
+
+\series bold
+lfs\InsetSpace ~
 setstripe -d <dirname>
 setstripe -d <dirname>
-\layout Standard
+\end_layout
 
 
+\begin_layout Standard
 
 
-\series bold 
-lfs\SpecialChar ~
+\series bold
+lfs\InsetSpace ~
 check <mds| osts| servers>
 check <mds| osts| servers>
-\layout Standard
+\end_layout
 
 
+\begin_layout Standard
 
 
-\series bold 
-lfs\SpecialChar ~
+\series bold
+lfs\InsetSpace ~
 quotachog [-i] <filesystem>
 quotachog [-i] <filesystem>
-\layout Standard
+\end_layout
 
 
+\begin_layout Standard
 
 
-\series bold 
-lfs\SpecialChar ~
+\series bold
+lfs\InsetSpace ~
 quotacheck [-ug] <filesystem>
 quotacheck [-ug] <filesystem>
-\layout Standard
+\end_layout
 
 
+\begin_layout Standard
 
 
-\series bold 
-lfs\SpecialChar ~
+\series bold
+lfs\InsetSpace ~
 quotaon [-ugf] <filesystem>
 quotaon [-ugf] <filesystem>
-\layout Standard
+\end_layout
 
 
+\begin_layout Standard
 
 
-\series bold 
-lfs\SpecialChar ~
+\series bold
+lfs\InsetSpace ~
 quotaoff [-ug] <filesystem>
 quotaoff [-ug] <filesystem>
-\layout Standard
+\end_layout
 
 
+\begin_layout Standard
 
 
-\series bold 
-lfs\SpecialChar ~
+\series bold
+lfs\InsetSpace ~
 setquota [-u|-g] <name> <block-softlimit> <block-hardlimit> <inode-softlimit>
  <inode-hardlimit> <filesystem>
 setquota [-u|-g] <name> <block-softlimit> <block-hardlimit> <inode-softlimit>
  <inode-hardlimit> <filesystem>
-\layout Standard
+\end_layout
 
 
+\begin_layout Standard
 
 
-\series bold 
-lfs\SpecialChar ~
+\series bold
+lfs\InsetSpace ~
 quota [-o obd_uuid] [-u|-g] <name> <filesystem>
 quota [-o obd_uuid] [-u|-g] <name> <filesystem>
-\layout Standard
+\end_layout
 
 
+\begin_layout Standard
 
 
-\series bold 
-lfs\SpecialChar ~
+\series bold
+lfs\InsetSpace ~
 df [-i] [-h] [path]
 df [-i] [-h] [path]
-\layout Standard
+\end_layout
 
 
+\begin_layout Standard
 
 
-\series bold 
-lfs\SpecialChar ~
+\series bold
+lfs\InsetSpace ~
 help
 help
-\layout Subsection
+\end_layout
 
 
+\begin_layout Subsection
 DESCRIPTION
 DESCRIPTION
-\layout Standard
+\end_layout
 
 
+\begin_layout Standard
 This utility can be used to create a new file with a specific striping pattern,
  determine the default striping pattern, gather the extended attributes
  (object numbers and location) for a specific file, and manipulate disk
  quotas.
  It can be invoked interactively without any arguments or in a non-interactive
  mode with one of the arguements listed and explained below:
 This utility can be used to create a new file with a specific striping pattern,
  determine the default striping pattern, gather the extended attributes
  (object numbers and location) for a specific file, and manipulate disk
  quotas.
  It can be invoked interactively without any arguments or in a non-interactive
  mode with one of the arguements listed and explained below:
-\layout List
-\labelwidthstring 00.00.0000
+\end_layout
 
 
+\begin_layout List
+\labelwidthstring 00.00.0000
 
 
-\series bold 
+\series bold
 setstripe
 setstripe
-\series default 
+\series default
  To create a new file with a specific striping pattern
  To create a new file with a specific striping pattern
-\layout List
-\labelwidthstring 00.00.0000
+\end_layout
 
 
+\begin_layout List
+\labelwidthstring 00.00.0000
 
 
-\series bold 
+\series bold
 find
 find
-\series default 
+\series default
  To search the directory tree rooted at the given dir/file name for the
  files that match the given parameters: --atime (file was last accessed
  N*24 hours ago), --ctime (file's status was last changed N*24 hours ago),
  To search the directory tree rooted at the given dir/file name for the
  files that match the given parameters: --atime (file was last accessed
  N*24 hours ago), --ctime (file's status was last changed N*24 hours ago),
@@ -164,293 +198,354 @@ find
  tree.
  The options --print and --print0 print full file name, followed by a newline
  and null character correspondingly.
  tree.
  The options --print and --print0 print full file name, followed by a newline
  and null character correspondingly.
-\layout List
-\labelwidthstring 00.00.0000
+\end_layout
 
 
+\begin_layout List
+\labelwidthstring 00.00.0000
 
 
-\series bold 
+\series bold
 find
 find
-\series default 
+\series default
  To list the striping info for a given filename or files in a directory
  or recursively for all files in a directory tree use one of the following
  options: [--quiet|-q] [--verbose|-v] [--recursive|-r].
  If one of these options is given find works in old (obsolete, please use
  getstripe instead) mode.
  
  To list the striping info for a given filename or files in a directory
  or recursively for all files in a directory tree use one of the following
  options: [--quiet|-q] [--verbose|-v] [--recursive|-r].
  If one of these options is given find works in old (obsolete, please use
  getstripe instead) mode.
  
-\layout List
-\labelwidthstring 00.00.0000
+\end_layout
 
 
+\begin_layout List
+\labelwidthstring 00.00.0000
 
 
-\series bold 
+\series bold
 getstripe
 getstripe
-\series default 
+\series default
  To list the striping info for given filename or files in a directory or
  recursively for all files in a directory tree.
  It can also be used to list the files that have objects on a specific OST.
  To list the striping info for given filename or files in a directory or
  recursively for all files in a directory tree.
  It can also be used to list the files that have objects on a specific OST.
-\layout List
-\labelwidthstring 00.00.0000
+\end_layout
 
 
+\begin_layout List
+\labelwidthstring 00.00.0000
 
 
-\series bold 
+\series bold
 check 
 check 
-\series default 
+\series default
 Display the status of MDS or OSTs (as specified in the command) or all the
  servers (MDS and OSTs)
 Display the status of MDS or OSTs (as specified in the command) or all the
  servers (MDS and OSTs)
-\layout List
-\labelwidthstring 00.00.0000
+\end_layout
 
 
+\begin_layout List
+\labelwidthstring 00.00.0000
 
 
-\series bold 
+\series bold
 osts
 osts
-\series default 
+\series default
  List all the OSTs for the filesystem
  List all the OSTs for the filesystem
-\layout List
-\labelwidthstring 00.00.0000
+\end_layout
 
 
+\begin_layout List
+\labelwidthstring 00.00.0000
 
 
-\series bold 
+\series bold
 quotachog
 quotachog
-\series default 
+\series default
  Change files' owner and group on OSTs of the specified filesystem
  Change files' owner and group on OSTs of the specified filesystem
-\layout List
-\labelwidthstring 00.00.0000
+\end_layout
 
 
+\begin_layout List
+\labelwidthstring 00.00.0000
 
 
-\series bold 
+\series bold
 quotacheck
 quotacheck
-\series default 
+\series default
  Scan the specified filesystem for disk usage, and create or update quota
  files
  Scan the specified filesystem for disk usage, and create or update quota
  files
-\layout List
-\labelwidthstring 00.00.0000
+\end_layout
 
 
+\begin_layout List
+\labelwidthstring 00.00.0000
 
 
-\series bold 
+\series bold
 quotaon
 quotaon
-\series default 
+\series default
  Turn filesystem quotas on
  Turn filesystem quotas on
-\layout List
-\labelwidthstring 00.00.0000
+\end_layout
 
 
+\begin_layout List
+\labelwidthstring 00.00.0000
 
 
-\series bold 
+\series bold
 quotaoff
 quotaoff
-\series default 
+\series default
  Turn filesystem quotas off
  Turn filesystem quotas off
-\layout List
-\labelwidthstring 00.00.0000
+\end_layout
 
 
+\begin_layout List
+\labelwidthstring 00.00.0000
 
 
-\series bold 
+\series bold
 setquota
 setquota
-\series default 
+\series default
  Set filesystem quotas
  Set filesystem quotas
-\layout List
-\labelwidthstring 00.00.0000
+\end_layout
 
 
+\begin_layout List
+\labelwidthstring 00.00.0000
 
 
-\series bold 
+\series bold
 quota
 quota
-\series default 
+\series default
  Display disk usage and limits
  Display disk usage and limits
-\layout List
-\labelwidthstring 00.00.0000
+\end_layout
 
 
+\begin_layout List
+\labelwidthstring 00.00.0000
 
 
-\series bold 
+\series bold
 df
 df
-\series default 
+\series default
  Report filesystem disk space usage or inodes usage of each MDS/OSD.
  Report filesystem disk space usage or inodes usage of each MDS/OSD.
-\layout List
-\labelwidthstring 00.00.0000
+\end_layout
 
 
+\begin_layout List
+\labelwidthstring 00.00.0000
 
 
-\series bold 
+\series bold
 help
 help
-\series default 
+\series default
  Provides brief help on the various arguments
  Provides brief help on the various arguments
-\layout List
-\labelwidthstring 00.00.0000
+\end_layout
 
 
+\begin_layout List
+\labelwidthstring 00.00.0000
 
 
-\series bold 
+\series bold
 exit/quit
 exit/quit
-\series default 
+\series default
  Quit the interactive lfs session
  Quit the interactive lfs session
-\layout Subsection
+\end_layout
 
 
+\begin_layout Subsection
 EXAMPLES
 EXAMPLES
-\layout Description
+\end_layout
 
 
+\begin_layout Description
 This creates a file striped on one OST
 This creates a file striped on one OST
-\layout LyX-Code
+\end_layout
 
 
+\begin_layout LyX-Code
    $ lfs setstripe /mnt/lustre/file1 131072 0 1
    $ lfs setstripe /mnt/lustre/file1 131072 0 1
-\layout Description
+\end_layout
 
 
+\begin_layout Description
 This creates a default stripe pattern on and existing dir for all new files
  created therein.
 This creates a default stripe pattern on and existing dir for all new files
  created therein.
-\layout LyX-Code
+\end_layout
 
 
+\begin_layout LyX-Code
    $ lfs setstripe /mnt/lustre/dir 131072 0 1
    $ lfs setstripe /mnt/lustre/dir 131072 0 1
-\layout Description
+\end_layout
 
 
+\begin_layout Description
 This deletes a default stripe pattern on dir.
   New files will use the default striping pattern.
  created therein.
 This deletes a default stripe pattern on dir.
   New files will use the default striping pattern.
  created therein.
-\layout LyX-Code
+\end_layout
 
 
+\begin_layout LyX-Code
    $ lfs setstripe -d /mnt/lustre/dir
    $ lfs setstripe -d /mnt/lustre/dir
-\layout Description
+\end_layout
 
 
+\begin_layout Description
 Listing the extended attributes of a given file
 Listing the extended attributes of a given file
-\layout LyX-Code
+\end_layout
 
 
+\begin_layout LyX-Code
    $ lfs find /mnt/lustre/foo1
    $ lfs find /mnt/lustre/foo1
-\layout LyX-Code
+\end_layout
 
 
+\begin_layout LyX-Code
    OBDS:    
    OBDS:    
-\layout LyX-Code
+\end_layout
 
 
+\begin_layout LyX-Code
       0: OST_localhost_UUID 
       0: OST_localhost_UUID 
-\layout LyX-Code
+\end_layout
 
 
+\begin_layout LyX-Code
    /mnt/lustre/foo1         
    /mnt/lustre/foo1         
-\layout LyX-Code
+\end_layout
 
 
+\begin_layout LyX-Code
    obdidx           objid          objid            group              
    obdidx           objid          objid            group              
-\layout LyX-Code
+\end_layout
 
 
+\begin_layout LyX-Code
    0                 1            0x1                0 
    0                 1            0x1                0 
-\layout Description
+\end_layout
 
 
+\begin_layout Description
 Listing the extended attributes of all files in a given directory
 Listing the extended attributes of all files in a given directory
-\layout LyX-Code
+\end_layout
 
 
+\begin_layout LyX-Code
    $ lfs find /mnt/lustre/
    $ lfs find /mnt/lustre/
-\layout Description
+\end_layout
 
 
+\begin_layout Description
 Recursively list the extended attributes of all files in a given directory
  tree
 Recursively list the extended attributes of all files in a given directory
  tree
-\layout LyX-Code
+\end_layout
 
 
+\begin_layout LyX-Code
    $ lfs find -r /mnt/lustre/
    $ lfs find -r /mnt/lustre/
-\layout Description
+\end_layout
 
 
+\begin_layout Description
 List all the files that have objects on a specific OST
 List all the files that have objects on a specific OST
-\layout LyX-Code
+\end_layout
 
 
+\begin_layout LyX-Code
    $ lfs find -r --obd OST2_UUID /mnt/lustre/
    $ lfs find -r --obd OST2_UUID /mnt/lustre/
-\layout Description
+\end_layout
 
 
+\begin_layout Description
 Check the status of all servers(mds, osts)
 Check the status of all servers(mds, osts)
-\layout LyX-Code
+\end_layout
 
 
+\begin_layout LyX-Code
    $ lfs check servers 
    $ lfs check servers 
-\layout LyX-Code
+\end_layout
 
 
+\begin_layout LyX-Code
    OSC_localhost.localdomain_OST_localhost_mds1 active.
  
    OSC_localhost.localdomain_OST_localhost_mds1 active.
  
-\layout LyX-Code
+\end_layout
 
 
+\begin_layout LyX-Code
    OSC_localhost.localdomain_OST_localhost_MNT_localhost active.
  
    OSC_localhost.localdomain_OST_localhost_MNT_localhost active.
  
-\layout LyX-Code
+\end_layout
 
 
+\begin_layout LyX-Code
    MDC_localhost.localdomain_mds1_MNT_localhost active.
    MDC_localhost.localdomain_mds1_MNT_localhost active.
-\layout LyX-Code
+\end_layout
 
 
+\begin_layout LyX-Code
    $
    $
-\layout Description
+\end_layout
 
 
+\begin_layout Description
 List all the OSTs
 List all the OSTs
-\layout LyX-Code
+\end_layout
 
 
+\begin_layout LyX-Code
    $ lfs osts 
    $ lfs osts 
-\layout LyX-Code
+\end_layout
 
 
+\begin_layout LyX-Code
    OBDS:    
    OBDS:    
-\layout LyX-Code
+\end_layout
 
 
+\begin_layout LyX-Code
    0: OST_localhost_UUID   
    0: OST_localhost_UUID   
-\layout LyX-Code
+\end_layout
 
 
+\begin_layout LyX-Code
    $
    $
-\layout Description
+\end_layout
 
 
-Change\SpecialChar ~
-file\SpecialChar ~
-owner\SpecialChar ~
-and\SpecialChar ~
+\begin_layout Description
+Change\InsetSpace ~
+file\InsetSpace ~
+owner\InsetSpace ~
+and\InsetSpace ~
 group
 group
-\layout LyX-Code
+\end_layout
 
 
+\begin_layout LyX-Code
    $lfs quotachog -i /mnt/lustre
    $lfs quotachog -i /mnt/lustre
-\layout Description
+\end_layout
 
 
-Quotacheck\SpecialChar ~
-for\SpecialChar ~
-user\SpecialChar ~
-and\SpecialChar ~
+\begin_layout Description
+Quotacheck\InsetSpace ~
+for\InsetSpace ~
+user\InsetSpace ~
+and\InsetSpace ~
 group
 group
-\layout LyX-Code
+\end_layout
 
 
+\begin_layout LyX-Code
    $lfs quotacheck -ug /mnt/lustre
    $lfs quotacheck -ug /mnt/lustre
-\layout Description
-
-Turn\SpecialChar ~
-quotas\SpecialChar ~
-of\SpecialChar ~
-user\SpecialChar ~
-and\SpecialChar ~
-group\SpecialChar ~
+\end_layout
+
+\begin_layout Description
+Turn\InsetSpace ~
+quotas\InsetSpace ~
+of\InsetSpace ~
+user\InsetSpace ~
+and\InsetSpace ~
+group\InsetSpace ~
 on
 on
-\layout LyX-Code
+\end_layout
 
 
+\begin_layout LyX-Code
    $lfs quotaon -ug /mnt/lustre
    $lfs quotaon -ug /mnt/lustre
-\layout Description
-
-Turn\SpecialChar ~
-quotas\SpecialChar ~
-of\SpecialChar ~
-user\SpecialChar ~
-and\SpecialChar ~
-group\SpecialChar ~
+\end_layout
+
+\begin_layout Description
+Turn\InsetSpace ~
+quotas\InsetSpace ~
+of\InsetSpace ~
+user\InsetSpace ~
+and\InsetSpace ~
+group\InsetSpace ~
 off
 off
-\layout LyX-Code
+\end_layout
 
 
+\begin_layout LyX-Code
    $lfs quotaoff -ug /mnt/lustre
    $lfs quotaoff -ug /mnt/lustre
-\layout Description
-
-Set\SpecialChar ~
-quotas\SpecialChar ~
-of\SpecialChar ~
-user\SpecialChar ~
-`bob':\SpecialChar ~
-1GB\SpecialChar ~
-block\SpecialChar ~
-quota\SpecialChar ~
-and\SpecialChar ~
-10,000\SpecialChar ~
-file\SpecialChar ~
+\end_layout
+
+\begin_layout Description
+Set\InsetSpace ~
+quotas\InsetSpace ~
+of\InsetSpace ~
+user\InsetSpace ~
+`bob':\InsetSpace ~
+1GB\InsetSpace ~
+block\InsetSpace ~
+quota\InsetSpace ~
+and\InsetSpace ~
+10,000\InsetSpace ~
+file\InsetSpace ~
 quota
 quota
-\layout LyX-Code
+\end_layout
 
 
+\begin_layout LyX-Code
    $lfs setquota -u bob 0 1000000 0 10000 /mnt/lustre
    $lfs setquota -u bob 0 1000000 0 10000 /mnt/lustre
-\layout Description
+\end_layout
 
 
-List\SpecialChar ~
-quotas\SpecialChar ~
-of\SpecialChar ~
-user\SpecialChar ~
+\begin_layout Description
+List\InsetSpace ~
+quotas\InsetSpace ~
+of\InsetSpace ~
+user\InsetSpace ~
 `bob'
 `bob'
-\layout LyX-Code
+\end_layout
 
 
+\begin_layout LyX-Code
    $lfs quota -u bob /mnt/lustre
    $lfs quota -u bob /mnt/lustre
-\layout Subsection
+\end_layout
 
 
+\begin_layout Subsection
 BUGS
 BUGS
-\layout Standard
+\end_layout
 
 
+\begin_layout Standard
 None are known.
 None are known.
-\the_end
+\end_layout
+
+\end_body
+\end_document
index 0f167e0..0b4a915 100644 (file)
@@ -28,6 +28,7 @@ noinst_PROGRAMS += small_write multiop sleeptest ll_sparseness_verify cmknod
 noinst_PROGRAMS += ll_sparseness_write mrename ll_dirstripe_verify mkdirmany rmdirmany
 noinst_PROGRAMS += openfilleddirunlink rename_many memhog iopentest1 iopentest2
 noinst_PROGRAMS += mmap_sanity flock_test writemany random-reads flocks_test
 noinst_PROGRAMS += ll_sparseness_write mrename ll_dirstripe_verify mkdirmany rmdirmany
 noinst_PROGRAMS += openfilleddirunlink rename_many memhog iopentest1 iopentest2
 noinst_PROGRAMS += mmap_sanity flock_test writemany random-reads flocks_test
+noinst_PROGRAMS += ll_getstripe_info
 if MPITESTS
 noinst_PROGRAMS += parallel_grouplock write_append_truncate createmany_mpi
 endif
 if MPITESTS
 noinst_PROGRAMS += parallel_grouplock write_append_truncate createmany_mpi
 endif
@@ -39,6 +40,9 @@ stat_SOURCES = stat.c stat_fs.h
 # mkdirdeep_LDADD=-L$(top_builddir)/lnet/utils -lptlctl $(LIBREADLINE)
 mmap_sanity_SOURCES= mmap_sanity.c
 
 # mkdirdeep_LDADD=-L$(top_builddir)/lnet/utils -lptlctl $(LIBREADLINE)
 mmap_sanity_SOURCES= mmap_sanity.c
 
+LIBLUSTREAPI := $(top_builddir)/lustre/utils/liblustreapi.a
+ll_getstripe_info_LDADD=$(LIBLUSTREAPI)
+
 if MPITESTS
 LAM_LD_FLAGS=-L/opt/lam/lib -lmpi -llam -lpthread
 write_append_truncate_SOURCES=write_append_truncate.c
 if MPITESTS
 LAM_LD_FLAGS=-L/opt/lam/lib -lmpi -llam -lpthread
 write_append_truncate_SOURCES=write_append_truncate.c
diff --git a/lustre/tests/ll_getstripe_info.c b/lustre/tests/ll_getstripe_info.c
new file mode 100644 (file)
index 0000000..b8df70c
--- /dev/null
@@ -0,0 +1,57 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ *
+ * ll_getstripe_info <file>:
+ * - get file's stripe info.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <liblustre.h>
+#include <obd.h>
+#include <obd_lov.h>
+
+#include <lustre/liblustreapi.h>
+
+#define MAX_LOV_UUID_COUNT      1000
+
+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_size = lov_mds_md_size(MAX_LOV_UUID_COUNT);
+
+        if ((lum_file = (struct lov_user_md *)malloc(lum_size)) == NULL) {
+                fprintf(stderr, "unable to allocate memory for ioctl's");
+                rc = errno;
+                goto cleanup;
+        }
+
+        rc = llapi_file_get_stripe(argv[1], lum_file);
+        if (rc) {
+                rc = errno;
+                goto cleanup;
+        }
+
+        /* stripe_size stripe_count stripe_offset */
+        printf("%d %d %d\n", 
+               lum_file->lmm_stripe_size,
+               lum_file->lmm_stripe_count,
+               lum_file->lmm_objects[0].l_ost_idx);
+
+cleanup:
+        if (lum_file != NULL)
+                free(lum_file);
+
+        return rc;
+}
index 03ec592..4a7bc92 100644 (file)
@@ -38,6 +38,7 @@ GETSTRIPE=${GETSTRIPE:-"$LFS getstripe"}
 LSTRIPE=${LSTRIPE:-"$LFS setstripe"}
 LFIND=${LFIND:-"$LFS find"}
 LVERIFY=${LVERIFY:-ll_dirstripe_verify}
 LSTRIPE=${LSTRIPE:-"$LFS setstripe"}
 LFIND=${LFIND:-"$LFS find"}
 LVERIFY=${LVERIFY:-ll_dirstripe_verify}
+LSTRIPEINFO=${LSTRIPEINFO:-ll_getstripe_info}
 LCTL=${LCTL:-lctl}
 MCREATE=${MCREATE:-mcreate}
 OPENFILE=${OPENFILE:-openfile}
 LCTL=${LCTL:-lctl}
 MCREATE=${MCREATE:-mcreate}
 OPENFILE=${OPENFILE:-openfile}
@@ -1123,6 +1124,24 @@ test_27t() { # bug 10864
 }
 run_test 27t "check that utils parse path correctly"
 
 }
 run_test 27t "check that utils parse path correctly"
 
+test_27x() { # bug 10997
+        mkdir -p $DIR/d27w || error "mkdir failed"
+        $LSTRIPE $DIR/d27w/f0 -s 65536 || error "lstripe failed"
+        size=`$LSTRIPEINFO $DIR/d27w/f0 | awk {'print $1'}`
+        [ $size -ne 65536 ] && error "stripe size $size != 65536" || true
+
+        [ "$OSTCOUNT" -lt "2" ] && echo "skipping multiple stripe count/offset test" && return
+        for i in `seq 1 $OSTCOUNT`; do
+                offset=$(($i-1))
+                $LSTRIPE $DIR/d27w/f$i -c $i -i $offset || error "lstripe -c $i -i $offset failed"
+                count=`$LSTRIPEINFO $DIR/d27w/f$i | awk {'print $2'}`
+                index=`$LSTRIPEINFO $DIR/d27w/f$i | awk {'print $3'}`
+                [ $count -ne $i ] && error "stripe count $count != $i" || true
+                [ $index -ne $offset ] && error "stripe offset $index != $offset" || true
+        done
+}
+run_test 27x "check lfs setstripe -c -s -i options ============="
+
 test_28() {
        mkdir $DIR/d28
        $CREATETEST $DIR/d28/ct || error
 test_28() {
        mkdir $DIR/d28
        $CREATETEST $DIR/d28/ct || error
index abda085..05f2919 100644 (file)
@@ -75,12 +75,16 @@ command_t cmdlist[] = {
          "Create a new file with a specific striping pattern or\n"
          "set the default striping pattern on an existing directory or\n"
          "delete the default striping pattern from an existing directory\n"
          "Create a new file with a specific striping pattern or\n"
          "set the default striping pattern on an existing directory or\n"
          "delete the default striping pattern from an existing directory\n"
-         "usage: setstripe <filename|dirname> <stripe size> <stripe start> <stripe count>\n"
+         "usage: setstripe <filename|dirname> <stripe_size> <stripe_index> <stripe_count>\n"
+         "       or \n"
+         "       setstripe <filename|dirname> [--size|-s stripe_size]\n"
+         "                                    [--index|-i stripe_index]\n"
+         "                                    [--count|-c stripe_count]\n"
          "       or \n"
          "       setstripe -d <dirname>   (to delete default striping)\n"
          "       or \n"
          "       setstripe -d <dirname>   (to delete default striping)\n"
-         "\tstripe size:  Number of bytes on each OST (0 filesystem default)\n"
-         "\tstripe start: OST index of first stripe (-1 filesystem default)\n"
-         "\tstripe count: Number of OSTs to stripe over (0 default, -1 all)"},
+         "\tstripe_size:  Number of bytes on each OST (0 filesystem default)\n"
+         "\tstripe_index: OST index of first stripe (-1 filesystem default)\n"
+         "\tstripe_count: Number of OSTs to stripe over (0 default, -1 all)"},
         {"getstripe", lfs_getstripe, 0,
          "To list the striping info for a given filename or files in a\n"
          "directory or recursively for all files in a directory tree.\n"
         {"getstripe", lfs_getstripe, 0,
          "To list the striping info for a given filename or files in a\n"
          "directory or recursively for all files in a directory tree.\n"
@@ -148,42 +152,116 @@ static int lfs_setstripe(int argc, char **argv)
         long st_size;
         int  st_offset, st_count;
         char *end;
         long st_size;
         int  st_offset, st_count;
         char *end;
+        int c;
+        int delete = 0;
+        char *stripe_size_arg = NULL;
+        char *stripe_off_arg = NULL;
+        char *stripe_count_arg = NULL;
 
 
-        if (argc != 5 && argc != 3)
-                return CMD_HELP;
+        struct option long_opts[] = {
+                {"size",        required_argument, 0, 's'},
+                {"count",       required_argument, 0, 'c'},
+                {"index",       required_argument, 0, 'i'},
+                {"delete",      no_argument,       0, 'd'},
+                {0, 0, 0, 0}
+        };
 
 
+        st_size = 0;
+        st_offset = -1;
+        st_count = 0;
+        if (argc == 3 && strcmp(argv[1], "-d") == 0) {
+                /* for compatibility with the existing positional parameter
+                 * usage */
+                fname = argv[2];
+                optind = 2;
+        } else if (argc == 5  && 
+                   (argv[2][0] != '-' || isdigit(argv[2][1])) &&
+                   (argv[3][0] != '-' || isdigit(argv[3][1])) &&
+                   (argv[4][0] != '-' || isdigit(argv[4][1])) ) {
+                /* for compatibility with the existing positional parameter
+                 * usage */
+                fname = argv[1];
+                stripe_size_arg = argv[2];
+                stripe_off_arg = argv[3];
+                stripe_count_arg = argv[4];
+                optind = 4;
+        } else {
+                while ((c = getopt_long(argc, argv, "c:di:s:",
+                                                long_opts, NULL)) >= 0) 
+                {
+                        switch (c) {
+                        case 0:
+                                /* Long options. */
+                                break;
+                        case 'c':
+                                stripe_count_arg = optarg;
+                                break;
+                        case 'd':
+                                /* delete the default striping pattern */
+                                delete = 1;
+                                break;
+                        case 'i':
+                                stripe_off_arg = optarg;
+                                break;
+                        case 's':
+                                stripe_size_arg = optarg;
+                                break;
+                        case '?':
+                                return CMD_HELP;
+                        default:
+                                fprintf(stderr, "error: %s: option '%s' "
+                                                "unrecognized\n",
+                                                argv[0], argv[optind - 1]);
+                                return CMD_HELP;
+                        }
+                }
 
 
-        if (argc == 3) {
-                if (strcmp(argv[1], "-d") != 0)
+                if (optind < argc)
+                        fname = argv[optind];
+                else
                         return CMD_HELP;
 
                         return CMD_HELP;
 
-                fname = argv[2];
-                st_size = 0;
-                st_offset = -1;
-                st_count = 0;
-        } else {
-                fname = argv[1];
+                if (delete && 
+                    (stripe_size_arg != NULL || stripe_off_arg != NULL || 
+                     stripe_count_arg != NULL)) {
+                        fprintf(stderr, "error: %s: cannot specify -d with "
+                                        "-s, -c or -i options\n",
+                                        argv[0]);
+                        return CMD_HELP;
+                }
+        }
+
+        if (optind != argc - 1) {
+                fprintf(stderr, "error: %s: only 1 filename|dirname can be "
+                                "specified: '%s'\n",
+                                argv[0], argv[argc-1]);
+                return CMD_HELP;
+        }
 
 
-                /* get the stripe size */
-                st_size = strtoul(argv[2], &end, 0);
+        /* get the stripe size */
+        if (stripe_size_arg != NULL) {
+                st_size = strtoul(stripe_size_arg, &end, 0);
                 if (*end != '\0') {
                         fprintf(stderr, "error: %s: bad stripe size '%s'\n",
                 if (*end != '\0') {
                         fprintf(stderr, "error: %s: bad stripe size '%s'\n",
-                                argv[0], argv[2]);
+                                        argv[0], stripe_size_arg);
                         return CMD_HELP;
                 }
                         return CMD_HELP;
                 }
-
-                /* get the stripe offset */
-                st_offset = strtoul(argv[3], &end, 0);
+        }
+        /* get the stripe offset */
+        if (stripe_off_arg != NULL) {
+                st_offset = strtoul(stripe_off_arg, &end, 0);
                 if (*end != '\0') {
                         fprintf(stderr, "error: %s: bad stripe offset '%s'\n",
                 if (*end != '\0') {
                         fprintf(stderr, "error: %s: bad stripe offset '%s'\n",
-                                argv[0], argv[3]);
+                                        argv[0], stripe_off_arg);
                         return CMD_HELP;
                 }
                         return CMD_HELP;
                 }
-                /* get the stripe count */
-                st_count = strtoul(argv[4], &end, 0);
+        }
+        /* get the stripe count */
+        if (stripe_count_arg != NULL) {
+                st_count = strtoul(stripe_count_arg, &end, 0);
                 if (*end != '\0') {
                         fprintf(stderr, "error: %s: bad stripe count '%s'\n",
                 if (*end != '\0') {
                         fprintf(stderr, "error: %s: bad stripe count '%s'\n",
-                                argv[0], argv[4]);
+                                        argv[0], stripe_count_arg);
                         return CMD_HELP;
                 }
         }
                         return CMD_HELP;
                 }
         }