[Ocfs-commits]
rev 10 - in trunk: . docs ocfs2 ocfs2/Common ocfs2/Common/inc
ocfs2/Linux ocfs2/Linux/inc ocfs2/Support redhat tools/debugocfs
tools/format tools/ocfs_uid_gen tools/ocfstool tools/sizetest
unitedlinux
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Tue Sep 2 21:05:22 CDT 2003
Author: manish
Date: 2003-09-02 20:05:18 -0500 (Tue, 02 Sep 2003)
New Revision: 10
Added:
trunk/docs/2.5_PORT-TODO
trunk/tools/debugocfs/README.txt
trunk/tools/debugocfs/ver.c
trunk/tools/sizetest/disk.txt
trunk/tools/sizetest/diskstructs.c
trunk/tools/sizetest/net.txt
trunk/tools/sizetest/netstructs.c
Modified:
trunk/Config.make.in
trunk/config.guess
trunk/config.sub
trunk/configure.in
trunk/ocfs2/Common/inc/ocfs.h
trunk/ocfs2/Common/inc/ocfscom.h
trunk/ocfs2/Common/inc/ocfsdef.h
trunk/ocfs2/Common/inc/ocfsdisk.h
trunk/ocfs2/Common/inc/ocfsdlm.h
trunk/ocfs2/Common/inc/ocfsgenalloc.h
trunk/ocfs2/Common/inc/ocfsgendlm.h
trunk/ocfs2/Common/inc/ocfsgenvolcfg.h
trunk/ocfs2/Common/inc/ocfstrace.h
trunk/ocfs2/Common/inc/ocfsvol.h
trunk/ocfs2/Common/ocfsgenalloc.c
trunk/ocfs2/Common/ocfsgencreate.c
trunk/ocfs2/Common/ocfsgendirnode.c
trunk/ocfs2/Common/ocfsgenmisc.c
trunk/ocfs2/Common/ocfsgennm.c
trunk/ocfs2/Common/ocfsgensysfile.c
trunk/ocfs2/Common/ocfsgentrans.c
trunk/ocfs2/Common/ocfsgenvolcfg.c
trunk/ocfs2/Common/ocfsgenvote.c
trunk/ocfs2/Common/ocfsheartbeat.c
trunk/ocfs2/Common/ocfsver.c
trunk/ocfs2/Linux/inc/ocfsmain.h
trunk/ocfs2/Linux/inc/ocfsmount.h
trunk/ocfs2/Linux/ocfsbitmap.c
trunk/ocfs2/Linux/ocfsdlm.c
trunk/ocfs2/Linux/ocfsfile.c
trunk/ocfs2/Linux/ocfsioctl.c
trunk/ocfs2/Linux/ocfsiosup.c
trunk/ocfs2/Linux/ocfsipc.c
trunk/ocfs2/Linux/ocfsmain.c
trunk/ocfs2/Linux/ocfsmount.c
trunk/ocfs2/Linux/ocfsport.c
trunk/ocfs2/Makefile
trunk/ocfs2/Support/divdi3.c
trunk/redhat/ocfs-2.4.9-e.spec.in
trunk/redhat/ocfs.init
trunk/tools/debugocfs/Makefile
trunk/tools/debugocfs/class_print.c
trunk/tools/debugocfs/class_rw.c
trunk/tools/debugocfs/classes.h
trunk/tools/debugocfs/debugocfs.c
trunk/tools/debugocfs/dummy.c
trunk/tools/debugocfs/dummy.h
trunk/tools/debugocfs/extfinder.c
trunk/tools/debugocfs/fsck.c
trunk/tools/debugocfs/fsck.h
trunk/tools/debugocfs/fsck_io.c
trunk/tools/debugocfs/layout.c
trunk/tools/debugocfs/layout.h
trunk/tools/debugocfs/libdebugocfs.c
trunk/tools/debugocfs/main.c
trunk/tools/debugocfs/ocfsmalloc.c
trunk/tools/debugocfs/parse.c
trunk/tools/debugocfs/print.c
trunk/tools/debugocfs/sig.c
trunk/tools/debugocfs/translate.c
trunk/tools/debugocfs/verify.c
trunk/tools/debugocfs/verify.h
trunk/tools/format/Makefile
trunk/tools/format/format.c
trunk/tools/format/frmtport.c
trunk/tools/ocfs_uid_gen/ocfs_uid_gen
trunk/tools/ocfstool/Makefile
trunk/tools/ocfstool/ocfsgenconfig.c
trunk/tools/ocfstool/ocfsguiutil.c
trunk/tools/sizetest/Makefile
trunk/tools/sizetest/sizetest.c
trunk/unitedlinux/ocfs-2.4.19-64GB-SMP.spec.in
trunk/unitedlinux/ocfs.init
Log:
tree sync
Modified: trunk/Config.make.in
===================================================================
--- trunk/Config.make.in 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/Config.make.in 2003-09-03 01:05:18 UTC (rev 10)
@@ -45,6 +45,8 @@
KVER = @KVER@
+HAVE_NPTL = @HAVE_NPTL@
+
MODULEDIR = @MODULEDIR@
MODVERSIONS = @MODVERSIONS@
Modified: trunk/config.guess
===================================================================
--- trunk/config.guess 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/config.guess 2003-09-03 01:05:18 UTC (rev 10)
@@ -1,9 +1,9 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002 Free Software Foundation, Inc.
+# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
-timestamp='2002-05-29'
+timestamp='2003-05-19'
# 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
@@ -88,30 +88,41 @@
exit 1
fi
+trap 'exit 1' 1 2 15
-dummy=dummy-$$
-trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
-# CC_FOR_BUILD -- compiler used by this script.
# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
# use `HOST_CC' if defined, but it is deprecated.
-set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,) echo "int dummy(){}" > $dummy.c ;
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${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) ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,) echo "int x;" > $dummy.c ;
for c in cc gcc c89 c99 ; do
- ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ;
- if test $? = 0 ; then
+ if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
CC_FOR_BUILD="$c"; break ;
fi ;
done ;
- rm -f $dummy.c $dummy.o $dummy.rel ;
if test x"$CC_FOR_BUILD" = x ; then
CC_FOR_BUILD=no_compiler_found ;
fi
;;
,,*) CC_FOR_BUILD=$CC ;;
,*,*) CC_FOR_BUILD=$HOST_CC ;;
-esac'
+esac ;'
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi at noc.rutgers.edu 1994-08-24)
@@ -168,7 +179,18 @@
;;
esac
# The OS release
- release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ # Debian GNU/NetBSD machines have a different userland, and
+ # thus, need a distinct triplet. However, they do not need
+ # kernel version information, so it can be replaced with a
+ # suitable tag, in the style of linux-gnu.
+ case "${UNAME_VERSION}" in
+ Debian*)
+ release='-gnu'
+ ;;
+ *)
+ release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ ;;
+ esac
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
@@ -217,63 +239,47 @@
if test $UNAME_RELEASE = "V4.0"; then
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
fi
+ # According to Compaq, /usr/sbin/psrinfo has been available on
+ # OSF/1 and Tru64 systems produced since 1995. I hope that
+ # covers most systems running today. This code pipes the CPU
+ # types through head -n 1, so we only detect the type of CPU 0.
+ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+ case "$ALPHA_CPU_TYPE" in
+ "EV4 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "EV4.5 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "LCA4 (21066/21068)")
+ UNAME_MACHINE="alpha" ;;
+ "EV5 (21164)")
+ UNAME_MACHINE="alphaev5" ;;
+ "EV5.6 (21164A)")
+ UNAME_MACHINE="alphaev56" ;;
+ "EV5.6 (21164PC)")
+ UNAME_MACHINE="alphapca56" ;;
+ "EV5.7 (21164PC)")
+ UNAME_MACHINE="alphapca57" ;;
+ "EV6 (21264)")
+ UNAME_MACHINE="alphaev6" ;;
+ "EV6.7 (21264A)")
+ UNAME_MACHINE="alphaev67" ;;
+ "EV6.8CB (21264C)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8AL (21264B)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8CX (21264D)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.9A (21264/EV69A)")
+ UNAME_MACHINE="alphaev69" ;;
+ "EV7 (21364)")
+ UNAME_MACHINE="alphaev7" ;;
+ "EV7.9 (21364A)")
+ UNAME_MACHINE="alphaev79" ;;
+ esac
# A Vn.n version is a released version.
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
- cat <<EOF >$dummy.s
- .data
-\$Lformat:
- .byte 37,100,45,37,120,10,0 # "%d-%x\n"
-
- .text
- .globl main
- .align 4
- .ent main
-main:
- .frame \$30,16,\$26,0
- ldgp \$29,0(\$27)
- .prologue 1
- .long 0x47e03d80 # implver \$0
- lda \$2,-1
- .long 0x47e20c21 # amask \$2,\$1
- lda \$16,\$Lformat
- mov \$0,\$17
- not \$1,\$18
- jsr \$26,printf
- ldgp \$29,0(\$26)
- mov 0,\$16
- jsr \$26,exit
- .end main
-EOF
- eval $set_cc_for_build
- $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
- if test "$?" = 0 ; then
- case `./$dummy` in
- 0-0)
- UNAME_MACHINE="alpha"
- ;;
- 1-0)
- UNAME_MACHINE="alphaev5"
- ;;
- 1-1)
- UNAME_MACHINE="alphaev56"
- ;;
- 1-101)
- UNAME_MACHINE="alphapca56"
- ;;
- 2-303)
- UNAME_MACHINE="alphaev6"
- ;;
- 2-307)
- UNAME_MACHINE="alphaev67"
- ;;
- 2-1307)
- UNAME_MACHINE="alphaev68"
- ;;
- esac
- fi
- rm -f $dummy.s $dummy
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
exit 0 ;;
Alpha\ *:Windows_NT*:*)
@@ -314,6 +320,10 @@
NILE*:*:*:dcosx)
echo pyramid-pyramid-svr4
exit 0 ;;
+ DRS?6000:UNIX_SV:4.2*:7*)
+ case `/usr/bin/uname -p` in
+ sparc) echo sparc-icl-nx7 && exit 0 ;;
+ esac ;;
sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
@@ -420,18 +430,20 @@
exit (-1);
}
EOF
- $CC_FOR_BUILD $dummy.c -o $dummy \
- && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
- && rm -f $dummy.c $dummy && exit 0
- rm -f $dummy.c $dummy
+ $CC_FOR_BUILD -o $dummy $dummy.c \
+ && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+ && exit 0
echo mips-mips-riscos${UNAME_RELEASE}
exit 0 ;;
Motorola:PowerMAX_OS:*:*)
echo powerpc-motorola-powermax
exit 0 ;;
- Night_Hawk:*:*:PowerMAX_OS)
+ Motorola:*:4.3:PL8-*)
echo powerpc-harris-powermax
exit 0 ;;
+ Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+ echo powerpc-harris-powermax
+ exit 0 ;;
Night_Hawk:Power_UNIX:*:*)
echo powerpc-harris-powerunix
exit 0 ;;
@@ -504,8 +516,7 @@
exit(0);
}
EOF
- $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
- rm -f $dummy.c $dummy
+ $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
echo rs6000-ibm-aix3.2.5
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
echo rs6000-ibm-aix3.2.4
@@ -603,11 +614,21 @@
exit (0);
}
EOF
- (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy`
- if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
- rm -f $dummy.c $dummy
+ (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+ test -z "$HP_ARCH" && HP_ARCH=hppa
fi ;;
esac
+ if [ ${HP_ARCH} = "hppa2.0w" ]
+ then
+ # avoid double evaluation of $set_cc_for_build
+ test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
+ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
+ then
+ HP_ARCH="hppa2.0w"
+ else
+ HP_ARCH="hppa64"
+ fi
+ fi
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
exit 0 ;;
ia64:HP-UX:*:*)
@@ -641,8 +662,7 @@
exit (0);
}
EOF
- $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
- rm -f $dummy.c $dummy
+ $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
echo unknown-hitachi-hiuxwe2
exit 0 ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
@@ -700,15 +720,15 @@
CRAY*TS:*:*:*)
echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
- CRAY*T3D:*:*:*)
- echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
CRAY*T3E:*:*:*)
echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*SV1:*:*:*)
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
+ *:UNICOS/mp:*:*)
+ 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'`
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
@@ -724,8 +744,19 @@
*:BSD/OS:*:*)
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit 0 ;;
- *:FreeBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ *:FreeBSD:*:*|*:GNU/FreeBSD:*:*)
+ # Determine whether the default compiler uses glibc.
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <features.h>
+ #if __GLIBC__ >= 2
+ LIBC=gnu
+ #else
+ LIBC=
+ #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}
exit 0 ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
@@ -737,13 +768,16 @@
echo ${UNAME_MACHINE}-pc-pw32
exit 0 ;;
x86:Interix*:3*)
- echo i386-pc-interix3
+ echo i586-pc-interix3
exit 0 ;;
+ [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+ echo i${UNAME_MACHINE}-pc-mks
+ exit 0 ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
# UNAME_MACHINE based on the output of uname instead of i386?
- echo i386-pc-interix
+ echo i586-pc-interix
exit 0 ;;
i*:UWIN*:*)
echo ${UNAME_MACHINE}-pc-uwin
@@ -763,6 +797,9 @@
arm*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
+ cris:Linux:*:*)
+ echo cris-axis-linux-gnu
+ exit 0 ;;
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
@@ -786,9 +823,27 @@
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
- rm -f $dummy.c
- test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0
+ test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
;;
+ mips64:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef mips64
+ #undef mips64el
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=mips64el
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=mips64
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+ test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+ ;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
exit 0 ;;
@@ -849,7 +904,7 @@
;;
a.out-i386-linux)
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
- exit 0 ;;
+ exit 0 ;;
coff-i386)
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
exit 0 ;;
@@ -882,7 +937,6 @@
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
- rm -f $dummy.c
test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
;;
@@ -900,6 +954,23 @@
# Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
exit 0 ;;
+ i*86:OS/2:*:*)
+ # If we were able to find `uname', then EMX Unix compatibility
+ # is probably installed.
+ echo ${UNAME_MACHINE}-pc-os2-emx
+ exit 0 ;;
+ i*86:XTS-300:*:STOP)
+ echo ${UNAME_MACHINE}-unknown-stop
+ exit 0 ;;
+ i*86:atheos:*:*)
+ echo ${UNAME_MACHINE}-unknown-atheos
+ exit 0 ;;
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ i*86:*DOS:*:*)
+ echo ${UNAME_MACHINE}-pc-msdosdjgpp
+ exit 0 ;;
i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
@@ -934,9 +1005,6 @@
echo ${UNAME_MACHINE}-pc-sysv32
fi
exit 0 ;;
- i*86:*DOS:*:*)
- echo ${UNAME_MACHINE}-pc-msdosdjgpp
- exit 0 ;;
pc:*:*:*)
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
@@ -960,9 +1028,15 @@
# "miniframe"
echo m68010-convergent-sysv
exit 0 ;;
+ mc68k:UNIX:SYSTEM5:3.51m)
+ echo m68k-convergent-sysv
+ exit 0 ;;
+ M680?0:D-NIX:5.3:*)
+ echo m68k-diab-dnix
+ 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)
+ 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)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
@@ -979,9 +1053,6 @@
mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4
exit 0 ;;
- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
- echo i386-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
TSUNAMI:LynxOS:2.*:*)
echo sparc-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
@@ -1053,6 +1124,9 @@
SX-5:SUPER-UX:*:*)
echo sx5-nec-superux${UNAME_RELEASE}
exit 0 ;;
+ SX-6:SUPER-UX:*:*)
+ echo sx6-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE}
exit 0 ;;
@@ -1060,7 +1134,11 @@
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
exit 0 ;;
*:Darwin:*:*)
- echo `uname -p`-apple-darwin${UNAME_RELEASE}
+ case `uname -p` in
+ *86) UNAME_PROCESSOR=i686 ;;
+ powerpc) UNAME_PROCESSOR=powerpc ;;
+ esac
+ echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit 0 ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
UNAME_PROCESSOR=`uname -p`
@@ -1073,7 +1151,7 @@
*:QNX:*:4*)
echo i386-pc-qnx
exit 0 ;;
- NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*)
+ NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
echo nsr-tandem-nsk${UNAME_RELEASE}
exit 0 ;;
*:NonStop-UX:*:*)
@@ -1096,11 +1174,6 @@
fi
echo ${UNAME_MACHINE}-unknown-plan9
exit 0 ;;
- i*86:OS/2:*:*)
- # If we were able to find `uname', then EMX Unix compatibility
- # is probably installed.
- echo ${UNAME_MACHINE}-pc-os2-emx
- exit 0 ;;
*:TOPS-10:*:*)
echo pdp10-unknown-tops10
exit 0 ;;
@@ -1119,12 +1192,6 @@
*:ITS:*:*)
echo pdp10-unknown-its
exit 0 ;;
- i*86:XTS-300:*:STOP)
- echo ${UNAME_MACHINE}-unknown-stop
- exit 0 ;;
- i*86:atheos:*:*)
- echo ${UNAME_MACHINE}-unknown-atheos
- exit 0 ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
@@ -1245,8 +1312,7 @@
}
EOF
-$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0
-rm -f $dummy.c $dummy
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
# Apollos put the system type in the environment.
Modified: trunk/config.sub
===================================================================
--- trunk/config.sub 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/config.sub 2003-09-03 01:05:18 UTC (rev 10)
@@ -1,9 +1,9 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002 Free Software Foundation, Inc.
+# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
-timestamp='2002-06-21'
+timestamp='2003-05-09'
# 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,7 @@
# 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* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*)
+ nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
@@ -229,7 +229,7 @@
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
- | c4x | clipper \
+ | clipper \
| d10v | d30v | dlx | dsp16xx \
| fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
@@ -239,21 +239,25 @@
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
+ | mips64vr | mips64vrel \
| mips64orion | mips64orionel \
| mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \
| mipsisa32 | mipsisa32el \
+ | mipsisa32r2 | mipsisa32r2el \
| mipsisa64 | mipsisa64el \
| mipsisa64sb1 | mipsisa64sb1el \
+ | mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
+ | msp430 \
| ns16k | ns32k \
| openrisc | or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
- | sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+ | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
| strongarm \
@@ -292,7 +296,7 @@
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* \
| bs2000-* \
- | c[123]* | c30-* | [cjt]90-* | c54x-* \
+ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
| clipper-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
@@ -307,25 +311,31 @@
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
+ | mips64vr-* | mips64vrel-* \
| mips64orion-* | mips64orionel-* \
| mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* \
| mips64vr5000-* | mips64vr5000el-* \
| mipsisa32-* | mipsisa32el-* \
+ | mipsisa32r2-* | mipsisa32r2el-* \
| mipsisa64-* | mipsisa64el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
- | mipstx39 | mipstx39el \
- | none-* | np1-* | ns16k-* | ns32k-* \
+ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipstx39-* | mipstx39el-* \
+ | msp430-* \
+ | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \
| romp-* | rs6000-* \
- | sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \
+ | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
- | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \
+ | tahoe-* | thumb-* \
+ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+ | tron-* \
| v850-* | v850e-* | vax-* \
| we32k-* \
| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
@@ -363,6 +373,9 @@
basic_machine=a29k-none
os=-bsd
;;
+ amd64)
+ basic_machine=x86_64-pc
+ ;;
amdahl)
basic_machine=580-amdahl
os=-sysv
@@ -712,6 +725,10 @@
np1)
basic_machine=np1-gould
;;
+ nv1)
+ basic_machine=nv1-cray
+ os=-unicosmp
+ ;;
nsr-tandem)
basic_machine=nsr-tandem
;;
@@ -745,13 +762,13 @@
pbb)
basic_machine=m68k-tti
;;
- pc532 | pc532-*)
+ pc532 | pc532-*)
basic_machine=ns32k-pc532
;;
pentium | p5 | k5 | k6 | nexgen | viac3)
basic_machine=i586-pc
;;
- pentiumpro | p6 | 6x86 | athlon)
+ pentiumpro | p6 | 6x86 | athlon | athlon_*)
basic_machine=i686-pc
;;
pentiumii | pentium2)
@@ -772,22 +789,22 @@
power) basic_machine=power-ibm
;;
ppc) basic_machine=powerpc-unknown
- ;;
+ ;;
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppcle | powerpclittle | ppc-le | powerpc-little)
basic_machine=powerpcle-unknown
- ;;
+ ;;
ppcle-* | powerpclittle-*)
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppc64) basic_machine=powerpc64-unknown
- ;;
+ ;;
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppc64le | powerpc64little | ppc64-le | powerpc64-little)
basic_machine=powerpc64le-unknown
- ;;
+ ;;
ppc64le-* | powerpc64little-*)
basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
@@ -818,6 +835,12 @@
basic_machine=a29k-amd
os=-udi
;;
+ sb1)
+ basic_machine=mipsisa64sb1-unknown
+ ;;
+ sb1el)
+ basic_machine=mipsisa64sb1el-unknown
+ ;;
sequent)
basic_machine=i386-sequent
;;
@@ -883,7 +906,7 @@
sun386 | sun386i | roadrunner)
basic_machine=i386-sun
;;
- sv1)
+ sv1)
basic_machine=sv1-cray
os=-unicos
;;
@@ -891,10 +914,6 @@
basic_machine=i386-sequent
os=-dynix
;;
- t3d)
- basic_machine=alpha-cray
- os=-unicos
- ;;
t3e)
basic_machine=alphaev5-cray
os=-unicos
@@ -903,10 +922,22 @@
basic_machine=t90-cray
os=-unicos
;;
+ tic4x | c4x*)
+ basic_machine=tic4x-unknown
+ os=-coff
+ ;;
tic54x | c54x*)
basic_machine=tic54x-unknown
os=-coff
;;
+ tic55x | c55x*)
+ basic_machine=tic55x-unknown
+ os=-coff
+ ;;
+ tic6x | c6x*)
+ basic_machine=tic6x-unknown
+ os=-coff
+ ;;
tx39)
basic_machine=mipstx39-unknown
;;
@@ -941,8 +972,8 @@
os=-vms
;;
vpp*|vx|vx-*)
- basic_machine=f301-fujitsu
- ;;
+ basic_machine=f301-fujitsu
+ ;;
vxworks960)
basic_machine=i960-wrs
os=-vxworks
@@ -963,11 +994,7 @@
basic_machine=hppa1.1-winbond
os=-proelf
;;
- windows32)
- basic_machine=i386-pc
- os=-windows32-msvcrt
- ;;
- xps | xps100)
+ xps | xps100)
basic_machine=xps100-honeywell
;;
ymp)
@@ -1013,7 +1040,7 @@
we32k)
basic_machine=we32k-att
;;
- sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele)
+ sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
basic_machine=sh-unknown
;;
sh64)
@@ -1022,7 +1049,7 @@
sparc | sparcv9 | sparcv9b)
basic_machine=sparc-sun
;;
- cydra)
+ cydra)
basic_machine=cydra-cydrome
;;
orion)
@@ -1037,10 +1064,6 @@
pmac | pmac-mpw)
basic_machine=powerpc-apple
;;
- c4x*)
- basic_machine=c4x-none
- os=-coff
- ;;
*-unknown)
# Make sure to match an already-canonicalized machine name.
;;
@@ -1103,11 +1126,12 @@
| -chorusos* | -chorusrdb* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
- | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
+ | -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*)
+ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+ | -powermax* | -dnix*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@@ -1119,8 +1143,10 @@
;;
esac
;;
+ -nto-qnx*)
+ ;;
-nto*)
- os=-nto-qnx
+ os=`echo $os | sed -e 's|nto|nto-qnx|'`
;;
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
| -windows* | -osx | -abug | -netware* | -os9* | -beos* \
@@ -1172,7 +1198,7 @@
os=-rtmk-nova
;;
-ns2 )
- os=-nextstep2
+ os=-nextstep2
;;
-nsk*)
os=-nsk
@@ -1211,9 +1237,15 @@
-xenix)
os=-xenix
;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- os=-mint
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ os=-mint
;;
+ -aros*)
+ os=-aros
+ ;;
+ -kaos*)
+ os=-kaos
+ ;;
-none)
;;
*)
@@ -1249,7 +1281,7 @@
pdp10-*)
os=-tops20
;;
- pdp11-*)
+ pdp11-*)
os=-none
;;
*-dec | vax-*)
@@ -1342,19 +1374,19 @@
*-next)
os=-nextstep3
;;
- *-gould)
+ *-gould)
os=-sysv
;;
- *-highlevel)
+ *-highlevel)
os=-bsd
;;
*-encore)
os=-bsd
;;
- *-sgi)
+ *-sgi)
os=-irix
;;
- *-siemens)
+ *-siemens)
os=-sysv4
;;
*-masscomp)
Modified: trunk/configure.in
===================================================================
--- trunk/configure.in 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/configure.in 2003-09-03 01:05:18 UTC (rev 10)
@@ -36,11 +36,14 @@
esac
case "$host_cpu" in
+ ia64)
+ OCFS_PROCESSOR="ia64"
+ ;;
x86_64)
OCFS_PROCESSOR="x86_64"
;;
- i686)
- CFLAGS="-g -O2"
+ i386|i486|i586|i686|i786|k6|k7)
+ OCFS_PROCESSOR="i686"
;;
*)
AC_MSG_ERROR([not configured for "$host_cpu"])
@@ -161,6 +164,19 @@
fi
AC_SUBST(KVER)
+AC_MSG_CHECKING([for NPTL support])
+AC_TRY_COMPILE(
+[#define __KERNEL__ 1
+#include <linux/sched.h>],
+[recalc_sigpending ();], have_NPTL=yes, have_NPTL=no)
+AC_MSG_RESULT($have_NPTL)
+
+HAVE_NPTL=
+if test "x$have_NPTL" = "xyes"; then
+ HAVE_NPTL=yes
+fi
+AC_SUBST(HAVE_NPTL)
+
AC_MSG_CHECKING([for kernel module symbol versions])
AC_EGREP_CPP(kernel_has_modversions,
[#include <linux/autoconf.h>
Added: trunk/docs/2.5_PORT-TODO
===================================================================
--- trunk/docs/2.5_PORT-TODO 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/docs/2.5_PORT-TODO 2003-09-03 01:05:18 UTC (rev 10)
@@ -0,0 +1,5 @@
+* Remove usage of deprecated apis
+* fix ReadForceDisk, WriteForceDisk, and related functions to use bios
+* remove all 2.4 O_DIRECT stuff from the read/write functions
+* make ocfs_direct_IO_get_blocks into a generic get_blocks function
+* cleanup, use more macros for compatibility.
Modified: trunk/ocfs2/Common/inc/ocfs.h
===================================================================
--- trunk/ocfs2/Common/inc/ocfs.h 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Common/inc/ocfs.h 2003-09-03 01:05:18 UTC (rev 10)
@@ -30,8 +30,14 @@
/* XXX Hack to avoid warning */
struct mem_dqinfo;
extern inline void mark_info_dirty(struct mem_dqinfo *info);
-#ifndef x86_64
+#ifndef LINUX_2_5
+# ifdef __i386__
extern inline void prefetch(const void *x);
+# endif
+# ifdef __ia64__
+extern inline void prefetch(const void *x);
+extern inline void prefetchw(const void *x);
+# endif
#endif
/*
@@ -56,7 +62,11 @@
#include <linux/pagemap.h>
#include <linux/random.h>
#include <linux/string.h>
+#ifdef LINUX_2_5
+#include <linux/writeback.h>
+#else
#include <linux/locks.h>
+#endif
#include <linux/hdreg.h>
#include <linux/file.h>
#include <linux/raw.h>
@@ -67,8 +77,18 @@
#include <linux/net.h>
#include <net/sock.h>
#include <linux/ctype.h>
+#ifdef LINUX_2_5
+#include <linux/workqueue.h>
+#else
#include <linux/tqueue.h>
+#endif
#include <linux/inet.h>
+#ifdef LINUX_2_5
+#include <asm/statfs.h>
+#include <linux/blkdev.h>
+#include <linux/in.h>
+#include <linux/buffer_head.h>
+#endif
#include <ocfsbool.h>
Modified: trunk/ocfs2/Common/inc/ocfscom.h
===================================================================
--- trunk/ocfs2/Common/inc/ocfscom.h 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Common/inc/ocfscom.h 2003-09-03 01:05:18 UTC (rev 10)
@@ -29,6 +29,17 @@
#define OCFS_POINTER_SIZE (sizeof(void *))
+#ifdef __LP64__
+#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__
+#define OCFS_GCC_ATTR_PACKED
+#define OCFS_GCC_ATTR_ALIGNED
+#define OCFS_GCC_ATTR_PACKALGN
+#endif
+
typedef struct _ocfs_alloc_bm
{
void *buf;
@@ -66,12 +77,20 @@
#define OCFS_BREAKPOINT() printk("DEBUG BREAKPOINT! %s, %d\n", \
__FILE__, __LINE__)
+#ifdef LINUX_2_5
+#define OcfsQuerySystemTime(t) \
+ do { \
+ *t = (__u64)(CURRENT_TIME.tv_sec) * (__u64) 10000000; \
+ *t += (__u64)(CURRENT_TIME.tv_nsec) / (__u64) 100; \
+ } while (0)
+#else
/* time is in 0.1 microsecs */
#define OcfsQuerySystemTime(t) \
do { \
(*t) = (__u64)((__u64)CURRENT_TIME * (__u64)10000000); \
(*t) += (__u64)((__u64)xtime.tv_usec * (__u64)10); \
} while (0)
+#endif
#ifdef __KERNEL__
#define ocfs_getpid() current->pid
Modified: trunk/ocfs2/Common/inc/ocfsdef.h
===================================================================
--- trunk/ocfs2/Common/inc/ocfsdef.h 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Common/inc/ocfsdef.h 2003-09-03 01:05:18 UTC (rev 10)
@@ -27,15 +27,6 @@
#ifndef _OCFSDEF_H_
#define _OCFSDEF_H_
-#define UPDATE_OIN(a) \
-do { \
- int __status; \
- (a)->needs_verification = true; \
- __status = ocfs_verify_update_oin((a)->osb, (a)); \
- if (__status < 0) \
- LOG_ERROR_STATUS (__status); \
-} while (0)
-
#define OIN_NEEDS_VERIFICATION(a) ((a)->needs_verification)
#define OIN_UPDATED(a) ((a)->needs_verification = false)
@@ -342,6 +333,7 @@
__u8 *log_prealloc;
struct semaphore publish_lock; /* protects r/w to publish sector */
atomic_t node_req_vote; /* set when node's vote req pending */
+ struct semaphore trans_lock; /* serializes transactions */
bool publish_dirty;
__u32 in_voting;
ocfs_sem voting_lock;
Modified: trunk/ocfs2/Common/inc/ocfsdisk.h
===================================================================
--- trunk/ocfs2/Common/inc/ocfsdisk.h 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Common/inc/ocfsdisk.h 2003-09-03 01:05:18 UTC (rev 10)
@@ -3,7 +3,7 @@
*
* Defines disk-based structures
*
- * Copyright (C) 2002 Oracle Corporation. All rights reserved.
+ * Copyright (C) 2002, 2003 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.
@@ -33,7 +33,7 @@
__u64 file_off; // DISKPTR
/* Number of bytes used by this alloc */
/* WARNING!: should never be greater than LONG_MAX! */
- __u64 num_bytes; // NUMBER RANGE(0,LONG_MAX)
+ __u64 num_bytes; // NUMBER RANGE(0,ULONG_LONG_MAX)
/* Physical Disk Offset */
__u64 disk_off; // DISKPTR
}
@@ -41,7 +41,7 @@
typedef struct _ocfs_publish // CLASS
{
- __u64 time; // DATE
+ __u64 time; // NUMBER RANGE(0,ULONG_LONG_MAX)
__s32 vote; // BOOL
bool dirty; // BOOL
__u32 vote_type; // FILEFLAG
@@ -52,6 +52,7 @@
/* last seq num used in comm voting */
__u64 comm_seq_num; // NUMBER RANGE(0,ULONG_LONG_MAX)
}
+OCFS_GCC_ATTR_PACKALGN
ocfs_publish; // END CLASS
typedef struct _ocfs_vote // CLASS
@@ -61,6 +62,7 @@
__u64 dir_ent; // NUMBER RANGE(0,ULONG_LONG_MAX)
__u8 open_handle; // BOOL
}
+OCFS_GCC_ATTR_PACKALGN
ocfs_vote; // END CLASS
typedef struct _ocfs_file_entry // CLASS
@@ -91,6 +93,9 @@
__u32 gid; // GID
__u16 dev_major; // NUMBER RANGE(0,65535)
__u16 dev_minor; // NUMBER RANGE(0,65535)
+ /* 32-bit: sizeof(fe) = 484 bytes */
+ /* 64-bit: sizeof(fe) = 488 bytes */
+ /* Need to account for that fact when the struct is extended. */
}
ocfs_file_entry; // END CLASS
@@ -102,6 +107,7 @@
__u8 name_len;
__u8 name[1];
}
+OCFS_GCC_ATTR_PACKALGN
ocfs_index_node;
typedef struct _ocfs_index_hdr
@@ -111,7 +117,7 @@
__s64 up_tree_ptr; /* Pointer to parent of this dnode */
__u64 node_disk_off;
__u8 state; /* In recovery, needs recovery etc */
- __u64 down_ptr;
+ __u64 down_ptr OCFS_GCC_ATTR_ALIGNED;
__u8 num_ents;; /* Number of extents in this Node */
__u8 depth; /* Depth of this Node from root of the btree */
__u8 num_ent_used; /* Num of entries in the dir blk used up. */
@@ -121,6 +127,7 @@
__u8 reserved[161];
__u8 file_ent[1]; /* 63 entries here with 32K DIR_NODE size */
}
+OCFS_GCC_ATTR_PACKED
ocfs_index_hdr;
/* not sizeof-safe across platforms */
@@ -142,14 +149,14 @@
__u8 depth; // UNUSED
__u8 num_ent_used; // NUMBER RANGE(0,254)
__u8 dir_node_flags; // DIRFLAG
- __u8 sync_flags; // SYNCFLAG
+ __u8 sync_flags; // NUMBER RANGE(0,0)
__u8 index[256]; // DIRINDEX
- __u8 index_dirty; // BOOL
+ __u8 index_dirty; // NUMBER RANGE(0,1)
__u8 bad_off; // NUMBER RANGE(0,254)
- __u64 num_tot_files; // NUMBER RANGE(0,ULONG_LONG_MAX)
- __u8 reserved[119]; // UNUSED
+ __u8 reserved[127]; // UNUSED
__u8 file_ent[1]; // UNUSED
}
+OCFS_GCC_ATTR_PACKALGN
ocfs_dir_node; // END CLASS
typedef struct _ocfs_vol_node_map
@@ -203,15 +210,15 @@
{
__u8 signature[8]; // CHAR ARRAY[8]
/* 0 when init, -1 when full */
- __s32 next_free_ext; // NUMBER RANGE(-1,LONG_MAX)
+ __s32 next_free_ext; // NUMBER RANGE(-1,INT_MAX)
/* Currently available sector for use */
- __u32 curr_sect; // NUMBER RANGE(0,ULONG_MAX)
+ __u32 curr_sect; // NUMBER RANGE(0,UINT_MAX)
/* Maximum Number of Sectors */
- __u32 max_sects; // NUMBER RANGE(0,ULONG_MAX)
+ __u32 max_sects; // NUMBER RANGE(0,UINT_MAX)
/* Type of this sector... either */
__u32 type; // EXTENTTYPE
/* Number of leaf levels */
- __s32 granularity; // NUMBER RANGE(-1,LONG_MAX)
+ __s32 granularity; // NUMBER RANGE(-1,INT_MAX)
__u32 alloc_node; // NODENUM
__u64 this_ext; // DISKPTR
__u64 next_data_ext; // DISKPTR
@@ -227,5 +234,6 @@
ocfs_disk_lock disk_lock;
__u32 used_bits;
}
+OCFS_GCC_ATTR_PACKALGN
ocfs_bitmap_lock;
#endif /*_OCFSDISK_H_ */
Modified: trunk/ocfs2/Common/inc/ocfsdlm.h
===================================================================
--- trunk/ocfs2/Common/inc/ocfsdlm.h 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Common/inc/ocfsdlm.h 2003-09-03 01:05:18 UTC (rev 10)
@@ -38,7 +38,9 @@
__u32 flags;
__u64 lock_seq_num;
__u8 open_handle;
-} ocfs_dlm_msg_hdr;
+}
+OCFS_GCC_ATTR_PACKALGN
+ocfs_dlm_msg_hdr;
typedef ocfs_dlm_msg_hdr ocfs_dlm_req_master;
typedef ocfs_dlm_msg_hdr ocfs_dlm_disk_vote_req;
@@ -75,7 +77,11 @@
__s32 msg_len;
__u8 msg[OCFS_MAX_DLM_PKT_SIZE];
int status;
+#ifdef LINUX_2_5
+ struct work_struct ipc_wq;
+#else
struct tq_struct ipc_tq;
+#endif
}
ocfs_recv_ctxt;
Modified: trunk/ocfs2/Common/inc/ocfsgenalloc.h
===================================================================
--- trunk/ocfs2/Common/inc/ocfsgenalloc.h 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Common/inc/ocfsgenalloc.h 2003-09-03 01:05:18 UTC (rev 10)
@@ -56,8 +56,14 @@
int ocfs_kill_this_tree(ocfs_super *osb, ocfs_extent_group *extent_grp,
ocfs_cleanup_record *CleanupLogRec);
+#ifdef LINUX_2_5
int ocfs_lookup_file_allocation (ocfs_super * osb, ocfs_inode * oin,
+ __s64 Vbo, __s64 * Lbo, __u32 sectors,
+ u32 *sector_count);
+#else
+int ocfs_lookup_file_allocation (ocfs_super * osb, ocfs_inode * oin,
__s64 Vbo, __s64 * Lbo, __u32 sectors);
+#endif
#ifndef USERSPACE_TOOL
Modified: trunk/ocfs2/Common/inc/ocfsgendlm.h
===================================================================
--- trunk/ocfs2/Common/inc/ocfsgendlm.h 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Common/inc/ocfsgendlm.h 2003-09-03 01:05:18 UTC (rev 10)
@@ -33,6 +33,7 @@
__u64 log_disk_off;
__u64 actual_disk_off;
}
+OCFS_GCC_ATTR_PACKALGN
ocfs_offset_map;
int ocfs_insert_cache_link (ocfs_super * osb, ocfs_lock_res * lockres);
Modified: trunk/ocfs2/Common/inc/ocfsgenvolcfg.h
===================================================================
--- trunk/ocfs2/Common/inc/ocfsgenvolcfg.h 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Common/inc/ocfsgenvolcfg.h 2003-09-03 01:05:18 UTC (rev 10)
@@ -29,7 +29,11 @@
typedef struct _ocfs_cfg_task
{
+#ifdef LINUX_2_5
+ struct work_struct cfg_wq;
+#else
struct tq_struct cfg_tq;
+#endif
ocfs_super *osb;
__u64 lock_off;
__u8 *buffer;
Modified: trunk/ocfs2/Common/inc/ocfstrace.h
===================================================================
--- trunk/ocfs2/Common/inc/ocfstrace.h 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Common/inc/ocfstrace.h 2003-09-03 01:05:18 UTC (rev 10)
@@ -82,7 +82,10 @@
#define OCFS_DEBUG_CONTEXT_IOSUP 0x40000000 /* ocfsiosup.c */
-#define GET_STACK(s) \
+#ifdef __ia64__
+# define GET_STACK(s)
+#else
+# define GET_STACK(s) \
IF_LEVEL(OCFS_DEBUG_LEVEL_STACK) { \
__s32 esp; \
__asm__ __volatile__("andl %%esp,%0" : "=r" (esp) : \
@@ -90,14 +93,19 @@
esp -= sizeof(struct task_struct); \
sprintf((s), "[%ld] ", esp); \
}
+#endif
/* privately used macros */
-# define IF_LEVEL(level) \
+#define IF_LEVEL(level) \
if ((debug_context & OCFS_DEBUG_CONTEXT) && (debug_level & level) && \
ocfs_getpid()!=debug_exclude)
-
+
+#ifdef __ia64__
# define GET_TIMING(s, hi, lo) \
+ do { _HI = _LO = 0; } while (0)
+#else
+# define GET_TIMING(s, hi, lo) \
do { \
IF_LEVEL(OCFS_DEBUG_LEVEL_TIMING) { \
__u32 _lo, _hi; \
@@ -114,6 +122,7 @@
} \
} \
} while (0)
+#endif
/* IF macro */
#define IF_TRACE(func) \
Modified: trunk/ocfs2/Common/inc/ocfsvol.h
===================================================================
--- trunk/ocfs2/Common/inc/ocfsvol.h 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Common/inc/ocfsvol.h 2003-09-03 01:05:18 UTC (rev 10)
@@ -3,7 +3,7 @@
*
* On-disk structures. See format.h for disk layout.
*
- * Copyright (C) 2002 Oracle Corporation. All rights reserved.
+ * Copyright (C) 2002, 2003 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.
@@ -95,8 +95,8 @@
{
__u32 curr_master; // NODENUM
__u8 file_lock; // LOCKLEVEL
- __u64 last_write_time; // DATE
- __u64 last_read_time; // DATE
+ __u64 last_write_time; // NUMBER RANGE(0,ULONG_LONG_MAX)
+ __u64 last_read_time; // NUMBER RANGE(0,ULONG_LONG_MAX)
__u32 writer_node_num; // NODENUM
__u32 reader_node_num; // NODENUM
__u64 oin_node_map; // NODEBITMAP
@@ -122,7 +122,7 @@
ocfs_disk_lock disk_lock; // DISKLOCK
__u8 label[MAX_VOL_LABEL_LEN]; // CHAR[MAX_VOL_LABEL_LEN]
__u16 label_len; // NUMBER RANGE(0,MAX_VOL_LABEL_LEN)
- __u8 vol_id[MAX_VOL_ID_LENGTH]; // CHAR[MAX_VOL_ID_LENGTH]
+ __u8 vol_id[MAX_VOL_ID_LENGTH]; // HEX[MAX_VOL_ID_LENGTH]
__u16 vol_id_len; // NUMBER RANGE(0,MAX_VOL_ID_LENGTH)
__u8 cluster_name[MAX_CLUSTER_NAME_LEN]; // CHAR[MAX_CLUSTER_NAME_LEN]
__u16 cluster_name_len; // NUMBER RANGE(0,MAX_CLUSTER_NAME_LEN)
@@ -182,6 +182,7 @@
__u32 last_node; // NUMBER RANGE(0,32)
__u64 cfg_seq_num; // NUMBER RANGE(0,ULONG_LONG_MAX)
}
+OCFS_GCC_ATTR_PACKALGN
ocfs_node_config_hdr; // END CLASS
/*
Modified: trunk/ocfs2/Common/ocfsgenalloc.c
===================================================================
--- trunk/ocfs2/Common/ocfsgenalloc.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Common/ocfsgenalloc.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -2054,8 +2054,13 @@
* decoded and updated in the extent map.
*
*/
+#ifdef LINUX_2_5
int ocfs_lookup_file_allocation (ocfs_super * osb, ocfs_inode * oin, __s64 Vbo,
+ __s64 * Lbo, __u32 sectors, u32 *sector_count)
+#else
+int ocfs_lookup_file_allocation (ocfs_super * osb, ocfs_inode * oin, __s64 Vbo,
__s64 * Lbo, __u32 sectors)
+#endif
{
int status = -EFAIL;
ocfs_file_entry *FileEntry = NULL;
@@ -2170,6 +2175,11 @@
} else
status = -EFAIL;
+#ifdef LINUX_2_5
+ /* want to return cnt only if asked for it */
+ if (sector_count)
+ *sector_count = (u32) cnt;
+#endif
finally:
ocfs_safefree (buffer);
Modified: trunk/ocfs2/Common/ocfsgencreate.c
===================================================================
--- trunk/ocfs2/Common/ocfsgencreate.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Common/ocfsgencreate.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -122,9 +122,15 @@
inode->i_gid = fe->gid;
inode->i_mode = fe->prot_bits;
inode->i_blksize = (__u32) osb->vol_layout.cluster_size;
+#ifdef LINUX_2_5
+ inode->i_ctime.tv_sec = fe->create_time;
+ inode->i_atime.tv_sec = fe->modify_time;
+ inode->i_mtime.tv_sec = fe->modify_time;
+#else
inode->i_ctime = fe->create_time;
inode->i_atime = fe->modify_time;
inode->i_mtime = fe->modify_time;
+#endif
if (!S_ISDIR (inode->i_mode)) {
truncate_inode_pages (inode->i_mapping, 0);
@@ -146,8 +152,11 @@
case OCFS_ATTRIB_FIFO:
case OCFS_ATTRIB_SOCKET:
{
+#ifdef LINUX_2_5
+ dev_t dev;
+#else
kdev_t kdev;
-
+#endif
if (fe->attribs == OCFS_ATTRIB_CHAR)
inode->i_mode |= S_IFCHR;
else if (fe->attribs == OCFS_ATTRIB_BLOCK)
@@ -158,9 +167,19 @@
inode->i_mode |= S_IFSOCK;
inode->i_rdev = NODEV;
+#ifdef LINUX_2_5
+ dev = MKDEV (fe->dev_major, fe->dev_minor);
+#else
kdev = MKDEV (fe->dev_major, fe->dev_minor);
+#endif
+
+#ifdef LINUX_2_5
init_special_inode (inode, inode->i_mode,
- kdev_t_to_nr (kdev));
+ dev);
+#else
+ init_special_inode (inode, inode->i_mode,
+ kdev_t_to_nr(kdev));
+#endif
break;
}
default:
@@ -361,10 +380,10 @@
}
#endif
- LOG_TRACE_ARGS ("byte offset=%u\n", ByteOffset);
-
ocfs_set_bits (&osb->cluster_bitmap, ByteOffset, ClusterCount);
+ LOG_TRACE_ARGS("gb_s: bit=%d, len=%d\n", ByteOffset, ClusterCount);
+
startOffset = osb->vol_layout.bitmap_off;
status = ocfs_write_force_disk (osb, osb->cluster_bitmap.buf, size, startOffset);
@@ -716,7 +735,6 @@
dir_node->first_del = INVALID_DIR_NODE_INDEX;
dir_node->index_dirty = 0;
- dir_node->num_tot_files = 0;
// dir_node->alt_dir_node_offset = 0; // TODO: figure out if we need these
LOG_EXIT ();
@@ -1248,8 +1266,11 @@
SET_VALID_BIT (fileEntry->sync_flags);
fileEntry->sync_flags &= ~(OCFS_SYNC_FLAG_CHANGE);
+#ifdef LINUX_2_5
+ fileEntry->modify_time = CURRENT_TIME.tv_sec;
+#else
fileEntry->modify_time = CURRENT_TIME;
-
+#endif
tempOffset = fileEntry->this_sector;
size = (__u32) OCFS_ALIGN (sizeof (ocfs_file_entry), osb->sect_size);
@@ -1372,8 +1393,11 @@
dirOffset = fileEntry->this_sector;
+#ifdef LINUX_2_5
+ fileEntry->modify_time = CURRENT_TIME.tv_sec;
+#else
fileEntry->modify_time = CURRENT_TIME;
-
+#endif
size = (__u32) OCFS_SECTOR_ALIGN (sizeof (ocfs_file_entry));
status =
ocfs_write_file_entry (osb, (ocfs_file_entry *) fileEntry, dirOffset);
@@ -1750,8 +1774,12 @@
DISK_LOCK_LAST_WRITE(newfe) = t;
DISK_LOCK_LAST_READ(newfe) = t;
+#ifdef LINUX_2_5
+
+ newfe->create_time = newfe->modify_time = CURRENT_TIME.tv_sec;
+#else
newfe->create_time = newfe->modify_time = CURRENT_TIME;
-
+#endif
status = ocfs_create_directory (osb, parent_off, newfe);
if (status >= 0)
*file_off = newfe->this_sector;
@@ -1799,7 +1827,11 @@
DISK_LOCK_LAST_WRITE(newfe) = t;
DISK_LOCK_LAST_READ(newfe) = t;
+#ifdef LINUX_2_5
+ newfe->create_time = newfe->modify_time = CURRENT_TIME.tv_sec;
+#else
newfe->create_time = newfe->modify_time = CURRENT_TIME;
+#endif
status = ocfs_create_file (osb, parent_off, newfe);
if (status >= 0)
Modified: trunk/ocfs2/Common/ocfsgendirnode.c
===================================================================
--- trunk/ocfs2/Common/ocfsgendirnode.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Common/ocfsgendirnode.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -458,6 +458,9 @@
ocfs_clear_bits (pTempBitMap, (__u32) foundBit,
(__u32) FreeLog->free_bitmap[i].length);
+
+ LOG_TRACE_ARGS("gb_c: bit=%d, len=%u, i=%d\n", foundBit,
+ (__u32)FreeLog->free_bitmap[i].length, i);
}
/* Write a cleanup log here */
@@ -1448,11 +1451,6 @@
}
}
- if(LockNode->node_disk_off != PDirNode->node_disk_off)
- LockNode->num_tot_files--;
- else
- PDirNode->num_tot_files--;
-
status = ocfs_write_dir_node (osb, PDirNode, offset);
if (status < 0) {
LOG_ERROR_STATUS (status);
@@ -1606,11 +1604,6 @@
DISK_LOCK_FILE_LOCK (LockNode) = OCFS_DLM_NO_LOCK;
}
- if (LockNode->node_disk_off == DirNode->node_disk_off)
- DirNode->num_tot_files++;
- else
- LockNode->num_tot_files++;
-
ocfs_write_dir_node (osb, DirNode, indexOffset);
if (LockNode->node_disk_off != DirNode->node_disk_off) {
Modified: trunk/ocfs2/Common/ocfsgenmisc.c
===================================================================
--- trunk/ocfs2/Common/ocfsgenmisc.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Common/ocfsgenmisc.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -557,7 +557,7 @@
osb->obj_id.type = OCFS_TYPE_OSB;
osb->obj_id.size = sizeof (ocfs_super);
-#ifdef x86_64
+#ifdef __LP64__
#define HASHBITS 11
#else
#define HASHBITS 12
@@ -577,7 +577,8 @@
#endif
ocfs_init_sem (&(osb->vol_alloc_lock));
- init_MUTEX (&(osb->comm_lock));
+ init_MUTEX (&(osb->comm_lock));
+ init_MUTEX (&(osb->trans_lock));
osb->node_recovering = OCFS_INVALID_NODE_NUM;
Modified: trunk/ocfs2/Common/ocfsgennm.c
===================================================================
--- trunk/ocfs2/Common/ocfsgennm.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Common/ocfsgennm.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -236,11 +236,13 @@
ocfs_lock_res ** lockres)
{
int status = 0;
+ int tmpstat = 0;
__u32 flags = 0;
__u32 retry_cnt = 0;
bool acq_oin = false;
ocfs_file_entry *fe = NULL;
bool rls_oin = true;
+ ocfs_inode *oin = NULL;
ocfs_sem *oin_sem = NULL;
LOG_ENTRY_ARGS ("(0x%08x, 0x%08x, %u, 0x%08x, 0x%08x)\n", osb, publish,
@@ -250,8 +252,14 @@
ocfs_acquire_lockres (*lockres);
- if ((*lockres)->oin) {
- UPDATE_OIN ((*lockres)->oin);
+ oin = (*lockres)->oin;
+ if (oin) {
+ ocfs_down_sem (&oin->main_res, true);
+ oin->needs_verification = true;
+ tmpstat = ocfs_verify_update_oin(osb, oin);
+ if (tmpstat < 0)
+ LOG_ERROR_STATUS (tmpstat);
+ ocfs_up_sem (&oin->main_res);
}
/* NOTE: NT flushes the inode pages here with MmFlushForDelete... */
@@ -260,11 +268,7 @@
HILO (publish->dir_ent), HILO (publish->publ_seq_num));
/* Check for oin */
- if ((*lockres)->oin != NULL) {
- ocfs_inode *oin;
-
- oin = (*lockres)->oin;
-
+ if (oin) {
oin_sem = &(oin->main_res);
ocfs_down_sem (oin_sem, true);
acq_oin = true;
@@ -431,9 +435,13 @@
if (status >= 0) {
args.offset = fe->this_sector;
args.entry = fe;
+#ifdef LINUX_2_5
+ inode = ocfs_iget(osb->sb, &args);
+#else
inode = iget4 (osb->sb, (__u32) LO (fileoff),
(find_inode_t) ocfs_find_inode,
(void *) (&args));
+#endif
if (inode != NULL && is_bad_inode (inode)) {
iput (inode);
inode = NULL;
@@ -497,6 +505,7 @@
int ocfs_process_vote (ocfs_super * osb, ocfs_publish * publish, __u32 node_num)
{
int status = 0;
+ int tmpstat = 0;
ocfs_lock_res *lockres = NULL;
__u32 flags;
__u32 num_nodes;
@@ -642,9 +651,12 @@
if (lockres->oin != NULL) {
oin = lockres->oin;
ocfs_down_sem (&(oin->main_res), true);
- UPDATE_OIN (lockres->oin);
+ oin->needs_verification = true;
+ tmpstat = ocfs_verify_update_oin(osb, oin);
+ if (tmpstat < 0)
+ LOG_ERROR_STATUS (tmpstat);
ocfs_up_sem (&(oin->main_res));
-
+
vote->dir_ent = publish->dir_ent;
vote->vote_seq_num = publish->publ_seq_num;
vote->vote[node_num] = FLAG_VOTE_OIN_UPDATED;
Modified: trunk/ocfs2/Common/ocfsgensysfile.c
===================================================================
--- trunk/ocfs2/Common/ocfsgensysfile.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Common/ocfsgensysfile.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -28,6 +28,7 @@
#include <ocfs.h>
#else
#include <dummy.h>
+#include <ocfsmalloc.h>
#endif
/* Tracing */
@@ -421,13 +422,13 @@
LOG_ENTRY_ARGS ("(FileId = %u, Size = %u.%u)\n", FileId, HI (FileSize),
LO (FileSize));
+ OCFS_ASSERT (osb);
+
if ((FileId == (OCFS_FILE_VOL_LOG_FILE + osb->node_num)) ||
(FileId == (OCFS_FILE_VOL_META_DATA + osb->node_num))) {
bWriteThru = true;
}
- OCFS_ASSERT (osb);
-
if (!fe) {
local_fe = true;
status = ocfs_force_get_file_entry (osb, &fe,
Modified: trunk/ocfs2/Common/ocfsgentrans.c
===================================================================
--- trunk/ocfs2/Common/ocfsgentrans.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Common/ocfsgentrans.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -711,6 +711,8 @@
{
LOG_ENTRY_ARGS ("(0x%08x)\n", osb);
+ down (&osb->trans_lock);
+
osb->curr_trans_id = osb->vol_node_map.largest_seq_num;
if (osb->needs_flush) {
@@ -724,7 +726,6 @@
}
osb->trans_in_progress = true;
- LOG_TRACE_STR ("tip=true");
LOG_EXIT_STATUS (0);
return 0;
@@ -771,7 +772,7 @@
finally:
osb->trans_in_progress = false;
- LOG_TRACE_STR ("tip=false");
+ up (&osb->trans_lock);
LOG_EXIT_STATUS (status);
return status;
@@ -818,7 +819,7 @@
finally:
osb->trans_in_progress = false;
- LOG_TRACE_STR ("tip=false");
+ up (&osb->trans_lock);
LOG_EXIT_STATUS (status);
return status;
@@ -885,13 +886,13 @@
__u64 file_size = 0;
__u64 alloc_size = 0;
ocfs_lock_res *lock_res = NULL;
- ocfs_log_record *log_rec = NULL;
- __u32 size;
__u32 log_type;
__u64 trans_id = 0;
__u64 cleanup_file_size = 0;
__u32 file_id;
ocfs_file_entry *fe = NULL;
+ /* ocfs_log_record *log_rec = NULL; */
+ /* __u32 size; */
LOG_ENTRY_ARGS ("(0x%08x, %u.%u)\n", osb, HI (node_num), LO (node_num));
@@ -971,6 +972,7 @@
lock_acq = true;
+#if 0
if (node_num != osb->node_num) {
/*
** Write a log entry indicating this node is doing recovery
@@ -1001,10 +1003,11 @@
goto finally;
}
}
+#endif
log_type = LOG_RECOVER;
- status = ocfs_process_log (osb, trans_id, osb->node_num, &log_type);
+ status = ocfs_process_log (osb, trans_id, node_num, &log_type);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
@@ -1015,7 +1018,7 @@
** if we aborted the transaction otherwise process the cleanup file....
*/
if (log_type == LOG_CLEANUP) {
- status = ocfs_process_log (osb, trans_id, osb->node_num,
+ status = ocfs_process_log (osb, trans_id, node_num,
&log_type);
if (status < 0) {
LOG_ERROR_STATUS (status);
Modified: trunk/ocfs2/Common/ocfsgenvolcfg.c
===================================================================
--- trunk/ocfs2/Common/ocfsgenvolcfg.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Common/ocfsgenvolcfg.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -88,10 +88,18 @@
cfg_task = (ocfs_cfg_task *) arg;
/* initialize the task */
+#ifdef LINUX_2_5
+ INIT_WORK (&(cfg_task->cfg_wq), ocfs_worker, cfg_task);
+#else
INIT_TQUEUE (&(cfg_task->cfg_tq), ocfs_worker, cfg_task);
+#endif
/* submit it */
+#ifdef LINUX_2_5
+ schedule_work (&cfg_task->cfg_wq);
+#else
schedule_task (&cfg_task->cfg_tq);
+#endif
LOG_EXIT ();
return ;
Modified: trunk/ocfs2/Common/ocfsgenvote.c
===================================================================
--- trunk/ocfs2/Common/ocfsgenvote.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Common/ocfsgenvote.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -83,12 +83,14 @@
ocfs_dlm_msg * dlm_msg)
{
int status = 0;
+ int tmpstat = 0;
ocfs_dlm_req_master *req_master;
__u32 node_num;
__u32 flags;
__u32 retry_cnt = 0;
bool acq_oin = false;
ocfs_file_entry *fe = NULL;
+ ocfs_inode *oin = NULL;
ocfs_sem *oin_sem = NULL;
struct dentry *dentry;
struct list_head *iter;
@@ -103,20 +105,21 @@
flags = req_master->flags;
node_num = dlm_msg->src_node;
- if ((*lockres)->oin) {
- UPDATE_OIN ((*lockres)->oin);
+ oin = (*lockres)->oin;
+ if (oin) {
+ ocfs_down_sem (&oin->main_res, true);
+ oin->needs_verification = true;
+ tmpstat = ocfs_verify_update_oin(osb, oin);
+ if (tmpstat < 0)
+ LOG_ERROR_STATUS (tmpstat);
+ ocfs_up_sem (&oin->main_res);
}
LOG_TRACE_ARGS ("node=%u, lockid=%u.%u, seq=%u.%u\n", node_num,
- HI (req_master->lock_id), LO (req_master->lock_id),
- HI (req_master->lock_seq_num), LO (req_master->lock_seq_num));
+ HILO (req_master->lock_id), HILO (req_master->lock_seq_num));
/* Check for oin */
- if ((*lockres)->oin != NULL) {
- ocfs_inode *oin;
-
- oin = (*lockres)->oin;
-
+ if (oin) {
oin_sem = &(oin->main_res);
ocfs_down_sem (oin_sem, true);
acq_oin = true;
@@ -367,6 +370,7 @@
int ocfs_comm_process_vote (ocfs_super * osb, ocfs_dlm_msg * dlm_msg)
{
int status = 0;
+ int tmpstat = 0;
ocfs_lock_res *lockres = NULL;
ocfs_dlm_req_master *req_master;
__u32 node_num = OCFS_INVALID_NODE_NUM;
@@ -486,7 +490,10 @@
if (lockres->oin != NULL) {
oin = lockres->oin;
ocfs_down_sem (&(oin->main_res), true);
- UPDATE_OIN (lockres->oin);
+ oin->needs_verification = true;
+ tmpstat = ocfs_verify_update_oin(osb, oin);
+ if (tmpstat < 0)
+ LOG_ERROR_STATUS (tmpstat);
ocfs_up_sem (&(oin->main_res));
} else {
status = ocfs_process_update_inode_request (osb,
Modified: trunk/ocfs2/Common/ocfsheartbeat.c
===================================================================
--- trunk/ocfs2/Common/ocfsheartbeat.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Common/ocfsheartbeat.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -146,7 +146,7 @@
if (osb->osb_flags & OCFS_OSB_FLAGS_BEING_DISMOUNTED)
goto finally;
- if (!time_after (jiffies, osb->hbt))
+ if (!time_after (jiffies, (unsigned long) (osb->hbt)))
goto finally;
if (osb->vol_state == VOLUME_MOUNTED) {
@@ -357,8 +357,10 @@
(node_map->miss_cnt[i])++;
if (node_map->miss_cnt[i] > MISS_COUNT_VALUE) {
#if !defined(USERSPACE_TOOL)
- printk ("ocfs: Removing node %d from "
- "cluster\n", i);
+ printk ("ocfs: Removing device (%u,%u) in "
+ "node %d from cluster\n",
+ MAJOR(osb->sb->s_dev),
+ MINOR(osb->sb->s_dev), i);
#endif
UPDATE_PUBLISH_MAP (osb->publ_map, i,
OCFS_PUBLISH_CLEAR, num_nodes);
@@ -366,8 +368,11 @@
}
} else {
#if !defined(USERSPACE_TOOL)
- if (!IS_NODE_ALIVE(osb->publ_map, i, num_nodes))
- printk ("ocfs: Adding node %d to cluster\n", i);
+ if (!IS_NODE_ALIVE(osb->publ_map, i, num_nodes) &&
+ osb->node_num != i)
+ printk ("ocfs: Adding device (%u,%u) in node %d to "
+ "cluster\n", MAJOR(osb->sb->s_dev),
+ MINOR(osb->sb->s_dev), i);
#endif
node_map->miss_cnt[i] = 0;
node_map->time[i] = publish->time;
Modified: trunk/ocfs2/Common/ocfsver.c
===================================================================
--- trunk/ocfs2/Common/ocfsver.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Common/ocfsver.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -1,7 +1,29 @@
-#include <linux/kernel.h>
+/*
+ * ocfsver.c
+ *
+ * prints the version string
+ *
+ * Copyright (C) 2003 Oracle Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ *
+ * Authors: Kurt Hackel, Sunil Mushran, Manish Singh, Wim Coekaerts
+ */
-#include <ocfsver.h>
-#include <linux/module.h>
+#include <ocfs.h>
MODULE_DESCRIPTION("The Oracle Cluster Filesystem (version "
OCFS_BUILD_VERSION
@@ -9,10 +31,14 @@
char *ocfs_version = OCFS_BUILD_VERSION;
+/*
+ * ocfs_version_print()
+ *
+ */
void ocfs_version_print (void)
{
printk(KERN_INFO "Oracle Cluster FileSystem "
OCFS_BUILD_VERSION " "
OCFS_BUILD_DATE " "
"(build " OCFS_BUILD_MD5 ")\n");
-}
+} /* ocfs_version_print */
Modified: trunk/ocfs2/Linux/inc/ocfsmain.h
===================================================================
--- trunk/ocfs2/Linux/inc/ocfsmain.h 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Linux/inc/ocfsmain.h 2003-09-03 01:05:18 UTC (rev 10)
@@ -30,16 +30,34 @@
/* Module versioning */
#define LinuxVersionCode(v, p, s) (((v)<<16)+((p)<<8)+(s))
+#if LINUX_VERSION_CODE >= LinuxVersionCode(2,5,0)
+
+#ifndef LINUX_2_5
+#define LINUX_2_5
+#endif
+
+#endif
+
int ocfs_find_inode (struct inode *inode, unsigned long ino, void *opaque);
int ocfs_extend_allocation(ocfs_super *osb, ocfs_inode *oin, __u64 newsize, bool unlock);
+#ifdef LINUX_2_5
int ocfs_symlink_get_block (struct inode *inode,
- long iblock, struct buffer_head *bh_result, int create);
+ sector_t iblock, struct buffer_head *bh_result, int create);
int ocfs_get_block (struct inode *inode,
+ sector_t iblock, struct buffer_head *bh_result, int create);
+
+#else
+int ocfs_symlink_get_block (struct inode *inode,
long iblock, struct buffer_head *bh_result, int create);
+int ocfs_get_block (struct inode *inode,
+ long iblock, struct buffer_head *bh_result, int create);
+#endif
+
+
void ocfs_release_cached_oin (ocfs_super * osb, ocfs_inode * oin);
@@ -54,11 +72,26 @@
}
ocfs_find_inode_args;
+#if LINUX_2_5
+/* No longer exists in 2.5 */
+#define fsync_inode_buffers(inode) sync_mapping_buffers(inode->i_mapping)
+#define getblk(dev, blk, sz) __getblk(dev, blk, sz)
+#define MOD_INC_USE_COUNT do { } while(0)
+#define MOD_DEC_USE_COUNT do { } while(0)
+
+int ocfs_find_actor (struct inode *inode, void *opaque);
+int ocfs_init_locked_inode(struct inode * inode, void * opaque);
+struct inode * ocfs_iget(struct super_block *sb, ocfs_find_inode_args *args);
+#endif /* LINUX_2_5 */
+
#ifdef OCFSMAIN_PRIVATE_DECLS
static int ocfs_parse_options (char *options, __u32 * uid, __u32 * gid,
bool * cache, bool * reclaim_id);
+
+#ifndef LINUX_2_5
static struct super_block *ocfs_read_super (struct super_block *sb, void *data,
int silent);
+#endif
static int __init ocfs_driver_entry (void);
static void __exit ocfs_driver_exit (void);
@@ -71,9 +104,13 @@
static void ocfs_populate_inode (struct inode *inode, ocfs_file_entry *fe,
umode_t mode, void *genptr);
+#ifdef LINUX_2_5
+static void ocfs_read_locked_inode (struct inode *inode, ocfs_file_entry *entry);
+#else
static void ocfs_read_inode2 (struct inode *inode, void *opaque);
static void ocfs_read_inode (struct inode *inode);
+#endif
static struct dentry *ocfs_lookup (struct inode *dir, struct dentry *dentry);
@@ -86,7 +123,11 @@
static int ocfs_readpage (struct file *file, struct page *page);
+#ifdef LINUX_2_5
+static int ocfs_writepage (struct page *page, struct writeback_control *wbc);
+#else
static int ocfs_writepage (struct page *page);
+#endif
static int ocfs_prepare_write (struct file *file,
struct page *page, unsigned from, unsigned to);
@@ -94,14 +135,25 @@
static int ocfs_commit_write (struct file *file,
struct page *page, unsigned from, unsigned to);
+#ifdef LINUX_2_5
static int ocfs_create_or_open_file (struct inode *inode,
struct inode *dir,
struct dentry *dentry,
+ int mode, ocfs_file ** newofile, kdev_t dev);
+#else
+static int ocfs_create_or_open_file (struct inode *inode,
+ struct inode *dir,
+ struct dentry *dentry,
int mode, ocfs_file ** newofile, int dev);
+#endif
static int ocfs_file_open (struct inode *inode, struct file *file);
+#ifdef LINUX_2_5
+static int ocfs_mknod (struct inode *dir, struct dentry *dentry, int mode, dev_t dev);
+#else
static int ocfs_mknod (struct inode *dir, struct dentry *dentry, int mode, int dev);
+#endif
static int ocfs_mkdir (struct inode *dir, struct dentry *dentry, int mode);
@@ -137,7 +189,12 @@
static int ocfs_setattr (struct dentry *dentry, struct iattr *attr);
+#ifdef LINUX_2_5
+static int ocfs_getattr (struct vfsmount *mnt, struct dentry *dentry,
+ struct kstat *stat);
+#else
static int ocfs_getattr (struct dentry *dentry, struct iattr *attr);
+#endif
static int ocfs_dentry_revalidate (struct dentry *dentry, int flags);
@@ -148,7 +205,11 @@
size_t size, loff_t * offp);
#endif
-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,4,10)
+#ifdef LINUX_2_5
+static int ocfs_direct_IO(int rw, struct kiocb *iocb,
+ const struct iovec *iov, loff_t offset,
+ unsigned long nr_segs);
+#elif LINUX_VERSION_CODE >= LinuxVersionCode(2,4,10)
static int ocfs_direct_IO (int rw,
#ifdef SUSE
struct file *filp,
Modified: trunk/ocfs2/Linux/inc/ocfsmount.h
===================================================================
--- trunk/ocfs2/Linux/inc/ocfsmount.h 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Linux/inc/ocfsmount.h 2003-09-03 01:05:18 UTC (rev 10)
@@ -27,6 +27,13 @@
#ifndef _OCFSMOUNT_H_
#define _OCFSMOUNT_H_
+/* utility macro */
+#ifdef LINUX_2_5
+#define OCFS_GENERIC_SB_P(sb) (sb->s_fs_info)
+#else
+#define OCFS_GENERIC_SB_P(sb) (sb->u.generic_sbp)
+#endif
+
int ocfs_read_disk_header (__u8 ** buffer, struct super_block *sb);
int ocfs_mount_volume (struct super_block *sb, bool reclaim_id);
Modified: trunk/ocfs2/Linux/ocfsbitmap.c
===================================================================
--- trunk/ocfs2/Linux/ocfsbitmap.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Linux/ocfsbitmap.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -27,7 +27,7 @@
#if defined(__KERNEL__)
#include <ocfs.h>
#else
-#include <asm/bitops.h>
+//#include <asm/bitops.h>
#include <dummy.h>
#endif
Modified: trunk/ocfs2/Linux/ocfsdlm.c
===================================================================
--- trunk/ocfs2/Linux/ocfsdlm.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Linux/ocfsdlm.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -208,7 +208,11 @@
#ifdef DO_PERIODIC_SYNC
/* do a syncdev every 2 minutes currently that is 500ms per cycle */
if (flush_counter++ == 240) {
+#ifdef LINUX_2_5
+ sync_blockdev (osb->sb->s_bdev);
+#else
fsync_no_super (osb->sb->s_dev);
+#endif
flush_counter = 0;
}
#endif
Modified: trunk/ocfs2/Linux/ocfsfile.c
===================================================================
--- trunk/ocfs2/Linux/ocfsfile.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Linux/ocfsfile.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -53,7 +53,7 @@
goto finally;
}
inode = dentry->d_inode;
- osb = ((ocfs_super *)(dir->i_sb->u.generic_sbp));
+ osb = (ocfs_super *)OCFS_GENERIC_SB_P(dir->i_sb);
if (inode_data_is_oin (inode)) {
OIN = ((ocfs_inode *)inode->u.generic_ip);
@@ -170,7 +170,7 @@
goto finally;
}
- osb = ((ocfs_super *)(old_dir->i_sb->u.generic_sbp));
+ osb = (ocfs_super *) OCFS_GENERIC_SB_P(old_dir->i_sb);
/* old parent dir offset */
ocfs_linux_get_inode_offset (old_dir, &oldDirOff, NULL);
@@ -207,8 +207,10 @@
/* OIN exists and it's not marked for deletion! */
ocfs_down_sem (&(newOIN->main_res), true);
OCFS_SET_FLAG (newOIN->oin_flags, OCFS_OIN_IN_USE);
+ status = ocfs_verify_update_oin (osb, newOIN);
+ if (status < 0)
+ LOG_ERROR_STATUS (status);
ocfs_up_sem (&(newOIN->main_res));
- status = ocfs_verify_update_oin (osb, newOIN);
DeleteTargetOin = true;
}
}
@@ -282,8 +284,11 @@
DISK_LOCK_LAST_READ (oldfe) = t;
DISK_LOCK_READER_NODE (oldfe) = osb->node_num;
DISK_LOCK_WRITER_NODE (oldfe) = osb->node_num;
+#ifdef LINUX_2_5
+ oldfe->modify_time = CURRENT_TIME.tv_sec;
+#else
oldfe->modify_time = CURRENT_TIME;
-
+#endif
status = ocfs_create_file (osb, newDirOff, oldfe);
if (status < 0) {
LOG_ERROR_STATUS (status);
Modified: trunk/ocfs2/Linux/ocfsioctl.c
===================================================================
--- trunk/ocfs2/Linux/ocfsioctl.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Linux/ocfsioctl.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -62,7 +62,7 @@
sizeof (struct ocfs_ioc));
break;
case OCFS_IOC_CDSL_MODIFY:
- osb = ((ocfs_super *)(inode->i_sb->u.generic_sbp));
+ osb = (ocfs_super *) OCFS_GENERIC_SB_P(inode->i_sb);
ret =
copy_from_user (&cdsl, (void *) arg,
sizeof (ocfs_cdsl));
Modified: trunk/ocfs2/Linux/ocfsiosup.c
===================================================================
--- trunk/ocfs2/Linux/ocfsiosup.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Linux/ocfsiosup.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -25,7 +25,11 @@
*/
#include "ocfs.h"
+#ifdef LINUX_2_5
+#include <linux/buffer_head.h>
+#else
#include <linux/locks.h>
+#endif
#include <linux/pagemap.h>
/* Tracing */
@@ -43,12 +47,20 @@
struct super_block *sb;
struct buffer_head *bh;
struct buffer_head **bhs = NULL;
+#ifdef LINUX_2_5
+ struct block_device *dev;
+#else
kdev_t dev;
+#endif
LOG_ENTRY ();
sb = osb->sb;
+#ifdef LINUX_2_5
+ dev = sb->s_bdev;
+#else
dev = sb->s_dev;
+#endif
ret = 0;
tot=0;
@@ -110,7 +122,11 @@
int nr, i;
struct super_block *sb;
__u64 blocknum;
+#ifdef LINUX_2_5
+ struct block_device *dev;
+#else
kdev_t dev;
+#endif
struct buffer_head *bh;
struct buffer_head **bhs = NULL;
char *kaddr;
@@ -133,8 +149,11 @@
}
sb = osb->sb;
+#ifdef LINUX_2_5
+ dev = sb->s_bdev;
+#else
dev = sb->s_dev;
-
+#endif
if (Cached && Offset >= osb->vol_layout.data_start_off) {
ocfs_create_log_extent_map(osb, Offset, (__u64)Length);
//KASEY ???
@@ -189,7 +208,11 @@
}
memcpy(kaddr + ((unsigned long)(bh)->b_data & ~PAGE_MASK), Buffer, 512);
kunmap(bh->b_page);
+#ifdef LINUX_2_5
+ set_buffer_uptodate(bh);
+#else
mark_buffer_uptodate(bh, true);
+#endif
mark_buffer_dirty(bh);
unlock_buffer(bh);
bhs[i] = bh;
@@ -230,7 +253,11 @@
struct super_block *sb;
int nr, i;
__u64 blocknum;
+#ifdef LINUX_2_5
+ struct block_device *dev;
+#else
kdev_t dev;
+#endif
struct buffer_head *bh;
struct buffer_head **bhs = NULL;
char *kaddr;
@@ -253,7 +280,11 @@
}
sb = osb->sb;
+#ifdef LINUX_2_5
+ dev = sb->s_bdev;
+#else
dev = sb->s_dev;
+#endif
nr = (Length + 511) >> 9;
bhs = kmalloc (nr * sizeof(bh), GFP_KERNEL);
@@ -282,7 +313,11 @@
if (!Cached || Offset < osb->vol_layout.data_start_off) {
lock_buffer(bh);
if (!buffer_dirty(bh))
+#ifdef LINUX_2_5
+ clear_buffer_uptodate(bh);
+#else
mark_buffer_uptodate(bh, false);
+#endif
unlock_buffer(bh);
}
}
Modified: trunk/ocfs2/Linux/ocfsipc.c
===================================================================
--- trunk/ocfs2/Linux/ocfsipc.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Linux/ocfsipc.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -99,8 +99,11 @@
}
/* Flush all scheduled tasks */
+#ifdef LINUX_2_5
+ flush_scheduled_work ();
+#else
flush_scheduled_tasks ();
-
+#endif
/* signal main thread of ipcdlm's exit */
complete (&(OcfsIpcCtxt.complete));
@@ -227,7 +230,11 @@
LOG_ENTRY ();
/* Initialize the workitem with our worker routine and Q it. */
+#ifdef LINUX_2_5
+ INIT_WORK (&recv_ctxt->ipc_wq, ocfs_dlm_recv_msg, recv_ctxt);
+#else
INIT_TQUEUE (&recv_ctxt->ipc_tq, ocfs_dlm_recv_msg, recv_ctxt);
+#endif
sinlen = sizeof (struct sockaddr_in);
memset (&sin, 0, sinlen);
@@ -245,7 +252,11 @@
NIPQUAD (sin.sin_addr.s_addr));
if (status == 0)
+#ifdef LINUX_2_5
+ schedule_work (&recv_ctxt->ipc_wq);
+#else
schedule_task (&recv_ctxt->ipc_tq);
+#endif
bail:
LOG_EXIT_STATUS (status);
Modified: trunk/ocfs2/Linux/ocfsmain.c
===================================================================
--- trunk/ocfs2/Linux/ocfsmain.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Linux/ocfsmain.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -27,8 +27,14 @@
#define OCFSMAIN_PRIVATE_DECLS
#include <ocfs.h>
+#ifndef LINUX_2_5
#include <linux/iobuf.h>
+#endif /* for 2.5 - no more kiovec, kiobuf structures - vfs handles
+ * this for us (direct i/o) */
#include <linux/sysctl.h>
+#ifdef LINUX_2_5
+#include <linux/moduleparam.h>
+#endif
/* Tracing */
#define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_INIT
@@ -38,6 +44,13 @@
#define alloc_kiovec_sz(nr, buf, bh) alloc_kiovec(nr, buf)
#endif
+/* Operates on a struct super_block * */
+#ifdef LINUX_2_5
+#define OCFS_SB_GET_KDEV(sb) (to_kdev_t(sb->s_dev))
+#else
+#define OCFS_SB_GET_KDEV(sb) (sb->s_dev)
+#endif
+
/*
** Globals
*/
@@ -58,6 +71,18 @@
__u32 cs = 0;
__u32 comm_voting = 0;
+#ifdef LINUX_2_5
+module_param (node_name, charp, 0);
+module_param (node_number, ulong, 0);
+module_param (debug_context, ulong, 0);
+module_param (debug_level, ulong, 0);
+module_param (debug_exclude, ulong, 0);
+module_param (ip_address, charp, 0);
+module_param (ip_port, ulong, 0);
+module_param (guid, charp, 0);
+module_param (cs, ulong, 0);
+module_param (comm_voting, ulong, 0);
+#else /* LINUX_2_5 */
MODULE_PARM (node_name, "s");
MODULE_PARM_DESC(node_name, "Name of this machine in the cluster");
MODULE_PARM (node_number, "l");
@@ -78,6 +103,7 @@
MODULE_PARM_DESC(cs, "Checksum");
MODULE_PARM (comm_voting, "l");
MODULE_PARM_DESC(comm_voting, "Enable/Disable network dlm");
+#endif /* Linux 2.4 stuff */
#define KERN_OCFS 989
static ctl_table ocfs_dbg_table[] = {
@@ -104,6 +130,12 @@
int ocfs_get_block2 (struct inode *inode, long iblock, long *oblock, int len);
+#ifdef LINUX_2_5
+int ocfs_direct_IO_get_blocks(struct inode *inode, sector_t iblock,
+ unsigned long max_blocks,
+ struct buffer_head *bh_result, int create);
+#endif
+
#ifdef AIO_ENABLED
int ocfs_kvec_read(struct file *filp, kvec_cb_t cb, size_t size, loff_t pos);
int ocfs_kvec_write(struct file *filp, kvec_cb_t cb, size_t size, loff_t pos);
@@ -122,8 +154,10 @@
.clear_inode = ocfs_clear_inode,
//put_inode = force_delete,
//delete_inode = ocfs_delete_inode,
+#ifndef LINUX_2_5
.read_inode = ocfs_read_inode,
.read_inode2 = ocfs_read_inode2,
+#endif
.put_super = ocfs_put_super,
#ifdef ALLOW_CACHE_FS
.remount_fs = ocfs_remount,
@@ -209,7 +243,11 @@
goto bail;
}
+#ifdef LINUX_2_5
+ while ( (c = strsep(&options, ",")) != NULL) {
+#else
for (c = strtok (options, ","); c != NULL; c = strtok (NULL, ",")) {
+#endif
if ((value = strchr (c, '=')) != NULL)
*value++ = 0;
if (!strcmp (c, "gid")) {
@@ -252,6 +290,105 @@
return ret;
} /* ocfs_parse_options */
+#ifdef LINUX_2_5
+static int ocfs_fill_super (struct super_block *sb, void *data,
+ int silent)
+{
+ struct dentry *root_dentry;
+ int status = -1;
+ struct inode *root_inode = NULL;
+ __u32 uid = current->fsuid;
+ __u32 gid = current->fsgid;
+ bool c;
+ bool reclaim_id;
+ ocfs_super *osb;
+
+ LOG_ENTRY ();
+
+ if (ocfs_parse_options (data, &uid, &gid, &c, &reclaim_id) != 0) {
+ LOG_ERROR_STR ("bad mount option");
+ status=-EINVAL;
+ goto read_super_error;
+ }
+
+ sb->s_magic = OCFS_MAGIC;
+ sb->s_op = &ocfs_sops;
+
+ /* this is needed to support O_LARGE_FILE */
+ sb->s_maxbytes = OCFS_LINUX_MAX_FILE_SIZE;
+
+ if (!sb_set_blocksize(sb, 512)) {
+ LOG_ERROR_STR("Could not set block size");
+ status=-EIO;
+ goto read_super_error;
+ }
+
+ status = ocfs_mount_volume (sb, reclaim_id);
+ if (status < 0) {
+ goto read_super_error;
+ }
+ osb = ((ocfs_super *)(sb->s_fs_info));
+ if (!osb) {
+ status=-EINVAL;
+ goto read_super_error;
+ }
+
+#ifdef ALLOW_CACHE_MOUNT
+ osb->cache_fs = c; /* set caching type */
+#else
+ osb->cache_fs = false;
+#endif
+
+ root_inode = ocfs_iget(sb, NULL);
+ if (!root_inode) {
+ status=-EIO;
+ LOG_ERROR_STATUS (status);
+ goto read_super_error;
+ }
+
+ root_dentry = d_alloc_root (root_inode);
+ if (!root_dentry) {
+ status=-ENOMEM;
+ LOG_ERROR_STATUS (status);
+ goto read_super_error;
+ }
+
+ sb->s_root = root_dentry;
+
+ status = 0;
+ LOG_EXIT_STATUS (status);
+ return status;
+
+read_super_error:
+ if (root_inode != NULL) {
+ iput (root_inode);
+ root_inode = NULL;
+ }
+
+ LOG_EXIT_STATUS (status);
+ return status;
+} /* ocfs_fill_super */
+
+static struct super_block *ocfs_get_sb(struct file_system_type *fs_type,
+ int flags, char *dev_name, void *data)
+{
+ return get_sb_bdev(fs_type, flags, dev_name, data, ocfs_fill_super);
+}
+
+static struct file_system_type ocfs_fs_type = {
+ .owner = THIS_MODULE,
+ .name = "ocfs",
+ .get_sb = ocfs_get_sb, /* is this called when we mount
+ * the fs? */
+ .kill_sb = kill_block_super, /* set to the generic one
+ * right now, but do we
+ * need to change that? */
+ .fs_flags = FS_REQUIRES_DEV,
+ .next = NULL
+};
+
+#else /* We're a 2.4 kernel */
+
/*
* ocfs_read_super()
*
@@ -297,7 +434,7 @@
sb->s_maxbytes = OCFS_LINUX_MAX_FILE_SIZE;
status = ocfs_mount_volume (sb, reclaim_id);
- osb = ((ocfs_super *)(sb->u.generic_sbp));
+ osb = (ocfs_super *) OCFS_GENERIC_SB_P(sb);
if (status < 0 || !osb)
goto read_super_error;
@@ -322,6 +459,9 @@
sb->s_root = root;
+ printk ("ocfs: Mounting device (%u,%u) in node %d\n",
+ MAJOR(sb->s_dev), MINOR(sb->s_dev), osb->node_num);
+
LOG_EXIT_PTR (sb);
return sb;
@@ -340,6 +480,7 @@
} /* ocfs_read_super */
static DECLARE_FSTYPE (ocfs_fs_type, "ocfs", ocfs_read_super, FS_REQUIRES_DEV);
+#endif /* #if LINUX_2_5 ... #else */
/*
* ocfs_driver_entry()
@@ -607,6 +748,7 @@
ocfs_memcheck ();
#endif
+ printk("Unloaded OCFS Driver module\n");
LOG_EXIT ();
return;
} /* ocfs_driver_exit */
@@ -618,6 +760,7 @@
* not found? : get_new_inode -> OCFS_READ_INODE2
*/
+#if LINUX_VERSION_CODE < LinuxVersionCode(2,5,0)
/*
* ocfs_find_inode()
*
@@ -704,7 +847,9 @@
LOG_EXIT_LONG (ret);
return ret;
} /* ocfs_find_inode */
+#endif /* LINUX_VERSION_CODE < LinuxVersionCode(2,5,0) */
+
/*
* ocfs_populate_inode()
*
@@ -719,20 +864,29 @@
LOG_ENTRY_ARGS ("(0x%08x, %u, size:%u)\n", inode, mode, fe->file_size);
sb = inode->i_sb;
- osb = ((ocfs_super *)(sb->u.generic_sbp));
+ osb = (ocfs_super *) OCFS_GENERIC_SB_P(sb);
offset = S_ISDIR (mode) ? fe->extents[0].disk_off : fe->this_sector;
- inode->i_dev = sb->s_dev;
+#ifdef LINUX_2_5
+ inode->i_rdev = OCFS_SB_GET_KDEV(sb);
+#else
+ inode->i_dev = OCFS_SB_GET_KDEV(sb);
+#endif
inode->i_mode = mode;
inode->i_uid = fe->uid;
inode->i_gid = fe->gid;
inode->i_blksize = (__u32) osb->vol_layout.cluster_size; // sb->s_blocksize;
inode->i_blocks = (fe->file_size + sb->s_blocksize) >> sb->s_blocksize_bits;
inode->i_mapping->a_ops = &ocfs_aops;
+#ifdef LINUX_2_5
+ inode->i_atime.tv_sec = fe->modify_time;
+ inode->i_mtime.tv_sec = fe->modify_time;
+ inode->i_ctime.tv_sec = fe->create_time;
+#else
inode->i_atime = fe->modify_time;
inode->i_mtime = fe->modify_time;
inode->i_ctime = fe->create_time;
-
+#endif
if (genptr)
SET_INODE_OIN (inode, genptr);
else
@@ -743,22 +897,26 @@
inode->i_fop = &ocfs_fops;
inode->i_op = &ocfs_file_iops;
inode->i_size = fe->file_size;
- inode->i_rdev = sb->s_dev;
+ inode->i_rdev = OCFS_SB_GET_KDEV(sb);
break;
case S_IFDIR:
inode->i_op = &ocfs_dir_iops;
inode->i_fop = &ocfs_dops;
inode->i_size = OCFS_DEFAULT_DIR_NODE_SIZE;
- inode->i_rdev = sb->s_dev;
+ inode->i_rdev = OCFS_SB_GET_KDEV(sb);
break;
case S_IFLNK:
inode->i_op = &page_symlink_inode_operations;
//inode->i_fop = &ocfs_fops;
inode->i_size = fe->file_size;
- inode->i_rdev = sb->s_dev;
+ inode->i_rdev = OCFS_SB_GET_KDEV(sb);
break;
default:
+#ifdef LINUX_2_5
+ init_special_inode (inode, mode, inode->i_rdev.value);
+#else
init_special_inode (inode, mode, inode->i_rdev);
+#endif
break;
}
@@ -766,7 +924,98 @@
return;
} /* ocfs_populate_inode */
+#ifdef LINUX_2_5
/*
+ * ocfs_read_locked_inode()
+ *
+ * by this point, i_sb, i_dev, i_ino are filled in
+ *
+ */
+static void ocfs_read_locked_inode (struct inode *inode,
+ ocfs_file_entry *entry)
+{
+ struct super_block *sb;
+ ocfs_super *osb;
+ ocfs_inode *newoin;
+ umode_t mode;
+
+ LOG_ENTRY_ARGS ("(0x%08x, 0x%08x)\n", inode, entry);
+
+ if (inode == NULL || inode->i_sb == NULL) {
+ LOG_ERROR_STR ("bad inode");
+ goto bail;
+ }
+ sb = inode->i_sb;
+ osb = ((ocfs_super *)(sb->s_fs_info));
+ LOG_TRACE_ARGS("osb = %x\n", osb);
+ if (inode->i_ino == OCFS_ROOT_INODE_NUMBER) {
+ LOG_TRACE_ARGS("Populating root inode (i_ino = %lu)\n", inode->i_ino);
+ inode->i_mode = S_IFDIR | osb->vol_layout.prot_bits;
+ inode->i_blksize = 512; /* TODO: fix */
+ inode->i_blkbits = 9;
+ inode->i_blocks = 0;
+ inode->i_rdev = OCFS_SB_GET_KDEV(sb);/* is this correct?! */
+ inode->i_mapping->a_ops = &ocfs_aops;
+ inode->i_atime = CURRENT_TIME;
+ inode->i_mtime = CURRENT_TIME;
+ inode->i_ctime = CURRENT_TIME;
+ inode->i_op = &ocfs_dir_iops;
+ inode->i_fop = &ocfs_dops;
+ inode->i_uid = osb->vol_layout.uid;
+ inode->i_gid = osb->vol_layout.gid;
+ SET_INODE_OIN (inode, osb->oin_root_dir);
+ goto bail;
+ }
+
+ LOG_TRACE_ARGS("Populating non-root inode (i_ino = %lu)\n", inode->i_ino);
+
+ if (entry == NULL) {
+ make_bad_inode (inode);
+ goto bail;
+ }
+
+ newoin = NULL;
+
+ mode = entry->prot_bits;
+
+ switch (entry->attribs & (~OCFS_ATTRIB_FILE_CDSL)) {
+ case OCFS_ATTRIB_DIRECTORY:
+ mode |= S_IFDIR;
+ break;
+ case OCFS_ATTRIB_CHAR:
+ inode->i_rdev =
+ mk_kdev (entry->dev_major, entry->dev_minor);
+ mode |= S_IFCHR;
+ break;
+ case OCFS_ATTRIB_BLOCK:
+ inode->i_rdev =
+ mk_kdev (entry->dev_major, entry->dev_minor);
+ mode |= S_IFBLK;
+ break;
+ case OCFS_ATTRIB_FIFO:
+ mode |= S_IFIFO;
+ break;
+ case OCFS_ATTRIB_SYMLINK:
+ mode |= S_IFLNK;
+ break;
+ case OCFS_ATTRIB_SOCKET:
+ mode |= S_IFSOCK;
+ break;
+ case OCFS_ATTRIB_REG:
+ default:
+ mode |= S_IFREG;
+ break;
+ }
+ ocfs_populate_inode (inode, entry, mode, newoin);
+
+ bail:
+ LOG_EXIT ();
+ return;
+} /* ocfs_read_locked_inode */
+
+#else
+
+/*
* ocfs_read_inode2()
*
* by this point, i_sb, i_dev, i_ino are filled in
@@ -787,7 +1036,7 @@
goto bail;
}
sb = inode->i_sb;
- osb = ((ocfs_super *)(sb->u.generic_sbp));
+ osb = (ocfs_super *) OCFS_GENERIC_SB_P(sb);
if (inode->i_ino == OCFS_ROOT_INODE_NUMBER) {
inode->i_mode = S_IFDIR | osb->vol_layout.prot_bits;
inode->i_blksize = (__u32) osb->vol_layout.cluster_size;
@@ -853,14 +1102,142 @@
/*
* ocfs_read_inode()
- *
+ * Only used in Linux 2.4
*/
static void ocfs_read_inode (struct inode *inode)
{
make_bad_inode (inode);
} /* ocfs_read_inode() */
+#endif
+#ifdef LINUX_2_5
/*
+ * here's how inodes get read from disk:
+ * iget5_locked -> find_actor -> OCFS_FIND_ACTOR
+ * found? : return the in-memory inode
+ * not found? : get_new_inode -> OCFS_INIT_LOCKED_INODE
+ */
+
+/*
+ * ocfs_find_actor()
+ *
+ * This is the iget5_locked helper function. It used to be ocfs_find_inode()
+ */
+int ocfs_find_actor (struct inode *inode, void *opaque)
+{
+ ocfs_find_inode_args *args;
+ int ret = 0;
+ __u64 fileOff;
+
+ LOG_ENTRY_ARGS ("(0x%08x, %u, 0x%08x)\n", inode, inode->i_ino, opaque);
+
+ /* Special Case: opaque == NULL, means we're looking for
+ the root inode. We only get called like this from
+ ocfs_fill_super, and therefore that inode should not exist
+ yet. */
+ if (opaque == NULL)
+ goto bail;
+ if (inode == NULL)
+ goto bail;
+ args = (ocfs_find_inode_args *) opaque;
+
+ if (!ocfs_linux_get_inode_offset (inode, &fileOff, NULL)) {
+ LOG_TRACE_STR ("could not get inode offset");
+ goto bail;
+ }
+
+ if (S_ISDIR (inode->i_mode)) {
+ LOG_TRACE_STR ("find_actor -> S_ISDIR\n");
+ if (args->entry->extents[0].disk_off != fileOff) {
+ LOG_TRACE_ARGS
+ ("DIR : inode number same but full offset does not match: %u.%u != %u.%u\n",
+ args->entry->extents[0].disk_off, fileOff);
+ goto bail;
+ }
+ } else if (args->offset != fileOff) {
+ LOG_TRACE_ARGS
+ ("FILE : inode number same but full offset does not match: %u.%u != %u.%u\n",
+ args->offset, fileOff);
+ goto bail;
+ }
+
+ ret = 1;
+ bail:
+ LOG_EXIT_LONG (ret);
+ return ret;
+} /* ocfs_find_actor */
+
+
+/*
+ * initialize the new inode, but don't do anything that would cause
+ * us to sleep.
+ * return 0 on success, 1 on failure
+ */
+int ocfs_init_locked_inode(struct inode * inode, void * opaque) {
+ int ret = 1;
+ LOG_ENTRY_ARGS("inode = %x, opaque = %x\n", inode, opaque);
+
+ /* We might be called from ocfs_fill_super in which case, opaque
+ * will be null (but we'll be looking for the root inode
+ * anyway... */
+ if (opaque == NULL) {
+ inode->i_ino = OCFS_ROOT_INODE_NUMBER;
+ }
+
+ ret = 0;
+//bail:
+ LOG_EXIT_STATUS(ret);
+ return(ret);
+}
+
+/*
+ * ocfs_iget()
+ *
+ * expects sb and args to be already filled out.
+ * specifically, need args->entry->extents[0].disk_off, args->offset
+ * if we're called from ocfs_fill_super, args == NULL
+ */
+struct inode * ocfs_iget(struct super_block *sb,
+ ocfs_find_inode_args *args) {
+ struct inode *inode = NULL;
+ ocfs_file_entry *fe = NULL;
+
+ LOG_ENTRY();
+
+ if (!sb)
+ goto bail;
+
+ /* if args == NULL, we want the root inode */
+ if (!args) {
+ LOG_TRACE_STR("looking for root inode");
+ inode = iget5_locked(sb, OCFS_ROOT_INODE_NUMBER, ocfs_find_actor, ocfs_init_locked_inode, NULL);
+ } else {
+ LOG_TRACE_STR("looking for non-root inode");
+ fe = args->entry;
+ /* Need to verify that ocfs_find_inode does the right thing,
+ * and need to actually write ocfs_init_inode */
+ inode = iget5_locked(sb, LO (fe->this_sector), ocfs_find_actor,
+ ocfs_init_locked_inode, args);
+ }
+
+ if (!inode)
+ goto bail;
+
+ /* inode was *not* in the inode cache */
+ if (inode->i_state & I_NEW) {
+ LOG_TRACE_STR("Inode was not in inode cache, reading it.");
+ ocfs_read_locked_inode(inode, args ? args->entry : NULL);
+ unlock_new_inode(inode);
+ }
+
+bail:
+ LOG_EXIT_PTR(inode);
+ return(inode);
+}
+
+#endif /* LINUX_2_5 stuff */
+
+/*
* ocfs_lookup()
*
*/
@@ -874,7 +1251,7 @@
struct inode *inode = NULL;
struct super_block *sb = dir->i_sb;
struct dentry *ret;
- ocfs_super *osb = ((ocfs_super *)(sb->u.generic_sbp));
+ ocfs_super *osb = (ocfs_super *) OCFS_GENERIC_SB_P(sb);
LOG_ENTRY_ARGS ("(0x%08x, 0x%08x, '%*s')\n", dir, dentry,
dentry->d_name.len, dentry->d_name.name);
@@ -882,6 +1259,7 @@
atomic_inc (&dir->i_count);
if (dentry->d_name.len > OCFS_MAX_FILENAME_LENGTH) {
+ LOG_ERROR_STR ("name too long");
ret = ERR_PTR (-ENAMETOOLONG);
goto bail;
}
@@ -894,6 +1272,7 @@
fe = ocfs_allocate_file_entry();
if (!fe) {
+ LOG_ERROR_STR("could not allocate file entry");
ret = ERR_PTR (-ENOMEM);
goto bail;
}
@@ -902,14 +1281,20 @@
if (status >= 0) {
args.offset = fe->this_sector;
args.entry = fe;
+#ifdef LINUX_2_5
+ inode = ocfs_iget (sb, &args);
+#else
inode =
iget4 (sb, LO (fe->this_sector),
(find_inode_t) ocfs_find_inode, (void *) (&args));
+#endif
if (inode == NULL) {
+ LOG_ERROR_STR("access error");
ret = ERR_PTR (-EACCES);
goto bail;
}
if (is_bad_inode (inode)) {
+ LOG_ERROR_STR("access error (bad inode)");
iput (inode);
inode = NULL;
ret = ERR_PTR (-EACCES);
@@ -944,7 +1329,7 @@
LOG_ENTRY_ARGS ("(0x%08x, 0x%08x)\n", sb, buf);
- osb = ((ocfs_super *)(sb->u.generic_sbp));
+ osb = (ocfs_super *) OCFS_GENERIC_SB_P(sb);
numbits = osb->cluster_bitmap.size;
status = ocfs_read_force_disk (osb, lockbuf, OCFS_SECTOR_SIZE, (__u64)OCFS_BITMAP_LOCK_OFFSET);
@@ -952,13 +1337,18 @@
if (numbits >= bm_lock->used_bits)
freebits = numbits - bm_lock->used_bits;
+ /* take out the space reserved for system files */
+ freebits -= (8 * ONE_MEGA_BYTE / osb->vol_layout.cluster_size);
+
+
buf->f_type = OCFS_MAGIC;
buf->f_bsize = sb->s_blocksize;
buf->f_namelen = OCFS_MAX_FILENAME_LENGTH;
buf->f_blocks =
(unsigned long) ((unsigned long) (numbits) *
(unsigned long) (osb->vol_layout.
- cluster_size >> 9));
+ cluster_size >> 9) -
+ (8 * ONE_MEGA_BYTE / osb->vol_layout.cluster_size));
buf->f_bfree =
(unsigned long) (freebits * (osb->vol_layout.cluster_size >> 9));
buf->f_bavail = buf->f_bfree;
@@ -992,7 +1382,11 @@
memcpy (kaddr, symname, len - 1);
mapping->a_ops->commit_write (NULL, page, 0, len - 1);
err = mapping->a_ops->readpage (NULL, page);
+#ifdef LINUX_2_5
+ wait_on_page_locked (page);
+#else
wait_on_page (page);
+#endif
page_cache_release (page);
if (err < 0)
goto fail;
@@ -1000,7 +1394,11 @@
return 0;
fail_map:
+#ifdef LINUX_2_5
+ unlock_page (page);
+#else
UnlockPage (page);
+#endif
page_cache_release (page);
fail:
return err;
@@ -1044,8 +1442,13 @@
* ocfs_symlink_get_block()
*
*/
+#ifdef LINUX_2_5
int ocfs_symlink_get_block (struct inode *inode,
+ sector_t iblock, struct buffer_head *bh_result, int create)
+#else
+int ocfs_symlink_get_block (struct inode *inode,
long iblock, struct buffer_head *bh_result, int create)
+#endif
{
int err = -EIO;
ocfs_super *osb;
@@ -1061,7 +1464,7 @@
goto bail;
}
- osb = ((ocfs_super *)(inode->i_sb->u.generic_sbp));
+ osb = (ocfs_super *) OCFS_GENERIC_SB_P(inode->i_sb);
if ((iblock << 9) > PATH_MAX + 1) {
LOG_ERROR_ARGS ("file offset > PATH_MAX: %u.%u", iblock << 9);
@@ -1097,10 +1500,15 @@
goto bail;
}
+#ifdef LINUX_2_5
+ map_bh(bh_result, inode->i_sb, (fe->extents[0].disk_off >> 9) + iblock);
+#else
bh_result->b_dev = inode->i_dev;
bh_result->b_blocknr = fe->extents[0].disk_off >> 9;
bh_result->b_blocknr += iblock;
bh_result->b_state |= (1UL << BH_Mapped);
+#endif
+
if (create)
bh_result->b_state |= (1UL << BH_New);
err = 0;
@@ -1116,8 +1524,13 @@
* ocfs_get_block()
*
*/
+#ifdef LINUX_2_5
int ocfs_get_block (struct inode *inode,
+ sector_t iblock, struct buffer_head *bh_result, int create)
+#else
+int ocfs_get_block (struct inode *inode,
long iblock, struct buffer_head *bh_result, int create)
+#endif
{
int err = -EIO;
ocfs_inode *oin;
@@ -1151,7 +1564,11 @@
}
}
len = 1;
+#ifdef LINUX_2_5
+ err = ocfs_lookup_file_allocation (osb, oin, vbo, &lbo, len, NULL);
+#else
err = ocfs_lookup_file_allocation (osb, oin, vbo, &lbo, len);
+#endif
if (err < 0) {
LOG_ERROR_ARGS ("vbo=%u.%u lbo=%u.%u len=%u", HILO(vbo),
HILO(lbo), len);
@@ -1159,14 +1576,19 @@
}
if (create) {
- LOG_TRACE_ARGS ("CREATE: offset: %d -> block#: %d\n", iblock,
+ LOG_TRACE_ARGS ("CREATE: offset: %u -> block#: %d\n", iblock,
lbo >> inode->i_sb->s_blocksize_bits);
bh_result->b_state |= (1UL << BH_New);
}
+#ifdef LINUX_2_5
+ map_bh(bh_result, inode->i_sb, lbo >> inode->i_sb->s_blocksize_bits);
+#else
bh_result->b_dev = inode->i_dev;
bh_result->b_blocknr = lbo >> inode->i_sb->s_blocksize_bits;
bh_result->b_state |= (1UL << BH_Mapped);
+#endif
+
if (create)
bh_result->b_state |= (1UL << BH_New);
@@ -1185,6 +1607,7 @@
return err;
} /* ocfs_get_block */
+#ifndef LINUX_2_5
/*
* ocfs_get_block2()
*
@@ -1232,11 +1655,12 @@
LOG_EXIT_LONG (err);
return err;
} /* ocfs_get_block2 */
+#endif
-
/*
* ocfs_file_write()
- *
+ * Linux 2.5 TODO: Remove all O_DIRECT conditionals here, they are no longer
+ * needed.
*/
static ssize_t ocfs_file_write (struct file *filp, const char *buf, size_t count,
loff_t * ppos)
@@ -1322,6 +1746,12 @@
goto bail;
}
}
+
+ if (acquired) {
+ ocfs_up_sem (&(oin->main_res));
+ acquired = false;
+ }
+
if (filp->f_flags & O_APPEND)
newsize = count + inode->i_size;
else
@@ -1342,11 +1772,6 @@
HI (oin->alloc_size), LO (oin->alloc_size), HI (newsize),
LO (newsize));
- if (acquired) {
- ocfs_up_sem (&(oin->main_res));
- acquired = false;
- }
-
status =
ocfs_create_modify_file (osb, oin->parent_dirnode_off, oin,
NULL, newsize, &oin->file_disk_off,
@@ -1358,9 +1783,6 @@
ret = -ENOSPC;
goto bail;
}
-
- ocfs_down_sem (&(oin->main_res), true);
- acquired = true;
}
#if LINUX_VERSION_CODE < LinuxVersionCode(2,4,10)
@@ -1376,10 +1798,6 @@
LOG_TRACE_STR
("Generic_file_write ok, asking for OIN update now");
inode->i_size = newsize;
- if (acquired) {
- ocfs_up_sem (&(oin->main_res));
- acquired = false;
- }
memset (&attr, 0, sizeof (struct iattr));
attr.ia_valid |= ATTR_SIZE;
attr.ia_size = newsize;
@@ -1416,7 +1834,8 @@
/*
* ocfs_file_read()
- *
+ * Linux 2.5 TODO: Remove all O_DIRECT conditionals here, they are no longer
+ * needed.
*/
static ssize_t ocfs_file_read (struct file *filp, char *buf, size_t count, loff_t * ppos)
{
@@ -1509,23 +1928,170 @@
* ocfs_writepage()
*
*/
+#ifdef LINUX_2_5
+static int ocfs_writepage (struct page *page, struct writeback_control *wbc)
+#else
static int ocfs_writepage (struct page *page)
+#endif
{
int ret;
LOG_ENTRY_ARGS ("(0x%08x)\n", page);
-
+
+#ifdef LINUX_2_5
+ ret = block_write_full_page (page, ocfs_get_block, wbc);
+#else
ret = block_write_full_page (page, ocfs_get_block);
+#endif
LOG_EXIT_LONG (ret);
return ret;
} /* ocfs_writepage */
-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,4,10)
+#if LINUX_2_5
/*
+ * TODO: Make this into a generic get_blocks function.
+ *
+ * From do_direct_io in direct-io.c:
+ * "So what we do is to permit the ->get_blocks function to populate
+ * bh.b_size with the size of IO which is permitted at this offset and
+ * this i_blkbits."
+ *
+ * This function is called directly from get_more_blocks in direct-io.c.
+ *
+ * We should probably have this data in the oin for the inode.
+ * Otherwise, we might want to look at ocfs_rw_direct,
+ * ocfs_lookup_file_allocation and ocfs_get_block
+ *
+ * called like this: dio->get_blocks(dio->inode, fs_startblk,
+ * fs_count, map_bh, dio->rw == WRITE);
+ */
+int ocfs_direct_IO_get_blocks(struct inode *inode, sector_t iblock,
+ unsigned long max_blocks,
+ struct buffer_head *bh_result, int create)
+{
+ int ret = -1;
+ int status;
+ ocfs_super *osb = NULL;
+ ocfs_inode *oin = NULL;
+ __s64 vbo; /* file offset */
+ __s64 lbo; /* logical (disk) offset */
+ __s64 vbo_max; /* file offset, max_blocks from iblock */
+ int set_new = 0; /* flag */
+ u32 new_size; /* In sectors, the size of the contiguous block */
+ unsigned char blocksize_bits;
+
+ if (!inode || !bh_result) {
+ LOG_ERROR_STR("ocfs_direct_IO_get_blocks: inode or bh_result is null");
+ return -EIO;
+ }
+ if (!inode_data_is_oin(inode)) {
+ LOG_ERROR_STR("ocfs_direct_IO_get_blocks: inode has no oin\n");
+ return -EIO;
+ }
+
+ oin = (ocfs_inode *) inode->u.generic_ip;
+ osb = (ocfs_super *) inode->i_sb->s_fs_info;
+ blocksize_bits = inode->i_sb->s_blocksize_bits;
+
+ /* make sure we're up to date... */
+ ocfs_down_sem (&(oin->main_res), true);
+ if (OIN_NEEDS_VERIFICATION (oin)) {
+ LOG_TRACE_STR ("ocfs_direct_IO_get_blocks: verify oin.");
+ status = ocfs_verify_update_oin (osb, oin);
+ if (status < 0) {
+ LOG_TRACE_STR ("ocfs_verify_update_oin failed");
+ ocfs_up_sem (&(oin->main_res));
+ ret = -EIO;
+ goto bail;
+ }
+ }
+ ocfs_up_sem (&(oin->main_res));
+
+ /* This function won't even be called if the request isn't all
+ * nicely aligned and of the right size, so there's no need
+ * for us to check any of that. */
+
+ vbo = (__s64) iblock << blocksize_bits;
+ vbo_max = vbo + ((__s64) max_blocks << blocksize_bits);
+
+ /* NOTE: create flag is set when we ?may? have to allocate some
+ blocks for the file. */
+ if (create && vbo_max > oin->alloc_size) {
+ /* WARNING: How much do we really want to extend the file?
+ is 'false' the right argument there? */
+ status = ocfs_extend_allocation(osb, oin, vbo_max, false);
+ if (status < 0) {
+ LOG_ERROR_STR("ocfs_direct_IO_get_blocks: failed to extend the file!");
+ goto bail;
+ }
+ set_new = 1;
+ }
+
+ /* This figure out the size of the next contiguous block, and
+ * our logical offset */
+ /* TODO: Try our damndest to give sizes in multiples of PAGE_SIZE */
+ status = ocfs_lookup_file_allocation(osb, oin, vbo, &lbo,
+ max_blocks, &new_size);
+
+ /* Do whatever we need to the buffer_head */
+ if (set_new) {
+ set_buffer_new(bh_result);
+ /* Do we really want to set bh_result->b_blocknr here too? */
+ bh_result->b_blocknr = lbo >> blocksize_bits;
+ } else {
+ clear_buffer_new(bh_result);
+ /* is the last argument here correct? */
+ map_bh(bh_result, inode->i_sb, lbo >> blocksize_bits);
+ }
+
+ /* make sure we don't map more than max_blocks blocks here as
+ that's all the kernel will handle at this point. */
+ if (new_size > max_blocks)
+ new_size = max_blocks;
+ bh_result->b_size = new_size << blocksize_bits;
+
+ ret = 0;
+bail:
+ return ret;
+}
+
+/*
* ocfs_direct_IO()
+ * used to be:
+ * static int ocfs_direct_IO (int rw,
+ * struct inode *inode,
+ * struct kiobuf *iobuf, unsigned long blocknr, int blocksize)
*
+ * now:
+ static int ocfs_direct_IO(int rw, struct kiocb *iocb,
+ const struct iovec *iov, loff_t offset,
+ unsigned long nr_segs)
+ * int (*direct_IO)(int, struct kiocb *, const struct iovec *iov,
+ * loff_t offset, unsigned long nr_segs);
*/
+static int ocfs_direct_IO(int rw, struct kiocb *iocb,
+ const struct iovec *iov, loff_t offset,
+ unsigned long nr_segs)
+{
+ struct file *file = iocb->ki_filp;
+ struct inode *inode = file->f_dentry->d_inode->i_mapping->host;
+ int ret;
+
+ LOG_ENTRY ();
+
+ /* blockdev_direct_IO checks alignment for us, using */
+ ret = blockdev_direct_IO (rw, iocb, inode, inode->i_sb->s_bdev, iov, offset, nr_segs, ocfs_direct_IO_get_blocks);
+
+ LOG_EXIT_LONG (ret);
+ return ret;
+} /* ocfs_direct_IO */
+
+#elif LINUX_VERSION_CODE >= LinuxVersionCode(2,4,10)
+/*
+ * ocfs_direct_IO()
+ *
+ */
static int ocfs_direct_IO (int rw,
#ifdef SUSE
struct file *filp,
@@ -1768,8 +2334,10 @@
printk(
"ocfs_rw_direct : brw_kiovec() %d\n",
err);
+ unmap_kiobuf(iobuf);
break;
}
+
unmap_kiobuf (iobuf);
if (err != iosize)
break;
@@ -1886,9 +2454,15 @@
* ocfs_create_or_open_file()
*
*/
+#ifdef LINUX_2_5
static int ocfs_create_or_open_file (struct inode *inode,
struct inode *dir, struct dentry *dentry,
+ int mode, ocfs_file ** newofile, kdev_t dev)
+#else
+static int ocfs_create_or_open_file (struct inode *inode,
+ struct inode *dir, struct dentry *dentry,
int mode, ocfs_file ** newofile, int dev)
+#endif
{
int create = (inode == NULL);
int status = 0;
@@ -1914,7 +2488,7 @@
OCFS_ASSERT (dir->i_sb);
OCFS_ASSERT (newofile);
- osb = ((ocfs_super *)(dir->i_sb->u.generic_sbp));
+ osb = (ocfs_super *) OCFS_GENERIC_SB_P(dir->i_sb);
OCFS_ASSERT (osb);
OCFS_ASSERT (osb->obj_id.type == OCFS_TYPE_OSB);
@@ -2036,8 +2610,13 @@
tempFileEnt->gid = current->fsgid;
tempFileEnt->prot_bits = mode & 0007777;
if (S_ISCHR (mode) || S_ISBLK (mode)) {
+#ifdef LINUX_2_5
+ tempFileEnt->dev_major = major (dev);
+ tempFileEnt->dev_minor = minor (dev);
+#else
tempFileEnt->dev_major = MAJOR (dev);
tempFileEnt->dev_minor = MINOR (dev);
+#endif
} else {
tempFileEnt->dev_major = MAJOR (dir->i_sb->s_dev);
tempFileEnt->dev_minor = MINOR (dir->i_sb->s_dev);
@@ -2155,24 +2734,14 @@
/* of how many concurrent openers at this point */
/* so take the oin->main_res so we won't need the i_sem */
-
+ up(&inode->i_sem);
+
oin_sem = &(oin->main_res);
+ if (!bAcquiredOIN) {
+ ocfs_down_sem (oin_sem, true);
+ bAcquiredOIN = true;
+ }
- if (!ocfs_down_sem (oin_sem, false)) {
- // eek! we cannot sit around and wait for main_res while we're holding i_sem
- bAcquiredOIN = false;
- } else {
- bAcquiredOIN = true;
- }
- up(&inode->i_sem);
-
- /* is this still a race!?!? */
- if (!bAcquiredOIN) {
- oin_sem = &(oin->main_res);
- ocfs_down_sem (oin_sem, true);
- bAcquiredOIN = true;
- }
-
if (oin->oin_flags & OCFS_OIN_DELETE_ON_CLOSE) {
LOG_TRACE_STR
("oin has DELETE_ON_CLOSE set, returning DELETE_PENDING");
@@ -2219,8 +2788,12 @@
ocfs_delete_all_extent_maps (oin);
if (mode & O_DIRECT)
OCFS_SET_FLAG(oin->oin_flags, OCFS_OIN_OPEN_FOR_DIRECTIO);
- else
+ else {
OCFS_CLEAR_FLAG(oin->oin_flags, OCFS_OIN_OPEN_FOR_DIRECTIO);
+ fsync_inode_buffers(inode);
+ if (inode->i_data.nrpages)
+ truncate_inode_pages(&inode->i_data, 0);
+ }
}
/* Allocate a new OFile */
@@ -2349,7 +2922,11 @@
* ocfs_mknod()
*
*/
+#ifdef LINUX_2_5
+static int ocfs_mknod (struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
+#else
static int ocfs_mknod (struct inode *dir, struct dentry *dentry, int mode, int dev)
+#endif
{
int status;
struct inode *inode;
@@ -2361,8 +2938,13 @@
atomic_inc (&dir->i_count);
+#ifdef LINUX_2_5
status = ocfs_create_or_open_file (NULL, dir, dentry, mode, &newofile,
+ to_kdev_t(dev));
+#else
+ status = ocfs_create_or_open_file (NULL, dir, dentry, mode, &newofile,
dev);
+#endif
if (status >= 0) {
ocfs_inode *oin;
@@ -2381,8 +2963,13 @@
fe.uid = current->fsuid;
fe.gid = current->fsgid;
fe.file_size = 0;
+#ifdef LINUX_2_5
+ fe.modify_time = fe.create_time = CURRENT_TIME.tv_sec;
+ inode->i_rdev = to_kdev_t(dev);
+#else
fe.modify_time = fe.create_time = CURRENT_TIME;
inode->i_rdev = dev;
+#endif
inode->i_ino = LO (oin->file_disk_off);
oin->inode = inode;
@@ -2422,8 +3009,11 @@
LOG_ENTRY_ARGS ("(0x%08x, 0x%08x, %d, '%*s')\n", dir, dentry, mode,
dentry->d_name.len, dentry->d_name.name);
+#ifdef LINUX_2_5
+ ret = ocfs_mknod (dir, dentry, mode | S_IFDIR, NODEV.value);
+#else
ret = ocfs_mknod (dir, dentry, mode | S_IFDIR, NODEV);
-
+#endif
LOG_EXIT_LONG (ret);
return ret;
} /* ocfs_mkdir */
@@ -2439,8 +3029,11 @@
LOG_ENTRY_ARGS ("(0x%08x, 0x%08x, %d, '%*s')\n", dir, dentry, mode,
dentry->d_name.len, dentry->d_name.name);
+#ifdef LINUX_2_5
+ ret = ocfs_mknod (dir, dentry, mode | S_IFREG, NODEV.value);
+#else
ret = ocfs_mknod (dir, dentry, mode | S_IFREG, NODEV);
-
+#endif
LOG_EXIT_LONG (ret);
return ret;
} /* ocfs_create */
@@ -2472,7 +3065,7 @@
}
- status = ocfs_read_file_entry (((ocfs_super *)(inode->i_sb->u.generic_sbp)), fe, off);
+ status = ocfs_read_file_entry((ocfs_super *) OCFS_GENERIC_SB_P(inode->i_sb), fe, off);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto bail;
@@ -2590,7 +3183,7 @@
if (oin)
ocfs_release_oin (oin, true);
else {
- osb = ((ocfs_super *)(inode->i_sb->u.generic_sbp));
+ osb = (ocfs_super *) OCFS_GENERIC_SB_P(inode->i_sb);
if (osb && ocfs_linux_get_inode_offset (inode, &off, NULL)) {
tmpstat = ocfs_lookup_sector_node (osb, off, &lockres);
if (tmpstat >= 0 && lockres) {
@@ -2635,17 +3228,12 @@
if (atomic_read (&old_inode->i_count) > 1) {
error = -EBUSY;
goto bail;
- } else if (atomic_read (&old_dentry->d_count) > 1) {
-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,4,18)
+ } else if (atomic_read (&old_dentry->d_count) > 2) {
shrink_dcache_parent (old_dentry);
- if (atomic_read (&old_dentry->d_count) > 1) {
+ if (atomic_read (&old_dentry->d_count) > 2) {
error = -EBUSY;
goto bail;
}
-#else
- error = -EBUSY;
- goto bail;
-#endif
}
if (new_inode) {
@@ -2730,7 +3318,11 @@
}
parentInode = dentry->d_parent->d_inode;
+#ifdef LINUX_2_5
+ error = ocfs_mknod (dir, dentry, S_IFLNK | S_IRWXUGO, NODEV.value);
+#else
error = ocfs_mknod (dir, dentry, S_IFLNK | S_IRWXUGO, NODEV);
+#endif
if (!error) {
int l = strlen (symname) + 1;
@@ -2827,7 +3419,7 @@
}
/* file */
- osb = ((ocfs_super *)(inode->i_sb->u.generic_sbp));
+ osb = (ocfs_super *) OCFS_GENERIC_SB_P(inode->i_sb);
oin = NULL;
if (ofile == NULL)
@@ -2857,6 +3449,9 @@
/* no hard links yet so who cares */
if (!atomic_read(&dentry->d_count)) {
if (oin->oin_flags & OCFS_OIN_OPEN_FOR_DIRECTIO) {
+ fsync_inode_buffers(inode);
+ if (inode->i_data.nrpages)
+ truncate_inode_pages(&inode->i_data, 0);
OCFS_CLEAR_FLAG(oin->oin_flags, OCFS_OIN_OPEN_FOR_DIRECTIO);
}
if (oin->oin_flags & OCFS_OIN_NEEDS_DELETION ||
@@ -2890,12 +3485,14 @@
*/
static int ocfs_flush (struct file *file)
{
+ int err = 0;
+
LOG_ENTRY_ARGS ("(0x%08x, '%*s')\n", file,
file->f_dentry->d_name.len, file->f_dentry->d_name.name);
- fsync_inode_buffers(file->f_dentry->d_inode);
- LOG_EXIT_LONG (0);
- return 0;
+ err = fsync_inode_buffers(file->f_dentry->d_inode);
+ LOG_EXIT_STATUS (err);
+ return (err < 0) ? -EIO : 0;
} /* ocfs_flush */
/*
@@ -2904,11 +3501,12 @@
*/
static int ocfs_sync_file (struct file *file, struct dentry *dentry, int datasync)
{
+ int err = 0;
LOG_ENTRY_ARGS ("(0x%08x, 0x%08x, %d, '%*s')\n", file, dentry, datasync,
dentry->d_name.len, dentry->d_name.name);
- fsync_inode_buffers(dentry->d_inode);
- LOG_EXIT_LONG (0);
- return 0;
+ err = fsync_inode_buffers(dentry->d_inode);
+ LOG_EXIT_STATUS (err);
+ return (err < 0) ? -EIO : 0;
} /* ocfs_sync_file */
/*
@@ -2919,7 +3517,11 @@
{
LOG_ENTRY_ARGS ("(0x%08x)\n", sb);
+#ifdef LINUX_2_5
+ sync_blockdev(sb->s_bdev);
+#else
fsync_no_super (sb->s_dev);
+#endif
LOG_TRACE_STR ("put super... do nothing! DONE!!!!");
MOD_DEC_USE_COUNT;
@@ -2955,11 +3557,11 @@
pos = filp->f_pos;
inode = filp->f_dentry->d_inode;
sb = inode->i_sb;
- if (!sb->u.generic_sbp) {
+ if (!(OCFS_GENERIC_SB_P(sb))) {
LOG_TRACE_STR ("Invalid OSB");
goto bail;
}
- osb = ((ocfs_super *)(sb->u.generic_sbp));
+ osb = (ocfs_super *) OCFS_GENERIC_SB_P(sb);
if (!ocfs_linux_get_inode_offset (inode, &rootOff, &oin)) {
LOG_TRACE_STR ("Inode has no OIN");
@@ -3086,7 +3688,11 @@
if (oin == osb->oin_root_dir) {
LOG_TRACE_STR
("this is the root inode, doing cleanup now!");
+#ifdef LINUX_2_5
+ sync_blockdev (inode->i_sb->s_bdev);
+#else
fsync_no_super (inode->i_sb->s_dev);
+#endif
LOG_TRACE_STR ("syncing past root inode");
LOG_TRACE_STR ("calling dismount");
ocfs_dismount_volume (inode->i_sb);
@@ -3110,7 +3716,7 @@
ocfs_lock_res *lockres = NULL;
ocfs_super *osb;
- osb = ((ocfs_super *)(inode->i_sb->u.generic_sbp));
+ osb = (ocfs_super *) OCFS_GENERIC_SB_P(inode->i_sb);
if (ocfs_linux_get_inode_offset (inode, &fileOff, NULL)) {
if (!ocfs_lookup_sector_node (osb, fileOff, &lockres)) {
@@ -3175,7 +3781,7 @@
LOG_ENTRY_ARGS ("(0x%08x, '%*s')\n", dentry,
dentry->d_name.len, dentry->d_name.name);
- osb = ((ocfs_super *)(inode->i_sb->u.generic_sbp));
+ osb = (ocfs_super *) OCFS_GENERIC_SB_P(inode->i_sb);
if (!dentry->d_parent || !dentry->d_parent->d_inode) {
LOG_ERROR_STR ("bad inode or root inode");
@@ -3292,7 +3898,53 @@
return error;
} /* ocfs_setattr */
+#ifdef LINUX_2_5
/*
+ * ocfs_getattr() (Linux 2.5 version)
+ *
+ */
+static int ocfs_getattr (struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
+{
+ struct inode *inode;
+ struct super_block *sb;
+ ocfs_super *osb;
+ int err = -1;
+
+ LOG_ENTRY();
+
+ if (!dentry || !stat)
+ goto bail;
+
+ inode = dentry->d_inode;
+ if (!inode)
+ goto bail;
+ sb = dentry->d_inode->i_sb;
+ osb = ((ocfs_super *) sb->s_fs_info);
+
+ stat->dev = inode->i_sb->s_dev;
+ stat->ino = inode->i_ino;
+ stat->mode = inode->i_mode;
+ stat->nlink = inode->i_nlink;
+ stat->uid = inode->i_uid;
+ stat->gid = inode->i_gid;
+ stat->rdev = kdev_t_to_nr(inode->i_rdev);
+ stat->atime = inode->i_atime;
+ stat->mtime = inode->i_mtime;
+ stat->ctime = inode->i_ctime;
+ stat->size = inode->i_size;
+ stat->blocks = inode->i_blocks;
+
+ /* We set the blksize from the cluster size for performance */
+ stat->blksize = (__u32) osb->vol_layout.cluster_size;
+
+ err = 0;
+ bail:
+ LOG_EXIT_LONG (err);
+ return err;
+} /* ocfs_getattr */
+
+#else
+/*
* ocfs_getattr()
*
*/
@@ -3310,18 +3962,21 @@
if (inode == NULL || !inode_data_is_oin (inode))
goto bail;
oin = ((ocfs_inode *)inode->u.generic_ip);
- if (oin == ((ocfs_super *)(sb->u.generic_sbp))->oin_root_dir)
+ if (oin == ((ocfs_super *)(OCFS_GENERIC_SB_P(sb)))->oin_root_dir)
goto bail;
if (oin != NULL) {
+ ocfs_down_sem (&(oin->main_res), true);
status = ocfs_verify_update_oin (oin->osb, oin);
if (status < 0)
LOG_ERROR_STATUS (status);
+ ocfs_up_sem (&(oin->main_res));
}
bail:
LOG_EXIT_LONG (0);
return 0;
} /* ocfs_getattr */
+#endif
/*
* ocfs_dentry_revalidate()
@@ -3330,6 +3985,7 @@
static int ocfs_dentry_revalidate (struct dentry *dentry, int flags)
{
int ret = 0; /* if all else fails, just return false */
+ int tmpstat = 0;
ocfs_file_entry *fe = NULL;
struct inode *inode;
ocfs_inode *oin;
@@ -3342,7 +3998,7 @@
dentry->d_name.len, dentry->d_name.name);
if ((inode = dentry->d_inode) == NULL ||
- (osb = (ocfs_super *)(inode->i_sb->u.generic_sbp)) == NULL)
+ (osb = (ocfs_super *)(OCFS_GENERIC_SB_P(inode->i_sb))) == NULL)
goto bail;
if (osb->publ_map == (1 << osb->node_num)) {
@@ -3370,8 +4026,11 @@
/* TODO: optimize */
ocfs_down_sem (&(oin->main_res), true);
oin->needs_verification = true;
+ tmpstat = ocfs_verify_update_oin(osb, oin);
+ if (tmpstat < 0)
+ LOG_ERROR_STATUS (tmpstat);
ocfs_up_sem (&(oin->main_res));
- UPDATE_OIN (oin);
+
goto bail;
}
@@ -3406,7 +4065,11 @@
} else {
args.offset = fe->this_sector;
args.entry = fe;
+#ifdef LINUX_2_5
+ ocfs_read_locked_inode (inode, (void *) &args);
+#else
ocfs_read_inode2 (inode, (void *) &args);
+#endif
ret = 1;
}
@@ -3436,7 +4099,7 @@
if (inode == NULL || !inode_data_is_oin (inode))
goto bail;
oin = ((ocfs_inode *)inode->u.generic_ip);
- if (oin == (ocfs_super *)(dentry->d_inode->i_sb->u.generic_sbp)->oin_root_dir)
+ if (oin == (ocfs_super *)(OCFS_GENERIC_SB_P(dentry->d_inode->i_sb))->oin_root_dir)
goto bail;
if (oin != NULL)
// if (OIN_NEEDS_VERIFICATION(oin))
@@ -3635,7 +4298,11 @@
LOG_ENTRY ();
+#ifdef LINUX_2_5
+ bh = sb_bread(sb, 0);
+#else
bh = bread (sb->s_dev, 0, 512);
+#endif
hdr = (ocfs_vol_disk_hdr *) bh->b_data;
hdr->excl_mount = val;
mark_buffer_dirty (bh);
@@ -3673,12 +4340,16 @@
}
ocfs_parse_options (data, &uid, &gid, &c, &reclaim_id);
- osb = (ocfs_super *)(sb->u.generic_sbp);
+ osb = (ocfs_super *) OCFS_GENERIC_SB_P(sb);
if (!c) {
osb->cache_fs = false;
ocfs_set_exclusive_mount_flag (sb, NOT_MOUNTED_EXCLUSIVE);
+#ifdef LINUX_2_5
+ sync_blockdev (sb->s_bdev);
+#else
fsync_no_super (sb->s_dev);
+#endif
LOG_ERROR_STR ("remounted with nocache");
ret = 0;
goto bail;
@@ -3724,7 +4395,12 @@
LOG_TRACE_ARGS ("publishmap = %u.%u\n", osb->publ_map);
if (osb->publ_map == (1 << osb->node_num)) {
ocfs_set_exclusive_mount_flag (sb, (osb->node_num));
+ //osb->exclusive = true;
+#ifdef LINUX_2_5
+ sync_blockdev (sb->s_bdev);
+#else
fsync_no_super (sb->s_dev);
+#endif
LOG_ERROR_STR ("remount synced device");
ret = 0;
} else {
@@ -3750,3 +4426,7 @@
module_init (ocfs_driver_entry);
module_exit (ocfs_driver_exit);
MODULE_LICENSE ("GPL");
+#ifdef LINUX_2_5
+MODULE_AUTHOR("Oracle Corporation");
+MODULE_DESCRIPTION("Oracle Clustered FileSystem");
+#endif
Modified: trunk/ocfs2/Linux/ocfsmount.c
===================================================================
--- trunk/ocfs2/Linux/ocfsmount.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Linux/ocfsmount.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -59,8 +59,11 @@
LOG_ERROR_STATUS (status = -ENOMEM);
goto leave;
}
-
+#ifdef LINUX_2_5
+ bh = sb_bread (sb, 0);
+#else
bh = bread (sb->s_dev, 0, 512);
+#endif
if (!bh) {
LOG_ERROR_STATUS (status = -ENOMEM);
goto leave;
@@ -68,7 +71,11 @@
memcpy (*buffer, bh->b_data, 512);
bforget (bh);
+#ifdef LINUX_2_5
+ bh = sb_bread (sb, 1);
+#else
bh = bread (sb->s_dev, 1, 512);
+#endif
if (!bh) {
LOG_ERROR_STATUS (status = -ENOMEM);
goto leave;
@@ -82,7 +89,6 @@
return status;
} /* ocfs_read_disk_header */
-
/*
* is_exclusive_node_alive()
*
@@ -101,7 +107,11 @@
off += (__u64) hdr->excl_mount;
/* get the timestamp from the publish sector */
+#ifdef LINUX_2_5
+ bh = __bread (sb->s_bdev, (__u32) off, 512);
+#else
bh = bread (sb->s_dev, (__u32) off, 512);
+#endif
if (!bh) {
LOG_ERROR_ARGS ("failed to read block: %u", (__u32) off);
return true;
@@ -117,7 +127,11 @@
ocfs_sleep (5000); /* 5 seconds */
/* get the timestamp from the publish sector */
+#ifdef LINUX_2_5
+ bh = __bread (sb->s_bdev, (__u32) off, 512);
+#else
bh = bread (sb->s_dev, (__u32) off, 512);
+#endif
if (!bh) {
LOG_ERROR_ARGS ("failed to read block: %u", (__u32) off);
return true;
@@ -211,7 +225,9 @@
goto leave;
}
memset(osb, 0, sizeof(ocfs_super));
- sb->u.generic_sbp = (void *)osb;
+
+ OCFS_GENERIC_SB_P(sb) = (void *) osb;
+
osb->sb = sb;
osb->reclaim_id = reclaim_id;
@@ -332,12 +348,17 @@
LOG_ENTRY_ARGS ("(0x%08x)\n", sb);
- if (sb == NULL || sb->u.generic_sbp == NULL) {
+ if (sb == NULL) {
LOG_ERROR_STATUS (status = -EFAIL);
goto leave;
}
- osb = (ocfs_super *)(sb->u.generic_sbp);
+ osb = (ocfs_super *) OCFS_GENERIC_SB_P(sb);
+
+ if ( osb == NULL) {
+ LOG_ERROR_STATUS (status = -EFAIL);
+ goto leave;
+ }
rootoin = osb->oin_root_dir;
ocfs_down_sem (&(osb->osb_res), true);
@@ -358,7 +379,11 @@
LOG_TRACE_ARGS ("osb=0x%08x rootoin=0x%08x offset=%u.%u\n", osb,
rootoin, rootoin->file_disk_off);
+#ifdef LINUX_2_5
+ sync_blockdev (sb->s_bdev);
+#else
fsync_no_super (sb->s_dev);
+#endif
ocfs_release_oin (rootoin, true);
@@ -423,6 +448,9 @@
ocfs_safefree (p);
}
+ printk ("ocfs: Unmounting device (%u,%u) in node %d\n",
+ MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev), osb->node_num);
+
ocfs_delete_osb (osb);
ocfs_safefree (osb);
sb->s_dev = 0;
Modified: trunk/ocfs2/Linux/ocfsport.c
===================================================================
--- trunk/ocfs2/Linux/ocfsport.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Linux/ocfsport.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -154,10 +154,26 @@
* ocfs_daemonize()
*
*/
+#ifdef LINUX_2_5
+/* yes, len is unused but kept here for backwards compatibility. */
void ocfs_daemonize (char *name, int len)
{
sigset_t tmpsig;
+ daemonize (name);
+
+ /* Unblock SIGKILL, SIGSTOP, SIGHUP and SIGINT */
+ sigemptyset(&tmpsig);
+ sigaddsetmask(&tmpsig, SHUTDOWN_SIGS);
+ sigprocmask(SIG_UNBLOCK, &tmpsig, NULL);
+
+ return;
+} /* ocfs_daemonize */
+#else
+void ocfs_daemonize (char *name, int len)
+{
+ sigset_t tmpsig;
+
daemonize ();
reparent_to_init ();
@@ -169,16 +185,24 @@
}
/* Block all signals except SIGKILL, SIGSTOP, SIGHUP and SIGINT */
+#ifdef HAVE_NPTL
+ spin_lock_irq (¤t->sighand->siglock);
+ tmpsig = current->blocked;
+ siginitsetinv (¤t->blocked, SHUTDOWN_SIGS);
+ recalc_sigpending ();
+ spin_unlock_irq (¤t->sighand->siglock);
+#else
spin_lock_irq (¤t->sigmask_lock);
tmpsig = current->blocked;
siginitsetinv (¤t->blocked, SHUTDOWN_SIGS);
recalc_sigpending (current);
spin_unlock_irq (¤t->sigmask_lock);
+#endif
return;
} /* ocfs_daemonize */
+#endif
-
/*
* ocfs_sleep()
*
@@ -428,7 +452,11 @@
*/
void ocfs_flush_cache (ocfs_super * osb)
{
+#ifdef LINUX_2_5
+ sync_blockdev (osb->sb->s_bdev);
+#else
fsync_no_super (osb->sb->s_dev);
+#endif
} /* ocfs_flush_cache */
@@ -447,11 +475,12 @@
/* prefetch has been declared to allow to build in debug mode */
#ifdef DEBUG
#ifndef ARCH_HAS_PREFETCH
-inline void prefetch (const void *x)
-{;
-}
+inline void prefetch (const void *x) {;}
#endif
+#ifndef ARCH_HAS_PREFETCHW
+inline void prefetchw(const void *x) {;}
#endif
+#endif
#endif /* !USERSPACE_TOOL */
Modified: trunk/ocfs2/Makefile
===================================================================
--- trunk/ocfs2/Makefile 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Makefile 2003-09-03 01:05:18 UTC (rev 10)
@@ -38,24 +38,25 @@
DEFINES += -DTRACE
endif
+ifdef HAVE_NPTL
+DEFINES += -DHAVE_NPTL
+endif
+
ifeq ($(KVER),vmware)
KERNELINC = /usr/src/linux-2.4/include
endif
ifeq ($(KVER),smp)
- DEFINES += -D__MODULE_KERNEL_i686=1
DEFINES += -D__BOOT_KERNEL_ENTERPRISE=0
DEFINES += -D__BOOT_KERNEL_SMP=1
DEFINES += -D__BOOT_KERNEL_UP=0
endif
ifeq ($(KVER),ent)
- DEFINES += -D__MODULE_KERNEL_i686=1
DEFINES += -D__BOOT_KERNEL_ENTERPRISE=1
DEFINES += -D__BOOT_KERNEL_SMP=0
DEFINES += -D__BOOT_KERNEL_UP=0
endif
ifeq ($(KVER),up)
- DEFINES += -D__MODULE_KERNEL_i686=1
DEFINES += -D__BOOT_KERNEL_ENTERPRISE=0
DEFINES += -D__BOOT_KERNEL_SMP=0
DEFINES += -D__BOOT_KERNEL_UP=1
@@ -63,15 +64,21 @@
INCLUDES = -ICommon/inc -ILinux/inc -I$(KERNELINC) -I$(GCCINC)
-CFLAGS=$(OPTS) -nostdinc -fomit-frame-pointer $(MODVERSIONS) $(WARNINGS)
+CFLAGS=$(OPTS) -nostdinc -fno-strict-aliasing -fno-common -fomit-frame-pointer \
+ $(MODVERSIONS) $(WARNINGS)
LDADD=-nostdlib
ifeq ($(OCFS_PROCESSOR),x86_64)
- DEFINES += -Dx86_64
DEFINES += -DSUSE -D__OPTIMIZE__
CFLAGS += -mcmodel=kernel
CFLAGS += -O0
-else
+endif
+ifeq ($(OCFS_PROCESSOR),ia64)
+ DEFINES += -D__OPTIMIZE__
+ CFLAGS += -O0
+endif
+ifeq ($(OCFS_PROCESSOR),i686)
+ DEFINES += -D__ILP32__
CFLAGS += -O2
endif
@@ -106,7 +113,11 @@
ifeq ($(OCFS_PROCESSOR),x86_64)
SUPPORT =
-else
+endif
+ifeq ($(OCFS_PROCESSOR),ia64)
+ SUPPORT =
+endif
+ifeq ($(OCFS_PROCESSOR),i686)
SUPPORT = Support/divdi3.c
endif
Modified: trunk/ocfs2/Support/divdi3.c
===================================================================
--- trunk/ocfs2/Support/divdi3.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/ocfs2/Support/divdi3.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -86,8 +86,7 @@
#ifdef __i386__
#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- __asm__ ("subl %5,%1
- sbbl %3,%0" \
+ __asm__ ("subl %5,%1\n\tsbbl %3,%0" \
: "=r" ((USItype) (sh)), \
"=&r" ((USItype) (sl)) \
: "0" ((USItype) (ah)), \
Modified: trunk/redhat/ocfs-2.4.9-e.spec.in
===================================================================
--- trunk/redhat/ocfs-2.4.9-e.spec.in 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/redhat/ocfs-2.4.9-e.spec.in 2003-09-03 01:05:18 UTC (rev 10)
@@ -1,5 +1,5 @@
#
-# Spec file for cvsman
+# Spec file for ocfs
#
# Macros
Modified: trunk/redhat/ocfs.init
===================================================================
--- trunk/redhat/ocfs.init 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/redhat/ocfs.init 2003-09-03 01:05:18 UTC (rev 10)
@@ -2,7 +2,7 @@
# init fragment for ocfs
#
# chkconfig: 2345 24 20
-# description: Run cvsman update at system boot
+# description: Setup OCFS environment
#
# Note that the start priority is 24. This is precisely one less than
@@ -14,49 +14,141 @@
# from trying to mount before this script has run.
#
+
+
+# Source init.d functions
+. /etc/init.d/functions
+
+# Source networking configuration
+. /etc/sysconfig/network
+
+
LOAD_OCFS=/sbin/load_ocfs
-test -x "$LOAD_OCFS" || exit 0
+if ! test -x "$LOAD_OCFS"; then
+ echo -n "Checking for /sbin/load_ocfs: "
+ failure $"load_ocfs does not exist;"
+ echo
+ exit 1
+fi
-test -r /etc/ocfs.conf || exit 0
-
KVER="`uname -r`"
case "$KVER" in
-2.4.9-e.*enterprise)
- MODPATH="/lib/modules/${KVER}/kernel/drivers/addon/ocfs"
- OBJPATH="/lib/modules/2.4.9-e-enterprise-ABI/ocfs"
+2.4.9-e.*)
+ BASE_VER=2.4.9-e
;;
-2.4.9-e.*smp)
- MODPATH="/lib/modules/${KVER}/kernel/drivers/addon/ocfs"
- OBJPATH="/lib/modules/2.4.9-e-smp-ABI/ocfs"
+2.4.18-e.*)
+ BASE_VER=2.4.18-e
;;
-2.4.9-e.*summit)
- MODPATH="/lib/modules/${KVER}/kernel/drivers/addon/ocfs"
- OBJPATH="/lib/modules/2.4.9-e-summit-ABI/ocfs"
+2.4.20-ent.*) # Will go away with RHEL3 GA
+ BASE_VER=2.4.20-ent
;;
-2.4.9-e.*)
- MODPATH="/lib/modules/${KVER}/kernel/drivers/addon/ocfs"
- OBJPATH="/lib/modules/2.4.9-e-ABI/ocfs"
+2.4.21-ent.*)
+ BASE_VER=2.4.21-ent
;;
*)
- # Not a supported kernel
- exit 0
+ echo -n "Checking for Red Hat enterprise kernel: "
+ failure $"Kernel ${KVER} is not a Red Hat enterprise release;"
+ echo
+ exit 1
;;
esac
-test -r "$OBJPATH/ocfs.o" || exit 0
+EVER="${KVER#${BASE_VER}}"
+ETYPE=""
+case "$EVER" in
+*hugemem)
+ ETYPE=hugemem
+ ;;
+*bigmem) # Will go away with RHEL3 GA
+ if test "$BASE_VER" = "2.4.20-ent"
+ then
+ ETYPE=bigmem
+ fi
+ ;;
+*smp)
+ ETYPE=smp
+ ;;
+*enterprise)
+ if test "$BASE_VER" = "2.4.9-e"
+ then
+ ETYPE=enterprise
+ fi
+ ;;
+*summit)
+ if test "$BASE_VER" = "2.4.9-e"
+ then
+ ETYPE=summit
+ fi
+ ;;
+*[0-9])
+ ETYPE=up
+ ;;
+esac
-# Source init.d functions
-. /etc/init.d/functions
+if test -z "$ETYPE"
+then
+ echo -n "Checking for Red Hat enterprise kernel: "
+ failure $"Kernel ${KVER} is not a Red Hat enterprise release;"
+ echo
+ exit 1
+fi
-# Source networking configuration
-. /etc/sysconfig/network
+EVER="${EVER%${ETYPE}}"
+EVER="${EVER#.}"
+case "$EVER" in
+[1-9])
+ ;;
+[1-9][0-9])
+ ;;
+[1-9][0-9][0-9])
+ ;;
+*)
+ echo -n "Checking for Red Hat enterprise kernel: "
+ failure $"Kernel ${KVER} is not a Red Hat enterprise release;"
+ echo
+ exit 1
+ ;;
+esac
+# This is for path happiness...
+if test "$ETYPE" != "up"
+then
+ ETYPE="${ETYPE}-"
+fi
+MODPATH="/lib/modules/${KVER}/kernel/drivers/addon/ocfs"
+case "$BASE_VER" in
+2.4.9-e)
+ if test "${EVER}" -gt 23
+ then
+ OBJPATH="/lib/modules/2.4.9-e-${ETYPE}ABI/ocfs"
+ else
+ OBJPATH="/lib/modules/2.4.9-e-${ETYPE}ABI/ocfs-noaio"
+ fi
+ ;;
+2.4.18-e)
+ OBJPATH="/lib/modules/${BASE_VER}-${ETYPE}ABI/ocfs"
+ ;;
+2.4.20-ent) # Will go away with RHEL3 GA
+ OBJPATH="/lib/modules/${BASE_VER}-${ETYPE}ABI/ocfs"
+ ;;
+2.4.21-ent)
+ OBJPATH="/lib/modules/${BASE_VER}-${ETYPE}ABI/ocfs"
+ ;;
+*)
+ echo -n "Checking for Red Hat enterprise kernel: "
+ failure $"Can't get here! (Kernel ${KVER});"
+ echo
+ exit 1
+esac
+test -r "$OBJPATH/ocfs.o" || exit 0
+
+
fstab_check()
{
# Are there any volumes to mount?
ANY="`awk '/^[ ]*#/{next}$4 ~ /^noauto$|^noauto,|,noauto$/{next}$3 == "ocfs"{print $2}' /etc/fstab 2>/dev/null`"
- test -z "$ANY" && exit 0
+ test -z "$ANY" && return
# Check if anything is missing netdev
ANY="`awk '/^[ ]*#/{next}$4 ~ /^noauto$|^noauto,|,noauto$/{next}$4 ~ /^_netdev$|^_netdev,|,_netdev$/{next}$3 == "ocfs"{print $2}' /etc/fstab 2>/dev/null`"
@@ -65,10 +157,25 @@
module_link()
{
- # Assume any symlink is OK - caveat emptor for non-RPM users
- test -L "${MODPATH}/ocfs.o" && return
+ if test -L "${MODPATH}/ocfs.o"
+ then
+ LINKTARGET="`ls -l "${MODPATH}/ocfs.o" 2>/dev/null | sed -e 's/^.* -> //'`"
+ case "${LINKTARGET}" in
+ ${OBJPATH}/ocfs.o)
+ return
+ ;;
+ ${OBJPATH%-noaio}/ocfs.o)
+ ;;
+ ${OBJPATH}-noaio/ocfs.o)
+ ;;
+ *)
+ return
+ ;;
+ esac
+ rm -f "${MODPATH}/ocfs.o"
+ fi
- echo -n "Linking OCFS module into the module path"
+ echo -n "Linking OCFS module into the module path "
# Same deal for modules that are physically there
if test -f "${MODPATH}/ocfs.o" ; then
@@ -87,7 +194,7 @@
echo "Warning: Moving ancient ocfs.o out of the way"
mv -f "${MODPATH}/ocfs.o" "${MODPATH}/ocfs.o.preABI" >/dev/null 2>&1
if test "$?" != 0 ; then
- failure $"Unable to move ancient ocfs module out of the way"
+ failure $"Unable to move ancient ocfs module out of the way;"
echo
exit 1
fi
@@ -96,13 +203,13 @@
if test ! -d "$MODPATH" ; then
if test -e "${MODPATH}"; then
- failure $"Path \"${MODPATH}\" already exists, but is not a directory"
+ failure $"Path \"${MODPATH}\" already exists, but is not a directory;"
echo
exit 1
else
mkdir -p "$MODPATH" >/dev/null 2>&1
if test $? != 0; then
- failure $"Unable to create directory \"${MODPATH}\""
+ failure $"Unable to create directory \"${MODPATH}\";"
echo
exit 1
fi
@@ -111,7 +218,7 @@
ln -s "${OBJPATH}/ocfs.o" "${MODPATH}/ocfs.o" >/dev/null 2>&1
if test $? != 0; then
- failure $"Unable to create symbolic link \"${MODPATH}/ocfs.o\""
+ failure $"Unable to create symbolic link \"${MODPATH}/ocfs.o\";"
echo
exit 1
fi
@@ -123,18 +230,25 @@
case "$1" in
start)
module_link
+
fstab_check
- echo -n $"Loading OCFS:"
+ echo -n $"Loading OCFS: "
+ if ! test -r /etc/ocfs.conf; then
+ failure $"No configuration file /etc/ocfs.conf; loading OCFS;"
+ echo
+ exit 1
+ fi
+
if test "$NETWORKING" = "no"; then
- failure $"Network is unavailable"
+ failure $"Network is unavailable; loading OCFS;"
echo
exit 1
fi
if grep '^ocfs ' /proc/modules >/dev/null 2>&1; then
- success $"OCFS is already loaded"
+ success $"OCFS is already loaded;"
echo
exit 0
fi
@@ -146,6 +260,23 @@
;;
+ link)
+ module_link
+ ;;
+
+ status)
+ echo -n $"Checking if OCFS is loaded: "
+ if grep '^ocfs ' /proc/modules >/dev/null 2>&1; then
+ success $"OCFS is already loaded; status"
+ echo
+ exit 0
+ else
+ failure $"OCFS is not loaded; status"
+ echo
+ exit 1
+ fi
+ ;;
+
stop|force-reload|restart)
RETVAL=0
;;
Modified: trunk/tools/debugocfs/Makefile
===================================================================
--- trunk/tools/debugocfs/Makefile 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/debugocfs/Makefile 2003-09-03 01:05:18 UTC (rev 10)
@@ -2,23 +2,27 @@
include $(TOPDIR)/Preamble.make
-BIN_PROGRAMS = debugocfs fsck.ocfs classes.c parse ocfstranslate
+BIN_PROGRAMS = debugocfs fsck.ocfs fsck.ocfs.ro classes.c parse ocfstranslate extfinder
LIBRARIES = libdebugocfs.a
WARNINGS = -Wall -Wstrict-prototypes -Wno-format -Wmissing-prototypes \
-Wmissing-declarations
-CFLAGS = $(WARNINGS)
+CFLAGS = -fno-strict-aliasing $(WARNINGS)
INCLUDES = -I. -I$(TOPDIR)/ocfs2/Common/inc -I$(TOPDIR)/ocfs2/Linux/inc
GLIB_LIBS = `glib-config --libs`
GLIB_CFLAGS = `glib-config --cflags`
-DEFINES = -DLINUX -DUSERSPACE_TOOL -DDISABLE_DEVICE_SIZE_CHECK -DREADONLY
+DEFINES = -DLINUX -DUSERSPACE_TOOL -DSHOW_INVALID_VALUES
ifeq ($(OCFS_PROCESSOR),x86_64)
- DEFINES += -Dx86_64
CFLAGS += -O0 -m64
-else
+endif
+ifeq ($(OCFS_PROCESSOR),ia64)
+ CFLAGS += -O0
+endif
+ifeq ($(OCFS_PROCESSOR),i686)
+ DEFINES += -D__ILP32__
CFLAGS += -O2
endif
@@ -35,11 +39,11 @@
DIST_FILES = debugocfs.c debugocfs.h libdebugocfs.h test.c print.c dummy.c dummy.h libdebugocfs.c io.c main.c ocfsmalloc.c ocfsmalloc.h
KERNEL_OBJS = ocfsgensysfile.o ocfsbitmap.o ocfsgenalloc.o ocfsport.o
-GLIB_OBJS = fsck.o verify.o fsck_io.o class_print.o class_rw.o fsck_print.o sig.o layout.o defaults.o ocfsmalloc.o
+GLIB_OBJS = verify.o fsck_io.o class_print.o class_rw.o fsck_print.o sig.o layout.o defaults.o ocfsmalloc.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
-VERSION_SRC = fsck.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
+VERSION_SRC = ver.c
VERSION_PREFIX = FSCK
vpath ocfsgensysfile.c $(TOPDIR)/ocfs2/Common
@@ -47,7 +51,7 @@
vpath ocfsconst.h $(TOPDIR)/ocfs2/Common/inc
vpath ocfs%.c $(TOPDIR)/ocfs2/Linux
-extfinder: extfinder.o
+extfinder: extfinder.o ocfsmalloc.o
$(LINK) $(GTK_LIBS) -lglib
test: test.o libdebugocfs.a
@@ -68,13 +72,21 @@
$(KERNEL_OBJS): %.o: %.c
$(CC) $(CFLAGS) $(INCLUDES) $(DEFINES) -I$(GCCINC) -o $@ -c $<
+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 $(KERNEL_OBJS) $(GLIB_OBJS) dummy.o ../format/ocfsheartbeat.o
- $(LINK) $(GLIB_LIBS)
+fsck.ocfs: classes.o $(KERNEL_OBJS) fsck.o $(GLIB_OBJS) dummy.o ../format/ocfsheartbeat.o ver.o
+ $(LINK) -static $(GLIB_LIBS)
+fsck.ocfs.ro: classes.o $(KERNEL_OBJS) fsckro.o $(GLIB_OBJS) dummy.o ../format/ocfsheartbeat.o ver.o
+ $(LINK) -static $(GLIB_LIBS)
+
dbg.o: debugocfs.c
$(CC) $(CFLAGS) $(INCLUDES) $(GTK_CFLAGS) -DLIBDEBUGOCFS $(DEFINES) -o $@ -c $<
@@ -89,7 +101,7 @@
translate.o: translate.c
$(CC) $(CFLAGS) $(INCLUDES) $(GLIB_CFLAGS) $(DEFINES) -o $@ -c $<
-ocfstranslate: translate.o classes.o class_rw.o class_print.o
+ocfstranslate: translate.o classes.o class_rw.o class_print.o ocfsmalloc.o
$(LINK) $(GLIB_LIBS)
Added: trunk/tools/debugocfs/README.txt
===================================================================
--- trunk/tools/debugocfs/README.txt 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/debugocfs/README.txt 2003-09-03 01:05:18 UTC (rev 10)
@@ -0,0 +1,33 @@
+This is an updated version of fsck.ocfs which uses direct IO to bypass
+any buffercache caching that may have taken place on the ocfs device.
+
+ ********************************************
+ ********* W A R N I N G ! ! ! *********
+ ********************************************
+
+You should not use this utility unless you know exactly what you are
+doing or are instructed to do so by support personnel. This utility can
+modify filesystem structures. Data loss and filesystem corruption may
+occur with improper use of this utility!!!
+
+If you have reason to believe that your ocfs filesystem has been
+corrupted, you may run this utility with the "-N" option to ensure that
+no writes will take place. The output from this command can be sent to
+support for debugging purposes. Again, the only safe command to run
+with this utility is:
+
+ fsck.ocfs -N /dev/device
+
+You may also safely run the fsck.ocfs.ro utility. This is an
+exclusively readonly version of fsck.ocfs that only reports problems.
+This may be run on a live volume regardless of any mounted nodes. Keep
+in mind that at certain points in time their may be metadata on the
+filesystem that is in flux and you may see spurious errors as a result.
+You may want to run the command multiple times to get a more accurate
+picture of what errors may actually exist on the volume. However, if
+fsck.ocfs.ro checks out cleanly, there is no need to run the readwrite
+version. Run the command like this:
+
+ fsck.ocfs.ro /dev/device
+
+
Modified: trunk/tools/debugocfs/class_print.c
===================================================================
--- trunk/tools/debugocfs/class_print.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/debugocfs/class_print.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -3,7 +3,7 @@
*
* generic print for structures in ocfs file system check utility
*
- * Copyright (C) 2003 Oracle Corporation. All rights reserved.
+ * Copyright (C) 2003 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.
@@ -41,7 +41,7 @@
if (ret != 0 || bad)
inval_str = "<INVALID VALUE> ";
- fprintf(out, "%s: %s%s", mbr->name, inval_str, gs==NULL ? "" : gs->str);
+ fprintf(out, "%s: %s%s", mbr->name, inval_str, gs==NULL ? "NULL" : gs->str);
if (gs)
g_string_free(gs, true);
@@ -57,25 +57,27 @@
int ret = 0, i, bad;
bad = 0;
- fprintf(out, "%s\n=================================\n", cl->name);
+ fprintf(out, "\n%s\n=================================\n", cl->name);
for (i=0; i<cl->num_members; i++)
{
- bool bad;
+ bool fail;
ocfs_class_member *mbr = &(cl->members[i]);
- bad = (g_hash_table_lookup(ht, GINT_TO_POINTER(i)) != NULL);
+ fail = (g_hash_table_lookup(ht, GINT_TO_POINTER(i)) != NULL);
if (num)
fprintf(out, "%3d. ", i+1);
- if (print_class_member(buf, cl, mbr, out, bad) != 0)
+ if (print_class_member(buf, cl, mbr, out, fail) != 0)
{
bad++;
ret = -1;
}
fprintf(out, "\n");
}
- if (ret)
+
+ if (ret == -1)
LOG_ERROR("%d bad fields total", bad);
+
return ret;
} /* _print_class */
Modified: trunk/tools/debugocfs/class_rw.c
===================================================================
--- trunk/tools/debugocfs/class_rw.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/debugocfs/class_rw.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -3,7 +3,7 @@
*
* reader-writer functions for each type
*
- * Copyright (C) 2003 Oracle Corporation. All rights reserved.
+ * Copyright (C) 2003 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.
@@ -834,12 +834,14 @@
// GID: __u32
int _gid_valid(void *top, typeinfo *info)
{
+#ifdef ARE_WE_SURE_WE_WANT_TO_DO_THIS
struct group *gr;
__u32 id = G_STRUCT_MEMBER(__u32, top, info->off);
gr = getgrgid(id);
if (gr == NULL)
return -1;
+#endif
return 0;
}
@@ -861,7 +863,7 @@
}
gr = getgrgid(id);
g_string_sprintf(*retval, "%u (%s)", id,
- gr ? gr->gr_name : "invalid group id");
+ gr ? gr->gr_name : "unknown group id");
return 0;
}
@@ -893,12 +895,14 @@
// UID: __u32
int _uid_valid(void *top, typeinfo *info)
{
+#ifdef ARE_WE_SURE_WE_WANT_TO_DO_THIS
struct passwd *pw;
__u32 id = G_STRUCT_MEMBER(__u32, top, info->off);
pw = getpwuid(id);
if (pw == NULL)
return -1;
+#endif
return 0;
}
@@ -919,7 +923,7 @@
}
pw = getpwuid(id);
g_string_sprintf(*retval, "%u (%s)", id,
- pw ? pw->pw_name : "invalid user id");
+ pw ? pw->pw_name : "unknown user id");
return 0;
}
@@ -1449,6 +1453,75 @@
info->array_size - 1);
}
+// HEX ARRAY: __u8[]
+int _hex_array_valid(void *top, typeinfo *info)
+{
+ return 0;
+}
+
+int _hex_array_to_string_u8(GString **retval, void *top, typeinfo *info)
+{
+ char *buf = NULL;
+ char *p;
+ int i;
+ __u8 *arr;
+
+ if (info->array_size <= 0)
+ return -1;
+ arr = G_STRUCT_MEMBER_P(top, info->off);
+ if (_char_array_valid(top, info) == -1)
+ {
+#ifdef SHOW_INVALID_VALUES
+ *retval = g_string_new("");
+ g_string_sprintf(*retval, "[ %X, ... ]", arr[0]);
+#endif
+ return -1;
+ }
+
+ if ((buf = malloc(2 * info->array_size + 1)) == NULL) {
+ LOG_ERROR("unable to allocate %d bytes of memory",
+ info->array_size + 1);
+ goto bail;
+ }
+
+ for (i = 0, p = buf; i < info->array_size; ++i, p += 2)
+ sprintf(p, "%2X", arr[i]);
+ buf[ 2 * info->array_size ] = '\0';
+ *retval = g_string_new(buf);
+
+ bail:
+ free(buf);
+ return 0;
+}
+
+int _string_to_hex_array_u8(char *newval, void *top, typeinfo *info)
+{
+ unsigned char *buf;
+ unsigned char tb[3];
+ int i;
+ unsigned char *p;
+
+ if (info->array_size <= 0)
+ return -1;
+
+ buf = G_STRUCT_MEMBER_P(top, info->off);
+
+ tb[2] = '\0';
+ for (i = 0, p = newval; i < info->array_size; ++i, ++p) {
+ tb[0] = *p;
+ tb[1] = *(++p);
+ buf[i] = strtoul(tb, NULL, 16);
+ }
+
+ return 0;
+}
+
+char * _get_hex_array_helptext(typeinfo *info)
+{
+ return g_strdup_printf("a hex string with maximum length %d",
+ info->array_size);
+}
+
// NUMBER RANGE: __s32 __u8 __u16 __u32 __u64
int _number_range_valid(void *top, typeinfo *info)
{
Modified: trunk/tools/debugocfs/classes.h
===================================================================
--- trunk/tools/debugocfs/classes.h 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/debugocfs/classes.h 2003-09-03 01:05:18 UTC (rev 10)
@@ -89,6 +89,7 @@
int _perms_valid(void *top, typeinfo *info);
int _syncflag_valid(void *top, typeinfo *info);
int _char_array_valid(void *top, typeinfo *info);
+int _hex_array_valid(void *top, typeinfo *info);
int _number_range_valid(void *top, typeinfo *info) ;
int _voteflag_array_valid(void *top, typeinfo *info);
@@ -158,6 +159,9 @@
int _char_array_to_string_u8(GString **retval, void *top, typeinfo *info);
int _string_to_char_array_u8(char *newval, void *top, typeinfo *info);
char * _get_char_array_helptext(typeinfo *info);
+int _hex_array_to_string_u8(GString **retval, void *top, typeinfo *info);
+int _string_to_hex_array_u8(char *newval, void *top, typeinfo *info);
+char * _get_hex_array_helptext(typeinfo *info);
int _number_range_to_string_s32(GString **retval, void *top, typeinfo *info);
int _string_to_number_range_s32(char *newval, void *top, typeinfo *info);
int _number_range_to_string_u8(GString **retval, void *top, typeinfo *info);
Modified: trunk/tools/debugocfs/debugocfs.c
===================================================================
--- trunk/tools/debugocfs/debugocfs.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/debugocfs/debugocfs.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -93,6 +93,11 @@
while (1)
{
+ if (dirPartOffset == 0)
+ {
+ /* this is an error, but silently fail */
+ break;
+ }
read_dir_node(fd, dir, dirPartOffset);
for (i = 0; i < dir->num_ent_used; i++)
{
@@ -229,6 +234,11 @@
while (1)
{
+ if (dirPartOffset == 0)
+ {
+ /* this is an error, but silently fail */
+ break;
+ }
read_dir_node(fd, dir, dirPartOffset);
for (i = 0; i < dir->num_ent_used; i++)
{
Modified: trunk/tools/debugocfs/dummy.c
===================================================================
--- trunk/tools/debugocfs/dummy.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/debugocfs/dummy.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -184,7 +184,7 @@
ocfs_super *vcb;
/* fake a few VCB values */
- vcb = (ocfs_super *) malloc_aligned(sizeof(ocfs_super));
+ vcb = (ocfs_super *) malloc(sizeof(ocfs_super));
vcb->vol_layout.root_start_off = hdr->root_off;
vcb->vol_layout.root_int_off = hdr->internal_off;
Modified: trunk/tools/debugocfs/dummy.h
===================================================================
--- trunk/tools/debugocfs/dummy.h 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/debugocfs/dummy.h 2003-09-03 01:05:18 UTC (rev 10)
@@ -103,8 +103,8 @@
(ptr)->next = (ptr); (ptr)->prev = (ptr); \
} while (0)
-#define kmalloc(a, b) malloc(a)
-#define kfree(a) free(a)
+#define kmalloc(a, b) malloc_aligned(a)
+#define kfree(a) free_aligned(a)
#define FILE_BUFFER_SIZE (1048576 * 2)
Modified: trunk/tools/debugocfs/extfinder.c
===================================================================
--- trunk/tools/debugocfs/extfinder.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/debugocfs/extfinder.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -2,6 +2,7 @@
#include "glib.h"
#include <stdio.h>
#include <stdlib.h>
+#include "ocfsmalloc.h"
int extents_to_print = 0;
@@ -14,6 +15,10 @@
#define MAX_BITMAP_RUNS 10
+void print_global_bitmap_runs(int fd, void *buf);
+int bmrun_reversesort(const void *a, const void *b);
+
+
int bmrun_reversesort(const void *a, const void *b)
{
bitmap_run *one, *two;
@@ -43,7 +48,7 @@
cs = v->cluster_size;
num = v->num_clusters;
bufsz = (num+7)/8;
- bmbuf = (char *)malloc(bufsz);
+ bmbuf = (char *)malloc_aligned(bufsz);
lseek64(fd, v->bitmap_off, SEEK_SET);
read(fd, bmbuf, bufsz);
@@ -94,7 +99,7 @@
g_array_free(arr, FALSE);
- free(bmbuf);
+ free_aligned(bmbuf);
}
void read_vol_disk_header(int fd, ocfs_vol_disk_hdr * v)
Modified: trunk/tools/debugocfs/fsck.c
===================================================================
--- trunk/tools/debugocfs/fsck.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/debugocfs/fsck.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -3,7 +3,7 @@
*
* ocfs file system check utility
*
- * Copyright (C) 2003 Oracle Corporation. All rights reserved.
+ * Copyright (C) 2003, 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.
@@ -24,6 +24,7 @@
*/
#include "fsck.h"
+#include <ocfsmalloc.h>
#include <glib.h>
#include <sys/stat.h>
@@ -31,12 +32,23 @@
#include <fcntl.h>
#include <sys/ioctl.h>
#include <ocfsheartbeat.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <sys/wait.h>
+#include <sys/raw.h>
-
#define MAX_EXTENTS 2048
#define OCFS_HBT_WAIT 10
+int prn_len = 1;
+int cnt_err = 0;
+int cnt_wrn = 0;
+int cnt_obj = 0;
+bool int_err = false;
+bool prn_err = false;
+
ocfsck_context ctxt;
+extern void version(char *progname);
char *usage_str =
"usage: fsck.ocfs [-N] [-v] device\n\n"
@@ -46,19 +58,6 @@
" -q Quiet\n";
/*
- * version()
- *
- */
-void version(char *progname)
-{
- printf("%s %s %s (build %s)\n", progname,
- FSCK_BUILD_VERSION,
- FSCK_BUILD_DATE,
- FSCK_BUILD_MD5);
- exit(0);
-} /* version */
-
-/*
* usage()
*
*/
@@ -74,7 +73,8 @@
int parse_fsck_cmdline(int argc, char **argv)
{
int off;
- int c;
+ int c;
+ int ret = -1;
ctxt.write_changes = true;
ctxt.verbose = false;
@@ -82,6 +82,11 @@
ctxt.quiet = false;
ctxt.dev_is_file = false;
+ if (argc < 2) {
+ usage();
+ goto bail;
+ }
+
while (1) {
off = 0;
c = getopt(argc, argv, "NVvmqf?");
@@ -107,12 +112,11 @@
break;
case 'V':
version(argv[0]);
- break;
+ goto bail;
default:
case '?':
usage();
- return 1;
- break;
+ goto bail;
}
}
@@ -120,10 +124,12 @@
ctxt.verbose = true;
#ifdef READONLY
- ctxt.write_changes = false;
- ctxt.modify_all = false;
+ ctxt.write_changes = true;
#endif
- return 0;
+
+ ret = 0;
+bail:
+ return ret;
} /* parse_fsck_cmdline */
/*
@@ -142,7 +148,7 @@
char *bad;
char *loc;
- if ((newval = mem_alloc(USER_INPUT_MAX)) == NULL) {
+ if ((newval = malloc(USER_INPUT_MAX)) == NULL) {
LOG_INTERNAL();
goto bail;
}
@@ -248,7 +254,7 @@
if (cur)
g_string_free(cur, true);
- bail:
+bail:
safefree(newval);
return ret;
@@ -264,17 +270,17 @@
char *yesno, *loc;
int fd = ctxt.fd;
- yesno = mem_alloc(USER_INPUT_MAX);
+ yesno = malloc(USER_INPUT_MAX);
if (!yesno) {
LOG_INTERNAL();
- return -1;
+ goto bail;
}
if (s->output(buf, idx, bad, stdout)==-1) {
//fprintf(stderr, "at least one bad field found\n");
}
- printf("Do you really want to write your changes out? : ");
+ printf("\n\nDo you really want to write your changes out? : ");
if (fgets(yesno, USER_INPUT_MAX, stdin) == NULL) {
ret = -1;
@@ -295,11 +301,12 @@
}
}
- bail:
- free(yesno);
+bail:
+ safefree(yesno);
return ret;
} /* confirm_changes */
+static char *saved_block = NULL;
/*
* read_print_struct()
*
@@ -308,16 +315,38 @@
{
int ret = 0;
int fd = ctxt.fd;
+
+ if (saved_block == NULL)
+ saved_block = malloc(512);
+ if (saved_block == NULL)
+ return -1;
+
if (s->read(fd, buf, off, idx)==-1) {
LOG_ERROR("failed to read data");
- return -1;
+ return -2;
}
+ memcpy(saved_block, buf, 512);
+
if (s->sig_match) {
- if (s->sig_match(buf, idx)==-1) {
+ if (s->sig_match(buf, idx)==-EINVAL) {
LOG_ERROR("bad signature");
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");
+ } else
+ LOG_ERROR("Bad signature not fixed due to -N option");
+#endif
+ /* restore the original if the new one was not written */
+ if (ret == -1)
+ memcpy(buf, saved_block, 512);
}
}
@@ -343,22 +372,73 @@
*/
int get_device_size(int fd)
{
+ int ret = -1;
__u32 numblks;
struct stat buf;
+ if (fstat(fd, &buf) == -1) {
+ printf("%s: %s\n", ctxt.device, strerror(errno));
+ goto bail;
+ }
+
if (ctxt.dev_is_file) { /* used during testing */
- if (fstat(fd, &buf) == -1)
- return -1;
ctxt.device_size = buf.st_size;
+ goto finito;
+ } else if (S_ISCHR(buf.st_mode)) {
+ char *junk;
+ __u64 hi, lo, new, delta, last;
+ int ret;
+
+ junk = malloc_aligned(512);
+ hi = 0xfffffffffffffd00;
+ lo = 0ULL;
+ new = hi >> 1;
+
+ ctxt.device_size = 0;
+ do {
+ last = new;
+ myseek64(fd, new, SEEK_SET);
+ ret = read(fd, junk, 512);
+ if (ret == 512) {
+ // go higher
+ ctxt.device_size = (new + 512);
+ lo = new;
+ delta = (hi - lo) >> 1;
+ new = hi - delta;
+ new &= 0xfffffffffffffd00;
+ } else {
+ // go lower
+ hi = new;
+ delta = (hi - lo) >> 1;
+ new = lo + delta;
+ new &= 0xfffffffffffffd00;
+ }
+
+ if (last == new || hi <= lo)
+ break;
+ } while (1);
+ while (ret == 512)
+ {
+ ctxt.device_size = (new + 512);
+ myseek64(fd, new, SEEK_SET);
+ ret = read(fd, junk, 512);
+ new += 512;
+ }
+ goto finito;
} else {
- if (ioctl(fd, BLKGETSIZE, &numblks) == -1)
- return -1;
-
+ if (ioctl(fd, BLKGETSIZE, &numblks) == -1) {
+ printf("%s: %s\n", ctxt.device, strerror(errno));
+ goto bail;
+ }
ctxt.device_size = numblks;
ctxt.device_size *= OCFS_SECTOR_SIZE;
+ goto finito;
}
- return 0;
+finito:
+ ret = 0;
+bail:
+ return ret;
} /* get_device_size */
/*
@@ -372,44 +452,48 @@
int flags;
#ifdef READONLY
- flags = O_RDONLY|O_LARGEFILE;
+ flags = O_RDONLY | O_LARGEFILE;
#else
- flags = O_RDWR|O_LARGEFILE;
+ flags = O_RDWR | O_LARGEFILE;
#endif
if ((fd = myopen(ctxt.device, flags)) == -1) {
usage();
goto bail;
- }
+ } else
+ ctxt.fd = fd;
-#ifndef DISABLE_DEVICE_SIZE_CHECK
- if (get_device_size(fd) == -1) {
- LOG_ERROR("failed to get device size. exiting");
+ if ((ctxt.hdr = malloc_aligned(OCFS_SECTOR_SIZE)) == NULL) {
+ LOG_INTERNAL();
goto bail;
}
-#endif
- ctxt.fd = fd;
+ if ((ctxt.vol_bm = malloc_aligned(VOL_BITMAP_BYTES)) == NULL) {
+ LOG_INTERNAL();
+ goto bail;
+ } else
+ memset(ctxt.vol_bm, 0, VOL_BITMAP_BYTES);
- if ((ctxt.hdr = mem_alloc(OCFS_SECTOR_SIZE)) == NULL) {
+ if ((*buf = malloc_aligned(OCFS_SECTOR_SIZE)) == NULL) {
LOG_INTERNAL();
goto bail;
}
- if ((ctxt.vol_bm = mem_alloc(VOL_BITMAP_BYTES)) == NULL) {
+ /* Seek to the first block */
+ if (myseek64(fd, 0, SEEK_SET) == -1) {
LOG_INTERNAL();
goto bail;
- } else
- memset(ctxt.vol_bm, 0, VOL_BITMAP_BYTES);
+ }
- if ((ctxt.vol_bm_orig = mem_alloc(VOL_BITMAP_BYTES)) == NULL) {
+ /* Read the super block */
+ if (myread(fd, (char *)ctxt.hdr, OCFS_SECTOR_SIZE) == -1) {
LOG_INTERNAL();
goto bail;
- } else
- memset(ctxt.vol_bm_orig, 0, VOL_BITMAP_BYTES);
+ }
- if ((*buf = mem_alloc(OCFS_SECTOR_SIZE)) == NULL) {
- LOG_INTERNAL();
+ /* Get the device size */
+ if (get_device_size(fd) == -1) {
+ LOG_ERROR("unable to get the device size. exiting");
goto bail;
}
@@ -419,7 +503,7 @@
ret = 0;
- bail:
+bail:
return ret;
} /* fsck_initialize */
@@ -438,28 +522,53 @@
ocfs_layout_t *l;
int j;
GHashTable *bad = NULL;
+#ifndef READONLY
int changed = 0;
+#endif
+ pid_t pid;
+ pid = fork ();
+ if (pid < 0)
+ exit(0);
+ if (pid != 0) {
+ /* parent */
+ wait(NULL);
+ //waitpid(pid, NULL, WNOHANG);
+ exit (0);
+ }
+
memset(&ctxt, 0, sizeof(ctxt));
- if (parse_fsck_cmdline(argc, argv) != 0) {
+ if (parse_fsck_cmdline(argc, argv) == -1)
+ goto quiet_bail;
+
+ if (optind >= argc) {
usage();
- goto bail;
+ goto quiet_bail;
}
+ version(argv[0]);
+
strncpy(ctxt.device, argv[optind], OCFS_MAX_FILENAME_LENGTH);
if (fsck_initialize(&buf) == -1) {
LOG_ERROR("during initialize. exiting.");
- goto bail;
+ goto quiet_bail;
}
+ /* Exit if not an OCFS volume */
+ if (memcmp(ctxt.hdr->signature, OCFS_VOLUME_SIGNATURE,
+ strlen(OCFS_VOLUME_SIGNATURE))) {
+ printf("%s: bad signature in super block\n", ctxt.device);
+ goto quiet_bail;
+ }
+
+ /* Exit if heartbeat detected */
#ifndef READONLY
- /* Exit if heartbeat detected */
if (!ctxt.dev_is_file) {
if (!check_heart_beat(&ctxt.fd, OCFSCK_PUBLISH_OFF,
OCFS_SECTOR_SIZE))
- goto bail;
+ goto quiet_bail;
}
#endif
@@ -472,7 +581,7 @@
continue;
}
- LOG_NOQUIET("Checking %s....\n", l->name);
+ CLEAR_AND_PRINT("Checking %s...", l->name);
ret = 0;
for (j = 0; j < l->num_blocks; j++) {
@@ -480,9 +589,11 @@
off = BLOCKS2BYTES((l->block+j));
ret = read_print_struct(s, buf, off, j, &bad);
+ if (ret == -2)
+ 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)
@@ -498,6 +609,7 @@
break;
}
+#endif
if (bad)
g_hash_table_destroy(bad);
@@ -512,8 +624,8 @@
if (option == 'q' || option == 'd')
break;
- if (ret == -1 && s == &diskhdr_t) {
- LOG_ERROR("Volume header bad. Exiting\n");
+ if (ret < 0 && s == &diskhdr_t) {
+ LOG_ERROR("Volume header bad. Exiting");
goto bail;
}
}
@@ -521,24 +633,39 @@
if (option == 'q')
goto bail;
- LOG_NOQUIET("Checking Directories and Files...\n");
- traverse_dir_nodes(ctxt.fd, ctxt.hdr->root_off);
+ CLEAR_AND_PRINT("Checking Directories and Files...");
+ traverse_dir_nodes(ctxt.fd, ctxt.hdr->root_off, "/");
- LOG_NOQUIET("Checking Global Bitmap...\n");
+ CLEAR_AND_PRINT("Checking Global Bitmap...");
if (check_global_bitmap(ctxt.fd) == -1)
LOG_ERROR("Global bitmap check failed");
- LOG_NOQUIET("Checking Extent Bitmap...\n");
+ CLEAR_AND_PRINT("Checking Extent Bitmap...");
if (check_node_bitmaps(ctxt.fd, ctxt.ext_bm_data, ctxt.ext_bm,
ctxt.ext_bm_sz, "extent") == -1)
LOG_ERROR("Extent bitmap check failed");
- LOG_NOQUIET("Checking Directory Bitmap...\n");
+ CLEAR_AND_PRINT("Checking Directory Bitmap...");
if (check_node_bitmaps(ctxt.fd, ctxt.dir_bm_data, ctxt.dir_bm,
ctxt.dir_bm_sz, "directory") == -1)
LOG_ERROR("Directory bitmap check failed");
- bail:
+bail:
+ if (!int_err) {
+ if (cnt_err == 0)
+ CLEAR_AND_PRINT("%s: clean, %d objects, %u/%llu "
+ "blocks", ctxt.device, cnt_obj,
+ ctxt.vol_bm_data->len,
+ ctxt.hdr->num_clusters);
+ else
+ CLEAR_AND_PRINT("%s: %d errors, %d objects, %u/%llu "
+ "blocks", ctxt.device, cnt_err, cnt_obj,
+ ctxt.vol_bm_data->len,
+ ctxt.hdr->num_clusters);
+ }
+ printf("\n");
+
+quiet_bail:
if (ctxt.vol_bm_data)
g_array_free(ctxt.vol_bm_data, true);
@@ -549,15 +676,15 @@
g_array_free(ctxt.ext_bm_data, true);
for (i = 0; i < OCFS_MAXIMUM_NODES; ++i)
- safefree(ctxt.dir_bm[i]);
+ free_aligned(ctxt.dir_bm[i]);
for (i = 0; i < OCFS_MAXIMUM_NODES; ++i)
- safefree(ctxt.ext_bm[i]);
+ free_aligned(ctxt.ext_bm[i]);
- safefree(buf);
- safefree(ctxt.hdr);
- safefree(ctxt.vol_bm);
- safefree(ctxt.vol_bm_orig);
+ free_aligned(buf);
+ free_aligned(ctxt.hdr);
+ free_aligned(ctxt.vol_bm);
+
exit(0);
} /* main */
@@ -571,12 +698,20 @@
int ret = -1;
bitmap_data *bm1;
bitmap_data *bm2;
+ __u8 *vol_bm = NULL;
__u32 i;
__u32 j;
/* sorting the global bitmap data on alloc_node and bit_num */
qsort(ctxt.vol_bm_data->data, ctxt.vol_bm_data->len,
sizeof(bitmap_data), &qsort_compare);
+#if 0
+ for (i = 0; i < ctxt.vol_bm_data->len; ++i) {
+ bm1 = &(g_array_index(ctxt.vol_bm_data, bitmap_data, i));
+ printf("BOO: bit=%u, num=%u, blk=%u.%u, fe=%u.%u\n", bm1->bitnum,
+ bm1->num, HILO(bm1->fss_off), HILO(bm1->parent_off));
+ }
+#endif
/* walk the list and check for any duplicates */
for (i = 0; i < ctxt.vol_bm_data->len; ++i) {
@@ -584,38 +719,49 @@
for (j = i + 1; j < ctxt.vol_bm_data->len; ++j) {
bm2 = &(g_array_index(ctxt.vol_bm_data, bitmap_data, j));
if (bm2->bitnum == bm1->bitnum) {
- LOG_ERROR("File offsets %u.%u and %u.%u "
- "account for the same bit %u "
- "in the global bitmap",
- HILO(bm1->fss_off), HILO(bm2->fss_off),
- bm1->bitnum);
+ LOG_ERROR("Block %u.%u (bit# %u) allocated "
+ "to File Entries %u.%u and %u.%u",
+ HILO(bm1->fss_off), bm1->bitnum,
+ HILO(bm1->parent_off),
+ HILO(bm2->parent_off));
continue;
} else
break;
}
}
+ /* make a temp copy of the volume bitmap */
+ if ((vol_bm = malloc_aligned(VOL_BITMAP_BYTES)) == NULL) {
+ LOG_INTERNAL();
+ goto bail;
+ } else
+ memcpy(vol_bm, ctxt.vol_bm, VOL_BITMAP_BYTES);
+
/* clearing all the allocated bits in the global bitmap */
for (i = 0; i < ctxt.vol_bm_data->len; ++i) {
bm1 = &(g_array_index(ctxt.vol_bm_data, bitmap_data, i));
- j = __test_and_clear_bit(bm1->bitnum, ctxt.vol_bm);
+ j = __test_and_clear_bit(bm1->bitnum, vol_bm);
if (!j) {
- LOG_ERROR("Bit %u is unset in the global bitmap",
- bm1->bitnum);
+ if (!test_bit(bm1->bitnum, ctxt.vol_bm))
+ LOG_ERROR("Bit %u is unset in the global bitmap",
+ bm1->bitnum);
}
}
+#ifdef STILL_DEBUGGING
/* cross check... ensure no bit in the global bitmap is set */
/* The first 1MB in the bitmap is for the system fe's */
j = VOL_BITMAP_BYTES / ctxt.hdr->cluster_size;
for (i = j; i < ctxt.hdr->num_clusters; ++i) {
- if (test_bit(i, ctxt.vol_bm))
+ if (test_bit(i, vol_bm))
LOG_ERROR("Bit %u in the global bitmap is "
"unaccounted", i);
}
+#endif
ret = 0;
-
+bail:
+ free_aligned(vol_bm);
return ret;
} /* check_global_bitmap */
@@ -632,16 +778,15 @@
int ret = -1;
bitmap_data *bm1;
bitmap_data *bm2;
+ __u8 *temp_bm[OCFS_MAXIMUM_NODES];
__u32 i;
__u32 j;
-// __u32 len;
/* sorting the node bitmap data on alloc_node and bit_num */
qsort(bm_data->data, bm_data->len, sizeof(bitmap_data), &qsort_compare);
#ifdef STILL_DEBUGGING
for (i = 0; i < bm_data->len; ++i) {
bm1 = &(g_array_index(bm_data, bitmap_data, i));
- printf("%u %u\n", bm1->alloc_node, bm1->bitnum);
}
#endif
for (i = 0; i < bm_data->len; ++i) {
@@ -651,49 +796,66 @@
if (bm2->alloc_node != bm1->alloc_node)
break;
if (bm2->bitnum == bm1->bitnum) {
- LOG_ERROR("File offsets %u.%u and %u.%u "
- "account for the same bit %u "
- "in the %s bitmap for node %d",
- HILO(bm1->fss_off), HILO(bm2->fss_off),
- bm1->bitnum, str, bm1->alloc_node);
+ LOG_ERROR("Block %u.%u (bit# %u) allocated "
+ "to %s %u.%u and %u.%u on node %u",
+ HILO(bm1->fss_off), bm1->bitnum,
+ str, HILO(bm1->parent_off),
+ HILO(bm2->parent_off), bm1->alloc_node);
continue;
} else
break;
}
}
+ /* make a temp copy of the node bitmaps */
+ for (i = 0; i < OCFS_MAXIMUM_NODES; ++i) {
+ if (!node_bm_sz[i]) {
+ temp_bm[i] = NULL;
+ continue;
+ }
+ if ((temp_bm[i] = malloc_aligned(node_bm_sz[i])) == NULL) {
+ LOG_INTERNAL();
+ goto bail;
+ } else
+ memcpy(temp_bm[i], node_bm[i], node_bm_sz[i]);
+ }
+
/* clearing all the allocated bits in the extent bitmap */
for (i = 0; i < bm_data->len; ++i) {
bm1 = &(g_array_index(bm_data, bitmap_data, i));
- if (!node_bm[bm1->alloc_node]) {
+ if (!temp_bm[bm1->alloc_node]) {
LOG_ERROR("%s bitmap for node %d not allocated but "
"structure at offset %u.%u suggests otherwise",
str, bm1->alloc_node, HILO(bm1->fss_off));
continue;
}
- j = __test_and_clear_bit(bm1->bitnum, node_bm[bm1->alloc_node]);
+ j = __test_and_clear_bit(bm1->bitnum, temp_bm[bm1->alloc_node]);
if (!j) {
- LOG_ERROR("Bit %u is unset in the %s bitmap of node %d",
- bm1->bitnum, str, bm1->alloc_node);
+ if (!test_bit(bm1->bitnum, node_bm[bm1->alloc_node]))
+ LOG_ERROR("Bit %u is unset in the %s bitmap "
+ "of node %d", bm1->bitnum, str,
+ bm1->alloc_node);
}
}
#ifdef STILL_DEBUGGING
/* cross check... ensure no bit in the extent/directory bitmap is set */
for (i = 0; i < OCFS_MAXIMUM_NODES; ++i) {
- if (!node_bm[i])
+ if (!temp_bm[i])
continue;
len = node_bm_sz[i] * 8;
- printf("num of bits: %u\n", len);
for (j = 0; j < len; ++j) {
- if (test_bit(j, node_bm[i]))
+ if (test_bit(j, temp_bm[i]))
LOG_ERROR("Bit %u in the %s bitmap of node "
"%d is unaccounted", j, str, i);
}
}
#endif
+
ret = 0;
-
+bail:
+ for (i = 0; i < OCFS_MAXIMUM_NODES; ++i)
+ free_aligned(temp_bm[i]);
return ret;
} /* check_node_bitmaps */
@@ -713,80 +875,86 @@
ret = bm1->bitnum - bm2->bitnum;
return ret;
-// return bm1->bitnum - bm2->bitnum;
} /* qsort_compare */
+static int fe_compare_func(const void *m1, const void *m2);
-#if 0
-int check_bitmaps()
+/* if we ever rewrite this as a shared library or
+ * parallelized fsck we will have to change this */
+ocfs_dir_node *globaldir = NULL;
+
+static int fe_compare_func(const void *m1, const void *m2)
{
- int i;
- ocfs_disk_structure *u;
- char *tmp = NULL;
- GHashTable *tmparr = NULL;
+ ocfs_file_entry *fe1, *fe2;
+ __u8 idx1, idx2;
+ int ret;
- if ((tmp = mem_alloc(OCFS_SECTOR_SIZE)) == NULL) {
+ if (globaldir == NULL) {
LOG_INTERNAL();
- goto bail;
+ exit(0);
}
- for (i = 0; i < ctxt.hdr->num_clusters; i++) {
- if (test_bit(i, ctxt.vol_bm)) {
- printf("bit=%d diskoff=%llu\n", i, BIT_NUMBER_TO_DISK_OFF(i));
+ idx1 = *(__u8 *)m1;
+ idx2 = *(__u8 *)m2;
- myseek64(ctxt.fd, BIT_NUMBER_TO_DISK_OFF(i), SEEK_SET);
-
- memset(tmp, 0, OCFS_SECTOR_SIZE);
- read(ctxt.fd, tmp, OCFS_SECTOR_SIZE);
-
- u = find_matching_struct(tmp, 0);
- if (u == NULL)
- LOG_ERROR("no matching structure");
- else
- u->output(tmp, 0, tmparr, stdout);
- }
+ 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 ||
+ (!(fe1->sync_flags & OCFS_SYNC_FLAG_VALID)) ||
+ fe2->sync_flags & OCFS_SYNC_FLAG_NAME_DELETED ||
+ (!(fe2->sync_flags & OCFS_SYNC_FLAG_VALID))) {
+ return 0;
}
+ ret = strncmp(fe1->filename, fe2->filename, 255);
+
+ return -ret;
+}
- bail:
- safefree(tmp);
- return 0;
-} /* check_bitmaps */
-#endif
/*
* traverse_dir_nodes()
*
*/
-void traverse_dir_nodes(int fd, __u64 offset)
+void traverse_dir_nodes(int fd, __u64 offset, char *dirpath)
{
int i;
int ret;
- ocfs_dir_node *dirbuf = NULL;
+ char *dirbuf = NULL;
ocfs_file_entry *febuf = NULL;
__u64 dir_offset;
__u64 off;
ocfs_disk_structure *dirst;
ocfs_disk_structure *fest;
GHashTable *bad;
+ ocfs_dir_node *dir;
+ __u8 *index = NULL;
dirst = &dirnode_t;
fest = &fileent_t;
bad = NULL;
- if ((dirbuf = (ocfs_dir_node *) mem_alloc(OCFS_SECTOR_SIZE)) == NULL) {
+ if ((index = malloc(256)) == NULL) {
LOG_INTERNAL();
goto bail;
}
- if ((febuf = (ocfs_file_entry *) mem_alloc(OCFS_SECTOR_SIZE)) == NULL) {
+ if ((dirbuf = malloc_aligned(DIR_NODE_SIZE)) == NULL) {
LOG_INTERNAL();
goto bail;
}
+ if ((febuf = (ocfs_file_entry *) malloc_aligned(OCFS_SECTOR_SIZE)) == NULL) {
+ LOG_INTERNAL();
+ goto bail;
+ }
+
dir_offset = offset;
+ dir = (ocfs_dir_node *)dirbuf;
+ CLEAR_AND_PRINT(dirpath);
+
while (1) {
- ret = read_print_struct(dirst, (char *)dirbuf, dir_offset, 0, &bad);
+ ret = read_print_struct(dirst, dirbuf, dir_offset, 0, &bad);
if (bad)
g_hash_table_destroy(bad);
@@ -797,14 +965,67 @@
goto bail;
}
+ /* check the dir->index integrity */
+ globaldir = dir;
+ memcpy(index, dir->index, dir->num_ent_used);
+ 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.");
+ if (ctxt.write_changes) {
+ if ((idxtmp = malloc(256)) == NULL) {
+ LOG_INTERNAL();
+ goto bail;
+ }
+ memcpy(idxtmp, dir->index, 256);
+ memcpy(dir->index, index, dir->num_ent_used);
+ if (dirst->write(ctxt.fd, dirbuf, dir_offset, 0) == -1) {
+ LOG_ERROR("failed to write at offset %u.%u",
+ HILO(dir_offset));
+ memcpy(dir->index, idxtmp, 256);
+ }
+ safefree(idxtmp);
+ LOG_ERROR("Bad dir index fixed.");
+ } else
+ LOG_ERROR("Bad dir index not fixed due to -N option");
+#endif
+ }
+
+ /* check the undeletable dir bug, BUG #3016598 */
+ if (dir->num_ent_used == 1 &&
+ (FILEENT(dir, 0))->sync_flags &
+ OCFS_SYNC_FLAG_MARK_FOR_DELETION) {
+ /* 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.");
+ 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.");
+ } else
+ LOG_ERROR("Undeletable directory not fixed due to -N option");
+#endif
+ }
+
/* Add bitmap entry for the dirnode itself */
- add_bm_data(dirbuf->alloc_file_off, 1, dirbuf->alloc_node, bm_dir);
+ add_bm_data(dir->alloc_file_off, 1, dir->alloc_node,
+ dir_offset, bm_dir);
// TODO: add in directory editing here
- for (i = 0; i < dirbuf->num_ent_used; i++) {
+ for (i = 0; i < dir->num_ent_used; i++) {
off = dir_offset;
off += OCFS_SECTOR_SIZE; /* move past the dirnode header */
- off += (OCFS_SECTOR_SIZE * dirbuf->index[i]);
+ off += (OCFS_SECTOR_SIZE * dir->index[i]);
ret = read_print_struct(fest, (char *)febuf, off, 0, &bad);
if (bad)
@@ -816,19 +1037,26 @@
}
// TODO: add in file entry editing here
- check_file_entry(fd, febuf, off, false);
+
+#define DELETED_FLAGS (OCFS_SYNC_FLAG_DELETED | \
+ OCFS_SYNC_FLAG_MARK_FOR_DELETION | \
+ OCFS_SYNC_FLAG_NAME_DELETED)
+ if (febuf->sync_flags &&
+ !(febuf->sync_flags & DELETED_FLAGS))
+ check_file_entry(fd, febuf, off, false, dirpath);
}
/* is there another directory chained off of this one? */
- if (dirbuf->next_node_ptr == -1)
+ if (dir->next_node_ptr == -1)
break; // nope, we're done
else
- dir_offset = dirbuf->next_node_ptr; // keep going
+ dir_offset = dir->next_node_ptr; // keep going
}
- bail:
- safefree(dirbuf);
- safefree(febuf);
+bail:
+ free_aligned(dirbuf);
+ free_aligned(febuf);
+ safefree(index);
} /* traverse_dir_nodes */
/*
@@ -844,11 +1072,13 @@
* check_file_entry()
*
*/
-void check_file_entry(int fd, ocfs_file_entry *fe, __u64 offset, bool systemfile)
+void check_file_entry(int fd, ocfs_file_entry *fe, __u64 offset,
+ bool systemfile, char *dirpath)
{
void *buf = NULL;
int indx = 0;
int val = 0;
+ char *path = NULL;
if (systemfile)
val = 3;
@@ -859,29 +1089,42 @@
val = 2;
else if (fe->attribs & (OCFS_ATTRIB_REG | OCFS_ATTRIB_SYMLINK))
val = 3;
+ else {
+ LOG_ERROR ("unknown attribs %x at offset %u.%u",
+ fe->attribs, HILO(offset));
+ goto bail;
+ }
}
+ ++cnt_obj;
+ if (val == 2)
+ path = g_strdup_printf("%s%s/", dirpath, fe->filename);
+ else
+ path = g_strdup_printf("%s%s", dirpath, fe->filename);
+
switch (val) {
case 1:
+ CLEAR_AND_PRINT(path);
handle_one_cdsl_entry(fd, fe, offset);
break;
case 2:
if (fe->extents[0].disk_off) {
handle_leaf_extents(fd, fe->extents, 1,
- OCFS_INVALID_NODE_NUM);
- traverse_dir_nodes(fd, fe->extents[0].disk_off);
+ OCFS_INVALID_NODE_NUM, fe->this_sector);
+ traverse_dir_nodes(fd, fe->extents[0].disk_off, path);
} else
LOG_ERROR("Invalid dir entry at %u.%u", HILO(offset));
break;
case 3:
+ CLEAR_AND_PRINT(path);
if (fe->local_ext)
handle_leaf_extents(fd, fe->extents,
OCFS_MAX_FILE_ENTRY_EXTENTS,
- OCFS_INVALID_NODE_NUM);
+ OCFS_INVALID_NODE_NUM, fe->this_sector);
else {
- if ((buf = mem_alloc(MAX_EXTENTS * OCFS_SECTOR_SIZE)) == NULL) {
+ if ((buf = malloc_aligned(MAX_EXTENTS * OCFS_SECTOR_SIZE)) == NULL) {
LOG_INTERNAL();
goto bail;
}
@@ -900,16 +1143,18 @@
break;
}
- bail:
- safefree(buf);
+bail:
+ safefree(path);
+ free_aligned(buf);
return ;
-} /* handle_one_file_entry */
+} /* check_file_entry */
/*
* add_bm_data()
*
*/
-bitmap_data * add_bm_data(__u64 start, __u64 len, __s32 alloc_node, int type)
+bitmap_data * add_bm_data(__u64 start, __u64 len, __s32 alloc_node,
+ __u64 parent_offset, int type)
{
bitmap_data *bm = NULL;
__u32 bitnum = 0;
@@ -945,7 +1190,7 @@
if (num == 0)
goto bail;
- if ((buf = mem_alloc(sizeof(bitmap_data) * num)) == NULL) {
+ if ((buf = malloc(sizeof(bitmap_data) * num)) == NULL) {
LOG_INTERNAL();
goto bail;
}
@@ -955,7 +1200,7 @@
bm->bitnum = bitnum + i;
bm->fss_off = start;
bm->alloc_node = alloc_node;
-// bm->type = type;
+ bm->parent_off = parent_offset;
p += sizeof(bitmap_data);
}
@@ -978,7 +1223,7 @@
break;
}
- bail:
+bail:
return bm;
} /* add_bm_data */
@@ -987,7 +1232,8 @@
* handle_leaf_extents()
*
*/
-int handle_leaf_extents (int fd, ocfs_alloc_ext *arr, int num, __u32 node)
+int handle_leaf_extents (int fd, ocfs_alloc_ext *arr, int num, __u32 node,
+ __u64 parent_offset)
{
int i;
int ret = 0;
@@ -995,7 +1241,7 @@
for (i = 0; i < num; i++) {
if (arr[i].disk_off)
if (!add_bm_data(arr[i].disk_off, arr[i].num_bytes,
- node, bm_filedata))
+ node, parent_offset, bm_filedata))
ret = -1;
}
@@ -1076,18 +1322,19 @@
}
/* Add bitmap entry for the extent itself */
- add_bm_data(ext->alloc_file_off, 1, ext->alloc_node, bm_extent);
+ add_bm_data(ext->alloc_file_off, 1, ext->alloc_node, ext->this_ext,
+ bm_extent);
if (flag == OCFS_EXTENT_HEADER) {
type = ext->granularity ? OCFS_EXTENT_HEADER : OCFS_EXTENT_DATA;
traverse_extent(fd, ext, type, buf, indx);
} else {
handle_leaf_extents(fd, ext->extents, ext->next_free_ext,
- OCFS_INVALID_NODE_NUM);
+ OCFS_INVALID_NODE_NUM, ext->this_ext);
}
}
- bail:
+bail:
return ;
} /* traverse_extent */
@@ -1161,18 +1408,19 @@
}
/* Add bitmap entry for the extent itself */
- add_bm_data(ext->alloc_file_off, 1, ext->alloc_node, bm_extent);
+ add_bm_data(ext->alloc_file_off, 1, ext->alloc_node, ext->this_ext,
+ bm_extent);
if (fe->granularity) {
type = ext->granularity ? OCFS_EXTENT_HEADER : OCFS_EXTENT_DATA;
traverse_extent(fd, ext, type, buf, indx);
} else {
handle_leaf_extents(fd, ext->extents, ext->next_free_ext,
- OCFS_INVALID_NODE_NUM);
+ OCFS_INVALID_NODE_NUM, ext->this_ext);
}
}
- bail:
+bail:
return ;
} /* traverse_fe_extents */
@@ -1244,11 +1492,14 @@
ocfs_super osb;
int ret = 0;
int i;
+ int j;
int waittime;
- char nodestr[512];
- char tmpstr[100];
- __u32 nodemap;
+ char *node_names[OCFS_MAXIMUM_NODES];
+ __u32 nodemap;
+ for (i = 0; i < OCFS_MAXIMUM_NODES; ++i)
+ node_names[i] = NULL;
+
memset (&osb, 0, sizeof(ocfs_super));
if (!read_publish(*file, publ_off, sect_size, (void **)&publish)) {
@@ -1274,10 +1525,17 @@
/* Close and re-open device to force disk read */
myclose(*file);
- if ((*file = myopen(ctxt.device, O_RDWR|O_LARGEFILE)) == -1) {
+#ifdef READONLY
+ if ((*file = myopen(ctxt.device, O_RDONLY | O_LARGEFILE)) == -1) {
LOG_INTERNAL();
goto bail;
}
+#else
+ if ((*file = myopen(ctxt.device, O_RDWR | O_LARGEFILE)) == -1) {
+ LOG_INTERNAL();
+ goto bail;
+ }
+#endif
memset (publish, 0, sect_size);
if (!read_publish(*file, publ_off, sect_size, (void **)&publish)) {
@@ -1288,29 +1546,37 @@
/* call ocfs_update_publish_map(first_time = false) */
ocfs_update_publish_map (&osb, (void *)publish, false);
+ printf("\r \r");
+ fflush(stdout);
+
/* 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);
- }
+ if (!nodemap)
+ goto success;
+
+ /* Get names of all the nodes */
+ 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);
}
- nodestr[strlen(nodestr) - 2] = '\0';
- printf("\n");
- LOG_ERROR("Volume is mounted on node number(s) (%s).\n"
- "Aborting.\n", nodestr);
- goto bail;
}
+ printf("\numount on node(s) before running fsck again.\n");
+ goto bail;
- printf("\r \r");
- fflush(stdout);
+success:
+ ret = 1;
+bail:
+ for (i = 0; i < OCFS_MAXIMUM_NODES; ++i)
+ free(node_names[i]);
- ret = 1;
- bail:
- safefree(publish);
+ free_aligned(publish);
return ret;
} /* check_heart_beat */
@@ -1326,7 +1592,7 @@
pub_len = OCFS_MAXIMUM_NODES * sect_size;
if (!*buf) {
- if (!(*buf = mem_alloc(pub_len))) {
+ if (!(*buf = malloc_aligned(pub_len))) {
LOG_INTERNAL();
goto bail;
}
@@ -1344,6 +1610,50 @@
ret = 1;
- bail:
+bail:
return ret;
} /* read_publish */
+
+/*
+ * 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 *) malloc_aligned(len))) {
+ LOG_INTERNAL();
+ goto bail;
+ } else
+ memset(buf, 0, len);
+
+ if (myseek64(file, volhdr->node_cfg_off, SEEK_SET) == -1) {
+ LOG_INTERNAL();
+ goto bail;
+ }
+
+ if (myread(file, buf, len) == -1) {
+ LOG_INTERNAL();
+ 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:
+ free_aligned(buf);
+ return ret;
+} /* get_node_names */
Modified: trunk/tools/debugocfs/fsck.h
===================================================================
--- trunk/tools/debugocfs/fsck.h 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/debugocfs/fsck.h 2003-09-03 01:05:18 UTC (rev 10)
@@ -3,7 +3,7 @@
*
* Function prototypes, macros, etc. for related 'C' files
*
- * Copyright (C) 2003 Oracle Corporation. All rights reserved.
+ * Copyright (C) 2003 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.
@@ -51,6 +51,11 @@
#include "defaults.h"
#include "layout.h"
+extern bool prn_err;
+extern bool int_err;
+extern int cnt_err;
+extern int cnt_wrn;
+
#define MAX_NODES OCFS_MAXIMUM_NODES
#define MAX_SYSTEM_FILES (CLEANUP_FILE_BASE_ID + OCFS_MAXIMUM_NODES) /* 193? */
#define DIR_NODE_SIZE (1024 * 128)
@@ -77,34 +82,49 @@
#define LOG_INTERNAL() \
do { \
- fprintf(stderr, "INTERNAL ERROR: "); \
- fprintf(stderr, "%s, %d\n", __FILE__, __LINE__);\
+ prn_err = true; int_err = true; \
+ fprintf(stdout, "\nINTERNAL ERROR: "); \
+ fprintf(stdout, "%s, %d", __FILE__, __LINE__); \
} while (0)
-#define LOG_ERROR(fmt, arg...) \
- do { \
- fprintf(stderr, "ERROR: "); \
- fprintf(stderr, fmt, ## arg); \
- fprintf(stderr, "\n"); \
+#define LOG_ERROR(fmt, arg...) \
+ do { \
+ prn_err = true; cnt_err++; \
+ fprintf(stdout, "\nERROR: "); \
+ fprintf(stdout, fmt, ## arg); \
+ fprintf(stdout, ", %s, %d", __FILE__, __LINE__);\
} while (0)
-#define LOG_WARNING(fmt, arg...) \
- do { \
- fprintf(stderr, "WARNING: "); \
- fprintf(stderr, fmt, ## arg); \
- fprintf(stderr, "\n"); \
+#define LOG_WARNING(fmt, arg...) \
+ do { \
+ prn_err = true; cnt_wrn++; \
+ fprintf(stdout, "\nWARNING: "); \
+ fprintf(stdout, fmt, ## arg); \
} while (0)
-#define LOG_VERBOSE(fmt, arg...) \
- if (ctxt.verbose) { \
- printf(fmt, ## arg); \
- }
+#define CLEAR_AND_PRINT(fmt, arg...) \
+do { \
+ if (!ctxt.quiet) { \
+ gchar *_a = g_strdup_printf(fmt, ## arg); \
+ if (ctxt.verbose) \
+ printf("\n%s\n", _a); \
+ else { \
+ int _j = strlen(_a); \
+ int _l = prn_len - _j; \
+ char _n = (prn_err ? '\n' : '\r'); \
+ if (_l > 0) { \
+ gchar *_s = g_strnfill(_l, ' '); \
+ printf("%c%s%s", _n, _a, _s); \
+ prn_len = _j; \
+ free(_s); \
+ } else \
+ prn_len = printf("%c%s", _n, _a); \
+ prn_err = false; \
+ } \
+ free(_a); \
+ } \
+} while (0)
-#define LOG_NOQUIET(fmt, arg...) \
- if (!ctxt.quiet) { \
- printf(fmt, ## arg); \
- }
-
typedef struct _filedata
{
ocfs_io_runs *array;
@@ -118,7 +138,6 @@
} filedata;
-void version(char *progname);
void usage(void);
int parse_fsck_cmdline(int argc, char **argv);
int edit_structure(ocfs_disk_structure *s, char *buf, int idx, int *changed,
@@ -134,10 +153,11 @@
int check_node_bitmaps(int fd, GArray *bm_data, __u8 **node_bm,
__u32 *node_bm_sz, char *str);
void handle_one_cdsl_entry(int fd, ocfs_file_entry *fe, __u64 offset);
-int handle_leaf_extents (int fd, ocfs_alloc_ext *arr, int num, __u32 node);
-void traverse_dir_nodes(int fd, __u64 offset);
+int handle_leaf_extents (int fd, ocfs_alloc_ext *arr, int num, __u32 node,
+ __u64 parent_offset);
+void traverse_dir_nodes(int fd, __u64 offset, char *path);
void check_file_entry(int fd, ocfs_file_entry *fe, __u64 offset,
- bool systemfile);
+ bool systemfile, char *path);
void traverse_extent(int fd, ocfs_extent_group * exthdr, int flag, void *buf,
int *indx);
void traverse_fe_extents(int fd, ocfs_file_entry *fe, void *buf, int *indx);
@@ -147,6 +167,8 @@
int get_device_size(int fd);
int check_heart_beat(int *file, __u64 publ_off, __u32 sect_size);
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 ocfs_extent_map_init (ocfs_extent_map * map);
@@ -180,8 +202,9 @@
typedef struct _bitmap_data
{
__u32 bitnum;
+ __s32 alloc_node;
__u64 fss_off; /* file system structure offset */
- __s32 alloc_node;
+ __u64 parent_off; /* offset of the fs structure housing the extent */
} bitmap_data;
typedef struct _ocfsck_context
@@ -196,7 +219,6 @@
bool dev_is_file;
ocfs_vol_disk_hdr *hdr;
__u8 *vol_bm;
- __u8 *vol_bm_orig;
__u8 *dir_bm[OCFS_MAXIMUM_NODES];
__u8 *ext_bm[OCFS_MAXIMUM_NODES];
__u32 dir_bm_sz[OCFS_MAXIMUM_NODES];
@@ -229,6 +251,7 @@
FILE *out, bool bad);
int _print_class(char *buf, ocfs_class *cl, FILE *out, bool num, GHashTable *ht);
int print_class(char *buf, ocfs_class *cl, FILE *out, GHashTable *ht);
-bitmap_data * add_bm_data(__u64 start, __u64 len, __s32 alloc_node, int type);
+bitmap_data * add_bm_data(__u64 start, __u64 len, __s32 alloc_node,
+ __u64 parent_offset, int type);
#endif /* FSCK_H */
Modified: trunk/tools/debugocfs/fsck_io.c
===================================================================
--- trunk/tools/debugocfs/fsck_io.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/debugocfs/fsck_io.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -4,7 +4,7 @@
* provides the actual file I/O support in ocfs file system
* check utility
*
- * Copyright (C) 2003 Oracle Corporation. All rights reserved.
+ * Copyright (C) 2003 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
@@ -16,7 +16,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.
@@ -25,12 +25,13 @@
*/
#include "fsck.h"
+#include "ocfsmalloc.h"
void *mem_alloc(int len)
{
void *buf;
- if ((buf = malloc(len)) == NULL)
+ if ((buf = malloc_aligned(len)) == NULL)
LOG_ERROR("unable to allocate %d bytes of memory", len);
return buf;
@@ -53,12 +54,12 @@
*/
int myread(int file, char *buf, __u32 len)
{
- int ret;
+ int ret;
- if ((ret = read(file, buf, len)) == -1)
- LOG_ERROR("read() %s", strerror(errno));
+ if ((ret = read(file, buf, len)) == -1)
+ LOG_ERROR("read() %s", strerror(errno));
- return ret;
+ return ret;
} /* myread */
@@ -68,12 +69,12 @@
*/
int mywrite(int file, char *buf, __u32 len)
{
- int ret;
+int ret;
- if ((ret = write(file, buf, len)) == -1)
- LOG_ERROR("write() %s", strerror(errno));
+ if ((ret = write(file, buf, len)) == -1)
+ LOG_ERROR("write() %s", strerror(errno));
- return ret;
+ return ret;
} /* mywrite */
/*
@@ -125,7 +126,8 @@
void *sector;
__u64 diskOffset = (fileid * OCFS_SECTOR_SIZE) + v->internal_off;
- sector = calloc(OCFS_SECTOR_SIZE, 1);
+ sector = malloc_aligned(OCFS_SECTOR_SIZE);
+ memset(sector, 0, OCFS_SECTOR_SIZE);
memcpy(sector, fe, sizeof(ocfs_file_entry));
myseek64(fd, diskOffset, SEEK_SET);
ret = write(fd, sector, OCFS_SECTOR_SIZE);
@@ -148,17 +150,22 @@
int read_one_sector(int fd, char *buf, __u64 offset, int idx)
{
+ int ret;
+
myseek64(fd, offset, SEEK_SET);
- read(fd, buf, OCFS_SECTOR_SIZE);
- return 0;
+ if ((ret = read(fd, buf, OCFS_SECTOR_SIZE)) == -1)
+ LOG_ERROR("read() %s", strerror(errno));
+ return ret;
} /* read_one_sector */
int write_one_sector(int fd, char *buf, __u64 offset, int idx)
{
int ret;
+
myseek64(fd, offset, SEEK_SET);
- ret = write(fd, buf, OCFS_SECTOR_SIZE);
+ if ((ret = write(fd, buf, OCFS_SECTOR_SIZE)) == -1)
+ LOG_ERROR("write() %s", strerror(errno));
return ret;
} /* write_one_sector */
@@ -169,7 +176,7 @@
myseek64(fd, offset, SEEK_SET);
- if ((rdlen = read(fd, buf, OCFS_SECTOR_SIZE)) != OCFS_SECTOR_SIZE)
+ if ((rdlen = read(fd, buf, DIR_NODE_SIZE)) != DIR_NODE_SIZE)
LOG_ERROR("short read for dir node... %d instead of %d bytes",
rdlen, OCFS_SECTOR_SIZE);
return 0;
@@ -180,7 +187,8 @@
{
int ret;
myseek64(fd, offset, SEEK_SET);
- ret = write(fd, buf, OCFS_SECTOR_SIZE);
+ if ((ret = write(fd, buf, DIR_NODE_SIZE)) == -1)
+ LOG_ERROR("write() %s", strerror(errno));
return ret;
} /* write_dir_node */
@@ -201,6 +209,7 @@
{
int ret;
myseek64(fd, offset, SEEK_SET);
- ret = write(fd, buf, VOL_BITMAP_BYTES);
+ if ((ret = write(fd, buf, VOL_BITMAP_BYTES)) == -1)
+ LOG_ERROR("write() %s", strerror(errno));
return ret;
} /* write_volume_bitmap */
Modified: trunk/tools/debugocfs/layout.c
===================================================================
--- trunk/tools/debugocfs/layout.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/debugocfs/layout.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -3,7 +3,7 @@
*
* ocfs file system block structure layouts
*
- * Copyright (C) 2003 Oracle Corporation. All rights reserved.
+ * Copyright (C) 2003 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.
@@ -259,7 +259,7 @@
ocfs_layout_t ocfs_header_layout[] =
{
- { 0, 1, &diskhdr_t, "Volume header" },
+ { 0, 1, &diskhdr_t, "Volume Header" },
{ 1, 1, &vollabel_t, "Volume Label" },
{ 2, 1, &bmlock_t, "Bitmap Lock" },
{ 3, 1, &nmlock_t, "NM Lock" },
@@ -278,8 +278,8 @@
{ 2704, 32, &volmdlog_t, "Volume Metadata Logfile" },
{ 2736, 32, &diralloc_t, "Directory Alloc File" },
{ 2768, 32, &dirallocbm_t, "Directory Alloc Bitmap File" },
- { 2800, 32, &filealloc_t, "File Alloc File" },
- { 2832, 32, &fileallocbm_t, "File Alloc Bitmap File" },
+ { 2800, 32, &filealloc_t, "Extent Alloc File" },
+ { 2832, 32, &fileallocbm_t, "Extent Alloc Bitmap File" },
{ 2864, 32, &recover_t, "Recover File" },
{ 2896, 32, &cleanup_t, "Cleanup File" }
};
Modified: trunk/tools/debugocfs/layout.h
===================================================================
--- trunk/tools/debugocfs/layout.h 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/debugocfs/layout.h 2003-09-03 01:05:18 UTC (rev 10)
@@ -130,6 +130,7 @@
#define OCFSCK_NEW_CFG_OFF 21504LLU /* block# 42 */
#define OCFSCK_DATA_START_OFF 1368064LLU /* block# 2672 */
#define OCFSCK_INTERNAL_OFF OCFSCK_DATA_START_OFF
+#define OCFSCK_ROOT_OFF 2416640LLU /* block# 4720 */
#define OCFSCK_MIN_MOUNT_POINT_LEN (strlen("/a"))
#define OCFSCK_END_SECTOR_BYTES (1022*512)
#define OCFSCK_NON_DATA_AREA (OCFSCK_DATA_START_OFF+OCFSCK_END_SECTOR_BYTES)
Modified: trunk/tools/debugocfs/libdebugocfs.c
===================================================================
--- trunk/tools/debugocfs/libdebugocfs.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/debugocfs/libdebugocfs.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -43,7 +43,7 @@
{
return fd;
}
- *dh = (ocfs_vol_disk_hdr *) malloc(512);
+ *dh = (ocfs_vol_disk_hdr *) malloc_aligned(512);
read_vol_disk_header(fd, *dh);
return fd;
}
@@ -57,7 +57,7 @@
{
return fd;
}
- *dh = (ocfs_vol_disk_hdr *) malloc(512);
+ *dh = (ocfs_vol_disk_hdr *) malloc_aligned(512);
read_vol_disk_header(fd, *dh);
return fd;
}
@@ -76,7 +76,7 @@
if (!arr ||
(*arr = g_array_new(TRUE, TRUE, sizeof(libocfs_stat))) == NULL)
{
- free(diskHeader);
+ free_aligned(diskHeader);
close(fd);
return 2;
}
@@ -94,7 +94,7 @@
if (off <= 0)
{
g_array_free(*arr, FALSE);
- free(diskHeader);
+ free_aligned(diskHeader);
close(fd);
return 3;
}
@@ -102,7 +102,7 @@
walk_dir_nodes(fd, off, dir, (void *) (*arr));
close(fd);
- free(diskHeader);
+ free_aligned(diskHeader);
return 0;
}
@@ -126,7 +126,7 @@
*numbits = diskHeader->num_clusters;
- free(diskHeader);
+ free_aligned(diskHeader);
close(fd);
return 0;
}
@@ -158,7 +158,7 @@
(*info)->uid = diskHeader->uid;
(*info)->gid = diskHeader->gid;
- free(diskHeader);
+ free_aligned(diskHeader);
close(fd);
return 0;
}
@@ -175,7 +175,7 @@
strlen(OCFS_VOLUME_SIGNATURE)) == 0)
ret = 1;
- free(diskHeader);
+ free_aligned(diskHeader);
close(fd);
return ret;
}
@@ -200,7 +200,7 @@
if (write_vol_disk_header(fd, diskHeader) != OCFS_SECTOR_SIZE)
ret = 2;
- free(diskHeader);
+ free_aligned(diskHeader);
close(fd);
bail:
return ret;
@@ -216,7 +216,7 @@
int status;
__u32 tmp;
- buffer = malloc(vcb->vol_layout.node_cfg_size);
+ buffer = malloc_aligned(vcb->vol_layout.node_cfg_size);
tmp = LO(vcb->vol_layout.node_cfg_size);
status =
@@ -247,7 +247,7 @@
g_array_append_val(arr, libnode);
}
bail:
- free(buffer);
+ free_aligned(buffer);
return ret;
}
@@ -275,7 +275,7 @@
ret = get_node_config_data(vcb, *arr);
free:
- free(diskHeader);
+ free_aligned(diskHeader);
free(vcb);
close(fd);
bail:
@@ -303,7 +303,7 @@
vcb = get_fake_vcb(fd, diskHeader, node);
ret = suck_file(vcb, path, file);
- free(diskHeader);
+ free_aligned(diskHeader);
free(vcb);
close(fd);
@@ -350,12 +350,12 @@
if (fe->attribs & OCFS_ATTRIB_FILE_CDSL)
{
st.attribs |= OCFS_DBGLIB_ATTRIB_FILE_CDSL;
- cdslbuf = malloc(sizeof(__u64) * MAX_NODES);
+ cdslbuf = malloc_aligned(sizeof(__u64) * MAX_NODES);
read_cdsl_data(fd, cdslbuf, fe->extents[0].disk_off);
for (j = 0; j < MAX_NODES; j++)
if (*(((__u64 *) cdslbuf) + j) != 0)
st.cdsl_bitmap |= (1 << j);
- free(cdslbuf);
+ free_aligned(cdslbuf);
}
g_array_append_val(arr, st);
Modified: trunk/tools/debugocfs/main.c
===================================================================
--- trunk/tools/debugocfs/main.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/debugocfs/main.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -123,7 +123,7 @@
ok = !ok;
break;
case 't':
- type = malloc_aligned(strlen(optarg));
+ type = malloc(strlen(optarg));
strcpy(type, optarg);
break;
case '?':
Modified: trunk/tools/debugocfs/ocfsmalloc.c
===================================================================
--- trunk/tools/debugocfs/ocfsmalloc.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/debugocfs/ocfsmalloc.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -3,7 +3,7 @@
*
* memory alloc functions used in debugocfs
*
- * Copyright (C) 2003 Oracle Corporation. All rights reserved.
+ * Copyright (C) 2003 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,46 +31,16 @@
#include "ocfsmalloc.h"
-#define SECTSIZE 512
-#define OVERHEAD (sizeof(void *))
+// too lazy to figure out where this comes from
+void *memalign(size_t boundary, size_t size);
-#ifdef USE_MALLOC_ALIGNED
-void * malloc_aligned(int size) {
- void *orig, *cnt;
- long dummy;
-
- size = size + OVERHEAD;
- size = size + SECTSIZE;
- orig = malloc(size);
-
- for(cnt = orig; cnt < orig + SECTSIZE; cnt++) {
- if ((long) cnt % (long) SECTSIZE == 0)
- break;
- }
-
- dummy = (long) orig;
- memcpy(cnt-OVERHEAD, &dummy, OVERHEAD);
-
- return(cnt);
-}
-
-void free_aligned(void *ptr) {
-#if 0
- void *orig;
-
- orig = ptr - OVERHEAD;
-
- free(orig);
-#endif
-}
-#else
-void *malloc_aligned(int size)
+void * malloc_aligned(int size)
{
- return malloc(size);
+ return memalign(512, size);
}
-void free_aligned(void *ptr)
+void free_aligned(void *ptr)
{
- free(ptr);
+ if (ptr)
+ free(ptr);
}
-#endif
Modified: trunk/tools/debugocfs/parse.c
===================================================================
--- trunk/tools/debugocfs/parse.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/debugocfs/parse.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -305,6 +305,12 @@
cm = add_member(cc, cm);
cm->flavor = strdup("char_array");
}
+ else if (strstr(buf, "// HEX"))
+ {
+ get_type_and_name(buf, cm);
+ cm = add_member(cc, cm);
+ cm->flavor = strdup("hex_array");
+ }
else if (strstr(buf, "// VOTEFLAG"))
{
get_type_and_name(buf, cm);
Modified: trunk/tools/debugocfs/print.c
===================================================================
--- trunk/tools/debugocfs/print.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/debugocfs/print.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -164,7 +164,7 @@
cs = v->cluster_size;
num = v->num_clusters;
bufsz = (num+7)/8;
- bmbuf = (char *)malloc(bufsz);
+ bmbuf = (char *)malloc_aligned(bufsz);
myseek64(fd, v->bitmap_off, SEEK_SET);
read(fd, bmbuf, bufsz);
@@ -173,7 +173,7 @@
printf("\tcluster_size = %llu\n", v->cluster_size);
printf("\tnum_clusters = %llu\n", v->num_clusters);
print_bitmap(bmbuf, num, global_bm_bitnum_to_offset, v);
- free(bmbuf);
+ free_aligned(bmbuf);
}
@@ -419,7 +419,7 @@
__u64 alloc_fs = 0, alloc_as = 0;
size = OCFS_ALIGN(allocSize, 512);
- buf = (void *) malloc(size);
+ buf = (void *) malloc_aligned(size);
if (type==OCFS_DIR_BM_SYSFILE)
allocfileid = OCFS_SYSFILE_TYPE_TO_FILE_NUM(OCFS_DIR_SYSFILE, nodenum);
@@ -482,7 +482,7 @@
}
vcb = get_fake_vcb(fd, v, nodenum);
- buf = malloc(logsize);
+ buf = malloc_aligned(logsize);
memset(buf, 0, logsize);
/*
if (fileSize == 0) {
@@ -491,7 +491,7 @@
fileSize = allocSize;
}
*/
- filebuf = malloc(fileSize);
+ filebuf = malloc_aligned(fileSize);
memset(filebuf, 0, fileSize);
st = ocfs_read_system_file(vcb, (__u32) fileid, filebuf, fileSize, (__u64)0);
if (st < 0) {
@@ -507,7 +507,7 @@
print_log_record(buf, type);
}
- free(filebuf);
+ free_aligned(filebuf);
}
else
{
@@ -515,7 +515,7 @@
}
if (buf != NULL)
- free(buf);
+ free_aligned(buf);
if (vcb != NULL)
free_aligned(vcb);
}
Modified: trunk/tools/debugocfs/sig.c
===================================================================
--- trunk/tools/debugocfs/sig.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/debugocfs/sig.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -31,6 +31,9 @@
ocfs_node_config_hdr *hdr = (ocfs_node_config_hdr *)buf;
if (!strncmp (hdr->signature, NODE_CONFIG_HDR_SIGN, NODE_CONFIG_SIGN_LEN))
return 0;
+ fprintf(stderr, "\ninvalid signature found on autoconfig header. found '%*s'\n",
+ NODE_CONFIG_SIGN_LEN, hdr->signature);
+ strcpy (hdr->signature, NODE_CONFIG_HDR_SIGN);
return -EINVAL;
}
@@ -99,6 +102,9 @@
ocfs_dir_node *dir = (ocfs_dir_node *)buf;
if (IS_VALID_DIR_NODE(dir))
return 0;
+ fprintf(stderr, "\ninvalid signature found on directory. found '%*s'\n",
+ strlen(OCFS_DIR_NODE_SIGNATURE), dir->signature);
+ strcpy (dir->signature, OCFS_DIR_NODE_SIGNATURE);
return -EINVAL;
}
@@ -107,6 +113,9 @@
ocfs_file_entry *fe = (ocfs_file_entry *)buf;
if (IS_VALID_FILE_ENTRY(fe))
return 0;
+ fprintf(stderr, "\ninvalid signature found on file entry. found '%*s'\n",
+ strlen(OCFS_FILE_ENTRY_SIGNATURE), fe->signature);
+ strcpy (fe->signature, OCFS_FILE_ENTRY_SIGNATURE);
return -EINVAL;
}
@@ -115,6 +124,9 @@
ocfs_extent_group *ext = (ocfs_extent_group *)buf;
if (IS_VALID_EXTENT_HEADER(ext))
return 0;
+ fprintf(stderr, "\ninvalid signature found on extent header. found '%*s'\n",
+ strlen(OCFS_EXTENT_HEADER_SIGNATURE), ext->signature);
+ strcpy (ext->signature, OCFS_EXTENT_HEADER_SIGNATURE);
return -EINVAL;
}
@@ -123,6 +135,9 @@
ocfs_extent_group *ext = (ocfs_extent_group *)buf;
if (IS_VALID_EXTENT_DATA(ext))
return 0;
+ fprintf(stderr, "\ninvalid signature found on extent data. found '%*s'\n",
+ strlen(OCFS_EXTENT_DATA_SIGNATURE), ext->signature);
+ strcpy (ext->signature, OCFS_EXTENT_DATA_SIGNATURE);
return -EINVAL;
}
Modified: trunk/tools/debugocfs/translate.c
===================================================================
--- trunk/tools/debugocfs/translate.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/debugocfs/translate.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -3,7 +3,7 @@
*
* display raw disk data casted as specified ocfs disk structure
*
- * Copyright (C) 2003 Oracle Corporation. All rights reserved.
+ * Copyright (C) 2003 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.
@@ -24,6 +24,7 @@
*/
#include "fsck.h"
+#include "ocfsmalloc.h"
/* special translate mode junk */
extern int ocfs_num_classes;
@@ -31,6 +32,9 @@
void translate_usage(void);
+bool prn_err = false;
+int cnt_err = 0;
+
ocfsck_context ctxt;
void translate_usage(void)
@@ -109,7 +113,7 @@
printf("offset: %lld, type: %s\n", off, cl->name);
- buf = malloc(512);
+ buf = malloc_aligned(512);
if (buf == NULL)
{
printf("failed to alloc 512 bytes\n");
@@ -122,6 +126,6 @@
ret = print_class(buf, cl, stdout, ht);
g_hash_table_destroy(ht);
- free(buf);
+ free_aligned(buf);
return ret;
}
Added: trunk/tools/debugocfs/ver.c
===================================================================
--- trunk/tools/debugocfs/ver.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/debugocfs/ver.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -0,0 +1,16 @@
+#include <stdio.h>
+
+void version(char *progname);
+
+/*
+ * version()
+ *
+ */
+void version(char *progname)
+{
+ printf("%s %s %s (build %s)\n", progname,
+ FSCK_BUILD_VERSION,
+ FSCK_BUILD_DATE,
+ FSCK_BUILD_MD5);
+ return ;
+} /* version */
Modified: trunk/tools/debugocfs/verify.c
===================================================================
--- trunk/tools/debugocfs/verify.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/debugocfs/verify.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -3,7 +3,7 @@
*
* verification checks for ocfs file system check utility
*
- * Copyright (C) 2003 Oracle Corporation. All rights reserved.
+ * Copyright (C) 2003 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.
@@ -24,6 +24,7 @@
*/
#include "fsck.h"
+#include "ocfsmalloc.h"
extern ocfsck_context ctxt;
@@ -135,7 +136,7 @@
* verify_system_file_entry()
*
*/
-int verify_system_file_entry (int fd, char *buf, int idx, GHashTable **bad, char *fname)
+int verify_system_file_entry (int fd, char *buf, int idx, GHashTable **bad, char *fname, int type)
{
int ret, i;
ocfs_file_entry *fe;
@@ -154,8 +155,19 @@
ret = -1;
}
- check_file_entry(fd, fe, fe->this_sector, true);
+ check_file_entry(fd, fe, fe->this_sector, true, "$");
+ if (fe->disk_lock.curr_master != ((type+idx) % OCFS_MAXIMUM_NODES) &&
+ fe->disk_lock.curr_master != OCFS_INVALID_NODE_NUM &&
+ fe->disk_lock.file_lock != OCFS_DLM_NO_LOCK) {
+ fprintf(stderr, "bug 3038188 found! system file locked "
+ "by another node: file=%s type=%d idx=%d node=%d.\n",
+ fname, type, idx, fe->disk_lock.curr_master);
+ fprintf(stderr, "solution: unmount on all nodes except %d, then "
+ "touch a file in any directory on node %d.\n",
+ ((type+idx) % OCFS_MAXIMUM_NODES), ((type+idx) % OCFS_MAXIMUM_NODES));
+ }
+
return ret;
} /* verify_system_file_entry */
@@ -183,9 +195,7 @@
}
if (dirbm) {
- LOG_VERBOSE("working on dir bitmap #%d allocsize=%llu\n",
- idx, fe->alloc_size);
- if ((ctxt.dir_bm[idx] = mem_alloc(fe->alloc_size)) == NULL) {
+ if ((ctxt.dir_bm[idx] = malloc_aligned(fe->alloc_size)) == NULL) {
LOG_INTERNAL();
goto bail;
}
@@ -194,9 +204,7 @@
ptr = ctxt.dir_bm[idx];
fileid = idx + OCFS_FILE_DIR_ALLOC_BITMAP;
} else {
- LOG_VERBOSE("working on extent bitmap #%d allocsize=%llu\n",
- idx, fe->alloc_size);
- if ((ctxt.ext_bm[idx] = mem_alloc(fe->alloc_size)) == NULL) {
+ if ((ctxt.ext_bm[idx] = malloc_aligned(fe->alloc_size)) == NULL) {
LOG_INTERNAL();
goto bail;
}
@@ -211,10 +219,9 @@
goto bail;
}
- LOG_VERBOSE("Reading System file #%d....", fileid);
-
ret = ocfs_read_system_file(ctxt.vcb, fileid, ptr, fe->alloc_size,
(__u64)0);
+#if 0
if (ret >= 0) {
ocfs_alloc_bm bm;
int freebits, firstclear;
@@ -228,6 +235,7 @@
} else {
LOG_VERBOSE("failed\n");
}
+#endif
if ((prev=myseek64(fd, prev, SEEK_SET)) == -1) {
LOG_INTERNAL();
@@ -247,7 +255,7 @@
char fname[30];
sprintf(fname, "%s%d", "DirBitMapFile", idx+OCFS_FILE_DIR_ALLOC_BITMAP);
load_sysfile_bitmap(fd, buf, idx, true);
- return verify_system_file_entry (fd, buf, idx, bad, fname);
+ return verify_system_file_entry (fd, buf, idx, bad, fname, OCFS_FILE_DIR_ALLOC_BITMAP);
} /* verify_dir_alloc_bitmap */
/*
@@ -259,7 +267,7 @@
char fname[30];
sprintf(fname, "%s%d", "ExtentBitMapFile", idx+OCFS_FILE_FILE_ALLOC_BITMAP);
load_sysfile_bitmap(fd, buf, idx, false);
- return verify_system_file_entry (fd, buf, idx, bad, fname);
+ return verify_system_file_entry (fd, buf, idx, bad, fname, OCFS_FILE_FILE_ALLOC_BITMAP);
} /* verify_file_alloc_bitmap */
/*
@@ -270,7 +278,7 @@
{
char fname[30];
sprintf(fname, "%s%d", "DirFile", idx+OCFS_FILE_DIR_ALLOC);
- return verify_system_file_entry (fd, buf, idx, bad, fname);
+ return verify_system_file_entry (fd, buf, idx, bad, fname, OCFS_FILE_DIR_ALLOC);
} /* verify_dir_alloc */
/*
@@ -281,7 +289,7 @@
{
char fname[30];
sprintf(fname, "%s%d", "ExtentFile", idx+OCFS_FILE_FILE_ALLOC);
- return verify_system_file_entry (fd, buf, idx, bad, fname);
+ return verify_system_file_entry (fd, buf, idx, bad, fname, OCFS_FILE_FILE_ALLOC);
} /* verify_file_alloc */
/*
@@ -292,7 +300,7 @@
{
char fname[30];
sprintf(fname, "%s", "VolMetaDataFile"); // no file #
- return verify_system_file_entry (fd, buf, idx, bad, fname);
+ return verify_system_file_entry (fd, buf, idx, bad, fname, OCFS_FILE_VOL_META_DATA);
} /* verify_vol_metadata */
/*
@@ -303,7 +311,7 @@
{
char fname[30];
sprintf(fname, "%s", "VolMetaDataLogFile"); // no file #
- return verify_system_file_entry (fd, buf, idx, bad, fname);
+ return verify_system_file_entry (fd, buf, idx, bad, fname, OCFS_FILE_VOL_LOG_FILE);
} /* verify_vol_metadata_log */
/*
@@ -314,7 +322,7 @@
{
char fname[30];
sprintf(fname, "%s%d", "CleanUpLogFile", idx+CLEANUP_FILE_BASE_ID);
- return verify_system_file_entry (fd, buf, idx, bad, fname);
+ return verify_system_file_entry (fd, buf, idx, bad, fname, CLEANUP_FILE_BASE_ID);
} /* verify_cleanup_log */
/*
@@ -325,7 +333,7 @@
{
char fname[30];
sprintf(fname, "%s%d", "RecoverLogFile", idx+LOG_FILE_BASE_ID);
- return verify_system_file_entry (fd, buf, idx, bad, fname);
+ return verify_system_file_entry (fd, buf, idx, bad, fname, LOG_FILE_BASE_ID);
} /* verify_recover_log */
/*
@@ -408,16 +416,15 @@
int verify_dir_node (int fd, char *buf, int idx, GHashTable **bad)
{
int ret = 0;
- ocfs_dir_node *dir;
+// ocfs_dir_node *dir;
ocfs_class *cl;
-// ocfs_class_member *mbr;
// int i;
+// ocfs_class_member *mbr;
// int j;
// __u64 size = 0;
// __u64 off = 0;
// char tmpstr[255];
- dir = (ocfs_dir_node *)buf;
cl = &ocfs_dir_node_class;
*bad = g_hash_table_new(g_direct_hash, g_direct_equal);
@@ -505,13 +512,13 @@
size += fe->extents[j].num_bytes;
/* __u64 file_size; */
- if (fe->file_size > size) {
+ if (!(fe->attribs & OCFS_ATTRIB_DIRECTORY) && fe->file_size > size) {
mbr = find_class_member(cl, "file_size", &i);
g_hash_table_insert(*bad, GINT_TO_POINTER(i), GINT_TO_POINTER(1));
}
/* __u64 alloc_size; */
- if (fe->alloc_size != size) {
+ if (!(fe->attribs & OCFS_ATTRIB_DIRECTORY) && fe->alloc_size != size) {
mbr = find_class_member(cl, "alloc_size", &i);
g_hash_table_insert(*bad, GINT_TO_POINTER(i), GINT_TO_POINTER(1));
}
@@ -722,14 +729,14 @@
int len, ret = -1;
struct stat st;
__u64 j;
- off_t old_off;
- ocfs_dir_node dir;
+ ocfs_dir_node *dir = NULL;
ocfs_vol_disk_hdr *hdr;
ocfs_layout_t *lay;
ocfs_class *cl;
ocfs_class_member *mbr;
int i;
+ dir = (ocfs_dir_node *) malloc_aligned(512);
hdr = (ocfs_vol_disk_hdr *)buf;
lay = find_nxt_hdr_struct(vol_disk_header, 0);
cl = lay->kind->cls;
@@ -850,15 +857,11 @@
if ((i = test_member_range(cl, "prot_bits", buf)) != -1)
g_hash_table_insert(*bad, GINT_TO_POINTER(i), GINT_TO_POINTER(1));
-// NOTE: disabling device size checking can lead to
-// invalid device_size and/or num_clusters!!!
-#ifndef DISABLE_DEVICE_SIZE_CHECK
if (hdr->device_size != ctxt.device_size)
{
mbr = find_class_member(cl, "device_size", &i);
g_hash_table_insert(*bad, GINT_TO_POINTER(i), GINT_TO_POINTER(1));
}
-#endif
ctxt.cluster_size_bits = 11; // 2048
for (j = OCFSCK_LO_CLUSTER_SIZE; j <= OCFSCK_HI_CLUSTER_SIZE; j *= 2)
@@ -866,14 +869,12 @@
ctxt.cluster_size_bits++;
if (hdr->cluster_size == j)
{
-#ifndef DISABLE_DEVICE_SIZE_CHECK
if (j * hdr->num_clusters > ctxt.device_size - OCFSCK_NON_DATA_AREA ||
hdr->num_clusters < 1 || hdr->num_clusters > OCFSCK_MAX_CLUSTERS)
{
mbr = find_class_member(cl, "num_clusters", &i);
g_hash_table_insert(*bad, GINT_TO_POINTER(i), GINT_TO_POINTER(1));
}
-#endif
break;
}
}
@@ -883,30 +884,25 @@
g_hash_table_insert(*bad, GINT_TO_POINTER(i), GINT_TO_POINTER(1));
}
- /* root dir node pointer */
- /* just do a quick check to see if it's a directory */
- /* we'll be doing a more thorough check later */
- if ((old_off = myseek64(fd, 0, SEEK_CUR)) == -1 ||
- myseek64(fd, hdr->root_off, SEEK_SET) == -1 ||
- myread(fd, (char *)&dir, sizeof(dir)) != sizeof(dir) ||
- strncmp(dir.signature, "DIRNV20", strlen("DIRNV20")) != 0)
+ /* the root off is *always* at OCFSCK_ROOT_OFF */
+ /* and we can no longer do the signature check because */
+ /* it may be bad and we want to be able to change it later */
+ if (hdr->root_off != OCFSCK_ROOT_OFF)
{
mbr = find_class_member(cl, "root_off", &i);
g_hash_table_insert(*bad, GINT_TO_POINTER(i), GINT_TO_POINTER(1));
}
- if (old_off != -1)
- if (myseek64(fd, old_off, SEEK_SET) == -1)
- LOG_INTERNAL();
+
if (g_hash_table_size(*bad) == 0)
{
memcpy(ctxt.hdr, buf, OCFS_SECTOR_SIZE);
ctxt.vcb = get_fake_vcb(ctxt.fd, ctxt.hdr, /* node# */ 0);
- if ((ret = load_volume_bitmap()) == 0)
- memcpy(ctxt.vol_bm_orig, ctxt.vol_bm, VOL_BITMAP_BYTES);
- else
+ if ((ret = load_volume_bitmap()) != 0)
LOG_ERROR("failed to read volume bitmap");
}
+ if (dir)
+ free_aligned(dir);
return ret;
} /* verify_vol_disk_header */
Modified: trunk/tools/debugocfs/verify.h
===================================================================
--- trunk/tools/debugocfs/verify.h 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/debugocfs/verify.h 2003-09-03 01:05:18 UTC (rev 10)
@@ -50,8 +50,8 @@
int type, __u64 up_ptr);
int verify_extent_header (int fd, char *buf, int idx, GHashTable **bad);
int verify_extent_data (int fd, char *buf, int idx, GHashTable **bad);
-int verify_system_file_entry (int fd, char *buf, int idx, GHashTable **bad,
- char *fname);
+int verify_system_file_entry (int fd, char *buf, int idx, GHashTable **bad,
+ char *fname, int type);
int load_volume_bitmap(void);
#endif /* VERIFY_H */
Modified: trunk/tools/format/Makefile
===================================================================
--- trunk/tools/format/Makefile 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/format/Makefile 2003-09-03 01:05:18 UTC (rev 10)
@@ -5,7 +5,7 @@
WARNINGS = -Wall -Wstrict-prototypes -Wno-format -Wmissing-prototypes \
-Wmissing-declarations
-CFLAGS = $(WARNINGS)
+CFLAGS = -fno-strict-aliasing $(WARNINGS)
ifdef OCFS_DEBUG
CFLAGS += -g
@@ -17,9 +17,13 @@
DEFINES = -DLINUX -DUSERSPACE_TOOL
ifeq ($(OCFS_PROCESSOR),x86_64)
- DEFINES += -Dx86_64
CFLAGS += -O0 -m64
-else
+endif
+ifeq ($(OCFS_PROCESSOR),ia64)
+ CFLAGS += -O0
+endif
+ifeq ($(OCFS_PROCESSOR),i686)
+ DEFINES += -D__ILP32__
CFLAGS += -O2
endif
Modified: trunk/tools/format/format.c
===================================================================
--- trunk/tools/format/format.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/format/format.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -727,7 +727,9 @@
volhdr->root_bitmap_off = 0;
volhdr->root_bitmap_size = 0;
volhdr->data_start_off = volhdr->bitmap_off + BitmapSize + BegFreeSize;
- volhdr->data_start_off = OCFS_ALIGN(volhdr->data_start_off, PAGE_SIZE);
+#define OCFS_DATA_START_ALIGN 4096
+ volhdr->data_start_off = OCFS_ALIGN(volhdr->data_start_off,
+ OCFS_DATA_START_ALIGN);
/* calculate number of data blocks */
*data_start_off = volhdr->data_start_off;
Modified: trunk/tools/format/frmtport.c
===================================================================
--- trunk/tools/format/frmtport.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/format/frmtport.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -96,14 +96,14 @@
*/
int GetDiskGeometry(int file, __u64 * vollength, __u32 * sect_size)
{
-#ifdef x86_64
+#ifdef __LP64__
__u64 devicesize;
#else
__u32 devicesize; /* SM: should be __s32... struct hd_struct.nr_sects */
#endif
int ret = 0;
-#ifdef x86_64
+#ifdef __LP64__
#define u64 __u64
if (ioctl(file, BLKGETSIZE64, &devicesize) == -1)
#else
@@ -129,7 +129,7 @@
if (devicesize && *sect_size)
{
*vollength = devicesize;
-#ifndef x86_64
+#ifndef __LP64__
*vollength *= *sect_size;
#endif
ret = 1;
Modified: trunk/tools/ocfs_uid_gen/ocfs_uid_gen
===================================================================
--- trunk/tools/ocfs_uid_gen/ocfs_uid_gen 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/ocfs_uid_gen/ocfs_uid_gen 2003-09-03 01:05:18 UTC (rev 10)
@@ -48,6 +48,9 @@
#
+# Force LC_ALL=C for proper ifconfig(8) parsing
+export LC_ALL=C
+
#
###################################################################
# Variables
Modified: trunk/tools/ocfstool/Makefile
===================================================================
--- trunk/tools/ocfstool/Makefile 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/ocfstool/Makefile 2003-09-03 01:05:18 UTC (rev 10)
@@ -2,6 +2,14 @@
include $(TOPDIR)/Preamble.make
+WARNINGS = -Wall
+
+CFLAGS = $(WARNINGS)
+
+ifdef OCFS_DEBUG
+CFLAGS += -g
+endif
+
BIN_PROGRAMS = ocfstool
MANS = ocfstool.1
@@ -9,7 +17,15 @@
DEFINES = -DOCFSTOOL_VERSION=\"0.0.5\"
INCLUDES = $(GTK_CFLAGS) -I../debugocfs
-CFLAGS += -Wall
+ifeq ($(OCFS_PROCESSOR),x86_64)
+ CFLAGS += -O0 -m64
+endif
+ifeq ($(OCFS_PROCESSOR),ia64)
+ CFLAGS += -O0
+endif
+ifeq ($(OCFS_PROCESSOR),i686)
+ CFLAGS += -O2
+endif
CBITS = \
ocfsbitmap.c \
Modified: trunk/tools/ocfstool/ocfsgenconfig.c
===================================================================
--- trunk/tools/ocfstool/ocfsgenconfig.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/ocfstool/ocfsgenconfig.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -172,6 +172,7 @@
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");
fclose (config);
Modified: trunk/tools/ocfstool/ocfsguiutil.c
===================================================================
--- trunk/tools/ocfstool/ocfsguiutil.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/ocfstool/ocfsguiutil.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -414,7 +414,7 @@
else if (bytes < 1024)
return g_strdup_printf ("%llu bytes", bytes);
- for (i = -1; i < 4 && fbytes >= 1024; i++)
+ for (i = -1; i < 3 && fbytes >= 1024; i++)
fbytes /= 1024;
if (show_bytes)
Modified: trunk/tools/sizetest/Makefile
===================================================================
--- trunk/tools/sizetest/Makefile 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/sizetest/Makefile 2003-09-03 01:05:18 UTC (rev 10)
@@ -1,22 +1,21 @@
-#
-# Makefile for OCFS
-#
-
TOPDIR = ../..
include $(TOPDIR)/Preamble.make
# default include
-INC=/usr/src/linux/include
+INC=$(KERNELDIR)/include
DEFINES=-DMODULE -DLINUX -D__KERNEL__
CFLAGS=-nostdinc -fomit-frame-pointer -I../../ocfs2/Common/inc -I$(INC) -I../../ocfs2/Linux/inc -I$(GCCINC)
LDADD=-nostdlib
ifeq ($(OCFS_PROCESSOR),x86_64)
- DEFINES += -Dx86_64 -D__x86_64__
CFLAGS += -O0 -m64
-else
+endif
+ifeq ($(OCFS_PROCESSOR),ia64)
+ CFLAGS += -O0
+endif
+ifeq ($(OCFS_PROCESSOR),i686)
CFLAGS += -O2
endif
@@ -29,15 +28,25 @@
DIST_RULES = dist-incdir
-BIN_PROGRAMS = sizetest hexsizetest
+VERSION_FILES = diskstructs.c netstructs.c
+VERSION_SRC = diskstructs.c netstructs.c
+VERSION_PREFIX = OCFS
-all: sizetest hexsizetest
+BIN_PROGRAMS = diskstructs netstructs sizetest hexsizetest
+all: diskstructs netstructs sizetest hexsizetest
+
+diskstructs: diskstructs.c
+ $(LINK)
+
+netstructs: netstructs.c
+ $(LINK)
+
sizetest: sizetest.c
$(LINK)
hexsizetest: sizetest.c
- $(LINK)
+ $(LINK) -DUSE_HEX
dist-incdir:
$(TOPDIR)/mkinstalldirs $(DIST_DIR)/inc
Added: trunk/tools/sizetest/disk.txt
===================================================================
--- trunk/tools/sizetest/disk.txt 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/sizetest/disk.txt 2003-09-03 01:05:18 UTC (rev 10)
@@ -0,0 +1,940 @@
+sizeof(ocfs_alloc_ext) = 24
+ file_off = 0
+ num_bytes = 8
+ disk_off = 16
+
+sizeof(ocfs_publish) = 84
+ time = 0
+ vote = 8
+ dirty = 12
+ vote_type = 16
+ vote_map = 20
+ publ_seq_num = 28
+ dir_ent = 36
+ hbm[i] = 44
+ hbm[i] = 45
+ hbm[i] = 46
+ hbm[i] = 47
+ hbm[i] = 48
+ hbm[i] = 49
+ hbm[i] = 50
+ hbm[i] = 51
+ hbm[i] = 52
+ hbm[i] = 53
+ hbm[i] = 54
+ hbm[i] = 55
+ hbm[i] = 56
+ hbm[i] = 57
+ hbm[i] = 58
+ hbm[i] = 59
+ hbm[i] = 60
+ hbm[i] = 61
+ hbm[i] = 62
+ hbm[i] = 63
+ hbm[i] = 64
+ hbm[i] = 65
+ hbm[i] = 66
+ hbm[i] = 67
+ hbm[i] = 68
+ hbm[i] = 69
+ hbm[i] = 70
+ hbm[i] = 71
+ hbm[i] = 72
+ hbm[i] = 73
+ hbm[i] = 74
+ hbm[i] = 75
+ comm_seq_num = 76
+
+sizeof(ocfs_vote) = 52
+ vote[i] = 0
+ vote[i] = 1
+ vote[i] = 2
+ vote[i] = 3
+ vote[i] = 4
+ vote[i] = 5
+ vote[i] = 6
+ vote[i] = 7
+ vote[i] = 8
+ vote[i] = 9
+ vote[i] = 10
+ vote[i] = 11
+ vote[i] = 12
+ vote[i] = 13
+ vote[i] = 14
+ vote[i] = 15
+ vote[i] = 16
+ vote[i] = 17
+ vote[i] = 18
+ vote[i] = 19
+ vote[i] = 20
+ vote[i] = 21
+ vote[i] = 22
+ vote[i] = 23
+ vote[i] = 24
+ vote[i] = 25
+ vote[i] = 26
+ vote[i] = 27
+ vote[i] = 28
+ vote[i] = 29
+ vote[i] = 30
+ vote[i] = 31
+ vote_seq_num = 32
+ dir_ent = 40
+ open_handle = 48
+
+sizeof(ocfs_file_entry) = 484
+ disk_lock = 0
+ signature = 48
+ local_ext = 56
+ next_free_ext = 60
+ next_del = 61
+ granularity = 64
+ filename = 68
+ filename_len = 324
+ file_size = 328
+ alloc_size = 336
+ create_time = 344
+ modify_time = 352
+ extents[i] = 360
+ extents[i] = 384
+ extents[i] = 408
+ dir_node_ptr = 432
+ this_sector = 440
+ last_ext_ptr = 448
+ sync_flags = 456
+ link_cnt = 460
+ attribs = 464
+ prot_bits = 468
+ uid = 472
+ gid = 476
+ dev_major = 480
+ dev_minor = 482
+
+sizeof(ocfs_index_node) = 20
+ down_ptr = 0
+ file_ent_ptr = 8
+ name_len = 16
+ name = 17
+
+sizeof(ocfs_index_hdr) = 508
+ disk_lock = 0
+ signature = 48
+ up_tree_ptr = 56
+ node_disk_off = 64
+ state = 72
+ down_ptr = 76
+ num_ents = 84
+ depth = 85
+ num_ent_used = 86
+ dir_node_flags = 87
+ sync_flags = 88
+ index = 89
+ reserved = 345
+ file_ent = 506
+
+sizeof(ocfs_dir_node) = 512
+ disk_lock = 0
+ signature = 48
+ alloc_file_off = 56
+ alloc_node = 64
+ free_node_ptr = 68
+ node_disk_off = 76
+ next_node_ptr = 84
+ indx_node_ptr = 92
+ next_del_ent_node = 100
+ head_del_ent_node = 108
+ first_del = 116
+ num_del = 117
+ num_ents = 118
+ depth = 119
+ num_ent_used = 120
+ dir_node_flags = 121
+ sync_flags = 122
+ index = 123
+ index_dirty = 379
+ bad_off = 380
+ reserved = 381
+ file_ent = 508
+
+sizeof(ocfs_extent_group) = 504
+ signature = 0
+ next_free_ext = 8
+ curr_sect = 12
+ max_sects = 16
+ type = 20
+ granularity = 24
+ alloc_node = 28
+ this_ext = 32
+ next_data_ext = 40
+ alloc_file_off = 48
+ last_ext_ptr = 56
+ up_hdr_node_ptr = 64
+ extents[i] = 72
+ extents[i] = 96
+ extents[i] = 120
+ extents[i] = 144
+ extents[i] = 168
+ extents[i] = 192
+ extents[i] = 216
+ extents[i] = 240
+ extents[i] = 264
+ extents[i] = 288
+ extents[i] = 312
+ extents[i] = 336
+ extents[i] = 360
+ extents[i] = 384
+ extents[i] = 408
+ extents[i] = 432
+ extents[i] = 456
+ extents[i] = 480
+
+sizeof(ocfs_bitmap_lock) = 52
+ disk_lock = 0
+ used_bits = 48
+
+sizeof(ocfs_offset_map) = 20
+ length = 0
+ log_disk_off = 4
+ actual_disk_off = 12
+
+sizeof(ocfs_vol_disk_hdr) = 440
+ minor_version = 0
+ major_version = 4
+ signature = 8
+ mount_point = 136
+ serial_num = 264
+ device_size = 272
+ start_off = 280
+ bitmap_off = 288
+ publ_off = 296
+ vote_off = 304
+ root_bitmap_off = 312
+ data_start_off = 320
+ root_bitmap_size = 328
+ root_off = 336
+ root_size = 344
+ cluster_size = 352
+ num_nodes = 360
+ num_clusters = 368
+ dir_node_size = 376
+ file_node_size = 384
+ internal_off = 392
+ node_cfg_off = 400
+ node_cfg_size = 408
+ new_cfg_off = 416
+ prot_bits = 424
+ uid = 428
+ gid = 432
+ excl_mount = 436
+
+sizeof(ocfs_disk_lock) = 48
+ curr_master = 0
+ file_lock = 4
+ last_write_time = 8
+ last_read_time = 16
+ writer_node_num = 24
+ reader_node_num = 28
+ oin_node_map = 32
+ dlock_seq_num = 40
+
+sizeof(ocfs_vol_label) = 200
+ disk_lock = 0
+ label = 48
+ label_len = 112
+ vol_id = 114
+ vol_id_len = 130
+ cluster_name = 132
+ cluster_name_len = 196
+
+sizeof(ocfs_ipc_config_info) = 76
+ type = 0
+ ip_addr = 1
+ ip_port = 36
+ ip_mask = 40
+
+sizeof(ocfs_guid) = 32
+ guid = 0
+ id.host_id = 0
+ id.mac_id = 20
+
+sizeof(ocfs_disk_node_config_info) = 192
+ disk_lock = 0
+ node_name = 48
+ guid = 81
+ ipc_config = 116
+
+sizeof(ocfs_node_config_hdr) = 76
+ disk_lock = 0
+ signature = 48
+ version = 56
+ num_nodes = 60
+ last_node = 64
+ cfg_seq_num = 68
+
+sizeof(ocfs_cdsl) = 1032
+ name = 0
+ flags = 1024
+ operation = 1028
+
+sizeof(ocfs_free_bitmap) = 24
+ length = 0
+ file_off = 8
+ type = 16
+ node_num = 20
+
+sizeof(ocfs_free_extent_log) = 16
+ index = 0
+ disk_off = 8
+
+sizeof(ocfs_free_log) = 3608
+ num_free_upds = 0
+ free_bitmap[i] = 8
+ free_bitmap[i] = 32
+ free_bitmap[i] = 56
+ free_bitmap[i] = 80
+ free_bitmap[i] = 104
+ free_bitmap[i] = 128
+ free_bitmap[i] = 152
+ free_bitmap[i] = 176
+ free_bitmap[i] = 200
+ free_bitmap[i] = 224
+ free_bitmap[i] = 248
+ free_bitmap[i] = 272
+ free_bitmap[i] = 296
+ free_bitmap[i] = 320
+ free_bitmap[i] = 344
+ free_bitmap[i] = 368
+ free_bitmap[i] = 392
+ free_bitmap[i] = 416
+ free_bitmap[i] = 440
+ free_bitmap[i] = 464
+ free_bitmap[i] = 488
+ free_bitmap[i] = 512
+ free_bitmap[i] = 536
+ free_bitmap[i] = 560
+ free_bitmap[i] = 584
+ free_bitmap[i] = 608
+ free_bitmap[i] = 632
+ free_bitmap[i] = 656
+ free_bitmap[i] = 680
+ free_bitmap[i] = 704
+ free_bitmap[i] = 728
+ free_bitmap[i] = 752
+ free_bitmap[i] = 776
+ free_bitmap[i] = 800
+ free_bitmap[i] = 824
+ free_bitmap[i] = 848
+ free_bitmap[i] = 872
+ free_bitmap[i] = 896
+ free_bitmap[i] = 920
+ free_bitmap[i] = 944
+ free_bitmap[i] = 968
+ free_bitmap[i] = 992
+ free_bitmap[i] = 1016
+ free_bitmap[i] = 1040
+ free_bitmap[i] = 1064
+ free_bitmap[i] = 1088
+ free_bitmap[i] = 1112
+ free_bitmap[i] = 1136
+ free_bitmap[i] = 1160
+ free_bitmap[i] = 1184
+ free_bitmap[i] = 1208
+ free_bitmap[i] = 1232
+ free_bitmap[i] = 1256
+ free_bitmap[i] = 1280
+ free_bitmap[i] = 1304
+ free_bitmap[i] = 1328
+ free_bitmap[i] = 1352
+ free_bitmap[i] = 1376
+ free_bitmap[i] = 1400
+ free_bitmap[i] = 1424
+ free_bitmap[i] = 1448
+ free_bitmap[i] = 1472
+ free_bitmap[i] = 1496
+ free_bitmap[i] = 1520
+ free_bitmap[i] = 1544
+ free_bitmap[i] = 1568
+ free_bitmap[i] = 1592
+ free_bitmap[i] = 1616
+ free_bitmap[i] = 1640
+ free_bitmap[i] = 1664
+ free_bitmap[i] = 1688
+ free_bitmap[i] = 1712
+ free_bitmap[i] = 1736
+ free_bitmap[i] = 1760
+ free_bitmap[i] = 1784
+ free_bitmap[i] = 1808
+ free_bitmap[i] = 1832
+ free_bitmap[i] = 1856
+ free_bitmap[i] = 1880
+ free_bitmap[i] = 1904
+ free_bitmap[i] = 1928
+ free_bitmap[i] = 1952
+ free_bitmap[i] = 1976
+ free_bitmap[i] = 2000
+ free_bitmap[i] = 2024
+ free_bitmap[i] = 2048
+ free_bitmap[i] = 2072
+ free_bitmap[i] = 2096
+ free_bitmap[i] = 2120
+ free_bitmap[i] = 2144
+ free_bitmap[i] = 2168
+ free_bitmap[i] = 2192
+ free_bitmap[i] = 2216
+ free_bitmap[i] = 2240
+ free_bitmap[i] = 2264
+ free_bitmap[i] = 2288
+ free_bitmap[i] = 2312
+ free_bitmap[i] = 2336
+ free_bitmap[i] = 2360
+ free_bitmap[i] = 2384
+ free_bitmap[i] = 2408
+ free_bitmap[i] = 2432
+ free_bitmap[i] = 2456
+ free_bitmap[i] = 2480
+ free_bitmap[i] = 2504
+ free_bitmap[i] = 2528
+ free_bitmap[i] = 2552
+ free_bitmap[i] = 2576
+ free_bitmap[i] = 2600
+ free_bitmap[i] = 2624
+ free_bitmap[i] = 2648
+ free_bitmap[i] = 2672
+ free_bitmap[i] = 2696
+ free_bitmap[i] = 2720
+ free_bitmap[i] = 2744
+ free_bitmap[i] = 2768
+ free_bitmap[i] = 2792
+ free_bitmap[i] = 2816
+ free_bitmap[i] = 2840
+ free_bitmap[i] = 2864
+ free_bitmap[i] = 2888
+ free_bitmap[i] = 2912
+ free_bitmap[i] = 2936
+ free_bitmap[i] = 2960
+ free_bitmap[i] = 2984
+ free_bitmap[i] = 3008
+ free_bitmap[i] = 3032
+ free_bitmap[i] = 3056
+ free_bitmap[i] = 3080
+ free_bitmap[i] = 3104
+ free_bitmap[i] = 3128
+ free_bitmap[i] = 3152
+ free_bitmap[i] = 3176
+ free_bitmap[i] = 3200
+ free_bitmap[i] = 3224
+ free_bitmap[i] = 3248
+ free_bitmap[i] = 3272
+ free_bitmap[i] = 3296
+ free_bitmap[i] = 3320
+ free_bitmap[i] = 3344
+ free_bitmap[i] = 3368
+ free_bitmap[i] = 3392
+ free_bitmap[i] = 3416
+ free_bitmap[i] = 3440
+ free_bitmap[i] = 3464
+ free_bitmap[i] = 3488
+ free_bitmap[i] = 3512
+ free_bitmap[i] = 3536
+ free_bitmap[i] = 3560
+ free_bitmap[i] = 3584
+
+sizeof(ocfs_delete_log) = 32
+ node_num = 0
+ ent_del = 8
+ parent_dirnode_off = 16
+ flags = 24
+
+sizeof(ocfs_recovery_log) = 8
+ node_num = 0
+
+sizeof(ocfs_alloc_log) = 24
+ length = 0
+ file_off = 8
+ type = 16
+ node_num = 20
+
+sizeof(ocfs_dir_log) = 24
+ orig_off = 0
+ saved_off = 8
+ length = 16
+
+sizeof(ocfs_lock_log) = 7208
+ num_lock_upds = 0
+ lock_upd[i] = 8
+ lock_upd[i] = 24
+ lock_upd[i] = 40
+ lock_upd[i] = 56
+ lock_upd[i] = 72
+ lock_upd[i] = 88
+ lock_upd[i] = 104
+ lock_upd[i] = 120
+ lock_upd[i] = 136
+ lock_upd[i] = 152
+ lock_upd[i] = 168
+ lock_upd[i] = 184
+ lock_upd[i] = 200
+ lock_upd[i] = 216
+ lock_upd[i] = 232
+ lock_upd[i] = 248
+ lock_upd[i] = 264
+ lock_upd[i] = 280
+ lock_upd[i] = 296
+ lock_upd[i] = 312
+ lock_upd[i] = 328
+ lock_upd[i] = 344
+ lock_upd[i] = 360
+ lock_upd[i] = 376
+ lock_upd[i] = 392
+ lock_upd[i] = 408
+ lock_upd[i] = 424
+ lock_upd[i] = 440
+ lock_upd[i] = 456
+ lock_upd[i] = 472
+ lock_upd[i] = 488
+ lock_upd[i] = 504
+ lock_upd[i] = 520
+ lock_upd[i] = 536
+ lock_upd[i] = 552
+ lock_upd[i] = 568
+ lock_upd[i] = 584
+ lock_upd[i] = 600
+ lock_upd[i] = 616
+ lock_upd[i] = 632
+ lock_upd[i] = 648
+ lock_upd[i] = 664
+ lock_upd[i] = 680
+ lock_upd[i] = 696
+ lock_upd[i] = 712
+ lock_upd[i] = 728
+ lock_upd[i] = 744
+ lock_upd[i] = 760
+ lock_upd[i] = 776
+ lock_upd[i] = 792
+ lock_upd[i] = 808
+ lock_upd[i] = 824
+ lock_upd[i] = 840
+ lock_upd[i] = 856
+ lock_upd[i] = 872
+ lock_upd[i] = 888
+ lock_upd[i] = 904
+ lock_upd[i] = 920
+ lock_upd[i] = 936
+ lock_upd[i] = 952
+ lock_upd[i] = 968
+ lock_upd[i] = 984
+ lock_upd[i] = 1000
+ lock_upd[i] = 1016
+ lock_upd[i] = 1032
+ lock_upd[i] = 1048
+ lock_upd[i] = 1064
+ lock_upd[i] = 1080
+ lock_upd[i] = 1096
+ lock_upd[i] = 1112
+ lock_upd[i] = 1128
+ lock_upd[i] = 1144
+ lock_upd[i] = 1160
+ lock_upd[i] = 1176
+ lock_upd[i] = 1192
+ lock_upd[i] = 1208
+ lock_upd[i] = 1224
+ lock_upd[i] = 1240
+ lock_upd[i] = 1256
+ lock_upd[i] = 1272
+ lock_upd[i] = 1288
+ lock_upd[i] = 1304
+ lock_upd[i] = 1320
+ lock_upd[i] = 1336
+ lock_upd[i] = 1352
+ lock_upd[i] = 1368
+ lock_upd[i] = 1384
+ lock_upd[i] = 1400
+ lock_upd[i] = 1416
+ lock_upd[i] = 1432
+ lock_upd[i] = 1448
+ lock_upd[i] = 1464
+ lock_upd[i] = 1480
+ lock_upd[i] = 1496
+ lock_upd[i] = 1512
+ lock_upd[i] = 1528
+ lock_upd[i] = 1544
+ lock_upd[i] = 1560
+ lock_upd[i] = 1576
+ lock_upd[i] = 1592
+ lock_upd[i] = 1608
+ lock_upd[i] = 1624
+ lock_upd[i] = 1640
+ lock_upd[i] = 1656
+ lock_upd[i] = 1672
+ lock_upd[i] = 1688
+ lock_upd[i] = 1704
+ lock_upd[i] = 1720
+ lock_upd[i] = 1736
+ lock_upd[i] = 1752
+ lock_upd[i] = 1768
+ lock_upd[i] = 1784
+ lock_upd[i] = 1800
+ lock_upd[i] = 1816
+ lock_upd[i] = 1832
+ lock_upd[i] = 1848
+ lock_upd[i] = 1864
+ lock_upd[i] = 1880
+ lock_upd[i] = 1896
+ lock_upd[i] = 1912
+ lock_upd[i] = 1928
+ lock_upd[i] = 1944
+ lock_upd[i] = 1960
+ lock_upd[i] = 1976
+ lock_upd[i] = 1992
+ lock_upd[i] = 2008
+ lock_upd[i] = 2024
+ lock_upd[i] = 2040
+ lock_upd[i] = 2056
+ lock_upd[i] = 2072
+ lock_upd[i] = 2088
+ lock_upd[i] = 2104
+ lock_upd[i] = 2120
+ lock_upd[i] = 2136
+ lock_upd[i] = 2152
+ lock_upd[i] = 2168
+ lock_upd[i] = 2184
+ lock_upd[i] = 2200
+ lock_upd[i] = 2216
+ lock_upd[i] = 2232
+ lock_upd[i] = 2248
+ lock_upd[i] = 2264
+ lock_upd[i] = 2280
+ lock_upd[i] = 2296
+ lock_upd[i] = 2312
+ lock_upd[i] = 2328
+ lock_upd[i] = 2344
+ lock_upd[i] = 2360
+ lock_upd[i] = 2376
+ lock_upd[i] = 2392
+ lock_upd[i] = 2408
+ lock_upd[i] = 2424
+ lock_upd[i] = 2440
+ lock_upd[i] = 2456
+ lock_upd[i] = 2472
+ lock_upd[i] = 2488
+ lock_upd[i] = 2504
+ lock_upd[i] = 2520
+ lock_upd[i] = 2536
+ lock_upd[i] = 2552
+ lock_upd[i] = 2568
+ lock_upd[i] = 2584
+ lock_upd[i] = 2600
+ lock_upd[i] = 2616
+ lock_upd[i] = 2632
+ lock_upd[i] = 2648
+ lock_upd[i] = 2664
+ lock_upd[i] = 2680
+ lock_upd[i] = 2696
+ lock_upd[i] = 2712
+ lock_upd[i] = 2728
+ lock_upd[i] = 2744
+ lock_upd[i] = 2760
+ lock_upd[i] = 2776
+ lock_upd[i] = 2792
+ lock_upd[i] = 2808
+ lock_upd[i] = 2824
+ lock_upd[i] = 2840
+ lock_upd[i] = 2856
+ lock_upd[i] = 2872
+ lock_upd[i] = 2888
+ lock_upd[i] = 2904
+ lock_upd[i] = 2920
+ lock_upd[i] = 2936
+ lock_upd[i] = 2952
+ lock_upd[i] = 2968
+ lock_upd[i] = 2984
+ lock_upd[i] = 3000
+ lock_upd[i] = 3016
+ lock_upd[i] = 3032
+ lock_upd[i] = 3048
+ lock_upd[i] = 3064
+ lock_upd[i] = 3080
+ lock_upd[i] = 3096
+ lock_upd[i] = 3112
+ lock_upd[i] = 3128
+ lock_upd[i] = 3144
+ lock_upd[i] = 3160
+ lock_upd[i] = 3176
+ lock_upd[i] = 3192
+ lock_upd[i] = 3208
+ lock_upd[i] = 3224
+ lock_upd[i] = 3240
+ lock_upd[i] = 3256
+ lock_upd[i] = 3272
+ lock_upd[i] = 3288
+ lock_upd[i] = 3304
+ lock_upd[i] = 3320
+ lock_upd[i] = 3336
+ lock_upd[i] = 3352
+ lock_upd[i] = 3368
+ lock_upd[i] = 3384
+ lock_upd[i] = 3400
+ lock_upd[i] = 3416
+ lock_upd[i] = 3432
+ lock_upd[i] = 3448
+ lock_upd[i] = 3464
+ lock_upd[i] = 3480
+ lock_upd[i] = 3496
+ lock_upd[i] = 3512
+ lock_upd[i] = 3528
+ lock_upd[i] = 3544
+ lock_upd[i] = 3560
+ lock_upd[i] = 3576
+ lock_upd[i] = 3592
+ lock_upd[i] = 3608
+ lock_upd[i] = 3624
+ lock_upd[i] = 3640
+ lock_upd[i] = 3656
+ lock_upd[i] = 3672
+ lock_upd[i] = 3688
+ lock_upd[i] = 3704
+ lock_upd[i] = 3720
+ lock_upd[i] = 3736
+ lock_upd[i] = 3752
+ lock_upd[i] = 3768
+ lock_upd[i] = 3784
+ lock_upd[i] = 3800
+ lock_upd[i] = 3816
+ lock_upd[i] = 3832
+ lock_upd[i] = 3848
+ lock_upd[i] = 3864
+ lock_upd[i] = 3880
+ lock_upd[i] = 3896
+ lock_upd[i] = 3912
+ lock_upd[i] = 3928
+ lock_upd[i] = 3944
+ lock_upd[i] = 3960
+ lock_upd[i] = 3976
+ lock_upd[i] = 3992
+ lock_upd[i] = 4008
+ lock_upd[i] = 4024
+ lock_upd[i] = 4040
+ lock_upd[i] = 4056
+ lock_upd[i] = 4072
+ lock_upd[i] = 4088
+ lock_upd[i] = 4104
+ lock_upd[i] = 4120
+ lock_upd[i] = 4136
+ lock_upd[i] = 4152
+ lock_upd[i] = 4168
+ lock_upd[i] = 4184
+ lock_upd[i] = 4200
+ lock_upd[i] = 4216
+ lock_upd[i] = 4232
+ lock_upd[i] = 4248
+ lock_upd[i] = 4264
+ lock_upd[i] = 4280
+ lock_upd[i] = 4296
+ lock_upd[i] = 4312
+ lock_upd[i] = 4328
+ lock_upd[i] = 4344
+ lock_upd[i] = 4360
+ lock_upd[i] = 4376
+ lock_upd[i] = 4392
+ lock_upd[i] = 4408
+ lock_upd[i] = 4424
+ lock_upd[i] = 4440
+ lock_upd[i] = 4456
+ lock_upd[i] = 4472
+ lock_upd[i] = 4488
+ lock_upd[i] = 4504
+ lock_upd[i] = 4520
+ lock_upd[i] = 4536
+ lock_upd[i] = 4552
+ lock_upd[i] = 4568
+ lock_upd[i] = 4584
+ lock_upd[i] = 4600
+ lock_upd[i] = 4616
+ lock_upd[i] = 4632
+ lock_upd[i] = 4648
+ lock_upd[i] = 4664
+ lock_upd[i] = 4680
+ lock_upd[i] = 4696
+ lock_upd[i] = 4712
+ lock_upd[i] = 4728
+ lock_upd[i] = 4744
+ lock_upd[i] = 4760
+ lock_upd[i] = 4776
+ lock_upd[i] = 4792
+ lock_upd[i] = 4808
+ lock_upd[i] = 4824
+ lock_upd[i] = 4840
+ lock_upd[i] = 4856
+ lock_upd[i] = 4872
+ lock_upd[i] = 4888
+ lock_upd[i] = 4904
+ lock_upd[i] = 4920
+ lock_upd[i] = 4936
+ lock_upd[i] = 4952
+ lock_upd[i] = 4968
+ lock_upd[i] = 4984
+ lock_upd[i] = 5000
+ lock_upd[i] = 5016
+ lock_upd[i] = 5032
+ lock_upd[i] = 5048
+ lock_upd[i] = 5064
+ lock_upd[i] = 5080
+ lock_upd[i] = 5096
+ lock_upd[i] = 5112
+ lock_upd[i] = 5128
+ lock_upd[i] = 5144
+ lock_upd[i] = 5160
+ lock_upd[i] = 5176
+ lock_upd[i] = 5192
+ lock_upd[i] = 5208
+ lock_upd[i] = 5224
+ lock_upd[i] = 5240
+ lock_upd[i] = 5256
+ lock_upd[i] = 5272
+ lock_upd[i] = 5288
+ lock_upd[i] = 5304
+ lock_upd[i] = 5320
+ lock_upd[i] = 5336
+ lock_upd[i] = 5352
+ lock_upd[i] = 5368
+ lock_upd[i] = 5384
+ lock_upd[i] = 5400
+ lock_upd[i] = 5416
+ lock_upd[i] = 5432
+ lock_upd[i] = 5448
+ lock_upd[i] = 5464
+ lock_upd[i] = 5480
+ lock_upd[i] = 5496
+ lock_upd[i] = 5512
+ lock_upd[i] = 5528
+ lock_upd[i] = 5544
+ lock_upd[i] = 5560
+ lock_upd[i] = 5576
+ lock_upd[i] = 5592
+ lock_upd[i] = 5608
+ lock_upd[i] = 5624
+ lock_upd[i] = 5640
+ lock_upd[i] = 5656
+ lock_upd[i] = 5672
+ lock_upd[i] = 5688
+ lock_upd[i] = 5704
+ lock_upd[i] = 5720
+ lock_upd[i] = 5736
+ lock_upd[i] = 5752
+ lock_upd[i] = 5768
+ lock_upd[i] = 5784
+ lock_upd[i] = 5800
+ lock_upd[i] = 5816
+ lock_upd[i] = 5832
+ lock_upd[i] = 5848
+ lock_upd[i] = 5864
+ lock_upd[i] = 5880
+ lock_upd[i] = 5896
+ lock_upd[i] = 5912
+ lock_upd[i] = 5928
+ lock_upd[i] = 5944
+ lock_upd[i] = 5960
+ lock_upd[i] = 5976
+ lock_upd[i] = 5992
+ lock_upd[i] = 6008
+ lock_upd[i] = 6024
+ lock_upd[i] = 6040
+ lock_upd[i] = 6056
+ lock_upd[i] = 6072
+ lock_upd[i] = 6088
+ lock_upd[i] = 6104
+ lock_upd[i] = 6120
+ lock_upd[i] = 6136
+ lock_upd[i] = 6152
+ lock_upd[i] = 6168
+ lock_upd[i] = 6184
+ lock_upd[i] = 6200
+ lock_upd[i] = 6216
+ lock_upd[i] = 6232
+ lock_upd[i] = 6248
+ lock_upd[i] = 6264
+ lock_upd[i] = 6280
+ lock_upd[i] = 6296
+ lock_upd[i] = 6312
+ lock_upd[i] = 6328
+ lock_upd[i] = 6344
+ lock_upd[i] = 6360
+ lock_upd[i] = 6376
+ lock_upd[i] = 6392
+ lock_upd[i] = 6408
+ lock_upd[i] = 6424
+ lock_upd[i] = 6440
+ lock_upd[i] = 6456
+ lock_upd[i] = 6472
+ lock_upd[i] = 6488
+ lock_upd[i] = 6504
+ lock_upd[i] = 6520
+ lock_upd[i] = 6536
+ lock_upd[i] = 6552
+ lock_upd[i] = 6568
+ lock_upd[i] = 6584
+ lock_upd[i] = 6600
+ lock_upd[i] = 6616
+ lock_upd[i] = 6632
+ lock_upd[i] = 6648
+ lock_upd[i] = 6664
+ lock_upd[i] = 6680
+ lock_upd[i] = 6696
+ lock_upd[i] = 6712
+ lock_upd[i] = 6728
+ lock_upd[i] = 6744
+ lock_upd[i] = 6760
+ lock_upd[i] = 6776
+ lock_upd[i] = 6792
+ lock_upd[i] = 6808
+ lock_upd[i] = 6824
+ lock_upd[i] = 6840
+ lock_upd[i] = 6856
+ lock_upd[i] = 6872
+ lock_upd[i] = 6888
+ lock_upd[i] = 6904
+ lock_upd[i] = 6920
+ lock_upd[i] = 6936
+ lock_upd[i] = 6952
+ lock_upd[i] = 6968
+ lock_upd[i] = 6984
+ lock_upd[i] = 7000
+ lock_upd[i] = 7016
+ lock_upd[i] = 7032
+ lock_upd[i] = 7048
+ lock_upd[i] = 7064
+ lock_upd[i] = 7080
+ lock_upd[i] = 7096
+ lock_upd[i] = 7112
+ lock_upd[i] = 7128
+ lock_upd[i] = 7144
+ lock_upd[i] = 7160
+ lock_upd[i] = 7176
+ lock_upd[i] = 7192
+
+sizeof(ocfs_lock_update) = 16
+ orig_off = 0
+ new_off = 8
+
+sizeof(ocfs_bcast_rel_log) = 8
+ lock_id = 0
+
+sizeof(ocfs_cleanup_record) = 7224
+ log_id = 0
+ log_type = 8
+ rec.lock = 16
+ rec.alloc = 16
+ rec.bcast = 16
+ rec.del = 16
+ rec.free = 16
+
+sizeof(ocfs_log_record) = 48
+ log_id = 0
+ log_type = 8
+ rec.dir = 16
+ rec.alloc = 16
+ rec.recovery = 16
+ rec.bcast = 16
+ rec.del = 16
+ rec.extent = 16
+
Added: trunk/tools/sizetest/diskstructs.c
===================================================================
--- trunk/tools/sizetest/diskstructs.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/sizetest/diskstructs.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -0,0 +1,642 @@
+/*
+ * diskstructs.c
+ *
+ * Prints sizes and offsets of structures and its elements.
+ * Useful to ensure cross platform compatibility.
+ *
+ * Copyright (C) 2003 Oracle Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ *
+ * Authors: Kurt Hackel, Sunil Mushran, Manish Singh, Wim Coekaerts
+ */
+
+#include <ocfs.h>
+
+#ifdef USE_HEX
+#define NUMFORMAT "0x%x"
+#else
+#define NUMFORMAT "%d"
+#endif
+
+bool show_all = false;
+
+void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr)
+{
+ return;
+}
+
+#define SHOW_SIZEOF(x,y) printf("sizeof("#x") = "NUMFORMAT"\n", sizeof(##y))
+#define SHOW_OFFSET(x,y) printf("\t"#x" = "NUMFORMAT"\n", (void *)&(##y.##x)-(void *)&##y)
+
+
+static void print_ocfs_offset_map()
+{
+ ocfs_offset_map s;
+
+ SHOW_SIZEOF(ocfs_offset_map, s);
+ if (show_all) {
+ SHOW_OFFSET(length, s);
+ SHOW_OFFSET(log_disk_off, s);
+ SHOW_OFFSET(actual_disk_off, s);
+ printf("\n");
+ }
+}
+
+
+static void print_ocfs_cleanup_record()
+{
+ ocfs_cleanup_record s;
+
+ SHOW_SIZEOF(ocfs_cleanup_record, s);
+ if (show_all) {
+ SHOW_OFFSET(log_id, s);
+ SHOW_OFFSET(log_type, s);;
+ SHOW_OFFSET(rec.lock, s);
+ SHOW_OFFSET(rec.alloc, s);
+ SHOW_OFFSET(rec.bcast, s);
+ SHOW_OFFSET(rec.del, s);
+ SHOW_OFFSET(rec.free, s);
+ printf("\n");
+ }
+}
+
+
+void usage(void)
+{
+ printf("usage: diskstructs [all]\n");
+ return ;
+}
+
+
+static void print_ocfs_alloc_ext()
+{
+ ocfs_alloc_ext s;
+
+ SHOW_SIZEOF(ocfs_alloc_ext, s);
+ if (show_all) {
+ SHOW_OFFSET(file_off, s);
+ SHOW_OFFSET(num_bytes, s);
+ SHOW_OFFSET(disk_off, s);
+ printf("\n");
+ }
+}
+
+
+static void print_ocfs_publish()
+{
+ ocfs_publish s;
+ int i;
+
+ SHOW_SIZEOF(ocfs_publish, s);
+ if (show_all) {
+ SHOW_OFFSET(time, s);
+ SHOW_OFFSET(vote, s);
+ SHOW_OFFSET(dirty, s);
+ SHOW_OFFSET(vote_type, s);
+ SHOW_OFFSET(vote_map, s);
+ SHOW_OFFSET(publ_seq_num, s);
+ SHOW_OFFSET(dir_ent, s);
+ for (i = 0; i < OCFS_MAXIMUM_NODES; ++i)
+ SHOW_OFFSET(hbm[i], s);
+ SHOW_OFFSET(comm_seq_num, s);
+ printf("\n");
+ }
+}
+
+
+static void print_ocfs_vote()
+{
+ ocfs_vote s;
+ int i;
+
+ SHOW_SIZEOF(ocfs_vote, s);
+ if (show_all) {
+ for (i = 0; i < OCFS_MAXIMUM_NODES; ++i)
+ SHOW_OFFSET(vote[i], s);
+ SHOW_OFFSET(vote_seq_num, s);
+ SHOW_OFFSET(dir_ent, s);
+ SHOW_OFFSET(open_handle, s);
+ printf("\n");
+ }
+}
+
+
+static void print_ocfs_file_entry()
+{
+ ocfs_file_entry s;
+ int i;
+
+ SHOW_SIZEOF(ocfs_file_entry, s);
+ if (show_all) {
+ SHOW_OFFSET(disk_lock, s);
+ SHOW_OFFSET(signature, s);
+ SHOW_OFFSET(local_ext, s);
+ SHOW_OFFSET(next_free_ext, s);
+ SHOW_OFFSET(next_del, s);
+ SHOW_OFFSET(granularity, s);
+ SHOW_OFFSET(filename, s);
+ SHOW_OFFSET(filename_len, s);
+ SHOW_OFFSET(file_size, s);
+ SHOW_OFFSET(alloc_size, s);
+ SHOW_OFFSET(create_time, s);
+ SHOW_OFFSET(modify_time, s);
+ for (i = 0; i < OCFS_MAX_FILE_ENTRY_EXTENTS; ++i)
+ SHOW_OFFSET(extents[i], s);
+ SHOW_OFFSET(dir_node_ptr, s);
+ SHOW_OFFSET(this_sector, s);
+ SHOW_OFFSET(last_ext_ptr, s);
+ SHOW_OFFSET(sync_flags, s);
+ SHOW_OFFSET(link_cnt, s);
+ SHOW_OFFSET(attribs, s);
+ SHOW_OFFSET(prot_bits, s);
+ SHOW_OFFSET(uid, s);
+ SHOW_OFFSET(gid, s);
+ SHOW_OFFSET(dev_major, s);
+ SHOW_OFFSET(dev_minor, s);
+ printf("\n");
+ }
+}
+
+
+static void print_ocfs_index_node()
+{
+ ocfs_index_node s;
+
+ SHOW_SIZEOF(ocfs_index_node, s);
+ if (show_all) {
+ SHOW_OFFSET(down_ptr, s);
+ SHOW_OFFSET(file_ent_ptr, s);
+ SHOW_OFFSET(name_len, s);
+ SHOW_OFFSET(name, s);
+ printf("\n");
+ }
+}
+
+
+static void print_ocfs_index_hdr()
+{
+ ocfs_index_hdr s;
+
+ SHOW_SIZEOF(ocfs_index_hdr, s);
+ if (show_all) {
+ SHOW_OFFSET(disk_lock, s);
+ SHOW_OFFSET(signature, s);
+ SHOW_OFFSET(up_tree_ptr, s);
+ SHOW_OFFSET(node_disk_off, s);
+ SHOW_OFFSET(state, s);
+ SHOW_OFFSET(down_ptr, s);
+ SHOW_OFFSET(num_ents, s);
+ SHOW_OFFSET(depth, s);
+ SHOW_OFFSET(num_ent_used, s);
+ SHOW_OFFSET(dir_node_flags, s);
+ SHOW_OFFSET(sync_flags, s);
+ SHOW_OFFSET(index, s);
+ SHOW_OFFSET(reserved, s);
+ SHOW_OFFSET(file_ent, s);
+ printf("\n");
+ }
+}
+
+
+static void print_ocfs_dir_node()
+{
+ ocfs_dir_node s;
+
+ SHOW_SIZEOF(ocfs_dir_node, s);
+ if (show_all) {
+ SHOW_OFFSET(disk_lock, s);
+ SHOW_OFFSET(signature, s);
+ SHOW_OFFSET(alloc_file_off, s);
+ SHOW_OFFSET(alloc_node, s);
+ SHOW_OFFSET(free_node_ptr, s);
+ SHOW_OFFSET(node_disk_off, s);
+ SHOW_OFFSET(next_node_ptr, s);
+ SHOW_OFFSET(indx_node_ptr, s);
+ SHOW_OFFSET(next_del_ent_node, s);
+ SHOW_OFFSET(head_del_ent_node, s);
+ SHOW_OFFSET(first_del, s);
+ SHOW_OFFSET(num_del, s);
+ SHOW_OFFSET(num_ents, s);
+ SHOW_OFFSET(depth, s);
+ SHOW_OFFSET(num_ent_used, s);
+ SHOW_OFFSET(dir_node_flags, s);
+ SHOW_OFFSET(sync_flags, s);
+ SHOW_OFFSET(index, s);
+ SHOW_OFFSET(index_dirty, s);
+ SHOW_OFFSET(bad_off, s);
+ SHOW_OFFSET(reserved, s);
+ SHOW_OFFSET(file_ent, s);
+ printf("\n");
+ }
+}
+
+
+static void print_ocfs_extent_group()
+{
+ ocfs_extent_group s;
+ int i;
+
+ SHOW_SIZEOF(ocfs_extent_group, s);
+ if (show_all) {
+ SHOW_OFFSET(signature, s);
+ SHOW_OFFSET(next_free_ext, s);
+ SHOW_OFFSET(curr_sect, s);
+ SHOW_OFFSET(max_sects, s);
+ SHOW_OFFSET(type, s);
+ SHOW_OFFSET(granularity, s);
+ SHOW_OFFSET(alloc_node, s);
+ SHOW_OFFSET(this_ext, s);
+ SHOW_OFFSET(next_data_ext, s);
+ SHOW_OFFSET(alloc_file_off, s);
+ SHOW_OFFSET(last_ext_ptr, s);
+ SHOW_OFFSET(up_hdr_node_ptr, s);
+ for (i = 0; i < OCFS_MAX_DATA_EXTENTS; ++i)
+ SHOW_OFFSET(extents[i], s);
+ printf("\n");
+ }
+}
+
+
+static void print_ocfs_bitmap_lock()
+{
+ ocfs_bitmap_lock s;
+
+ SHOW_SIZEOF(ocfs_bitmap_lock, s);
+ if (show_all) {
+ SHOW_OFFSET(disk_lock, s);
+ SHOW_OFFSET(used_bits, s);
+ printf("\n");
+ }
+}
+
+
+static void print_ocfs_vol_disk_hdr()
+{
+ ocfs_vol_disk_hdr s;
+
+ SHOW_SIZEOF(ocfs_vol_disk_hdr, s);
+ if (show_all) {
+ SHOW_OFFSET(minor_version, s);
+ SHOW_OFFSET(major_version, s);
+ SHOW_OFFSET(signature, s);
+ SHOW_OFFSET(mount_point, s);
+ SHOW_OFFSET(serial_num, s);
+ SHOW_OFFSET(device_size, s);
+ SHOW_OFFSET(start_off, s);
+ SHOW_OFFSET(bitmap_off, s);
+ SHOW_OFFSET(publ_off, s);
+ SHOW_OFFSET(vote_off, s);
+ SHOW_OFFSET(root_bitmap_off, s);
+ SHOW_OFFSET(data_start_off, s);
+ SHOW_OFFSET(root_bitmap_size, s);
+ SHOW_OFFSET(root_off, s);
+ SHOW_OFFSET(root_size, s);
+ SHOW_OFFSET(cluster_size, s);
+ SHOW_OFFSET(num_nodes, s);
+ SHOW_OFFSET(num_clusters, s);
+ SHOW_OFFSET(dir_node_size, s);
+ SHOW_OFFSET(file_node_size, s);
+ SHOW_OFFSET(internal_off, s);
+ SHOW_OFFSET(node_cfg_off, s);
+ SHOW_OFFSET(node_cfg_size, s);
+ SHOW_OFFSET(new_cfg_off, s);
+ SHOW_OFFSET(prot_bits, s);
+ SHOW_OFFSET(uid, s);
+ SHOW_OFFSET(gid, s);
+ SHOW_OFFSET(excl_mount, s);
+ printf("\n");
+ }
+}
+
+
+static void print_ocfs_disk_lock()
+{
+ ocfs_disk_lock s;
+
+ SHOW_SIZEOF(ocfs_disk_lock, s);
+ if (show_all) {
+ SHOW_OFFSET(curr_master, s);
+ SHOW_OFFSET(file_lock, s);
+ SHOW_OFFSET(last_write_time, s);
+ SHOW_OFFSET(last_read_time, s);
+ SHOW_OFFSET(writer_node_num, s);
+ SHOW_OFFSET(reader_node_num, s);
+ SHOW_OFFSET(oin_node_map, s);
+ SHOW_OFFSET(dlock_seq_num, s);
+ printf("\n");
+ }
+}
+
+
+static void print_ocfs_vol_label()
+{
+ ocfs_vol_label s;
+
+ SHOW_SIZEOF(ocfs_vol_label, s);
+ if (show_all) {
+ SHOW_OFFSET(disk_lock, s);
+ SHOW_OFFSET(label, s);
+ SHOW_OFFSET(label_len, s);
+ SHOW_OFFSET(vol_id, s);
+ SHOW_OFFSET(vol_id_len, s);
+ SHOW_OFFSET(cluster_name, s);
+ SHOW_OFFSET(cluster_name_len, s);
+ printf("\n");
+ }
+}
+
+
+static void print_ocfs_ipc_config_info()
+{
+ ocfs_ipc_config_info s;
+
+ SHOW_SIZEOF(ocfs_ipc_config_info, s);
+ if (show_all) {
+ SHOW_OFFSET(type, s);
+ SHOW_OFFSET(ip_addr, s);
+ SHOW_OFFSET(ip_port, s);
+ SHOW_OFFSET(ip_mask, s);
+ printf("\n");
+ }
+}
+
+
+static void print_ocfs_guid()
+{
+ ocfs_guid s;
+
+ SHOW_SIZEOF(ocfs_guid, s);
+ if (show_all) {
+ SHOW_OFFSET(guid, s);
+ SHOW_OFFSET(id.host_id, s);
+ SHOW_OFFSET(id.mac_id, s);
+ printf("\n");
+ }
+}
+
+
+static void print_ocfs_disk_node_config_info()
+{
+ ocfs_disk_node_config_info s;
+
+ SHOW_SIZEOF(ocfs_disk_node_config_info, s);
+ if (show_all) {
+ SHOW_OFFSET(disk_lock, s);
+ SHOW_OFFSET(node_name, s);
+ SHOW_OFFSET(guid, s);
+ SHOW_OFFSET(ipc_config, s);
+ printf("\n");
+ }
+}
+
+
+static void print_ocfs_node_config_hdr()
+{
+ ocfs_node_config_hdr s;
+
+ SHOW_SIZEOF(ocfs_node_config_hdr, s);
+ if (show_all) {
+ SHOW_OFFSET(disk_lock, s);
+ SHOW_OFFSET(signature, s);
+ SHOW_OFFSET(version, s);
+ SHOW_OFFSET(num_nodes, s);
+ SHOW_OFFSET(last_node, s);
+ SHOW_OFFSET(cfg_seq_num, s);
+ printf("\n");
+ }
+}
+
+
+static void print_ocfs_cdsl()
+{
+ ocfs_cdsl s;
+
+ SHOW_SIZEOF(ocfs_cdsl, s);
+ if (show_all) {
+ SHOW_OFFSET(name, s);
+ SHOW_OFFSET(flags, s);
+ SHOW_OFFSET(operation, s);
+ printf("\n");
+ }
+}
+
+
+static void print_ocfs_free_bitmap()
+{
+ ocfs_free_bitmap s;
+
+ SHOW_SIZEOF(ocfs_free_bitmap, s);
+ if (show_all) {
+ SHOW_OFFSET(length, s);
+ SHOW_OFFSET(file_off, s);
+ SHOW_OFFSET(type, s);
+ SHOW_OFFSET(node_num, s);
+ printf("\n");
+ }
+}
+
+
+static void print_ocfs_free_extent_log()
+{
+ ocfs_free_extent_log s;
+
+ SHOW_SIZEOF(ocfs_free_extent_log, s);
+ if (show_all) {
+ SHOW_OFFSET(index, s);
+ SHOW_OFFSET(disk_off, s);
+ printf("\n");
+ }
+}
+
+
+static void print_ocfs_free_log()
+{
+ ocfs_free_log s;
+ int i;
+
+ SHOW_SIZEOF(ocfs_free_log, s);
+ if (show_all) {
+ SHOW_OFFSET(num_free_upds, s);
+ for (i = 0; i < FREE_LOG_SIZE; ++i)
+ SHOW_OFFSET(free_bitmap[i], s);
+ printf("\n");
+ }
+}
+
+
+static void print_ocfs_delete_log()
+{
+ ocfs_delete_log s;
+
+ SHOW_SIZEOF(ocfs_delete_log, s);
+ if (show_all) {
+ SHOW_OFFSET(node_num, s);
+ SHOW_OFFSET(ent_del, s);
+ SHOW_OFFSET(parent_dirnode_off, s);
+ SHOW_OFFSET(flags, s);
+ printf("\n");
+ }
+}
+
+
+static void print_ocfs_recovery_log()
+{
+ ocfs_recovery_log s;
+
+ SHOW_SIZEOF(ocfs_recovery_log, s);
+ if (show_all) {
+ SHOW_OFFSET(node_num, s);
+ printf("\n");
+ }
+}
+
+
+static void print_ocfs_alloc_log()
+{
+ ocfs_alloc_log s;
+
+ SHOW_SIZEOF(ocfs_alloc_log, s);
+ if (show_all) {
+ SHOW_OFFSET(length, s);
+ SHOW_OFFSET(file_off, s);
+ SHOW_OFFSET(type, s);
+ SHOW_OFFSET(node_num, s);
+ printf("\n");
+ }
+}
+
+
+static void print_ocfs_dir_log()
+{
+ ocfs_dir_log s;
+
+ SHOW_SIZEOF(ocfs_dir_log, s);
+ if (show_all) {
+ SHOW_OFFSET(orig_off, s);
+ SHOW_OFFSET(saved_off, s);
+ SHOW_OFFSET(length, s);
+ printf("\n");
+ }
+}
+
+
+static void print_ocfs_lock_update()
+{
+ ocfs_lock_update s;
+
+ SHOW_SIZEOF(ocfs_lock_update, s);
+ if (show_all) {
+ SHOW_OFFSET(orig_off, s);
+ SHOW_OFFSET(new_off, s);
+ printf("\n");
+ }
+}
+
+
+static void print_ocfs_lock_log()
+{
+ ocfs_lock_log s;
+ int i;
+
+ SHOW_SIZEOF(ocfs_lock_log, s);
+ if (show_all) {
+ SHOW_OFFSET(num_lock_upds, s);
+ for (i = 0; i < LOCK_UPDATE_LOG_SIZE; ++i)
+ SHOW_OFFSET(lock_upd[i], s);
+ printf("\n");
+ }
+}
+
+
+static void print_ocfs_bcast_rel_log()
+{
+ ocfs_bcast_rel_log s;
+
+ SHOW_SIZEOF(ocfs_bcast_rel_log, s);
+ if (show_all) {
+ SHOW_OFFSET(lock_id, s);
+ printf("\n");
+ }
+}
+
+
+static void print_ocfs_log_record()
+{
+ ocfs_log_record s;
+
+ SHOW_SIZEOF(ocfs_log_record, s);
+ if (show_all) {
+ SHOW_OFFSET(log_id, s);
+ SHOW_OFFSET(log_type, s);
+ SHOW_OFFSET(rec.dir, s);
+ SHOW_OFFSET(rec.alloc, s);
+ SHOW_OFFSET(rec.recovery, s);
+ SHOW_OFFSET(rec.bcast, s);
+ SHOW_OFFSET(rec.del, s);
+ SHOW_OFFSET(rec.extent, s);
+ printf("\n");
+ }
+}
+
+
+int main(int argc, char **argv)
+{
+ if (argc > 1) {
+ if (!strncasecmp(*++argv, "all", 3))
+ show_all = true;
+ else {
+ usage();
+ exit (1);
+ }
+ }
+
+ print_ocfs_alloc_ext();
+ print_ocfs_publish();
+ print_ocfs_vote();
+ print_ocfs_file_entry();
+ print_ocfs_index_node();
+ print_ocfs_index_hdr();
+ print_ocfs_dir_node();
+ print_ocfs_extent_group();
+ print_ocfs_bitmap_lock();
+
+ print_ocfs_offset_map();
+
+ print_ocfs_vol_disk_hdr();
+ print_ocfs_disk_lock();
+ print_ocfs_vol_label();
+ print_ocfs_ipc_config_info();
+ print_ocfs_guid();
+ print_ocfs_disk_node_config_info();
+ print_ocfs_node_config_hdr();
+ print_ocfs_cdsl();
+
+ print_ocfs_free_bitmap();
+ print_ocfs_free_extent_log();
+ print_ocfs_free_log();
+ print_ocfs_delete_log();
+ print_ocfs_recovery_log();
+ print_ocfs_alloc_log();
+ print_ocfs_dir_log();
+ print_ocfs_lock_log();
+ print_ocfs_lock_update();
+ print_ocfs_bcast_rel_log();
+ print_ocfs_cleanup_record();
+ print_ocfs_log_record();
+
+ return 0;
+} /* main */
Added: trunk/tools/sizetest/net.txt
===================================================================
--- trunk/tools/sizetest/net.txt 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/sizetest/net.txt 2003-09-03 01:05:18 UTC (rev 10)
@@ -0,0 +1,24 @@
+sizeof(ocfs_dlm_msg_hdr) = 24
+ lock_id = 0
+ flags = 8
+ lock_seq_num = 12
+ open_handle = 20
+
+sizeof(ocfs_dlm_reply_master) = 28
+ h = 0
+ status = 24
+
+sizeof(ocfs_dlm_disk_vote_reply) = 28
+ h = 0
+ status = 24
+
+sizeof(ocfs_dlm_msg) = 44
+ magic = 0
+ msg_len = 4
+ vol_id = 8
+ src_node = 24
+ dst_node = 28
+ msg_type = 32
+ check_sum = 36
+ msg_buf = 40
+
Added: trunk/tools/sizetest/netstructs.c
===================================================================
--- trunk/tools/sizetest/netstructs.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/sizetest/netstructs.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -0,0 +1,130 @@
+/*
+ * netstructs.c
+ *
+ * Prints sizes and offsets of structures and its elements.
+ * Useful to ensure cross platform compatibility.
+ *
+ * Copyright (C) 2003 Oracle Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ *
+ * Authors: Kurt Hackel, Sunil Mushran, Manish Singh, Wim Coekaerts
+ */
+
+#include <ocfs.h>
+
+#ifdef USE_HEX
+#define NUMFORMAT "0x%x"
+#else
+#define NUMFORMAT "%d"
+#endif
+
+bool show_all = false;
+
+void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr)
+{
+ return;
+}
+
+#define SHOW_SIZEOF(x,y) printf("sizeof("#x") = "NUMFORMAT"\n", sizeof(##y))
+#define SHOW_OFFSET(x,y) printf("\t"#x" = "NUMFORMAT"\n", (void *)&(##y.##x)-(void *)&##y)
+
+
+void usage(void)
+{
+ printf("usage: netstructs [all]\n");
+ return ;
+}
+
+
+static void print_ocfs_dlm_msg_hdr()
+{
+ ocfs_dlm_msg_hdr s;
+
+ SHOW_SIZEOF(ocfs_dlm_msg_hdr, s);
+ if (show_all) {
+ SHOW_OFFSET(lock_id, s);
+ SHOW_OFFSET(flags, s);
+ SHOW_OFFSET(lock_seq_num, s);
+ SHOW_OFFSET(open_handle, s);
+ printf("\n");
+ }
+}
+
+
+static void print_ocfs_dlm_reply_master()
+{
+ ocfs_dlm_reply_master s;
+
+ SHOW_SIZEOF(ocfs_dlm_reply_master, s);
+ if (show_all) {
+ SHOW_OFFSET(h, s);
+ SHOW_OFFSET(status, s);
+ printf("\n");
+ }
+}
+
+
+static void print_ocfs_dlm_disk_vote_reply()
+{
+ ocfs_dlm_disk_vote_reply s;
+
+ SHOW_SIZEOF(ocfs_dlm_disk_vote_reply, s);
+ if (show_all) {
+ SHOW_OFFSET(h, s);
+ SHOW_OFFSET(status, s);
+ printf("\n");
+ }
+}
+
+
+static void print_ocfs_dlm_msg()
+{
+ ocfs_dlm_msg s;
+
+ SHOW_SIZEOF(ocfs_dlm_msg, s);
+ if (show_all) {
+ SHOW_OFFSET(magic, s);
+ SHOW_OFFSET(msg_len, s);
+ SHOW_OFFSET(vol_id, s);
+ SHOW_OFFSET(src_node, s);
+ SHOW_OFFSET(dst_node, s);
+ SHOW_OFFSET(msg_type, s);
+ SHOW_OFFSET(check_sum, s);
+ SHOW_OFFSET(msg_buf, s);
+ printf("\n");
+ }
+}
+
+
+int main(int argc, char **argv)
+{
+ if (argc > 1) {
+ if (!strncasecmp(*++argv, "all", 3))
+ show_all = true;
+ else {
+ usage();
+ exit (1);
+ }
+ }
+
+ print_ocfs_dlm_msg_hdr();
+ print_ocfs_dlm_reply_master();
+ print_ocfs_dlm_disk_vote_reply();
+ print_ocfs_dlm_msg();
+
+ return 0;
+} /* main */
Modified: trunk/tools/sizetest/sizetest.c
===================================================================
--- trunk/tools/sizetest/sizetest.c 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/tools/sizetest/sizetest.c 2003-09-03 01:05:18 UTC (rev 10)
@@ -14,30 +14,16 @@
}
#define SHOW_SIZEOF(x,y) printf("sizeof("#x")="NUMFORMAT"\n", sizeof(##y))
-#define SHOW_OFFSET(x,y) printf(" "#x"="NUMFORMAT"\n", (void *)&(##y.##x)-(void *)&##y)
+#define SHOW_OFFSET(x,y) printf("\t"#x"="NUMFORMAT"\n", (void *)&(##y.##x)-(void *)&##y)
-static void print_ocfs_file_entry()
-{
- ocfs_file_entry i;
- SHOW_SIZEOF(ocfs_file_entry, i);
-}
-static void print_ocfs_vol_disk_hdr()
-{
- ocfs_vol_disk_hdr i;
- SHOW_SIZEOF(ocfs_vol_disk_hdr, i);
-}
-
-static void print_ocfs_log_record()
-{
- ocfs_log_record i;
- SHOW_SIZEOF(ocfs_log_record, i);
-}
-
static void print_ocfs_offset_map()
{
ocfs_offset_map i;
SHOW_SIZEOF(ocfs_offset_map, i);
+ SHOW_OFFSET(length, i);
+ SHOW_OFFSET(log_disk_off, i);
+ SHOW_OFFSET(actual_disk_off, i);
}
static void print_ocfs_io_runs()
@@ -46,18 +32,6 @@
SHOW_SIZEOF(ocfs_io_runs, i);
}
-static void print_ocfs_alloc_ext()
-{
- ocfs_alloc_ext i;
- SHOW_SIZEOF(ocfs_alloc_ext, i);
-}
-
-static void print_ocfs_extent_group()
-{
- ocfs_extent_group i;
- SHOW_SIZEOF(ocfs_extent_group, i);
-}
-
static void print_ocfs_inode_offsets()
{
ocfs_inode i;
@@ -170,7 +144,7 @@
if (show_all) {
SHOW_OFFSET(signature, l);
SHOW_OFFSET(lock_type, l);
- SHOW_OFFSET(ref_cnt, l);
+// SHOW_OFFSET(ref_cnt, l);
SHOW_OFFSET(master_node_num, l);
SHOW_OFFSET(last_upd_seq_num, l);
SHOW_OFFSET(last_lock_upd, l);
@@ -278,8 +252,8 @@
SHOW_OFFSET(f_error, f);
SHOW_OFFSET(f_version, f);
SHOW_OFFSET(private_data, f);
- SHOW_OFFSET(f_iobuf, f);
- SHOW_OFFSET(f_iobuf_lock, f);
+ //SHOW_OFFSET(f_iobuf, f);
+ //SHOW_OFFSET(f_iobuf_lock, f);
}
}
@@ -294,7 +268,7 @@
SHOW_OFFSET(i_list, ino);
SHOW_OFFSET(i_dentry, ino);
SHOW_OFFSET(i_dirty_buffers, ino);
- SHOW_OFFSET(i_dirty_data_buffers, ino);
+ //SHOW_OFFSET(i_dirty_data_buffers, ino);
SHOW_OFFSET(i_ino, ino);
SHOW_OFFSET(i_count, ino);
SHOW_OFFSET(i_dev, ino);
@@ -312,7 +286,7 @@
SHOW_OFFSET(i_version, ino);
SHOW_OFFSET(i_bytes, ino);
SHOW_OFFSET(i_sem, ino);
-#ifndef x86_64
+#ifndef __LP64__
SHOW_OFFSET(i_truncate_sem, ino);
#endif
SHOW_OFFSET(i_zombie, ino);
@@ -324,7 +298,7 @@
SHOW_OFFSET(i_mapping, ino);
SHOW_OFFSET(i_data, ino);
SHOW_OFFSET(i_dquot, ino);
- SHOW_OFFSET(i_devices, ino);
+ //SHOW_OFFSET(i_devices, ino);
SHOW_OFFSET(i_pipe, ino);
SHOW_OFFSET(i_bdev, ino);
SHOW_OFFSET(i_cdev, ino);
@@ -378,6 +352,511 @@
return ;
}
+
+static void print_ocfs_alloc_ext()
+{
+ ocfs_alloc_ext s;
+ SHOW_SIZEOF(ocfs_alloc_ext, s);
+ SHOW_OFFSET(file_off, s);
+ SHOW_OFFSET(num_bytes, s);
+ SHOW_OFFSET(disk_off, s);
+}
+
+
+static void print_ocfs_publish()
+{
+ ocfs_publish s;
+ SHOW_SIZEOF(ocfs_publish, s);
+ SHOW_OFFSET(time, s);
+ SHOW_OFFSET(vote, s);
+ SHOW_OFFSET(dirty, s);
+ SHOW_OFFSET(vote_type, s);
+ SHOW_OFFSET(vote_map, s);
+ SHOW_OFFSET(publ_seq_num, s);
+ SHOW_OFFSET(dir_ent, s);
+ SHOW_OFFSET(hbm, s);
+ SHOW_OFFSET(comm_seq_num, s);
+}
+
+
+static void print_ocfs_vote()
+{
+ ocfs_vote s;
+ SHOW_SIZEOF(ocfs_vote, s);
+ SHOW_OFFSET(vote, s);
+ SHOW_OFFSET(vote_seq_num, s);
+ SHOW_OFFSET(dir_ent, s);
+ SHOW_OFFSET(open_handle, s);
+}
+
+
+static void print_ocfs_file_entry()
+{
+ ocfs_file_entry s;
+ SHOW_SIZEOF(ocfs_file_entry, s);
+ SHOW_OFFSET(disk_lock, s);
+ SHOW_OFFSET(signature, s);
+ SHOW_OFFSET(local_ext, s);
+ SHOW_OFFSET(next_free_ext, s);
+ SHOW_OFFSET(next_del, s);
+ SHOW_OFFSET(granularity, s);
+ SHOW_OFFSET(filename, s);
+ SHOW_OFFSET(filename_len, s);
+ SHOW_OFFSET(file_size, s);
+ SHOW_OFFSET(alloc_size, s);
+ SHOW_OFFSET(create_time, s);
+ SHOW_OFFSET(modify_time, s);
+ SHOW_OFFSET(extents, s);
+ SHOW_OFFSET(dir_node_ptr, s);
+ SHOW_OFFSET(this_sector, s);
+ SHOW_OFFSET(last_ext_ptr, s);
+ SHOW_OFFSET(sync_flags, s);
+ SHOW_OFFSET(link_cnt, s);
+ SHOW_OFFSET(attribs, s);
+ SHOW_OFFSET(prot_bits, s);
+ SHOW_OFFSET(uid, s);
+ SHOW_OFFSET(gid, s);
+ SHOW_OFFSET(dev_major, s);
+ SHOW_OFFSET(dev_minor, s);
+}
+
+
+static void print_ocfs_index_node()
+{
+ ocfs_index_node s;
+ SHOW_SIZEOF(ocfs_index_node, s);
+ SHOW_OFFSET(down_ptr, s);
+ SHOW_OFFSET(file_ent_ptr, s);
+ SHOW_OFFSET(name_len, s);
+ SHOW_OFFSET(name, s);
+}
+
+
+static void print_ocfs_index_hdr()
+{
+ ocfs_index_hdr s;
+ SHOW_SIZEOF(ocfs_index_hdr, s);
+ SHOW_OFFSET(disk_lock, s);
+ SHOW_OFFSET(signature, s);
+ SHOW_OFFSET(up_tree_ptr, s);
+ SHOW_OFFSET(node_disk_off, s);
+ SHOW_OFFSET(state, s);
+ SHOW_OFFSET(down_ptr, s);
+ SHOW_OFFSET(num_ents, s);
+ SHOW_OFFSET(depth, s);
+ SHOW_OFFSET(num_ent_used, s);
+ SHOW_OFFSET(dir_node_flags, s);
+ SHOW_OFFSET(sync_flags, s);
+ SHOW_OFFSET(index, s);
+ SHOW_OFFSET(reserved, s);
+ SHOW_OFFSET(file_ent, s);
+}
+
+
+static void print_ocfs_dir_node()
+{
+ ocfs_dir_node s;
+ SHOW_SIZEOF(ocfs_dir_node, s);
+ SHOW_OFFSET(disk_lock, s);
+ SHOW_OFFSET(signature, s);
+ SHOW_OFFSET(alloc_file_off, s);
+ SHOW_OFFSET(alloc_node, s);
+ SHOW_OFFSET(free_node_ptr, s);
+ SHOW_OFFSET(node_disk_off, s);
+ SHOW_OFFSET(next_node_ptr, s);
+ SHOW_OFFSET(indx_node_ptr, s);
+ SHOW_OFFSET(next_del_ent_node, s);
+ SHOW_OFFSET(head_del_ent_node, s);
+ SHOW_OFFSET(first_del, s);
+ SHOW_OFFSET(num_del, s);
+ SHOW_OFFSET(num_ents, s);
+ SHOW_OFFSET(depth, s);
+ SHOW_OFFSET(num_ent_used, s);
+ SHOW_OFFSET(dir_node_flags, s);
+ SHOW_OFFSET(sync_flags, s);
+ SHOW_OFFSET(index, s);
+ SHOW_OFFSET(index_dirty, s);
+ SHOW_OFFSET(bad_off, s);
+ SHOW_OFFSET(reserved, s);
+ SHOW_OFFSET(file_ent, s);
+}
+
+
+static void print_ocfs_vol_node_map()
+{
+ ocfs_vol_node_map s;
+ SHOW_SIZEOF(ocfs_vol_node_map, s);
+ SHOW_OFFSET(time, s);
+ SHOW_OFFSET(scan_time, s);
+ SHOW_OFFSET(scan_rate, s);
+ SHOW_OFFSET(miss_cnt, s);
+ SHOW_OFFSET(dismount, s);
+ SHOW_OFFSET(largest_seq_num, s);
+}
+
+
+static void print_ocfs_vol_layout()
+{
+ ocfs_vol_layout s;
+ SHOW_SIZEOF(ocfs_vol_layout, s);
+ SHOW_OFFSET(start_off, s);
+ SHOW_OFFSET(num_nodes, s);
+ SHOW_OFFSET(cluster_size, s);
+ SHOW_OFFSET(mount_point, s);
+ SHOW_OFFSET(vol_id, s);
+ SHOW_OFFSET(label, s);
+ SHOW_OFFSET(label_len, s);
+ SHOW_OFFSET(size, s);
+ SHOW_OFFSET(root_start_off, s);
+ SHOW_OFFSET(serial_num, s);
+ SHOW_OFFSET(root_size, s);
+ SHOW_OFFSET(publ_sect_off, s);
+ SHOW_OFFSET(vote_sect_off, s);
+ SHOW_OFFSET(root_bitmap_off, s);
+ SHOW_OFFSET(root_bitmap_size, s);
+ SHOW_OFFSET(data_start_off, s);
+ SHOW_OFFSET(num_clusters, s);
+ SHOW_OFFSET(root_int_off, s);
+ SHOW_OFFSET(dir_node_size, s);
+ SHOW_OFFSET(file_node_size, s);
+ SHOW_OFFSET(bitmap_off, s);
+ SHOW_OFFSET(node_cfg_off, s);
+ SHOW_OFFSET(node_cfg_size, s);
+ SHOW_OFFSET(new_cfg_off, s);
+ SHOW_OFFSET(prot_bits, s);
+ SHOW_OFFSET(uid, s);
+ SHOW_OFFSET(gid, s);
+}
+
+
+static void print_ocfs_extent_group()
+{
+ ocfs_extent_group s;
+ SHOW_SIZEOF(ocfs_extent_group, s);
+ SHOW_OFFSET(signature, s);
+ SHOW_OFFSET(next_free_ext, s);
+ SHOW_OFFSET(curr_sect, s);
+ SHOW_OFFSET(max_sects, s);
+ SHOW_OFFSET(type, s);
+ SHOW_OFFSET(granularity, s);
+ SHOW_OFFSET(alloc_node, s);
+ SHOW_OFFSET(this_ext, s);
+ SHOW_OFFSET(next_data_ext, s);
+ SHOW_OFFSET(alloc_file_off, s);
+ SHOW_OFFSET(last_ext_ptr, s);
+ SHOW_OFFSET(up_hdr_node_ptr, s);
+ SHOW_OFFSET(extents, s);
+}
+
+
+static void print_ocfs_bitmap_lock()
+{
+ ocfs_bitmap_lock s;
+ SHOW_SIZEOF(ocfs_bitmap_lock, s);
+ SHOW_OFFSET(disk_lock, s);
+ SHOW_OFFSET(used_bits, s);
+}
+
+
+static void print_ocfs_vol_disk_hdr()
+{
+ ocfs_vol_disk_hdr s;
+ SHOW_SIZEOF(ocfs_vol_disk_hdr, s);
+ SHOW_OFFSET(minor_version, s);
+ SHOW_OFFSET(major_version, s);
+ SHOW_OFFSET(signature, s);
+ SHOW_OFFSET(mount_point, s);
+ SHOW_OFFSET(serial_num, s);
+ SHOW_OFFSET(device_size, s);
+ SHOW_OFFSET(start_off, s);
+ SHOW_OFFSET(bitmap_off, s);
+ SHOW_OFFSET(publ_off, s);
+ SHOW_OFFSET(vote_off, s);
+ SHOW_OFFSET(root_bitmap_off, s);
+ SHOW_OFFSET(data_start_off, s);
+ SHOW_OFFSET(root_bitmap_size, s);
+ SHOW_OFFSET(root_off, s);
+ SHOW_OFFSET(root_size, s);
+ SHOW_OFFSET(cluster_size, s);
+ SHOW_OFFSET(num_nodes, s);
+ SHOW_OFFSET(num_clusters, s);
+ SHOW_OFFSET(dir_node_size, s);
+ SHOW_OFFSET(file_node_size, s);
+ SHOW_OFFSET(internal_off, s);
+ SHOW_OFFSET(node_cfg_off, s);
+ SHOW_OFFSET(node_cfg_size, s);
+ SHOW_OFFSET(new_cfg_off, s);
+ SHOW_OFFSET(prot_bits, s);
+ SHOW_OFFSET(uid, s);
+ SHOW_OFFSET(gid, s);
+ SHOW_OFFSET(excl_mount, s);
+}
+
+
+static void print_ocfs_disk_lock()
+{
+ ocfs_disk_lock s;
+ SHOW_SIZEOF(ocfs_disk_lock, s);
+ SHOW_OFFSET(curr_master, s);
+ SHOW_OFFSET(file_lock, s);
+ SHOW_OFFSET(last_write_time, s);
+ SHOW_OFFSET(last_read_time, s);
+ SHOW_OFFSET(writer_node_num, s);
+ SHOW_OFFSET(reader_node_num, s);
+ SHOW_OFFSET(oin_node_map, s);
+ SHOW_OFFSET(dlock_seq_num, s);
+}
+
+
+static void print_ocfs_vol_label()
+{
+ ocfs_vol_label s;
+ SHOW_SIZEOF(ocfs_vol_label, s);
+ SHOW_OFFSET(disk_lock, s);
+ SHOW_OFFSET(label, s);
+ SHOW_OFFSET(label_len, s);
+ SHOW_OFFSET(vol_id, s);
+ SHOW_OFFSET(vol_id_len, s);
+ SHOW_OFFSET(cluster_name, s);
+ SHOW_OFFSET(cluster_name_len, s);
+}
+
+
+static void print_ocfs_ipc_config_info()
+{
+ ocfs_ipc_config_info s;
+ SHOW_SIZEOF(ocfs_ipc_config_info, s);
+ SHOW_OFFSET(type, s);
+ SHOW_OFFSET(ip_addr, s);
+ SHOW_OFFSET(ip_port, s);
+ SHOW_OFFSET(ip_mask, s);
+}
+
+
+static void print_ocfs_guid()
+{
+ ocfs_guid s;
+ SHOW_SIZEOF(ocfs_guid, s);
+ SHOW_OFFSET(id.host_id, s);
+ SHOW_OFFSET(id.mac_id, s);
+}
+
+
+static void print_ocfs_disk_node_config_info()
+{
+ ocfs_disk_node_config_info s;
+ SHOW_SIZEOF(ocfs_disk_node_config_info, s);
+ SHOW_OFFSET(disk_lock, s);
+ SHOW_OFFSET(node_name, s);
+ SHOW_OFFSET(guid, s);
+ SHOW_OFFSET(ipc_config, s);
+}
+
+
+static void print_ocfs_node_config_hdr()
+{
+ ocfs_node_config_hdr s;
+ SHOW_SIZEOF(ocfs_node_config_hdr, s);
+ SHOW_OFFSET(disk_lock, s);
+ SHOW_OFFSET(signature, s);
+ SHOW_OFFSET(version, s);
+ SHOW_OFFSET(num_nodes, s);
+ SHOW_OFFSET(last_node, s);
+ SHOW_OFFSET(cfg_seq_num, s);
+}
+
+
+static void print_ocfs_cdsl()
+{
+ ocfs_cdsl s;
+ SHOW_SIZEOF(ocfs_cdsl, s);
+ SHOW_OFFSET(name, s);
+ SHOW_OFFSET(flags, s);
+ SHOW_OFFSET(operation, s);
+}
+
+
+static void print_ocfs_free_bitmap()
+{
+ ocfs_free_bitmap s;
+ SHOW_SIZEOF(ocfs_free_bitmap, s);
+ SHOW_OFFSET(length, s);
+ SHOW_OFFSET(file_off, s);
+ SHOW_OFFSET(type, s);
+ SHOW_OFFSET(node_num, s);
+}
+
+
+static void print_ocfs_free_extent_log()
+{
+ ocfs_free_extent_log s;
+ SHOW_SIZEOF(ocfs_free_extent_log, s);
+ SHOW_OFFSET(index, s);
+ SHOW_OFFSET(disk_off, s);
+}
+
+
+static void print_ocfs_free_log()
+{
+ ocfs_free_log s;
+ SHOW_SIZEOF(ocfs_free_log, s);
+ SHOW_OFFSET(num_free_upds, s);
+ SHOW_OFFSET(free_bitmap, s);
+}
+
+
+static void print_ocfs_delete_log()
+{
+ ocfs_delete_log s;
+ SHOW_SIZEOF(ocfs_delete_log, s);
+ SHOW_OFFSET(node_num, s);
+ SHOW_OFFSET(ent_del, s);
+ SHOW_OFFSET(parent_dirnode_off, s);
+ SHOW_OFFSET(flags, s);
+}
+
+
+static void print_ocfs_recovery_log()
+{
+ ocfs_recovery_log s;
+ SHOW_SIZEOF(ocfs_recovery_log, s);
+ SHOW_OFFSET(node_num, s);
+}
+
+
+static void print_ocfs_alloc_log()
+{
+ ocfs_alloc_log s;
+ SHOW_SIZEOF(ocfs_alloc_log, s);
+ SHOW_OFFSET(length, s);
+ SHOW_OFFSET(file_off, s);
+ SHOW_OFFSET(type, s);
+ SHOW_OFFSET(node_num, s);
+}
+
+
+static void print_ocfs_dir_log()
+{
+ ocfs_dir_log s;
+ SHOW_SIZEOF(ocfs_dir_log, s);
+ SHOW_OFFSET(orig_off, s);
+ SHOW_OFFSET(saved_off, s);
+ SHOW_OFFSET(length, s);
+}
+
+
+static void print_ocfs_lock_update()
+{
+ ocfs_lock_update s;
+ SHOW_SIZEOF(ocfs_lock_update, s);
+ SHOW_OFFSET(orig_off, s);
+ SHOW_OFFSET(new_off, s);
+}
+
+
+static void print_ocfs_lock_log()
+{
+ ocfs_lock_log s;
+ SHOW_SIZEOF(ocfs_lock_log, s);
+ SHOW_OFFSET(num_lock_upds, s);
+ SHOW_OFFSET(lock_upd, s);
+}
+
+
+static void print_ocfs_bcast_rel_log()
+{
+ ocfs_bcast_rel_log s;
+ SHOW_SIZEOF(ocfs_bcast_rel_log, s);
+ SHOW_OFFSET(lock_id, s);
+}
+
+
+static void print_ocfs_cleanup_record()
+{
+ ocfs_cleanup_record s;
+ SHOW_SIZEOF(ocfs_cleanup_record, s);
+ SHOW_OFFSET(log_id, s);
+ SHOW_OFFSET(log_type, s);
+ SHOW_OFFSET(rec.lock, s);
+ SHOW_OFFSET(rec.alloc, s);
+ SHOW_OFFSET(rec.bcast, s);
+ SHOW_OFFSET(rec.del, s);
+ SHOW_OFFSET(rec.free, s);
+}
+
+
+static void print_ocfs_log_record()
+{
+ ocfs_log_record s;
+ SHOW_SIZEOF(ocfs_log_record, s);
+ SHOW_OFFSET(log_id, s);
+ SHOW_OFFSET(log_type, s);
+ SHOW_OFFSET(rec.dir, s);
+ SHOW_OFFSET(rec.alloc, s);
+ SHOW_OFFSET(rec.recovery, s);
+ SHOW_OFFSET(rec.bcast, s);
+ SHOW_OFFSET(rec.del, s);
+ SHOW_OFFSET(rec.extent, s);
+}
+
+
+static void print_ocfs_dlm_msg_hdr()
+{
+ ocfs_dlm_msg_hdr s;
+ SHOW_SIZEOF(ocfs_dlm_msg_hdr, s);
+ SHOW_OFFSET(lock_id, s);
+ SHOW_OFFSET(flags, s);
+ SHOW_OFFSET(lock_seq_num, s);
+ SHOW_OFFSET(open_handle, s);
+}
+
+static void print_ocfs_dlm_reply_master()
+{
+ ocfs_dlm_reply_master s;
+ SHOW_SIZEOF(ocfs_dlm_reply_master, s);
+ SHOW_OFFSET(h, s);
+ SHOW_OFFSET(status, s);
+}
+
+
+static void print_ocfs_dlm_disk_vote_reply()
+{
+ ocfs_dlm_disk_vote_reply s;
+ SHOW_SIZEOF(ocfs_dlm_disk_vote_reply, s);
+ SHOW_OFFSET(h, s);
+ SHOW_OFFSET(status, s);
+}
+
+
+static void print_ocfs_dlm_msg()
+{
+ ocfs_dlm_msg s;
+ SHOW_SIZEOF(ocfs_dlm_msg, s);
+ SHOW_OFFSET(magic, s);
+ SHOW_OFFSET(msg_len, s);
+ SHOW_OFFSET(vol_id, s);
+ SHOW_OFFSET(src_node, s);
+ SHOW_OFFSET(dst_node, s);
+ SHOW_OFFSET(msg_type, s);
+ SHOW_OFFSET(check_sum, s);
+ SHOW_OFFSET(msg_buf, s);
+}
+
+
+static void print_ocfs_recv_ctxt()
+{
+ ocfs_recv_ctxt s;
+ SHOW_SIZEOF(ocfs_recv_ctxt, s);
+ SHOW_OFFSET(msg_len, s);
+ SHOW_OFFSET(msg, s);
+ SHOW_OFFSET(status, s);
+#ifdef LINUX_2_5
+ SHOW_OFFSET(ipc_wq, s);
+#else
+ SHOW_OFFSET(ipc_tq, s);
+#endif
+}
+
int main(int argc, char **argv)
{
if (argc > 1) {
@@ -408,5 +887,41 @@
print_ocfs_vol_disk_hdr();
print_ocfs_file_entry();
print_ocfs_extent_group();
+ print_ocfs_alloc_ext();
+ print_ocfs_publish();
+ print_ocfs_vote();
+ print_ocfs_file_entry();
+ print_ocfs_index_node();
+ print_ocfs_index_hdr();
+ print_ocfs_dir_node();
+ print_ocfs_vol_node_map();
+ print_ocfs_vol_layout();
+ print_ocfs_extent_group();
+ print_ocfs_bitmap_lock();
+ print_ocfs_vol_disk_hdr();
+ print_ocfs_disk_lock();
+ print_ocfs_vol_label();
+ print_ocfs_ipc_config_info();
+ print_ocfs_guid();
+ print_ocfs_disk_node_config_info();
+ print_ocfs_node_config_hdr();
+ print_ocfs_cdsl();
+ print_ocfs_free_bitmap();
+ print_ocfs_free_extent_log();
+ print_ocfs_free_log();
+ print_ocfs_delete_log();
+ print_ocfs_recovery_log();
+ print_ocfs_alloc_log();
+ print_ocfs_dir_log();
+ print_ocfs_lock_update();
+ print_ocfs_lock_log();
+ print_ocfs_bcast_rel_log();
+ print_ocfs_cleanup_record();
+ print_ocfs_log_record();
+ print_ocfs_dlm_msg_hdr();
+ print_ocfs_dlm_reply_master();
+ print_ocfs_dlm_disk_vote_reply();
+ print_ocfs_dlm_msg();
+ print_ocfs_recv_ctxt();
return 0;
}
Modified: trunk/unitedlinux/ocfs-2.4.19-64GB-SMP.spec.in
===================================================================
--- trunk/unitedlinux/ocfs-2.4.19-64GB-SMP.spec.in 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/unitedlinux/ocfs-2.4.19-64GB-SMP.spec.in 2003-09-03 01:05:18 UTC (rev 10)
@@ -1,5 +1,5 @@
#
-# Spec file for cvsman
+# Spec file for ocfs
#
# Macros
Modified: trunk/unitedlinux/ocfs.init
===================================================================
--- trunk/unitedlinux/ocfs.init 2003-09-03 00:57:45 UTC (rev 9)
+++ trunk/unitedlinux/ocfs.init 2003-09-03 01:05:18 UTC (rev 10)
@@ -20,13 +20,13 @@
#
LOAD_OCFS=/sbin/load_ocfs
-test -x "$LOAD_OCFS" || exit 0
+test -x "$LOAD_OCFS" || exit 5
-test -r /etc/ocfs.conf || exit 0
+test -r /etc/ocfs.conf || exit 6
KVER="`uname -r`"
case "$KVER" in
-2.4.19-64GB-SMP)
+2.4.19-64GB-SMP|2.4.19-4GB-SMP|2.4.19-4GB)
MODPATH="/lib/modules/${KVER}/kernel/drivers/addon/ocfs"
;;
*)
@@ -35,7 +35,7 @@
;;
esac
-test -r "$MODPATH/ocfs.o" || exit 0
+test -r "$MODPATH/ocfs.o" || exit 5
# Source init.d functions
. /etc/rc.status
@@ -48,7 +48,7 @@
{
# Are there any volumes to mount?
ANY="`awk '/^[ ]*#/{next}$4 ~ /^noauto$|^noauto,|,noauto$/{next}$3 == "ocfs"{print $2}' /etc/fstab 2>/dev/null`"
- test -z "$ANY" && exit 0
+ test -z "$ANY" && return
# Check if anything is missing netdev
ANY="`awk '/^[ ]*#/{next}$4 ~ /^noauto$|^noauto,|,noauto$/{next}$4 ~ /^_netdev$|^_netdev,|,_netdev$/{next}$3 == "ocfs"{print $2}' /etc/fstab 2>/dev/null`"
@@ -67,21 +67,25 @@
# Note that UnitedLinux doesn't have NETWORKING=no
if grep '^ocfs ' /proc/modules >/dev/null 2>&1; then
- $?=0
rc_status -v
- exit 0
+ rc_exit
fi
- # action - DO NOT REMOVE, this is to trick RH /etc/rc
"$LOAD_OCFS"
rc_status -v
;;
+ status)
+ echo -n $"Checking if OCFS is loaded: "
+ grep '^ocfs ' /proc/modules >/dev/null 2>&1
+ rc_status -v
+ ;;
+
stop|force-reload|restart)
;;
*)
- echo "Usage: $0 {start|stop|restart|force-reload}"
+ echo "Usage: $0 {start|stop|status|restart|force-reload}"
exit 1
esac
More information about the Ocfs-commits
mailing list