Whamcloud - gitweb
LU-995 utils: make lfs getstripe directory output consistent.
authorHongchao Zhang <hongchao.zhang@whamcloud.com>
Thu, 15 Mar 2012 04:03:07 +0000 (12:03 +0800)
committerJohann Lombardi <johann@whamcloud.com>
Fri, 20 Apr 2012 13:44:05 +0000 (09:44 -0400)
commit2e07f1f30bdde4b9263dcb3913c35dd11fa5ae3c
tree614d4c2552fdff6d9a5bec9fdfbc45c16751bd1c
parent4d59b9eac6b961d89c4f0e8ce9f342bc01c58f4a
LU-995 utils: make lfs getstripe directory output consistent.

"lfs getstripe" should report the global default for any fields with
a value that means "use the default". This patch introduces the
following functionality:

1. If "lfs getstripe" is called on a directory and finds that striping
   EA is not set, the filesystem's defaults are looked up and printed.
2. If the striping EA is set, but the striping count and/or striping
   size has a value that means "use the default" (count = 0 and/or
   size = 0), the filesystem's default for that specific striping
   attribute is looked up and printed.
3. A new option to "lfs getstripe" is introduced; the "--raw" or
   "-R" option. If this option is specified, the previous two checks
   are skipped. In other words, if the striping EA is not set, 0, 0,
   -1, will be printed for the striping count, size, and offset
   respectively. Also, if the striping EA is set, the values will be
   printed without first converting them into their respective
   defaults.

This patch relies on the /proc filesystem to determine each
filesystem's default striping attributes, and a cache is maintained
which holds the default values for the last filesystem queried.

See Also:
Bugzilla #23802, https://bugzilla.lustre.org/show_bug.cgi?id=23802

Signed-off-by: Prakash Surya <surya1@llnl.gov>
Signed-off-by: Hongchao Zhang <hongchao.zhang@whamcloud.com>
Change-Id: Ic5b616dd83775c0a15be5c060b11cfbba05c4fbb
Reviewed-on: http://review.whamcloud.com/2117
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Bobi Jam <bobijam@whamcloud.com>
Reviewed-by: Johann Lombardi <johann@whamcloud.com>
lustre/doc/lfs.1
lustre/include/lustre/liblustreapi.h
lustre/tests/sanity.sh
lustre/utils/lfs.c
lustre/utils/liblustreapi.c