Whamcloud - gitweb
Landing b_bug1414
authorshaocheng <shaocheng>
Fri, 19 Mar 2004 13:38:35 +0000 (13:38 +0000)
committershaocheng <shaocheng>
Fri, 19 Mar 2004 13:38:35 +0000 (13:38 +0000)
27 files changed:
lustre/configure.in
lustre/include/Makefile.am
lustre/include/linux/Makefile.am
lustre/include/linux/lustre_idl.h
lustre/include/linux/lustre_lite.h
lustre/include/linux/obd.h
lustre/include/lustre/Makefile [new file with mode: 0644]
lustre/include/lustre/Makefile.am [new file with mode: 0644]
lustre/include/lustre/Makefile.in [new file with mode: 0644]
lustre/include/lustre/liblustreapi.h [new file with mode: 0644]
lustre/include/lustre/lustre_user.h [moved from lustre/include/linux/lustre_user.h with 86% similarity]
lustre/kernel_patches/patches/linux-2.6.3-CITI_NFS4_ALL.patch
lustre/llite/dir.c
lustre/lov/lov_internal.h
lustre/lov/lov_pack.c
lustre/mds/handler.c
lustre/mds/mds_internal.h
lustre/mds/mds_open.c
lustre/mds/mds_reint.c
lustre/osc/osc_request.c
lustre/tests/Makefile.am
lustre/tests/ll_dirstripe_verify.c [new file with mode: 0644]
lustre/tests/open_delay.c
lustre/tests/openclose.c
lustre/tests/sanity.sh
lustre/utils/lfs.c
lustre/utils/liblustreapi.c

index aff6e19..aec5d2e 100644 (file)
@@ -82,5 +82,6 @@ AC_OUTPUT([Makefile lvfs/Makefile portals/Makefile portals/Kernelenv \
          cobd/Makefile ptlbd/Makefile conf/Makefile  tests/Makefile \
          utils/Makefile utils/Lustre/Makefile obdfilter/Makefile \
           obdclass/Makefile smfs/Makefile snapfs/Makefile snapfs/utils/Makefile \
-         include/Makefile include/linux/Makefile llite/Makefile doc/Makefile scripts/Makefile \
+         include/Makefile include/linux/Makefile include/lustre/Makefile \
+          llite/Makefile doc/Makefile scripts/Makefile \
          scripts/lustre.spec])
index d532ab5..7c8201c 100644 (file)
@@ -4,6 +4,6 @@
 # This code is issued under the GNU General Public License.
 # See the file COPYING in this distribution
 
-SUBDIRS = linux
+SUBDIRS = linux lustre
 EXTRA_DIST = config.h.in ioctl.h liblustre.h 
 include $(top_srcdir)/Rules
index cd614f9..dde079f 100644 (file)
@@ -4,7 +4,7 @@
 # See the file COPYING in this distribution
 
 
-pkginclude_HEADERS = lustre_user.h
+#pkginclude_HEADERS = lustre_user.h
 
 EXTRA_DIST = lprocfs_status.h lustre_debug.h lustre_ha.h lustre_lib.h \
   lustre_mgmt.h obd_cache.h obd_lov.h lustre_dlm.h lustre_handles.h \
index 669c079..7f6813d 100644 (file)
@@ -68,7 +68,7 @@
 #endif
 
 /* Defn's shared with user-space. */
-#include <linux/lustre_user.h>
+#include <lustre/lustre_user.h>
 
 /*
  * this file contains all data structures used in Lustre interfaces:
@@ -379,6 +379,7 @@ struct lov_mds_md_v0 {            /* LOV EA mds/wire data (little-endian) */
 #define OBD_MD_FLIFID   (0x02000000)    /* ->ost write inline fid */
 #define OBD_MD_FLEPOCH  (0x04000000)    /* ->ost write easize is epoch */
 #define OBD_MD_FLGRANT  (0x08000000)    /* ost preallocation space grant */
+#define OBD_MD_FLDIREA  (0x10000000)    /* dir's extended attribute data */
 #define OBD_MD_FLNOTOBD (~(OBD_MD_FLBLOCKS | OBD_MD_LINKNAME|\
                            OBD_MD_FLEASIZE | OBD_MD_FLHANDLE | OBD_MD_FLCKSUM|\
                            OBD_MD_FLQOS | OBD_MD_FLOSCOPQ | OBD_MD_FLCOOKIE))
