Whamcloud - gitweb
Branch b1_6
authoryangsheng <yangsheng>
Fri, 6 Mar 2009 18:16:01 +0000 (18:16 +0000)
committeryangsheng <yangsheng>
Fri, 6 Mar 2009 18:16:01 +0000 (18:16 +0000)
b=18503

i=adilger, girish

Build process changes for ldiskfs base on ext4.

build/autoconf/lustre-build.m4
ldiskfs/configure.ac
ldiskfs/ldiskfs/Makefile.in
ldiskfs/ldiskfs/autoMakefile.am

index 9ba15bc..343748d 100644 (file)
@@ -273,6 +273,9 @@ AC_DEFUN([LB_DEFINE_LDISKFS_OPTIONS],
        AC_DEFINE(CONFIG_LDISKFS_FS_XATTR, 1, [enable extended attributes for ldiskfs])
        AC_DEFINE(CONFIG_LDISKFS_FS_POSIX_ACL, 1, [enable posix acls for ldiskfs])
        AC_DEFINE(CONFIG_LDISKFS_FS_SECURITY, 1, [enable fs security for ldiskfs])
+       AC_DEFINE(CONFIG_LDISKFSDEV_FS_POSIX_ACL, 1, [enable posix acls for ldiskfs])
+       AC_DEFINE(CONFIG_LDISKFSDEV_FS_XATTR, 1, [enable extented attributes for ldiskfs])
+       AC_DEFINE(CONFIG_LDISKFSDEV_FS_SECURITY, 1, [enable fs security for ldiskfs])
 ])
 
 #
index e7b19c1..7de84cf 100644 (file)
@@ -33,6 +33,13 @@ $2
 esac
 ])
 
+AC_DEFUN([LC_KERNEL_WITH_EXT4],
+[if test -f $LINUX/fs/ext4/ext4.h ; then
+$1
+else
+$2
+fi
+])
 
 AC_MSG_CHECKING([whether to build kernel modules])
 AC_ARG_ENABLE([modules],
@@ -83,6 +90,25 @@ AM_CONDITIONAL(USE_QUILT, test x$QUILT != xno)
 
 LB_DEFINE_LDISKFS_OPTIONS
 
+AC_MSG_CHECKING([whether to build ldisk base on ext4])
+AC_ARG_ENABLE([ext4],
+             AC_HELP_STRING([--disable-ext4],
+                            [disable building of ldiskfs base on ext4]),[],
+                            [LC_KERNEL_WITH_EXT4([enable_ext4='yes'],
+                            [enable_ext4='no'])])
+AC_MSG_RESULT([$enable_ext4])
+
+if test x$enable_ext4 = xyes ; then
+        BACKFS=ext4
+else
+        BACKFS=ext3
+fi
+AC_SUBST(BACKFS)
+BACKFSU=${BACKFS/ext/EXT}
+AC_SUBST(BACKFSU) # We need a Upper string
+
+AM_CONDITIONAL(USE_EXT4, test x$enable_ext4 = xyes)
+
 AC_MSG_CHECKING([which ldiskfs series to use])
 case $LINUXRELEASE in
 2.6.5*) LDISKFS_SERIES="2.6-suse.series" ;;
@@ -94,12 +120,17 @@ case $LINUXRELEASE in
 2.6.16*) LDISKFS_SERIES="2.6-sles10.series";;
 2.6.18*)
        if test x$RHEL_KENEL = xyes; then
-               LDISKFS_SERIES="2.6-rhel5.series"
+                if test x$enable_ext4 = xyes; then
+                       LDISKFS_SERIES="2.6-rhel5-ext4.series"
+                else
+                       LDISKFS_SERIES="2.6-rhel5.series"
+                fi
        else
                LDISKFS_SERIES="2.6.18-vanilla.series"
        fi
        ;;
 2.6.22*) LDISKFS_SERIES="2.6.22-vanilla.series";;
+2.6.27*) LDISKFS_SERIES="2.6.27-vanilla.series";;
 *) AC_MSG_WARN([Unknown kernel version $LINUXRELEASE, fix ldiskfs/configure.ac])
 esac
 AC_MSG_RESULT([$LDISKFS_SERIES])
