[Ocfs-commits]
rev 3 - in trunk: . ocfs2 ocfs2/Common ocfs2/Common/inc ocfs2/Linux
redhat tools/bugfix tools/debugocfs tools/format tools/format/inc
tools/fsck tools/libocfs tools/ocfs_uid_gen tools/ocfstool
tools/sizetest unitedlinux
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Sat Jan 24 01:20:21 CST 2004
Author: manish
Date: 2004-01-23 19:20:18 -0600 (Fri, 23 Jan 2004)
New Revision: 3
Modified:
trunk/Makefile
trunk/config.guess
trunk/config.sub
trunk/configure.in
trunk/install-sh
trunk/mkinstalldirs
trunk/ocfs2/Common/inc/ocfs.h
trunk/ocfs2/Common/inc/ocfscom.h
trunk/ocfs2/Common/inc/ocfsconst.h
trunk/ocfs2/Common/inc/ocfsdef.h
trunk/ocfs2/Common/inc/ocfsgenalloc.h
trunk/ocfs2/Common/inc/ocfsgenmisc.h
trunk/ocfs2/Common/inc/ocfsgennm.h
trunk/ocfs2/Common/ocfsgenalloc.c
trunk/ocfs2/Common/ocfsgencreate.c
trunk/ocfs2/Common/ocfsgendirnode.c
trunk/ocfs2/Common/ocfsgendlm.c
trunk/ocfs2/Common/ocfsgenmisc.c
trunk/ocfs2/Common/ocfsgennm.c
trunk/ocfs2/Common/ocfsgenvote.c
trunk/ocfs2/Common/ocfsheartbeat.c
trunk/ocfs2/Linux/ocfsfile.c
trunk/ocfs2/Linux/ocfsiosup.c
trunk/ocfs2/Linux/ocfsmain.c
trunk/ocfs2/Linux/ocfsport.c
trunk/ocfs2/Linux/ocfsproc.c
trunk/ocfs2/Makefile
trunk/redhat/ocfs-2.4.18-e.spec.in
trunk/redhat/ocfs-2.4.21-EL.spec.in
trunk/redhat/ocfs-2.4.9-e.spec.in
trunk/tools/bugfix/Makefile
trunk/tools/debugocfs/Makefile
trunk/tools/debugocfs/debugocfs.1.in
trunk/tools/debugocfs/debugocfs.h
trunk/tools/debugocfs/extfinder.c
trunk/tools/debugocfs/libdebugocfs.c
trunk/tools/debugocfs/main.c
trunk/tools/debugocfs/print.c
trunk/tools/format/Cscope.make
trunk/tools/format/Makefile
trunk/tools/format/format.c
trunk/tools/format/frmtport.c
trunk/tools/format/inc/format.h
trunk/tools/format/inc/frmtport.h
trunk/tools/format/mkfs.ocfs.1.in
trunk/tools/format/mounted.c
trunk/tools/fsck/Cscope.make
trunk/tools/fsck/Makefile
trunk/tools/fsck/fsck.c
trunk/tools/fsck/fsck.h
trunk/tools/fsck/fsck_io.c
trunk/tools/libocfs/Makefile
trunk/tools/libocfs/libocfs.h
trunk/tools/ocfs_uid_gen/ocfs_uid_gen.1.in
trunk/tools/ocfstool/Makefile
trunk/tools/ocfstool/ocfsbrowser.c
trunk/tools/ocfstool/ocfsgenconfig.c
trunk/tools/ocfstool/ocfsguiutil.c
trunk/tools/sizetest/Makefile
trunk/unitedlinux/Makefile
trunk/unitedlinux/ocfs-2.4.19-4GB-SMP.spec.in
trunk/unitedlinux/ocfs-2.4.19-4GB.spec.in
trunk/unitedlinux/ocfs-2.4.19-64GB-SMP.spec.in
Log:
Sync
Modified: trunk/Makefile
===================================================================
--- trunk/Makefile 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/Makefile 2004-01-24 01:20:18 UTC (rev 3)
@@ -50,7 +50,13 @@
rhel3_rpm: rhel3_srpm
rpmbuild --rebuild --target i686 "ocfs-2.4.21-EL-$(DIST_VERSION)-$(RPM_VERSION).src.rpm"
+rhel3ia64_rpm: rhel3_srpm
+ rpmbuild --rebuild --target ia64 "ocfs-2.4.21-EL-$(DIST_VERSION)-$(RPM_VERSION).src.rpm"
+rhel3amd64_rpm: rhel3_srpm
+ rpmbuild --rebuild --target x86_64 "ocfs-2.4.21-EL-$(DIST_VERSION)-$(RPM_VERSION).src.rpm"
+
+
# UNITED LINUX
#
ul64gb_srpm: dist
@@ -72,6 +78,12 @@
ul4gb_rpm: ul4gb_srpm
rpm --rebuild --target i586 "ocfs-2.4.19-4GB-$(DIST_VERSION)-$(RPM_VERSION).src.rpm"
+ul10sp3_%_srpm: dist
+ rpm -bs --define "_sourcedir `pwd`" --define "_srcrpmdir `pwd`" $(TOPDIR)/unitedlinux/ocfs-2.4.21-$(patsubst ul10sp3_%_srpm,%,$@).spec
+
+ul10sp3_%_rpm: ul10sp3_%_srpm
+ rpm --rebuild --target i586 "ocfs-2.4.21-$(patsubst ul10sp3_%_rpm,%,$@)-$(DIST_VERSION)-$(RPM_VERSION).src.rpm"
+
distclean: clean
rm -f Config.make config.status config.cache config.log
Modified: trunk/config.guess
===================================================================
--- trunk/config.guess 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/config.guess 2004-01-24 01:20:18 UTC (rev 3)
@@ -3,7 +3,7 @@
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
-timestamp='2003-05-19'
+timestamp='2004-01-05'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -106,6 +106,7 @@
: ${TMPDIR=/tmp} ;
{ tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
dummy=$tmp/dummy ;
tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
@@ -220,6 +221,9 @@
mvmeppc:OpenBSD:*:*)
echo powerpc-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
+ pegasos:OpenBSD:*:*)
+ echo powerpc-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
pmax:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
@@ -282,6 +286,9 @@
# 1.2 uses "1.2" for uname -r.
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
exit 0 ;;
+ Alpha*:OpenVMS:*:*)
+ echo alpha-hp-vms
+ exit 0 ;;
Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# Should we change UNAME_MACHINE based on the output of uname instead
@@ -303,6 +310,9 @@
*:OS/390:*:*)
echo i370-ibm-openedition
exit 0 ;;
+ *:OS400:*:*)
+ echo powerpc-ibm-os400
+ exit 0 ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit 0;;
@@ -320,6 +330,9 @@
NILE*:*:*:dcosx)
echo pyramid-pyramid-svr4
exit 0 ;;
+ DRS?6000:unix:4.0:6*)
+ echo sparc-icl-nx6
+ exit 0 ;;
DRS?6000:UNIX_SV:4.2*:7*)
case `/usr/bin/uname -p` in
sparc) echo sparc-icl-nx7 && exit 0 ;;
@@ -727,7 +740,7 @@
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
*:UNICOS/mp:*:*)
- echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
@@ -735,6 +748,11 @@
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit 0 ;;
+ 5000:UNIX_System_V:4.*:*)
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit 0 ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
exit 0 ;;
@@ -744,7 +762,7 @@
*:BSD/OS:*:*)
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit 0 ;;
- *:FreeBSD:*:*|*:GNU/FreeBSD:*:*)
+ *:FreeBSD:*:*)
# Determine whether the default compiler uses glibc.
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
@@ -756,7 +774,10 @@
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
+ # GNU/KFreeBSD systems have a "k" prefix to indicate we are using
+ # FreeBSD's kernel, but not the complete OS.
+ case ${LIBC} in gnu) kernel_only='k' ;; esac
+ echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
exit 0 ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
@@ -767,8 +788,8 @@
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
exit 0 ;;
- x86:Interix*:3*)
- echo i586-pc-interix3
+ x86:Interix*:[34]*)
+ echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
exit 0 ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
@@ -789,8 +810,13 @@
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
*:GNU:*:*)
+ # the GNU system
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit 0 ;;
+ *:GNU/*:*:*)
+ # other systems with GNU libc and userland
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+ exit 0 ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit 0 ;;
@@ -878,6 +904,9 @@
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux
exit 0 ;;
+ sh64*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
sh*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
@@ -935,6 +964,9 @@
LIBC=gnuaout
#endif
#endif
+ #ifdef __dietlibc__
+ LIBC=dietlibc
+ #endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
@@ -965,6 +997,9 @@
i*86:atheos:*:*)
echo ${UNAME_MACHINE}-unknown-atheos
exit 0 ;;
+ i*86:syllable:*:*)
+ echo ${UNAME_MACHINE}-pc-syllable
+ exit 0 ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
@@ -1036,7 +1071,7 @@
exit 0 ;;
M68*:*:R3V[567]*:*)
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
- 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0)
+ 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
@@ -1151,7 +1186,7 @@
*:QNX:*:4*)
echo i386-pc-qnx
exit 0 ;;
- NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
+ NSR-?:NONSTOP_KERNEL:*:*)
echo nsr-tandem-nsk${UNAME_RELEASE}
exit 0 ;;
*:NonStop-UX:*:*)
@@ -1192,6 +1227,12 @@
*:ITS:*:*)
echo pdp10-unknown-its
exit 0 ;;
+ SEI:*:*:SEIUX)
+ echo mips-sei-seiux${UNAME_RELEASE}
+ exit 0 ;;
+ *:DRAGONFLY:*:*)
+ echo ${UNAME_MACHINE}-unknown-dragonfly${UNAME_RELEASE}
+ exit 0 ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
Modified: trunk/config.sub
===================================================================
--- trunk/config.sub 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/config.sub 2004-01-24 01:20:18 UTC (rev 3)
@@ -3,7 +3,7 @@
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
-timestamp='2003-05-09'
+timestamp='2004-01-05'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@@ -118,7 +118,8 @@
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
- nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+ nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
+ kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
@@ -228,13 +229,14 @@
| a29k \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+ | am33_2.0 \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
- | clipper \
+ | c4x | clipper \
| d10v | d30v | dlx | dsp16xx \
| fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
- | ip2k \
+ | ip2k | iq2000 \
| m32r | m68000 | m68k | m88k | mcore \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
@@ -247,6 +249,7 @@
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
| mipsisa64 | mipsisa64el \
+ | mipsisa64r2 | mipsisa64r2el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \
@@ -261,7 +264,7 @@
| sh64 | sh64le \
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
| strongarm \
- | tahoe | thumb | tic80 | tron \
+ | tahoe | thumb | tic4x | tic80 | tron \
| v850 | v850e \
| we32k \
| x86 | xscale | xstormy16 | xtensa \
@@ -304,7 +307,7 @@
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \
- | ip2k-* \
+ | ip2k-* | iq2000-* \
| m32r-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | mcore-* \
@@ -319,6 +322,7 @@
| mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \
| mipsisa64-* | mipsisa64el-* \
+ | mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipstx39-* | mipstx39el-* \
@@ -376,6 +380,9 @@
amd64)
basic_machine=x86_64-pc
;;
+ amd64-*)
+ basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
amdahl)
basic_machine=580-amdahl
os=-sysv
@@ -740,6 +747,10 @@
basic_machine=or32-unknown
os=-coff
;;
+ os400)
+ basic_machine=powerpc-ibm
+ os=-os400
+ ;;
OSE68000 | ose68000)
basic_machine=m68000-ericsson
os=-ose
@@ -771,18 +782,24 @@
pentiumpro | p6 | 6x86 | athlon | athlon_*)
basic_machine=i686-pc
;;
- pentiumii | pentium2)
+ pentiumii | pentium2 | pentiumiii | pentium3)
basic_machine=i686-pc
;;
+ pentium4)
+ basic_machine=i786-pc
+ ;;
pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumpro-* | p6-* | 6x86-* | athlon-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
- pentiumii-* | pentium2-*)
+ pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
+ pentium4-*)
+ basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
pn)
basic_machine=pn-gould
;;
@@ -841,6 +858,10 @@
sb1el)
basic_machine=mipsisa64sb1el-unknown
;;
+ sei)
+ basic_machine=mips-sei
+ os=-seiux
+ ;;
sequent)
basic_machine=i386-sequent
;;
@@ -848,6 +869,9 @@
basic_machine=sh-hitachi
os=-hms
;;
+ sh64)
+ basic_machine=sh64-unknown
+ ;;
sparclite-wrs | simso-wrs)
basic_machine=sparclite-wrs
os=-vxworks
@@ -922,10 +946,6 @@
basic_machine=t90-cray
os=-unicos
;;
- tic4x | c4x*)
- basic_machine=tic4x-unknown
- os=-coff
- ;;
tic54x | c54x*)
basic_machine=tic54x-unknown
os=-coff
@@ -951,6 +971,10 @@
tower | tower-32)
basic_machine=m68k-ncr
;;
+ tpf)
+ basic_machine=s390x-ibm
+ os=-tpf
+ ;;
udi29k)
basic_machine=a29k-amd
os=-udi
@@ -1119,19 +1143,19 @@
| -aos* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
- | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
+ | -hiux* | -386bsd* | -knetbsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
- | -powermax* | -dnix*)
+ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@@ -1155,6 +1179,9 @@
-mac*)
os=`echo $os | sed -e 's|mac|macos|'`
;;
+ -linux-dietlibc)
+ os=-linux-dietlibc
+ ;;
-linux*)
os=`echo $os | sed -e 's|linux|linux-gnu|'`
;;
@@ -1167,6 +1194,9 @@
-opened*)
os=-openedition
;;
+ -os400*)
+ os=-os400
+ ;;
-wince*)
os=-wince
;;
@@ -1188,6 +1218,9 @@
-atheos*)
os=-atheos
;;
+ -syllable*)
+ os=-syllable
+ ;;
-386bsd)
os=-bsd
;;
@@ -1210,6 +1243,9 @@
-sinix*)
os=-sysv4
;;
+ -tpf*)
+ os=-tpf
+ ;;
-triton*)
os=-sysv3
;;
@@ -1277,6 +1313,9 @@
arm*-semi)
os=-aout
;;
+ c4x-* | tic4x-*)
+ os=-coff
+ ;;
# This must come before the *-dec entry.
pdp10-*)
os=-tops20
@@ -1455,9 +1494,15 @@
-mvs* | -opened*)
vendor=ibm
;;
+ -os400*)
+ vendor=ibm
+ ;;
-ptx*)
vendor=sequent
;;
+ -tpf*)
+ vendor=ibm
+ ;;
-vxsim* | -vxworks* | -windiss*)
vendor=wrs
;;
Modified: trunk/configure.in
===================================================================
--- trunk/configure.in 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/configure.in 2004-01-24 01:20:18 UTC (rev 3)
@@ -38,12 +38,19 @@
;;
esac
+KERNEL_CFLAGS=
+
case "$host_cpu" in
+ powerpc64)
+ OCFS_PROCESSOR="ppc64"
+ KERNEL_CFLAGS="-m64"
+ ;;
ia64)
OCFS_PROCESSOR="ia64"
;;
x86_64)
OCFS_PROCESSOR="x86_64"
+ KERNEL_CFLAGS="-m64"
;;
i386|i486|i586|i686|i786|k6|k7)
OCFS_PROCESSOR="i686"
@@ -84,7 +91,7 @@
fi
AC_SUBST(OCFS_AIO)
-AC_ARG_ENABLE(memdebug, [ --enable-mem-debug=[yes/no] Turn on memory debugging [default=no]],,enable_memdebug=no)
+AC_ARG_ENABLE(memdebug, [ --enable-memdebug=[yes/no] Turn on memory debugging [default=no]],,enable_memdebug=no)
OCFS_MEMDEBUG=
if test "x$enable_memdebug" = "xyes"; then
OCFS_MEMDEBUG=yes
@@ -98,10 +105,10 @@
fi
AC_SUBST(OCFS_TRACE)
-AC_ARG_ENABLE(largeio, [ --enable-largeio=[yes/no] Turn on largeio [default=no]],,enable_largeio=no)
-OCFS_LARGEIO=
-if test "x$enable_largeio" = "xyes"; then
- OCFS_LARGEIO=yes
+AC_ARG_ENABLE(largeio, [ --enable-largeio=[yes/no] Turn on largeio [default=yes]],,enable_largeio=yes)
+OCFS_LARGEIO=yes
+if test "x$enable_largeio" = "xno"; then
+ OCFS_LARGEIO=
fi
AC_SUBST(OCFS_LARGEIO)
@@ -125,7 +132,10 @@
fi
saved_CPPFLAGS="$CPPFLAGS"
+saved_CFLAGS="$CFLAGS"
+
CPPFLAGS="-I$KERNELINC $CPPFLAGS"
+CFLAGS="$KERNEL_CFLAGS $CFLAGS"
AC_MSG_CHECKING(for kernel version)
rm -f conf.kvertest
@@ -175,9 +185,23 @@
}], rhkernel=yes, rhkernel=no)
AC_MSG_RESULT($rhkernel)
+ulkernel=no
+if test "x$rhkernel" = "xno"; then
+ AC_MSG_CHECKING([for United Linux kernel])
+ AC_EGREP_CPP(kernel_is_United_Linux,
+[#include <linux/autoconf.h>
+#ifdef CONFIG_UNITEDLINUX_KERNEL
+ kernel_is_United_Linux
+#endif
+}], ulkernel=yes)
+ AC_MSG_RESULT($ulkernel)
+fi
+
KVER=
if test "x$rhkernel" = "xyes"; then
KVER=smp
+elif test "x$ulkernel" = "xyes"; then
+ KVER=suse
fi
AC_SUBST(KVER)
@@ -227,6 +251,7 @@
AC_SUBST(MODVERSIONS)
CPPFLAGS="$saved_CPPFLAGS"
+CFLAGS="$saved_CFLAGS"
AC_MSG_CHECKING(for directory for kernel modules)
AC_ARG_WITH(moddir, [ --with-moddir=/path Path to where modules should be installed [/lib/modules/<KVER>/fs]], moddir="$withval", moddir="/lib/modules/$kversion/kernel/fs")
@@ -270,7 +295,8 @@
tools/cdslctl/cdslctl.1
tools/debugocfs/debugocfs.1
tools/format/mkfs.ocfs.1
-tools/fsck/fsck.1
+tools/format/resizeocfs.1
+tools/fsck/fsck.ocfs.1
tools/load_ocfs/load_ocfs.1
tools/ocfs_uid_gen/ocfs_uid_gen.1
tools/ocfstool/ocfstool.1
@@ -280,4 +306,7 @@
unitedlinux/ocfs-2.4.19-64GB-SMP.spec
unitedlinux/ocfs-2.4.19-4GB-SMP.spec
unitedlinux/ocfs-2.4.19-4GB.spec
+unitedlinux/ocfs-2.4.21-107.spec
+unitedlinux/ocfs-2.4.21-111.spec
+unitedlinux/ocfs-2.4.21-138.spec
])
Modified: trunk/install-sh
===================================================================
--- trunk/install-sh 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/install-sh 2004-01-24 01:20:18 UTC (rev 3)
@@ -1,20 +1,39 @@
#!/bin/sh
-#
# install - install a program, script, or datafile
-# This comes from X11R5 (mit/util/scripts/install.sh).
+
+scriptversion=2004-01-12.10
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
#
-# Copyright 1991 by the Massachusetts Institute of Technology
+# Copyright (C) 1994 X Consortium
#
-# Permission to use, copy, modify, distribute, and sell this software and its
-# documentation for any purpose is hereby granted without fee, provided that
-# the above copyright notice appear in all copies and that both that
-# copyright notice and this permission notice appear in supporting
-# documentation, and that the name of M.I.T. not be used in advertising or
-# publicity pertaining to distribution of the software without specific,
-# written prior permission. M.I.T. makes no representations about the
-# suitability of this software for any purpose. It is provided "as is"
-# without express or implied warranty.
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
@@ -23,13 +42,11 @@
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
-
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
-
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
@@ -41,211 +58,253 @@
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
-transformbasename=""
-transform_arg=""
+transformbasename=
+transform_arg=
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
+chowncmd=
+chgrpcmd=
+stripcmd=
rmcmd="$rmprog -f"
mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
+src=
+dst=
+dir_arg=
-while [ x"$1" != x ]; do
- case $1 in
- -c) instcmd="$cpprog"
- shift
- continue;;
+usage="Usage: $0 [OPTION]... SRCFILE DSTFILE
+ or: $0 [OPTION]... SRCFILES... DIRECTORY
+ or: $0 -d DIRECTORIES...
- -d) dir_arg=true
- shift
- continue;;
+In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default.
+In the second, create the directory path DIR.
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
+Options:
+-b=TRANSFORMBASENAME
+-c copy source (using $cpprog) instead of moving (using $mvprog).
+-d create directories instead of installing files.
+-g GROUP $chgrp installed files to GROUP.
+-m MODE $chmod installed files to MODE.
+-o USER $chown installed files to USER.
+-s strip installed files (using $stripprog).
+-t=TRANSFORM
+--help display this help and exit.
+--version display version info and exit.
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
+Environment variables override the default commands:
+ CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
+"
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
+while test -n "$1"; do
+ case $1 in
+ -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+ shift
+ continue;;
- -s) stripcmd="$stripprog"
- shift
- continue;;
+ -c) instcmd=$cpprog
+ shift
+ continue;;
- -t=*) transformarg=`echo $1 | sed 's/-t=//'`
- shift
- continue;;
+ -d) dir_arg=true
+ shift
+ continue;;
- -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
- shift
- continue;;
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
- *) if [ x"$src" = x ]
- then
- src=$1
- else
- # this colon is to work around a 386BSD /bin/sh bug
- :
- dst=$1
- fi
- shift
- continue;;
- esac
-done
+ --help) echo "$usage"; exit 0;;
-if [ x"$src" = x ]
-then
- echo "install: no input file specified"
- exit 1
-else
- :
-fi
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
-if [ x"$dir_arg" != x ]; then
- dst=$src
- src=""
-
- if [ -d $dst ]; then
- instcmd=:
- chmodcmd=""
- else
- instcmd=$mkdirprog
- fi
-else
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
+ -s) stripcmd=$stripprog
+ shift
+ continue;;
- if [ -f $src -o -d $src ]
- then
- :
- else
- echo "install: $src does not exist"
- exit 1
- fi
-
- if [ x"$dst" = x ]
- then
- echo "install: no destination specified"
- exit 1
- else
- :
- fi
+ -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+ shift
+ continue;;
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
+ --version) echo "$0 $scriptversion"; exit 0;;
- if [ -d $dst ]
- then
- dst="$dst"/`basename $src`
- else
- :
- fi
+ *) # When -d is used, all remaining arguments are directories to create.
+ test -n "$dir_arg" && break
+ # Otherwise, the last argument is the destination. Remove it from $@.
+ for arg
+ do
+ if test -n "$dstarg"; then
+ # $@ is not empty: it contains at least $arg.
+ set fnord "$@" "$dstarg"
+ shift # fnord
+ fi
+ shift # arg
+ dstarg=$arg
+ done
+ break;;
+ esac
+done
+
+if test -z "$1"; then
+ if test -z "$dir_arg"; then
+ echo "$0: no input file specified." >&2
+ exit 1
+ fi
+ # It's OK to call `install-sh -d' without argument.
+ # This can happen when creating conditional directories.
+ exit 0
fi
-## this sed command emulates the dirname command
-dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+for src
+do
+ # Protect names starting with `-'.
+ case $src in
+ -*) src=./$src ;;
+ esac
-# Make sure that the destination directory exists.
-# this part is taken from Noah Friedman's mkinstalldirs script
+ if test -n "$dir_arg"; then
+ dst=$src
+ src=
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
- '
-IFS="${IFS-${defaultIFS}}"
+ if test -d "$dst"; then
+ instcmd=:
+ chmodcmd=
+ else
+ instcmd=$mkdirprog
+ fi
+ else
+ # Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+ # might cause directories to be created, which would be especially bad
+ # if $src (and thus $dsttmp) contains '*'.
+ if test ! -f "$src" && test ! -d "$src"; then
+ echo "$0: $src does not exist." >&2
+ exit 1
+ fi
-oIFS="${IFS}"
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS="${oIFS}"
+ if test -z "$dstarg"; then
+ echo "$0: no destination specified." >&2
+ exit 1
+ fi
-pathcomp=''
+ dst=$dstarg
+ # Protect names starting with `-'.
+ case $dst in
+ -*) dst=./$dst ;;
+ esac
-while [ $# -ne 0 ] ; do
- pathcomp="${pathcomp}${1}"
- shift
+ # If destination is a directory, append the input filename; won't work
+ # if double slashes aren't ignored.
+ if test -d "$dst"; then
+ dst=$dst/`basename "$src"`
+ fi
+ fi
- if [ ! -d "${pathcomp}" ] ;
- then
- $mkdirprog "${pathcomp}"
- else
- :
- fi
+ # This sed command emulates the dirname command.
+ dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
- pathcomp="${pathcomp}/"
-done
-fi
+ # Make sure that the destination directory exists.
-if [ x"$dir_arg" != x ]
-then
- $doit $instcmd $dst &&
+ # Skip lots of stat calls in the usual case.
+ if test ! -d "$dstdir"; then
+ defaultIFS='
+ '
+ IFS="${IFS-$defaultIFS}"
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi
-else
+ oIFS=$IFS
+ # Some sh's can't handle IFS=/ for some reason.
+ IFS='%'
+ set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+ IFS=$oIFS
-# If we're going to rename the final executable, determine the name now.
+ pathcomp=
- if [ x"$transformarg" = x ]
- then
- dstfile=`basename $dst`
- else
- dstfile=`basename $dst $transformbasename |
- sed $transformarg`$transformbasename
- fi
+ while test $# -ne 0 ; do
+ pathcomp=$pathcomp$1
+ shift
+ test -d "$pathcomp" || $mkdirprog "$pathcomp"
+ pathcomp=$pathcomp/
+ done
+ fi
-# don't allow the sed command to completely eliminate the filename
+ if test -n "$dir_arg"; then
+ $doit $instcmd "$dst" \
+ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
+ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
+ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
+ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
- if [ x"$dstfile" = x ]
- then
- dstfile=`basename $dst`
- else
- :
- fi
+ else
+ # If we're going to rename the final executable, determine the name now.
+ if test -z "$transformarg"; then
+ dstfile=`basename "$dst"`
+ else
+ dstfile=`basename "$dst" $transformbasename \
+ | sed $transformarg`$transformbasename
+ fi
-# Make a temp file name in the proper directory.
+ # don't allow the sed command to completely eliminate the filename.
+ test -z "$dstfile" && dstfile=`basename "$dst"`
- dsttmp=$dstdir/#inst.$$#
+ # Make a couple of temp file names in the proper directory.
+ dsttmp=$dstdir/_inst.$$_
+ rmtmp=$dstdir/_rm.$$_
-# Move or copy the file name to the temp name
+ # Trap to clean up those temp files at exit.
+ trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
+ trap '(exit $?); exit' 1 2 13 15
- $doit $instcmd $src $dsttmp &&
+ # Move or copy the file name to the temp name
+ $doit $instcmd "$src" "$dsttmp" &&
- trap "rm -f ${dsttmp}" 0 &&
+ # and set any options; do chmod last to preserve setuid bits.
+ #
+ # If any of these fail, we abort the whole thing. If we want to
+ # ignore errors from any of these, just make sure not to ignore
+ # errors from the above "$doit $instcmd $src $dsttmp" command.
+ #
+ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
+ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
+ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
+ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
-# and set any options; do chmod last to preserve setuid bits
+ # Now remove or move aside any old file at destination location. We
+ # try this two ways since rm can't unlink itself on some systems and
+ # the destination file might be busy for other reasons. In this case,
+ # the final cleanup might fail but the new file should still install
+ # successfully.
+ {
+ if test -f "$dstdir/$dstfile"; then
+ $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
+ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
+ || {
+ echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+ (exit 1); exit
+ }
+ else
+ :
+ fi
+ } &&
-# If any of these fail, we abort the whole thing. If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+ fi || { (exit 1); exit; }
+done
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi &&
+# The final little trick to "correctly" pass the exit status to the exit trap.
+{
+ (exit 0); exit
+}
-# Now rename the file to the real destination.
-
- $doit $rmcmd -f $dstdir/$dstfile &&
- $doit $mvcmd $dsttmp $dstdir/$dstfile
-
-fi &&
-
-
-exit 0
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
Modified: trunk/mkinstalldirs
===================================================================
--- trunk/mkinstalldirs 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/mkinstalldirs 2004-01-24 01:20:18 UTC (rev 3)
@@ -1,31 +1,56 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
-# Author: Noah Friedman <friedman at prep.ai.mit.edu>
+
+scriptversion=2003-11-08.23
+
+# Original author: Noah Friedman <friedman at prep.ai.mit.edu>
# Created: 1993-05-16
-# Public domain
+# Public domain.
+#
+# This file is maintained in Automake, please report
+# bugs to <bug-automake at gnu.org> or send patches to
+# <automake-patches at gnu.org>.
-# $Id: mkinstalldirs,v 1.1 2002/07/26 21:51:17 manish Exp $
-
errstatus=0
dirmode=""
usage="\
-Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
+Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
+Create each directory DIR (with mode MODE, if specified), including all
+leading file name components.
+
+Report bugs to <bug-automake at gnu.org>."
+
# process command line arguments
while test $# -gt 0 ; do
- case "${1}" in
- -h | --help | --h* ) # -h for help
- echo "${usage}" 1>&2; exit 0 ;;
- -m ) # -m PERM arg
- shift
- test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
- dirmode="${1}"
- shift ;;
- -- ) shift; break ;; # stop option processing
- -* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option
- * ) break ;; # first non-opt arg
- esac
+ case $1 in
+ -h | --help | --h*) # -h for help
+ echo "$usage"
+ exit 0
+ ;;
+ -m) # -m PERM arg
+ shift
+ test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
+ dirmode=$1
+ shift
+ ;;
+ --version)
+ echo "$0 $scriptversion"
+ exit 0
+ ;;
+ --) # stop option processing
+ shift
+ break
+ ;;
+ -*) # unknown option
+ echo "$usage" 1>&2
+ exit 1
+ ;;
+ *) # first non-opt arg
+ break
+ ;;
+ esac
done
for file
@@ -38,64 +63,81 @@
done
case $# in
-0) exit 0 ;;
+ 0) exit 0 ;;
esac
case $dirmode in
-'')
- if mkdir -p -- . 2>/dev/null; then
- echo "mkdir -p -- $*"
- exec mkdir -p -- "$@"
- fi ;;
-*)
- if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
- echo "mkdir -m $dirmode -p -- $*"
- exec mkdir -m "$dirmode" -p -- "$@"
- fi ;;
+ '')
+ if mkdir -p -- . 2>/dev/null; then
+ echo "mkdir -p -- $*"
+ exec mkdir -p -- "$@"
+ else
+ # On NextStep and OpenStep, the `mkdir' command does not
+ # recognize any option. It will interpret all options as
+ # directories to create, and then abort because `.' already
+ # exists.
+ test -d ./-p && rmdir ./-p
+ test -d ./-- && rmdir ./--
+ fi
+ ;;
+ *)
+ if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
+ echo "mkdir -m $dirmode -p -- $*"
+ exec mkdir -m "$dirmode" -p -- "$@"
+ else
+ # Clean up after NextStep and OpenStep mkdir.
+ for d in ./-m ./-p ./-- "./$dirmode";
+ do
+ test -d $d && rmdir $d
+ done
+ fi
+ ;;
esac
for file
do
- set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
- shift
+ set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+ shift
- pathcomp=
- for d
- do
- pathcomp="$pathcomp$d"
- case "$pathcomp" in
- -* ) pathcomp=./$pathcomp ;;
- esac
+ pathcomp=
+ for d
+ do
+ pathcomp="$pathcomp$d"
+ case $pathcomp in
+ -*) pathcomp=./$pathcomp ;;
+ esac
- if test ! -d "$pathcomp"; then
- echo "mkdir $pathcomp"
+ if test ! -d "$pathcomp"; then
+ echo "mkdir $pathcomp"
- mkdir "$pathcomp" || lasterr=$?
+ mkdir "$pathcomp" || lasterr=$?
- if test ! -d "$pathcomp"; then
- errstatus=$lasterr
- else
- if test ! -z "$dirmode"; then
- echo "chmod $dirmode $pathcomp"
+ if test ! -d "$pathcomp"; then
+ errstatus=$lasterr
+ else
+ if test ! -z "$dirmode"; then
+ echo "chmod $dirmode $pathcomp"
+ lasterr=""
+ chmod "$dirmode" "$pathcomp" || lasterr=$?
- lasterr=""
- chmod "$dirmode" "$pathcomp" || lasterr=$?
-
- if test ! -z "$lasterr"; then
- errstatus=$lasterr
- fi
+ if test ! -z "$lasterr"; then
+ errstatus=$lasterr
fi
fi
- fi
+ fi
+ fi
- pathcomp="$pathcomp/"
- done
+ pathcomp="$pathcomp/"
+ done
done
exit $errstatus
# Local Variables:
# mode: shell-script
-# sh-indentation: 3
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
# End:
-# mkinstalldirs ends here
Modified: trunk/ocfs2/Common/inc/ocfs.h
===================================================================
--- trunk/ocfs2/Common/inc/ocfs.h 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/ocfs2/Common/inc/ocfs.h 2004-01-24 01:20:18 UTC (rev 3)
@@ -40,11 +40,23 @@
#ifdef __i386__
extern inline void prefetch(const void *x);
#endif
+#endif
+
+#ifndef SUSE
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,18)
#ifdef __ia64__
extern inline void prefetch(const void *x);
extern inline void prefetchw(const void *x);
#endif
#endif
+#else
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,21)
+#ifdef __ia64__
+extern inline void prefetch(const void *x);
+extern inline void prefetchw(const void *x);
+#endif
+#endif
+#endif
/*
** System header files
Modified: trunk/ocfs2/Common/inc/ocfscom.h
===================================================================
--- trunk/ocfs2/Common/inc/ocfscom.h 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/ocfs2/Common/inc/ocfscom.h 2004-01-24 01:20:18 UTC (rev 3)
@@ -33,8 +33,7 @@
#define OCFS_GCC_ATTR_PACKED __attribute__ ((packed))
#define OCFS_GCC_ATTR_ALIGNED __attribute__ ((aligned(4)))
#define OCFS_GCC_ATTR_PACKALGN __attribute__ ((aligned(4), packed))
-#endif
-#ifdef __i386__
+#else
#define OCFS_GCC_ATTR_PACKED
#define OCFS_GCC_ATTR_ALIGNED
#define OCFS_GCC_ATTR_PACKALGN
@@ -153,4 +152,10 @@
#define FILEENT(dir,idx) (ocfs_file_entry *) ( ((char *)dir) + \
((dir->index[idx]+1) * OCFS_SECTOR_SIZE))
+#define IS_FE_DELETED(_flg) \
+ (!(_flg) || \
+ ((_flg) & OCFS_SYNC_FLAG_MARK_FOR_DELETION) || \
+ ((_flg) & OCFS_SYNC_FLAG_NAME_DELETED) || \
+ ((_flg) & OCFS_SYNC_FLAG_DELETED))
+
#endif /* _OCFSCOM_H_ */
Modified: trunk/ocfs2/Common/inc/ocfsconst.h
===================================================================
--- trunk/ocfs2/Common/inc/ocfsconst.h 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/ocfs2/Common/inc/ocfsconst.h 2004-01-24 01:20:18 UTC (rev 3)
@@ -42,6 +42,8 @@
#define OCFS_PAGE_SIZE 4096
+#define ULONGLONG_MAX (~0ULL)
+
/*
** The following flag values reflect the operation to be performed
** by ocfs_create_modify_file
@@ -64,6 +66,8 @@
#define FLAG_FILE_DELETE_CDSL 0x1000000
#define FLAG_FILE_CHANGE_TO_CDSL 0x4000000
#define FLAG_FILE_TRUNCATE 0x8000000 // kch- consider removing this and ocfs_truncate_file
+#define FLAG_FILE_ACQUIRE_LOCK 0x10000000
+#define FLAG_FILE_RELEASE_LOCK 0x20000000
enum {
OCFS_INVALID_SYSFILE = -1,
Modified: trunk/ocfs2/Common/inc/ocfsdef.h
===================================================================
--- trunk/ocfs2/Common/inc/ocfsdef.h 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/ocfs2/Common/inc/ocfsdef.h 2004-01-24 01:20:18 UTC (rev 3)
@@ -48,6 +48,8 @@
#define IS_VALID_NODE_NUM(node) \
(((node) >= 0) && ((node) < OCFS_MAXIMUM_NODES))
+#define IS_VALID_OIN(_oin) ((_oin)->obj_id.type == OCFS_TYPE_OIN)
+
#define OCFS_GET_EXTENT(vbo, extent, k) \
do { \
for ((k) = 0; (k) < OCFS_MAX_DATA_EXTENTS; (k)++) { \
@@ -196,7 +198,6 @@
__u64 curr_byte_off;
__s64 curr_dir_off;
void *curr_dir_buf;
- bool cdbuf_vmed; /* true if curr_dir_buf vmalloced */
ocfs_filldir filldir;
}
ocfs_file;
@@ -316,6 +317,7 @@
struct completion complete;
struct task_struct *dlm_task;
__u32 osb_flags;
+ bool blk_zero_write; /* true when blk 0 is written on first mount */
__s64 file_open_cnt; /* num of open files/dirs. vol cannot be dismounted if > 0 */
__u64 publ_map; /* each bit represents state of node */
HASHTABLE root_sect_node; /* lockres->sector_num hash */
@@ -377,6 +379,7 @@
ocfs_dlm_stats dsk_reqst_stats; /* stats of diskdlm vote requests */
ocfs_dlm_stats dsk_reply_stats; /* stats of diskdlm vote reponses */
ocfs_lock_type_stats lock_type_stats; /* stats of lock types taken */
+ __u64 last_disk_seq; /* last vote seq voted on on disk */
char dev_str[20]; /* "major,minor" of the device */
};
@@ -410,6 +413,7 @@
kmem_cache_t *ofile_cache;
kmem_cache_t *fe_cache;
kmem_cache_t *lockres_cache;
+ kmem_cache_t *dirnode_cache;
__u32 flags;
__u32 pref_node_num; /* preferred... osb has the real one */
ocfs_guid guid; /* uniquely identifies a node */
Modified: trunk/ocfs2/Common/inc/ocfsgenalloc.h
===================================================================
--- trunk/ocfs2/Common/inc/ocfsgenalloc.h 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/ocfs2/Common/inc/ocfsgenalloc.h 2004-01-24 01:20:18 UTC (rev 3)
@@ -142,7 +142,7 @@
int ocfs_split_this_tree(ocfs_super * osb, ocfs_extent_group *extent_grp,
ocfs_cleanup_record *CleanupLogRec, ocfs_file_entry *fe);
-int _squish_extent_entries(ocfs_super *osb, ocfs_alloc_ext *extarr, __u32 *freeExtent, ocfs_cleanup_record *CleanupLogRec, __u64 FileSize, bool flag);
+int _squish_extent_entries(ocfs_super *osb, ocfs_alloc_ext *extarr, __u8 *freeExtent, ocfs_cleanup_record *CleanupLogRec, __u64 FileSize, bool flag);
/*
* ocfs_force_get_file_entry()
Modified: trunk/ocfs2/Common/inc/ocfsgenmisc.h
===================================================================
--- trunk/ocfs2/Common/inc/ocfsgenmisc.h 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/ocfs2/Common/inc/ocfsgenmisc.h 2004-01-24 01:20:18 UTC (rev 3)
@@ -66,7 +66,10 @@
ocfs_lock_res *_l = NULL; \
_l = (ocfs_lock_res *)ocfs_dbg_slab_alloc \
(OcfsGlobalCtxt.lockres_cache, __FILE__, __LINE__); \
- if (_l) atomic_inc (&(OcfsGlobalCtxt.cnt_lockres)); \
+ if (_l) { \
+ memset (_l, 0, sizeof(ocfs_lock_res)); \
+ atomic_inc (&(OcfsGlobalCtxt.cnt_lockres)); \
+ } \
_l; \
})
@@ -82,7 +85,10 @@
ocfs_lock_res *_l = NULL; \
_l = (ocfs_lock_res *)kmem_cache_alloc \
(OcfsGlobalCtxt.lockres_cache, GFP_NOFS); \
- if (_l) atomic_inc (&(OcfsGlobalCtxt.cnt_lockres)); \
+ if (_l) { \
+ memset (_l, 0, sizeof(ocfs_lock_res)); \
+ atomic_inc (&(OcfsGlobalCtxt.cnt_lockres)); \
+ } \
_l; \
})
@@ -162,10 +168,7 @@
#define ocfs_release_ofile(of) \
do { \
if (of) { \
- if ((of)->cdbuf_vmed) \
- ocfs_safevfree ((of)->curr_dir_buf); \
- else \
- ocfs_safefree ((of)->curr_dir_buf); \
+ ocfs_release_dirnode ((of)->curr_dir_buf); \
ocfs_dbg_slab_free (OcfsGlobalCtxt.ofile_cache, (of)); \
} \
} while (0)
@@ -183,10 +186,7 @@
#define ocfs_release_ofile(of) \
do { \
if (of) { \
- if ((of)->cdbuf_vmed) \
- ocfs_safevfree ((of)->curr_dir_buf); \
- else \
- ocfs_safefree ((of)->curr_dir_buf); \
+ ocfs_release_dirnode ((of)->curr_dir_buf); \
kmem_cache_free (OcfsGlobalCtxt.ofile_cache, (of)); \
} \
} while (0)
@@ -248,6 +248,41 @@
} \
oin; }))
#endif
+
+/* dirnode macros */
+#ifdef OCFS_MEM_DBG
+#define ocfs_allocate_dirnode() \
+((ocfs_dir_node *)({ \
+ ocfs_dir_node *_dn = NULL; \
+ _dn = ocfs_dbg_slab_alloc (OcfsGlobalCtxt.dirnode_cache, __FILE__, __LINE__); \
+ if (_dn) \
+ memset (_dn, 0, OCFS_DEFAULT_DIR_NODE_SIZE); \
+ _dn; }))
+
+#define ocfs_release_dirnode(_dn) \
+ do { \
+ if (_dn) { \
+ ocfs_dbg_slab_free (OcfsGlobalCtxt.dirnode_cache, (_dn));\
+ (_dn) = NULL; \
+ } \
+ } while (0)
+#else /* !OCFS_MEM_DBG */
+#define ocfs_allocate_dirnode() \
+((ocfs_dir_node *)({ \
+ ocfs_dir_node *_dn = NULL; \
+ _dn = kmem_cache_alloc (OcfsGlobalCtxt.dirnode_cache, GFP_NOFS);\
+ if (_dn) \
+ memset (_dn, 0, OCFS_DEFAULT_DIR_NODE_SIZE); \
+ _dn; }))
+
+#define ocfs_release_dirnode(_dn) \
+ do { \
+ if (_dn) { \
+ kmem_cache_free (OcfsGlobalCtxt.dirnode_cache, (_dn));\
+ (_dn) = NULL; \
+ } \
+ } while (0)
+#endif
#endif /* !USERSPACE_TOOL */
@@ -314,7 +349,17 @@
if (x) \
ocfs_safefree(oin); })
+/* dirnode macros */
+#define ocfs_allocate_dirnode() \
+((ocfs_dir_node *)({ \
+ ocfs_dir_node *_dn = NULL; \
+ _dn = (ocfs_dir_node *)ocfs_malloc(OCFS_DEFAULT_DIR_NODE_SIZE);\
+ if (_dn) \
+ memset (_dn, 0, OCFS_DEFAULT_DIR_NODE_SIZE); \
+ _dn; }))
+#define ocfs_release_dirnode(_dn) ocfs_safefree(_dn)
+
#endif /* USERSPACE_TOOL */
#endif /* _OCFSGENMISC_H_ */
Modified: trunk/ocfs2/Common/inc/ocfsgennm.h
===================================================================
--- trunk/ocfs2/Common/inc/ocfsgennm.h 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/ocfs2/Common/inc/ocfsgennm.h 2004-01-24 01:20:18 UTC (rev 3)
@@ -32,6 +32,9 @@
int ocfs_disk_update_resource (ocfs_super * osb, ocfs_lock_res * lockres,
ocfs_file_entry * file_ent, __u32 timeout);
+int ocfs_check_for_stale_lock(ocfs_super *osb, ocfs_lock_res *lockres,
+ ocfs_file_entry *fe, __u64 lock_id);
+
int ocfs_find_update_res (ocfs_super * osb, __u64 lock_id,
ocfs_lock_res ** lockres, ocfs_file_entry * fe,
__u32 * updated, __u32 timeout);
Modified: trunk/ocfs2/Common/ocfsgenalloc.c
===================================================================
--- trunk/ocfs2/Common/ocfsgenalloc.c 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/ocfs2/Common/ocfsgenalloc.c 2004-01-24 01:20:18 UTC (rev 3)
@@ -1238,7 +1238,7 @@
} /* _write_free_extent_log */
-int _squish_extent_entries(ocfs_super *osb, ocfs_alloc_ext *extarr, __u32 *freeExtent,
+int _squish_extent_entries(ocfs_super *osb, ocfs_alloc_ext *extarr, __u8 *freeExtent,
ocfs_cleanup_record *CleanupLogRec, __u64 FileSize, bool flag)
{
int status = 0;
@@ -1909,7 +1909,7 @@
/* local extents */
if (FileEntry->local_ext) {
LOG_TRACE_STR("local extents, calling _squish_extent_entries");
- status = _squish_extent_entries(osb, FileEntry->extents, (__u32 *)&FileEntry->next_free_ext, CleanupLogRec, alloc_size, false);
+ status = _squish_extent_entries(osb, FileEntry->extents, &FileEntry->next_free_ext, CleanupLogRec, alloc_size, false);
LOG_TRACE_ARGS("return from _squish_extent_entries, status=%d",
status);
Modified: trunk/ocfs2/Common/ocfsgencreate.c
===================================================================
--- trunk/ocfs2/Common/ocfsgencreate.c 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/ocfs2/Common/ocfsgencreate.c 2004-01-24 01:20:18 UTC (rev 3)
@@ -50,9 +50,9 @@
#ifndef USERSPACE_TOOL
struct list_head *iter;
struct list_head *temp_iter;
+ struct dentry *dentry;
#endif
int disk_len;
- struct dentry *dentry;
/* We are setting the oin Updated flag in the end. */
LOG_ENTRY ();
@@ -68,16 +68,11 @@
/* Make sure that what we found is not a directory. */
if (!(oin->oin_flags & OCFS_OIN_DIRECTORY)) {
/* Add checks as needed */
- if ((fe->sync_flags & OCFS_SYNC_FLAG_MARK_FOR_DELETION) ||
+ if (IS_FE_DELETED(fe->sync_flags) ||
(!(fe->sync_flags & OCFS_SYNC_FLAG_VALID))) {
- if (fe->sync_flags & OCFS_SYNC_FLAG_MARK_FOR_DELETION) {
- LOG_ERROR_ARGS ("File marked for deletion: %*s",
- fe->filename_len, fe->filename);
- } else {
- LOG_ERROR_ARGS ("File is not valid: %*s",
- fe->filename_len, fe->filename);
- }
-
+ LOG_TRACE_ARGS ("Invalid file: %*s, syncflg=0x%X",
+ fe->filename_len, fe->filename,
+ fe->sync_flags);
OCFS_SET_FLAG (oin->oin_flags, OCFS_OIN_INVALID);
/* ?? I think we should remove the oin here from the oin list */
status = -ENOENT;
@@ -87,7 +82,7 @@
disk_len = strlen(fe->filename);
inode = oin->inode;
if (inode == NULL) {
- LOG_ERROR_ARGS ("oin has no matching inode: %*s",
+ LOG_TRACE_ARGS ("oin has no matching inode: %*s",
fe->filename_len, fe->filename);
OCFS_SET_FLAG (oin->oin_flags, OCFS_OIN_INVALID);
status = -ENOENT;
@@ -106,7 +101,7 @@
}
}
if (status < 0) {
- LOG_ERROR_ARGS ("name did not match inode: %*s",
+ LOG_TRACE_ARGS ("name did not match inode: %*s, %d",
fe->filename_len, fe->filename);
OCFS_SET_FLAG (oin->oin_flags, OCFS_OIN_INVALID);
goto leave;
@@ -600,7 +595,6 @@
ocfs_lock_res *lockres = NULL;
bool bReadDirNode = true;
ocfs_file_entry *dirfe = NULL;
- bool icky_vmalloc = false;
bool lock_acq = false;
LOG_ENTRY_ARGS ("(osb=0x%p, poff=%u.%u, fe=0x%p)\n",
@@ -627,22 +621,14 @@
if ((ofile == NULL)
|| ((ofile != NULL) && (ofile->curr_dir_buf == NULL))) {
- pDirNode = ocfs_malloc (osb->vol_layout.dir_node_size);
+ pDirNode = ocfs_allocate_dirnode();
if (pDirNode == NULL) {
- pDirNode = vmalloc (osb->vol_layout.dir_node_size);
- icky_vmalloc = true;
- }
- if (pDirNode == NULL) {
- icky_vmalloc = false;
LOG_ERROR_STATUS (status = -ENOMEM);
goto leave;
}
- memset (pDirNode, 0, osb->vol_layout.dir_node_size);
-
if (ofile != NULL) {
ofile->curr_dir_buf = pDirNode;
- ofile->cdbuf_vmed = icky_vmalloc;
}
} else {
pDirNode = ofile->curr_dir_buf;
@@ -700,10 +686,7 @@
ocfs_put_lockres (lockres);
if (ofile == NULL && pDirNode) {
- if (icky_vmalloc)
- ocfs_safevfree(pDirNode);
- else
- ocfs_safefree(pDirNode);
+ ocfs_release_dirnode (pDirNode);
}
LOG_EXIT_STATUS (status);
@@ -1506,7 +1489,6 @@
ocfs_dir_node *PDirNode = NULL;
ocfs_dir_node *PNewDirNode = NULL;
ocfs_dir_node *pLockNode = NULL;
- __u32 size;
__u64 allocSize = 0;
__u64 bitmapOffset;
__u64 numClustersAlloc = 0;
@@ -1563,16 +1545,13 @@
if (DISK_LOCK_FILE_LOCK (pLockNode) != OCFS_DLM_ENABLE_CACHE_LOCK)
DISK_LOCK_FILE_LOCK (fileEntry) = OCFS_DLM_NO_LOCK;
- size = (__u32) (osb->vol_layout.dir_node_size);
- PDirNode = ocfs_malloc (size);
+ PDirNode = ocfs_allocate_dirnode();
if (PDirNode == NULL) {
LOG_ERROR_STATUS (status = -ENOMEM);
goto leave;
}
PNewDirNode = PDirNode;
- size = (__u32) (osb->vol_layout.dir_node_size);
- memset (PNewDirNode, 0, size);
ocfs_initialize_dir_node (osb, PNewDirNode, bitmapOffset, fileOffset,
osb->node_num);
@@ -1636,7 +1615,7 @@
if (tmpstat < 0)
LOG_ERROR_STATUS (tmpstat);
}
- ocfs_safefree (PDirNode);
+ ocfs_release_dirnode (PDirNode);
ocfs_release_file_entry ((ocfs_file_entry *) pLockNode);
ocfs_put_lockres (pLockResource);
LOG_EXIT_STATUS (status);
@@ -1653,7 +1632,6 @@
ocfs_file_entry *fileEntry = NULL;
ocfs_dir_node *PDirNode = NULL;
ocfs_dir_node *pLockNode = NULL;
- __u32 size;
__u64 lockId = 0;
ocfs_lock_res *pLockResource = NULL;
__u32 lockFlags = 0;
@@ -1688,8 +1666,7 @@
/* Change the name and write it back... */
fileEntry = fe;
- size = (__u32) (osb->vol_layout.dir_node_size);
- PDirNode = ocfs_malloc (size);
+ PDirNode = ocfs_allocate_dirnode();
if (PDirNode == NULL) {
LOG_ERROR_STATUS (status = -ENOMEM);
goto leave;
@@ -1724,7 +1701,7 @@
if (tmpstat < 0)
LOG_ERROR_STATUS (tmpstat);
}
- ocfs_safefree (PDirNode);
+ ocfs_release_dirnode (PDirNode);
ocfs_release_file_entry ((ocfs_file_entry *) pLockNode);
ocfs_put_lockres (pLockResource);
LOG_EXIT_STATUS (status);
@@ -2678,7 +2655,7 @@
int status = 0, tmpstat = 0;
ocfs_file_entry *fileEntry = NULL;
ocfs_dir_node *PDirNode = NULL, *pLockNode = NULL;
- __u32 size, length;
+ __u32 length;
__u64 lockId = 0, bitmapOffset, numClustersAlloc;
ocfs_lock_res *pLockResource = NULL;
__u32 lockFlags = 0;
@@ -2753,8 +2730,7 @@
goto leave;
}
- size = (__u32) (osb->vol_layout.dir_node_size);
- PDirNode = ocfs_malloc (size);
+ PDirNode = ocfs_allocate_dirnode();
if (PDirNode == NULL) {
LOG_ERROR_STATUS (status = -ENOMEM);
goto leave;
@@ -2771,8 +2747,6 @@
DISK_LOCK_WRITER_NODE (fileEntry) = osb->node_num;
DISK_LOCK_READER_NODE (fileEntry) = osb->node_num;
- LOG_TRACE_ARGS ("PDirNode has a Lock = %d\n", DISK_LOCK_FILE_LOCK (PDirNode));
-
status = ocfs_insert_file (osb, PDirNode, fileEntry, pLockNode,
pLockResource);
if (status < 0) {
@@ -2791,7 +2765,7 @@
LOG_ERROR_STATUS (tmpstat);
}
- ocfs_safefree (PDirNode);
+ ocfs_release_dirnode (PDirNode);
ocfs_release_file_entry ((ocfs_file_entry *) pLockNode);
ocfs_safefree (buffer);
ocfs_put_lockres (pLockResource);
Modified: trunk/ocfs2/Common/ocfsgendirnode.c
===================================================================
--- trunk/ocfs2/Common/ocfsgendirnode.c 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/ocfs2/Common/ocfsgendirnode.c 2004-01-24 01:20:18 UTC (rev 3)
@@ -902,7 +902,7 @@
for (i = start; i < DirNode->num_ent_used; i++) {
fe = FILEENT (DirNode, i);
- if ((fe->sync_flags & OCFS_SYNC_FLAG_NAME_DELETED) ||
+ if (IS_FE_DELETED(fe->sync_flags) ||
(!(fe->sync_flags & OCFS_SYNC_FLAG_VALID))) {
continue;
}
@@ -1055,7 +1055,7 @@
if (DirNode->index_dirty) {
for (index = start; index < DirNode->num_ent_used; index++) {
fe = FILEENT (DirNode, index);
- if ((fe->sync_flags & OCFS_SYNC_FLAG_NAME_DELETED) ||
+ if (IS_FE_DELETED(fe->sync_flags) ||
(!(fe->sync_flags & OCFS_SYNC_FLAG_VALID))) {
continue;
}
@@ -1079,11 +1079,11 @@
fe = FILEENT (DirNode, index);
- if ((fe->sync_flags & OCFS_SYNC_FLAG_NAME_DELETED) ||
+ if (IS_FE_DELETED(fe->sync_flags) ||
(!(fe->sync_flags & OCFS_SYNC_FLAG_VALID))) {
for (index = lowBnd; index < (lowBnd + upBnd); index++) {
fe = FILEENT (DirNode, index);
- if ((fe->sync_flags & OCFS_SYNC_FLAG_NAME_DELETED) ||
+ if (IS_FE_DELETED(fe->sync_flags) ||
(!(fe->sync_flags & OCFS_SYNC_FLAG_VALID))) {
continue;
}
@@ -1139,15 +1139,14 @@
ocfs_dir_node *pDirNode = NULL;
ocfs_file_entry *pInsertEntry;
ocfs_file_entry *fe;
- __u32 size, index;
+ __u32 index;
__u8 offset = 0;
int res;
LOG_ENTRY ();
if (DirNode == NULL) {
- size = (__u32) (osb->vol_layout.dir_node_size);
- pDirNode = ocfs_malloc (size);
+ pDirNode = ocfs_allocate_dirnode();
if (pDirNode == NULL) {
LOG_ERROR_STATUS (status = -ENOMEM);
goto leave;
@@ -1171,7 +1170,7 @@
for (index = 0; index < pDirNode->num_ent_used; index++) {
fe = FILEENT (pDirNode, index);
- if ((fe->sync_flags & OCFS_SYNC_FLAG_NAME_DELETED) ||
+ if (IS_FE_DELETED(fe->sync_flags) ||
(!(fe->sync_flags & OCFS_SYNC_FLAG_VALID))) {
continue;
}
@@ -1200,7 +1199,7 @@
}
leave:
if (DirNode == NULL)
- ocfs_safefree (pDirNode);
+ ocfs_release_dirnode (pDirNode);
LOG_EXIT_STATUS (status);
return status;
@@ -1372,7 +1371,6 @@
int status = 0;
int tmpstat = 0;
__u32 offset;
- __u32 size;
ocfs_dir_node *PDirNode = NULL;
ocfs_file_entry *fe;
ocfs_lock_res *dir_lres = NULL;
@@ -1395,8 +1393,7 @@
}
lock_acq = true;
- size = (__u32) (osb->vol_layout.dir_node_size);
- PDirNode = ocfs_malloc (size);
+ PDirNode = ocfs_allocate_dirnode();
if (PDirNode == NULL) {
LOG_ERROR_STATUS (status = -ENOMEM);
goto leave;
@@ -1490,7 +1487,7 @@
LOG_ERROR_STATUS (tmpstat);
}
- ocfs_safefree (PDirNode);
+ ocfs_release_dirnode (PDirNode);
LOG_EXIT_STATUS (status);
return status;
} /* ocfs_del_file_entry */
@@ -1507,7 +1504,6 @@
__u64 bitmapOffset = 0;
__u64 numClustersAlloc = 0;
ocfs_dir_node *pNewDirNode = NULL;
- __u32 size;
__s32 indexOffset = -1;
LOG_ENTRY ();
@@ -1531,8 +1527,7 @@
goto leave;
}
} else {
- size = (__u32) (osb->vol_layout.dir_node_size);
- pNewDirNode = ocfs_malloc (size);
+ pNewDirNode = ocfs_allocate_dirnode();
if (pNewDirNode == NULL) {
LOG_ERROR_STATUS (status = -ENOMEM);
goto leave;
@@ -1633,7 +1628,7 @@
}
}
leave:
- ocfs_safefree (pNewDirNode);
+ ocfs_release_dirnode (pNewDirNode);
LOG_EXIT_STATUS (status);
return status;
Modified: trunk/ocfs2/Common/ocfsgendlm.c
===================================================================
--- trunk/ocfs2/Common/ocfsgendlm.c 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/ocfs2/Common/ocfsgendlm.c 2004-01-24 01:20:18 UTC (rev 3)
@@ -72,6 +72,7 @@
ocfs_acquire_lockres (lockres);
votemap = (1 << lockres->master_node_num);
+ flags |= FLAG_FILE_ACQUIRE_LOCK;
ocfs_compute_lock_type_stats (&(osb->lock_type_stats),
OCFS_UPDATE_LOCK_STATE);
@@ -385,6 +386,21 @@
timewaited += WAIT_FOR_VOTE_INCREMENT;
}
+ LOG_TRACE_ARGS("probing the node %d for possible stale lock, lockid=%u.%u\n",
+ lockres->master_node_num, HILO (lockres->sector_num));
+
+ status = ocfs_update_master_on_open (osb, lockres);
+ if (status >= 0) {
+ tmpstat = ocfs_read_disk (osb, fe, osb->sect_size, offset);
+ if (tmpstat < 0) {
+ LOG_ERROR_STATUS(tmpstat);
+ status = tmpstat;
+ }
+ if (DISK_LOCK_FILE_LOCK(fe) < lockres->lock_type) {
+ LOG_TRACE_STR("stale lock was found and corrected!");
+ }
+ }
+
finally:
if (status == -ETIMEDOUT) {
LOG_ERROR_ARGS ("WARNING: timeout lockid=%u.%u, master=%u, "
@@ -398,6 +414,7 @@
lockres->master_node_num = DISK_LOCK_CURRENT_MASTER (fe);
lockres->oin_openmap = DISK_LOCK_OIN_MAP (fe);
lockres->last_lock_upd = DISK_LOCK_LAST_WRITE (fe);
+ lockres->lock_type = DISK_LOCK_FILE_LOCK(fe);
ocfs_release_lockres (lockres);
}
@@ -770,6 +787,8 @@
ocfs_compute_lock_type_stats (&(osb->lock_type_stats),
OCFS_MAKE_LOCK_MASTER);
+ flags |= FLAG_FILE_ACQUIRE_LOCK;
+
#ifndef USERSPACE_TOOL
if (comm_voting && !*disk_vote) {
LOG_TRACE_STR ("Network vote");
@@ -1145,6 +1164,12 @@
LOG_ERROR_STATUS (status);
goto bail;
}
+
+ status = ocfs_check_for_stale_lock(osb, lockres, NULL, lock_id);
+ if (status < 0) {
+ LOG_ERROR_STATUS (status);
+ goto bail;
+ }
status = ocfs_insert_sector_node (osb, lockres, &tmp_lockres);
if (status < 0) {
@@ -1195,12 +1220,8 @@
/* this node also. If u are the master then update File_entry */
/* and set the bit that this node has a open */
status = ocfs_update_master_on_open (osb, lockres);
- if (status < 0) {
- ocfs_release_lockres (lockres);
- if (status != -EINTR)
- LOG_ERROR_STATUS (status);
- goto bail;
- }
+ if (status < 0 && status != -EINTR)
+ LOG_ERROR_STATUS (status);
}
ocfs_release_lockres (lockres);
@@ -1366,7 +1387,8 @@
#endif
if (lockres->master_node_num != OCFS_INVALID_NODE_NUM) {
if (!IS_VALID_NODE_NUM (lockres->master_node_num)) {
- LOG_ERROR_STATUS(status = -EINVAL);
+ status = -EINVAL;
+ LOG_ERROR_ARGS ("node=%d, status = %d", lockres->master_node_num, status);
goto finally;
}
}
@@ -1706,6 +1728,7 @@
ocfs_compute_lock_type_stats (&(osb->lock_type_stats),
OCFS_DISK_RELEASE_LOCK);
+ flags |= FLAG_FILE_RELEASE_LOCK;
status = -EAGAIN;
while (status == -EAGAIN) {
#ifndef USERSPACE_TOOL
@@ -2347,6 +2370,7 @@
bool disk_vote = false;
unsigned long jif;
bool disk_reset = true;
+ __u32 flags = FLAG_FILE_RELEASE_CACHE | FLAG_FILE_ACQUIRE_LOCK;
LOG_ENTRY_ARGS ("(osb=0x%p, lres=0x%p, fe=0x%p)\n", osb, lockres, fe);
@@ -2375,8 +2399,7 @@
LOG_TRACE_STR ("Network vote");
jif = jiffies;
status = ocfs_send_dlm_request_msg (osb, lockres->sector_num,
- lockres->lock_type,
- FLAG_FILE_RELEASE_CACHE,
+ lockres->lock_type, flags,
lockres, votemap);
if (status >= 0) {
status = lockres->vote_status;
@@ -2401,9 +2424,8 @@
jif = jiffies;
disk_reset = false;
status = ocfs_request_vote (osb, lockres->sector_num,
- lockres->lock_type,
- FLAG_FILE_RELEASE_CACHE, votemap,
- &lockseqno);
+ lockres->lock_type, flags,
+ votemap, &lockseqno);
if (status < 0) {
if (status == -EAGAIN)
goto reset;
@@ -2412,9 +2434,8 @@
}
status = ocfs_wait_for_vote (osb, lockres->sector_num,
- lockres->lock_type,
- FLAG_FILE_RELEASE_CACHE, votemap,
- 15000, lockseqno, lockres);
+ lockres->lock_type, flags,
+ votemap, 15000, lockseqno, lockres);
if (status < 0) {
if (status == -EAGAIN)
goto reset;
Modified: trunk/ocfs2/Common/ocfsgenmisc.c
===================================================================
--- trunk/ocfs2/Common/ocfsgenmisc.c 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/ocfs2/Common/ocfsgenmisc.c 2004-01-24 01:20:18 UTC (rev 3)
@@ -153,6 +153,7 @@
}
ocfs_init_sem (&(oin->main_res));
+ ocfs_init_sem (&(oin->paging_io_res));
OCFS_SET_FLAG (oin->oin_flags, OCFS_INITIALIZED_MAIN_RESOURCE);
/* Initialize the alloc size value here, file size will come later in i_size */
@@ -202,15 +203,12 @@
} else
lock_acq = true;
- size = (__u32) osb->vol_layout.dir_node_size;
- NewDirNode = ocfs_malloc (size);
+ NewDirNode = ocfs_allocate_dirnode();
if (NewDirNode == NULL) {
LOG_ERROR_STATUS (status = -ENOMEM);
goto bail;
}
- memset (NewDirNode, 0, size);
-
size = (ONE_MEGA_BYTE > osb->vol_layout.cluster_size) ?
ONE_MEGA_BYTE : osb->vol_layout.cluster_size;
@@ -284,7 +282,9 @@
volDiskHdr->root_off = osb->vol_layout.root_start_off;
volDiskHdr->internal_off = osb->vol_layout.root_int_off;
+ osb->blk_zero_write = true;
status = ocfs_write_disk (osb, (__s8 *) volDiskHdr, size, 0);
+ osb->blk_zero_write = false;
if (status < 0) {
LOG_ERROR_STATUS (status);
goto bail;
@@ -305,7 +305,7 @@
osb->vol_state = VOLUME_DISABLED;
}
}
- ocfs_safefree (NewDirNode);
+ ocfs_release_dirnode (NewDirNode);
ocfs_safefree (volDiskHdr);
ocfs_safefree (buf);
ocfs_release_file_entry (sys_fe);
@@ -608,6 +608,8 @@
osb->log_meta_disk_off = 0;
osb->trans_in_progress = false;
+ osb->last_disk_seq = ULONGLONG_MAX;
+
init_MUTEX (&(osb->publish_lock));
atomic_set (&osb->node_req_vote, 0);
Modified: trunk/ocfs2/Common/ocfsgennm.c
===================================================================
--- trunk/ocfs2/Common/ocfsgennm.c 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/ocfs2/Common/ocfsgennm.c 2004-01-24 01:20:18 UTC (rev 3)
@@ -46,6 +46,9 @@
LOG_ENTRY ();
+ if (!IS_VALID_OIN(oin))
+ BUG();
+
if (oin->oin_flags & OCFS_OIN_DIRECTORY)
goto bail;
@@ -121,6 +124,51 @@
return status;
} /* ocfs_disk_update_resource */
+
+int ocfs_check_for_stale_lock(ocfs_super *osb, ocfs_lock_res *lockres, ocfs_file_entry *fe, __u64 lock_id)
+{
+ int status = 0;
+ ocfs_file_entry *tmpfe = NULL;
+
+ LOG_ENTRY_ARGS ("(0x%p, 0x%p, 0x%p, %u.%u)\n", osb, lockres, fe,
+ HILO(lock_id));
+
+ if (fe == NULL) {
+ tmpfe = ocfs_allocate_file_entry ();
+ if (tmpfe == NULL) {
+ LOG_ERROR_STATUS (status == -ENOMEM);
+ goto bail;
+ }
+ status = ocfs_read_force_disk (osb, tmpfe, osb->sect_size, lock_id);
+ if (status < 0) {
+ LOG_ERROR_STATUS(status);
+ goto bail;
+ }
+ fe = tmpfe;
+ }
+
+ /* should NEVER see am EXCLUSIVE on disk when creating lockres */
+ /* indicates that a lock was held when the node died */
+ if (lockres->lock_type == OCFS_DLM_EXCLUSIVE_LOCK &&
+ lockres->master_node_num == osb->node_num) {
+ LOG_TRACE_ARGS("stale lock found! lockid=%u.%u\n", HILO(lock_id));
+ lockres->lock_type = OCFS_DLM_NO_LOCK;
+ DISK_LOCK_FILE_LOCK (fe) = OCFS_DLM_NO_LOCK;
+ status = ocfs_write_force_disk (osb, fe, osb->sect_size, lock_id);
+ if (status < 0) {
+ LOG_ERROR_ARGS("error updating stale lockid=%u.%u\n",
+ HILO(lock_id));
+ }
+ }
+
+bail:
+ if (tmpfe)
+ ocfs_release_file_entry(tmpfe);
+
+ LOG_EXIT_STATUS(status);
+ return status;
+}
+
/*
* ocfs_find_update_res()
*
@@ -171,13 +219,19 @@
}
if (lock_id != (*lockres)->sector_num) {
- LOG_ERROR_ARGS ("lockid=%u.%u != secnum=%u.%u",
+ LOG_ERROR_ARGS ("lockid=%u.%u != secnum=%u.%u\n",
HILO(lock_id),
HILO((*lockres)->sector_num));
status = -EFAIL;
goto finally;
}
+ status = ocfs_check_for_stale_lock(osb, *lockres, fe, lock_id);
+ if (status < 0) {
+ LOG_ERROR_STATUS (status);
+ goto finally;
+ }
+
if (updated)
*updated = 1;
@@ -338,6 +392,7 @@
return status;
} /* ocfs_process_update_inode_request */
+
/*
* ocfs_process_vote()
*
@@ -358,6 +413,7 @@
__u64 offset;
ocfs_file_entry *fe = NULL;
ocfs_vote *vote = NULL;
+ ocfs_inode *oin = NULL;
LOG_ENTRY_ARGS ("(0x%p, 0x%p, %u)\n", osb, publish, node_num);
@@ -469,14 +525,12 @@
}
if (publish->vote_type & FLAG_FILE_UPDATE_OIN) {
- ocfs_inode *oin;
-
- /*
- * Set the verify oin flag on the oin....??? Assumption is that
- * we have Lock resource or oin lock
- */
- if (lockres->oin != NULL) {
- oin = lockres->oin;
+ oin = lockres->oin;
+ if (oin) {
+ if (!IS_VALID_OIN(oin))
+ BUG();
+ if (!(oin->oin_flags & OCFS_INITIALIZED_MAIN_RESOURCE))
+ BUG();
ocfs_down_sem (&(oin->main_res), true);
oin->needs_verification = true;
tmpstat = ocfs_verify_update_oin(osb, oin);
@@ -507,7 +561,6 @@
if (flags & FLAG_CHANGE_MASTER) {
osb->needs_flush = true;
ocfs_trans_in_progress(osb);
-// if (osb->trans_in_progress == false) {
if (lockres->lock_type == OCFS_DLM_NO_LOCK) {
__u64 tmp = publish->dir_ent;
@@ -552,8 +605,11 @@
goto finito;
}
- if ((fe->sync_flags & OCFS_SYNC_FLAG_NAME_DELETED) ||
- (!(fe->sync_flags & OCFS_SYNC_FLAG_VALID))) {
+ if (fe->attribs & OCFS_ATTRIB_DIRECTORY) {
+ LOG_TRACE_STR("stale lock probe on directory!, respond but do nothing");
+ vote->vote[node_num] = FLAG_VOTE_NODE;
+ } else if (IS_FE_DELETED(fe->sync_flags) ||
+ (!(fe->sync_flags & OCFS_SYNC_FLAG_VALID))) {
vote->vote[node_num] = FLAG_VOTE_FILE_DEL;
vote->open_handle = false;
} else {
@@ -667,7 +723,11 @@
oin->needs_verification = true;
status = ocfs_verify_update_oin(osb, oin);
if (status < 0) {
- LOG_ERROR_STATUS (status);
+ if (status == -ENOENT) {
+ *vote = FLAG_VOTE_NODE;
+ status = 0;
+ } else
+ LOG_ERROR_STATUS (status);
ocfs_up_sem (&oin->main_res);
goto finally;
}
@@ -696,9 +756,15 @@
}
}
+/* The macro below takes into account the pre RELEASE/ACQUIRE_LOCK flag days */
+/* Allows for rolling upgrade */
+#define IS_RELEASE_LOCK(_f) (((_f) & FLAG_FILE_RELEASE_LOCK) || \
+ !((_f) & (FLAG_FILE_ACQUIRE_LOCK | FLAG_FILE_RELEASE_LOCK)))
+
if (((*lockres)->oin->open_hndl_cnt == 0) &&
(!(oin->oin_flags & OCFS_OIN_IN_USE))) {
- if (!(oin->oin_flags & OCFS_OIN_IN_TEARDOWN)) {
+ if (!(oin->oin_flags & OCFS_OIN_IN_TEARDOWN) &&
+ IS_RELEASE_LOCK(flags)) {
if (acq_oin) {
ocfs_up_sem (oin_sem);
acq_oin = false;
@@ -736,6 +802,13 @@
ocfs_purge_cache_section (oin, NULL, 0);
ocfs_up_sem (&(oin->paging_io_res));
}
+
+ if (oin && oin->inode) {
+#ifndef USERSPACE_TOOL
+ iput (oin->inode);
+#endif
+ oin->inode = NULL;
+ }
*lockres = NULL;
}
*vote = FLAG_VOTE_NODE;
@@ -747,7 +820,7 @@
} else {
#ifndef USERSPACE_TOOL
struct inode *inode = NULL;
- if (flags & FLAG_FILE_DELETE) {
+ if (flags & FLAG_FILE_DELETE && IS_RELEASE_LOCK(flags)) {
inode = ocfs_get_inode_from_offset(osb, lock_id);
if (inode) {
inode->i_nlink = 0;
Modified: trunk/ocfs2/Common/ocfsgenvote.c
===================================================================
--- trunk/ocfs2/Common/ocfsgenvote.c 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/ocfs2/Common/ocfsgenvote.c 2004-01-24 01:20:18 UTC (rev 3)
@@ -374,6 +374,10 @@
if (flags & FLAG_FILE_UPDATE_OIN) {
if (lockres->oin != NULL) {
oin = lockres->oin;
+ if (!IS_VALID_OIN(oin))
+ BUG();
+ if (!(oin->oin_flags & OCFS_INITIALIZED_MAIN_RESOURCE))
+ BUG();
ocfs_down_sem (&(oin->main_res), true);
oin->needs_verification = true;
tmpstat = ocfs_verify_update_oin(osb, oin);
@@ -445,8 +449,12 @@
goto finally;
}
- if ((fe->sync_flags & OCFS_SYNC_FLAG_NAME_DELETED) ||
- (!(fe-> sync_flags & OCFS_SYNC_FLAG_VALID))) {
+ if (fe->attribs & OCFS_ATTRIB_DIRECTORY) {
+ LOG_TRACE_STR("stale lock probe on directory!, respond but do nothing");
+ ocfs_send_vote_reply (osb, dlm_msg, FLAG_VOTE_NODE, false);
+ goto finally;
+ } else if (IS_FE_DELETED(fe->sync_flags) ||
+ (!(fe->sync_flags & OCFS_SYNC_FLAG_VALID))) {
LOG_TRACE_ARGS ("ocfs: rqrep seq=%u.%u, vote=FILE_DEL\n",
HILO (req_master->lock_seq_num));
ocfs_send_vote_reply (osb, dlm_msg,
Modified: trunk/ocfs2/Common/ocfsheartbeat.c
===================================================================
--- trunk/ocfs2/Common/ocfsheartbeat.c 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/ocfs2/Common/ocfsheartbeat.c 2004-01-24 01:20:18 UTC (rev 3)
@@ -120,6 +120,7 @@
ocfs_node_config_hdr *node_cfg_hdr = NULL;
__u8 *p;
__u64 curr_node_map;
+ __u64 curr_publ_seq;
LOG_ENTRY ();
@@ -205,6 +206,7 @@
/* map of local node */
curr_node_map = (__u64) ((__u64)1 << osb->node_num);
+ curr_publ_seq = 0;
/* Check for the highest node looking for a vote, if anybody is looking */
for (i = 0, p = buffer; i < num_nodes; i++, p += osb->sect_size) {
@@ -226,6 +228,7 @@
if (IS_NODE_ALIVE (osb->publ_map, highest_vote_node, num_nodes)) {
vote_node = highest_vote_node;
publish_to_vote = publish;
+ curr_publ_seq = publish->publ_seq_num;
} else {
status = ocfs_recover_vol (osb, highest_vote_node);
if (status < 0) {
@@ -235,13 +238,16 @@
}
}
- if ((vote_node != OCFS_INVALID_NODE_NUM) && (vote_node != osb->node_num)) {
+ if ((vote_node != OCFS_INVALID_NODE_NUM) &&
+ (vote_node != osb->node_num) &&
+ (curr_publ_seq != osb->last_disk_seq)) {
publish = (ocfs_publish *)
(buffer + (osb->node_num * osb->sect_size));
if (publish->vote)
publish->vote = 0;
ocfs_process_vote (osb, publish_to_vote, vote_node);
+ osb->last_disk_seq = curr_publ_seq;
}
osb->hbt = 50 + jiffies;
Modified: trunk/ocfs2/Linux/ocfsfile.c
===================================================================
--- trunk/ocfs2/Linux/ocfsfile.c 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/ocfs2/Linux/ocfsfile.c 2004-01-24 01:20:18 UTC (rev 3)
@@ -52,8 +52,7 @@
LOG_ENTRY ();
if (!dentry->d_inode) {
- LOG_ERROR_STR ("Bad inode");
- status = -EFAIL;
+ LOG_ERROR_STATUS (status = -EFAIL);
goto finally;
}
inode = dentry->d_inode;
@@ -100,13 +99,23 @@
}
/* Call CreateModify with delete flag to free up the bitmap etc. */
- ocfs_linux_get_inode_offset (dir, &parentOff, NULL);
+ if (!ocfs_linux_get_inode_offset (dir, &parentOff, NULL)) {
+ LOG_ERROR_STATUS (status = -ENOENT);
+ goto finally;
+ }
- if (S_ISDIR (inode->i_mode))
- ocfs_linux_get_dir_entry_offset (osb, &fileOff, parentOff,
- &(dentry->d_name), NULL);
- else
- ocfs_linux_get_inode_offset (inode, &fileOff, NULL);
+ if (S_ISDIR (inode->i_mode)) {
+ if (!ocfs_linux_get_dir_entry_offset (osb, &fileOff, parentOff,
+ &(dentry->d_name), NULL)) {
+ LOG_ERROR_STATUS (status = -ENOENT);
+ goto finally;
+ }
+ } else {
+ if (!ocfs_linux_get_inode_offset (inode, &fileOff, NULL)) {
+ LOG_ERROR_STATUS (status = -ENOENT);
+ goto finally;
+ }
+ }
status = -EFAIL;
if (fileOff != -1)
@@ -159,6 +168,7 @@
ocfs_super *osb = NULL;
bool DeleteTargetOin = false;
__u64 t;
+ ocfs_inode *newOIN = NULL;
LOG_ENTRY ();
@@ -204,7 +214,7 @@
if (new_dentry->d_inode != NULL &&
inode_data_is_oin (new_dentry->d_inode)) {
/* overwriting an existing inode */
- ocfs_inode *newOIN = ((ocfs_inode *)new_dentry->d_inode->u.generic_ip);
+ newOIN = ((ocfs_inode *)new_dentry->d_inode->u.generic_ip);
if (!(newOIN->oin_flags & OCFS_OIN_IN_TEARDOWN) &&
!(newOIN->oin_flags & OCFS_OIN_DELETE_ON_CLOSE)) {
@@ -250,8 +260,8 @@
}
// Delete the Oin if one exists
if (DeleteTargetOin) {
- ocfs_release_cached_oin (osb, oldOIN);
- ocfs_release_oin (oldOIN, true);
+ ocfs_release_cached_oin (osb, newOIN);
+ ocfs_release_oin (newOIN, true);
}
}
Modified: trunk/ocfs2/Linux/ocfsiosup.c
===================================================================
--- trunk/ocfs2/Linux/ocfsiosup.c 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/ocfs2/Linux/ocfsiosup.c 2004-01-24 01:20:18 UTC (rev 3)
@@ -92,6 +92,12 @@
blocknum = Offset >> sb->s_blocksize_bits;
+ if (blocknum == 0 && !osb->blk_zero_write) {
+ status = -EIO;
+ LOG_ERROR_STR ("WARNING! attempt to write non volume header to block 0");
+ goto bail;
+ }
+#if 0
if (blocknum == 0) {
ocfs_vol_disk_hdr *hdr;
LOG_TRACE_STR ("Blocknum is zero!!!");
@@ -102,6 +108,7 @@
goto bail;
}
}
+#endif
/* build an array of bh's and prepare them for submit */
for (i = 0 ; i < nr ; i++) {
Modified: trunk/ocfs2/Linux/ocfsmain.c
===================================================================
--- trunk/ocfs2/Linux/ocfsmain.c 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/ocfs2/Linux/ocfsmain.c 2004-01-24 01:20:18 UTC (rev 3)
@@ -173,23 +173,23 @@
MODULE_PARM (node_name, "s");
MODULE_PARM_DESC(node_name, "Name of this machine in the cluster");
-MODULE_PARM (node_number, "l");
+MODULE_PARM (node_number, "i");
MODULE_PARM_DESC(node_number, "Slot number for this machine within volume");
-MODULE_PARM (debug_context, "l");
+MODULE_PARM (debug_context, "i");
MODULE_PARM_DESC(debug_context, "Debug context");
-MODULE_PARM (debug_level, "l");
+MODULE_PARM (debug_level, "i");
MODULE_PARM_DESC(debug_level, "Debug level");
-MODULE_PARM (debug_exclude, "l");
+MODULE_PARM (debug_exclude, "i");
MODULE_PARM_DESC(debug_exclude, "Process ID to exclude from tracing");
MODULE_PARM (ip_address, "s");
MODULE_PARM_DESC(ip_address, "IP address for the network dlm on this node");
-MODULE_PARM (ip_port, "l");
+MODULE_PARM (ip_port, "i");
MODULE_PARM_DESC(ip_port, "Port number for the network dlm on this node");
MODULE_PARM (guid, "s");
MODULE_PARM_DESC(guid, "GUID for this machine");
-MODULE_PARM (cs, "l");
+MODULE_PARM (cs, "i");
MODULE_PARM_DESC(cs, "Checksum");
-MODULE_PARM (comm_voting, "l");
+MODULE_PARM (comm_voting, "i");
MODULE_PARM_DESC(comm_voting, "Enable/Disable network dlm");
/*
@@ -1518,6 +1518,12 @@
#define SECTOR_SIZE (1U << SECTOR_BITS)
#define SECTOR_MASK (SECTOR_SIZE - 1)
+#if LINUX_VERSION_CODE <= LinuxVersionCode(2,4,10)
+#define KERNEL_NO_F_IOBUF 1
+#elif defined(SUSE) && LINUX_VERSION_CODE >= LinuxVersionCode(2,4,20)
+#define KERNEL_NO_F_IOBUF 1
+#endif
+
/*
* ocfs_rw_direct()
*
@@ -1525,7 +1531,7 @@
static ssize_t ocfs_rw_direct (int rw, struct file *filp, char *buf, size_t size,
loff_t * offp)
{
-#if LINUX_VERSION_CODE <= LinuxVersionCode(2,4,10)
+#ifdef KERNEL_NO_F_IOBUF
struct kiobuf *iobuf;
#else
struct kiobuf *iobuf = filp->f_iobuf;
@@ -1667,7 +1673,7 @@
nbhs = (size >> SECTOR_BITS);
if (nbhs > max_sectors)
nbhs = max_sectors;
-#if LINUX_VERSION_CODE <= LinuxVersionCode(2,4,10)
+#ifdef KERNEL_NO_F_IOBUF
err = alloc_kiovec_sz (1, &iobuf, &nbhs);
#else
if (test_and_set_bit(0, &filp->f_iobuf_lock)) {
@@ -1682,7 +1688,7 @@
}
#endif
inuse = true;
-#if LINUX_VERSION_CODE <= LinuxVersionCode(2,4,10)
+#ifdef KERNEL_NO_F_IOBUF
if (err)
goto out;
#endif
@@ -1754,7 +1760,11 @@
transferred += err;
size -= err;
buf += err;
- totalioblocks += blocks;
+ if (large_io) {
+ totalioblocks += (blocks * 8);
+ } else {
+ totalioblocks += blocks;
+ }
} else {
printk(
"ocfs_rw_direct : brw_kiovec() %d\n",
@@ -1773,7 +1783,7 @@
printk("need to fail out\n");
break;
}
-#if LINUX_VERSION_CODE <= LinuxVersionCode(2,4,10)
+#ifdef KERNEL_NO_F_IOBUF
free_kiovec_sz(1, &iobuf, &nbhs);
#else
if (!new_iobuf)
@@ -1792,7 +1802,7 @@
}
out:
-#if LINUX_VERSION_CODE <= LinuxVersionCode(2,4,10)
+#ifdef KERNEL_NO_F_IOBUF
if (inuse)
free_kiovec_sz (1, &iobuf, &nbhs);
#else
@@ -1826,6 +1836,7 @@
long firstphys;
int clustersize;
unsigned long blocks_end_cluster = 0;
+ struct kiocb *myiocb;
int ret;
unsigned long firstlogic;
@@ -1899,6 +1910,14 @@
}
doio:
blocks = totalioblocks;
+ /* if the io we can submit is not the same size as requested
+ * set the iocb->this_size so that generic_aio_next_chunk()
+ * can handle it */
+
+ myiocb = cb.data;
+ if (myiocb->this_size > (blocks <<9))
+ myiocb->this_size = (blocks <<9);
+
err = brw_kvec_async(rw, cb, inode->i_dev, blocks, firstphys, sector_bits);
return err;
@@ -2393,7 +2412,7 @@
int error = -EACCES;
ocfs_file_entry *fe = NULL;
- LOG_ENTRY_ARGS ("(0x%p, 0x%p, %d, %d, '%*s')", dir, dentry, mode,
+ LOG_ENTRY_ARGS ("(0x%p, 0x%p, %d, %d, '%*s')\n", dir, dentry, mode,
dev, dentry->d_name.len, dentry->d_name.name);
atomic_inc (&dir->i_count);
@@ -2599,7 +2618,6 @@
LOG_ENTRY_ARGS ("(0x%p, 0x%p, '%*s')\n", dir, dentry,
dentry->d_name.len, dentry->d_name.name);
-
inode = dentry->d_inode;
if ((atomic_read (&inode->i_count) > 1)
@@ -2612,7 +2630,9 @@
if (status < 0) {
if (status != -ENOTEMPTY && status != -EPERM &&
status != -EBUSY && status != -EINTR) {
- LOG_ERROR_STATUS (status);
+ LOG_ERROR_ARGS ("file=%*s, status=%d",
+ dentry->d_name.len,
+ dentry->d_name.name, status);
retval = -EBUSY;
} else
retval = status;
@@ -2621,7 +2641,8 @@
if (inode_data_is_oin (inode)
&& (oin = ((ocfs_inode *)inode->u.generic_ip)) == NULL) {
- LOG_ERROR_STR ("inode has bad oin");
+ LOG_ERROR_ARGS ("inode has bad oin for file: %*s",
+ dentry->d_name.len, dentry->d_name.name);
retval = -EIO;
goto bail;
}
@@ -3240,11 +3261,13 @@
if (!dentry->d_parent || !dentry->d_parent->d_inode) {
LOG_ERROR_STR ("bad inode or root inode");
+ error = -EPERM;
goto bail2;
}
if (dentry == inode->i_sb->s_root) {
LOG_ERROR_ARGS ("setattr(%u) not allowed on the root inode",
attr->ia_valid);
+ error = -EPERM;
goto bail2;
}
@@ -3470,11 +3493,9 @@
/* we now have a file entry to call read_inode */
q.name = fe->filename;
q.len = strlen(fe->filename);
- if (fe->sync_flags & OCFS_SYNC_FLAG_MARK_FOR_DELETION ||
- fe->sync_flags & OCFS_SYNC_FLAG_NAME_DELETED ||
- fe->sync_flags & OCFS_SYNC_FLAG_DELETED ||
- ocfs_compare_qstr(&dentry->d_name, &q) != 0) {
- LOG_TRACE_STR("found the file entry, but it has been deleted or renamed!");
+
+ if (IS_FE_DELETED(fe->sync_flags) ||
+ ocfs_compare_qstr(&dentry->d_name, &q) != 0) {
ret = 0; /* it is now officially stale :) */
} else {
args.offset = fe->this_sector;
@@ -3580,12 +3601,14 @@
lockResource = (ocfs_lock_res *) oin->lock_res;
if (lockResource == NULL) {
- LOG_ERROR_STR ("lockres=null");
+ LOG_TRACE_ARGS ("lockres=null, id=%u.%u",
+ HILO(oin->file_disk_off));
goto bail;
}
if (lockResource->signature != 0x55AA) {
- LOG_ERROR_STR("Invalid lock resource");
+ LOG_TRACE_ARGS("Invalid lockres, id=%u.%u",
+ HILO(oin->file_disk_off));
goto bail;
}
ocfs_get_lockres (lockResource);
@@ -3665,6 +3688,9 @@
OcfsGlobalCtxt.fe_cache = kmem_cache_create ("fileentry_cache",
OCFS_SECTOR_SIZE, 0, SLAB_NO_REAP | SLAB_HWCACHE_ALIGN, NULL, NULL);
+ OcfsGlobalCtxt.dirnode_cache = kmem_cache_create ("dirnode_cache",
+ OCFS_DEFAULT_DIR_NODE_SIZE, 0, SLAB_NO_REAP | SLAB_HWCACHE_ALIGN, NULL, NULL);
+
OCFS_SET_FLAG (OcfsGlobalCtxt.flags, OCFS_FLAG_MEM_LISTS_INITIALIZED);
return 0;
@@ -3680,6 +3706,7 @@
kmem_cache_destroy (OcfsGlobalCtxt.ofile_cache);
kmem_cache_destroy (OcfsGlobalCtxt.fe_cache);
kmem_cache_destroy (OcfsGlobalCtxt.lockres_cache);
+ kmem_cache_destroy (OcfsGlobalCtxt.dirnode_cache);
OCFS_CLEAR_FLAG (OcfsGlobalCtxt.flags, OCFS_FLAG_MEM_LISTS_INITIALIZED);
} /* ocfs_free_mem_lists */
Modified: trunk/ocfs2/Linux/ocfsport.c
===================================================================
--- trunk/ocfs2/Linux/ocfsport.c 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/ocfs2/Linux/ocfsport.c 2004-01-24 01:20:18 UTC (rev 3)
@@ -97,10 +97,8 @@
#else
LOG_ENTRY_ARGS ("(0x%p, %u)\n", res, wait);
- if (!res || res->magic != OCFS_SEM_MAGIC) {
- ret = false;
- goto bail;
- }
+ if (!res || res->magic != OCFS_SEM_MAGIC)
+ BUG();
#define WAIT_TILL_ACQUIRE(a) \
do { \
@@ -130,7 +128,7 @@
ret = false;
}
}
- bail:
+
LOG_EXIT_ULONG (ret);
#endif /* !USERSPACE_TOOL */
@@ -162,14 +160,9 @@
#else
LOG_ENTRY_ARGS ("(0x%p)\n", res);
- if (!res) {
- LOG_ERROR_STR ("sem is null");
- goto bail;
- }
+ if (!res || res->magic != OCFS_SEM_MAGIC)
+ BUG();
- if (res->magic != OCFS_SEM_MAGIC)
- goto bail;
-
if (res->count && current->pid == res->pid) {
res->count--;
if (!res->count) {
@@ -177,7 +170,7 @@
up (&(res->sem));
}
}
- bail:
+
LOG_EXIT ();
#endif
Modified: trunk/ocfs2/Linux/ocfsproc.c
===================================================================
--- trunk/ocfs2/Linux/ocfsproc.c 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/ocfs2/Linux/ocfsproc.c 2004-01-24 01:20:18 UTC (rev 3)
@@ -160,6 +160,8 @@
slabname = "lockres";
else if (item->u.slab == OcfsGlobalCtxt.fe_cache)
slabname = "fe";
+ else if (item->u.slab == OcfsGlobalCtxt.dirnode_cache)
+ slabname = "dirnode";
else
slabname = "unknown";
Modified: trunk/ocfs2/Makefile
===================================================================
--- trunk/ocfs2/Makefile 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/ocfs2/Makefile 2004-01-24 01:20:18 UTC (rev 3)
@@ -2,11 +2,10 @@
include $(TOPDIR)/Preamble.make
-ifeq ($(OCFS_PROCESSOR),x86_64)
- WARNINGS = -Wall -Wstrict-prototypes -Wno-format
-else
- WARNINGS = -Wall -Wstrict-prototypes -Wno-format -Wmissing-prototypes \
- -Wmissing-declarations
+WARNINGS = -Wall -Wstrict-prototypes -Wno-format
+
+ifneq ($(OCFS_PROCESSOR),x86_64)
+WARNINGS += -Wmissing-prototypes -Wmissing-declarations
endif
ifdef OCFS_DEBUG
@@ -83,23 +82,27 @@
$(MODVERSIONS) $(WARNINGS)
LDADD=-nostdlib
+OPTIMIZE = -O2
+
+ifeq ($(OCFS_PROCESSOR),ppc64)
+ DEFINES += -D__LP64__
+ CFLAGS += -m64 -fsigned-char -fno-builtin -msoft-float -mminimal-toc
+ LDADD += -m elf64ppc
+endif
ifeq ($(OCFS_PROCESSOR),x86_64)
- DEFINES += -D__OPTIMIZE__
- CFLAGS += -mcmodel=kernel
- CFLAGS += -O0 -m64 -finline-functions
+ CFLAGS += -m64 -mcmodel=kernel
endif
ifeq ($(OCFS_PROCESSOR),ia64)
- DEFINES += -D__OPTIMIZE__
- CFLAGS += -O0
endif
ifeq ($(OCFS_PROCESSOR),i686)
DEFINES += -D__ILP32__
- CFLAGS += -O2
endif
ifeq ($(OCFS_PROCESSOR),i586)
- CFLAGS += -O2
+ DEFINES += -D__ILP32__
endif
+CFLAGS += $(OPTIMIZE)
+
MODULES = ocfs.o
CPARTNER = \
@@ -129,12 +132,8 @@
CALONE = Linux/ocfsdlm.c
-ifeq ($(OCFS_PROCESSOR),x86_64)
- SUPPORT =
-endif
-ifeq ($(OCFS_PROCESSOR),ia64)
- SUPPORT =
-endif
+SUPPORT =
+
ifeq ($(OCFS_PROCESSOR),i686)
SUPPORT = Support/divdi3.c
endif
Modified: trunk/redhat/ocfs-2.4.18-e.spec.in
===================================================================
--- trunk/redhat/ocfs-2.4.18-e.spec.in 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/redhat/ocfs-2.4.18-e.spec.in 2004-01-24 01:20:18 UTC (rev 3)
@@ -20,6 +20,9 @@
%define base 2.4.18-e
%define kver %{base}.37
+# The minimum -support package required for the kernel bits.
+%define support_ver 1.0.9
+
Summary: The Oracle Cluster Filesystem
Name: ocfs-%{base}
Version: @DIST_VERSION@
@@ -34,7 +37,7 @@
Provides: ocfs = %{version}
AutoReqProv: no
Requires: kernel >= %{kver}
-Requires: ocfs-support >= 1.0.9
+Requires: ocfs-support >= %{support_ver}
BuildRequires: kernel-source >= %{kver}
@@ -51,7 +54,7 @@
Group: System Environment/Kernel
Provides: ocfs = %{version}
Requires: kernel-smp >= %{kver}
-Requires: ocfs-support >= 1.0.9
+Requires: ocfs-support >= %{support_ver}
BuildRequires: kernel-source >= %{kver}
AutoReqProv: no
@@ -68,7 +71,7 @@
Group: System Environment/Kernel
Provides: ocfs = %{version}
Requires: kernel-debug >= %{kver}
-Requires: ocfs-support >= 1.0.9
+Requires: ocfs-support >= %{support_ver}
BuildRequires: kernel-source >= %{kver}
AutoReqProv: no
Modified: trunk/redhat/ocfs-2.4.21-EL.spec.in
===================================================================
--- trunk/redhat/ocfs-2.4.21-EL.spec.in 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/redhat/ocfs-2.4.21-EL.spec.in 2004-01-24 01:20:18 UTC (rev 3)
@@ -22,6 +22,9 @@
%define abi 2.4.21-EL
%define kver %{base}-4.EL
+# The minimum -support package required for the kernel bits.
+%define support_ver 1.0.9
+
Summary: The Oracle Cluster Filesystem
Name: ocfs-%{abi}
Version: @DIST_VERSION@
@@ -36,7 +39,7 @@
Provides: ocfs = %{version}
AutoReqProv: no
Requires: kernel >= %{kver}
-Requires: ocfs-support >= 1.0.9
+Requires: ocfs-support >= %{support_ver}
BuildRequires: kernel-source >= %{kver}
@@ -53,7 +56,7 @@
Group: System Environment/Kernel
Provides: ocfs = %{version}
Requires: kernel-smp >= %{kver}
-Requires: ocfs-support >= 1.0.9
+Requires: ocfs-support >= %{support_ver}
BuildRequires: kernel-source >= %{kver}
AutoReqProv: no
@@ -70,7 +73,7 @@
Group: System Environment/Kernel
Provides: ocfs = %{version}
Requires: kernel-hugemem >= %{kver}
-Requires: ocfs-support >= 1.0.9
+Requires: ocfs-support >= %{support_ver}
BuildRequires: kernel-source >= %{kver}
AutoReqProv: no
@@ -87,7 +90,7 @@
Group: System Environment/Kernel
Provides: ocfs = %{version}
Requires: kernel-debug >= %{kver}
-Requires: ocfs-support >= 1.0.9
+Requires: ocfs-support >= %{support_ver}
BuildRequires: kernel-source >= %{kver}
AutoReqProv: no
Modified: trunk/redhat/ocfs-2.4.9-e.spec.in
===================================================================
--- trunk/redhat/ocfs-2.4.9-e.spec.in 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/redhat/ocfs-2.4.9-e.spec.in 2004-01-24 01:20:18 UTC (rev 3)
@@ -21,6 +21,9 @@
%define kver %{base}.12
%define kveraio %{base}.25
+# The minimum -support package required for the kernel bits.
+%define support_ver 1.0.9
+
Summary: The Oracle Cluster Filesystem
Name: ocfs-%{base}
Version: @DIST_VERSION@
@@ -35,7 +38,7 @@
Provides: ocfs = %{version}
AutoReqProv: no
Requires: kernel >= %{kver}
-Requires: ocfs-support >= 1.0.8
+Requires: ocfs-support >= %{support_ver}
Obsoletes: ocfs-2.4.9-e.3, ocfs-2.4.9-e.8, ocfs-2.4.9-e.9, ocfs-2.4.9-e.10, ocfs-2.4.9-e.12
BuildRequires: kernel-source >= %{kver}
@@ -53,7 +56,7 @@
Group: System Environment/Kernel
Provides: ocfs = %{version}
Requires: kernel-smp >= %{kver}
-Requires: ocfs-support >= 1.0.9
+Requires: ocfs-support >= %{support_ver}
Obsoletes: ocfs-2.4.9-e.3-smp, ocfs-2.4.9-e.8-smp, ocfs-2.4.9-e.9-smp, ocfs-2.4.9-e.10-smp, ocfs-2.4.9-e.12-smp
BuildRequires: kernel-source >= %{kver}
AutoReqProv: no
@@ -71,7 +74,7 @@
Group: System Environment/Kernel
Provides: ocfs = %{version}
Requires: kernel-enterprise >= %{kver}
-Requires: ocfs-support >= 1.0.9
+Requires: ocfs-support >= %{support_ver}
Obsoletes: ocfs-2.4.9-e.3-enterprise, ocfs-2.4.9-e.8-enterprise, ocfs-2.4.9-e.9-enterprise, ocfs-2.4.9-e.10-enterprise, ocfs-2.4.9-e.12-enterprise
BuildRequires: kernel-source >= %{kver}
AutoReqProv: no
@@ -88,10 +91,10 @@
Summary: The Oracle Cluster Filesystem for summit based systems.
Group: System Environment/Kernel
Provides: ocfs = %{version}
-Requires: kernel-summit >= %{kver}
-Requires: ocfs-support >= 1.0.9
+Requires: kernel-summit >= %{kveraio}
+Requires: ocfs-support >= %{support_ver}
Obsoletes: ocfs-2.4.9-e.3-summit, ocfs-2.4.9-e.8-summit, ocfs-2.4.9-e.9-summit, ocfs-2.4.9-e.10-summit, ocfs-2.4.9-e.12-summit
-BuildRequires: kernel-source >= %{kver}
+BuildRequires: kernel-source >= %{kveraio}
AutoReqProv: no
@@ -165,27 +168,6 @@
cd ../tools
make
-%if %{buildsummit}
-cd ..
-# Now to find a summit source tree
-KVER=""
-if test -d "/usr/src/linux-%{kver}summit"; then
- KVER="%{kver}summit"
-else
- echo "No %{kver} summit tree to build from!" >&2
- exit 1
-fi
-
-KPATH="/usr/src/linux-${KVER}"
-
-%configure --sbindir=/sbin --with-kernel="${KPATH}" --enable-aio=no
-cd ocfs2
-
-make clean
-make KVER=summit
-make DESTDIR="$RPM_BUILD_ROOT" MODULEDIR="/lib/modules/%{base}-summit-ABI/ocfs-noaio" install
-%endif
-
# Now to build with AIO
cd ..
KVER=""
@@ -311,7 +293,6 @@
%files summit
%defattr(-,root,root)
/lib/modules/%{base}-summit-ABI/ocfs
-/lib/modules/%{base}-summit-ABI/ocfs-noaio
%endif
Modified: trunk/tools/bugfix/Makefile
===================================================================
--- trunk/tools/bugfix/Makefile 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/tools/bugfix/Makefile 2004-01-24 01:20:18 UTC (rev 3)
@@ -15,10 +15,10 @@
DEFINES = -DLINUX -DUSERSPACE_TOOL
ifeq ($(OCFS_PROCESSOR),x86_64)
- CFLAGS += -O0 -m64
+ CFLAGS += -O2 -m64
endif
ifeq ($(OCFS_PROCESSOR),ia64)
- CFLAGS += -O0
+ CFLAGS += -O2
endif
ifeq ($(OCFS_PROCESSOR),i686)
DEFINES += -D__ILP32__
Modified: trunk/tools/debugocfs/Makefile
===================================================================
--- trunk/tools/debugocfs/Makefile 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/tools/debugocfs/Makefile 2004-01-24 01:20:18 UTC (rev 3)
@@ -13,13 +13,13 @@
CFLAGS = -fno-strict-aliasing $(WARNINGS)
INCLUDES = -I. -I$(TOPDIR)/ocfs2/Common/inc -I$(TOPDIR)/ocfs2/Linux/inc -I$(TOPDIR)/tools/libocfs
-DEFINES = -DLINUX -DUSERSPACE_TOOL
+DEFINES = -DLINUX -DUSERSPACE_TOOL -DDEBUGOCFS
ifeq ($(OCFS_PROCESSOR),x86_64)
- CFLAGS += -O0 -m64
+ CFLAGS += -O2 -m64
endif
ifeq ($(OCFS_PROCESSOR),ia64)
- CFLAGS += -O0
+ CFLAGS += -O2
endif
ifeq ($(OCFS_PROCESSOR),i686)
DEFINES += -D__ILP32__
@@ -42,15 +42,22 @@
MANS = debugocfs.1
-DIST_FILES = debugocfs.c debugocfs.h libdebugocfs.h test.c print.c libdebugocfs.c io.c main.c extfinder.c debugocfs.1.in
+vpath bindraw.c $(TOPDIR)/tools/fsck
+vpath bindraw.h $(TOPDIR)/tools/fsck
+VERSION_FILES = debugocfs.c debugocfs.h libdebugocfs.h test.c print.c libdebugocfs.c io.c main.c extfinder.c
+VERSION_SRC = main.c extfinder.c
+VERSION_PREFIX = OCFS
+
+DIST_FILES = $(VERSION_FILES) $(VERSION_SRC) debugocfs.1.in
+
test: test.o libdebugocfs.a
$(LINK) -L. -ldebugocfs $(GTK_LIBS)
-extfinder: extfinder.o
+extfinder: extfinder.o ../libocfs/libocfs.a bindraw.o
$(LINK) $(GLIB_LIBS) -lglib
-debugocfs: print.o debugocfs.o io.o main.o ../libocfs/libocfs.a
+debugocfs: print.o debugocfs.o io.o main.o ../libocfs/libocfs.a bindraw.o
$(LINK) -pthread -L$(TOPDIR)/tools/libocfs -locfs
dbg.o: debugocfs.c
Modified: trunk/tools/debugocfs/debugocfs.1.in
===================================================================
--- trunk/tools/debugocfs/debugocfs.1.in 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/tools/debugocfs/debugocfs.1.in 2004-01-24 01:20:18 UTC (rev 3)
@@ -8,19 +8,24 @@
\fBdebugocfs\fR is a utility used to dump an OCFS file system information. The \fBdebugocfs\fR utility is to be used under support direction and should use a bound specific raw device instead of the proper device (/dev/sdxx).
.SH "OPTIONS"
.TP
-\fB\-h\fR Dumps the OCFS header information.
+\fB\-h\fR
+Dumps the OCFS header information.
.TP
-\fB\-g\fR Dumps the OCFS bitmap information.
+\fB\-g\fR
+Dumps the OCFS bitmap information.
.TP
-\fB\-l\fR Dumps the OCFS full listing of all file entries.
+\fB\-l\fR
+Dumps the OCFS full listing of all file entries.
.TP
-\fB\-v\fR Dumps the OCFS vote sector information.
+\fB\-v\fR
+Dumps the OCFS vote sector information.
.TP
-\fB\-2\fR Prints 8-byte number as 2 4byte numbers.
+\fB\-2\fR
+Prints 8-byte number as 2 4byte numbers.
.TP
\fB\-p\fR \fIrange\fR
@@ -84,10 +89,12 @@
Perform action as node number given
.TP
-\fB/dev/name:\fR Readable bound raw device (/dev/raw/rawxx). One needs to bind a Linux raw character device to the block device (/dev/sdxx) in order to use this program.
+\fB/dev/name:\fR
+Readable bound raw device (/dev/raw/rawxx). One needs to bind a Linux raw character device to the block device (/dev/sdxx) in order to use this program.
.TP
-\fBrange:\fR Node numbers to inspect (0-31), commas and dashes ok (i.e.:\fI0-3,5,14-17\fR).
+\fBrange:\fR
+Node numbers to inspect (0-31), commas and dashes ok (i.e.:\fI0-3,5,14-17\fR).
.SH "BUGS"
Stuff.
Modified: trunk/tools/debugocfs/debugocfs.h
===================================================================
--- trunk/tools/debugocfs/debugocfs.h 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/tools/debugocfs/debugocfs.h 2004-01-24 01:20:18 UTC (rev 3)
@@ -3,7 +3,7 @@
*
* Function prototypes for related 'C' file.
*
- * Copyright (C) 2002 Oracle Corporation. All rights reserved.
+ * Copyright (C) 2002, 2004 Oracle. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
@@ -15,12 +15,12 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
- * You should have recieved a copy of the GNU General Public
+ * You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 021110-1307, USA.
*
- * Author: Kurt Hackel
+ * Author: Kurt Hackel, Sunil Mushran
*/
#define _LARGEFILE64_SOURCE
@@ -30,6 +30,15 @@
#define MAX_SYSTEM_FILES (CLEANUP_FILE_BASE_ID + OCFS_MAXIMUM_NODES) /* 193? */
#define DIR_NODE_SIZE (1024 * 128)
+
+#define LOG_ERROR(fmt, arg...) \
+ do { \
+ fprintf(stdout, "ERROR: "); \
+ fprintf(stdout, fmt, ## arg); \
+ fprintf(stdout, ", %s, %d\n", __FILE__, __LINE__);\
+ fflush(stdout); \
+ } while (0)
+
/* modes for find_file_entry */
enum
{
Modified: trunk/tools/debugocfs/extfinder.c
===================================================================
--- trunk/tools/debugocfs/extfinder.c 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/tools/debugocfs/extfinder.c 2004-01-24 01:20:18 UTC (rev 3)
@@ -3,7 +3,7 @@
*
* Lists the free extent sizes of an ocfs volume
*
- * Copyright (C) 2003 Oracle. All rights reserved.
+ * Copyright (C) 2003, 2004 Oracle. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
@@ -30,6 +30,7 @@
int bmrun_reversesort(const void *a, const void *b);
void print_global_bitmap_runs(int fd, void *buf);
+int read_vol_disk_header(int fd, ocfs_vol_disk_hdr * v);
int extents_to_print = 0;
int verbose = 0;
@@ -60,25 +61,43 @@
void print_global_bitmap_runs(int fd, void *buf)
{
- __u64 dso, cs, num;
- char *bmbuf;
+// __u64 dso, cs, num;
+ char *bmbuf = NULL;
int bufsz;
ocfs_vol_disk_hdr * v = (ocfs_vol_disk_hdr *)buf;
int non_sysfile, sysfile;
int i;
bitmap_run run;
- GArray *arr = g_array_new(TRUE, TRUE, sizeof(bitmap_run));
+ GArray *arr = NULL;
+
+ arr = g_array_new(TRUE, TRUE, sizeof(bitmap_run));
+ if (!arr) {
+ LOG_ERROR("out of memory");
+ goto bail;
+ }
- dso = v->data_start_off;
- cs = v->cluster_size;
- num = v->num_clusters;
- bufsz = (num+7)/8;
- bmbuf = (char *)malloc(bufsz);
- lseek64(fd, v->bitmap_off, SEEK_SET);
- read(fd, bmbuf, bufsz);
+// dso = v->data_start_off;
+// cs = v->cluster_size;
+// num = v->num_clusters;
+// bufsz = (num+7)/8;
+ bufsz = 1024 * 1024;
+ bmbuf = (char *)malloc_aligned(bufsz);
+ if (!bmbuf) {
+ LOG_ERROR("out of memory");
+ goto bail;
+ }
- if (verbose)
- {
+ if (lseek64(fd, v->bitmap_off, SEEK_SET) == -1) {
+ LOG_ERROR("%s", strerror(errno));
+ goto bail;
+ }
+
+ if (read(fd, bmbuf, bufsz) == -1) {
+ LOG_ERROR("%s", strerror(errno));
+ goto bail;
+ }
+
+ if (verbose) {
printf("bitmap_off = %llu\n", v->bitmap_off);
printf("data_start_off = %llu\n", v->data_start_off);
printf("cluster_size = %llu\n", v->cluster_size);
@@ -90,59 +109,70 @@
if (non_sysfile < 0)
non_sysfile = 0;
- run.start=-1;
- run.size=0;
- for (i=0; i<non_sysfile; i++)
- {
- if (!test_bit(i, bmbuf))
- {
+ run.start = -1;
+ run.size = 0;
+ for (i = 0; i < non_sysfile; i++) {
+ if (!test_bit(i, bmbuf)) {
run.size++;
if (run.start==-1)
run.start = i;
}
- else
- {
- if (run.start != -1 && run.size != 0)
- {
+ else {
+ if (run.start != -1 && run.size != 0) {
g_array_append_val(arr, run);
run.start = -1;
run.size = 0;
}
}
}
- if (run.start!=-1)
+
+ if (run.start != -1)
g_array_append_val(arr, run);
-
printf("Runs of contiguous free space available (decending order)\n");
printf("Run #\tLength (KB)\tStarting bit number\n");
printf("=====\t===========\t===================\n");
- if (arr->len > 0)
- {
+ if (arr->len > 0) {
qsort(arr->data, arr->len, sizeof(bitmap_run), bmrun_reversesort);
- for (i=0; i<(arr->len > extents_to_print ? extents_to_print : arr->len); i++)
- {
+ for (i = 0; i < (arr->len > extents_to_print ?
+ extents_to_print : arr->len); i++) {
bitmap_run *run = &g_array_index(arr, bitmap_run, i);
__u64 kb = (((__u64)run->size) * v->cluster_size) / 1024ULL;
printf("%5d\t%11llu\t%-9d\n", i+1, kb, run->start);
}
}
-
- g_array_free(arr, FALSE);
-
- free(bmbuf);
+bail:
+ if (arr)
+ g_array_free(arr, FALSE);
+
+ if (bmbuf)
+ free_aligned(bmbuf);
+ return ;
}
-void read_vol_disk_header(int fd, ocfs_vol_disk_hdr * v)
+int read_vol_disk_header(int fd, ocfs_vol_disk_hdr * v)
{
- lseek64(fd, 0, SEEK_SET);
- read(fd, v, sizeof(ocfs_vol_disk_hdr));
- if (strncmp(v->signature, "OracleCFS", strlen("OracleCFS")) != 0)
- {
- fprintf(stderr, "not a valid ocfs partition!\n");
- usage();
- exit(1);
- }
+ int ret = -1;
+
+ if (lseek64(fd, 0, SEEK_SET) == -1) {
+ LOG_ERROR("%s", strerror(errno));
+ goto bail;
+ }
+
+ if (read(fd, v, 512) == -1) {
+ LOG_ERROR("%s", strerror(errno));
+ goto bail;
+ }
+
+ if (strncmp(v->signature, "OracleCFS", strlen("OracleCFS")) != 0) {
+ LOG_ERROR("not a valid ocfs partition");
+ goto bail;
+ }
+
+ ret = 0;
+
+bail:
+ return ret;
}
void usage()
@@ -150,36 +180,61 @@
printf("usage: extfinder /dev/device\n");
}
+void version(char *prog)
+{
+ printf("%s %s %s (build %s)\n", prog,
+ OCFS_BUILD_VERSION, OCFS_BUILD_DATE,
+ OCFS_BUILD_MD5);
+}
/* uh, main */
int main(int argc, char **argv)
{
- ocfs_vol_disk_hdr *diskHeader;
- int fd;
+ ocfs_vol_disk_hdr *diskHeader = NULL;
+ int fd = 0;
+ char rawdev[255];
+ int rawminor = 0;
- if (argc < 2)
- {
+ version(argv[0]);
+
+ if (argc < 2) {
usage();
- exit(1);
+ goto bail;
}
+
if (argc==3)
- {
extents_to_print = atoi(argv[2]);
- }
+
if (extents_to_print <= 0)
- extents_to_print = MAX_BITMAP_RUNS;
- diskHeader = (ocfs_vol_disk_hdr *) malloc(512);
+ extents_to_print = MAX_BITMAP_RUNS;
- fd = open(argv[1], O_RDONLY);
- if (fd == -1)
- {
+ diskHeader = (ocfs_vol_disk_hdr *) malloc_aligned(512);
+ if (!diskHeader) {
+ LOG_ERROR("out of memory");
+ goto bail;
+ }
+
+ if (bind_raw(argv[1], &rawminor, rawdev, sizeof(rawdev)) == -1)
+ goto bail;
+
+ fd = open(rawdev, O_RDONLY);
+ if (fd == -1) {
usage();
- exit(1);
+ goto bail;
}
- read_vol_disk_header(fd, diskHeader);
+ if (read_vol_disk_header(fd, diskHeader) == -1)
+ goto bail;
+
print_global_bitmap_runs(fd, diskHeader);
+bail:
+ if (diskHeader)
+ free_aligned(diskHeader);
+ if (fd)
+ close(fd);
+ if (rawminor)
+ unbind_raw(rawminor, rawdev);
exit(0);
}
Modified: trunk/tools/debugocfs/libdebugocfs.c
===================================================================
--- trunk/tools/debugocfs/libdebugocfs.c 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/tools/debugocfs/libdebugocfs.c 2004-01-24 01:20:18 UTC (rev 3)
@@ -142,10 +142,12 @@
if ((fd = libocfs_init(dev, &diskHeader)) == -1)
return 0;
- if (memcmp
- (diskHeader->signature, OCFS_VOLUME_SIGNATURE,
- strlen(OCFS_VOLUME_SIGNATURE)) == 0)
+ if (memcmp(diskHeader->signature,
+ OCFS_VOLUME_SIGNATURE,
+ strlen(OCFS_VOLUME_SIGNATURE)) == 0)
ret = 1;
+ if (diskHeader->major_version >= 9)
+ ret = 0;
free(diskHeader);
close(fd);
Modified: trunk/tools/debugocfs/main.c
===================================================================
--- trunk/tools/debugocfs/main.c 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/tools/debugocfs/main.c 2004-01-24 01:20:18 UTC (rev 3)
@@ -3,7 +3,7 @@
*
* entry point for normal and -X mode debugocfs
*
- * Copyright (C) 2002 Oracle Corporation. All rights reserved.
+ * Copyright (C) 2002, 2004 Oracle. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
@@ -15,12 +15,12 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
- * You should have recieved a copy of the GNU General Public
+ * You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 021110-1307, USA.
*
- * Author: Kurt Hackel
+ * Author: Kurt Hackel, Sunil Mushran
*/
#include "debugocfs.h"
@@ -99,9 +99,11 @@
int size = 0;
char *type = NULL;
char *dot;
- int fd;
+ int fd = 0;
debugocfs_print_func func;
int flags;
+ char rawdev[255];
+ int rawminor = 0;
while (1)
{
@@ -197,13 +199,13 @@
exit(1);
}
+ if (bind_raw(argv[optind], &rawminor, rawdev, sizeof(rawdev)) == -1)
+ goto bail;
+
flags = O_RDONLY | O_LARGEFILE;
- fd = open(argv[optind], flags);
+ fd = open(rawdev, flags);
if (fd == -1)
- {
- printf("Oops. You didn't give a valid device.\n");
- exit(1);
- }
+ goto bail;
printf("offset: %lld, type: %s\n", off, type);
@@ -227,23 +229,37 @@
free(buf);
}
- if (type != NULL)
+bail:
+ if (type)
free(type);
+ if (fd)
+ close(fd);
+ if (rawminor)
+ unbind_raw(rawminor, rawdev);
}
+void version(char *prog)
+{
+ printf("%s %s %s (build %s)\n", prog, OCFS_BUILD_VERSION,
+ OCFS_BUILD_DATE, OCFS_BUILD_MD5);
+}
/* uh, main */
int main(int argc, char **argv)
{
- ocfs_vol_label *volLabel;
- ocfs_vote *vs;
- ocfs_publish *ps;
- ocfs_vol_disk_hdr *diskHeader;
- int i, fd;
- ocfs_super *vcb;
+ ocfs_vol_label *volLabel = NULL;
+ ocfs_vote *vs = NULL;
+ ocfs_publish *ps = NULL;
+ ocfs_vol_disk_hdr *diskHeader = NULL;
+ int i, fd = 0;
+ ocfs_super *vcb = NULL;
char *env;
int flags;
+ char rawdev[255];
+ int rawminor = 0;
+ version(argv[0]);
+
if ((env = getenv("dbgctxt")) != NULL)
OcfsDebugCtxt = strtol(env, NULL, 16);
if ((env = getenv("dbglvl")) != NULL)
@@ -254,6 +270,10 @@
vs = (ocfs_vote *) malloc_aligned(512);
ps = (ocfs_publish *) malloc_aligned(512);
diskHeader = (ocfs_vol_disk_hdr *) malloc_aligned(512);
+ if (!volLabel || !vs || !ps || !diskHeader) {
+ LOG_ERROR("out of memory");
+ goto bail;
+ }
args.nodenum = -1;
while (1)
@@ -376,18 +396,25 @@
exit(1);
}
+ if (bind_raw(argv[optind], &rawminor, rawdev, sizeof(rawdev)) == -1)
+ goto bail;
+
flags = O_RDONLY | O_LARGEFILE;
- fd = open(argv[optind], flags);
+ fd = open(rawdev, flags);
if (fd == -1)
{
usage();
- exit(1);
+ goto bail;
}
read_vol_disk_header(fd, diskHeader);
read_vol_label(fd, volLabel);
vcb = get_fake_vcb(fd, diskHeader, args.nodenum);
+ if (!vcb) {
+ LOG_ERROR("out of memory");
+ goto bail;
+ }
if (args.showHeader)
{
@@ -492,7 +519,7 @@
if (strcmp(args.fileent, "/") == 0)
{
printf("the root directory '/' has no file entry\n");
- exit(1);
+ goto bail;
}
else
{
@@ -503,11 +530,22 @@
}
}
- free_aligned(volLabel);
- free_aligned(vs);
- free_aligned(ps);
- free_aligned(diskHeader);
- free(vcb);
- close(fd);
+bail:
+ if (volLabel)
+ free_aligned(volLabel);
+ if (vs)
+ free_aligned(vs);
+ if (ps)
+ free_aligned(ps);
+ if (diskHeader)
+ free_aligned(diskHeader);
+ if (vcb && vcb->sb)
+ free_aligned(vcb->sb);
+ if (vcb)
+ free_aligned(vcb);
+ if (fd)
+ close(fd);
+ if (rawminor)
+ unbind_raw(rawminor, rawdev);
exit(0);
}
Modified: trunk/tools/debugocfs/print.c
===================================================================
--- trunk/tools/debugocfs/print.c 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/tools/debugocfs/print.c 2004-01-24 01:20:18 UTC (rev 3)
@@ -84,7 +84,10 @@
printf("\tdir_node_size = %llu\n", v->dir_node_size);
printf("\tfile_node_size = %llu\n", v->file_node_size);
printf("\tinternal_off = %llu\n", v->internal_off);
- printf("\tprot_bits = %u\n", v->prot_bits);
+ printf("\tnode_cfg_off = %llu\n", v->node_cfg_off);
+ printf("\tnode_cfg_size = %llu\n", v->node_cfg_size);
+ printf("\tnew_cfg_off = %llu\n", v->new_cfg_off);
+ printf("\tprot_bits = 0%o\n", v->prot_bits);
printf("\tuid = %u\n", v->uid);
printf("\tgid = %u\n", v->gid);
printf("\texcl_mount = %d\n", v->excl_mount);
Modified: trunk/tools/format/Cscope.make
===================================================================
--- trunk/tools/format/Cscope.make 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/tools/format/Cscope.make 2004-01-24 01:20:18 UTC (rev 3)
@@ -6,6 +6,7 @@
echo "-I inc" >> cscope.files
find . -maxdepth 2 -name '*.c' -print >>cscope.files
find . -maxdepth 2 -name '*.h' -print >>cscope.files
+ find ../libocfs -maxdepth 2 -name '*.h' -print >>cscope.files
find ../../ocfs2/Common -maxdepth 2 -name ocfsheartbeat\* -print >>cscope.files
find $(TOPDIR)/ocfs2/Common/inc -maxdepth 2 -name 'ocfscom.h' -print >>cscope.files
find $(TOPDIR)/ocfs2/Common/inc -maxdepth 2 -name 'ocfsvol.h' -print >>cscope.files
Modified: trunk/tools/format/Makefile
===================================================================
--- trunk/tools/format/Makefile 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/tools/format/Makefile 2004-01-24 01:20:18 UTC (rev 3)
@@ -12,31 +12,31 @@
CFLAGS += -g
endif
-SBIN_PROGRAMS = mkfs.ocfs mounted.ocfs
+SBIN_PROGRAMS = mkfs.ocfs mounted.ocfs resizeocfs
INCLUDES = -I$(TOPDIR)/ocfs2/Common/inc -Iinc -I$(TOPDIR)/tools/libocfs -I$(TOPDIR)/ocfs2/Linux/inc
DEFINES = -DLINUX -DUSERSPACE_TOOL
ifeq ($(OCFS_PROCESSOR),x86_64)
- CFLAGS += -O0 -m64
+ CFLAGS += -O2 -m64
endif
ifeq ($(OCFS_PROCESSOR),ia64)
- CFLAGS += -O0
+ CFLAGS += -O2
endif
ifeq ($(OCFS_PROCESSOR),i686)
DEFINES += -D__ILP32__
CFLAGS += -O2
endif
-VERSION_FILES = format.c frmtport.c inc/format.h inc/frmtport.h mounted.c
+VERSION_FILES = format.c frmtport.c inc/format.h inc/frmtport.h mounted.c resize.c inc/resize.h
VERSION_SRC = frmtport.c
VERSION_PREFIX = OCFS
DIST_RULES = dist-incdir
-MANS = mkfs.ocfs.1
+MANS = mkfs.ocfs.1 resizeocfs.1
-DIST_FILES = $(VERSION_FILES) $(VERSION_SRC) mkfs.ocfs.1.in
+DIST_FILES = $(VERSION_FILES) $(VERSION_SRC) mkfs.ocfs.1.in resizeocfs.1.in
vpath ocfsheartbeat.c $(TOPDIR)/ocfs2/Common
@@ -46,6 +46,9 @@
mounted.ocfs: mounted.o frmtport.o
$(LINK) -L$(TOPDIR)/tools/libocfs -locfs
+resizeocfs: resize.o frmtport.o
+ $(LINK) -L$(TOPDIR)/tools/libocfs -locfs
+
dist-incdir:
$(TOPDIR)/mkinstalldirs $(DIST_DIR)/inc
Modified: trunk/tools/format/format.c
===================================================================
--- trunk/tools/format/format.c 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/tools/format/format.c 2004-01-24 01:20:18 UTC (rev 3)
@@ -3,7 +3,7 @@
*
* ocfs format utility
*
- * Copyright (C) 2002 Oracle Corporation. All rights reserved.
+ * Copyright (C) 2002, 2004 Oracle. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
@@ -15,7 +15,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
- * You should have recieved a copy of the GNU General Public
+ * You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 021110-1307, USA.
@@ -29,24 +29,43 @@
bool in_data_blocks = false;
bool format_intr = false;
-ocfs_format_options opts = { "", 0, false, false, 0, "", "", false, 0755, 0,
- false, false };
+ocfs_options opts = {
+ .device = "",
+ .block_size = 0,
+ .clear_data_blocks = false,
+ .force_op = false,
+ .gid = 0,
+ .volume_label = "",
+ .mount_point = "",
+ .query_only = false,
+ .perms = 0755,
+ .quiet = false,
+ .uid = 0,
+ .print_progress = false,
+ .slot_num = OCFS_INVALID_NODE_NUM,
+ .device_size = 0
+};
+
__u64 sect_count = 0;
__u64 format_size = 0;
-#define PRINT_PROGRESS() \
- if (opts.print_progress) { \
- __u64 __p; \
- __p = (sect_count * 100) / format_size; \
- if (sect_count != format_size) \
- printf("%llu\n", __p); \
- else \
- printf("COMPLETE\n"); \
- }
+char *usage_string =
+"usage: mkfs.ocfs -b block-size [-C] [-F] [-g gid] [-h] -L volume-label\n"
+" -m mount-path [-n] [-p permissions] [-q] [-u uid] [-V] device\n\n"
+" -b Block size in kilo bytes\n"
+" -C Clear all data blocks\n"
+" -F Force format existing OCFS volume\n"
+" -g GID for the root directory\n"
+" -h Help\n"
+" -L Volume label\n"
+" -m Path where this device will be mounted\n"
+" -n Query only\n"
+" -p Permissions for the root directory\n"
+" -q Quiet execution\n"
+" -u UID for the root directory\n"
+" -V Print version and exit\n";
-#define PRINT_VERBOSE(f, a...) do { if (!opts.quiet) printf(f, ##a); \
- } while (0)
/*
* main()
@@ -63,6 +82,8 @@
__u64 publ_off = 0;
__u64 data_start_off = 0;
bool ocfs_vol = false;
+ __u32 nodemap = 0;
+ char *node_names[OCFS_MAXIMUM_NODES];
/* Set ctrl-c handler */
if (signal(SIGINT, HandleSignal) == SIG_ERR) {
@@ -95,6 +116,13 @@
if (!(GetDiskGeometry(file, &vol_size, §_size)))
goto bail;
+ if (vol_size < OCFS_MIN_VOL_SIZE) {
+ fprintf(stderr, "Error: %s at %lluMB is smaller than %uMB.\n"
+ "Aborting.\n", opts.device, (vol_size/(1024*1024)),
+ (OCFS_MIN_VOL_SIZE/(1024*1024)));
+ goto bail;
+ }
+
/* Initialize the DiskHeader structure */
if (!(InitVolumeDiskHeader(volhdr, sect_size, vol_size, &data_start_off)))
goto bail;
@@ -113,8 +141,16 @@
/* If valid ocfs volume, check for any heart beating node(s) */
if (ocfs_vol) {
- if (!CheckHeartBeat(&file, publ_off, sect_size))
- goto bail;
+ if (!check_heart_beat(&file, volhdr, &nodemap, sect_size))
+ goto bail;
+ if (nodemap) {
+ /* Exit as device is mounted on some node */
+ get_node_names(file, volhdr, node_names, sect_size);
+ printf("%s mounted on nodes:", opts.device);
+ print_node_names(node_names, nodemap);
+ printf("Aborting.\n");
+ goto bail;
+ }
}
if (opts.clear_data_blocks)
@@ -273,7 +309,7 @@
/* Ensure forceformat flag is set to prevent overwriting */
if (*ocfs_vol) {
- if (opts.force_format)
+ if (opts.force_op)
ret = 1;
else {
if (opts.print_progress) {
@@ -286,7 +322,7 @@
if (format == 'y' || format == 'Y')
ret = 1;
else
- printf("Aborting format.\n");
+ printf("Aborting.\n");
}
} else
ret = 1;
@@ -298,81 +334,6 @@
/*
- * CheckHeartBeat()
- *
- */
-int CheckHeartBeat(int *file, __u64 publ_off, __u32 sect_size)
-{
- char *publish = NULL;
- ocfs_super osb;
- int ret = 0;
- int i;
- int waittime;
- char nodestr[512];
- char tmpstr[100];
- __u32 nodemap;
-
- memset (&osb, 0, sizeof(ocfs_super));
-
- if (!ReadPublish(*file, publ_off, sect_size, (void **)&publish))
- goto bail;
-
- /* alloc osb and pop sect_size */
- osb.sect_size = sect_size;
-
- /* call ocfs_update_publish_map(first_time = true) */
- ocfs_update_publish_map (&osb, (void *)publish, true);
-
- /* sleep(OCFS_NM_HEARTBEAT_TIME * 10) */
- PRINT_VERBOSE("Checking heart beat on volume ");
- waittime = (OCFS_NM_HEARTBEAT_TIME/1000);
- waittime = (waittime ? waittime : 1);
- for (i = 0; i < OCFS_HBT_WAIT; ++i) {
- PRINT_VERBOSE(".");
- fflush(stdout);
- sleep(waittime);
- }
-
- /* Close and re-open device to force disk read */
- CloseDisk(*file);
- if (!(*file = OpenDisk()))
- goto bail;
-
- memset (publish, 0, sect_size);
- if (!ReadPublish(*file, publ_off, sect_size, (void **)&publish))
- goto bail;
-
- /* call ocfs_update_publish_map(first_time = false) */
- ocfs_update_publish_map (&osb, (void *)publish, false);
-
- /* OCFS currently supports upto 32 nodes */
- nodemap = LO(osb.publ_map);
- if (nodemap) {
- *nodestr = '\0';
- for (i = 0; nodemap; nodemap >>= 1, ++i) {
- if (nodemap & 0x0001) {
- sprintf(tmpstr, "%d, ", i);
- strcat(nodestr, tmpstr);
- }
- }
- nodestr[strlen(nodestr) - 2] = '\0';
-
- fprintf(stderr, "\nError: Volume is mounted on node number(s) " \
- "(%s).\nAborting format.\n", nodestr);
- goto bail;
- }
-
- PRINT_VERBOSE("\r \r");
- fflush(stdout);
-
- ret = 1;
- bail:
- MemFree(publish);
- return ret;
-} /* CheckHeartBeat */
-
-
-/*
* WriteVolumeHdr()
*
*/
@@ -619,6 +580,7 @@
int ret = 1;
if (argc < 2) {
+ version(argv[0]);
usage();
ret = 0;
goto bail;
@@ -644,13 +606,13 @@
break;
case 'F': /* force format */
- opts.force_format = true;
+ opts.force_op = true;
break;
case 'g': /* gid */
++i;
if (i < argc && argv[i])
- opts.gid = atoi(argv[i]);
+ opts.gid = get_gid(argv[i]);
else {
fprintf(stderr, "Invalid group id.\n"
"Aborting.\n");
@@ -671,6 +633,7 @@
break;
case 'h': /* help */
+ version(argv[0]);
usage();
ret = 0;
break;
@@ -711,7 +674,7 @@
case 'u': /* uid */
++i;
if (i < argc && argv[i])
- opts.uid = atoi(argv[i]);
+ opts.uid = get_uid(argv[i]);
else {
fprintf(stderr,"Invalid user id.\n"
"Aborting.\n");
Modified: trunk/tools/format/frmtport.c
===================================================================
--- trunk/tools/format/frmtport.c 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/tools/format/frmtport.c 2004-01-24 01:20:18 UTC (rev 3)
@@ -3,7 +3,7 @@
*
* ocfs format utility functions
*
- * Copyright (C) 2002 Oracle Corporation. All rights reserved.
+ * Copyright (C) 2002, 2004 Oracle. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
@@ -15,7 +15,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
- * You should have recieved a copy of the GNU General Public
+ * You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 021110-1307, USA.
@@ -31,25 +31,9 @@
__u32 debug_level = 0;
__u32 debug_exclude = 0;
+extern char *usage_string;
+extern ocfs_options opts;
-char *usage_string =
-"usage: mkfs.ocfs -b block-size [-C] [-F] [-g gid] [-h] -L volume-label\n"
-" -m mount-path [-n] [-p permissions] [-q] [-u uid] [-V] device\n\n"
-" -b Block size in kilo bytes\n"
-" -C Clear all data blocks\n"
-" -F Force format existing OCFS volume\n"
-" -g GID for the root directory\n"
-" -h Help\n"
-" -L Volume label\n"
-" -m Path where this device will be mounted\n"
-" -n Query only\n"
-" -p Permissions for the root directory\n"
-" -q Quiet execution\n"
-" -u UID for the root directory\n"
-" -V Print version and exit\n";
-
-extern ocfs_format_options opts;
-
/*
* MemAlloc()
*
@@ -118,24 +102,12 @@
*/
int GetDiskGeometry(int file, __u64 * vollength, __u32 * sect_size)
{
-#ifdef __LP64__
- __u64 devicesize;
-#else
- __u32 devicesize; /* SM: should be __s32... struct hd_struct.nr_sects */
-#endif
+ /* SM: should be signed... struct hd_struct.nr_sects */
+ /* MS: the above only applies to 2.4.9 */
+ unsigned long devicesize;
int ret = 0;
-#ifdef __LP64__
-#define u64 __u64
-
-#ifndef BLKGETSIZE64
-#define BLKGETSIZE64 _IOR(0x12,114,sizeof(u64))
-#endif
-
- if (ioctl(file, BLKGETSIZE64, &devicesize) == -1)
-#else
if (ioctl(file, BLKGETSIZE, &devicesize) == -1)
-#endif
{
fprintf(stderr, "Error reading size of %s device.\n%s\n", opts.device,
strerror(errno));
@@ -156,9 +128,7 @@
if (devicesize && *sect_size)
{
*vollength = devicesize;
-#ifndef __LP64__
*vollength *= *sect_size;
-#endif
ret = 1;
}
else
@@ -388,3 +358,305 @@
bail:
return ret;
} /* ReadPubllish */
+
+
+/*
+ * get_uid()
+ *
+ */
+uid_t get_uid(char *id)
+{
+ struct passwd *pw = NULL;
+ uid_t uid = 0;
+
+ if (isdigit(*id))
+ uid = atoi(id);
+ else {
+ pw = getpwnam(id);
+ if (pw)
+ uid = pw->pw_uid;
+ }
+
+ return uid;
+} /* get_uid */
+
+
+/*
+ * get_gid()
+ *
+ */
+uid_t get_gid(char *id)
+{
+ struct group *gr = NULL;
+ gid_t gid = 0;
+
+ if (isdigit(*id))
+ gid = atoi(id);
+ else {
+ gr = getgrnam(id);
+ if (gr)
+ gid = gr->gr_gid;
+ }
+
+ return gid;
+} /* get_gid */
+
+
+/*
+ * read_sectors()
+ *
+ */
+int read_sectors(int file, __u64 strtoffset, __u32 noofsects, __u32 sect_size,
+ void *buf)
+{
+ __u32 i;
+ char *p;
+ int ret = 0;
+
+ if (!SetSeek(file, strtoffset))
+ goto bail;
+
+ for (i = 0, p = buf; i < noofsects; ++i, p += sect_size) {
+ if (!Read(file, sect_size, p))
+ goto bail;
+ }
+
+ ret = 1;
+
+ bail:
+ return ret;
+} /* read_sectors */
+
+
+/*
+ * write_sectors()
+ *
+ */
+int write_sectors(int file, __u64 strtoffset, __u32 noofsects, __u32 sect_size,
+ void *buf)
+{
+ __u32 i;
+ char *p;
+ int ret = 0;
+
+ if (!SetSeek(file, strtoffset))
+ goto bail;
+
+ for (i = 0, p = buf; i < noofsects; ++i, p += sect_size) {
+ if (!Write(file, sect_size, (void *)p))
+ goto bail;
+ }
+
+ ret = 1;
+
+ bail:
+ return ret;
+} /* write_sectors */
+
+
+/*
+ * validate_volume_size()
+ *
+ */
+int validate_volume_size(__u64 given_vol_size, __u64 actual_vol_size)
+{
+ int ret = 0;
+ char str1[100], str2[100];
+
+ if (given_vol_size < OCFS_MIN_VOL_SIZE) {
+ num_to_str(given_vol_size, str1);
+ num_to_str(OCFS_MIN_VOL_SIZE, str2);
+ fprintf(stderr, "The size specified, %s, is smaller than "
+ "the minimum size, %s.\nAborting.\n", str1, str2);
+ goto bail;
+ }
+
+ if (given_vol_size > actual_vol_size) {
+ num_to_str(given_vol_size, str1);
+ num_to_str(actual_vol_size, str2);
+ fprintf(stderr, "The size specified, %s, is larger than "
+ "the device size, %s.\nAborting.\n",
+ str1, str2);
+ goto bail;
+ }
+
+ ret = 1;
+
+ bail:
+ return ret;
+} /* validate_volume_size */
+
+
+/*
+ * num_to_str()
+ *
+ */
+void num_to_str(__u64 num, char *numstr)
+{
+ __u64 newnum;
+ int i = 0;
+ char append[] = " KMGT";
+ int len;
+
+ len = strlen(append);
+
+ for (i = 0, newnum = num; i < len && newnum > 1023; ++i)
+ newnum /= (__u64)1024;
+
+ sprintf(numstr, "%llu%c", newnum, append[i]);
+
+ return ;
+} /* num_to_str */
+
+
+/*
+ * is_ocfs_volume()
+ *
+ */
+int is_ocfs_volume(int file, ocfs_vol_disk_hdr *volhdr, bool *ocfs_vol,
+ __u32 sect_size)
+{
+ char *buf;
+ int ret = 0;
+
+ buf = (char *)volhdr;
+ memset(buf, 0, sect_size);
+
+ if (!SetSeek(file, 0))
+ goto bail;
+
+ if (!(Read(file, sect_size, buf)))
+ goto bail;
+
+ volhdr = (ocfs_vol_disk_hdr *) buf;
+
+ if ((!memcmp(volhdr->signature, OCFS_VOLUME_SIGNATURE,
+ strlen(OCFS_VOLUME_SIGNATURE))))
+ *ocfs_vol = true;
+ else
+ *ocfs_vol = false;
+
+ ret = 1;
+
+ bail:
+ return ret;
+} /* is_ocfs_volume */
+
+/*
+ * check_heart_beat()
+ *
+ */
+int check_heart_beat(int *file, ocfs_vol_disk_hdr *volhdr, __u32 *nodemap,
+ __u32 sect_size)
+{
+ char *publish = NULL;
+ ocfs_super osb;
+ int ret = 0;
+ int i;
+ int waittime;
+
+ memset (&osb, 0, sizeof(ocfs_super));
+
+ if (!ReadPublish(*file, volhdr->publ_off, sect_size, (void **)&publish))
+ goto bail;
+
+ /* alloc osb and pop sect_size */
+ osb.sect_size = sect_size;
+
+ /* call ocfs_update_publish_map(first_time = true) */
+ ocfs_update_publish_map (&osb, (void *)publish, true);
+
+ /* sleep(OCFS_NM_HEARTBEAT_TIME * 10) */
+ PRINT_VERBOSE("Checking heart beat on volume ");
+ waittime = (OCFS_NM_HEARTBEAT_TIME/1000);
+ waittime = (waittime ? waittime : 1);
+ for (i = 0; i < OCFS_HBT_WAIT; ++i) {
+ PRINT_VERBOSE(".");
+ fflush(stdout);
+ sleep(waittime);
+ }
+
+ /* Close and re-open device to force disk read */
+ CloseDisk(*file);
+ if (!(*file = OpenDisk()))
+ goto bail;
+
+ memset (publish, 0, sect_size);
+ if (!ReadPublish(*file, volhdr->publ_off, sect_size, (void **)&publish))
+ goto bail;
+
+ /* call ocfs_update_publish_map(first_time = false) */
+ ocfs_update_publish_map (&osb, (void *)publish, false);
+
+ PRINT_VERBOSE("\r \r");
+ fflush(stdout);
+
+ *nodemap = LO(osb.publ_map);
+
+ ret = 1;
+ bail:
+ MemFree(publish);
+ return ret;
+} /* check_heart_beat */
+
+/*
+ * get_node_names()
+ *
+ */
+int get_node_names(int file, ocfs_vol_disk_hdr *volhdr, char **node_names,
+ __u32 sect_size)
+{
+ char *buf = NULL;
+ char *p;
+ int len;
+ int ret = 0;
+ int i;
+ ocfs_disk_node_config_info *conf;
+
+ len = volhdr->node_cfg_size;
+ if (!(buf = (char *) MemAlloc(len)))
+ goto bail;
+ else
+ memset(buf, 0, len);
+
+ if (!SetSeek(file, volhdr->node_cfg_off))
+ goto bail;
+
+ if (!(Read(file, len, buf)))
+ goto bail;
+
+ p = buf + (sect_size * 2);
+ for (i = 0; i < OCFS_MAXIMUM_NODES; ++i, p += sect_size) {
+ conf = (ocfs_disk_node_config_info *)p;
+ if (conf->node_name[0])
+ node_names[i] = strdup(conf->node_name);
+ }
+
+ ret = 1;
+ bail:
+ MemFree(buf);
+ return ret;
+} /* get_node_names */
+
+
+/*
+ * print_node_names()
+ *
+ */
+void print_node_names(char **node_names, __u32 nodemap)
+{
+ int i, j;
+ char comma = '\0';
+
+ for (j = 1, i = 0; i < OCFS_MAXIMUM_NODES; ++i, j <<= 1) {
+ if (nodemap & j) {
+ if (node_names[i])
+ printf("%c %s", comma, node_names[i]);
+ else
+ printf("%c %d", comma, i);
+ comma = ',';
+ }
+ }
+ printf("\n");
+} /* print_node_names */
+
Modified: trunk/tools/format/inc/format.h
===================================================================
--- trunk/tools/format/inc/format.h 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/tools/format/inc/format.h 2004-01-24 01:20:18 UTC (rev 3)
@@ -3,7 +3,7 @@
*
* Function prototypes for related 'C' file.
*
- * Copyright (C) 2002 Oracle Corporation. All rights reserved.
+ * Copyright (C) 2002, 2004 Oracle. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
@@ -15,7 +15,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
- * You should have recieved a copy of the GNU General Public
+ * You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 021110-1307, USA.
@@ -29,6 +29,9 @@
#include <libocfs.h>
#include <sys/ioctl.h>
+#include <ctype.h>
+#include <pwd.h>
+#include <grp.h>
#define OCFS_MAXIMUM_NODES 32
#define FILE_NAME_SIZE 200
@@ -38,7 +41,10 @@
#define OCFS_MAX_BITMAP_SIZE 1024 * 1024 /* in bytes */
#define CLEAR_DATA_BLOCK_SIZE 2048 /* in sectors */
+#define OCFS_MIN_VOL_SIZE (200 * 1024 * 1024) /* in bytes */
+
#define OCFS_FORMAT_NAME "mkfs.ocfs"
+#define OCFS_RESIZE_NAME "resizeocfs"
#define OCFS_HBT_WAIT 10
@@ -46,17 +52,50 @@
(((__u64)buf % secsz) ? \
(secsz - ((__u64)buf % secsz)) : 0))
+#define PRINT_PROGRESS() \
+ if (opts.print_progress) { \
+ __u64 __p; \
+ __p = (sect_count * 100) / format_size; \
+ if (sect_count != format_size) \
+ printf("%llu\n", __p); \
+ else \
+ printf("COMPLETE\n"); \
+ }
+
+#define PRINT_VERBOSE(f, a...) do { if (!opts.quiet) printf(f, ##a); \
+ } while (0)
+
+#define KILO_BYTE (1024)
+#define MEGA_BYTE (KILO_BYTE * 1024)
+#define GIGA_BYTE (MEGA_BYTE * 1024)
+#define TERA_BYTE ((__u64)GIGA_BYTE * (__u64)1024)
+
+#define MULT_FACTOR(c, f) \
+ do { \
+ switch (c) { \
+ case 'k': \
+ case 'K': (f) = KILO_BYTE; break; \
+ case 'm': \
+ case 'M': (f) = MEGA_BYTE; break; \
+ case 'g': \
+ case 'G': (f) = GIGA_BYTE; break; \
+ case 't': \
+ case 'T': (f) = TERA_BYTE; break; \
+ default : (f) = 1; break; \
+ } \
+ } while (0)
+
#undef MIN
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define safefree(a) do { if(a) { free(a); (a) = NULL; } }while(0)
-typedef struct _ocfs_format_options
+typedef struct _ocfs_options
{
__u8 device[FILE_NAME_SIZE];
__u32 block_size;
bool clear_data_blocks;
- bool force_format;
+ bool force_op;
gid_t gid;
__u8 volume_label[MAX_VOL_LABEL_LEN];
__u8 mount_point[FILE_NAME_SIZE];
@@ -65,8 +104,11 @@
bool quiet;
uid_t uid;
bool print_progress;
+ __u32 slot_num;
+ __u64 device_size;
+ bool list_nodes;
}
-ocfs_format_options;
+ocfs_options;
#include <frmtport.h>
Modified: trunk/tools/format/inc/frmtport.h
===================================================================
--- trunk/tools/format/inc/frmtport.h 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/tools/format/inc/frmtport.h 2004-01-24 01:20:18 UTC (rev 3)
@@ -3,7 +3,7 @@
*
* Function prototypes for related 'C' file.
*
- * Copyright (C) 2002 Oracle Corporation. All rights reserved.
+ * Copyright (C) 2002, 2004 Oracle. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
@@ -15,7 +15,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
- * You should have recieved a copy of the GNU General Public
+ * You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 021110-1307, USA.
@@ -56,4 +56,29 @@
int ReadPublish(int file, __u64 publ_off, __u32 sect_size, void **buf);
+uid_t get_uid(char *id);
+
+gid_t get_gid(char *id);
+
+int read_sectors(int file, __u64 strtoffset, __u32 noofsects, __u32 sect_size,
+ void *buf);
+
+int write_sectors(int file, __u64 strtoffset, __u32 noofsects, __u32 sect_size,
+ void *buf);
+
+int validate_volume_size(__u64 given_vol_size, __u64 actual_vol_size);
+
+void num_to_str(__u64 num, char *numstr);
+
+int is_ocfs_volume(int file, ocfs_vol_disk_hdr *volhdr, bool *ocfs_vol,
+ __u32 sect_size);
+
+int check_heart_beat(int *file, ocfs_vol_disk_hdr *volhdr, __u32 *nodemap,
+ __u32 sect_size);
+
+int get_node_names(int file, ocfs_vol_disk_hdr *volhdr, char **node_names,
+ __u32 sect_size);
+
+void print_node_names(char **node_names, __u32 nodemap);
+
#endif /* _FRMTPORT_H_ */
Modified: trunk/tools/format/mkfs.ocfs.1.in
===================================================================
--- trunk/tools/format/mkfs.ocfs.1.in 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/tools/format/mkfs.ocfs.1.in 2004-01-24 01:20:18 UTC (rev 3)
@@ -12,17 +12,22 @@
Block size in kilo bytes. The size of the blocksize (4k\-1M) will determine the maximum filesystem size possible for the OCFS (32Gb\-8Tb).
.TP
-\fB\-C\fR Clear all data blocks. Use this option only if it is really necessary to clear all blocks. This will slow down the process.
+\fB\-C\fR
+Clear all data blocks. Use this option only if it is really necessary to clear all blocks. This will slow down the process.
.TP
-\fB\-F\fR Force format. Use this option only if formatting a existing OCFS partition.
+\fB\-F\fR
+Force format. Use this option only if formatting an existing OCFS partition.
.TP
\fB\-g\fR \fIgid\fR
-\fIgid\fR for the root directory. On mount time, it will automatcially assign the \fIgid\fR specified by this parameter to the mount point. Make sure to use the \fIgid\fR, not the username (i.e.:1011, not \fIdba\fR).
+Set the \fIgid\fR for the root directory. On mount time, it will automatcially
+assign the \fIgid\fR specified by this parameter to the mount point. One may
+use the \fIgid\fR or the group name (i.e.:1011 or \fIdba\fR).
.TP
-\fB\-h\fR Help.
+\fB\-h\fR
+Help.
.TP
\fB\-L\fR \fIVolume label\fR
@@ -33,24 +38,27 @@
Mount point where the formatted device will be mounted.
.TP
-\fB\-n\fR Query only. Will not build the filesystem.
+\fB\-n\fR
+Query only. Will not build the filesystem.
.TP
\fB\-p\fR \fINNNN\fR
Permissions \fINNNN\fR for the root directory. On mount, it will automatcially assign the permission specified by this parameter to the mount point.
.TP
-\fB\-q\fR Quiet execution.
+\fB\-q\fR
+Quiet execution.
.TP
\fB\-u\fR \fIuid\fR
-\fIuid\fR for the root directory. On mount time, it will automatcially assign \fIuid\fR specified by this parameter to the mount point. Make sure to use the \fIuid\fR, not the username (i.e.:1011, not \fIoracle\fR).
+Set the \fIuid\fR for the root directory. On mount time, it will automatcially
+assign \fIuid\fR specified by this parameter to the mount point. One can use
+the \fIuid\fR or the username (i.e.:1011 or \fIoracle\fR).
.TP
-\fB\-V\fR Print version and exit.
+\fB\-V\fR
+Print version and exit.
-.TP
-
.SH "BUGS"
Stuff.
Modified: trunk/tools/format/mounted.c
===================================================================
--- trunk/tools/format/mounted.c 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/tools/format/mounted.c 2004-01-24 01:20:18 UTC (rev 3)
@@ -3,7 +3,7 @@
*
* ocfs mount detect utility
*
- * Copyright (C) 2003 Oracle. All rights reserved.
+ * Copyright (C) 2003, 2004 Oracle. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
@@ -26,21 +26,30 @@
#include <format.h>
#include <signal.h>
-ocfs_format_options opts = { "", 0, false, false, 0, "", "", false, 0755, 0,
- false, false };
+ocfs_options opts = {
+ .device = "",
+ .block_size = 0,
+ .clear_data_blocks = false,
+ .force_op = false,
+ .gid = 0,
+ .volume_label = "",
+ .mount_point = "",
+ .query_only = false,
+ .perms = 0755,
+ .quiet = false,
+ .uid = 0,
+ .print_progress = false,
+ .slot_num = OCFS_INVALID_NODE_NUM,
+ .device_size = 0
+};
+char *usage_string = "usage: mounted.ocfs <device>";
+
#define PRINT_VERBOSE(f, a...) do { if (true) printf(f, ##a); \
} while (0)
-int is_ocfs_volume(int file, ocfs_vol_disk_hdr *volhdr, bool *ocfs_vol,
- __u32 sect_size);
-int check_heart_beat(int *file, ocfs_vol_disk_hdr *volhdr, __u32 *nodemap,
- __u32 sect_size);
-int get_node_names(int file, ocfs_vol_disk_hdr *volhdr, char **node_names,
- __u32 sect_size);
int get_vol_label(int file, ocfs_vol_label *vollabel, __u32 sect_size);
void handle_signal(int sig);
-void mounted_usage(void);
int read_options(int argc, char **argv);
/*
@@ -55,14 +64,10 @@
__u32 sect_size = OCFS_SECTOR_SIZE;
__u64 vol_size = 0;
__u32 i;
- __u32 j;
bool ocfs_vol = false;
char *node_names[OCFS_MAXIMUM_NODES];
- __u32 nodemap;
- char comma;
+ __u32 nodemap = 0;
- version(argv[0]);
-
for (i = 0; i < OCFS_MAXIMUM_NODES; ++i)
node_names[i] = NULL;
@@ -119,18 +124,8 @@
get_node_names(file, volhdr, node_names, sect_size);
- comma = '\0';
printf("Nodes :");
- for (j = 1, i = 0; i < OCFS_MAXIMUM_NODES; ++i, j <<= 1) {
- if (nodemap & j) {
- if (node_names[i])
- printf("%c %s", comma, node_names[i]);
- else
- printf("%c %d", comma, i);
- comma = ',';
- }
- }
- printf("\n");
+ print_node_names(node_names, nodemap);
bail:
for (i = 0; i < OCFS_MAXIMUM_NODES; ++i)
@@ -144,137 +139,6 @@
/*
- * is_ocfs_volume()
- *
- */
-int is_ocfs_volume(int file, ocfs_vol_disk_hdr *volhdr, bool *ocfs_vol,
- __u32 sect_size)
-{
- char *buf;
- int ret = 0;
-
- buf = (char *)volhdr;
- memset(buf, 0, sect_size);
-
- if (!SetSeek(file, 0))
- goto bail;
-
- if (!(Read(file, sect_size, buf)))
- goto bail;
-
- volhdr = (ocfs_vol_disk_hdr *) buf;
-
- if ((!memcmp(volhdr->signature, OCFS_VOLUME_SIGNATURE,
- strlen(OCFS_VOLUME_SIGNATURE))))
- *ocfs_vol = true;
- else
- *ocfs_vol = false;
-
- ret = 1;
-
- bail:
- return ret;
-} /* is_ocfs_volume */
-
-
-/*
- * check_heart_beat()
- *
- */
-int check_heart_beat(int *file, ocfs_vol_disk_hdr *volhdr, __u32 *nodemap,
- __u32 sect_size)
-{
- char *publish = NULL;
- ocfs_super osb;
- int ret = 0;
- int i;
- int waittime;
-
- memset (&osb, 0, sizeof(ocfs_super));
-
- if (!ReadPublish(*file, volhdr->publ_off, sect_size, (void **)&publish))
- goto bail;
-
- /* alloc osb and pop sect_size */
- osb.sect_size = sect_size;
-
- /* call ocfs_update_publish_map(first_time = true) */
- ocfs_update_publish_map (&osb, (void *)publish, true);
-
- /* sleep(OCFS_NM_HEARTBEAT_TIME * 10) */
- PRINT_VERBOSE("Checking heart beat on volume ");
- waittime = (OCFS_NM_HEARTBEAT_TIME/1000);
- waittime = (waittime ? waittime : 1);
- for (i = 0; i < OCFS_HBT_WAIT; ++i) {
- PRINT_VERBOSE(".");
- fflush(stdout);
- sleep(waittime);
- }
-
- /* Close and re-open device to force disk read */
- CloseDisk(*file);
- if (!(*file = OpenDisk()))
- goto bail;
-
- memset (publish, 0, sect_size);
- if (!ReadPublish(*file, volhdr->publ_off, sect_size, (void **)&publish))
- goto bail;
-
- /* call ocfs_update_publish_map(first_time = false) */
- ocfs_update_publish_map (&osb, (void *)publish, false);
-
- PRINT_VERBOSE("\r \r");
- fflush(stdout);
-
- *nodemap = LO(osb.publ_map);
-
- ret = 1;
- bail:
- MemFree(publish);
- return ret;
-} /* check_heart_beat */
-
-
-/*
- * get_node_names()
- *
- */
-int get_node_names(int file, ocfs_vol_disk_hdr *volhdr, char **node_names,
- __u32 sect_size)
-{
- char *buf = NULL;
- char *p;
- int len;
- int ret = 0;
- int i;
- ocfs_disk_node_config_info *conf;
-
- len = volhdr->node_cfg_size;
- if (!(buf = (char *) MemAlloc(len)))
- goto bail;
- else
- memset(buf, 0, len);
-
- if (!SetSeek(file, volhdr->node_cfg_off))
- goto bail;
-
- if (!(Read(file, len, buf)))
- goto bail;
-
- p = buf + (sect_size * 2);
- for (i = 0; i < OCFS_MAXIMUM_NODES; ++i, p += sect_size) {
- conf = (ocfs_disk_node_config_info *)p;
- if (conf->node_name[0])
- node_names[i] = strdup(conf->node_name);
- }
-
- ret = 1;
- bail:
- MemFree(buf);
- return ret;
-} /* get_node_names */
-
-/*
* get_vol_label()
*
*/
@@ -316,12 +180,6 @@
} /* handle_signal */
-void mounted_usage(void)
-{
- printf("usage: mounted.ocfs <device>\n");
-} /* mounted_usage */
-
-
/*
* read_options()
*
@@ -333,15 +191,18 @@
int ret = 0;
if (argc < 2) {
- mounted_usage();
+ version(argv[0]);
+ usage();
goto bail;
}
strncpy(opts.device, argv[1], FILE_NAME_SIZE);
if (strlen(opts.device))
ret = 1;
- else
- mounted_usage();
+ else {
+ version(argv[0]);
+ usage();
+ }
bail:
return ret;
Modified: trunk/tools/fsck/Cscope.make
===================================================================
--- trunk/tools/fsck/Cscope.make 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/tools/fsck/Cscope.make 2004-01-24 01:20:18 UTC (rev 3)
@@ -5,4 +5,5 @@
echo "-I ../../ocfs2/Linux/inc" >> cscope.files
find . -name '*.c' -print >>cscope.files
find . -name '*.h' -print >>cscope.files
+ find ../libocfs -name '*.h' -print >>cscope.files
cscope -b
Modified: trunk/tools/fsck/Makefile
===================================================================
--- trunk/tools/fsck/Makefile 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/tools/fsck/Makefile 2004-01-24 01:20:18 UTC (rev 3)
@@ -2,10 +2,10 @@
include $(TOPDIR)/Preamble.make
-MANS = fsck.1
+MANS = fsck.ocfs.1
-SBIN_PROGRAMS = fsck.ocfs fsck.ocfs.ro
-DIST_FILES = mkgetconst fsck.h classes.h defaults.h fsck_print.h layout.h sig.h verify.h mkgetconst classes.c parse fsck.1.in
+SBIN_PROGRAMS = fsck.ocfs
+DIST_FILES = mkgetconst fsck.h classes.h defaults.h fsck_print.h layout.h sig.h verify.h mkgetconst classes.c parse fsck.ocfs.1.in
WARNINGS = -Wall -Wstrict-prototypes -Wno-format -Wmissing-prototypes \
@@ -19,13 +19,13 @@
GLIB_LIBS = `glib-config --libs`
GLIB_CFLAGS = `glib-config --cflags`
-DEFINES = -DLINUX -DUSERSPACE_TOOL -DSHOW_INVALID_VALUES
+DEFINES = -DLINUX -DUSERSPACE_TOOL -DSHOW_INVALID_VALUES -DFSCK_OCFS
ifeq ($(OCFS_PROCESSOR),x86_64)
- CFLAGS += -O0 -m64
+ CFLAGS += -O2 -m64
endif
ifeq ($(OCFS_PROCESSOR),ia64)
- CFLAGS += -O0
+ CFLAGS += -O2
endif
ifeq ($(OCFS_PROCESSOR),i686)
DEFINES += -D__ILP32__
@@ -37,10 +37,10 @@
DEFINES += -DDEBUG
endif
-GLIB_OBJS = verify.o fsck_io.o class_print.o class_rw.o fsck_print.o sig.o layout.o defaults.o
+GLIB_OBJS = verify.o fsck_io.o class_print.o class_rw.o fsck_print.o sig.o layout.o defaults.o bindraw.o
## FIXME: make real later
-VERSION_FILES = fsck.c verify.c fsck_io.c class_print.c class_rw.c fsck_print.c sig.c layout.c defaults.c ver.c parse.c
+VERSION_FILES = fsck.c verify.c fsck_io.c class_print.c class_rw.c fsck_print.c sig.c layout.c defaults.c ver.c parse.c bindraw.c
VERSION_SRC = ver.c
VERSION_PREFIX = FSCK
@@ -56,16 +56,10 @@
fsck.o: fsck.c
$(CC) $(CFLAGS) $(INCLUDES) $(GLIB_CFLAGS) $(DEFINES) -DUSE_MALLOC_ALIGNED $(VERMAGIC) -o $@ -c $<
-fsckro.o: fsck.c
- $(CC) $(CFLAGS) -DREADONLY $(INCLUDES) $(GLIB_CFLAGS) $(DEFINES) -DUSE_MALLOC_ALIGNED $(VERMAGIC) -o $@ -c $<
-
$(GLIB_OBJS): %.o: %.c
$(CC) $(CFLAGS) $(INCLUDES) $(GLIB_CFLAGS) $(DEFINES) -DUSE_MALLOC_ALIGNED $(VERMAGIC) -o $@ -c $<
fsck.ocfs: classes.o fsck.o $(GLIB_OBJS) ver.o
$(LINK) -static $(GLIB_LIBS) $(LIBOCFS_LIBS)
-fsck.ocfs.ro: classes.o fsckro.o $(GLIB_OBJS) ver.o
- $(LINK) -static $(GLIB_LIBS) $(LIBOCFS_LIBS)
-
include $(TOPDIR)/Postamble.make
Modified: trunk/tools/fsck/fsck.c
===================================================================
--- trunk/tools/fsck/fsck.c 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/tools/fsck/fsck.c 2004-01-24 01:20:18 UTC (rev 3)
@@ -3,7 +3,7 @@
*
* ocfs file system check utility
*
- * Copyright (C) 2003, Oracle. All rights reserved.
+ * Copyright (C) 2003, 2004 Oracle. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
@@ -77,11 +77,12 @@
}
char *usage_str =
-"usage: fsck.ocfs [-N] [-v] device\n\n"
-" -N No write\n"
+"usage: fsck.ocfs [OPTIONS] device\n"
+" -n No hearbeat check\n"
+" -w Writeable\n"
" -V Version\n"
" -v Verbose\n"
-" -q Quiet\n";
+" -q Quiet";
/*
* usage()
@@ -102,7 +103,8 @@
int c;
int ret = -1;
- ctxt.write_changes = true;
+ ctxt.write_changes = false;
+ ctxt.no_hb_chk = false;
ctxt.verbose = false;
ctxt.modify_all = false;
ctxt.quiet = false;
@@ -115,15 +117,18 @@
while (1) {
off = 0;
- c = getopt(argc, argv, "NVvmqf?");
+ c = getopt(argc, argv, "wnVvmqf?");
if (c == -1)
break;
switch (c) {
- case 'N':
- ctxt.write_changes = false;
+ case 'w':
+ ctxt.write_changes = true;
break;
+ case 'n':
+ ctxt.no_hb_chk = true;
+ break;
case 'm':
ctxt.modify_all = true;
break;
@@ -149,10 +154,12 @@
if (ctxt.modify_all)
ctxt.verbose = true;
-#ifdef READONLY
- ctxt.write_changes = true;
-#endif
+ if (ctxt.write_changes)
+ ctxt.no_hb_chk = false;
+ if (ctxt.dev_is_file)
+ ctxt.no_hb_chk = false;
+
ret = 0;
bail:
return ret;
@@ -357,19 +364,15 @@
if (s->sig_match) {
if (s->sig_match(buf, idx)==-EINVAL) {
- LOG_ERROR("bad signature");
+ LOG_ERROR("Bad signature found");
ret = -1;
-#ifdef READONLY
- LOG_ERROR("Bad signature not fixed due to readonly option");
-#else
if (ctxt.write_changes) {
if (!*bad)
*bad = g_hash_table_new(g_direct_hash, g_direct_equal);
ret = confirm_changes(off, s, buf, idx, *bad);
- LOG_ERROR("Bad signature fixed");
+ LOG_PRINT("Fixed");
} else
- LOG_ERROR("Bad signature not fixed due to -N option");
-#endif
+ LOG_PRINT("To fix, rerun with -w");
/* restore the original if the new one was not written */
if (ret == -1)
memcpy(buf, saved_block, 512);
@@ -475,17 +478,22 @@
{
int ret = -1;
int fd;
- int flags;
-#ifdef READONLY
- flags = O_RDONLY | O_LARGEFILE;
-#else
- flags = O_RDWR | O_LARGEFILE | O_DIRECT | O_SYNC;
-#endif
+ if (ctxt.write_changes)
+ ctxt.flags = O_RDWR | O_LARGEFILE | O_SYNC;
+ else
+ ctxt.flags = O_RDONLY | O_LARGEFILE;
- if ((fd = myopen(ctxt.device, flags)) == -1) {
- usage();
+ if (bind_raw(ctxt.device, &ctxt.raw_minor, ctxt.raw_device, sizeof(ctxt.raw_device)))
goto bail;
+
+ if (ctxt.verbose)
+ CLEAR_AND_PRINT("Bound %s to %s", ctxt.device, ctxt.raw_device);
+
+ if ((fd = myopen(ctxt.raw_device, ctxt.flags)) == -1) {
+ LOG_ERROR("Error opening %s.\n%s.", ctxt.raw_device,
+ strerror(errno));
+ goto bail;
} else
ctxt.fd = fd;
@@ -548,9 +556,8 @@
ocfs_layout_t *l;
int j;
GHashTable *bad = NULL;
-#ifndef READONLY
int changed = 0;
-#endif
+
memset(&ctxt, 0, sizeof(ctxt));
init_global_context();
@@ -567,7 +574,6 @@
strncpy(ctxt.device, argv[optind], OCFS_MAX_FILENAME_LENGTH);
if (fsck_initialize(&buf) == -1) {
- LOG_ERROR("during initialize. exiting.");
goto quiet_bail;
}
@@ -579,13 +585,11 @@
}
/* Exit if heartbeat detected */
-#ifndef READONLY
- if (!ctxt.dev_is_file) {
+ if (!ctxt.no_hb_chk) {
if (!check_heart_beat(&ctxt.fd, OCFSCK_PUBLISH_OFF,
OCFS_SECTOR_SIZE))
goto quiet_bail;
}
-#endif
/* Check ocfs volume header blocks */
for (i = 0; i < ocfs_header_layout_sz; i++) {
@@ -608,7 +612,6 @@
break;
if (ret != -1 && !ctxt.modify_all)
continue;
-#ifndef READONLY
while (ctxt.write_changes) {
changed = 0;
if (edit_structure(s, buf, j, &changed, &option) != -1)
@@ -618,13 +621,10 @@
break;
if ((ret = confirm_changes(off, s, buf, j, bad)) == -1)
- printf("did not write changes to disk\n");
- else
- printf("wrote changes to disk\n");
+ LOG_PRINT("Abort write");
break;
}
-#endif
if (bad)
g_hash_table_destroy(bad);
@@ -678,9 +678,14 @@
ctxt.vol_bm_data->len,
ctxt.hdr->num_clusters);
}
+
+quiet_bail:
+ myclose(ctxt.fd);
+
+ unbind_raw(ctxt.raw_minor, ctxt.raw_device);
+
printf("\n");
-quiet_bail:
if (ctxt.vol_bm_data)
g_array_free(ctxt.vol_bm_data, true);
@@ -914,12 +919,13 @@
fe1 = (ocfs_file_entry *) ((char *)FIRST_FILE_ENTRY(globaldir) + (idx1 * OCFS_SECTOR_SIZE));
fe2 = (ocfs_file_entry *) ((char *)FIRST_FILE_ENTRY(globaldir) + (idx2 * OCFS_SECTOR_SIZE));
- if (fe1->sync_flags & OCFS_SYNC_FLAG_NAME_DELETED ||
+
+ if (IS_FE_DELETED(fe1->sync_flags) ||
(!(fe1->sync_flags & OCFS_SYNC_FLAG_VALID)) ||
- fe2->sync_flags & OCFS_SYNC_FLAG_NAME_DELETED ||
- (!(fe2->sync_flags & OCFS_SYNC_FLAG_VALID))) {
+ IS_FE_DELETED(fe2->sync_flags) ||
+ (!(fe2->sync_flags & OCFS_SYNC_FLAG_VALID)))
return 0;
- }
+
ret = strncmp(fe1->filename, fe2->filename, 255);
return -ret;
@@ -987,12 +993,9 @@
qsort(index, dir->num_ent_used, sizeof(__u8), fe_compare_func);
if (memcmp(index, dir->index, dir->num_ent_used) != 0) {
-#ifdef READONLY
- LOG_ERROR("Bad dir index found, but not fixed due to readonly option");
-#else
__u8 *idxtmp = NULL;
- LOG_ERROR("Bad dir index found. Fixing.");
+ LOG_ERROR("Bad dir index found");
if (ctxt.write_changes) {
if ((idxtmp = malloc(256)) == NULL) {
LOG_INTERNAL();
@@ -1006,34 +1009,28 @@
memcpy(dir->index, idxtmp, 256);
}
safefree(idxtmp);
- LOG_ERROR("Bad dir index fixed.");
+ LOG_PRINT("Fixed");
} else
- LOG_ERROR("Bad dir index not fixed due to -N option");
-#endif
+ LOG_PRINT("To fix, rerun with -w");
}
/* check the undeletable dir bug, BUG #3016598 */
for (i=0, deleted_files=0; i < dir->num_ent_used; i++) {
- if ((FILEENT(dir, i))->sync_flags &
- OCFS_SYNC_FLAG_MARK_FOR_DELETION)
+ if (IS_FE_DELETED((FILEENT(dir, i))->sync_flags))
deleted_files++;
}
if (dir->num_ent_used && dir->num_ent_used == deleted_files) {
/* we hit the bug... fix by zeroing num_ent_used */
-#ifdef READONLY
- LOG_ERROR("Undeletable directory found, but not fixed due to readonly option");
-#else
- LOG_ERROR("Undeletable directory found. Fixing.");
+ LOG_ERROR("Undeletable directory found");
if (ctxt.write_changes) {
dir->num_ent_used = 0;
if (dirst->write(ctxt.fd, dirbuf, dir_offset, 0)==-1) {
LOG_ERROR("failed to write at offset %u/%u", dir_offset);
dir->num_ent_used = 1;
}
- LOG_ERROR("Undeletable directory fixed.");
+ LOG_PRINT("Fixed");
} else
- LOG_ERROR("Undeletable directory not fixed due to -N option");
-#endif
+ LOG_PRINT("To fix, rerun with -w");
}
/* Add bitmap entry for the dirnode itself */
@@ -1057,8 +1054,7 @@
// TODO: add in file entry editing here
- if (febuf->sync_flags &&
- !(febuf->sync_flags & DELETED_FLAGS))
+ if (!IS_FE_DELETED(febuf->sync_flags))
check_file_entry(fd, febuf, off, false, dirpath);
}
@@ -1508,7 +1504,6 @@
ocfs_super osb;
int ret = 0;
int i;
- int j;
int waittime;
char *node_names[OCFS_MAXIMUM_NODES];
__u32 nodemap;
@@ -1541,17 +1536,11 @@
/* Close and re-open device to force disk read */
myclose(*file);
-#ifdef READONLY
- if ((*file = myopen(ctxt.device, O_RDONLY | O_LARGEFILE | O_DIRECT)) == -1) {
+
+ if ((*file = myopen(ctxt.raw_device, ctxt.flags)) == -1) {
LOG_INTERNAL();
goto bail;
}
-#else
- if ((*file = myopen(ctxt.device, O_RDWR | O_LARGEFILE | O_DIRECT | O_SYNC)) == -1) {
- LOG_INTERNAL();
- goto bail;
- }
-#endif
memset (publish, 0, sect_size);
if (!read_publish(*file, publ_off, sect_size, (void **)&publish)) {
@@ -1574,18 +1563,18 @@
get_node_names(*file, ctxt.hdr, node_names, sect_size);
/* Prints the ones which are mounted */
- printf("Volume is mounted on nodes: ");
- for (j = 1, i = 0; i < OCFS_MAXIMUM_NODES; ++i, j <<= 1) {
- if (nodemap & j) {
- if (node_names[i])
- printf("%s\t", node_names[i]);
- else
- printf("%d\t", i);
- }
+ printf("%s is mounted on nodes:", ctxt.device);
+ print_node_names(node_names, nodemap);
+
+ if (ctxt.write_changes) {
+ ctxt.write_changes = false;
+ printf("umount volume on node(s) before running fsck -w\n");
+ printf("Continuing in read-only mode\n");
}
- printf("\numount on node(s) before running fsck again.\n");
- goto bail;
+ printf("As %s is mounted on one or more nodes, fsck.ocfs may "
+ "display false-positive errors\n", ctxt.device);
+
success:
ret = 1;
bail:
@@ -1673,3 +1662,25 @@
free_aligned(buf);
return ret;
} /* get_node_names */
+
+
+/*
+ * print_node_names()
+ *
+ */
+void print_node_names(char **node_names, __u32 nodemap)
+{
+ int i, j;
+ char comma = '\0';
+
+ for (j = 1, i = 0; i < OCFS_MAXIMUM_NODES; ++i, j <<= 1) {
+ if (nodemap & j) {
+ if (node_names[i])
+ printf("%c %s", comma, node_names[i]);
+ else
+ printf("%c %d", comma, i);
+ comma = ',';
+ }
+ }
+ printf("\n");
+} /* print_node_names */
Modified: trunk/tools/fsck/fsck.h
===================================================================
--- trunk/tools/fsck/fsck.h 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/tools/fsck/fsck.h 2004-01-24 01:20:18 UTC (rev 3)
@@ -3,7 +3,7 @@
*
* Function prototypes, macros, etc. for related 'C' files
*
- * Copyright (C) 2003 Oracle. All rights reserved.
+ * Copyright (C) 2003, 2004 Oracle. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
@@ -44,7 +44,6 @@
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/wait.h>
-#include <sys/raw.h>
#include "libocfs.h"
#include "classes.h"
@@ -53,6 +52,7 @@
#include "verify.h"
#include "defaults.h"
#include "layout.h"
+#include "bindraw.h"
extern bool prn_err;
extern bool int_err;
@@ -108,6 +108,14 @@
fflush(stdout); \
} while (0)
+#define LOG_PRINT(fmt, arg...) \
+ do { \
+ prn_err = true; \
+ fprintf(stdout, "\n"); \
+ fprintf(stdout, fmt, ## arg); \
+ fflush(stdout); \
+ } while (0)
+
#define CLEAR_AND_PRINT(fmt, arg...) \
do { \
if (!ctxt.quiet) { \
@@ -175,6 +183,7 @@
int read_publish(int file, __u64 publ_off, __u32 sect_size, void **buf);
int get_node_names(int file, ocfs_vol_disk_hdr *volhdr, char **node_names,
__u32 sect_size);
+void print_node_names(char **node_names, __u32 nodemap);
////////////////////////
void ocfs_extent_map_init (ocfs_extent_map * map);
@@ -216,12 +225,16 @@
typedef struct _ocfsck_context
{
char device[OCFS_MAX_FILENAME_LENGTH];
+ char raw_device[OCFS_MAX_FILENAME_LENGTH];
+ int raw_minor;
+ int flags;
int fd;
ocfs_super *vcb;
bool write_changes;
bool verbose;
bool modify_all;
bool quiet;
+ bool no_hb_chk;
bool dev_is_file;
ocfs_vol_disk_hdr *hdr;
__u8 *vol_bm;
Modified: trunk/tools/fsck/fsck_io.c
===================================================================
--- trunk/tools/fsck/fsck_io.c 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/tools/fsck/fsck_io.c 2004-01-24 01:20:18 UTC (rev 3)
@@ -4,7 +4,7 @@
* provides the actual file I/O support in ocfs file system
* check utility
*
- * Copyright (C) 2003 Oracle. All rights reserved.
+ * Copyright (C) 2003, 2004 Oracle. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
@@ -88,10 +88,6 @@
oldmode = umask(0000);
file = open(path, flags, 0777);
umask(oldmode);
- if (file == -1) {
- LOG_ERROR("open() %s", strerror(errno));
- file = 0;
- }
return file;
} /* myopen */
Modified: trunk/tools/libocfs/Makefile
===================================================================
--- trunk/tools/libocfs/Makefile 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/tools/libocfs/Makefile 2004-01-24 01:20:18 UTC (rev 3)
@@ -17,10 +17,10 @@
DEFINES = -DLINUX -DUSERSPACE_TOOL
ifeq ($(OCFS_PROCESSOR),x86_64)
- CFLAGS += -O0 -m64
+ CFLAGS += -O2 -m64
endif
ifeq ($(OCFS_PROCESSOR),ia64)
- CFLAGS += -O0
+ CFLAGS += -O2
endif
ifeq ($(OCFS_PROCESSOR),i686)
DEFINES += -D__ILP32__
Modified: trunk/tools/libocfs/libocfs.h
===================================================================
--- trunk/tools/libocfs/libocfs.h 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/tools/libocfs/libocfs.h 2004-01-24 01:20:18 UTC (rev 3)
@@ -27,6 +27,53 @@
extern long TIME_ZERO;
#endif
+/* Horrific, for SuSE */
+#ifdef __ia64__
+#define ia64_cmpxchg(sem,ptr,old,new,size) \
+({ \
+ __typeof__(ptr) _p_ = (ptr); \
+ __typeof__(new) _n_ = (new); \
+ __u64 _o_, _r_; \
+ \
+ switch (size) { \
+ case 1: _o_ = (__u8 ) (long) (old); break; \
+ case 2: _o_ = (__u16) (long) (old); break; \
+ case 4: _o_ = (__u32) (long) (old); break; \
+ case 8: _o_ = (__u64) (long) (old); break; \
+ default: break; \
+ } \
+ __asm__ __volatile__ ("mov ar.ccv=%0;;" :: "rO"(_o_)); \
+ switch (size) { \
+ case 1: \
+ __asm__ __volatile__ ("cmpxchg1."sem" %0=[%1],%2,ar.ccv" \
+ : "=r"(_r_) : "r"(_p_), "r"(_n_) : "memory"); \
+ break; \
+ \
+ case 2: \
+ __asm__ __volatile__ ("cmpxchg2."sem" %0=[%1],%2,ar.ccv" \
+ : "=r"(_r_) : "r"(_p_), "r"(_n_) : "memory"); \
+ break; \
+ \
+ case 4: \
+ __asm__ __volatile__ ("cmpxchg4."sem" %0=[%1],%2,ar.ccv" \
+ : "=r"(_r_) : "r"(_p_), "r"(_n_) : "memory"); \
+ break; \
+ \
+ case 8: \
+ __asm__ __volatile__ ("cmpxchg8."sem" %0=[%1],%2,ar.ccv" \
+ : "=r"(_r_) : "r"(_p_), "r"(_n_) : "memory"); \
+ break; \
+ \
+ default: \
+ _r_ = 0; \
+ break; \
+ } \
+ (__typeof__(old)) _r_; \
+})
+
+#define cmpxchg_acq(ptr,o,n) ia64_cmpxchg("acq", (ptr), (o), (n), sizeof(*(ptr)))
+#endif
+
/* Get large file support */
#define _GNU_SOURCE
@@ -49,7 +96,6 @@
#undef WUNTRACED
#include <linux/fs.h>
-
#include <pthread.h>
#include <sched.h>
#include <signal.h>
@@ -238,7 +284,10 @@
#ifndef ATOMIC_INIT
/* atomic_t stuff */
+
+#if !defined(_ASM_IA64_ATOMIC_H) && !defined(__ARCH_X86_64_ATOMIC__) && !defined(__ARCH_I386_ATOMIC__)
typedef struct { volatile int counter; } atomic_t;
+#endif
#define ATOMIC_INIT(i) { (i) }
Modified: trunk/tools/ocfs_uid_gen/ocfs_uid_gen.1.in
===================================================================
--- trunk/tools/ocfs_uid_gen/ocfs_uid_gen.1.in 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/tools/ocfs_uid_gen/ocfs_uid_gen.1.in 2004-01-24 01:20:18 UTC (rev 3)
@@ -9,9 +9,11 @@
.SH "OPTIONS"
.TP
-\fB\-c\fR Create a new GUID for a new node before it enters the cluster.
+\fB\-c\fR
+Create a new GUID for a new node before it enters the cluster.
.TP
-\fB\-r\fR Recover the GUID, inserting the new MAC address. This operation is only for existing nodes whose MAC address has changed.
+\fB\-r\fR
+Recover the GUID, inserting the new MAC address. This operation is only for existing nodes whose MAC address has changed.
.TP
.SH "BUGS"
Modified: trunk/tools/ocfstool/Makefile
===================================================================
--- trunk/tools/ocfstool/Makefile 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/tools/ocfstool/Makefile 2004-01-24 01:20:18 UTC (rev 3)
@@ -18,10 +18,10 @@
INCLUDES = $(GTK_CFLAGS) -I$(TOPDIR)/tools/libocfs -I../debugocfs
ifeq ($(OCFS_PROCESSOR),x86_64)
- CFLAGS += -O0 -m64
+ CFLAGS += -O2 -m64
endif
ifeq ($(OCFS_PROCESSOR),ia64)
- CFLAGS += -O0
+ CFLAGS += -O2
endif
ifeq ($(OCFS_PROCESSOR),i686)
CFLAGS += -O2
Modified: trunk/tools/ocfstool/ocfsbrowser.c
===================================================================
--- trunk/tools/ocfstool/ocfsbrowser.c 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/tools/ocfstool/ocfsbrowser.c 2004-01-24 01:20:18 UTC (rev 3)
@@ -399,7 +399,8 @@
gtk_object_set_data (GTK_OBJECT (item), "device", (gpointer) device);
gtk_signal_connect (GTK_OBJECT (item), "activate",
- GTK_SIGNAL_FUNC (is_cdsl ? dump_cdsl : dump_file), info);
+ GTK_SIGNAL_FUNC ((is_cdsl ? dump_cdsl : dump_file)),
+ info);
mountpoint = ocfs_get_mountpoint (device);
Modified: trunk/tools/ocfstool/ocfsgenconfig.c
===================================================================
--- trunk/tools/ocfstool/ocfsgenconfig.c 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/tools/ocfstool/ocfsgenconfig.c 2004-01-24 01:20:18 UTC (rev 3)
@@ -39,7 +39,6 @@
enum {
NODENAME,
- NODENUM,
DEVICE,
PORT
};
@@ -97,9 +96,9 @@
GtkWidget **entries)
{
GtkWindow *parent;
- gchar *interface, *address, *nodename, *nodenum;
- gint port, num;
- gchar *cmd, *buf;
+ gchar *interface, *address, *nodename;
+ gint port;
+ gchar *cmd;
gchar **info;
FILE *config;
@@ -119,25 +118,6 @@
return;
}
- nodenum = g_strdup ("");
-
- if (entries[NODENUM])
- {
- buf = gtk_entry_get_text (GTK_ENTRY (entries[NODENUM]));
- if (strlen (buf) > 0)
- {
- num = strtol (buf, NULL, 10);
- if (num > 31)
- {
- ocfs_error_box (parent, NULL, "Invalid node number");
- return;
- }
-
- g_free (nodenum);
- nodenum = g_strdup_printf ("%d", num);
- }
- }
-
interface = gtk_entry_get_text (GTK_ENTRY (entries[DEVICE]));
cmd = g_strdup_printf (INTERFACE_INFO_CMD, interface);
@@ -169,7 +149,6 @@
fprintf (config, "# Ensure this file exists in /etc\n");
fprintf (config, "#\n\n");
fprintf (config, "\tnode_name = %s\n", nodename);
- fprintf (config, "\tnode_number = %s\n", nodenum);
fprintf (config, "\tip_address = %s\n", address);
fprintf (config, "\tip_port = %d\n", port);
fprintf (config, "\tcomm_voting = 1\n");
@@ -177,7 +156,6 @@
fclose (config);
g_free (address);
- g_free (nodenum);
gtk_main_quit ();
@@ -268,25 +246,6 @@
NULL);
gtk_table_attach_defaults (table, label, 0, 1, 2, 3);
- if (advanced)
- {
- entry = gtk_widget_new (GTK_TYPE_ENTRY,
- "max_length", 2,
- "signal::insert_text", numeric_insert_filter, NULL,
- NULL);
-
- gtk_table_attach_defaults (table, entry, 1, 2, 3, 4);
- entries[NODENUM] = entry;
-
- label = gtk_widget_new (GTK_TYPE_LABEL,
- "label", "Preferred Node Number (optional):",
- "xalign", 1.0,
- NULL);
- gtk_table_attach_defaults (table, label, 0, 1, 3, 4);
- }
- else
- entries[NODENUM] = NULL;
-
entry = gtk_widget_new (GTK_TYPE_ENTRY,
"max_length", 5,
"signal::insert_text", numeric_insert_filter, NULL,
@@ -312,7 +271,7 @@
struct stat sbuf;
GtkWidget *dialog;
GtkWidget *table;
- GtkWidget *entries[4];
+ GtkWidget *entries[3];
if (stat (CONFFILE, &sbuf) == 0)
{
@@ -326,7 +285,7 @@
dialog = ocfs_dialog_new (parent, "OCFS Generate Config", do_config, entries);
table = gtk_widget_new (GTK_TYPE_TABLE,
- "n_rows", advanced ? 4 : 3,
+ "n_rows", 3,
"n_columns", 2,
"homogeneous", FALSE,
"row_spacing", 4,
Modified: trunk/tools/ocfstool/ocfsguiutil.c
===================================================================
--- trunk/tools/ocfstool/ocfsguiutil.c 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/tools/ocfstool/ocfsguiutil.c 2004-01-24 01:20:18 UTC (rev 3)
@@ -401,6 +401,13 @@
return str;
}
+/* Replace with G_GUINT64_FORMAT when we can */
+#ifdef __LP64__
+#define FORMAT64 "%lu"
+#else
+#define FORMAT64 "%llu"
+#endif
+
gchar *
ocfs_format_bytes (guint64 bytes,
gboolean show_bytes)
@@ -412,13 +419,14 @@
if (bytes == 1)
return g_strdup ("1 byte");
else if (bytes < 1024)
- return g_strdup_printf ("%llu bytes", bytes);
+ return g_strdup_printf (FORMAT64 " bytes", bytes);
for (i = -1; i < 3 && fbytes >= 1024; i++)
fbytes /= 1024;
if (show_bytes)
- return g_strdup_printf ("%.1f %s (%llub)", fbytes, suffixes[i], bytes);
+ return g_strdup_printf ("%.1f %s (" FORMAT64 "b)", fbytes, suffixes[i],
+ bytes);
else
return g_strdup_printf ("%.0f %s", fbytes, suffixes[i]);
}
Modified: trunk/tools/sizetest/Makefile
===================================================================
--- trunk/tools/sizetest/Makefile 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/tools/sizetest/Makefile 2004-01-24 01:20:18 UTC (rev 3)
@@ -10,10 +10,10 @@
LDADD=-nostdlib
ifeq ($(OCFS_PROCESSOR),x86_64)
- CFLAGS += -O0 -m64
+ CFLAGS += -O2 -m64
endif
ifeq ($(OCFS_PROCESSOR),ia64)
- CFLAGS += -O0
+ CFLAGS += -O2
endif
ifeq ($(OCFS_PROCESSOR),i686)
CFLAGS += -O2
Modified: trunk/unitedlinux/Makefile
===================================================================
--- trunk/unitedlinux/Makefile 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/unitedlinux/Makefile 2004-01-24 01:20:18 UTC (rev 3)
@@ -2,6 +2,13 @@
include $(TOPDIR)/Preamble.make
-DIST_FILES = ocfs.init ocfs-2.4.19-64GB-SMP.spec.in ocfs-2.4.19-4GB.spec.in ocfs-2.4.19-4GB-SMP.spec.in
+DIST_FILES = \
+ ocfs.init \
+ ocfs-2.4.19-64GB-SMP.spec.in \
+ ocfs-2.4.19-4GB-SMP.spec.in \
+ ocfs-2.4.19-4GB.spec.in \
+ ocfs-2.4.21-107.spec.in \
+ ocfs-2.4.21-111.spec.in \
+ ocfs-2.4.21-138.spec.in
include $(TOPDIR)/Postamble.make
Modified: trunk/unitedlinux/ocfs-2.4.19-4GB-SMP.spec.in
===================================================================
--- trunk/unitedlinux/ocfs-2.4.19-4GB-SMP.spec.in 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/unitedlinux/ocfs-2.4.19-4GB-SMP.spec.in 2004-01-24 01:20:18 UTC (rev 3)
@@ -10,6 +10,9 @@
# This must be changed to the minimum ABI compat kernel version expected
%define kver 2.4.19-4GB-SMP
+# The minimum -support package required for the kernel bits.
+%define support_ver 1.0.9
+
Summary: The Oracle Cluster Filesystem
Name: ocfs-%{kver}
Version: @DIST_VERSION@
@@ -25,7 +28,7 @@
AutoReqProv: no
# Requires: kernel >= %{kver} -- silly UL nodeps
Requires: k_psmp = 2.4.19-304
-Requires: ocfs-support >= 1.0.8
+Requires: ocfs-support >= %{support_ver}
# BuildRequires: kernel-source >= %{kver} -- silly UL nodeps
Modified: trunk/unitedlinux/ocfs-2.4.19-4GB.spec.in
===================================================================
--- trunk/unitedlinux/ocfs-2.4.19-4GB.spec.in 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/unitedlinux/ocfs-2.4.19-4GB.spec.in 2004-01-24 01:20:18 UTC (rev 3)
@@ -10,6 +10,9 @@
# This must be changed to the minimum ABI compat kernel version expected
%define kver 2.4.19-4GB
+# The minimum -support package required for the kernel bits.
+%define support_ver 1.0.9
+
Summary: The Oracle Cluster Filesystem
Name: ocfs-%{kver}
Version: @DIST_VERSION@
@@ -25,7 +28,7 @@
AutoReqProv: no
# Requires: kernel >= %{kver} -- silly UL nodeps
Requires: k_deflt = 2.4.19-304
-Requires: ocfs-support >= 1.0.8
+Requires: ocfs-support >= %{support_ver}
# BuildRequires: kernel-source >= %{kver} -- silly UL nodeps
Modified: trunk/unitedlinux/ocfs-2.4.19-64GB-SMP.spec.in
===================================================================
--- trunk/unitedlinux/ocfs-2.4.19-64GB-SMP.spec.in 2003-11-21 23:41:20 UTC (rev 2)
+++ trunk/unitedlinux/ocfs-2.4.19-64GB-SMP.spec.in 2004-01-24 01:20:18 UTC (rev 3)
@@ -10,6 +10,9 @@
# This must be changed to the minimum ABI compat kernel version expected
%define kver 2.4.19-64GB-SMP
+# The minimum -support package required for the kernel bits.
+%define support_ver 1.0.9
+
Summary: The Oracle Cluster Filesystem
Name: ocfs-%{kver}
Version: @DIST_VERSION@
@@ -25,7 +28,7 @@
AutoReqProv: no
# Requires: kernel >= %{kver} -- silly UL nodeps
Requires: k_smp = 2.4.19-304
-Requires: ocfs-support >= 1.0.8
+Requires: ocfs-support >= %{support_ver}
# BuildRequires: kernel-source >= %{kver} -- silly UL nodeps
More information about the Ocfs-commits
mailing list