index c496b42..5c6be08 100644 (file)
@@ -142,6 +142,6 @@ enum {
 #include <linux/lustre_idl.h>
 #endif /* __KERNEL__ */
 
-#include <linux/lustre_user.h>
+#include <lustre/lustre_user.h>
 
 #endif
index fb2da73..2f23fb8 100644 (file)
@@ -18,6 +18,7 @@
 #define IOC_MDC_TYPE         'i'
 #define IOC_MDC_MIN_NR       20
 #define IOC_MDC_LOOKUP       _IOWR(IOC_MDC_TYPE, 20, struct obd_device *)
+#define IOC_MDC_GETSTRIPE    _IOWR(IOC_MDC_TYPE, 21, struct lov_mds_md *)
 #define IOC_MDC_MAX_NR       50
 
 #ifdef __KERNEL__
diff --git a/lustre/include/lustre/Makefile b/lustre/include/lustre/Makefile
new file mode 100644 (file)
index 0000000..8e3b405
--- /dev/null
@@ -0,0 +1,295 @@
+# Makefile.in generated by automake 1.6.3 from Makefile.am.
+# include/lustre/Makefile.  Generated from Makefile.in by configure.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+
+# Copyright (C) 2001  Cluster File Systems, Inc.
+#
+# This code is issued under the GNU General Public License.
+# See the file COPYING in this distribution
+SHELL = /bin/sh
+
+srcdir = .
+top_srcdir = ../..
+
+prefix = 
+exec_prefix = ${prefix}
+
+bindir = ${exec_prefix}/usr/bin
+sbindir = ${exec_prefix}/usr/sbin
+libexecdir = ${exec_prefix}/libexec
+datadir = ${prefix}/share
+sysconfdir = ${prefix}/etc
+sharedstatedir = ${prefix}/com
+localstatedir = ${prefix}/var
+libdir = ${exec_prefix}/lib
+infodir = ${prefix}/info
+mandir = ${prefix}/man
+includedir = ${prefix}/usr/include
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/lustre
+pkglibdir = $(libdir)/lustre
+pkgincludedir = $(includedir)/lustre
+top_builddir = ../..
+
+ACLOCAL = ${SHELL} /usr/src/lustre/missing --run aclocal-1.6
+AUTOCONF = ${SHELL} /usr/src/lustre/missing --run autoconf
+AUTOMAKE = ${SHELL} /usr/src/lustre/missing --run automake-1.6
+AUTOHEADER = ${SHELL} /usr/src/lustre/missing --run autoheader
+
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = /usr/bin/install -c
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_DATA = ${INSTALL} -m 644
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_SCRIPT = ${INSTALL}
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = s,x,x,
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_alias = 
+build_triplet = i686-pc-linux-gnu
+host_alias = 
+host_triplet = i686-pc-linux-gnu
+target_alias = 
+target_triplet = i686-pc-linux-gnu
+
+EXEEXT = 
+OBJEXT = o
+PATH_SEPARATOR = :
+AMTAR = ${SHELL} /usr/src/lustre/missing --run tar
+AWK = gawk
+CC = gcc
+CRAY_PORTALS_INCLUDE = 
+DEPDIR = .deps
+ENABLE_DOC = 0
+GMNAL = 
+HAVE_LIBEFENCE = 
+HAVE_LIBREADLINE = -DHAVE_LIBREADLINE=1
+IBNAL = 
+INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
+LIBEFENCE = 
+LIBREADLINE = -lreadline -lncurses
+LINUX = /usr/src/uml
+LINUX25 = 
+LINUXRELEASE = 2.4.20-6um
+MOD_LINK = elf_i386
+PACKAGE = lustre
+QSWNAL = 
+RANLIB = ranlib
+RELEASE = 2.4.20_6um_200403190144
+SCIMACNAL = 
+STRIP = 
+SYSIO = $(top_srcdir)/../libsysio
+VERSION = HEAD
+am__include = include
+am__quote = 
+demodir = $(docdir)/demo
+docdir = ${prefix}/usr/share/doc/$(PACKAGE)
+install_sh = /usr/src/lustre/install-sh
+moduledir = $(libdir)/modules/2.4.20-6um/kernel
+modulefsdir = $(moduledir)/fs/$(PACKAGE)
+modulenetdir = $(moduledir)/net/$(PACKAGE)
+pkgexampledir = ${prefix}/usr/lib/$(PACKAGE)/examples
+pymoddir = ${prefix}/usr/lib/${PACKAGE}/python/Lustre
+rootsbindir = ${exec_prefix}/sbin
+with_gm = 
+with_ib = 
+with_quadrics = 
+with_scamac = 
+
+pkginclude_HEADERS = lustre_user.h liblustreapi.h
+subdir = include/lustre
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+HEADERS = $(pkginclude_HEADERS)
+
+DIST_COMMON = $(pkginclude_HEADERS) Makefile.am Makefile.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4)
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  include/lustre/Makefile
+Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
+       cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+uninstall-info-am:
+pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+install-pkgincludeHEADERS: $(pkginclude_HEADERS)
+       @$(NORMAL_INSTALL)
+       $(mkinstalldirs) $(DESTDIR)$(pkgincludedir)
+       @list='$(pkginclude_HEADERS)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f="`echo $$p | sed -e 's|^.*/||'`"; \
+         echo " $(pkgincludeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(pkgincludedir)/$$f"; \
+         $(pkgincludeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(pkgincludedir)/$$f; \
+       done
+
+uninstall-pkgincludeHEADERS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(pkginclude_HEADERS)'; for p in $$list; do \
+         f="`echo $$p | sed -e 's|^.*/||'`"; \
+         echo " rm -f $(DESTDIR)$(pkgincludedir)/$$f"; \
+         rm -f $(DESTDIR)$(pkgincludedir)/$$f; \
+       done
+
+ETAGS = etags
+ETAGSFLAGS =
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       mkid -fID $$unique
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       test -z "$(ETAGS_ARGS)$$tags$$unique" \
+         || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+            $$tags $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && cd $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+       @list='$(DISTFILES)'; for file in $$list; do \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+           dir="/$$dir"; \
+           $(mkinstalldirs) "$(distdir)$$dir"; \
+         else \
+           dir=''; \
+         fi; \
+         if test -d $$d/$$file; then \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+
+installdirs:
+       $(mkinstalldirs) $(DESTDIR)$(pkgincludedir)
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -rm -f Makefile $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-pkgincludeHEADERS
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+uninstall-am: uninstall-info-am uninstall-pkgincludeHEADERS
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic distclean \
+       distclean-generic distclean-tags distdir dvi dvi-am info \
+       info-am install install-am install-data install-data-am \
+       install-exec install-exec-am install-info install-info-am \
+       install-man install-pkgincludeHEADERS install-strip \
+       installcheck installcheck-am installdirs maintainer-clean \
+       maintainer-clean-generic mostlyclean mostlyclean-generic tags \
+       uninstall uninstall-am uninstall-info-am \
+       uninstall-pkgincludeHEADERS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/lustre/include/lustre/Makefile.am b/lustre/include/lustre/Makefile.am
new file mode 100644 (file)
index 0000000..377bef6
--- /dev/null
@@ -0,0 +1,7 @@
+# Copyright (C) 2001  Cluster File Systems, Inc.
+#
+# This code is issued under the GNU General Public License.
+# See the file COPYING in this distribution
+
+
+pkginclude_HEADERS = lustre_user.h liblustreapi.h
diff --git a/lustre/include/lustre/Makefile.in b/lustre/include/lustre/Makefile.in
new file mode 100644 (file)
index 0000000..35f3178
--- /dev/null
@@ -0,0 +1,295 @@
+# Makefile.in generated by automake 1.6.3 from Makefile.am.
+# @configure_input@
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Copyright (C) 2001  Cluster File Systems, Inc.
+#
+# This code is issued under the GNU General Public License.
+# See the file COPYING in this distribution
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_alias = @build_alias@
+build_triplet = @build@
+host_alias = @host_alias@
+host_triplet = @host@
+target_alias = @target_alias@
+target_triplet = @target@
+
+EXEEXT = @EXEEXT@
+OBJEXT = @OBJEXT@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CRAY_PORTALS_INCLUDE = @CRAY_PORTALS_INCLUDE@
+DEPDIR = @DEPDIR@
+ENABLE_DOC = @ENABLE_DOC@
+GMNAL = @GMNAL@
+HAVE_LIBEFENCE = @HAVE_LIBEFENCE@
+HAVE_LIBREADLINE = @HAVE_LIBREADLINE@
+IBNAL = @IBNAL@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LIBEFENCE = @LIBEFENCE@
+LIBREADLINE = @LIBREADLINE@
+LINUX = @LINUX@
+LINUX25 = @LINUX25@
+LINUXRELEASE = @LINUXRELEASE@
+MOD_LINK = @MOD_LINK@
+PACKAGE = @PACKAGE@
+QSWNAL = @QSWNAL@
+RANLIB = @RANLIB@
+RELEASE = @RELEASE@
+SCIMACNAL = @SCIMACNAL@
+STRIP = @STRIP@
+SYSIO = @SYSIO@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+demodir = @demodir@
+docdir = @docdir@
+install_sh = @install_sh@
+moduledir = @moduledir@
+modulefsdir = @modulefsdir@
+modulenetdir = @modulenetdir@
+pkgexampledir = @pkgexampledir@
+pymoddir = @pymoddir@
+rootsbindir = @rootsbindir@
+with_gm = @with_gm@
+with_ib = @with_ib@
+with_quadrics = @with_quadrics@
+with_scamac = @with_scamac@
+
+pkginclude_HEADERS = lustre_user.h liblustreapi.h
+subdir = include/lustre
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+HEADERS = $(pkginclude_HEADERS)
+
+DIST_COMMON = $(pkginclude_HEADERS) Makefile.am Makefile.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4)
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  include/lustre/Makefile
+Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
+       cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+uninstall-info-am:
+pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+install-pkgincludeHEADERS: $(pkginclude_HEADERS)
+       @$(NORMAL_INSTALL)
+       $(mkinstalldirs) $(DESTDIR)$(pkgincludedir)
+       @list='$(pkginclude_HEADERS)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f="`echo $$p | sed -e 's|^.*/||'`"; \
+         echo " $(pkgincludeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(pkgincludedir)/$$f"; \
+         $(pkgincludeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(pkgincludedir)/$$f; \
+       done
+
+uninstall-pkgincludeHEADERS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(pkginclude_HEADERS)'; for p in $$list; do \
+         f="`echo $$p | sed -e 's|^.*/||'`"; \
+         echo " rm -f $(DESTDIR)$(pkgincludedir)/$$f"; \
+         rm -f $(DESTDIR)$(pkgincludedir)/$$f; \
+       done
+
+ETAGS = etags
+ETAGSFLAGS =
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       mkid -fID $$unique
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       test -z "$(ETAGS_ARGS)$$tags$$unique" \
+         || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+            $$tags $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && cd $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+       @list='$(DISTFILES)'; for file in $$list; do \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+           dir="/$$dir"; \
+           $(mkinstalldirs) "$(distdir)$$dir"; \
+         else \
+           dir=''; \
+         fi; \
+         if test -d $$d/$$file; then \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+
+installdirs:
+       $(mkinstalldirs) $(DESTDIR)$(pkgincludedir)
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -rm -f Makefile $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-pkgincludeHEADERS
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+uninstall-am: uninstall-info-am uninstall-pkgincludeHEADERS
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic distclean \
+       distclean-generic distclean-tags distdir dvi dvi-am info \
+       info-am install install-am install-data install-data-am \
+       install-exec install-exec-am install-info install-info-am \
+       install-man install-pkgincludeHEADERS install-strip \
+       installcheck installcheck-am installdirs maintainer-clean \
+       maintainer-clean-generic mostlyclean mostlyclean-generic tags \
+       uninstall uninstall-am uninstall-info-am \
+       uninstall-pkgincludeHEADERS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/lustre/include/lustre/liblustreapi.h b/lustre/include/lustre/liblustreapi.h
new file mode 100644 (file)
index 0000000..9f890a7
--- /dev/null
@@ -0,0 +1,39 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ *
+ *  Copyright (C) 2002 Cluster File Systems, Inc.
+ *   Author: Peter J. Braam <braam@clusterfs.com>
+ *   Author: Phil Schwan <phil@clusterfs.com>
+ *   Author: Brian Behlendorf <behlendorf1@llnl.gov> 
+ *   Author: Robert Read <rread@clusterfs.com> 
+ *
+ *   This file is part of Lustre, http://www.lustre.org.
+ *
+ *   Lustre is free software; you can redistribute it and/or
+ *   modify it under the terms of version 2 of the GNU General Public
+ *   License as published by the Free Software Foundation.
+ *
+ *   Lustre is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with Lustre; if not, write to the Free Software
+ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+#ifndef _LIBLUSTREAPI_H_
+#define _LIBLUSTREAPI_H_
+
+/* liblustreapi.c */
+int op_create_file(char *name, long stripe_size, int stripe_offset,
+         int stripe_count);
+int op_find(char *path, struct obd_uuid *obduuid, int recursive,
+         int verbose, int quiet);
+int op_check(int type_num, char **obd_type_p, char *dir);
+int op_catinfo(char *dir, char *keyword, char *node_name);
+
+
+
+#endif
similarity index 86%
rename from lustre/include/linux/lustre_user.h
rename to lustre/include/lustre/lustre_user.h
index 2c3e315..2eba485 100644 (file)
@@ -25,9 +25,6 @@
 #define _LUSTRE_USER_H
 #include <asm/types.h>
 