index d70d42b..7f369b2 100644 (file)
@@ -3,15 +3,23 @@ default: all
 MODULES := ldiskfs
 
 # copy makefile over to not break patches
-ext3_extra := $(wildcard @LINUX@/fs/ext3/Makefile)
+backfs_extra := $(wildcard @LINUX@/fs/@BACKFS@/Makefile)
 
-ext3_headers := $(wildcard @LINUX@/fs/ext3/*.h)
-linux_headers := $(wildcard @LINUX@/include/linux/ext3*.h)
+backfs_headers := $(wildcard @LINUX@/fs/@BACKFS@/*.h)
+linux_headers := $(wildcard @LINUX@/include/linux/@BACKFS@*.h)
 
-ext3_sources := $(filter-out %.mod.c,$(wildcard @LINUX@/fs/ext3/*.c))
-new_sources := iopen.c iopen.h extents.c mballoc.c group.h fiemap.h
-new_headers := ext3_extents.h 
-ldiskfs_patched_sources := $(notdir $(ext3_sources) $(ext3_headers)) $(new_sources) $(new_headers)
+backfs_sources := $(filter-out %.mod.c,$(wildcard @LINUX@/fs/@BACKFS@/*.c))
+
+ext3_new_sources := iopen.c iopen.h extents.c mballoc.c group.h fiemap.h
+ext3_new_headers := ext3_extents.h 
+
+ext4_new_sources := iopen.c iopen.h fiemap.h
+ext4_new_headers :=
+
+new_sources := $(@BACKFS@_new_sources)
+new_headers := $(@BACKFS@_new_headers)
+
+ldiskfs_patched_sources := $(notdir $(backfs_sources) $(backfs_headers)) $(new_sources) $(new_headers)
 ldiskfs_sources := $(ldiskfs_patched_sources)
 
 ldiskfs-objs := $(filter %.o,$(ldiskfs_sources:.c=.o))
index f7b83ad..13a9558 100644 (file)
@@ -1,40 +1,42 @@
 modulefs_DATA = ldiskfs$(KMODEXT)
 
-ldiskfs_linux_headers := $(addprefix linux/,$(subst ext3,ldiskfs,$(notdir $(linux_headers))))
+ldiskfs_linux_headers := $(addprefix linux/,$(subst @BACKFS@,ldiskfs,$(notdir $(linux_headers))))
 
 $(filter %.c,$(ldiskfs_patched_sources)): sources $(ldiskfs_linux_headers) $(filter %.h,$(ldiskfs_patched_sources))
 
 ldiskfs_sed_flags = \
-       -e "s/dx_hash_info/ext3_dx_hash_info/g" \
-       -e "s/dir_private_info/ext3_dir_private_info/g" \
-       -e "s/DX_HASH/EXT3_DX_HASH/g" \
-       -e "s/reserve_window/ext3_reserve_window/g" \
-       -e "s/rsv_window_add/ext3_rsv_window_add/g" \
-       -e "s/EXT3/LDISKFS/g" -e "s/ext3/ldiskfs/g"
+       -e "s/dx_hash_info/@BACKFS@_dx_hash_info/g" \
+       -e "s/dir_private_info/@BACKFS@_dir_private_info/g" \
+       -e "s/DX_HASH/@BACKFSU@_DX_HASH/g" \
+       -e "s/\<reserve_window/@BACKFS@_reserve_window/g" \
+       -e "s/\<rsv_window_add/@BACKFS@_rsv_window_add/g" \
+       -e "s/@BACKFSU@/LDISKFS/g" -e "s/@BACKFS@/ldiskfs/g"
 
-%.c: linux-stage/fs/ext3/%.c
+%.c: linux-stage/fs/@BACKFS@/%.c
        sed $(strip $(ldiskfs_sed_flags)) $< > $@
 
-%.h: linux-stage/fs/ext3/%.h
+%.h: linux-stage/fs/@BACKFS@/%.h
        sed $(strip $(ldiskfs_sed_flags)) $< > $@
 
-linux/ldiskfs%.h: linux-stage/include/linux/ext3%.h
+linux/ldiskfs%.h: linux-stage/include/linux/@BACKFS@%.h
        sed $(strip $(ldiskfs_sed_flags)) $< > $@
 
 series := @top_srcdir@/kernel_patches/series/ldiskfs-$(LDISKFS_SERIES)
 patches := @top_srcdir@/kernel_patches/patches
 
-sources: $(ext3_sources) $(ext3_headers) $(linux_headers) $(series)
+sources: $(backfs_sources) $(backfs_headers) $(linux_headers) $(series)
        rm -rf linux-stage linux sources $(ldiskfs_SOURCES)
-       mkdir -p linux-stage/fs/ext3 linux-stage/include/linux
-       cp $(ext3_sources) $(ext3_headers) $(ext3_extra) linux-stage/fs/ext3
-       cp $(linux_headers) linux-stage/include/linux
+       mkdir -p linux-stage/fs/@BACKFS@ linux-stage/include/linux
+       cp $(backfs_sources) $(backfs_headers) $(backfs_extra) linux-stage/fs/@BACKFS@
+       if test -n "$(linux_headers)" ; then \
+               cp $(linux_headers) linux-stage/include/linux; \
+       fi
 if USE_QUILT
        ln -s ../$(patches) linux-stage/patches
        ln -s ../$(series) linux-stage/series
        cd linux-stage && quilt push -a -q
 else
-       @echo -n "Applying ext3 patches:"
+       @echo -n "Applying @BACKFS@ patches:"
        @cd linux-stage && for i in $$(<../$(series)) ; do \
                echo -n " $$i" ; \
                patch -s -p1 < ../$(patches)/$$i || exit 1 ; \
@@ -42,16 +44,22 @@ else
        @echo
 endif
        mkdir linux
-       @echo -n "Replacing 'ext3' with 'ldiskfs':"
-       @for i in $(notdir $(ext3_headers) $(ext3_sources)) $(new_sources) ; do \
+       @echo -n "Replacing '@BACKFS@' with 'ldiskfs':"
+       for i in $(notdir $(backfs_headers) $(backfs_sources)) $(new_sources) ; do \
                echo -n " $$i" ; \
                sed $(strip $(ldiskfs_sed_flags)) \
-                       linux-stage/fs/ext3/$$i > $$i ; \
+                       linux-stage/fs/@BACKFS@/$$i > $$i ; \
        done
-       @for i in $(subst ext3,,$(notdir $(linux_headers) $(new_headers))) ; do \
-               echo -n " ext3$$i" ; \
+       for i in $(subst @BACKFS@,,$(notdir $(backfs_headers))) ; do \
+               if test -f "@BACKFS@$$i" ; then \
+                       echo -n " @BACKFS@$$i" ; \
+                       mv @BACKFS@$$i ldiskfs$$i ; \
+               fi ; \
+       done
+       for i in $(subst @BACKFS@,,$(notdir $(linux_headers) $(new_headers))) ; do \
+               echo -n " @BACKFS@$$i" ; \
                sed $(strip $(ldiskfs_sed_flags)) \
-                       linux-stage/include/linux/ext3$$i \
+                       linux-stage/include/linux/@BACKFS@$$i \
                        > linux/ldiskfs$$i ; \
        done
        @echo
@@ -66,7 +74,7 @@ foo-check:
        @echo "ldiskfs_LDADD: $(ldiskfs_LDADD)"
 
 MOSTLYCLEANFILES := @MOSTLYCLEANFILES@ 
-CLEANFILES = sources $(notdir $(linux_headers) $(ext3_headers) $(ext3_sources) $(new_sources) $(new_headers))
+CLEANFILES = sources $(notdir $(linux_headers) $(backfs_headers) $(backfs_sources) $(new_sources) $(new_headers))
 
 clean: clean-am
-       rm -rf linux linux-stage
+       rm -rf linux linux-stage ldiskfs*.h