-#define IOC_MDC_TYPE         'i'
-#define IOC_MDC_GETSTRIPE    _IOWR(IOC_MDC_TYPE, 21, struct lov_mds_md *)
-
 #define LL_IOC_GETFLAGS                 _IOR ('f', 151, long)
 #define LL_IOC_SETFLAGS                 _IOW ('f', 152, long)
 #define LL_IOC_CLRFLAGS                 _IOW ('f', 153, long)
 #define LL_IOC_LOV_GETSTRIPE            _IOW ('f', 155, long)
 #define LL_IOC_LOV_SETEA                _IOW ('f', 156, long)
 #define LL_IOC_RECREATE_OBJ             _IOW ('f', 157, long)
-#define LL_IOC_CW_LOCK                  _IOW ('f', 158, long)
-#define LL_IOC_CW_UNLOCK                _IOW ('f', 159, long)
 
 #define O_LOV_DELAY_CREATE 0100000000  /* hopefully this does not conflict */
 
 #define LL_FILE_IGNORE_LOCK             0x00000001
-#define LL_FILE_CW_LOCKED               0x00000002
 
 #define LOV_USER_MAGIC_V1 0x0BD10BD0
 #define LOV_USER_MAGIC    LOV_USER_MAGIC_V1
@@ -71,8 +65,4 @@ struct lov_user_md_v1 {           /* LOV EA user data (host-endian) */
         struct lov_user_ost_data_v1 lmm_objects[0]; /* per-stripe data */
 } __attribute__((packed));
 
-extern int op_create_file(char *name, long stripe_size, int stripe_offset,
-                          int stripe_count);
-extern int get_file_stripe(char *path, struct lov_user_md *lum);
-
 #endif /* _LUSTRE_USER_H */
index 726957c..76c8535 100644 (file)
@@ -5336,7 +5336,7 @@ diff -puN /dev/null include/linux/sunrpc/svcauth_gss.h
 + * Bruce Fields <bfields@umich.edu>
 + * Copyright (c) 2002 The Regents of the Unviersity of Michigan
 + *
-+ * Id: linux-2.6.3-CITI_NFS4_ALL.patch,v 1.2.4.1 2004/03/17 23:55:23 adilger Exp $
++ * $Id: linux-2.6.3-CITI_NFS4_ALL.patch,v 1.4 2004/03/19 13:37:51 shaocheng Exp $
 + *
 + */
 +
index 3f945a7..97fbf99 100644 (file)
@@ -423,9 +423,79 @@ static int ll_dir_ioctl(struct inode *inode, struct file *file,
                 obd_ioctl_freedata(buf, len);
                 return rc;
         }
-        case LL_IOC_LOV_SETSTRIPE:
-        case LL_IOC_LOV_GETSTRIPE:
-                RETURN(-ENOTTY);
+        case LL_IOC_LOV_SETSTRIPE: {
+                struct ptlrpc_request *request = NULL;
+                struct mdc_op_data op_data;
+                struct iattr attr;
+                struct lov_user_md lum, *lump = (struct lov_user_md *)arg;
+                int rc = 0;
+
+                ll_prepare_mdc_op_data(&op_data, inode, NULL, NULL, 0, 0);
+
+                memset(&attr, 0x0, sizeof(attr));
+
+                LASSERT(sizeof(lum) == sizeof(*lump));
+                LASSERT(sizeof(lum.lmm_objects[0])
+                        == sizeof(lump->lmm_objects[0]));
+                rc = copy_from_user(&lum, lump, sizeof(lum));
+                if (rc)
+                        return(-EFAULT);
+
+                if (lum.lmm_magic != LOV_USER_MAGIC)
+                        RETURN(-EINVAL);
+
+                rc = mdc_setattr(sbi->ll_mdc_exp, &op_data,
+                                 &attr, &lum, sizeof(lum), NULL, 0, &request);
+                if (rc) {
+                        ptlrpc_req_finished(request);
+                        if (rc != -EPERM && rc != -EACCES)
+                                CERROR("mdc_setattr fails: rc = %d\n", rc);
+                        return rc;
+                }
+                ptlrpc_req_finished(request);
+
+                return rc;
+        }        
+        case LL_IOC_LOV_GETSTRIPE: {
+                struct ptlrpc_request *request = NULL;
+                struct lov_user_md *lump = (struct lov_user_md *)arg;
+                struct lov_mds_md *lmm;
+                struct ll_fid fid;
+                struct mds_body *body;
+                unsigned long valid = 0;
+                int rc, lmmsize;
+
+                valid |= OBD_MD_FLDIREA;
+
+                ll_inode2fid(&fid, inode);
+                rc = mdc_getattr(sbi->ll_mdc_exp, &fid, valid,
+                                 obd_size_diskmd(sbi->ll_osc_exp, NULL),
+                                 &request);
+                if (rc < 0) {
+                        CDEBUG(D_INFO, "mdc_getattr failed: rc = %d\n", rc);
+                        RETURN(rc);
+                }
+
+                body = lustre_msg_buf(request->rq_repmsg, 0, sizeof(*body));
+                LASSERT(body != NULL);         /* checked by mdc_getattr_name */
+                LASSERT_REPSWABBED(request, 0);/* swabbed by mdc_getattr_name */
+
+                lmmsize = body->eadatasize;
+                if (lmmsize == 0)
+                        GOTO(out_get, rc = -ENODATA);                        
+
+                lmm = lustre_msg_buf(request->rq_repmsg, 1, lmmsize);
+                LASSERT(lmm != NULL);
+                LASSERT_REPSWABBED(request, 1);
+                rc = copy_to_user(lump, lmm, lmmsize);
+                if (rc)
+                        GOTO(out_get, rc = -EFAULT);
+
+                EXIT;
+        out_get:
+                ptlrpc_req_finished(request);
+                RETURN(rc);
+        }
         case IOC_MDC_GETSTRIPE: {
                 struct ptlrpc_request *request = NULL;
                 struct ll_fid fid;
index aa04e4e..cefe534 100644 (file)
@@ -10,7 +10,7 @@
 #ifndef LOV_INTERNAL_H
 #define LOV_INTERNAL_H
 
-#include <linux/lustre_user.h>
+#include <lustre/lustre_user.h>
 
 #define LAP_MAGIC 8200
 
index 2a51441..91692ca 100644 (file)
@@ -33,7 +33,7 @@
 #include <linux/obd_lov.h>
 #include <linux/obd_class.h>
 #include <linux/obd_support.h>
-#include <linux/lustre_user.h>
+#include <lustre/lustre_user.h>
 
 #include "lov_internal.h"
 
index 54a69e6..ff8a2f5 100644 (file)
@@ -461,6 +461,37 @@ int mds_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,
         RETURN(0);
 }
 
+int mds_get_md(struct obd_device *obd, struct inode *inode, void *md,
+               int *size, int lock)
+{
+        int rc = 0;
+        int lmm_size;
+
+        if (lock)
+                down(&inode->i_sem);
+        rc = fsfilt_get_md(obd, inode, md, *size);
+        if (lock)
+                up(&inode->i_sem);
+
+        if (rc < 0) {
+                CERROR("Error %d reading eadata for ino %lu\n",
+                       rc, inode->i_ino);
+        } else if (rc > 0) {
+                lmm_size = rc;
+                rc = mds_convert_lov_ea(obd, inode, md, lmm_size);
+
+                if (rc == 0) {
+                        *size = lmm_size;
+                        rc = lmm_size;
+                } else if (rc > 0) {
+                        *size = rc;
+                }
+        }
+
+        RETURN (rc);
+}
+
+
 /* Call with lock=1 if you want mds_pack_md to take the i_sem.
  * Call with lock=0 if the caller has already taken the i_sem. */
 int mds_pack_md(struct obd_device *obd, struct lustre_msg *msg, int offset,
@@ -491,22 +522,13 @@ int mds_pack_md(struct obd_device *obd, struct lustre_msg *msg, int offset,
                        inode->i_ino, lmm_size, mds->mds_max_mdsize);
                 // RETURN(-EINVAL);
         }
-
-        if (lock)
-                down(&inode->i_sem);
-        rc = fsfilt_get_md(obd, inode, lmm, lmm_size);
-        if (lock)
-                up(&inode->i_sem);
-        if (rc < 0) {
-                CERROR("Error %d reading eadata for ino %lu\n",
-                       rc, inode->i_ino);
-        } else if (rc > 0) {
-                lmm_size = rc;
-                rc = mds_convert_lov_ea(obd, inode, lmm, lmm_size);
-
-                if (rc > 0)
-                        lmm_size = rc;
-                body->valid |= OBD_MD_FLEASIZE;
+        
+        rc = mds_get_md(obd, inode, lmm, &lmm_size, lock);
+        if (rc > 0) {
+                if (S_ISDIR(inode->i_mode))
+                        body->valid |= OBD_MD_FLDIREA;
+                else
+                        body->valid |= OBD_MD_FLEASIZE;
                 body->eadatasize = lmm_size;
                 rc = 0;
         }
@@ -532,12 +554,14 @@ static int mds_getattr_internal(struct obd_device *obd, struct dentry *dentry,
         mds_pack_inode2fid(&body->fid1, inode);
         mds_pack_inode2body(body, inode);
 
-        if (S_ISREG(inode->i_mode) && (reqbody->valid & OBD_MD_FLEASIZE) != 0) {
+        if ((S_ISREG(inode->i_mode) && (reqbody->valid & OBD_MD_FLEASIZE)) ||
+           (S_ISDIR(inode->i_mode) && (reqbody->valid & OBD_MD_FLDIREA))){
                 rc = mds_pack_md(obd, req->rq_repmsg, reply_off + 1, body,
                                  inode, 1);
 
                 /* If we have LOV EA data, the OST holds size, atime, mtime */
-                if (!(body->valid & OBD_MD_FLEASIZE))
+                if (!(body->valid & OBD_MD_FLEASIZE) && 
+                    !(body->valid & OBD_MD_FLDIREA))
                         body->valid |= (OBD_MD_FLSIZE | OBD_MD_FLBLOCKS |
                                         OBD_MD_FLATIME | OBD_MD_FLMTIME);
         } else if (S_ISLNK(inode->i_mode) &&
@@ -579,7 +603,8 @@ static int mds_getattr_pack_msg(struct ptlrpc_request *req, struct inode *inode,
         LASSERT(body != NULL);                 /* checked by caller */
         LASSERT_REQSWABBED(req, offset);       /* swabbed by caller */
 
-        if (S_ISREG(inode->i_mode) && (body->valid & OBD_MD_FLEASIZE)) {
+        if ((S_ISREG(inode->i_mode) && (body->valid & OBD_MD_FLEASIZE)) ||
+            (S_ISDIR(inode->i_mode) && (body->valid & OBD_MD_FLDIREA))){
                 int rc;
                 down(&inode->i_sem);
                 rc = fsfilt_get_md(req->rq_export->exp_obd, inode, NULL, 0);
index d8eb150..ec3f063 100644 (file)
@@ -97,6 +97,8 @@ int mds_lov_clean(struct obd_device *obd);
 extern int mds_iocontrol(unsigned int cmd, struct obd_export *exp,
                          int len, void *karg, void *uarg);
 #ifdef __KERNEL__
+int mds_get_md(struct obd_device *, struct inode *, void *md, int *size, 
+               int lock);
 int mds_pack_md(struct obd_device *, struct lustre_msg *, int offset,
                 struct mds_body *, struct inode *, int lock);
 void mds_pack_inode2fid(struct ll_fid *fid, struct inode *inode);
index 8b8bae0..ac62bf0 100644 (file)
@@ -304,13 +304,15 @@ static void mds_objids_from_lmm(obd_id *ids, struct lov_mds_md *lmm,
 static int mds_create_objects(struct ptlrpc_request *req, int offset,
                               struct mds_update_record *rec,
                               struct mds_obd *mds, struct obd_device *obd,
-                              struct inode *inode, void **handle, obd_id **ids)
+                              struct dentry *dchild, void **handle, 
+                              obd_id **ids)
 {
         struct obdo *oa;
         struct obd_trans_info oti = { 0 };
         struct mds_body *body;
         struct lov_stripe_md *lsm = NULL;
         struct lov_mds_md *lmm = NULL;
+        struct inode *inode = dchild->d_inode;
         void *lmm_buf;
         int rc, lmm_bufsize, lmm_size;
         ENTRY;
@@ -387,6 +389,21 @@ static int mds_create_objects(struct ptlrpc_request *req, int offset,
                                            0, &lsm, rec->ur_eadata);
                         if (rc)
                                 GOTO(out_oa, rc);
+                } else {
+                        OBD_ALLOC(lmm, mds->mds_max_mdsize);
+                        if (lmm == NULL)
+                                GOTO(out_oa, rc = -ENOMEM);
+
+                        lmm_size = mds->mds_max_mdsize;
+                        rc = mds_get_md(obd, dchild->d_parent->d_inode,
+                                        lmm, &lmm_size, 1);
+                        if (rc > 0)
+                                rc = obd_iocontrol(OBD_IOC_LOV_SETSTRIPE,
+                                                   mds->mds_osc_exp, 
+                                                   0, &lsm, lmm);
+                        OBD_FREE(lmm, mds->mds_max_mdsize);
+                        if (rc)
+                                GOTO(out_oa, rc);
                 }
                 rc = obd_create(mds->mds_osc_exp, oa, &lsm, &oti);
                 if (rc) {
@@ -621,7 +638,7 @@ static int mds_finish_open(struct ptlrpc_request *req, struct dentry *dchild,
         if (rec != NULL) {
                 /* no EA: create objects */
                 rc = mds_create_objects(req, 2, rec, mds, obd,
-                                        dchild->d_inode, handle, &ids);
+                                        dchild, handle, &ids);
                 if (rc) {
                         CERROR("mds_create_objects: rc = %d\n", rc);
                         up(&dchild->d_inode->i_sem);
index 96ea3a7..f55fe9e 100644 (file)
@@ -404,7 +404,8 @@ static int mds_reint_setattr(struct mds_update_record *rec, int offset,
         cleanup_phase = 1;
         inode = de->d_inode;
         LASSERT(inode);
-        if (S_ISREG(inode->i_mode) && rec->ur_eadata != NULL)
+        if ((S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)) && 
+            rec->ur_eadata != NULL)
                 down(&inode->i_sem);
 
         OBD_FAIL_WRITE(OBD_FAIL_MDS_REINT_SETATTR_WRITE, inode->i_sb);
@@ -427,9 +428,21 @@ static int mds_reint_setattr(struct mds_update_record *rec, int offset,
         else                                            /* setattr */
                 rc = fsfilt_setattr(obd, de, handle, &rec->ur_iattr, 0);
 
-        if (rc == 0 && S_ISREG(inode->i_mode) && rec->ur_eadata != NULL) {
-                rc = fsfilt_set_md(obd, inode, handle,
-                                   rec->ur_eadata, rec->ur_eadatalen);
+        if (rc == 0 && (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode))
+            && rec->ur_eadata != NULL) {
+                struct lov_stripe_md *lsm = NULL;
+
+                rc = obd_iocontrol(OBD_IOC_LOV_SETSTRIPE,
+                                   mds->mds_osc_exp, 0, &lsm, rec->ur_eadata);
+                if (rc)
+                        GOTO(cleanup, rc);
+                
+                obd_free_memmd(mds->mds_osc_exp, &lsm);
+
+                rc = fsfilt_set_md(obd, inode, handle, rec->ur_eadata,
+                                   rec->ur_eadatalen);
+                if (rc) 
+                        GOTO(cleanup, rc);
         }
 
         body = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*body));
@@ -470,7 +483,8 @@ static int mds_reint_setattr(struct mds_update_record *rec, int offset,
         err = mds_finish_transno(mds, inode, handle, req, rc, 0);
         switch (cleanup_phase) {
         case 1:
-                if (S_ISREG(inode->i_mode) && rec->ur_eadata != NULL)
+                if ((S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)) && 
+                    rec->ur_eadata != NULL)
                         up(&inode->i_sem);
                 l_dput(de);
                 if (locked) {
index 9e36be6..db33eab 100644 (file)
@@ -51,7 +51,7 @@
 # include <linux/lustre_dlm.h>
 #include <linux/kp30.h>
 #include <linux/lustre_net.h>
-#include <linux/lustre_user.h>
+#include <lustre/lustre_user.h>
 #include <linux/obd_ost.h>
 #include <linux/obd_lov.h>
 
index 34adfb9..d37259c 100644 (file)
@@ -19,7 +19,7 @@ noinst_PROGRAMS += stat createmany statmany multifstat createtest mlink utime cm
 noinst_PROGRAMS += opendirunlink opendevunlink unlinkmany fchdir_test checkstat
 noinst_PROGRAMS += wantedi statone runas openfile getdents mkdirdeep o_directory
 noinst_PROGRAMS += small_write multiop sleeptest ll_sparseness_verify
-noinst_PROGRAMS += ll_sparseness_write mrename
+noinst_PROGRAMS += ll_sparseness_write mrename ll_dirstripe_verify
 # noinst_PROGRAMS += ldaptest
 bin_PROGRAMS = mcreate munlink mkdirmany iopentest1 iopentest2
 
@@ -74,5 +74,6 @@ sleeptest_SOURCES = sleeptest.c
 #sanity test 
 ll_sparseness_verify_SOURCES = ll_sparseness_verify.c
 ll_sparseness_write_SOURCES = ll_sparseness_write.c
+ll_dirstripe_verify_SOURCE = ll_dirstripe_verify.c
 
 include $(top_srcdir)/Rules
diff --git a/lustre/tests/ll_dirstripe_verify.c b/lustre/tests/ll_dirstripe_verify.c
new file mode 100644 (file)
index 0000000..a4ce6d1
--- /dev/null
@@ -0,0 +1,201 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ *
+ * ll_dirstripe_verify <dir> <file>:
+ * - to verify if the file has the same lov_user_md setting as the parent dir.
+ * - if dir's offset is set -1, ll_dirstripe_verify <dir> <file1> <file2>
+ *      is used to further verify if file1 and file2's obdidx is continuous.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <dirent.h>
+
+#include <liblustre.h>
+#include <linux/obd.h>
+#include <linux/lustre_lib.h>
+#include <lustre/lustre_user.h>
+#include <linux/obd_lov.h>
+
+#include <portals/ptlctl.h>
+
+
+#define MAX_LOV_UUID_COUNT      1000
+
+int compare(struct lov_user_md *lum_dir, struct lov_user_md *lum_file1,
+            struct lov_user_md *lum_file2)
+{
+        int stripe_count;
+        int stripe_size;
+        int stripe_offset;
+        int ost_count;
+        int fd;
+        char buf[32];
+        int i;
+
+        stripe_count = (int)lum_dir->lmm_stripe_count;
+        if (stripe_count == 0) {
+                fd = open("/proc/fs/lustre/lov/lov1/stripecount", O_RDONLY);
+                if (fd == -1) {
+                        fprintf(stderr, "open proc file error: %s\n", 
+                                strerror(errno));
+                        return -1; 
+                }
+                if (read(fd, buf, sizeof(buf)) == -1) {
+                        fprintf(stderr, "read proc file error: %s\n", 
+                                strerror(errno));
+                        close(fd);
+                        return -1;
+                }
+                
+                stripe_count = atoi(buf);
+                stripe_count = stripe_count ? stripe_count : 1;
+                close(fd);
+        }
+
+        stripe_size = (int)lum_dir->lmm_stripe_size;
+        if (stripe_size == 0) {
+                fd = open("/proc/fs/lustre/lov/lov1/stripesize", O_RDONLY);
+                if (fd == -1) {
+                        fprintf(stderr, "open proc file error: %s\n", 
+                                strerror(errno)); 
+                        return -1; 
+                }
+                if (read(fd, buf, sizeof(buf)) == -1) {
+                        fprintf(stderr, "read proc file error: %s\n", 
+                                strerror(errno));
+                        close(fd);
+                        return -1;
+                }
+
+                stripe_size = atoi(buf);
+                close(fd);
+        }
+
+        fd = open("/proc/fs/lustre/lov/lov1/numobd", O_RDONLY);
+        if(fd  == -1) {
+                fprintf(stderr, "open proc file error: %s\n", 
+                        strerror(errno));
+                return -1;
+        }
+        if (read(fd, buf, sizeof(buf)) == -1) {
+                fprintf(stderr, "read proc file error: %s\n", 
+                        strerror(errno));
+                close(fd);
+                return -1;
+        }
+
+        ost_count = atoi(buf);
+        close(fd);
+
+        if ((lum_file1->lmm_stripe_count != stripe_count) ||
+            (lum_file1->lmm_stripe_size != stripe_size))
+                return -1;
+        
+        stripe_offset = (short int)lum_dir->lmm_stripe_offset;
+        if (stripe_offset != -1) {
+                for (i = 0; i < stripe_count; i++)
+                        if (lum_file1->lmm_objects[i].l_ost_idx != 
+                            (stripe_offset + i) % ost_count) 
+                                return -1;
+        } else if (lum_file2 != NULL) {
+                int next, idx;
+                next = (lum_file1->lmm_objects[stripe_count-1].l_ost_idx + 1)
+                       % ost_count;
+                idx = lum_file2->lmm_objects[0].l_ost_idx;
+                if (idx != next) 
+                        return -1;
+        }
+
+        return 0;        
+}
+
+int main(int argc, char **argv)
+{
+        DIR * dir;
+        struct lov_user_md *lum_dir, *lum_file1, *lum_file2=NULL;
+        int rc;
+        int lum_size;
+        char *fname;
+
+        if (argc < 3) {
+                fprintf(stderr, "Usage: %s <dirname> <filename1> [filename2]\n",
+                        argv[0]);
+                exit(1);
+        }
+
+        dir = opendir(argv[1]);
+        if (dir  == NULL) {
+                fprintf(stderr, "%s opendir failed\n", argv[1]);
+                return errno;
+        }
+
+        lum_size = lov_mds_md_size(MAX_LOV_UUID_COUNT);
+        if ((lum_dir = (struct lov_user_md *)malloc(lum_size)) == NULL) {
+                fprintf(stderr, "unable to allocate memory for ioctl's");
+                return errno;
+        }        
+
+        rc = ioctl(dirfd(dir), LL_IOC_LOV_GETSTRIPE, lum_dir);
+        if (rc) {
+                if (errno == ENODATA) {
+                        lum_dir->lmm_stripe_size = 0;
+                        lum_dir->lmm_stripe_count = 0;
+                        lum_dir->lmm_stripe_offset = -1;
+                } else {
+                        rc = errno;
+                        goto cleanup;
+                }       
+        }
+
+        if ((lum_file1 = (struct lov_user_md *)malloc(lum_size)) == NULL) {
+                fprintf(stderr, "unable to allocate memory for ioctl's");
+                rc = errno;
+                goto cleanup;
+        }
+
+        fname = strrchr(argv[2], '/');
+        fname++;
+        strncpy((char *)lum_file1, fname, lum_size);
+        rc = ioctl(dirfd(dir), IOC_MDC_GETSTRIPE, lum_file1);
+        if (rc) {
+                rc = errno;
+                goto cleanup;
+        }
+
+        if (argc == 4) {
+                if ((lum_file2 = (struct lov_user_md *)malloc(lum_size)) 
+                    == NULL) {
+                        fprintf(stderr, 
+                                "unable to allocate memory for ioctl's");
+                        rc = errno;
+                        goto cleanup;
+                }
+
+                fname = strrchr(argv[3], '/');
+                fname++;
+                strncpy((char *)lum_file2, fname, lum_size);
+                rc = ioctl(dirfd(dir), IOC_MDC_GETSTRIPE, lum_file2);
+                if (rc) {
+                        rc = errno;
+                        goto cleanup;
+                }
+        }
+
+        rc = compare(lum_dir, lum_file1, lum_file2);
+
+cleanup:
+        if (lum_dir != NULL)
+                free(lum_dir);
+        if (lum_file1 != NULL)
+                free(lum_file1);
+        if (lum_file2 != NULL)
+                free(lum_file2);
+
+        return rc;
+}
index 7200c3f..e4f46dc 100644 (file)
@@ -2,7 +2,7 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include <linux/lustre_user.h>
+#include <lustre/lustre_user.h>
 
 int main(int argc, char **argv)
 {
index ca10134..0def4b2 100644 (file)
@@ -16,7 +16,7 @@
 #include <sys/wait.h>
 #include <sys/ioctl.h>
 
-#include <linux/lustre_user.h>
+#include <lustre/lustre_user.h>
 
 int main(int argc, char *argv[])
 {
index 7495312..ca53e60 100644 (file)
@@ -1781,6 +1781,54 @@ test_64b () {
 }
 run_test 64b "check out-of-space detection on client ============"
 
+# bug 1414 - set/get directories' stripe info
+test_65() {
+       LFS=${LFS:-lfs}
+       LVERIFY=${LVERIFY:-ll_dirstripe_verify}
+
+        stripecount=`cat /proc/fs/lustre/lov/*/stripecount | head -1`
+        if [ $stripecount -eq 0 ]; then
+                stripecount=1
+        fi
+        stripesize=`cat /proc/fs/lustre/lov/*/stripesize | head -1`
+        ostcount=`cat /proc/fs/lustre/lov/*/numobd | head -1`
+
+        echo -n "case 1: dir has no stripe info..."
+        mkdir $DIR/d65
+        touch $DIR/d65/f1
+        $LVERIFY $DIR/d65 $DIR/d65/f1 || error
+       echo "pass"
+
+       echo -n "case 2: setstripe $(($stripesize * 2)) 0 1 ..."
+               $LFS setstripe $DIR/d65 $(($stripesize * 2)) 0 1 || error
+        touch $DIR/d65/f2
+        $LVERIFY $DIR/d65 $DIR/d65/f2 || error
+        echo "pass"
+
+        if [ $ostcount -gt 1 ]; then
+               echo -n "case 3: setstripe $(($stripesize * 4)) 1 $(($ostcount - 1)) ..."
+               $LFS setstripe $DIR/d65 $(($stripesize * 4)) 1 \
+                       $(($ostcount - 1)) || error
+                touch $DIR/d65/f3
+                $LVERIFY $DIR/d65 $DIR/d65/f3 || error
+                echo "pass"
+        fi
+
+        echo -n "case 4: setstripe  $stripesize -1 $(($stripecount - 1)) ..."
+        $LFS setstripe $DIR/d65 $stripesize -1 $(($stripecount - 1)) || error
+        touch $DIR/d65/f4 $DIR/d65/f5
+        $LVERIFY $DIR/d65 $DIR/d65/f4 $DIR/d65/f5 || error
+        echo "pass"
+
+       echo -n "case 5: setstripe 0 -1 0 (default) ..."
+        $LFS setstripe $DIR/d65 0 -1 0 || error
+        touch $DIR/d65/f6
+        $LVERIFY $DIR/d65 $DIR/d65/f6 || error
+        echo "pass"
+}
+run_test 65 "Verify that the files are created using parent dir's stripe info"
+
+
 # on the LLNL clusters, runas will still pick up root's $TMP settings,
 # which will not be writable for the runas user, and then you get a CVS
 # error message with a corrupt path string (CVS bug) and panic.
index 4685e46..238001c 100644 (file)
 
 #include <liblustre.h>
 #include <linux/lustre_idl.h>
-#include <linux/lustre_user.h>
+#include <lustre/liblustreapi.h>
+#include <lustre/lustre_user.h>
 
 #include "parser.h"
 #include "obdctl.h"
 
-extern int op_find(char *path, struct obd_uuid *obduuid, int recursive,
-                int verbose, int quiet);
-extern int op_check(int type_num, char **obd_type_p, char *dir);
-extern int op_catinfo(char *dir, char *keyword, char *node_name);
-
 /* all functions */
 static int lfs_setstripe(int argc, char **argv);
 static int lfs_find(int argc, char **argv);
@@ -55,8 +51,8 @@ static int lfs_catinfo(int argc, char **argv);
 /* all avaialable commands */
 command_t cmdlist[] = {
         {"setstripe", lfs_setstripe, 0,
-         "To create a new file with a specific striping pattern.\n"
-         "usage: setstripe <filename> <stripe size> <stripe start> <stripe count>\n"
+         "To create a new file with a specific striping pattern, or to set default striping pattern on an existing directory\n"
+         "usage: setstripe <filename|dirname> <stripe size> <stripe start> <stripe count>\n"
          "\tstripe size:  Number of bytes in each stripe (0 default)\n"
          "\tstripe start: OST index of first stripe (-1 default)\n"
          "\tstripe count: Number of OSTs to stripe over (0 default)"},
@@ -90,6 +86,7 @@ static int lfs_setstripe(int argc, char **argv)
         long st_size;
         int  st_offset, st_count;
         char *end;
+        struct stat statbuf;
 
         if (argc != 5)
                 return CMD_HELP;
index bb5bbe1..e4b7828 100644 (file)
@@ -45,7 +45,7 @@
 #include <liblustre.h>
 #include <linux/obd.h>
 #include <linux/lustre_lib.h>
-#include <linux/lustre_user.h>
+#include <lustre/lustre_user.h>
 #include <linux/obd_lov.h>
 
 #include <portals/ptlctl.h>
@@ -74,11 +74,15 @@ int op_create_file(char *name, long stripe_size, int stripe_offset,
         lum.lmm_stripe_count = stripe_count;
 
         fd = open(name, O_CREAT | O_RDWR | O_LOV_DELAY_CREATE, 0644);
+        if (errno == EISDIR) 
+                fd = open(name, O_DIRECTORY | O_RDONLY);
+
         if (fd < 0) {
                 err_msg("unable to open '%s'",name);
                 rc = -errno;
                 return rc;
         }
+
         if (ioctl(fd, LL_IOC_LOV_SETSTRIPE, &lum)) {
                 char *errmsg = "stripe already set";
                 if (errno != EEXIST && errno != EALREADY)
@@ -96,7 +100,6 @@ int op_create_file(char *name, long stripe_size, int stripe_offset,
         return rc;
 }
 
-
 struct find_param {
         int     recursive;
         int     verbose;
@@ -250,6 +253,16 @@ void lov_dump_user_lmm_v1(struct lov_user_md_v1 *lum, char *dname, char *fname,
                 obdstripe = 1;
         }
 
+        /* if it's a directory */
+        if (*fname == '\0') {
+                if (header && (obdstripe == 1)) {
+                        printf("count: %d, size: %d, offset: %d\n\n",
+                               lum->lmm_stripe_count, lum->lmm_stripe_size,
+                               (short int)lum->lmm_stripe_offset);
+                }                
+                return;
+        }        
+
         if (header && (obdstripe == 1)) {
                 printf("lmm_magic:          0x%08X\n",  lum->lmm_magic);
                 printf("lmm_object_gr:      "LPX64"\n", lum->lmm_object_gr);
@@ -381,6 +394,23 @@ static int process_dir(DIR *dir, char *dname, struct find_param *param)
                         return rc;
         }
 
+        /* retrieve dir's stripe info */
+        strncpy((char *)param->lum, dname, param->buflen);
+        rc = ioctl(dirfd(dir), LL_IOC_LOV_GETSTRIPE, (void *)param->lum);
+        if (rc) {
+                if (errno == ENODATA) {
+                        if (!param->obduuid && !param->quiet)
+                                printf("%s/%s has no stripe info\n", 
+                                       dname, "");
+                        rc = 0;
+                } else {
+                        err_msg("IOC_MDC_GETSTRIPE ioctl failed");
+                        return errno;
+                }
+        } else {
+               lov_dump_user_lmm(param, dname, "");
+        }
+
         /* Handle the contents of the directory */
         while ((dirp = readdir64(dir)) != NULL) {
                 if (!strcmp(dirp->d_name, ".") || !strcmp(dirp->d_name, ".."))