Whamcloud - gitweb
This commit was manufactured by cvs2svn to create branch 'unlabeled-1.1.4'.
authorcvs2svn <admin@example.com>
Thu, 28 Feb 2002 08:49:04 +0000 (08:49 +0000)
committercvs2svn <admin@example.com>
Thu, 28 Feb 2002 08:49:04 +0000 (08:49 +0000)
134 files changed:
lustre/.cvsignore [deleted file]
lustre/demos/.cvsignore [deleted file]
lustre/demos/Makefile.am [deleted file]
lustre/demos/baseclean.sh [deleted file]
lustre/demos/basesetup.sh [deleted file]
lustre/demos/config.sh [deleted file]
lustre/demos/obdfsclean.sh [deleted file]
lustre/demos/obdfssetup.sh [deleted file]
lustre/demos/obdtest.sh [deleted file]
lustre/demos/snap3clean.sh [deleted file]
lustre/demos/snap3set.sh [deleted file]
lustre/demos/snapclean.sh [deleted file]
lustre/demos/snapdel.sh [deleted file]
lustre/demos/snaprest.sh [deleted file]
lustre/demos/snaprestclean.sh [deleted file]
lustre/demos/snapsetup.sh [deleted file]
lustre/demos/snaptest.sh [deleted file]
lustre/doc/.cvsignore [deleted file]
lustre/doc/Makefile.am [deleted file]
lustre/doc/VERSIONING [deleted file]
lustre/include/.cvsignore [deleted file]
lustre/include/linux/Makefile [deleted file]
lustre/include/linux/inofs.h [deleted file]
lustre/include/linux/lustre_idl.h [deleted file]
lustre/include/linux/lustre_lib.h [deleted file]
lustre/include/linux/lustre_light.h [deleted file]
lustre/include/linux/lustre_mds.h [deleted file]
lustre/include/linux/lustre_net.h [deleted file]
lustre/include/linux/lustre_req.h [deleted file]
lustre/include/linux/obd.h [deleted file]
lustre/include/linux/obd_class.h [deleted file]
lustre/include/linux/obd_ext2.h [deleted file]
lustre/include/linux/obd_filter.h [deleted file]
lustre/include/linux/obd_osc.h [deleted file]
lustre/include/linux/obd_ost.h [deleted file]
lustre/include/linux/obd_raid1.h [deleted file]
lustre/include/linux/obd_rpc.h [deleted file]
lustre/include/linux/obd_snap.h [deleted file]
lustre/include/linux/obd_snap_support.h [deleted file]
lustre/include/linux/obd_support.h [deleted file]
lustre/include/linux/obd_trace.h [deleted file]
lustre/include/linux/obdfs.h [deleted file]
lustre/include/linux/obdo.h [deleted file]
lustre/lib/.cvsignore [deleted file]
lustre/lib/mds_pack.c [deleted file]
lustre/lib/mds_updates.c [deleted file]
lustre/lib/obd_pack.c [deleted file]
lustre/lib/page.c [deleted file]
lustre/llite/.cvsignore [deleted file]
lustre/llite/Makefile.am [deleted file]
lustre/llite/dir.c [deleted file]
lustre/llite/file.c [deleted file]
lustre/llite/namei.c [deleted file]
lustre/llite/rw.c [deleted file]
lustre/llite/super.c [deleted file]
lustre/llite/symlink.c [deleted file]
lustre/llite/sysctl.c [deleted file]
lustre/mdc/.cvsignore [deleted file]
lustre/mdc/Makefile.am [deleted file]
lustre/mdc/mdc_reint.c [deleted file]
lustre/mdc/mdc_request.c [deleted file]
lustre/mds/.cvsignore [deleted file]
lustre/mds/Makefile.am [deleted file]
lustre/mds/handler.c [deleted file]
lustre/mds/mds_reint.c [deleted file]
lustre/obdclass/.cvsignore [deleted file]
lustre/obdclass/Makefile.am [deleted file]
lustre/obdclass/class_obd.c [deleted file]
lustre/obdclass/genops.c [deleted file]
lustre/obdclass/pack.c [deleted file]
lustre/obdclass/proc_lustre.c [deleted file]
lustre/obdclass/sysctl.c [deleted file]
lustre/obdfilter/.cvsignore [deleted file]
lustre/obdfilter/Makefile.am [deleted file]
lustre/obdfilter/filter.c [deleted file]
lustre/obdfs/.cvsignore [deleted file]
lustre/obdfs/Makefile.am [deleted file]
lustre/obdfs/README [deleted file]
lustre/obdfs/dir.c [deleted file]
lustre/obdfs/file.c [deleted file]
lustre/obdfs/flushd.c [deleted file]
lustre/obdfs/namei.c [deleted file]
lustre/obdfs/rw.c [deleted file]
lustre/obdfs/super.c [deleted file]
lustre/obdfs/symlink.c [deleted file]
lustre/obdfs/sysctl.c [deleted file]
lustre/osc/.cvsignore [deleted file]
lustre/osc/Makefile.am [deleted file]
lustre/osc/osc_request.c [deleted file]
lustre/ost/.cvsignore [deleted file]
lustre/ost/Makefile.am [deleted file]
lustre/ost/ost_handler.c [deleted file]
lustre/patches/.cvsignore [deleted file]
lustre/patches/patch-2.2.10 [deleted file]
lustre/patches/patch-2.3.15 [deleted file]
lustre/patches/patch-2.3.21 [deleted file]
lustre/patches/patch-2.4.16 [deleted file]
lustre/patches/patch-2.4.17 [deleted file]
lustre/patches/patch-2.4.3-empty-super [deleted file]
lustre/patches/patch-2.4.9-ac10 [deleted file]
lustre/patches/patch-2.4.9-rh-ac13-xfs-1 [deleted file]
lustre/ptlrpc/rpc.c [deleted file]
lustre/scripts/.cvsignore [deleted file]
lustre/scripts/Makefile.am [deleted file]
lustre/scripts/license-status [deleted file]
lustre/scripts/maketags.sh [deleted file]
lustre/scripts/mkobddevs [deleted file]
lustre/scripts/obd.spec [deleted file]
lustre/scripts/obdtrace_demo.scr [deleted file]
lustre/tests/.cvsignore [deleted file]
lustre/tests/Makefile.am [deleted file]
lustre/tests/common.sh [deleted file]
lustre/tests/fs.sh [deleted file]
lustre/tests/lllocalmount.sh [deleted file]
lustre/tests/llmount-client.sh [deleted file]
lustre/tests/llmount-server.sh [deleted file]
lustre/tests/llmount.sh [deleted file]
lustre/tests/llmountcleanup.sh [deleted file]
lustre/tests/mdcreq.sh [deleted file]
lustre/tests/mdcreqcleanup.sh [deleted file]
lustre/tests/ostreq.sh [deleted file]
lustre/tests/rundbench [deleted file]
lustre/tests/snaprun.sh [deleted file]
lustre/tests/test.c [deleted file]
lustre/tests/test2.c [deleted file]
lustre/tests/testreq.c [deleted file]
lustre/tests/truncate.c [deleted file]
lustre/utils/.cvsignore [deleted file]
lustre/utils/Makefile.am [deleted file]
lustre/utils/Pack.pm [deleted file]
lustre/utils/obdcontrol [deleted file]
lustre/utils/obdctl.c [deleted file]
lustre/utils/parser.c [deleted file]
lustre/utils/parser.h [deleted file]

diff --git a/lustre/.cvsignore b/lustre/.cvsignore
deleted file mode 100644 (file)
index e530020..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-.Xrefs
-config.log
-config.status
-configure
-Makefile
-Makefile.in
-.deps
-TAGS
diff --git a/lustre/demos/.cvsignore b/lustre/demos/.cvsignore
deleted file mode 100644 (file)
index e530020..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-.Xrefs
-config.log
-config.status
-configure
-Makefile
-Makefile.in
-.deps
-TAGS
diff --git a/lustre/demos/Makefile.am b/lustre/demos/Makefile.am
deleted file mode 100644 (file)
index 0538049..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-# Copyright (C) 2001  Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-
-demo_SCRIPTS = baseclean.sh basesetup.sh obdfsclean.sh obdfssetup.sh \
-       obdtest.sh snap3clean.sh snap3set.sh snapclean.sh snapdel.sh \
-       snaprest.sh snaprestclean.sh snapsetup.sh snaptest.sh
-demo_DATA = config.sh
-EXTRA_DIST = $(demo_SCRIPTS) $(demo_DATA)
diff --git a/lustre/demos/baseclean.sh b/lustre/demos/baseclean.sh
deleted file mode 100755 (executable)
index 93730ee..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-# Script to remove the loopback device and temp file created in newtest.sh
-#
-# Copyright (C) 2001  Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-OBDDIR="`dirname $0`/.."
-. $OBDDIR/demos/config.sh
-
-
-mount | grep "$MNTOBD " > /dev/null 2>&1
-if [ x$? = x0 ]; then
-    echo "Stuff still mounted on $MNTOBD"
-    exit 1
-fi
-
-mount | grep "$MNTSNAP " > /dev/null 2>&1
-if [ x$? = x0 ]; then
-    echo "Stuff still mounted on $MNTSNAP"
-    exit 2
-fi
-
-mount | grep "$MNTSNAP2 " > /dev/null 2>&1
-if [ x$? = x0 ]; then
-    echo "Stuff still mounted on $MNTSNAP2"
-    exit 3
-fi
-
-
-if [ "$LOOPDEV" ]; then
-    losetup -d $LOOPDEV
-    rmmod loop > /dev/null 2>&1
-fi
-
-if [ "$LOOPDEV" -a "$TMPFILE" -a -f "$TMPFILE" ]; then
-    rm -i $TMPFILE
-fi
-
diff --git a/lustre/demos/basesetup.sh b/lustre/demos/basesetup.sh
deleted file mode 100755 (executable)
index 3b0bad8..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-#! /bin/sh
-# Get the locations for the files from a single place to avoid confusion
-#
-# Copyright (C) 2001  Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-OBDDIR="`dirname $0`/.."
-
-# source config info
-. $OBDDIR/demos/config.sh
-
-insmod obdclass
-insmod obdext2
-insmod obdfs
-
-# module configuration
-if [ "$MODCONF" -a -f $MODCONF ]; then
-    if [ -z "`grep -i "alias  *char-major-$OBDMAJ  *obdclass" $MODCONF`" ]; then
-       if [ -d /etc/modutils ]; then
-           # Debian-style modules configuration.
-           echo "alias char-major-${OBDMAJ} obdclass" > /etc/modutils/obd
-           update-modules
-       else
-           echo "alias char-major-${OBDMAJ} obdclass" >>$MODCONF
-       fi
-    fi
-fi
-
-
-# temp file
-if [ "$LOOPDEV" -a "$TMPFILE" -a -f $TMPFILE ]; then 
-    echo "$TMPFILE exists; I'm unwilling to overwrite it.  Remove [N/y]?" 1>&2
-    rm -i $TMPFILE
-    [ -f $TMPFILE ] && exit 1
-fi
-[ "$TMPFILE" ] && dd if=/dev/zero of=$TMPFILE bs=1k count=$TMPSIZE
-
-
-# loop device
-if [ "$LOOPDEV" ]; then
-    insmod loop > /dev/null 2>&1
-    if [ -a "`losetup $LOOPDEV 2> /dev/null`" ]; then
-       echo "It appears that $LOOPDEV is in use.  Unable to continue" 1>&2
-       echo "You need to clean up $LOOPDEV (via cleanup.sh),"
-       echo "or you can change which device is used in demos/config.sh" 1>&2
-       # undo previous
-       [ "$TMPFILE" ] && rm $TMPFILE
-       exit 2
-    fi
-    losetup $LOOPDEV $TMPFILE
-fi
-
-# Ensure that we have the correct devices for OBD to work
-[ ! -c /dev/obd0 ] && mknod /dev/obd0 c $OBDMAJ 0
-[ ! -c /dev/obd1 ] && mknod /dev/obd1 c $OBDMAJ 1
-[ ! -c /dev/obd2 ] && mknod /dev/obd2 c $OBDMAJ 2
-
-
-if [ "$BASEDEV" ]; then
-    # echo "No mke2fs!!"
-     mke2fs -r 0 -b 4096 $BASEDEV
-else
-    echo "\$BASEDEV not defined in demos/config.sh.  Please fix!"
-    [ "$LOOPDEV" ] && losetup -d $LOOPDEV 
-    [ "$TMPFILE" ] && rm $TMPFILE
-    exit 3
-fi
diff --git a/lustre/demos/config.sh b/lustre/demos/config.sh
deleted file mode 100644 (file)
index 4d19a29..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/bin/sh
-# File which holds configuation parameters in a single place to avoid any
-# mismatch between scripts (especially the cleanup scripts, which are
-# destructive).
-#
-# Copyright (C) 2001  Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-#set -vx
-
-# Major number for OBD devices
-OBDMAJ=186
-
-# Module configuration file
-[ -f /etc/conf.modules ] && MODCONF=/etc/conf.modules
-[ -z "$MODCONF" -a -f /etc/modules.conf ] && MODCONF=/etc/modules.conf
-
-# If LOOPDEV is empty (""), then no loopback device will be configured.
-# If TMPFILE is empty (""), then no temporary file will be created for loop.
-[ "$TMPFILE" ] || TMPFILE="/tmp/obdfs.tmpfile"
-[ "$TMPSIZE" ] || TMPSIZE=10240
-[ -b /dev/loop/0 ] && LOOPDEV=/dev/loop/0
-[ -z "$LOOPDEV" -a -b /dev/loop0 ] && LOOPDEV="/dev/loop0"
-
-# If LOOPDEV is empty, then it is assumed that BASEDEV is a real block device
-# that doesn't mind being overwritten - don't use a partition with data on it!!
-LOOPDEV="/dev/loop0"
-BASEDEV="/dev/loop0"
-
-# The following are mount points for the filesystems during the test.
-MNTOBD="/mnt/obd"
-MNTSNAP="/mnt/snap"
-MNTSNAP2="/mnt/snap2"
-
-# This is where the snapshot table will be stored:
-SNAPTABLE="/tmp/obdfs.snaptable"
-
-# A simple routine called by most of the scripts to help debugging.  The
-# kernel code has a lot of debugging statements, so this helps us keep
-# track of what is going on in user-land to generate the kernel messages.
-plog () {
-    if [ "$1" = "log" ]; then
-       shift
-       logger -p kern.info "******** $* **********"
-       echo "$*"
-    else
-       logger -p kern.info "****start**** $* *****"
-       echo "$*"
-       $*
-       logger -p kern.info "*****end***** $* *****"
-    fi
-}
-
-# A routine to display a command, and prompt user if it should be run
-qrun () {
-    echo
-    echo -n "Run '$*' [Y/n]?'";
-    read JUNK
-
-    case $JUNK in
-       n*|N*) echo "'$*' not run" ;;
-       *) plog $* ;;
-    esac
-}
diff --git a/lustre/demos/obdfsclean.sh b/lustre/demos/obdfsclean.sh
deleted file mode 100755 (executable)
index c0fa384..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/sh
-# Utility script for cleaning up a simple OBDFS mounted filesystem
-#
-# Copyright (C) 2001  Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-
-OBDDIR="`dirname $0`/.."
-. $OBDDIR/demos/config.sh
-
-plog umount $MNTOBD
-#killall pupdated      # stop the OBDFS flush daemon
-plog rmmod obdfs
-
-plog log "CLEANUP/DETACH"
-$OBDDIR/utils/obdctl << EOF
-device 0
-cleanup
-detach
-quit
-EOF
-
-plog rmmod xfs
-plog rmmod xfs_support
-plog rmmod pagebuf
-plog rmmod obdfilter
-plog rmmod obdext2
-plog rmmod obdclass
-
-$OBDDIR/demos/baseclean.sh
diff --git a/lustre/demos/obdfssetup.sh b/lustre/demos/obdfssetup.sh
deleted file mode 100755 (executable)
index 80acc66..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#! /bin/bash
-# Utility script for configuring a simple OBDFS mount
-#
-# Copyright (C) 2001  Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-
-OBDDIR="`dirname $0`/.."
-.  $OBDDIR/demos/config.sh
-
-$OBDDIR/demos/basesetup.sh
-
-if [ x$? != x0 ]; then 
-    echo "Error running basesetup.sh"
-    exit 4;
-fi
-
-#insmod $OBDDIR/class/obdclass.o
-#insmod $OBDDIR/ext2obd/obdext2.o
-#insmod $OBDDIR/obdfs/obdfs.o
-
-plog log "ATTACHING device 0 SETUP $BASEDEV"
-$OBDDIR/utils/obdctl << EOF
-device 0
-# attach obdfilter
-# setup $BASEDEV reiserfs
-attach obdext2
-setup $BASEDEV
-quit
-EOF
-
-[ ! -d "$MNTOBD" ] &&  mkdir $MNTOBD
-plog mount -t obdfs -odevice=/dev/obd0 none $MNTOBD
diff --git a/lustre/demos/obdtest.sh b/lustre/demos/obdtest.sh
deleted file mode 100755 (executable)
index e1235f2..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#! /bin/bash
-# Utility script to create an OBD snapshot.  If an existing filesystem is
-# not already mounted on /mnt/obd, we call the basic OBD setup script to
-# create and mount a filesystem for us.
-#
-# Copyright (C) 2001  Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-
-OBDDIR="`dirname $0`/.."
-. $OBDDIR/demos/config.sh
-
-[ ! -d $MNTOBD/lost+found ] && $OBDDIR/demos/obdfssetup.sh
-
-echo "echo yesterday >> $MNTOBD/hello" # create a file
-echo "yesterday" > $MNTOBD/hello
-echo "echo testing > $MNTOBD/goodbye"  # create a file
-echo "testing" > $MNTOBD/goodbye
-plog ln -s hello $MNTOBD/link          # create a symbolic link
-cd $MNTOBD ; plog touch a b c ; cd -           # create a file
diff --git a/lustre/demos/snap3clean.sh b/lustre/demos/snap3clean.sh
deleted file mode 100755 (executable)
index a660ad2..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh
-# Utility script for cleaning up a third snapshot created by setup3.sh
-#
-# Copyright (C) 2001  Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-
-OBDDIR="`dirname $0`/.."
-. $OBDDIR/demos/config.sh
-
-plog umount $MNTSNAP2
-
-plog log "CLEANUP /dev/obd3"
-$OBDDIR/utils/obdcontrol -f << EOF
-device /dev/obd3
-cleanup
-detach
-quit
-EOF
-
-$OBDDIR/demos/snapclean.sh
diff --git a/lustre/demos/snap3set.sh b/lustre/demos/snap3set.sh
deleted file mode 100755 (executable)
index d32baba..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/sh
-# Utility script for creating a third snapshot.
-#
-# Copyright (C) 2001  Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-
-OBDDIR="`dirname $0`/.."
-. $OBDDIR/demos/config.sh
-
-[ ! -d $MNTSNAP/lost+found ] && $OBDDIR/demos/snapsetup.sh
-
-$OBDDIR/demos/snaptest.sh
-
-sync
-sleep 5 # let syslog logs get written 
-
-plog log "CREATING /dev/obd3 snapshot"
-$OBDDIR/utils/obdcontrol -f << EOF
-snaptable
-$SNAPTABLE
-a
-3
-now
-q
-y
-snapset 0 $SNAPTABLE
-device /dev/obd3
-attach obdsnap 0 3 0
-setup
-quit
-EOF
-
-[ ! -d "$MNTSNAP2" ] && mkdir $MNTSNAP2
-plog mount -t obdfs -oro,device=/dev/obd3 none $MNTSNAP2
diff --git a/lustre/demos/snapclean.sh b/lustre/demos/snapclean.sh
deleted file mode 100755 (executable)
index ecc94ee..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#! /bin/bash
-# Utility script for cleaning up snapshots and removing modules.
-#
-# Copyright (C) 2001  Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-
-OBDDIR="`dirname $0`/.."
-. $OBDDIR/demos/config.sh
-
-plog umount $MNTOBD
-plog umount $MNTSNAP
-
-plog log "CLEANUP /dev/obd2 /dev/obd1"
-$OBDDIR/utils/obdcontrol -f << EOF
-device /dev/obd2
-cleanup
-detach
-device /dev/obd1
-cleanup
-detach
-quit
-EOF
-
-rmmod obdsnap
-
-rm $SNAPTABLE
-$OBDDIR/demos/obdfsclean.sh
diff --git a/lustre/demos/snapdel.sh b/lustre/demos/snapdel.sh
deleted file mode 100755 (executable)
index 06e33a4..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/sh
-# Utility script to test deleting a snapshot that has been previously
-# created as the setup.sh script does.
-#
-# Copyright (C) 2001  Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-
-OBDDIR="`dirname $0`/.."
-. $OBDDIR/demos/config.sh
-
-[ ! -d $MNTSNAP/lost+found ] && echo "need to run obdsetup.sh first" && exit 1
-[ ! -f $MNTOBD/hosts ] && $OBDDIR/demos/snaptest.sh
-
-plog umount $MNTSNAP
-plog umount $MNTOBD
-
-sync
-sleep 1
-plog log "STARTING snapdelete"
-$OBDDIR/utils/obdcontrol -f << EOF
-device /dev/obd2
-connect
-snapdelete
-disconnect
-cleanup
-detach
-snaptable
-$SNAPTABLE
-d
-2
-q
-y
-snapset 0 $SNAPTABLE
-EOF
-plog log "COMPLETE snapdelete"
-plog mount -t obdfs -odevice=/dev/obd1 none $MNTOBD
diff --git a/lustre/demos/snaprest.sh b/lustre/demos/snaprest.sh
deleted file mode 100755 (executable)
index b139e39..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/sh
-# Utility script to test restoring a previous snapshot.  This will destroy
-# the "current" snapshot and restore the old one in its place.
-#
-# Copyright (C) 2001  Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-
-OBDDIR="`dirname $0`/.."
-. $OBDDIR/demos/config.sh
-
-[ ! -d $MNTSNAP/lost+found ] && echo "need to run snapsetup.sh first" && exit 1
-
-plog umount $MNTSNAP
-plog umount $MNTOBD
-
-mount | grep "$MNTOBD " > /dev/null 2>&1
-if [ x$? = x0 ]; then 
-    echo "Stuff still mounted on $MNTOBD; clean up first."
-    exit 
-fi
-
-mount | grep "$MNTSNAP " > /dev/null 2>&1
-if [ x$? = x0 ]; then 
-    echo "Stuff still mounted on $MNTSNAP; clean up first."
-    exit 
-fi
-
-sync
-plog log "STARTING snaprestore"
-
-
-$OBDDIR/utils/obdcontrol -f << EOF
-device /dev/obd1
-cleanup
-detach
-device /dev/obd2
-connect
-snaprestore 2 $SNAPTABLE 0
-quit
-EOF
-
-plog log "COMPLETE snaprestore"
-
-plog mount -t obdfs -odevice=/dev/obd2 none $MNTOBD
diff --git a/lustre/demos/snaprestclean.sh b/lustre/demos/snaprestclean.sh
deleted file mode 100755 (executable)
index 4b3b57d..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#! /bin/bash
-# Utility script for cleaning up a simple OBDFS mounted filesystem
-#
-# Copyright (C) 2001  Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-
-OBDDIR="`dirname $0`/.."
-. $OBDDIR/demos/config.sh
-
-umount $MNTOBD
-mount | grep "$MNTOBD " > /dev/null 2>&1
-if [ x$? = x0 ]; then 
-    echo "Stuff still mounted on $MNTOBD; clean up first."
-    exit 
-fi
-
-rmmod obdfs
-
-$OBDDIR/utils/obdcontrol -f << EOF
-device /dev/obd2
-cleanup
-detach
-device /dev/obd0
-cleanup
-detach
-quit
-EOF
-
-rmmod obdsnap
-rmmod obdext2
-rmmod obdclass
-
-rm $SNAPTABLE
-$OBDDIR/demos/baseclean.sh
diff --git a/lustre/demos/snapsetup.sh b/lustre/demos/snapsetup.sh
deleted file mode 100755 (executable)
index 7db6ab1..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-#! /bin/bash
-# Utility script to create an OBD snapshot.  If an existing filesystem is
-# not already mounted on /mnt/obd, we call the basic OBD setup script to
-# create and mount a filesystem for us.
-#
-# Copyright (C) 2001  Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-
-OBDDIR="`dirname $0`/.."
-. $OBDDIR/demos/config.sh
-
-
-# prepare the snapshot drive with a file to be COW'd
-if [ ! -d /mnt/obd/lost+found ]; then 
-    $OBDDIR/demos/obdfssetup.sh
-    if [ x$? != x0 ]; then 
-       echo "Error running obdfssetup.sh"
-       exit 4
-   fi
-fi
-
-if [ ! -f $MNTOBD/hello ]; then
-       $OBDDIR/demos/obdtest.sh
-       if [ x$? != x0 ]; then 
-           echo "Error in obdfssetup.sh"
-       exit 4
-    fi
-fi
-
-plog umount $MNTOBD
-
-#plog insmod $OBDDIR/snap/obdsnap.o
-
-rm -f $SNAPTABLE
-
-plog log "NEW SNAP SETUP"
-# Create two snapshots using the OBD snapshot driver.  One will be the
-# "current" snapshot (in obd device 1), where changes will take place.
-# The current snapshot is required in order to use the filesystem.  The
-# second will be a snapshot of the filesystem taken "now" (in obd device 2)
-# that will remain static (historical read-only) filesystem as changes
-# are made to the current snapshot.
-$OBDDIR/utils/obdcontrol -f << EOF
-snaptable
-$SNAPTABLE
-a
-1
-current
-a
-2
-now
-q
-y
-snapset 0 $SNAPTABLE
-device /dev/obd1
-attach obdsnap 0 1 0
-setup
-device /dev/obd2
-attach obdsnap 0 2 0
-setup
-quit
-EOF
-
-# Mount the two filesystems.  The filesystem under $MNTOBD will be the
-# one where changes are made, while $MNTSNAP will contain the original
-# files at the point when the snapshot was taken.
-
-[ ! -d "$MNTOBD" ] &&  mkdir $MNTOBD
-[ ! -d "$MNTSNAP" ] &&  mkdir $MNTSNAP
-plog mount -t obdfs -odevice=/dev/obd1 none $MNTOBD
-plog mount -t obdfs -oro,device=/dev/obd2 none $MNTSNAP
diff --git a/lustre/demos/snaptest.sh b/lustre/demos/snaptest.sh
deleted file mode 100755 (executable)
index 675a529..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-# Utility script to perform minor modifications to the read-write mounted
-# snapshot in order to demonstrate the changes w.r.t. the read-only snapshot
-#
-# Copyright (C) 2001  Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-
-OBDDIR="`dirname $0`/.."
-. $OBDDIR/demos/config.sh
-
-plog chmod 777 $MNTOBD                 # change attributes on an existing file
-plog rm $MNTOBD/a                      # delete an existing file
-echo "echo today >> $MNTOBD/hello"     # modify an existing file
-echo today >> $MNTOBD/hello
-plog cp /etc/group $MNTOBD             # create a new file
-plog ln -s goodbye $MNTOBD/newlink     # create a new symlink
diff --git a/lustre/doc/.cvsignore b/lustre/doc/.cvsignore
deleted file mode 100644 (file)
index e530020..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-.Xrefs
-config.log
-config.status
-configure
-Makefile
-Makefile.in
-.deps
-TAGS
diff --git a/lustre/doc/Makefile.am b/lustre/doc/Makefile.am
deleted file mode 100644 (file)
index 8ee9ed5..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright (C) 2001  Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-
-DOCS = OBD-HOWTO.sgml OLVM.txt figs notes.txt obdspec.sgml obdtrace_demo.txt
-doc_DATA = $(DOCS) OBD-HOWTO.html OBD-HOWTO.txt
-CLEANFILES = OBD-HOWTO.html OBD-HOWTO.txt
-EXTRA_DIST = $(DOCS)
-
-.sgml.html:
-       sgml2html -split 0 $<
-
-.sgml.txt:
-       sgml2txt $<
-
-SUFFIXES = .sgml .html .txt
-
-dist-hook:
-       rm -rf $(distdir)/figs/CVS
diff --git a/lustre/doc/VERSIONING b/lustre/doc/VERSIONING
deleted file mode 100644 (file)
index 30f5f61..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-Lustre versioning
-=================
-
-0.0.1  2/19/2002 <braam@clusterfs.com>
-
-This document describes versioning of source and binaries for Lustre.
-
-CVS
-===
-
-Versions will have 4 digits:
-                     major.minor.patch.test
-
-Such versions will be tagged in CVS as:  
-                     v1_2_11_7
-and referred to as:
-                     1.2.11.7
-encoded as:
-                     0x01021107
-
-Usage: 
-------
-
-New numbers are used as follows: 
-
-1. major: 
- - increased when major new functionality becomes available
-2. minor: 
- - even: for each new release with new functionality
- - odd : when a new development cycle starts after a release
-3. patch:
- - when a development snapshot or release update becomes available
- - all these are announced on lustre-devel@lists.sf.net
-4. test: 
- - when developers feel it is time to exchange a named version
-
-What will run, what won't:
-
-1. If the test level is non-zero no guarantees of any kind are made. 
-2. For three digit releases/tags the code should perform 
-   according to the announcement.
-
diff --git a/lustre/include/.cvsignore b/lustre/include/.cvsignore
deleted file mode 100644 (file)
index e530020..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-.Xrefs
-config.log
-config.status
-configure
-Makefile
-Makefile.in
-.deps
-TAGS
diff --git a/lustre/include/linux/Makefile b/lustre/include/linux/Makefile
deleted file mode 100644 (file)
index c263b40..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-# Copyright (C) 2001  Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-
-all .DEFAULT: 
-       $(MAKE) -C ../..  $@
diff --git a/lustre/include/linux/inofs.h b/lustre/include/linux/inofs.h
deleted file mode 100644 (file)
index 1ed3220..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/* object based disk file system
- * 
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- * 
- * Copyright (C), 1999, Stelias Computing Inc
- *
- *
- */
-
-
-#ifndef _INOFS_H
-#define INOFS_H
-#include <linux/obd_class.h>
-
-#include <linux/obdo.h>
-
-/* super.c */
-void inofs_read_inode(struct inode *inode);
-
-
-/* file.c */
-ssize_t inofs_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos);
-
-
-/* rw.c */
-struct page *inofs_getpage(struct inode *inode, unsigned long offset, int create, int locked);
-int inofs_writepage(struct file *file, struct page *page);
-int inofs_write_one_page(struct file *file, struct page *page, unsigned long offset, unsigned long bytes, const char * buf);
-
-/* namei.c */
-struct dentry *inofs_lookup(struct inode * dir, struct dentry *dentry);
-int inofs_create (struct inode * dir, struct dentry * dentry, int mode);
-int inofs_mkdir(struct inode *dir, struct dentry *dentry, int mode);
-int inofs_rmdir(struct inode *dir, struct dentry *dentry);
-int inofs_unlink(struct inode *dir, struct dentry *dentry);
-int inofs_mknod(struct inode *dir, struct dentry *dentry, int mode, int rdev);
-int inofs_symlink(struct inode *dir, struct dentry *dentry, const char *symname);
-int inofs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry);
-int inofs_rename(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry);
-
-/* dir.c */
-int inofs_readdir(struct file * filp, void * dirent, filldir_t filldir);
-
-struct inofs_sb_info {
-        struct list_head osi_list;      /* list of supers */
-        struct obd_conn osi_conn;
-        struct super_block *osi_super;
-        struct obd_device *osi_obd;
-        struct obd_ops *osi_ops;
-        struct list_head         osi_inodes;    /* list of dirty inodes */
-        unsigned long            osi_cache_count;
-        struct semaphore         osi_list_mutex;
-};
-
-void inofs_sysctl_init(void);
-void inofs_sysctl_clean(void);
-
-struct inofs_inode_info;
-
-extern struct file_operations inofs_file_ops;
-extern struct inode_operations inofs_inode_ops;
-
-static inline struct obd_ops *iops(struct inode *i)
-{
-        struct inofs_sb_info *sbi = (struct inofs_sb_info *) i->i_sb->u.generic_sbp;
-        return sbi->osi_ops;
-}
-
-#define NOLOCK 0
-#define LOCKED 1
-
-
-#define INOFS_SUPER_MAGIC 0x4711
-
-#endif
-
diff --git a/lustre/include/linux/lustre_idl.h b/lustre/include/linux/lustre_idl.h
deleted file mode 100644 (file)
index c8d8969..0000000
+++ /dev/null
@@ -1,553 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 2001 Cluster File Systems, Inc. <braam@clusterfs.com>
- *
- *   This file is part of Lustre, http://www.lustre.org.
- *
- *   Lustre is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   Lustre is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with Lustre; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * (Un)packing of OST requests
- */
-
-#ifndef __LUSTRE_IDL_H__
-#define __LUSTRE_IDL_H__
-#ifdef __KERNEL__
-#include <linux/ioctl.h>
-#include <asm/types.h>
-
-#include <linux/types.h>
-#else 
-#define __KERNEL__
-#include <linux/list.h>
-#undef __KERNEL__
-#include <stdint.h>
-#endif
-/* 
- * this file contains all data structures used in Lustre interfaces:
- * - obdo and obd_request records
- * - mds_request records
- * - ioctl's
- */ 
-
-
-/* 
- *   OST requests: OBDO & OBD request records
- */
-
-/* opcodes */
-#define OST_GETATTR    1
-#define OST_SETATTR    2
-#define OST_BRW        3
-#define OST_CREATE     4
-#define OST_DESTROY    5
-#define OST_GET_INFO   6
-#define OST_CONNECT    7
-#define OST_DISCONNECT 8
-#define OST_PUNCH      9
-
-/* packet types */
-#define OST_TYPE_REQ 1
-#define OST_TYPE_REP 2
-#define OST_TYPE_ERR 3
-
-struct ptlreq_hdr { 
-       __u32 opc;
-       __u64 seqno;
-       __u32 status;
-       __u32 type;
-};
-
-struct ptlrep_hdr { 
-       __u32 opc;
-       __u64 seqno;
-       __u32 status;
-       __u32 type;
-};
-
-typedef uint64_t        obd_id;
-typedef uint64_t        obd_gr;
-typedef uint64_t        obd_time;
-typedef uint64_t        obd_size;
-typedef uint64_t        obd_off;
-typedef uint64_t        obd_blocks;
-typedef uint32_t        obd_blksize;
-typedef uint32_t        obd_mode;
-typedef uint32_t        obd_uid;
-typedef uint32_t        obd_gid;
-typedef uint32_t        obd_rdev;
-typedef uint32_t        obd_flag;
-typedef uint32_t        obd_count;
-
-#define OBD_FL_INLINEDATA       (0x00000001UL)  
-#define OBD_FL_OBDMDEXISTS      (0x00000002UL)
-
-#define OBD_INLINESZ    60
-#define OBD_OBDMDSZ     60
-/* Note: 64-bit types are 64-bit aligned in structure */
-struct obdo {
-        obd_id                  o_id;
-        obd_gr                  o_gr;
-        obd_time                o_atime;
-        obd_time                o_mtime;
-        obd_time                o_ctime;
-        obd_size                o_size;
-        obd_blocks              o_blocks;
-        obd_blksize             o_blksize;
-        obd_mode                o_mode;
-        obd_uid                 o_uid;
-        obd_gid                 o_gid;
-        obd_flag                o_flags;
-        obd_flag                o_obdflags;
-        obd_count               o_nlink;
-        obd_count               o_generation;
-        obd_flag                o_valid;        /* hot fields in this obdo */
-        char                    o_inline[OBD_INLINESZ];
-        char                    o_obdmd[OBD_OBDMDSZ];
-        struct list_head        o_list;
-        struct obd_ops          *o_op;
-};
-
-#define OBD_MD_FLALL    (~0UL)
-#define OBD_MD_FLID     (0x00000001UL)
-#define OBD_MD_FLATIME  (0x00000002UL)
-#define OBD_MD_FLMTIME  (0x00000004UL)
-#define OBD_MD_FLCTIME  (0x00000008UL)
-#define OBD_MD_FLSIZE   (0x00000010UL)
-#define OBD_MD_FLBLOCKS (0x00000020UL)
-#define OBD_MD_FLBLKSZ  (0x00000040UL)
-#define OBD_MD_FLMODE   (0x00000080UL)
-#define OBD_MD_FLTYPE   (0x00000100UL)
-#define OBD_MD_FLUID    (0x00000200UL)
-#define OBD_MD_FLGID    (0x00000400UL)
-#define OBD_MD_FLFLAGS  (0x00000800UL)
-#define OBD_MD_FLOBDFLG (0x00001000UL)
-#define OBD_MD_FLNLINK  (0x00002000UL)
-#define OBD_MD_FLGENER  (0x00004000UL)
-#define OBD_MD_FLINLINE (0x00008000UL)
-#define OBD_MD_FLOBDMD  (0x00010000UL)
-#define OBD_MD_FLOBJID  (0x00020000UL)
-#define OBD_MD_FLNOTOBD (~(OBD_MD_FLOBDMD | OBD_MD_FLOBDFLG | OBD_MD_FLBLOCKS))
-
-/* request structure for OST's */
-
-#define OST_REQ_HAS_OA1  0x1
-
-struct ost_req { 
-       __u32   connid;
-       __u32   cmd; 
-       struct  obdo oa;
-       __u32   buflen1;
-       __u32   buflen2;
-};
-
-struct ost_rep {
-       __u32   result;
-       __u32   connid;
-       struct  obdo oa;
-       __u32   buflen1;
-       __u32   buflen2;
-};
-
-struct obd_ioobj { 
-        obd_id    ioo_id;
-        obd_gr    ioo_gr;
-        __u32     ioo_type;
-        __u32     ioo_bufcnt;
-};
-
-
-/* 
- *   MDS REQ RECORDS
- */
-
-
-#define MDS_TYPE_REQ 1
-#define MDS_TYPE_REP 2
-#define MDS_TYPE_ERR 3
-
-#define MDS_GETATTR   1
-#define MDS_OPEN      2
-#define MDS_CLOSE     3
-#define MDS_REINT     4
-#define MDS_READPAGE  5
-
-#define REINT_SETATTR 0
-#define REINT_CREATE  1
-#define REINT_LINK    2
-#define REINT_UNLINK  3
-#define REINT_RENAME  4
-#define REINT_MAX     4
-
-struct ll_fid { 
-       __u64 id;
-       __u32 generation;
-       __u32 f_type;
-};
-
-struct niobuf { 
-        __u64 addr;
-        __u64 offset; 
-        __u32 len;
-        __u32 flags;
-        void *page;
-};
-
-struct mds_req {
-       struct ll_fid        fid1;
-       struct ll_fid        fid2;
-        __u32                       namelen;
-        __u32                       tgtlen;
-        __u32                       opcode;
-        __u32                       valid;
-        __u32                      mode;
-        __u32                       uid;
-        __u32                       gid;
-        __u64                       size;
-        __u32                       mtime;
-        __u32                       ctime;
-        __u32                       atime;
-        __u32                       flags;
-        __u32                       major;
-        __u32                       minor;
-        __u32                       ino;
-        __u32                       nlink;
-        __u32                       generation;
-        __u64                       objid;
-};
-
-struct mds_rep {
-       struct ll_fid               fid1;
-       struct ll_fid               fid2;
-        __u32                       namelen;
-        __u32                       tgtlen;
-        __u32                       valid;
-        __u32                      mode;
-        __u32                       uid;
-        __u32                       gid;
-        __u64                       size;
-        __u32                       mtime;
-        __u32                       ctime;
-        __u32                       atime;
-        __u32                       flags;
-        __u32                       major;
-        __u32                       minor;
-        __u32                       ino;
-        __u32                       nlink;
-        __u32                       generation;
-        __u64                       objid;
-};
-
-/* MDS update records */ 
-struct mds_update_record_hdr { 
-        __u32 ur_reclen;
-        __u32 ur_opcode;
-};
-
-struct mds_rec_setattr { 
-        __u32           sa_reclen;
-        __u32           sa_opcode;
-       struct ll_fid   sa_fid;
-       __u32           sa_valid;
-       __u32           sa_mode;
-       __u32           sa_uid;
-       __u32           sa_gid;
-       __u64           sa_size;
-       __u64           sa_atime;
-       __u64           sa_mtime;
-       __u64           sa_ctime;
-       __u32           sa_attr_flags;
-};
-
-struct mds_rec_create { 
-        __u32           cr_reclen;
-        __u32           cr_opcode;
-       struct ll_fid   cr_fid;
-        __u32           cr_uid;
-        __u32           cr_gid;
-        __u64           cr_time;
-       __u32           cr_mode;
-        /* overloaded: id for create, tgtlen for symlink, rdev for mknod */ 
-       __u64           cr_id; 
-        __u32           cr_namelen;
-        __u32           cr_tgtlen;
-        /* name here */
-        /* symlink target here */ 
-};
-
-struct mds_rec_link { 
-        __u32           lk_reclen;
-        __u32           lk_opcode;
-       struct ll_fid   lk_fid1;
-       struct ll_fid   lk_fid2;
-        __u32           lk_namelen;
-};
-
-struct mds_rec_unlink { 
-        __u32           ul_reclen;
-        __u32           ul_opcode;
-       struct ll_fid   ul_fid1;
-        __u32           ul_namelen;
-};
-
-struct mds_rec_rename { 
-        __u32           rn_reclen;
-        __u32           rn_opcode;
-       struct ll_fid   rn_fid1;
-       struct ll_fid   rn_fid2;
-        __u32           rn_namelen;
-        __u32           rn_tgtlen;
-};
-
-#ifdef __KERNEL__ 
-
-static inline void ll_ino2fid(struct ll_fid *fid, ino_t ino, __u32 generation, int type)
-{
-        fid->id = HTON__u64((__u64)ino);
-        fid->generation = HTON__u32(generation);
-        fid->f_type = HTON__u32(type);
-}
-
-static inline void ll_inode2fid(struct ll_fid *fid, struct inode *inode)
-{
-        fid->id = HTON__u64((__u64)inode->i_ino);
-        fid->generation = HTON__u32(inode->i_generation);
-        fid->f_type = HTON__u32(inode->i_mode & S_IFMT);
-}
-
-#endif 
-
-/* 
- *   OBD IOCTLS
- */
-
-
-#define OBD_IOCTL_VERSION 0x00010001
-
-struct obd_ioctl_data { 
-       uint32_t ioc_len;
-       uint32_t ioc_version;
-        uint32_t ioc_conn1;
-        uint32_t ioc_conn2;
-       struct obdo ioc_obdo1;
-       struct obdo ioc_obdo2;
-        obd_size         ioc_count;
-        obd_off          ioc_offset;
-       uint32_t         ioc_dev;
-
-       /* buffers the kernel will treat as user pointers */
-       uint32_t ioc_plen1;
-       char    *ioc_pbuf1;
-       uint32_t ioc_plen2;
-       char    *ioc_pbuf2;
-
-       /* two inline buffers */
-       uint32_t ioc_inllen1;
-       char    *ioc_inlbuf1;
-       uint32_t ioc_inllen2;
-       char    *ioc_inlbuf2;
-
-       char    ioc_bulk[0];
-};
-
-struct obd_ioctl_hdr { 
-       uint32_t ioc_len;
-       uint32_t ioc_version;
-};
-
-static inline int obd_ioctl_packlen(struct obd_ioctl_data *data)
-{
-       int len = sizeof(struct obd_ioctl_data);
-       len += size_round(data->ioc_inllen1);
-       len += size_round(data->ioc_inllen2);
-       return len;
-}
-
-static inline int obd_ioctl_is_invalid(struct obd_ioctl_data *data)
-{
-       if (data->ioc_len > (1<<30)) { 
-               printk("OBD ioctl: ioc_len larger than 1<<30\n");
-               return 1;
-       }
-       if (data->ioc_inllen1 > (1<<30)) { 
-               printk("OBD ioctl: ioc_inllen1 larger than 1<<30\n");
-               return 1;
-       }
-       if (data->ioc_inllen2 > (1<<30)) { 
-               printk("OBD ioctl: ioc_inllen2 larger than 1<<30\n");
-               return 1;
-       }
-       if (data->ioc_inlbuf1 && !data->ioc_inllen1) {
-               printk("OBD ioctl: inlbuf1 pointer but 0 length\n");
-               return 1;
-       }
-       if (data->ioc_inlbuf2 && !data->ioc_inllen2) {
-               printk("OBD ioctl: inlbuf2 pointer but 0 length\n");
-               return 1;
-       }
-       if (data->ioc_pbuf1 && !data->ioc_plen1) {
-               printk("OBD ioctl: pbuf1 pointer but 0 length\n");
-               return 1;
-       }
-       if (data->ioc_pbuf2 && !data->ioc_plen2) {
-               printk("OBD ioctl: pbuf2 pointer but 0 length\n");
-               return 1;
-       }
-       if (obd_ioctl_packlen(data) != data->ioc_len ) {
-               printk("OBD ioctl: packlen exceeds ioc_len\n");
-               return 1;
-       }
-       if (data->ioc_inllen1 && 
-           data->ioc_bulk[data->ioc_inllen1 - 1] != '\0') { 
-               printk("OBD ioctl: inlbuf1 not 0 terminated\n");
-               return 1;
-       }
-       if (data->ioc_inllen2 && 
-           data->ioc_bulk[size_round(data->ioc_inllen1) + data->ioc_inllen2 - 1] != '\0') { 
-               printk("OBD ioctl: inlbuf2 not 0 terminated\n");
-               return 1;
-       }
-       return 0;
-}
-
-#ifndef __KERNEL__
-static inline int obd_ioctl_pack(struct obd_ioctl_data *data, char **pbuf, int max)
-{
-       char *ptr;
-       struct obd_ioctl_data *overlay;
-       data->ioc_len = obd_ioctl_packlen(data);
-       data->ioc_version = OBD_IOCTL_VERSION;
-
-       if (*pbuf && obd_ioctl_packlen(data) > max) 
-               return 1;
-       if (*pbuf == NULL) { 
-               *pbuf = malloc(data->ioc_len);
-       }
-       if (!*pbuf)
-               return 1;
-       overlay = (struct obd_ioctl_data *)*pbuf;
-       memcpy(*pbuf, data, sizeof(*data));
-
-       ptr = overlay->ioc_bulk;
-       if (data->ioc_inlbuf1)
-               LOGL(data->ioc_inlbuf1, data->ioc_inllen1, ptr);
-       if (data->ioc_inlbuf2)
-               LOGL(data->ioc_inlbuf2, data->ioc_inllen2, ptr);
-       if (obd_ioctl_is_invalid(overlay))
-               return 1;
-
-       return 0;
-}
-#else
-
-
-/* buffer MUST be at least the size of obd_ioctl_hdr */
-static inline int obd_ioctl_getdata(char *buf, char *end, void *arg)
-{
-       struct obd_ioctl_hdr *hdr;
-       struct obd_ioctl_data *data;
-       int err;
-       ENTRY;
-
-       hdr = (struct obd_ioctl_hdr *)buf;
-       data = (struct obd_ioctl_data *)buf;
-
-       err = copy_from_user(buf, (void *)arg, sizeof(*hdr));
-       if ( err ) {
-               EXIT;
-               return err;
-       }
-
-       if (hdr->ioc_version != OBD_IOCTL_VERSION) { 
-               printk("OBD: version mismatch kernel vs application\n");
-               return -EINVAL;
-       }
-
-       if (hdr->ioc_len + buf >= end) { 
-               printk("OBD: user buffer exceeds kernel buffer\n");
-               return -EINVAL;
-       }
-
-
-       if (hdr->ioc_len < sizeof(struct obd_ioctl_data)) { 
-               printk("OBD: user buffer too small for ioctl\n");
-               return -EINVAL;
-       }
-
-       err = copy_from_user(buf, (void *)arg, hdr->ioc_len);
-       if ( err ) {
-               EXIT;
-               return err;
-       }
-
-       if (obd_ioctl_is_invalid(data)) { 
-               printk("OBD: ioctl not correctly formatted\n");
-               return -EINVAL;
-       }
-
-       if (data->ioc_inllen1) { 
-               data->ioc_inlbuf1 = &data->ioc_bulk[0];
-       }
-
-       if (data->ioc_inllen2) { 
-               data->ioc_inlbuf2 = &data->ioc_bulk[0] + size_round(data->ioc_inllen1);
-       }
-
-       EXIT;
-       return 0;
-}
-#endif
-
-
-#define OBD_IOC_CREATE                 _IOR ('f',  3, long)
-#define OBD_IOC_SETUP                  _IOW ('f',  4, long)
-#define OBD_IOC_CLEANUP                _IO  ('f',  5      )
-#define OBD_IOC_DESTROY                _IOW ('f',  6, long)
-#define OBD_IOC_PREALLOCATE            _IOWR('f',  7, long)
-#define OBD_IOC_DEC_USE_COUNT          _IO  ('f',  8      )
-#define OBD_IOC_SETATTR                _IOW ('f',  9, long)
-#define OBD_IOC_GETATTR                _IOR ('f', 10, long)
-#define OBD_IOC_READ                   _IOWR('f', 11, long)
-#define OBD_IOC_WRITE                  _IOWR('f', 12, long)
-#define OBD_IOC_CONNECT                _IOR ('f', 13, long)
-#define OBD_IOC_DISCONNECT             _IOW ('f', 14, long)
-#define OBD_IOC_STATFS                 _IOWR('f', 15, long)
-#define OBD_IOC_SYNC                   _IOR ('f', 16, long)
-#define OBD_IOC_READ2                  _IOWR('f', 17, long)
-#define OBD_IOC_FORMAT                 _IOWR('f', 18, long)
-#define OBD_IOC_PARTITION              _IOWR('f', 19, long)
-#define OBD_IOC_ATTACH                 _IOWR('f', 20, long)
-#define OBD_IOC_DETACH                 _IOWR('f', 21, long)
-#define OBD_IOC_COPY                   _IOWR('f', 22, long)
-#define OBD_IOC_MIGR                   _IOWR('f', 23, long)
-#define OBD_IOC_PUNCH                  _IOWR('f', 24, long)
-#define OBD_IOC_DEVICE                 _IOWR('f', 25, long)
-#define OBD_IOC_MODULE_DEBUG           _IOWR('f', 26, long)
-
-#define OBD_IOC_DEC_FS_USE_COUNT       _IO  ('f', 32      )
-
-
-/* GENERAL THINGS */
-union ptl_rep { 
-        struct mds_rep *mds;
-        struct ost_rep *ost;
-};
-
-union ptl_req { 
-        struct mds_req *mds;
-        struct ost_req *ost;
-};
-
-
-#endif
diff --git a/lustre/include/linux/lustre_lib.h b/lustre/include/linux/lustre_lib.h
deleted file mode 100644 (file)
index 81e133e..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 2001 Cluster File Systems, Inc. <braam@clusterfs.com>
- *
- *   This file is part of Lustre, http://www.lustre.org.
- *
- *   Lustre is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   Lustre is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with Lustre; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Basic Lustre library routines. 
- *
- */
-
-#ifndef _LUSTRE_LIB_H
-#define _LUSTRE_LIB_H
-
-#include <asm/types.h>
-
-#ifndef __KERNEL__
-# include <string.h>
-#endif
-
-#ifdef __KERNEL__
-/* page.c */
-inline void lustre_put_page(struct page *page);
-struct page * lustre_get_page(struct inode *dir, unsigned long n);
-int lustre_prepare_page(unsigned from, unsigned to, struct page *page);
-int lustre_commit_page(struct page *page, unsigned from, unsigned to);
-#endif
-
-#include <linux/portals_lib.h>
-
-#endif /* _LUSTRE_LIB_H */
diff --git a/lustre/include/linux/lustre_light.h b/lustre/include/linux/lustre_light.h
deleted file mode 100644 (file)
index edb38fb..0000000
+++ /dev/null
@@ -1,178 +0,0 @@
-/* object based disk file system
- * 
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- * 
- * Copyright (C), 1999, Stelias Computing Inc
- *
- *
- */
-
-
-#ifndef _LL_H
-#define _LL_H
-#include <linux/obd_class.h>
-#include <linux/obdo.h>
-#include <linux/list.h>
-#include <linux/lustre_net.h>
-
-#define LL_SUPER_MAGIC 0x0BD00BD0;
-
-#define LL_INLINESZ      60
-struct ll_inode_info {
-        int              lli_flags;
-       __u64            lli_objid; 
-        char             lli_inline[LL_INLINESZ];
-};
-
-struct ll_sb_info {
-        struct list_head         ll_list;      /* list of supers */
-        struct obd_conn          ll_conn;
-        struct super_block      *ll_super;
-        ino_t                       ll_rootino;   /* number of root inode */
-        int                        ll_minor;     /* minor of /dev/obdX */
-        struct list_head         ll_inodes;    /* list of dirty inodes */
-        unsigned long          ll_cache_count;
-        struct semaphore         ll_list_mutex;
-       struct ptlrpc_client     ll_mds_client;
-       struct ptlrpc_client     ll_ost_client;
-};
-
-
-static inline struct ll_sb_info *ll_i2sbi(struct inode *inode)
-{
-        return (struct ll_sb_info *) (inode->i_sb->u.generic_sbp);
-}
-
-static inline struct ll_inode_info *ll_i2info(struct inode *inode)
-{
-        return (struct ll_inode_info *)&(inode->u.generic_ip);
-}
-
-static inline int ll_has_inline(struct inode *inode)
-{
-        return (ll_i2info(inode)->lli_flags & OBD_FL_INLINEDATA);
-}
-
-
-static inline struct obd_conn *ll_i2obdconn(struct inode *inode)
-{
-       return &(ll_i2sbi(inode))->ll_conn;
-}
-
-
-
-
-
-/* super.c */ 
-struct ll_pgrq {
-        struct list_head         rq_plist;      /* linked list of req's */
-        unsigned long            rq_jiffies;
-        struct page             *rq_page;       /* page to be written */
-};
-
-extern struct list_head ll_super_list;       /* list of all LL superblocks */
-
-
-
-/* dir.c */
-#define EXT2_DIR_PAD                    4
-#define EXT2_DIR_ROUND                  (EXT2_DIR_PAD - 1)
-#define EXT2_DIR_REC_LEN(name_len)      (((name_len) + 8 + EXT2_DIR_ROUND) & \
-                                         ~EXT2_DIR_ROUND)
-#define EXT2_NAME_LEN 255
-
-int ll_check_dir_entry (const char * function, struct inode * dir,
-                          struct ext2_dir_entry_2 * de, struct page * page,
-                          unsigned long offset);
-extern struct file_operations ll_dir_operations;
-extern struct inode_operations ll_dir_inode_operations;
-
-/* file.c */
-extern struct file_operations ll_file_operations;
-extern struct inode_operations ll_file_inode_operations;
-
-/* flush.c */
-void ll_dequeue_pages(struct inode *inode);
-int ll_flushd_init(void);
-int ll_flushd_cleanup(void);
-int ll_flush_reqs(struct list_head *inode_list, unsigned long check_time);
-int ll_flush_dirty_pages(unsigned long check_time);
-
-/* namei.c */
-/*
- * Structure of the super block
- */
-
-
-#define EXT2_SB(sb)     (&((sb)->u.ext2_sb))
-/*
- * Maximal count of links to a file
- */
-#define EXT2_LINK_MAX           32000
-/*
- * Ext2 directory file types.  Only the low 3 bits are used.  The
- * other bits are reserved for now.
- */
-#define EXT2_FT_UNKNOWN         0
-#define EXT2_FT_REG_FILE        1
-#define EXT2_FT_DIR             2
-#define EXT2_FT_CHRDEV          3
-#define EXT2_FT_BLKDEV          4
-#define EXT2_FT_FIFO            5
-#define EXT2_FT_SOCK            6
-#define EXT2_FT_SYMLINK         7
-
-#define EXT2_FT_MAX             8
-
-#define EXT2_BTREE_FL                   0x00001000 /* btree format dir */
-#define EXT2_RESERVED_FL                0x80000000 /* reserved for ext2 lib */
-#define EXT2_FEATURE_INCOMPAT_FILETYPE          0x0002
-#define EXT2_HAS_COMPAT_FEATURE(sb,mask)                        \
-        ( EXT2_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) )
-#define EXT2_HAS_INCOMPAT_FEATURE(sb,mask)                      \
-        ( EXT2_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask) )
-
-/* rw.c */
-int ll_do_writepage(struct page *, int sync);
-int ll_init_pgrqcache(void);
-void ll_cleanup_pgrqcache(void);
-inline void ll_pgrq_del(struct ll_pgrq *pgrq);
-int ll_readpage(struct file *file, struct page *page);
-int ll_prepare_write(struct file *file, struct page *page, unsigned from, unsigned to);
-int ll_commit_write(struct file *file, struct page *page, unsigned from, unsigned to);
-int ll_writepage(struct page *page);
-struct page *ll_getpage(struct inode *inode, unsigned long offset,
-                           int create, int locked);
-int ll_write_one_page(struct file *file, struct page *page,
-                         unsigned long offset, unsigned long bytes,
-                         const char * buf);
-int ll_do_vec_wr(struct inode **inodes, obd_count num_io, obd_count num_oa,
-                    struct obdo **obdos, obd_count *oa_bufs,
-                    struct page **pages, char **bufs, obd_size *counts,
-                    obd_off *offsets, obd_flag *flags);
-void ll_truncate(struct inode *inode);
-
-/* super.c */
-extern long ll_cache_count;
-extern long ll_mutex_start;
-
-/* symlink.c */
-extern struct inode_operations ll_fast_symlink_inode_operations;
-extern struct inode_operations ll_symlink_inode_operations;
-
-/* sysctl.c */
-void ll_sysctl_init(void);
-void ll_sysctl_clean(void);
-
-
-
-static inline struct list_head *ll_slist(struct inode *inode) 
-{
-        struct ll_sb_info *sbi = ll_i2sbi(inode);
-
-        return &sbi->ll_inodes;
-}
-
-#endif
-
diff --git a/lustre/include/linux/lustre_mds.h b/lustre/include/linux/lustre_mds.h
deleted file mode 100644 (file)
index df6daf5..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 2001 Cluster File Systems, Inc. <braam@clusterfs.com>
- *
- *   This file is part of Lustre, http://www.lustre.org.
- *
- *   Lustre is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   Lustre is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with Lustre; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * MDS data structures.  
- * See also lustre_idl.h for wire formats of requests.
- *
- */
-
-#ifndef _LUSTRE_MDS_H
-#define _LUSTRE_MDS_H
-
-
-#include <linux/obd_support.h>
-#include <linux/lustre_idl.h>
-#include <linux/lustre_net.h>
-
-static inline void l_dput(struct dentry *de) 
-{
-        if (!de || IS_ERR(de)) 
-                return; 
-        dput(de); 
-}
-
-struct mds_run_ctxt { 
-       struct vfsmount *pwdmnt;
-       struct dentry   *pwd;
-       mm_segment_t     fs;
-};
-
-#define MDS_STOPPING 1
-#define MDS_RUNNING 2
-#define MDS_STOPPED 4
-#define LUSTRE_MDS_NAME "mds"
-
-struct mds_obd {
-       char *mds_fstype;
-       struct task_struct *mds_thread;
-        __u32 mds_remote_nid;
-       wait_queue_head_t mds_waitq;
-       wait_queue_head_t mds_done_waitq;
-       struct timer_list *mds_timer;
-       int mds_interval; 
-       int mds_flags;
-       struct list_head mds_reqs;
-        struct super_block * mds_sb;
-       struct vfsmount *mds_vfsmnt;
-       struct mds_run_ctxt  mds_ctxt;
-       spinlock_t mds_lock;
-       __u64 mds_lastino;
-       struct file_operations *mds_fop; 
-       struct inode_operations *mds_iop;
-       struct address_space_operations *mds_aops;
-
-        struct ptlrpc_service *mds_service;
-};
-
-
-struct mds_update_record { 
-        __u32 ur_reclen;
-        __u32 ur_opcode;
-        struct ll_fid *ur_fid1;
-        struct ll_fid *ur_fid2;
-        int ur_namelen;
-        char *ur_name;
-        int ur_tgtlen;
-        char *ur_tgt;
-        struct iattr ur_iattr;
-        __u64 ur_id;
-        __u32 ur_mode;
-        __u32 ur_uid;
-        __u32 ur_gid;
-        __u64 ur_time;
-}; 
-
-/* mds/mds_pack.c */
-void *mds_req_tgt(struct mds_req *req);
-int mds_pack_req(char *name, int namelen, char *tgt, int tgtlen, struct ptlreq_hdr **hdr, union ptl_req *req, int *len, char **buf);
-int mds_unpack_req(char *buf, int len, struct ptlreq_hdr **hdr, union ptl_req *);
-int mds_pack_rep(char *name, int namelen, char *tgt, int tgtlen, struct ptlrep_hdr **hdr, union ptl_rep *rep, int *len, char **buf);
-int mds_unpack_rep(char *buf, int len, struct ptlrep_hdr **hdr, union ptl_rep *rep);
-
-/* mds/mds_reint.c  */
-int mds_reint_rec(struct mds_update_record *r, struct ptlrpc_request *req); 
-
-/* lib/mds_updates.c */
-int mds_update_unpack(char *buf, int len, struct mds_update_record *r); 
-
-void mds_setattr_pack(struct mds_rec_setattr *rec, struct inode *inode, struct iattr *iattr);
-void mds_create_pack(struct mds_rec_create *rec, struct inode *inode, const char *name, int namelen, __u32 mode, __u64 id, __u32 uid, __u32 gid, __u64 time, const char *tgt, int tgtlen);
-void mds_unlink_pack(struct mds_rec_unlink *rec, struct inode *inode, const char *name, int namelen);
-void mds_link_pack(struct mds_rec_link *rec, struct inode *inode, struct inode *dir, const char *name, int namelen);
-void mds_rename_pack(struct mds_rec_rename *rec, struct inode *srcdir, struct inode *tgtdir, const char *name, int namelen, const char *tgt, int tgtlen);
-
-/* mds/handler.c */
-struct dentry *mds_fid2dentry(struct mds_obd *mds, struct ll_fid *fid, struct vfsmount **mnt);
-
-/* llight/request.c */
-int mdc_getattr(struct ptlrpc_client *peer, ino_t ino, int type, int valid, 
-               struct mds_rep  **mds_reply, struct ptlrep_hdr **hdr);
-int mdc_setattr(struct ptlrpc_client *peer, struct inode *inode,
-                struct iattr *iattr, struct mds_rep  **mds_reply,
-                struct ptlrep_hdr **hdr);
-int mdc_readpage(struct ptlrpc_client *peer, ino_t ino, int type, __u64 offset,
-                 char *addr, struct mds_rep  **rep, struct ptlrep_hdr **hdr);
-int mdc_create(struct ptlrpc_client *peer, 
-              struct inode *dir, const char *name, int namelen, 
-              const char *tgt, int tgtlen, 
-              int mode, __u64 id, __u32 uid, __u32 gid, __u64 time, 
-               struct mds_rep **rep, struct ptlrep_hdr **hdr);
-int mdc_unlink(struct ptlrpc_client *peer, 
-              struct inode *dir, const char *name, int namelen, 
-               struct mds_rep **rep, struct ptlrep_hdr **hdr);
-int mdc_link(struct ptlrpc_client *peer, struct dentry *src, 
-              struct inode *dir, const char *name, int namelen, 
-               struct mds_rep **rep, struct ptlrep_hdr **hdr);
-int mdc_rename(struct ptlrpc_client *peer, struct inode *src, 
-              struct inode *tgt, const char *old, int oldlen, 
-              const char *new, int newlen, 
-              struct mds_rep **rep, struct ptlrep_hdr **hdr);
-int mdc_create_client(char *uuid, struct ptlrpc_client *cl);
-
-/* ioctls for trying requests */
-#define IOC_REQUEST_TYPE                   'f'
-#define IOC_REQUEST_MIN_NR                 30
-
-#define IOC_REQUEST_GETATTR            _IOWR('f', 30, long)
-#define IOC_REQUEST_READPAGE           _IOWR('f', 31, long)
-#define IOC_REQUEST_SETATTR            _IOWR('f', 32, long)
-#define IOC_REQUEST_CREATE             _IOWR('f', 33, long)
-#define IOC_REQUEST_MAX_NR               33
-
-#endif
diff --git a/lustre/include/linux/lustre_net.h b/lustre/include/linux/lustre_net.h
deleted file mode 100644 (file)
index 0efec74..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 2002 Cluster File Systems, Inc.
- *
- *   This file is part of Lustre, http://www.lustre.org.
- *
- *   Lustre is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   Lustre is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with Lustre; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#ifndef _LUSTRE_NET_H
-#define _LUSTRE_NET_H
-
-#include <linux/kp30.h>
-#include <portals/p30.h>
-#include <linux/lustre_idl.h>
-
-/* FOO_REQUEST_PORTAL receives requests for the FOO subsystem.
- * FOO_REPLY_PORTAL receives replies _from_ the FOO subsystem. */
-#define OSC_REQUEST_PORTAL 1
-#define OSC_REPLY_PORTAL   2
-#define MDS_REQUEST_PORTAL 3
-#define MDS_REPLY_PORTAL   4
-#define OST_REQUEST_PORTAL 5
-#define OST_REPLY_PORTAL   6
-#define MDC_BULK_PORTAL    7
-#define MDS_BULK_PORTAL    8
-#define OSC_BULK_PORTAL    9
-#define OST_BULK_PORTAL    10
-
-/* default rpc ring length */
-#define RPC_RING_LENGTH    2
-
-/* generic wrappable next */
-#define NEXT_INDEX(index, max) (((index+1) >= max) ? 0 : (index+1))
-
-
-struct ptlrpc_service {
-        char *srv_buf[RPC_RING_LENGTH];
-        __u32 srv_buf_size;
-        __u32 srv_me_active;
-       __u32 srv_me_tail;
-       __u32 srv_md_active;
-        __u32 srv_ring_length;
-        __u32 srv_portal;
-        __u32 srv_ref_count[RPC_RING_LENGTH];
-
-        struct lustre_peer srv_self;
-
-        /* FIXME: perhaps a list of EQs, if multiple NIs are used? */
-        ptl_handle_eq_t srv_eq_h;
-
-        ptl_handle_me_t srv_me_h[RPC_RING_LENGTH];
-        ptl_process_id_t srv_id;
-        ptl_md_t srv_md[RPC_RING_LENGTH];
-        ptl_handle_md_t srv_md_h[RPC_RING_LENGTH];
-        wait_queue_head_t *srv_wait_queue;
-        int (*srv_req_unpack)(char *buf, int len, struct ptlreq_hdr **, 
-                          union ptl_req *);
-        int (*srv_rep_pack)(char *buf1, int len1, char *buf2, int len2,
-                        struct ptlrep_hdr **, union ptl_rep*, 
-                        int *replen, char **repbuf); 
-};
-
-struct ptlrpc_request { 
-        int rq_type; /* one of PTLRPC_REQUEST, PTLRPC_REPLY, PTLRPC_BULK */
-       struct list_head rq_list;
-       struct mds_obd *rq_obd;
-       struct ost_obd *rq_ost;
-       int rq_status;
-        __u32 rq_xid;
-
-       char *rq_reqbuf;
-       int rq_reqlen;
-       struct ptlreq_hdr *rq_reqhdr;
-       union ptl_req rq_req;
-
-       char *rq_repbuf;
-       int rq_replen;
-       struct ptlrep_hdr *rq_rephdr;
-       union ptl_rep rq_rep;
-
-        char *rq_bulkbuf;
-        int rq_bulklen;
-        int (*rq_bulk_cb)(struct ptlrpc_request *, void *);
-
-        void *rq_reply_handle;
-       wait_queue_head_t rq_wait_for_rep;
-       wait_queue_head_t rq_wait_for_bulk;
-
-        ptl_md_t rq_reply_md;
-        ptl_handle_md_t rq_reply_md_h;
-        ptl_handle_me_t rq_reply_me_h;
-
-        ptl_md_t rq_req_md;
-        ptl_md_t rq_bulk_md;
-        ptl_handle_md_t rq_bulk_md_h;
-        ptl_handle_me_t rq_bulk_me_h;
-        __u32 rq_reply_portal;
-        __u32 rq_req_portal;
-        __u32 rq_bulk_portal;
-
-        struct lustre_peer rq_peer;
-};
-
-struct ptlrpc_client {
-        struct lustre_peer cli_server;
-        __u32 cli_request_portal;
-        __u32 cli_reply_portal;
-        __u32 cli_xid;
-        int (*cli_rep_unpack)(char *buf, int len, struct ptlrep_hdr **, 
-                          union ptl_rep *);
-        int (*cli_req_pack)(char *buf1, int len1, char *buf2, int len2,
-                        struct ptlreq_hdr **, union ptl_req*, 
-                        int *reqlen, char **reqbuf); 
-        int (*cli_enqueue)(struct ptlrpc_request *req);
-};
-
-/* rpc/rpc.c */
-#define PTLRPC_REQUEST 1
-#define PTLRPC_REPLY   2
-#define PTLRPC_BULK    3
-
-int ptl_send_buf(struct ptlrpc_request *request, struct lustre_peer *peer,
-                 int portal);
-int ptl_send_rpc(struct ptlrpc_request *request, struct lustre_peer *peer);
-int ptl_received_rpc(struct ptlrpc_service *service);
-int rpc_register_service(struct ptlrpc_service *service, char *uuid);
-int rpc_unregister_service(struct ptlrpc_service *service);
-int ptlrpc_queue_wait(struct ptlrpc_request *req, 
-                      struct ptlrpc_client *cl);
-struct ptlrpc_request *ptlrpc_prep_req(struct ptlrpc_client *cl, 
-                                       int opcode, int namelen, char *name,
-                                       int tgtlen, char *tgt);
-void ptlrpc_free_req(struct ptlrpc_request *request);
-
-
-/* FIXME */
-#if 1
-# define LUSTRE_NAL "ksocknal"
-#else
-# define LUSTRE_NAL "kqswnal"
-#endif
-
-#endif
diff --git a/lustre/include/linux/lustre_req.h b/lustre/include/linux/lustre_req.h
deleted file mode 100644 (file)
index d726766..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 2001 Cluster File Systems, Inc. <braam@clusterfs.com>
- *
- *   This file is part of Lustre, http://www.lustre.org.
- *
- *   Lustre is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   Lustre is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with Lustre; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *   Definitions related to request handling
- */
-
-#ifndef __LUSTRE_REQ_H__
-#define __LUSTRE_REQ_H__
-
-struct lustre_connection { 
-       
-
-};
-
-#endif
diff --git a/lustre/include/linux/obd.h b/lustre/include/linux/obd.h
deleted file mode 100644 (file)
index 674a19a..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef __OBD_H
-#define __OBD_H
-/*
- * Copyright (C) 2001  Cluster File Systems, Inc.
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- */
-
-struct obd_conn_info {
-        unsigned int conn_id;     /* handle */
-};
-
-struct obd_type {
-        struct list_head typ_chain;
-        struct obd_ops *typ_ops;
-        char *typ_name;
-        int  typ_refcnt;
-};
-
-#define OBD_MAGIC       0xffff0000
-#define OBD_MAGIC_MASK  0xffff0000
-
-
-
-#endif
diff --git a/lustre/include/linux/obd_class.h b/lustre/include/linux/obd_class.h
deleted file mode 100644 (file)
index 7aa1e69..0000000
+++ /dev/null
@@ -1,691 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 2001, 2002 Cluster File Systems, Inc.
- *
- *   This file is part of Lustre, http://www.lustre.org.
- *
- *   Lustre is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   Lustre is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with Lustre; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#ifndef __LINUX_CLASS_OBD_H
-#define __LINUX_CLASS_OBD_H
-
-#ifndef __KERNEL__
-#include <stdint.h>
-#define __KERNEL__
-#include <linux/list.h>
-#undef __KERNEL__
-#else 
-#include <asm/segment.h>
-#include <asm/uaccess.h>
-#include <linux/types.h>
-#include <linux/fs.h>
-#include <linux/time.h>
-
-#include <linux/lustre_lib.h>
-#include <linux/lustre_idl.h>
-#include <linux/obd.h>
-#endif
-
-/*
- *  ======== OBD Device Declarations ===========
- */
-#define MAX_OBD_DEVICES 8
-#define MAX_MULTI       16
-extern struct obd_device obd_dev[MAX_OBD_DEVICES];
-
-#define OBD_ATTACHED 0x1
-#define OBD_SET_UP   0x2
-
-struct obd_conn {
-        struct obd_device *oc_dev;
-        uint32_t oc_id;
-};
-
-typedef struct {
-       uint32_t len;
-       char *   name;
-        struct dentry *dentry;   /* file system obd device names */
-        __u8           _uuid[16]; /* uuid obd device names */
-} obd_devicename;
-
-#include <linux/obd_ext2.h>
-#include <linux/obd_filter.h>
-#include <linux/lustre_mds.h>
-#include <linux/obd_snap.h>
-#include <linux/obd_trace.h>
-/* #include <linux/obd_fc.h> */
-#include <linux/obd_raid1.h>
-#include <linux/obd_ost.h>
-#include <linux/obd_osc.h>
-
-#ifdef __KERNEL__
-/* corresponds to one of the obdx */
-struct obd_device {
-        struct obd_type *obd_type;
-        int obd_minor;
-        int obd_flags;
-        int obd_refcnt; 
-        obd_devicename obd_fsname; 
-       struct proc_dir_entry *obd_proc_entry;
-        int obd_multi_count;
-        struct obd_conn obd_multi_conn[MAX_MULTI];
-        unsigned int obd_gen_last_id;
-        unsigned long obd_gen_prealloc_quota;
-        struct list_head obd_gen_clients;
-        union {
-                struct ext2_obd ext2;
-                struct filter_obd filter;
-                struct mds_obd mds;
-                struct raid1_obd raid1;
-                struct snap_obd snap;
-               struct trace_obd trace;
-                struct ost_obd ost;
-                struct osc_obd osc;
-        } u;
-};
-
-extern struct proc_dir_entry *proc_lustre_register_obd_device(struct obd_device *obd);
-extern void proc_lustre_release_obd_device(struct obd_device *obd);
-extern void proc_lustre_remove_obd_entry(const char* name, struct obd_device *obd);
-
-/*
- *  ======== OBD Operations Declarations ===========
- */
-
-#define OBD_BRW_READ    1
-#define OBD_BRW_WRITE   2
-#define OBD_BRW_RWMASK  OBD_BRW_READ | OBD_BRW_WRITE
-#define OBD_BRW_CREATE  4
-
-struct obd_ops {
-        int (*o_iocontrol)(int cmd, struct obd_conn *, int len, void *karg,
-                           void *uarg);
-        int (*o_get_info)(struct obd_conn *, obd_count keylen, void *key,
-                          obd_count *vallen, void **val);
-        int (*o_set_info)(struct obd_conn *, obd_count keylen, void *key,
-                          obd_count vallen, void *val);
-        int (*o_attach)(struct obd_device *dev, obd_count len, void *data);
-        int (*o_detach)(struct obd_device *dev);
-        int (*o_setup) (struct obd_device *dev, obd_count len, void *data);
-        int (*o_cleanup)(struct obd_device *dev);
-        int (*o_connect)(struct obd_conn *conn);
-        int (*o_disconnect)(struct obd_conn *conn);
-        int (*o_statfs)(struct obd_conn *conn, struct statfs *statfs);
-        int (*o_preallocate)(struct obd_conn *, obd_count *req, obd_id *ids);
-        int (*o_create)(struct obd_conn *conn,  struct obdo *oa);
-        int (*o_destroy)(struct obd_conn *conn, struct obdo *oa);
-        int (*o_setattr)(struct obd_conn *conn, struct obdo *oa);
-        int (*o_getattr)(struct obd_conn *conn, struct obdo *oa);
-        int (*o_read)(struct obd_conn *conn, struct obdo *oa, char *buf,
-                      obd_size *count, obd_off offset);
-        int (*o_write)(struct obd_conn *conn, struct obdo *oa, char *buf,
-                       obd_size *count, obd_off offset);
-        int (*o_brw)(int rw, struct obd_conn *conn, obd_count num_oa,
-                     struct obdo **oa, obd_count *oa_bufs, struct page **buf,
-                     obd_size *count, obd_off *offset, obd_flag *flags);
-        int (*o_punch)(struct obd_conn *conn, struct obdo *tgt, obd_size count,
-                       obd_off offset);
-        int (*o_sync)(struct obd_conn *conn, struct obdo *tgt, obd_size count,
-                      obd_off offset);
-        int (*o_migrate)(struct obd_conn *conn, struct obdo *dst,
-                         struct obdo *src, obd_size count, obd_off offset);
-        int (*o_copy)(struct obd_conn *dstconn, struct obdo *dst,
-                      struct obd_conn *srconn, struct obdo *src,
-                      obd_size count, obd_off offset);
-        int (*o_iterate)(struct obd_conn *conn, int (*)(obd_id, obd_gr, void *),
-                         obd_id *startid, obd_gr group, void *data);
-       int (*o_preprw)(int cmd, struct obd_conn *conn, 
-                       int objcount, struct obd_ioobj *obj, 
-                       int niocount, struct niobuf *nb, 
-                       struct niobuf *res);
-       int (*o_commitrw)(int cmd, struct obd_conn *conn, 
-                         int objcount, struct obd_ioobj *obj, 
-                         int niocount, struct niobuf *res);
-};
-
-struct obd_request {
-       struct obdo *oa;
-       struct obd_conn *conn;
-       __u32 plen1;
-       char *pbuf1;
-};
-
-static inline int obd_check_conn(struct obd_conn *conn) 
-{
-       struct obd_device *obd;
-       if (!conn) {
-               printk("obd_check_conn: NULL conn\n");
-               return -ENOTCONN;
-       }
-       obd = conn->oc_dev;
-       if (!obd) {
-               printk("obd_check_conn: NULL obd\n");
-               return -ENODEV;
-       }
-
-       if (!obd->obd_flags & OBD_ATTACHED ) {
-               printk("obd_check_conn: obd %d not attached\n", obd->obd_minor); 
-               return -ENODEV;
-       }
-
-       if (!obd->obd_flags & OBD_SET_UP) {
-               printk("obd_check_conn: obd %d not setup\n", obd->obd_minor); 
-               return -ENODEV;
-       }
-
-       if (!obd->obd_type) {
-               printk("obd_check_conn: obd %d not typed\n", obd->obd_minor);
-               return -ENODEV;
-       }
-
-       if (!obd->obd_type->typ_ops) {
-               printk("obd_check_conn: obd %d no operations\n", obd->obd_minor);
-               return -EOPNOTSUPP;
-       }
-       return 0;
-}
-
-#define OBT(dev)        dev->obd_type->typ_ops
-#define OBP(dev,op)     dev->obd_type->typ_ops->o_ ## op
-
-#define OBD_CHECK_OP(conn,op)                                   \
-do {                                                            \
-        int rc = obd_check_conn(conn);                          \
-        if (rc) {                                               \
-               printk("obd: error in operation: " #op "\n");   \
-               return rc;                                      \
-       }                                                       \
-        if (!OBP(conn->oc_dev,op)) {                            \
-               printk("obd_" #op ": dev %d no operation\n",    \
-                      conn->oc_dev->obd_minor);                \
-               return -EOPNOTSUPP;                             \
-       }                                                       \
-} while (0)
-
-static inline int obd_get_info(struct obd_conn *conn, obd_count keylen, void *key,
-                          obd_count *vallen, void **val)
-{
-       int rc;
-       OBD_CHECK_OP(conn,get_info);
-       
-       rc = OBP(conn->oc_dev, get_info)(conn, keylen, key, vallen, val);
-       EXIT;
-       return rc;
-}
-
-static inline int obd_set_info(struct obd_conn *conn, obd_count keylen, void *key,
-                          obd_count vallen, void *val)
-{
-       int rc;
-       OBD_CHECK_OP(conn,set_info);
-       
-       rc = OBP(conn->oc_dev, set_info)(conn, keylen, key, vallen, val);
-       EXIT;
-       return rc;
-}
-
-static inline int obd_cleanup(struct obd_device *obd)
-{
-       struct obd_conn conn;
-       int rc;
-       conn.oc_dev = obd;
-
-       OBD_CHECK_OP((&conn),cleanup);
-       
-       rc = OBP(conn.oc_dev, cleanup)(obd);
-       EXIT;
-       return rc;
-}
-
-static inline int obd_create(struct obd_conn *conn, struct obdo *obdo) 
-{
-       int rc;
-       OBD_CHECK_OP(conn,create);
-       
-       rc = OBP(conn->oc_dev, create)(conn, obdo);
-       EXIT;
-       return rc;
-}
-
-static inline int obd_destroy(struct obd_conn *conn, struct obdo *obdo) 
-{
-       int rc;
-       OBD_CHECK_OP(conn,destroy);
-       
-       rc = OBP(conn->oc_dev, destroy)(conn, obdo);
-       EXIT;
-       return rc;
-}
-
-static inline int obd_getattr(struct obd_conn *conn, struct obdo *obdo) 
-{
-       int rc;
-       OBD_CHECK_OP(conn,getattr);
-       
-       rc = OBP(conn->oc_dev, getattr)(conn, obdo);
-       EXIT;
-       return rc;
-}
-
-static inline int obd_setattr(struct obd_conn *conn, struct obdo *obdo) 
-{
-       int rc;
-       OBD_CHECK_OP(conn,setattr);
-       
-       rc = OBP(conn->oc_dev, setattr)(conn, obdo);
-       EXIT;
-       return rc;
-}
-
-static inline int obd_connect(struct obd_conn *conn)
-{
-       int rc;
-       OBD_CHECK_OP(conn,connect);
-       
-       rc = OBP(conn->oc_dev, connect)(conn);
-       EXIT;
-       return rc;
-}
-
-static inline int obd_disconnect(struct obd_conn *conn)
-{
-       int rc;
-       OBD_CHECK_OP(conn,disconnect);
-       
-       rc = OBP(conn->oc_dev, disconnect)(conn);
-       EXIT;
-       return rc;
-}
-
-static inline int obd_statfs(struct obd_conn *conn, struct statfs *buf)
-{
-       int rc;
-       OBD_CHECK_OP(conn,statfs);
-       
-       rc = OBP(conn->oc_dev, statfs)(conn, buf);
-       EXIT;
-       return rc;
-}
-
-static inline int obd_punch(struct obd_conn *conn, struct obdo *tgt, obd_size count, obd_off offset)
-{
-       int rc;
-       OBD_CHECK_OP(conn,punch);
-       
-       rc = OBP(conn->oc_dev, punch)(conn, tgt, count, offset);
-       EXIT;
-       return rc;
-}
-
-static inline int obd_brw(int rw, struct obd_conn *conn, obd_count num_oa,
-                     struct obdo **oa, obd_count *oa_bufs, struct page **buf,
-                     obd_size *count, obd_off *offset, obd_flag *flags)
-{
-       int rc;
-       OBD_CHECK_OP(conn,brw);
-       
-       rc = OBP(conn->oc_dev, brw)(rw, conn, num_oa, oa, oa_bufs, buf,
-                                   count, offset, flags);
-       EXIT;
-       return rc;
-}
-
-#endif 
-
-/*
- *  ======== OBD Metadata Support  ===========
- */
-
-extern int obd_init_obdo_cache(void);
-extern void obd_cleanup_obdo_cache(void);
-
-
-static inline int obdo_has_inline(struct obdo *obdo)
-{
-        return (obdo->o_valid & OBD_MD_FLINLINE &&
-                obdo->o_obdflags & OBD_FL_INLINEDATA);
-};
-
-static inline int obdo_has_obdmd(struct obdo *obdo)
-{
-        return (obdo->o_valid & OBD_MD_FLOBDMD &&
-                obdo->o_obdflags & OBD_FL_OBDMDEXISTS);
-};
-
-#ifdef __KERNEL__
-/* support routines */
-extern kmem_cache_t *obdo_cachep;
-
-static __inline__ struct obdo *obdo_alloc(void)
-{
-        struct obdo *oa = NULL;
-
-        oa = kmem_cache_alloc(obdo_cachep, SLAB_KERNEL);
-        memset(oa, 0, sizeof (*oa));
-
-        return oa;
-}
-
-static __inline__ void obdo_free(struct obdo *oa)
-{
-        if ( !oa ) 
-                return;
-        kmem_cache_free(obdo_cachep, oa);
-}
-
-static __inline__ struct obdo *obdo_fromid(struct obd_conn *conn, obd_id id,
-                                          obd_mode mode, obd_flag valid)
-{
-        struct obdo *oa;
-        int err;
-
-        ENTRY;
-        oa = obdo_alloc();
-        if ( !oa ) {
-                EXIT;
-                return ERR_PTR(-ENOMEM);
-        }
-
-        oa->o_id = id;
-       oa->o_mode = mode;
-        oa->o_valid = valid;
-        if ((err = OBP(conn->oc_dev, getattr)(conn, oa))) {
-                obdo_free(oa);
-                EXIT;
-                return ERR_PTR(err);
-        }
-        EXIT;
-        return oa;
-}
-
-static inline void obdo_from_iattr(struct obdo *oa, struct iattr *attr)
-{
-        unsigned int ia_valid = attr->ia_valid;
-
-        if (ia_valid & ATTR_ATIME) {
-                oa->o_atime = attr->ia_atime;
-                oa->o_valid |= OBD_MD_FLATIME;
-        }
-        if (ia_valid & ATTR_MTIME) {
-                oa->o_mtime = attr->ia_mtime;
-                oa->o_valid |= OBD_MD_FLMTIME;
-        }
-        if (ia_valid & ATTR_CTIME) {
-                oa->o_ctime = attr->ia_ctime;
-                oa->o_valid |= OBD_MD_FLCTIME;
-        }
-        if (ia_valid & ATTR_SIZE) {
-                oa->o_size = attr->ia_size;
-                oa->o_valid |= OBD_MD_FLSIZE;
-        }
-        if (ia_valid & ATTR_MODE) {
-                oa->o_mode = attr->ia_mode;
-                oa->o_valid |= OBD_MD_FLMODE;
-                if (!in_group_p(oa->o_gid) && !capable(CAP_FSETID))
-                        oa->o_mode &= ~S_ISGID;
-        }
-        if (ia_valid & ATTR_UID)
-        {
-                oa->o_uid = attr->ia_uid;
-                oa->o_valid |= OBD_MD_FLUID;
-        }
-        if (ia_valid & ATTR_GID) {
-                oa->o_gid = attr->ia_gid;
-                oa->o_valid |= OBD_MD_FLGID;
-        }
-}
-
-
-static inline void iattr_from_obdo(struct iattr *attr, struct obdo *oa)
-{
-        unsigned int ia_valid = oa->o_valid;
-       
-       memset(attr, 0, sizeof(*attr));
-        if (ia_valid & OBD_MD_FLATIME) {
-                attr->ia_atime = oa->o_atime;
-                attr->ia_valid |= ATTR_ATIME;
-        }
-        if (ia_valid & OBD_MD_FLMTIME) {
-                attr->ia_mtime = oa->o_mtime;
-                attr->ia_valid |= ATTR_MTIME;
-        }
-        if (ia_valid & OBD_MD_FLCTIME) {
-                attr->ia_ctime = oa->o_ctime;
-                attr->ia_valid |= ATTR_CTIME;
-        }
-        if (ia_valid & OBD_MD_FLSIZE) {
-                attr->ia_size = oa->o_size;
-                attr->ia_valid |= ATTR_SIZE;
-        }
-        if (ia_valid & OBD_MD_FLMODE) {
-                attr->ia_mode = oa->o_mode;
-                attr->ia_valid |= ATTR_MODE;
-                if (!in_group_p(oa->o_gid) && !capable(CAP_FSETID))
-                        attr->ia_mode &= ~S_ISGID;
-        }
-        if (ia_valid & OBD_MD_FLUID)
-        {
-                attr->ia_uid = oa->o_uid;
-                attr->ia_valid |= ATTR_UID;
-        }
-        if (ia_valid & OBD_MD_FLGID) {
-                attr->ia_gid = oa->o_gid;
-                attr->ia_valid |= ATTR_GID;
-        }
-}
-
-
-/* WARNING: the file systems must take care not to tinker with
-   attributes they don't manage (such as blocks). */
-
-static __inline__ void obdo_from_inode(struct obdo *dst, struct inode *src)
-{
-        if ( dst->o_valid & OBD_MD_FLID )
-                dst->o_id = src->i_ino;
-        if ( dst->o_valid & OBD_MD_FLATIME )
-                dst->o_atime = src->i_atime;
-        if ( dst->o_valid & OBD_MD_FLMTIME )
-                dst->o_mtime = src->i_mtime;
-        if ( dst->o_valid & OBD_MD_FLCTIME )
-                dst->o_ctime = src->i_ctime;
-        if ( dst->o_valid & OBD_MD_FLSIZE )
-                dst->o_size = src->i_size;
-        if ( dst->o_valid & OBD_MD_FLBLOCKS )   /* allocation of space */
-                dst->o_blocks = src->i_blocks;
-        if ( dst->o_valid & OBD_MD_FLBLKSZ )
-                dst->o_blksize = src->i_blksize;
-        if ( dst->o_valid & OBD_MD_FLMODE )
-                dst->o_mode = src->i_mode;
-        if ( dst->o_valid & OBD_MD_FLUID )
-                dst->o_uid = src->i_uid;
-        if ( dst->o_valid & OBD_MD_FLGID )
-                dst->o_gid = src->i_gid;
-        if ( dst->o_valid & OBD_MD_FLFLAGS )
-                dst->o_flags = src->i_flags;
-        if ( dst->o_valid & OBD_MD_FLNLINK )
-                dst->o_nlink = src->i_nlink;
-        if ( dst->o_valid & OBD_MD_FLGENER ) 
-                dst->o_generation = src->i_generation;
-}
-
-static __inline__ void obdo_to_inode(struct inode *dst, struct obdo *src)
-{
-
-        if ( src->o_valid & OBD_MD_FLID )
-                dst->i_ino = src->o_id;
-        if ( src->o_valid & OBD_MD_FLATIME ) 
-                dst->i_atime = src->o_atime;
-        if ( src->o_valid & OBD_MD_FLMTIME ) 
-                dst->i_mtime = src->o_mtime;
-        if ( src->o_valid & OBD_MD_FLCTIME ) 
-                dst->i_ctime = src->o_ctime;
-        if ( src->o_valid & OBD_MD_FLSIZE ) 
-                dst->i_size = src->o_size;
-        if ( src->o_valid & OBD_MD_FLBLOCKS ) /* allocation of space */
-                dst->i_blocks = src->o_blocks;
-        if ( src->o_valid & OBD_MD_FLBLKSZ )
-                dst->i_blksize = src->o_blksize;
-        if ( src->o_valid & OBD_MD_FLMODE ) 
-                dst->i_mode = src->o_mode;
-        if ( src->o_valid & OBD_MD_FLUID ) 
-                dst->i_uid = src->o_uid;
-        if ( src->o_valid & OBD_MD_FLGID ) 
-                dst->i_gid = src->o_gid;
-        if ( src->o_valid & OBD_MD_FLFLAGS ) 
-                dst->i_flags = src->o_flags;
-        if ( src->o_valid & OBD_MD_FLNLINK )
-                dst->i_nlink = src->o_nlink;
-        if ( src->o_valid & OBD_MD_FLGENER )
-                dst->i_generation = src->o_generation;
-}
-
-#endif 
-
-static __inline__ void obdo_cpy_md(struct obdo *dst, struct obdo *src)
-{
-#ifdef __KERNEL__
-        CDEBUG(D_INODE, "src obdo %Ld valid 0x%x, dst obdo %Ld\n",
-               src->o_id, src->o_valid, dst->o_id);
-#endif
-        if ( src->o_valid & OBD_MD_FLATIME ) 
-                dst->o_atime = src->o_atime;
-        if ( src->o_valid & OBD_MD_FLMTIME ) 
-                dst->o_mtime = src->o_mtime;
-        if ( src->o_valid & OBD_MD_FLCTIME ) 
-                dst->o_ctime = src->o_ctime;
-        if ( src->o_valid & OBD_MD_FLSIZE ) 
-                dst->o_size = src->o_size;
-        if ( src->o_valid & OBD_MD_FLBLOCKS ) /* allocation of space */
-                dst->o_blocks = src->o_blocks;
-        if ( src->o_valid & OBD_MD_FLBLKSZ )
-                dst->o_blksize = src->o_blksize;
-        if ( src->o_valid & OBD_MD_FLMODE ) 
-                dst->o_mode = src->o_mode;
-        if ( src->o_valid & OBD_MD_FLUID ) 
-                dst->o_uid = src->o_uid;
-        if ( src->o_valid & OBD_MD_FLGID ) 
-                dst->o_gid = src->o_gid;
-        if ( src->o_valid & OBD_MD_FLFLAGS ) 
-                dst->o_flags = src->o_flags;
-        /*
-        if ( src->o_valid & OBD_MD_FLOBDFLG ) 
-                dst->o_obdflags = src->o_obdflags;
-        */
-        if ( src->o_valid & OBD_MD_FLNLINK ) 
-                dst->o_nlink = src->o_nlink;
-        if ( src->o_valid & OBD_MD_FLGENER ) 
-                dst->o_generation = src->o_generation;
-        if ( src->o_valid & OBD_MD_FLINLINE &&
-             src->o_obdflags & OBD_FL_INLINEDATA) {
-                memcpy(dst->o_inline, src->o_inline, sizeof(src->o_inline));
-                dst->o_obdflags |= OBD_FL_INLINEDATA;
-        }
-        if ( src->o_valid & OBD_MD_FLOBDMD &&
-             src->o_obdflags & OBD_FL_OBDMDEXISTS) {
-                memcpy(dst->o_obdmd, src->o_obdmd, sizeof(src->o_obdmd));
-                dst->o_obdflags |= OBD_FL_OBDMDEXISTS;
-        }
-
-        dst->o_valid |= src->o_valid;
-}
-
-
-/* returns FALSE if comparison (by flags) is same, TRUE if changed */
-static __inline__ int obdo_cmp_md(struct obdo *dst, struct obdo *src,
-                                  obd_flag compare)
-{
-        int res = 0;
-
-        if ( compare & OBD_MD_FLATIME )
-                res = (res || (dst->o_atime != src->o_atime));
-        if ( compare & OBD_MD_FLMTIME )
-                res = (res || (dst->o_mtime != src->o_mtime));
-        if ( compare & OBD_MD_FLCTIME )
-                res = (res || (dst->o_ctime != src->o_ctime));
-        if ( compare & OBD_MD_FLSIZE )
-                res = (res || (dst->o_size != src->o_size));
-        if ( compare & OBD_MD_FLBLOCKS ) /* allocation of space */
-                res = (res || (dst->o_blocks != src->o_blocks));
-        if ( compare & OBD_MD_FLBLKSZ )
-                res = (res || (dst->o_blksize != src->o_blksize));
-        if ( compare & OBD_MD_FLMODE )
-                res = (res || (dst->o_mode != src->o_mode));
-        if ( compare & OBD_MD_FLUID )
-                res = (res || (dst->o_uid != src->o_uid));
-        if ( compare & OBD_MD_FLGID )
-                res = (res || (dst->o_gid != src->o_gid));
-        if ( compare & OBD_MD_FLFLAGS ) 
-                res = (res || (dst->o_flags != src->o_flags));
-        if ( compare & OBD_MD_FLNLINK )
-                res = (res || (dst->o_nlink != src->o_nlink));
-        if ( compare & OBD_MD_FLGENER )
-                res = (res || (dst->o_generation != src->o_generation));
-        /* XXX Don't know if thses should be included here - wasn't previously
-        if ( compare & OBD_MD_FLINLINE )
-                res = (res || memcmp(dst->o_inline, src->o_inline));
-        if ( compare & OBD_MD_FLOBDMD )
-                res = (res || memcmp(dst->o_obdmd, src->o_obdmd));
-        */
-        return res;
-}
-
-
-#ifdef __KERNEL__
-int obd_register_type(struct obd_ops *ops, char *nm);
-int obd_unregister_type(char *nm);
-
-struct obd_client {
-        struct list_head cli_chain;
-        struct obd_device *cli_obd;
-        unsigned int cli_id;
-        unsigned long cli_prealloc_quota;
-        struct list_head cli_prealloc_inodes;
-};
-
-
-struct obd_prealloc_inode {
-        struct list_head obd_prealloc_chain;
-        unsigned long inode;
-};
-
-/* generic operations shared by various OBD types */
-int gen_multi_setup(struct obd_device *obddev, uint32_t len, void *data);
-int gen_multi_cleanup(struct obd_device *obddev);
-int gen_multi_attach(struct obd_device *obddev, uint32_t len, void *data);
-int gen_multi_detach(struct obd_device *obddev);
-int gen_connect (struct obd_conn *conn);
-int gen_disconnect(struct obd_conn *conn);
-struct obd_client *gen_client(const struct obd_conn *);
-int gen_cleanup(struct obd_device *obddev);
-int gen_copy_data(struct obd_conn *dst_conn, struct obdo *dst,
-                  struct obd_conn *src_conn, struct obdo *src,
-                  obd_size count, obd_off offset);
-
-#endif
-
-/* sysctl.c */
-extern void obd_sysctl_init (void);
-extern void obd_sysctl_clean (void);
-
-#define CHKCONN(conn)   do { if (!gen_client(conn)) {\
-                printk("%s %d invalid client %u\n", __FILE__, __LINE__, \
-                       conn->oc_id);\
-                return -EINVAL; }} while (0) 
-
-
-
-#endif /* __LINUX_CLASS_OBD_H */
diff --git a/lustre/include/linux/obd_ext2.h b/lustre/include/linux/obd_ext2.h
deleted file mode 100644 (file)
index 1f15d0f..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef _OBD_EXT2
-#define _OBD_EXT2
-/*
- * Copyright (C) 2001  Cluster File Systems, Inc.
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- */
-
-#define OBD_EXT2_RUNIT           _IOWR('f', 61, long)
-
-#ifndef OBD_EXT2_DEVICENAME
-#define OBD_EXT2_DEVICENAME "obdext2"
-#endif
-
-struct ext2_obd {
-        struct super_block * e2_sb;
-       struct vfsmount *e2_vfsmnt;
-};
-
-
-/* development definitions */
-extern struct obdfs_sb_info *obd_sbi;
-extern struct file_operations *obd_fso;
-
-/* ext2_obd.c */
-extern struct obd_ops ext2_obd_ops;
-
-
-#include <linux/ext2_fs.h>
-
-/* super.c */
-#ifdef EXT2_OBD_DEBUG
-#  undef ext2_debug
-#  define ext2_debug(format, a...) CDEBUG(D_EXT2, format, ## a)
-#  define ext2_error ext2_warning
-#  define ext2_panic ext2_warning
-#  define ext2_warning(sb, func, format, a...) CDEBUG(D_WARNING, format, ## a)
-#else
-#  undef ext2_debug
-#  define ext2_debug(format, a...) {}
-#  define ext2_error(sb, func, format, a...) printk(KERN_ERR "%s: " format, func, ## a)
-#  define ext2_panic(sb, func, format, a...) printk(KERN_CRIT "%s: " format, func, ## a)
-#  define ext2_warning(sb, func, format, a...) printk(KERN_WARNING "%s: " format, func, ## a)
-#endif
-
-extern struct super_operations ext2_sops;
-int obd_remount (struct super_block * sb, int * flags, char * data);
-struct super_block * ext2_read_super (struct super_block * sb, void * data,
-                                      int silent);
-/* punch.c */
-void ext2_truncate (struct inode * inode);
-int ext2_punch (struct inode * inode, loff_t start, size_t count);
-
-#endif
diff --git a/lustre/include/linux/obd_filter.h b/lustre/include/linux/obd_filter.h
deleted file mode 100644 (file)
index 0530fc6..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef _OBD_FILTER_H
-#define _OBD_FILTER_H
-/*
- * Copyright (C) 2001  Cluster File Systems, Inc.
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- */
-
-
-#ifndef OBD_FILTER_DEVICENAME
-#define OBD_FILTER_DEVICENAME "obdfilter"
-#endif
-
-struct run_ctxt { 
-       struct vfsmount *pwdmnt;
-       struct dentry   *pwd;
-       mm_segment_t     fs;
-};
-
-struct filter_obd {
-       char *fo_fstype;
-        struct super_block * fo_sb;
-       struct vfsmount *fo_vfsmnt;
-       struct run_ctxt  fo_ctxt;
-       spinlock_t fo_lock;
-       __u64 fo_lastino;
-       struct file_operations *fo_fop; 
-       struct inode_operations *fo_iop;
-       struct address_space_operations *fo_aops;
-};
-
-
-extern struct obd_ops filter_obd_ops;
-
-#endif
diff --git a/lustre/include/linux/obd_osc.h b/lustre/include/linux/obd_osc.h
deleted file mode 100644 (file)
index f341737..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 2001 Cluster File Systems, Inc. <braam@clusterfs.com>
- *
- *   This file is part of Lustre, http://www.lustre.org.
- *
- *   Lustre is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   Lustre is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with Lustre; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Data structures for object storage targets and client: OST & OSC's
- * 
- * See also lustre_idl.h for wire formats of requests.
- *
- */
-
-#ifndef _LUSTRE_OSC_H
-#define _LUSTRE_OSC_H
-
-#include <linux/obd_support.h>
-#include <linux/lustre_net.h>
-
-#define OST_EXIT 1
-#define LUSTRE_OST_NAME "ost"
-
-struct osc_obd {
-       struct obd_device *osc_tgt;
-        struct lustre_peer osc_peer;
-};
-
-#endif
diff --git a/lustre/include/linux/obd_ost.h b/lustre/include/linux/obd_ost.h
deleted file mode 100644 (file)
index a53bd37..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 2001 Cluster File Systems, Inc. <braam@clusterfs.com>
- *
- *   This file is part of Lustre, http://www.lustre.org.
- *
- *   Lustre is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   Lustre is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with Lustre; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Data structures for object storage targets and client: OST & OSC's
- * 
- * See also lustre_idl.h for wire formats of requests.
- *
- */
-
-#ifndef _LUSTRE_OST_H
-#define _LUSTRE_OST_H
-
-#include <linux/obd_support.h>
-
-#define OST_EXIT 1
-#define LUSTRE_OST_NAME "ost"
-#define LUSTRE_OSC_NAME "osc"
-
-struct ost_obd {
-       struct obd_device *ost_tgt;
-       struct obd_conn ost_conn;
-       struct task_struct *ost_thread;
-       wait_queue_head_t ost_waitq;
-       wait_queue_head_t ost_done_waitq;
-       int ost_flags;
-       spinlock_t ost_lock;
-       struct list_head ost_reqs;
-
-        struct ptlrpc_service *ost_service;
-};
-
-struct ost_request { 
-       struct list_head rq_list;
-       struct ost_obd *rq_obd;
-       int rq_status;
-
-       char *rq_reqbuf;
-       int rq_reqlen;
-       struct ost_req_hdr *rq_reqhdr;
-       struct ost_req *rq_req;
-
-       char *rq_repbuf;
-       int rq_replen;
-       struct ost_rep_hdr *rq_rephdr;
-       struct ost_rep *rq_rep;
-
-        void *rq_reply_handle;
-       wait_queue_head_t rq_wait_for_rep;
-};
-
-/* ost/ost_pack.c */
-int ost_pack_req(char *buf1, int buflen1, char *buf2, int buflen2, struct ptlreq_hdr **hdr, struct ost_req **req, int *len, char **buf);
-int ost_unpack_req(char *buf, int len, struct ptlreq_hdr **hdr, struct ost_req **req);
-int ost_pack_rep(void *buf1, __u32 buflen1, void *buf2, __u32 buflen2, struct ptlrep_hdr **hdr, struct ost_rep **rep, int *len, char **buf);
-int ost_unpack_rep(char *buf, int len, struct ptlrep_hdr **hdr, struct ost_rep **rep);
-void ost_pack_niobuf(void **tmp, void *addr, __u64 offset, __u32 len, 
-                   __u32 flags);
-void ost_unpack_niobuf(void **tmp, struct niobuf **nbp);
-void ost_pack_ioo(void **tmp, struct obdo *oa, int bufcnt);
-void ost_unpack_ioo(void **tmp, struct obd_ioobj **ioop);
-void *ost_req_buf2(struct ost_req *req);
-void *ost_req_buf1(struct ost_req *req);
-void *ost_rep_buf2(struct ost_rep *rep);
-void *ost_rep_buf1(struct ost_rep *rep);
-
-
-
-#endif
-
-
diff --git a/lustre/include/linux/obd_raid1.h b/lustre/include/linux/obd_raid1.h
deleted file mode 100644 (file)
index b99161e..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef _OBD_RAID1
-#define _OBD_RAID1
-/*
- * Copyright (C) 2001  Cluster File Systems, Inc.
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- */
-
-#include <linux/obd_class.h>
-
-#define MAX_RAID1 16
-
-#ifndef OBD_RAID1_DEVICENAME
-#define OBD_RAID1_DEVICENAME "obdraid1"
-#endif
-
-struct raid1_obd {
-        unsigned int raid1_count; /* how many replicas */
-        /* devices to replicate on */
-        struct obd_device *raid1_devlist[MAX_RAID1];
-        /* connections we make */
-        struct obd_conn_info raid1_connections[MAX_RAID1];
-        struct list_head raid1_clients;  /* clients we have */
-};
-
-
-/* development definitions */
-extern struct obdfs_sb_info *obd_sbi;
-extern struct file_operations *obd_fso;
-
-/* obd_raid1.c */
-extern struct obd_ops raid1_obd_ops;
-inline long ext2_block_map (struct inode * inode, long block);
-
-#endif
diff --git a/lustre/include/linux/obd_rpc.h b/lustre/include/linux/obd_rpc.h
deleted file mode 100644 (file)
index e0847bc..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-#ifndef __OBD_RPC_H
-#define __OBD_RPC_H
-/*
- * Copyright (C) 2001  Cluster File Systems, Inc.
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- */
-
-#include <linux/sunrpc/svc.h>
-#define OBD_TGT_VERSION  001
-
-#define OBD_TGT_TCP  0x1
-#define OBD_TGT_INTR 0x2
-#define OBD_TGT_SOFT 0x4
-
-
-/* generic wrappable next */
-
-#define NEXT_INDEX(index, max)                                 \
-       (((index + 1) >= max) ? 0 : (index + 1))
-
-
-/* error codes */
-
-enum obd_stat {
- OBD_OK = 0,
- OBDERR_PERM = 1, 
- OBDERR_NOENT = 2,
- OBDERR_IO = 5,
- OBDERR_NXIO = 6,
- OBDERR_ACCESS = 13,
- OBDERR_EXIST = 17,
- OBDERR_XDEV = 18, 
- OBDERR_NODEV = 19,
- OBDERR_INVAL = 22,
- OBDERR_FBIG = 27,
- OBDERR_NOSPC = 28,
- OBDERR_ROFS = 30,
- OBDERR_OPNOTSUPP = 45,
- OBDERR_DQUOT = 69
-};
-
-
-extern struct rpc_program obd_program;
-
-
-struct obd_target {
-        struct sockaddr_in tgt_addr;
-        int tgt_flags;
-        int tgt_timeo;
-        int tgt_retrans;
-        int tgt_hostnamelen;
-        char tgt_hostname[0];
-        
-};
-
-
-struct rpc_obd {
-        struct rpc_clnt *       handle;         /* RPC client handle */
-        struct sockaddr_in      addr;
-        int                     flags;          /* various flags */
-        int                     timeo;
-        int                     retrans;
-        int                     rsize;          /* read size */
-        int                     wsize;          /* write size */
-        unsigned int            bsize;          /* server block size */
-        char *                  hostname;       /* remote hostname */
-};
-
-
-#define OBD_PROGRAM             300001
-#define OBD_VERSION             1
-#define OBDPROC_NULL            0
-#define OBDPROC_ECHOINT         1
-
-#ifdef  OBD_NEED_XDR_TYPES
-
-struct obd_echoint_in {
-        __u32                   in;
-};
-
-struct obd_echoint_out {
-        __u32                   out;
-};
-
-
-#endif /* OBD_NEED_XDR_TYPES */
-
-
-int obd_proc_echoint(struct rpc_obd *target, __u32 in, __u32 *out);
-
-
-#endif
diff --git a/lustre/include/linux/obd_snap.h b/lustre/include/linux/obd_snap.h
deleted file mode 100644 (file)
index 4b40801..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef _OBD_SNAP
-#define _OBD_SNAP
-/*
- * Copyright (C) 2001  Cluster File Systems, Inc.
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- */
-
-#define OBD_SNAP_MAGIC 0xfffffff3   /* an unlikely block number */
-
-#ifndef OBD_SNAP_DEVICENAME
-#define OBD_SNAP_DEVICENAME "obdsnap"
-#endif
-
-/* ioctls for manipulating snapshots 40 - 60 */
-#define OBD_SNAP_SETTABLE      _IOWR('f', 40, long)
-#define OBD_SNAP_PRINTTABLE    _IOWR('f', 41, long)
-#define OBD_SNAP_DELETE        _IOWR('f', 42, long)
-#define OBD_SNAP_RESTORE       _IOWR('f', 43, long)
-
-/* this is the obd device descriptor: 
- * - current snapshot ends up in first slot of this array
- */
-struct snap_obd {
-       unsigned int snap_index;  /* which snapshot index are we accessing */
-       int snap_tableno;
-};
-
-void snap_use(int table_no, int snap_index) ;
-void snap_unuse(int table_no, int snap_index) ;
-int snap_is_used(int table_no, int snap_index) ;
-int snap_table_attach(int tableno, int snap_index);
-
-#endif
diff --git a/lustre/include/linux/obd_snap_support.h b/lustre/include/linux/obd_snap_support.h
deleted file mode 100644 (file)
index e7dd012..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-#ifndef __OBD_SNAP_SUPP_H
-#define __OBD_SNAP_SUPP_H
-/*
- * Copyright (C) 2001  Cluster File Systems, Inc.
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- */
-
-/* What we use to point to IDs in the obdmd data for snapshots.  If we use
- * obd_id (8 bytes) instead of ino_t (4 bytes), we halve the number of
- * available snapshot slots (14 in 56 bytes vs. 7 in 56 bytes until we
- * increase the size of OBD_OBDMDSZ).
- */
-typedef ino_t  snap_id;
-
-/* maximum number of snapshot tables we maintain in the kernel */
-#define SNAP_MAX_TABLES 8
-
-/* maximum number of snapshots per device 
-   must fit in "o_obdmd" area of struct obdo */
-#define SNAP_MAX ((OBD_OBDMDSZ - sizeof(uint32_t))/sizeof(snap_id))
-
-struct snap_md {
-       uint32_t m_magic;
-       snap_id  m_ids[SNAP_MAX];       /* id of snaps; slot 0 has current id */
-};
-
-
-/* if time is 0 this designates the "current" snapshot, i.e.
-   the head of the tree 
-*/
-struct snap {
-       time_t time;
-       int index;
-};
-
-/* snap ioctl data for attach: current always in first slot of this array */
-struct snap_obd_data {
-       int          snap_dev;  /* which device contains the data */
-       unsigned int snap_index;/* which snapshot is ours */
-       unsigned int snap_table;/* which table do we use */
-};
-
-
-/* snap ioctl data for table fiddling */
-struct snap_table_data {
-       int             tblcmd_no;      /* which table */
-       unsigned int    tblcmd_count;   /* how many snaps */
-       struct snap     tblcmd_snaps[SNAP_MAX]; /* sorted times! */
-};
-
-
-struct snap_table {
-       spinlock_t          tbl_lock;
-       unsigned int tbl_count; /* how many snapshots exist in this table*/
-       int tbl_used;  /* bitmap of snaps in use by a device */
-       time_t tbl_times[SNAP_MAX];
-       int tbl_index[SNAP_MAX];
-};
-
-struct snap_iterdata {
-       struct obd_conn *conn;
-       struct obd_conn *ch_conn;
-       int index;
-       int previndex;
-       int currentindex;
-       int prevslot;
-       time_t prevtime;
-};
-
-inline struct obd_conn *child_conn(struct obd_conn *conn);
-int snap_deleteobj(obd_id id, obd_gr group, void *data);
-int snap_restoreobj(obd_id id, obd_gr group, void *data);
-int snap_printobj(obd_id id, obd_gr group, void *data);
-int snap_iocontrol(int cmd, struct obd_conn *conn, int len, void *karg, void *uarg);
-
-/* In the future, this function may have to deal with offsets into the obdmd.
- * Currently, we assume we have the whole obdmd struct.
- */
-static __inline__ struct snap_md *snap_obdmd(struct obdo *oa)
-{
-       return ((struct snap_md *)(&oa->o_obdmd));
-}
-#endif
diff --git a/lustre/include/linux/obd_support.h b/lustre/include/linux/obd_support.h
deleted file mode 100644 (file)
index 4707963..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-#ifndef _OBD_SUPPORT
-#define _OBD_SUPPORT
-/*
- * Copyright (C) 2001  Cluster File Systems, Inc.
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- */
-
-#include <linux/autoconf.h>
-#include <linux/slab.h>
-#include <linux/kp30.h>
-
-#define obd_unlock_page(page)                                           \
-do {                                                                    \
-        if (PageLocked(page)) {                                         \
-                UnlockPage(page);                                       \
-        } else {                                                        \
-                printk("file %s, line %d: expecting locked page\n",     \
-                       __FILE__, __LINE__);                             \
-        }                                                               \
-} while(0)
-
-/*
- * Debug code
- */
-/* global variables */
-extern int obd_debug_level;
-extern int obd_print_entry;
-extern int obd_inodes;
-extern int obd_pages;
-extern long obd_memory;
-
-#define EXT2_OBD_DEBUG
-
-#ifdef EXT2_OBD_DEBUG
-#define CMD(cmd) (( cmd == READ ) ? "read" : "write")
-
-/* Inode common information printed out (used by obdfs and ext2obd inodes) */
-#define ICDEBUG(inode) {                                                \
-        CDEBUG(D_INFO, "ino %ld, atm %ld, mtm %ld, ctm %ld, size %Ld, " \
-               "blocks %ld\n", inode->i_ino, inode->i_atime,            \
-               inode->i_mtime, inode->i_ctime, inode->i_size,           \
-               inode->i_blocks);                                        \
-        CDEBUG(D_INFO, "mode %o, uid %d, gid %d, nlnk %d, count %d\n",  \
-               inode->i_mode, inode->i_uid, inode->i_gid,               \
-               inode->i_nlink, atomic_read(&inode->i_count));           \
-}
-
-/* Ext2 inode information */
-#define EXDEBUG(inode) {                                                \
-        ICDEBUG(inode);                                                 \
-        CDEBUG(D_INFO, "ext2 blocks: %d %d %d %d %d %d %d %d\n",        \
-               inode->u.ext2_i.i_data[0], inode->u.ext2_i.i_data[1],    \
-               inode->u.ext2_i.i_data[2], inode->u.ext2_i.i_data[3],    \
-               inode->u.ext2_i.i_data[4], inode->u.ext2_i.i_data[5],    \
-               inode->u.ext2_i.i_data[6], inode->u.ext2_i.i_data[7]);   \
-}
-
-/* OBDFS inode information */
-#define OIDEBUG(inode) {                                                \
-        ICDEBUG(inode);                                                 \
-        CDEBUG(D_INFO,"oinfo: flags 0x%08x\n", obdfs_i2info(inode)->oi_flags);\
-        /* obdfs_print_plist(inode); */                                 \
-}
-
-#define ODEBUG(obdo) {                                                  \
-        CDEBUG(D_INFO, "id %ld, atm %ld, mtm %ld, ctm %ld, "            \
-               "size %ld, blocks %ld\n",                                \
-               (long)(obdo)->o_id, (long)(obdo)->o_atime,               \
-               (long)(obdo)->o_mtime, (long)(obdo)->o_ctime,            \
-               (long)(obdo)->o_size, (long)(obdo)->o_blocks);           \
-        CDEBUG(D_INFO, " mode %o, uid %d, gid %d, flg 0x%0x, "          \
-               "obdflg 0x%0x, nlnk %d, valid 0x%0x\n",                  \
-               (obdo)->o_mode, (obdo)->o_uid, (obdo)->o_gid, (obdo)->o_flags,\
-               (obdo)->o_obdflags, (obdo)->o_nlink, (obdo)->o_valid);   \
-}
-
-#define PDEBUG(page,msg) {                                              \
-        if (page){                                                      \
-                char *uptodate = (Page_Uptodate(page)) ? "upto" : "outof";\
-                char *locked = (PageLocked(page)) ? "" : "un";          \
-                char *buffer = page->buffers ? "buffer" : "";           \
-                int count = page_count(page);                           \
-                long index = page->index;                               \
-                CDEBUG(D_CACHE, "%s: ** off %ld, %sdate, %slocked, flag %ld,"\
-                       " cnt %d page 0x%p pages %ld virt %lx %s**\n",   \
-                       msg, index, uptodate, locked, page->flags, count,\
-                       page, page->mapping ? page->mapping->nrpages : -1,\
-                       page->virtual, buffer);                          \
-        } else                                                          \
-                CDEBUG(D_CACHE, "** %s: no page\n", msg);               \
-}
-
-#if 0
-#define iget(sb, ino) obd_iget(sb, ino)
-#define iput(sb, ino) obd_iput(sb, ino)
-
-static inline struct inode *obd_iget(struct super_block *sb, unsigned long ino)
-{
-        struct inode *inode;
-        
-        if ((inode = iget(sb, ino)) == NULL)
-                CDEBUG(D_INODE, "NULL in iget for %ld\n", ino);
-        else
-                obd_inodes++;
-        return inode;
-}
-
-static inline void obd_iput(struct inode *inode)
-{
-        if (inode == NULL)
-                CDEBUG(D_INODE, "NULL in iput\n");
-        else
-                obd_inodes--;
-}
-#endif
-
-#else /* EXT2_OBD_DEBUG */
-
-#define CDEBUG(mask, format, a...) {}
-#define ENTRY {}
-#define EXIT {}
-#define ODEBUG(obdo) {}
-#define EXDEBUG(inode) {}
-#define OIDEBUG(inode) {}
-#define PDEBUG(page, cmd) {}
-
-#endif /* EXT2_OBD_DEBUG */
-
-#define OBD_ALLOC(ptr, size)                                    \
-do {                                                            \
-        (ptr) = kmalloc((unsigned long)(size), GFP_KERNEL);     \
-        obd_memory += (size);                                   \
-        CDEBUG(D_MALLOC, "kmalloced: %ld at %x (tot %ld).\n",   \
-               (long)(size), (int)(ptr), obd_memory);           \
-        if (ptr == NULL) {                                      \
-                CERROR("kernel malloc failed at %s:%d\n",       \
-                       __FILE__, __LINE__);                     \
-        } else {                                                \
-                memset((ptr), 0, (size));                       \
-        }                                                       \
-} while (0)
-
-#define OBD_FREE(ptr, size)                                  \
-do {                                                         \
-        kfree((ptr));                                        \
-        obd_memory -= (size);                                \
-        CDEBUG(D_MALLOC, "kfreed: %d at %x (tot %ld).\n",    \
-               (int)(size), (int)(ptr), obd_memory);         \
-} while (0)
-
-#endif
diff --git a/lustre/include/linux/obd_trace.h b/lustre/include/linux/obd_trace.h
deleted file mode 100644 (file)
index 00e16bb..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- *
- * obdtrace (header file) - is useful for tracing and performance
- * debug of the Lustre obd protocol stack. obdtrace is a transparent
- * logical obd driver that prints commands their in- and outbound
- * parameters.  obdtrace maintains statistics about number and latency
- * of the obd commands that pass through it. As such it is also use
- * for performance analysis.
- *
- * Copyright (c) 2001  Rumi Zahir <rumi.zahir@intel.com>
- */
-
-#ifndef __OBD_TRACE_H
-#define __OBD_TRACE_H
-
-struct obd_device;
-struct obdtrace_opstats;
-
-struct trace_obd {
-  struct obdtrace_opstats *stats;
-};
-
-#endif
diff --git a/lustre/include/linux/obdfs.h b/lustre/include/linux/obdfs.h
deleted file mode 100644 (file)
index 4e68938..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-/* object based disk file system
- * 
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- * 
- * Copyright (C), 1999, Stelias Computing Inc
- *
- *
- */
-
-
-#ifndef _OBDFS_H
-#define _OBDFS_H
-#include <linux/obd_class.h>
-#include <linux/obdo.h>
-#include <linux/list.h>
-
-/* super.c */ 
-struct obdfs_pgrq {
-        struct list_head         rq_plist;      /* linked list of req's */
-        unsigned long            rq_jiffies;
-        struct page             *rq_page;       /* page to be written */
-};
-
-extern struct list_head obdfs_super_list;       /* list of all OBDFS superblocks */
-
-
-
-/* dir.c */
-extern struct file_operations obdfs_dir_operations;
-extern struct inode_operations obdfs_dir_inode_operations;
-
-/* file.c */
-extern struct file_operations obdfs_file_operations;
-extern struct inode_operations obdfs_file_inode_operations;
-
-/* flush.c */
-void obdfs_dequeue_pages(struct inode *inode);
-int obdfs_flushd_init(void);
-int obdfs_flushd_cleanup(void);
-int obdfs_flush_reqs(struct list_head *inode_list, unsigned long check_time);
-int obdfs_flush_dirty_pages(unsigned long check_time);
-
-/* namei.c */
-
-/* rw.c */
-int obdfs_do_writepage(struct page *, int sync);
-int obdfs_init_pgrqcache(void);
-void obdfs_cleanup_pgrqcache(void);
-inline void obdfs_pgrq_del(struct obdfs_pgrq *pgrq);
-int obdfs_readpage(struct file *file, struct page *page);
-int obdfs_prepare_write(struct file *file, struct page *page, unsigned from, unsigned to);
-int obdfs_commit_write(struct file *file, struct page *page, unsigned from, unsigned to);
-int obdfs_writepage(struct page *page);
-struct page *obdfs_getpage(struct inode *inode, unsigned long offset,
-                           int create, int locked);
-int obdfs_write_one_page(struct file *file, struct page *page,
-                         unsigned long offset, unsigned long bytes,
-                         const char * buf);
-int obdfs_do_vec_wr(struct inode **inodes, obd_count num_io, obd_count num_oa,
-                    struct obdo **obdos, obd_count *oa_bufs,
-                    struct page **pages, char **bufs, obd_size *counts,
-                    obd_off *offsets, obd_flag *flags);
-void obdfs_truncate(struct inode *inode);
-
-/* super.c */
-extern long obdfs_cache_count;
-extern long obdfs_mutex_start;
-
-/* symlink.c */
-extern struct inode_operations obdfs_fast_symlink_inode_operations;
-extern struct inode_operations obdfs_symlink_inode_operations;
-
-/* sysctl.c */
-void obdfs_sysctl_init(void);
-void obdfs_sysctl_clean(void);
-
-static inline struct obdfs_sb_info *obdfs_i2sbi(struct inode *inode)
-{
-        return (struct obdfs_sb_info *) &(inode->i_sb->u.generic_sbp);
-}
-
-static inline struct list_head *obdfs_iplist(struct inode *inode) 
-{
-        struct obdfs_inode_info *info = obdfs_i2info(inode);
-
-        return &info->oi_pages;
-}
-
-static inline struct list_head *obdfs_islist(struct inode *inode) 
-{
-        struct obdfs_inode_info *info = obdfs_i2info(inode);
-
-        return &info->oi_inodes;
-}
-
-static inline struct list_head *obdfs_slist(struct inode *inode) 
-{
-        struct obdfs_sb_info *sbi = obdfs_i2sbi(inode);
-
-        return &sbi->osi_inodes;
-}
-
-static void inline obdfs_set_size (struct inode *inode, obd_size size)
-{  
-       inode->i_size = size;
-       inode->i_blocks = (inode->i_size + inode->i_sb->s_blocksize - 1) >>
-               inode->i_sb->s_blocksize_bits;
-} /* obdfs_set_size */
-
-
-#if 0   /* PAGE CACHE DISABLED */
-
-#define obd_down(mutex) {                                               \
-        /* CDEBUG(D_INFO, "get lock\n"); */                             \
-        obdfs_mutex_start = jiffies;                                    \
-        down(mutex);                                                    \
-        if (jiffies - obdfs_mutex_start)                                \
-                CDEBUG(D_CACHE, "waited on mutex %ld jiffies\n",        \
-                       jiffies - obdfs_mutex_start);                    \
-}
-
-#define obd_up(mutex) {                                                 \
-        up(mutex);                                                      \
-        if (jiffies - obdfs_mutex_start > 1)                            \
-                CDEBUG(D_CACHE, "held mutex for %ld jiffies\n",         \
-                       jiffies - obdfs_mutex_start);                    \
-        /* CDEBUG(D_INFO, "free lock\n"); */                            \
-}
-
-/* We track if a page has been added to the OBD page cache by stting a
- * flag on the page.  We have chosen a bit that will hopefully not be
- * used for a while.
- */
-#define PG_obdcache 29
-#define OBDAddCachePage(page)   test_and_set_bit(PG_obdcache, &(page)->flags)
-#define OBDClearCachePage(page) clear_bit(PG_obdcache, &(page)->flags)
-
-static inline void obdfs_print_plist(struct inode *inode) 
-{
-        struct list_head *page_list = obdfs_iplist(inode);
-        struct list_head *tmp;
-
-        CDEBUG(D_INFO, "inode %ld: page", inode->i_ino);
-        /* obd_down(&obdfs_i2sbi(inode)->osi_list_mutex); */
-        if (list_empty(page_list)) {
-                CDEBUG(D_INFO, " list empty\n");
-                obd_up(&obdfs_i2sbi(inode)->osi_list_mutex);
-                return;
-        }
-
-        tmp = page_list;
-        while ( (tmp = tmp->next) != page_list) {
-                struct obdfs_pgrq *pgrq;
-                pgrq = list_entry(tmp, struct obdfs_pgrq, rq_plist);
-                CDEBUG(D_INFO, " %p", pgrq->rq_page);
-        }
-        CDEBUG(D_INFO, "\n");
-        /* obd_up(&obdfs_i2sbi(inode)->osi_list_mutex); */
-}
-#endif
-
-
-#endif
-
diff --git a/lustre/include/linux/obdo.h b/lustre/include/linux/obdo.h
deleted file mode 100644 (file)
index 4255482..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-#ifndef OBD_H
-#define OBD_H
-/*
- * Copyright (C) 2001  Cluster File Systems, Inc.
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- */
-
-struct obdfs_inode_info {
-        int              oi_flags;
-        struct list_head oi_inodes;
-        struct list_head oi_pages;
-        char             oi_inline[OBD_INLINESZ];
-};
-
-struct obdfs_sb_info {
-        struct list_head         osi_list;      /* list of supers */
-        struct obd_conn          osi_conn;
-        struct super_block      *osi_super;
-        struct obd_device       *osi_obd;
-        ino_t                    osi_rootino;   /* number of root inode */
-        int                      osi_minor;     /* minor of /dev/obdX */
-        struct list_head         osi_inodes;    /* list of dirty inodes */
-        unsigned long            osi_cache_count;
-        struct semaphore         osi_list_mutex;
-};
-
-
-static inline struct obdfs_inode_info *obdfs_i2info(struct inode *inode)
-{
-        return (struct obdfs_inode_info *)&(inode->u.generic_ip);
-}
-
-static inline int obdfs_has_inline(struct inode *inode)
-{
-        return (obdfs_i2info(inode)->oi_flags & OBD_FL_INLINEDATA);
-}
-
-static void inline obdfs_from_inode(struct obdo *oa, struct inode *inode)
-{
-        struct obdfs_inode_info *oinfo = obdfs_i2info(inode);
-
-        CDEBUG(D_INFO, "src inode %ld, dst obdo %ld valid 0x%08x\n",
-               inode->i_ino, (long)oa->o_id, oa->o_valid);
-        obdo_from_inode(oa, inode);
-       if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) {
-                CDEBUG(D_INODE, "copying device %x from inode to obdo\n",
-                      inode->i_rdev);
-               *((obd_rdev *)oa->o_inline) = kdev_t_to_nr(inode->i_rdev);
-                oa->o_obdflags |= OBD_FL_INLINEDATA;
-                oa->o_valid |= OBD_MD_FLINLINE;
-       } else if (obdfs_has_inline(inode)) {
-                CDEBUG(D_INODE, "copying inline data from inode to obdo\n");
-                memcpy(oa->o_inline, oinfo->oi_inline, OBD_INLINESZ);
-                oa->o_obdflags |= OBD_FL_INLINEDATA;
-                oa->o_valid |= OBD_MD_FLINLINE;
-        }
-} /* obdfs_from_inode */
-
-static void inline obdfs_to_inode(struct inode *inode, struct obdo *oa)
-{
-        struct obdfs_inode_info *oinfo = obdfs_i2info(inode);
-
-        CDEBUG(D_INFO, "src obdo %ld valid 0x%08x, dst inode %ld\n",
-               (long)oa->o_id, oa->o_valid, inode->i_ino);
-
-        obdo_to_inode(inode, oa);
-
-        if (obdo_has_inline(oa)) {
-               if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode) ||
-                   S_ISFIFO(inode->i_mode)) {
-                       obd_rdev rdev = *((obd_rdev *)oa->o_inline);
-                       CDEBUG(D_INODE,
-                              "copying device %x from obdo to inode\n", rdev);
-                       init_special_inode(inode, inode->i_mode, rdev);
-               } else {
-                       CDEBUG(D_INFO, "copying inline from obdo to inode\n");
-                       memcpy(oinfo->oi_inline, oa->o_inline, OBD_INLINESZ);
-               }
-                oinfo->oi_flags |= OBD_FL_INLINEDATA;
-        }
-} /* obdfs_to_inode */
-
-#define NOLOCK 0
-#define LOCKED 1
-
-#ifdef OPS
-#warning "*** WARNING redefining OPS"
-#else
-#define OPS(sb,op) ((struct obdfs_sb_info *)(& (sb)->u.generic_sbp))->osi_ops->o_ ## op
-#define IOPS(inode,op) ((struct obdfs_sb_info *)(&(inode)->i_sb->u.generic_sbp))->osi_ops->o_ ## op
-#endif
-
-#ifdef ID
-#warning "*** WARNING redefining ID"
-#else
-#define ID(sb) (&((struct obdfs_sb_info *)( &(sb)->u.generic_sbp))->osi_conn)
-#define IID(inode) (&((struct obdfs_sb_info *)( &(inode)->i_sb->u.generic_sbp))->osi_conn)
-#endif
-
-#define OBDFS_SUPER_MAGIC 0x4711
-
-#endif
diff --git a/lustre/lib/.cvsignore b/lustre/lib/.cvsignore
deleted file mode 100644 (file)
index e530020..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-.Xrefs
-config.log
-config.status
-configure
-Makefile
-Makefile.in
-.deps
-TAGS
diff --git a/lustre/lib/mds_pack.c b/lustre/lib/mds_pack.c
deleted file mode 100644 (file)
index 6a4204f..0000000
+++ /dev/null
@@ -1,228 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 2001 Cluster File Systems, Inc. <braam@clusterfs.com>
- *
- *   This file is part of Lustre, http://www.lustre.org.
- *
- *   Lustre is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   Lustre is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with Lustre; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * (Un)packing of MDS and OST request records
- *
- */
-
-#include <linux/module.h>
-#include <linux/errno.h>
-#include <linux/kernel.h>
-#include <linux/major.h>
-#include <linux/sched.h>
-#include <linux/lp.h>
-#include <linux/slab.h>
-#include <linux/ioport.h>
-#include <linux/fcntl.h>
-#include <linux/delay.h>
-#include <linux/skbuff.h>
-#include <linux/proc_fs.h>
-#include <linux/fs.h>
-#include <linux/poll.h>
-#include <linux/init.h>
-#include <linux/list.h>
-#include <asm/io.h>
-#include <asm/segment.h>
-#include <asm/system.h>
-#include <asm/poll.h>
-#include <asm/uaccess.h>
-
-#define DEBUG_SUBSYSTEM S_MDS
-
-#include <linux/obd_support.h>
-#include <linux/lustre_lib.h>
-#include <linux/lustre_idl.h>
-#include <linux/lustre_mds.h>
-
-int mds_pack_req(char *name, int namelen, char *tgt, int tgtlen, 
-                struct ptlreq_hdr **hdr, union ptl_req *r,
-                int *len, char **buf)
-{
-        struct mds_req *req;
-       char *ptr;
-
-       *len = sizeof(**hdr) + size_round(namelen) + size_round(tgtlen) + 
-               sizeof(*req); 
-
-       OBD_ALLOC(*buf, *len);
-       if (!*buf) {
-               EXIT;
-               return -ENOMEM;
-       }
-
-       memset(*buf, 0, *len); 
-       *hdr = (struct ptlreq_hdr *)(*buf);
-       req = (struct mds_req *)(*buf + sizeof(**hdr));
-        r->mds = req;
-
-       ptr = *buf + sizeof(**hdr) + sizeof(*req);
-
-       (*hdr)->type =  MDS_TYPE_REQ;
-
-       req->namelen = NTOH__u32(namelen);
-       if (name) { 
-               LOGL(name, namelen, ptr); 
-       } 
-
-       req->tgtlen = NTOH__u32(tgtlen);
-       if (tgt) {
-               LOGL(tgt, tgtlen, ptr);
-       }
-       return 0;
-}
-
-
-int mds_unpack_req(char *buf, int len, 
-                  struct ptlreq_hdr **hdr, union ptl_req *r)
-{
-        struct mds_req *req;
-        char *name, *tgt;
-
-       if (len < sizeof(**hdr) + sizeof(*req)) { 
-               EXIT;
-               return -EINVAL;
-       }
-
-       *hdr = (struct ptlreq_hdr *) (buf);
-        req = (struct mds_req *) (buf + sizeof(**hdr));
-        r->mds = req;
-
-       req->namelen = NTOH__u32(req->namelen); 
-       req->tgtlen = NTOH__u32(req->tgtlen); 
-
-       if (len < sizeof(**hdr) + sizeof(*req) +
-            size_round(req->namelen) + size_round(req->tgtlen) ) { 
-               EXIT;
-               return -EINVAL;
-       }
-
-       if (req->namelen) { 
-               name = buf + sizeof(**hdr) + sizeof(*req);
-       } else { 
-               name = NULL;
-       }
-
-       if (req->tgtlen) { 
-               tgt = buf + sizeof(**hdr) + sizeof(*req) + 
-                        size_round(req->namelen);
-       } else { 
-               tgt = NULL;
-       }
-
-       EXIT;
-       return 0;
-}
-
-void *mds_req_tgt(struct mds_req *req)
-{
-        if (!req->tgtlen) 
-                return NULL;
-        return (void *)((char *)req + sizeof(*req) + 
-                        size_round(req->namelen)); 
-}
-
-void *mds_req_name(struct mds_req *req)
-{
-        if (!req->namelen) 
-                return NULL;
-        return (void *)((char *)req + sizeof(*req));
-}
-
-int mds_pack_rep(char *name, int namelen, char *tgt, int tgtlen, 
-                struct ptlrep_hdr **hdr, union ptl_rep *r,
-                int *len, char **buf)
-{
-        struct mds_rep *rep;
-       char *ptr;
-
-       *len = sizeof(**hdr) + size_round(namelen) + size_round(tgtlen) + 
-               sizeof(*rep); 
-
-       OBD_ALLOC(*buf, *len);
-       if (!*buf) {
-               EXIT;
-               return -ENOMEM;
-       }
-
-       memset(*buf, 0, *len); 
-       *hdr = (struct ptlrep_hdr *)(*buf);
-        rep = (struct mds_rep *)(*buf + sizeof(**hdr));
-        r->mds = rep;
-
-       ptr = *buf + sizeof(**hdr) + sizeof(*rep);
-
-       (*hdr)->type =  MDS_TYPE_REP;
-
-       rep->namelen = NTOH__u32(namelen);
-       if (name) { 
-               LOGL(name, namelen, ptr); 
-       } 
-
-        rep->tgtlen = NTOH__u32(tgtlen);
-       if (tgt) { 
-               LOGL(tgt, tgtlen, ptr);
-       }
-       return 0;
-}
-
-int mds_unpack_rep(char *buf, int len, 
-                  struct ptlrep_hdr **hdr, union ptl_rep *r)
-{
-        struct mds_rep *rep;
-       if (len < sizeof(**hdr)) { 
-               EXIT;
-               return -EINVAL;
-       }
-       *hdr = (struct ptlrep_hdr *) (buf);
-
-       if (len < sizeof(**hdr) + sizeof(*rep)) { 
-               EXIT;
-               return -EINVAL;
-       }
-
-        rep = (struct mds_rep *) (buf + sizeof(**hdr));
-        r->mds = rep;
-       rep->namelen = NTOH__u32(rep->namelen); 
-       rep->tgtlen = NTOH__u32(rep->namelen); 
-
-       if (len < sizeof(**hdr) + sizeof(*rep) 
-            + size_round(rep->namelen) + size_round(rep->tgtlen) ) { 
-               EXIT;
-               return -EINVAL;
-       }
-
-       EXIT;
-       return 0;
-}
-
-void *mds_rep_name(struct mds_rep *rep)
-{
-        if (!rep->namelen) 
-                return NULL;
-        return (void *)((char *)rep + sizeof(*rep));
-}
-
-void *mds_rep_tgt(struct mds_rep *rep)
-{
-        if (!rep->tgtlen) 
-                return NULL;
-        return (void *)((char *)rep + sizeof(*rep) + size_round(rep->namelen)); 
-}
-
diff --git a/lustre/lib/mds_updates.c b/lustre/lib/mds_updates.c
deleted file mode 100644 (file)
index 0444417..0000000
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- * Lustre Light Update Records
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- *
- * Copryright (C) 2002 Cluster File Systems, Inc.
- *
- */
-
-#include <linux/config.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/string.h>
-#include <linux/stat.h>
-#include <linux/errno.h>
-#include <linux/locks.h>
-#include <linux/unistd.h>
-
-#include <asm/system.h>
-#include <asm/uaccess.h>
-
-#include <linux/fs.h>
-#include <linux/stat.h>
-#include <asm/uaccess.h>
-#include <linux/slab.h>
-#include <asm/segment.h>
-
-#define DEBUG_SUBSYSTEM S_MDS
-
-#include <linux/obd_support.h>
-#include <linux/lustre_lib.h>
-#include <linux/lustre_idl.h>
-#include <linux/lustre_light.h>
-
-/* packing of MDS records */
-void mds_create_pack(struct mds_rec_create *rec, struct inode *inode, const char *name, int namelen, __u32 mode, __u64 id, __u32 uid, __u32 gid, __u64 time, const char *tgt, int tgtlen)
-{
-       char *tmp = (char *)rec + sizeof(*rec); 
-       /* XXX do something about time, uid, gid */
-       rec->cr_reclen = 
-               HTON__u32(sizeof(*rec) + size_round0(namelen) + 
-                         size_round0(tgtlen));
-       rec->cr_opcode = HTON__u32(REINT_CREATE);
-
-       ll_inode2fid(&rec->cr_fid, inode); 
-       rec->cr_mode = HTON__u32(mode);
-       rec->cr_id = HTON__u64(id);
-       rec->cr_uid = HTON__u32(uid);
-       rec->cr_gid = HTON__u32(gid);
-       rec->cr_time = HTON__u64(time);
-       rec->cr_namelen = HTON__u32(namelen + 1); /* for terminating \0 */ 
-       LOGL0(name, namelen, tmp); 
-       if (tgt) { 
-               rec->cr_tgtlen = HTON__u32(tgtlen + 1); 
-               LOGL0(tgt, tgtlen, tmp); 
-       }
-}
-
-
-void mds_setattr_pack(struct mds_rec_setattr *rec, struct inode *inode, struct iattr *iattr)
-{
-       rec->sa_reclen = HTON__u32(sizeof(*rec));
-       rec->sa_opcode = HTON__u32(REINT_SETATTR);
-
-       ll_inode2fid(&rec->sa_fid, inode); 
-       rec->sa_valid = HTON__u32(iattr->ia_valid);
-       rec->sa_mode = HTON__u32(iattr->ia_mode);
-       rec->sa_uid = HTON__u32(iattr->ia_uid);
-       rec->sa_gid = HTON__u32(iattr->ia_gid);
-       rec->sa_size = HTON__u64(iattr->ia_size);
-       rec->sa_atime = HTON__u64(iattr->ia_atime);
-       rec->sa_mtime = HTON__u64(iattr->ia_mtime);
-       rec->sa_ctime = HTON__u64(iattr->ia_ctime);
-       rec->sa_attr_flags = HTON__u32(iattr->ia_attr_flags);
-}
-
-void mds_unlink_pack(struct mds_rec_unlink *rec, 
-                    struct inode *inode, const char *name, int namelen)
-{
-       char *tmp = (char *)rec + sizeof(*rec); 
-
-       rec->ul_reclen = HTON__u32(sizeof(*rec)) + size_round0(namelen);
-       rec->ul_opcode = HTON__u32(REINT_UNLINK);
-
-       ll_inode2fid(&rec->ul_fid1, inode); 
-       rec->ul_namelen = HTON__u32(namelen + 1); /* for terminating \0 */ 
-       LOGL0(name, namelen, tmp); 
-}
-
-void mds_link_pack(struct mds_rec_link *rec, 
-                    struct inode *inode, struct inode *dir,
-                    const char *name, int namelen)
-{
-       char *tmp = (char *)rec + sizeof(*rec); 
-       rec->lk_reclen = HTON__u32(sizeof(*rec)) + size_round0(namelen);
-       rec->lk_opcode = HTON__u32(REINT_LINK);
-
-       ll_inode2fid(&rec->lk_fid1, inode); 
-       ll_inode2fid(&rec->lk_fid2, dir); 
-       rec->lk_namelen = HTON__u32(namelen + 1); /* for terminating \0 */ 
-       LOGL0(name, namelen, tmp); 
-}
-
-void mds_rename_pack(struct mds_rec_rename *rec, struct inode *srcdir, struct inode *tgtdir, const char *name, int namelen, const char *tgt, int tgtlen)
-{
-       char *tmp = (char *)rec + sizeof(*rec); 
-       /* XXX do something about time, uid, gid */
-       rec->rn_reclen = 
-               HTON__u32(sizeof(*rec) + size_round0(namelen) + 
-                         size_round0(tgtlen));
-       rec->rn_opcode = HTON__u32(REINT_RENAME);
-
-       ll_inode2fid(&rec->rn_fid1, srcdir); 
-       ll_inode2fid(&rec->rn_fid2, tgtdir); 
-       rec->rn_namelen = HTON__u32(namelen + 1); /* for terminating \0 */ 
-       LOGL0(name, namelen, tmp); 
-       if (tgt) { 
-               rec->rn_tgtlen = HTON__u32(tgtlen + 1); 
-               LOGL0(tgt, tgtlen, tmp); 
-       }
-}
-
-/* unpacking */
-
-static int mds_update_hdr_unpack(char *buf, int len, struct mds_update_record *r)
-{
-       struct mds_update_record_hdr *hdr = (struct mds_update_record_hdr *)buf;
-       
-       r->ur_reclen = NTOH__u32(hdr->ur_reclen);
-       if (len < sizeof(*hdr) || len != r->ur_reclen) { 
-               CERROR("invalid buffer length\n"); 
-               return -EFAULT;
-       }
-       r->ur_opcode = NTOH__u32(hdr->ur_opcode); 
-       return 0;
-}
-
-static int mds_setattr_unpack(char *buf, int len, struct mds_update_record *r)
-{
-
-       struct iattr *attr = &r->ur_iattr;
-       struct mds_rec_setattr *rec = (struct mds_rec_setattr *)buf; 
-
-       if (len < sizeof(*rec)) { 
-               CERROR("invalid buffer length\n"); 
-               return -EFAULT;
-       }
-
-       r->ur_fid1 = &rec->sa_fid; 
-       attr->ia_valid = NTOH__u32(rec->sa_valid);
-       attr->ia_mode = NTOH__u32(rec->sa_mode);
-       attr->ia_uid = NTOH__u32(rec->sa_uid);
-       attr->ia_gid = NTOH__u32(rec->sa_gid);
-       attr->ia_size = NTOH__u64(rec->sa_size);
-       attr->ia_atime = NTOH__u64(rec->sa_atime);
-       attr->ia_mtime = NTOH__u64(rec->sa_mtime);
-       attr->ia_ctime = NTOH__u64(rec->sa_ctime);
-       attr->ia_attr_flags = NTOH__u32(rec->sa_attr_flags);
-       return 0; 
-}
-
-static int mds_create_unpack(char *buf, int len, struct mds_update_record *r)
-{
-       struct mds_rec_create *rec = (struct mds_rec_create *)buf; 
-       char *ptr, *end;
-
-       if (len < sizeof(*rec)) { 
-               CERROR("invalid buffer length\n"); 
-               return -EFAULT;
-       }
-       
-       ptr = (char *)rec + sizeof(*rec); 
-       end = ptr + len - sizeof(*rec); 
-       
-       r->ur_fid1 = &rec->cr_fid;
-       r->ur_mode = NTOH__u32(rec->cr_mode);
-       r->ur_id = NTOH__u64(rec->cr_id);
-       r->ur_uid = NTOH__u32(rec->cr_uid);
-       r->ur_gid = NTOH__u32(rec->cr_gid);
-       r->ur_time = NTOH__u64(rec->cr_time);
-       r->ur_namelen = NTOH__u32(rec->cr_namelen);
-       r->ur_tgtlen = NTOH__u32(rec->cr_tgtlen);
-
-       UNLOGL0(r->ur_name, char, r->ur_namelen, ptr, end); 
-       UNLOGL0(r->ur_tgt, char, r->ur_tgtlen, ptr, end);
-       return 0;
-}
-
-static int mds_link_unpack(char *buf, int len, struct mds_update_record *r)
-{
-       struct mds_rec_link *rec = (struct mds_rec_link *)buf; 
-       char *ptr, *end;
-
-       if (len < sizeof(*rec)) { 
-               CERROR("invalid buffer length\n"); 
-               return -EFAULT;
-       }
-       
-       ptr = (char *)rec + sizeof(*rec); 
-       end = ptr + len - sizeof(*rec); 
-       
-       r->ur_fid1 = &rec->lk_fid1;
-       r->ur_fid2 = &rec->lk_fid2;
-       r->ur_namelen = NTOH__u32(rec->lk_namelen);
-       UNLOGL0(r->ur_name, char, r->ur_namelen, ptr, end); 
-       return 0;
-}
-
-
-static int mds_unlink_unpack(char *buf, int len, struct mds_update_record *r)
-{
-       struct mds_rec_unlink *rec = (struct mds_rec_unlink *)buf; 
-       char *ptr, *end;
-       ENTRY;
-
-       if (len < sizeof(*rec)) { 
-               CERROR("invalid buffer length\n"); 
-               return -EFAULT;
-       }
-       
-       ptr = (char *)rec + sizeof(*rec); 
-       end = ptr + len - sizeof(*rec); 
-       
-       r->ur_fid1 = &rec->ul_fid1;
-       r->ur_namelen = NTOH__u32(rec->ul_namelen);
-       UNLOGL0(r->ur_name, char, r->ur_namelen, ptr, end); 
-       EXIT;
-       return 0;
-}
-
-static int mds_rename_unpack(char *buf, int len, struct mds_update_record *r)
-{
-       struct mds_rec_rename *rec = (struct mds_rec_rename *)buf; 
-       char *ptr, *end;
-
-       if (len < sizeof(*rec)) { 
-               CERROR("invalid buffer length\n"); 
-               return -EFAULT;
-       }
-       
-       ptr = (char *)rec + sizeof(*rec); 
-       end = ptr + len - sizeof(*rec); 
-       
-       r->ur_fid1 = &rec->rn_fid1;
-       r->ur_fid2 = &rec->rn_fid2;
-       r->ur_namelen = NTOH__u32(rec->rn_namelen);
-       r->ur_tgtlen = NTOH__u32(rec->rn_tgtlen);
-
-       UNLOGL0(r->ur_name, char, r->ur_namelen, ptr, end); 
-       UNLOGL0(r->ur_tgt, char, r->ur_tgtlen, ptr, end);
-       return 0;
-}
-
-typedef int (*update_unpacker)(char *, int , struct mds_update_record *); 
-
-static update_unpacker mds_unpackers[REINT_MAX + 1] = {
-       [REINT_SETATTR] mds_setattr_unpack,     
-        [REINT_CREATE] mds_create_unpack,
-        [REINT_LINK] mds_link_unpack,
-        [REINT_UNLINK] mds_unlink_unpack,
-        [REINT_RENAME] mds_rename_unpack,
-};
-
-int mds_update_unpack(char *buf, int len, struct mds_update_record *r)
-{
-       int rc; 
-       ENTRY;
-
-       rc = mds_update_hdr_unpack(buf, len, r);
-
-       if (rc) { 
-               EXIT;
-               return -EFAULT;
-       }
-
-       if ( r->ur_opcode<0 || r->ur_opcode > REINT_MAX) { 
-               EXIT;
-               return EFAULT; 
-       }
-       
-       rc = mds_unpackers[r->ur_opcode](buf, len, r);
-       EXIT;
-       return rc;
-}
diff --git a/lustre/lib/obd_pack.c b/lustre/lib/obd_pack.c
deleted file mode 100644 (file)
index f811437..0000000
+++ /dev/null
@@ -1,254 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 2001 Cluster File Systems, Inc. <braam@clusterfs.com>
- *
- *   This file is part of Lustre, http://www.lustre.org.
- *
- *   Lustre is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   Lustre is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with Lustre; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * (Un)packing of OST requests
- *
- */
-
-#include <linux/module.h>
-#include <linux/errno.h>
-#include <linux/kernel.h>
-#include <linux/major.h>
-#include <linux/sched.h>
-#include <linux/lp.h>
-#include <linux/slab.h>
-#include <linux/ioport.h>
-#include <linux/fcntl.h>
-#include <linux/delay.h>
-#include <linux/skbuff.h>
-#include <linux/proc_fs.h>
-#include <linux/fs.h>
-#include <linux/poll.h>
-#include <linux/init.h>
-#include <linux/list.h>
-#include <asm/io.h>
-#include <asm/segment.h>
-#include <asm/system.h>
-#include <asm/poll.h>
-#include <asm/uaccess.h>
-
-#define DEBUG_SUBSYSTEM S_OST
-
-#include <linux/obd_support.h>
-#include <linux/obd_class.h>
-#include <linux/obd_ost.h>
-#include <linux/lustre_lib.h>
-#include <linux/lustre_idl.h>
-
-int ost_pack_req(char *buf1, int buflen1, char *buf2, int buflen2, 
-                struct ptlreq_hdr **hdr, struct ost_req **req, 
-                int *len, char **buf)
-{
-       char *ptr;
-
-       *len = sizeof(**hdr) + size_round(buflen1) + size_round(buflen2) + 
-               sizeof(**req); 
-
-       OBD_ALLOC(*buf, *len);
-       if (!*buf) {
-               EXIT;
-               return -ENOMEM;
-       }
-
-       memset(*buf, 0, *len); 
-       *hdr = (struct ptlreq_hdr *)(*buf);
-       *req = (struct ost_req *)(*buf + sizeof(**hdr));
-
-       ptr = *buf + sizeof(**hdr) + sizeof(**req);
-
-       (*hdr)->type =  OST_TYPE_REQ;
-
-       (*req)->buflen1 = NTOH__u32(buflen1);
-       if (buf1) { 
-               LOGL(buf1, buflen1, ptr); 
-       } 
-
-       (*req)->buflen2 = NTOH__u32(buflen2);
-       if (buf2) { 
-               LOGL(buf2, buflen2, ptr);
-       }
-       return 0;
-}
-
-int ost_unpack_req(char *buf, int len, 
-                  struct ptlreq_hdr **hdr, struct ost_req **req)
-{
-
-       if (len < sizeof(**hdr) + sizeof(**req)) { 
-               EXIT;
-               return -EINVAL;
-       }
-
-       *hdr = (struct ptlreq_hdr *) (buf);
-       *req = (struct ost_req *) (buf + sizeof(**hdr));
-
-       (*req)->buflen1 = NTOH__u32((*req)->buflen1); 
-       (*req)->buflen2 = NTOH__u32((*req)->buflen2); 
-
-       if (len < sizeof(**hdr) + sizeof(**req) + 
-            size_round((*req)->buflen1) + size_round((*req)->buflen2) ) { 
-               EXIT;
-               return -EINVAL;
-       }
-
-       EXIT;
-       return 0;
-}
-
-
-void *ost_req_buf1(struct ost_req *req)
-{
-        if (!req->buflen1) 
-                return NULL;
-        return (void *)((char *)req + sizeof(*req));
-}
-
-void *ost_req_buf2(struct ost_req *req)
-{
-        if (!req->buflen2) 
-                return NULL;
-        return (void *)((char *)req + sizeof(*req) + 
-                        size_round(req->buflen1)); 
-}
-
-int ost_pack_rep(void *buf1, __u32 buflen1, void *buf2, __u32 buflen2,
-                struct ptlrep_hdr **hdr, struct ost_rep **rep, 
-                int *len, char **buf)
-{
-       char *ptr;
-
-       *len = sizeof(**hdr) + size_round(buflen1) + size_round(buflen2) + 
-               sizeof(**rep); 
-
-       OBD_ALLOC(*buf, *len);
-       if (!*buf) {
-               EXIT;
-               return -ENOMEM;
-       }
-
-       memset(*buf, 0, *len); 
-       *hdr = (struct ptlrep_hdr *)(*buf);
-       *rep = (struct ost_rep *)(*buf + sizeof(**hdr));
-       ptr = *buf + sizeof(**hdr) + sizeof(**rep);
-
-       (*rep)->buflen1 = NTOH__u32(buflen1);
-       if (buf1) { 
-               LOGL(buf1, buflen1, ptr); 
-       } 
-
-       (*rep)->buflen2 = NTOH__u32(buflen2);
-       if (buf2) { 
-               LOGL(buf2, buflen2, ptr);
-       }
-       return 0;
-}
-
-
-int ost_unpack_rep(char *buf, int len, 
-                  struct ptlrep_hdr **hdr, struct ost_rep **rep)
-{
-       if (len < sizeof(**hdr) + sizeof(**rep)) { 
-               EXIT;
-               return -EINVAL;
-       }
-
-       *hdr = (struct ptlrep_hdr *) (buf);
-       *rep = (struct ost_rep *) (buf + sizeof(**hdr));
-
-       (*rep)->buflen1 = NTOH__u32((*rep)->buflen1); 
-       (*rep)->buflen2 = NTOH__u32((*rep)->buflen2); 
-
-       if (len < sizeof(**hdr) + sizeof(**rep) + 
-            size_round((*rep)->buflen1) + size_round((*rep)->buflen2) ) { 
-               EXIT;
-               return -EINVAL;
-       }
-
-       EXIT;
-       return 0;
-}
-
-void *ost_rep_buf1(struct ost_rep *rep)
-{
-        if (!rep->buflen1) 
-                return NULL;
-        return (void *)((char *)rep + sizeof(*rep));
-}
-
-void *ost_rep_buf2(struct ost_rep *rep)
-{
-        if (!rep->buflen2) 
-                return NULL;
-        return (void *)((char *)rep + sizeof(*rep) + 
-                        size_round(rep->buflen1)); 
-}
-
-void ost_pack_ioo(void **tmp, struct obdo *oa, int bufcnt)
-{
-        struct obd_ioobj *ioo = *tmp;
-        char *c = *tmp;
-        
-        ioo->ioo_id = NTOH__u64(oa->o_id); 
-        ioo->ioo_gr = NTOH__u64(oa->o_gr); 
-        ioo->ioo_type = NTOH__u64(oa->o_mode); 
-        ioo->ioo_bufcnt = NTOH__u32(bufcnt); 
-        *tmp = c + sizeof(*ioo); 
-}
-
-void ost_unpack_ioo(void **tmp, struct obd_ioobj **ioop)
-{
-        char *c = *tmp;
-        struct obd_ioobj *ioo = *tmp;
-        *ioop = *tmp;
-        
-        ioo->ioo_id = NTOH__u64(ioo->ioo_id); 
-        ioo->ioo_gr = NTOH__u64(ioo->ioo_gr); 
-        ioo->ioo_type = NTOH__u64(ioo->ioo_type); 
-        ioo->ioo_bufcnt = NTOH__u32(ioo->ioo_bufcnt); 
-        *tmp = c + sizeof(*ioo); 
-}
-
-void ost_pack_niobuf(void **tmp, void *addr, __u64 offset, __u32 len, 
-                   __u32 flags)
-{
-        struct niobuf *ioo = *tmp;
-        char *c = *tmp;
-
-        ioo->addr = NTOH__u64((__u64)(unsigned long)addr); 
-        ioo->offset = NTOH__u64(offset); 
-        ioo->len = NTOH__u32(len); 
-        ioo->flags = NTOH__u32(flags); 
-        *tmp = c + sizeof(*ioo); 
-}
-
-void ost_unpack_niobuf(void **tmp, struct niobuf **nbp)
-{
-        char *c = *tmp;
-        struct niobuf *nb = *tmp;
-
-        *nbp = *tmp;
-
-        nb->addr = NTOH__u64(nb->addr); 
-        nb->offset = NTOH__u64(nb->offset); 
-        nb->len = NTOH__u32(nb->len); 
-        nb->flags = NTOH__u32(nb->flags); 
-
-        *tmp = c + sizeof(*nb); 
-}
diff --git a/lustre/lib/page.c b/lustre/lib/page.c
deleted file mode 100644 (file)
index 8f1437e..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * Copyright (C) 2001, 2002 Cluster File Systems, Inc.
- *
- *   This file is part of Lustre, http://www.sf.net/projects/lustre/
- *
- *   Lustre is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   Lustre is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with Lustre; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#include <linux/config.h>
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/string.h>
-#include <linux/stat.h>
-#include <linux/errno.h>
-#include <linux/locks.h>
-#include <linux/unistd.h>
-
-#include <asm/system.h>
-#include <asm/uaccess.h>
-
-#include <linux/fs.h>
-#include <linux/stat.h>
-#include <asm/uaccess.h>
-#include <asm/segment.h>
-#include <linux/mm.h>
-#include <linux/pagemap.h>
-#include <linux/smp_lock.h>
-
-#define DEBUG_SUBSYSTEM S_OST
-
-#include <linux/obd_support.h>
-#include <linux/lustre_lib.h>
-#include <linux/lustre_idl.h>
-#include <linux/lustre_mds.h>
-#include <linux/lustre_light.h>
-
-/*
- * Remove page from dirty list
- */
-static void __set_page_clean(struct page *page)
-{
-       struct address_space *mapping = page->mapping;
-       struct inode *inode;
-       
-       if (!mapping)
-               return;
-
-       spin_lock(&pagecache_lock);
-       list_del(&page->list);
-       list_add(&page->list, &mapping->clean_pages);
-
-       inode = mapping->host;
-       if (list_empty(&mapping->dirty_pages)) { 
-               CDEBUG(D_INODE, "inode clean\n");
-               inode->i_state &= ~I_DIRTY_PAGES;
-       }
-       spin_unlock(&pagecache_lock);
-       EXIT;
-}
-
-inline void set_page_clean(struct page *page)
-{
-       if (PageDirty(page)) { 
-               ClearPageDirty(page);
-               __set_page_clean(page);
-       }
-}
-
-inline void lustre_put_page(struct page *page)
-{
-       kunmap(page);
-       page_cache_release(page);
-}
-
-struct page * lustre_get_page(struct inode *dir, unsigned long n)
-{
-       struct address_space *mapping = dir->i_mapping;
-       struct page *page = read_cache_page(mapping, n,
-                               (filler_t*)mapping->a_ops->readpage, NULL);
-       if (!IS_ERR(page)) {
-               wait_on_page(page);
-               kmap(page);
-               if (!Page_Uptodate(page))
-                       goto fail;
-               if (PageError(page))
-                       goto fail;
-       }
-       return page;
-
-fail:
-       lustre_put_page(page);
-       return ERR_PTR(-EIO);
-}
-
-int lustre_prepare_page(unsigned from, unsigned to, struct page *page)
-{
-       int err;
-
-       lock_page(page);
-       err = page->mapping->a_ops->prepare_write(NULL, page, from, to);
-       if (err) { 
-                CERROR("page index %ld from %d to %d err %d\n", 
-                                page->index, from, to, err); 
-        }
-        return err;
-}
-
-int lustre_commit_page(struct page *page, unsigned from, unsigned to)
-{
-       struct inode *dir = page->mapping->host;
-       int err = 0;
-
-       SetPageUptodate(page);
-       set_page_clean(page);
-
-       page->mapping->a_ops->commit_write(NULL, page, from, to);
-       if (IS_SYNC(dir))
-               err = waitfor_one_page(page);
-       UnlockPage(page);
-       lustre_put_page(page);
-       return err;
-}
diff --git a/lustre/llite/.cvsignore b/lustre/llite/.cvsignore
deleted file mode 100644 (file)
index e530020..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-.Xrefs
-config.log
-config.status
-configure
-Makefile
-Makefile.in
-.deps
-TAGS
diff --git a/lustre/llite/Makefile.am b/lustre/llite/Makefile.am
deleted file mode 100644 (file)
index bf574b9..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright (C) 2001  Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-
-DEFS:= 
-
-MODULE = llight
-modulefs_DATA = llight.o
-EXTRA_PROGRAMS = llight
-
-page.c: 
-       -ln -s ../lib/page.c
-
-
-llight_SOURCES =  page.c super.c rw.c file.c dir.c sysctl.c namei.c symlink.c
-
-include $(top_srcdir)/Rules
diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c
deleted file mode 100644 (file)
index 1cf2604..0000000
+++ /dev/null
@@ -1,706 +0,0 @@
-/*
- *
- * Copyright (C) 1992, 1993, 1994, 1995
- * Remy Card (card@masi.ibp.fr)
- * Laboratoire MASI - Institut Blaise Pascal
- * Universite Pierre et Marie Curie (Paris VI)
- *
- *  from
- *
- *  linux/fs/minix/dir.c
- *  linux/fs/ext2/dir.c
- *
- *  Copyright (C) 1991, 1992  Linus Torvalds
- *
- *  ext2 directory handling functions
- *
- *  Big-endian to little-endian byte-swapping/bitmaps by
- *        David S. Miller (davem@caip.rutgers.edu), 1995
- *
- *  All code that works with directory layout had been switched to pagecache
- *  and moved here. AV
- *   
- *  Adapted for Lustre Light
- *  Copyright (C) 2002, Cluster File Systems, Inc.
- * 
- */
-
-#include <linux/fs.h>
-#include <linux/ext2_fs.h>
-#include <linux/pagemap.h>
-#include <linux/mm.h>
-#include <linux/locks.h>
-#include <asm/uaccess.h>
-
-#define DEBUG_SUBSYSTEM S_LLIGHT
-
-#include <linux/obd_support.h>
-#include <linux/lustre_lib.h>
-#include <linux/lustre_idl.h>
-#include <linux/lustre_mds.h>
-#include <linux/lustre_light.h>
-
-typedef struct ext2_dir_entry_2 ext2_dirent;
-
-#define PageChecked(page)        test_bit(PG_checked, &(page)->flags)
-#define SetPageChecked(page)     set_bit(PG_checked, &(page)->flags)
-
-
-static int ll_dir_prepare_write(struct file *file, struct page *page, unsigned from, unsigned to)
-{
-       return 0;
-}
-
-/* returns the page unlocked, but with a reference */
-static int ll_dir_readpage(struct file *file, struct page *page)
-{
-       struct inode *inode = page->mapping->host;
-        struct ll_sb_info *sbi = ll_i2sbi(inode);
-       char *buf;
-       __u64 offset;
-        int rc = 0;
-       struct ptlrep_hdr *hdr;
-
-        ENTRY;
-
-       if ( ((inode->i_size + PAGE_CACHE_SIZE -1)>>PAGE_SHIFT) 
-            <= page->index) {
-               memset(kmap(page), 0, PAGE_CACHE_SIZE);
-               kunmap(page);
-               goto readpage_out;
-       }
-
-       if (Page_Uptodate(page)) {
-               EXIT;
-               goto readpage_out;
-       }
-
-       offset = page->index << PAGE_SHIFT; 
-       buf = kmap(page);
-        rc = mdc_readpage(&sbi->ll_mds_client, inode->i_ino, S_IFDIR, offset, 
-                         buf, NULL, &hdr);
-       kunmap(page); 
-        if ( rc ) {
-               EXIT; 
-               goto readpage_out;
-        } 
-
-       if ((rc = hdr->status)) {
-               EXIT;
-               goto readpage_out;
-       }
-
-        /* PDEBUG(page, "READ"); */
-
-       SetPageUptodate(page);
- readpage_out:
-       obd_unlock_page(page);
-        EXIT;
-        return rc;
-} /* ll_dir_readpage */
-
-struct address_space_operations ll_dir_aops = {
-        readpage: ll_dir_readpage,
-        prepare_write: ll_dir_prepare_write
-};
-
-int waitfor_one_page(struct page *page)
-{
-       int error = 0;
-       struct buffer_head *bh, *head = page->buffers;
-
-       bh = head;
-       do {
-               wait_on_buffer(bh);
-               if (buffer_req(bh) && !buffer_uptodate(bh))
-                       error = -EIO;
-       } while ((bh = bh->b_this_page) != head);
-       return error;
-}
-
-/*
- * ext2 uses block-sized chunks. Arguably, sector-sized ones would be
- * more robust, but we have what we have
- */
-static inline unsigned ext2_chunk_size(struct inode *inode)
-{
-       //return inode->i_sb->s_blocksize;
-       return PAGE_SIZE;
-}
-
-static inline void ext2_put_page(struct page *page)
-{
-       kunmap(page);
-       page_cache_release(page);
-}
-
-static inline unsigned long dir_pages(struct inode *inode)
-{
-       return (inode->i_size+PAGE_CACHE_SIZE-1)>>PAGE_CACHE_SHIFT;
-}
-
-extern void set_page_clean(struct page *page); 
-
-static int ext2_commit_chunk(struct page *page, unsigned from, unsigned to)
-{
-       struct inode *dir = page->mapping->host;
-       int err = 0;
-
-       dir->i_version = ++event;
-       dir->i_size = (page->index << PAGE_CACHE_SHIFT) + to; 
-       SetPageUptodate(page);
-       set_page_clean(page);
-
-       //page->mapping->a_ops->commit_write(NULL, page, from, to);
-       //if (IS_SYNC(dir))
-       //      err = waitfor_one_page(page);
-       return err;
-}
-
-static void ext2_check_page(struct page *page)
-{
-       struct inode *dir = page->mapping->host;
-       unsigned chunk_size = ext2_chunk_size(dir);
-       char *kaddr = page_address(page);
-       //      u32 max_inumber = le32_to_cpu(sb->u.ext2_sb.s_es->s_inodes_count);
-       unsigned offs, rec_len;
-       unsigned limit = PAGE_CACHE_SIZE;
-       ext2_dirent *p;
-       char *error;
-
-       if ((dir->i_size >> PAGE_CACHE_SHIFT) == page->index) {
-               limit = dir->i_size & ~PAGE_CACHE_MASK;
-               if (limit & (chunk_size - 1)) {
-                       CERROR("limit %d dir size %lld index %ld\n", 
-                                       limit, dir->i_size, page->index); 
-                       goto Ebadsize;
-               }
-               for (offs = limit; offs<PAGE_CACHE_SIZE; offs += chunk_size) {
-                       ext2_dirent *p = (ext2_dirent*)(kaddr + offs);
-                       p->rec_len = cpu_to_le16(chunk_size);
-               }
-               if (!limit)
-                       goto out;
-       }
-       for (offs = 0; offs <= limit - EXT2_DIR_REC_LEN(1); offs += rec_len) {
-               p = (ext2_dirent *)(kaddr + offs);
-               rec_len = le16_to_cpu(p->rec_len);
-
-               if (rec_len < EXT2_DIR_REC_LEN(1))
-                       goto Eshort;
-               if (rec_len & 3)
-                       goto Ealign;
-               if (rec_len < EXT2_DIR_REC_LEN(p->name_len))
-                       goto Enamelen;
-               if (((offs + rec_len - 1) ^ offs) & ~(chunk_size-1))
-                       goto Espan;
-               //              if (le32_to_cpu(p->inode) > max_inumber)
-               //goto Einumber;
-       }
-       if (offs != limit)
-               goto Eend;
-out:
-       SetPageChecked(page);
-       return;
-
-       /* Too bad, we had an error */
-
-Ebadsize:
-       CERROR("ext2_check_page"
-               "size of directory #%lu is not a multiple of chunk size\n",
-               dir->i_ino
-       );
-       goto fail;
-Eshort:
-       error = "rec_len is smaller than minimal";
-       goto bad_entry;
-Ealign:
-       error = "unaligned directory entry";
-       goto bad_entry;
-Enamelen:
-       error = "rec_len is too small for name_len";
-       goto bad_entry;
-Espan:
-       error = "directory entry across blocks";
-       goto bad_entry;
-       //Einumber:
-       // error = "inode out of bounds";
-bad_entry:
-       CERROR("ext2_check_page: bad entry in directory #%lu: %s - "
-               "offset=%lu, inode=%lu, rec_len=%d, name_len=%d",
-               dir->i_ino, error, (page->index<<PAGE_CACHE_SHIFT)+offs,
-               (unsigned long) le32_to_cpu(p->inode),
-               rec_len, p->name_len);
-       goto fail;
-Eend:
-       p = (ext2_dirent *)(kaddr + offs);
-       CERROR("ext2_check_page"
-               "entry in directory #%lu spans the page boundary"
-               "offset=%lu, inode=%lu",
-               dir->i_ino, (page->index<<PAGE_CACHE_SHIFT)+offs,
-               (unsigned long) le32_to_cpu(p->inode));
-fail:
-       SetPageChecked(page);
-       SetPageError(page);
-}
-
-static struct page * ext2_get_page(struct inode *dir, unsigned long n)
-{
-       struct address_space *mapping = dir->i_mapping;
-       struct page *page = read_cache_page(mapping, n,
-                               (filler_t*)mapping->a_ops->readpage, NULL);
-       if (!IS_ERR(page)) {
-               wait_on_page(page);
-               kmap(page);
-               if (!Page_Uptodate(page))
-                       goto fail;
-               if (!PageChecked(page))
-                       ext2_check_page(page);
-               if (PageError(page))
-                       goto fail;
-       }
-       return page;
-
-fail:
-       ext2_put_page(page);
-       return ERR_PTR(-EIO);
-}
-
-/*
- * NOTE! unlike strncmp, ext2_match returns 1 for success, 0 for failure.
- *
- * len <= EXT2_NAME_LEN and de != NULL are guaranteed by caller.
- */
-static inline int ext2_match (int len, const char * const name,
-                                       struct ext2_dir_entry_2 * de)
-{
-       if (len != de->name_len)
-               return 0;
-       if (!de->inode)
-               return 0;
-       return !memcmp(name, de->name, len);
-}
-
-/*
- * p is at least 6 bytes before the end of page
- */
-static inline ext2_dirent *ext2_next_entry(ext2_dirent *p)
-{
-       return (ext2_dirent *)((char*)p + le16_to_cpu(p->rec_len));
-}
-
-static inline unsigned 
-ext2_validate_entry(char *base, unsigned offset, unsigned mask)
-{
-       ext2_dirent *de = (ext2_dirent*)(base + offset);
-       ext2_dirent *p = (ext2_dirent*)(base + (offset&mask));
-       while ((char*)p < (char*)de)
-               p = ext2_next_entry(p);
-       return (char *)p - base;
-}
-
-static unsigned char ext2_filetype_table[EXT2_FT_MAX] = {
-       [EXT2_FT_UNKNOWN]       DT_UNKNOWN,
-       [EXT2_FT_REG_FILE]      DT_REG,
-       [EXT2_FT_DIR]           DT_DIR,
-       [EXT2_FT_CHRDEV]        DT_CHR,
-       [EXT2_FT_BLKDEV]        DT_BLK,
-       [EXT2_FT_FIFO]          DT_FIFO,
-       [EXT2_FT_SOCK]          DT_SOCK,
-       [EXT2_FT_SYMLINK]       DT_LNK,
-};
-
-static unsigned int ll_dt2fmt[DT_WHT + 1] = {
-       [EXT2_FT_UNKNOWN]       0, 
-       [EXT2_FT_REG_FILE]      S_IFREG,
-       [EXT2_FT_DIR]           S_IFDIR,
-       [EXT2_FT_CHRDEV]        S_IFCHR,
-       [EXT2_FT_BLKDEV]        S_IFBLK, 
-       [EXT2_FT_FIFO]          S_IFIFO,
-       [EXT2_FT_SOCK]          S_IFSOCK,
-       [EXT2_FT_SYMLINK]       S_IFLNK
-};
-       
-#define S_SHIFT 12
-static unsigned char ext2_type_by_mode[S_IFMT >> S_SHIFT] = {
-       [S_IFREG >> S_SHIFT]    EXT2_FT_REG_FILE,
-       [S_IFDIR >> S_SHIFT]    EXT2_FT_DIR,
-       [S_IFCHR >> S_SHIFT]    EXT2_FT_CHRDEV,
-       [S_IFBLK >> S_SHIFT]    EXT2_FT_BLKDEV,
-       [S_IFIFO >> S_SHIFT]    EXT2_FT_FIFO,
-       [S_IFSOCK >> S_SHIFT]   EXT2_FT_SOCK,
-       [S_IFLNK >> S_SHIFT]    EXT2_FT_SYMLINK,
-};
-
-static inline void ext2_set_de_type(ext2_dirent *de, struct inode *inode)
-{
-       mode_t mode = inode->i_mode;
-       de->file_type = ext2_type_by_mode[(mode & S_IFMT)>>S_SHIFT];
-}
-
-int
-new_ll_readdir (struct file * filp, void * dirent, filldir_t filldir)
-{
-       loff_t pos = filp->f_pos;
-       struct inode *inode = filp->f_dentry->d_inode;
-       // XXX struct super_block *sb = inode->i_sb;
-       unsigned offset = pos & ~PAGE_CACHE_MASK;
-       unsigned long n = pos >> PAGE_CACHE_SHIFT;
-       unsigned long npages = dir_pages(inode);
-       unsigned chunk_mask = ~(ext2_chunk_size(inode)-1);
-       unsigned char *types = NULL;
-       int need_revalidate = (filp->f_version != inode->i_version);
-
-       if (pos > inode->i_size - EXT2_DIR_REC_LEN(1))
-               goto done;
-
-       types = ext2_filetype_table;
-
-       for ( ; n < npages; n++, offset = 0) {
-               char *kaddr, *limit;
-               ext2_dirent *de;
-               struct page *page = ext2_get_page(inode, n);
-
-               if (IS_ERR(page))
-                       continue;
-               kaddr = page_address(page);
-               if (need_revalidate) {
-                       offset = ext2_validate_entry(kaddr, offset, chunk_mask);
-                       need_revalidate = 0;
-               }
-               de = (ext2_dirent *)(kaddr+offset);
-               limit = kaddr + PAGE_CACHE_SIZE - EXT2_DIR_REC_LEN(1);
-               for ( ;(char*)de <= limit; de = ext2_next_entry(de))
-                       if (de->inode) {
-                               int over;
-                               unsigned char d_type = DT_UNKNOWN;
-
-                               if (types && de->file_type < EXT2_FT_MAX)
-                                       d_type = types[de->file_type];
-
-                               offset = (char *)de - kaddr;
-                               over = filldir(dirent, de->name, de->name_len,
-                                               (n<<PAGE_CACHE_SHIFT) | offset,
-                                               le32_to_cpu(de->inode), d_type);
-                               if (over) {
-                                       ext2_put_page(page);
-                                       goto done;
-                               }
-                       }
-               ext2_put_page(page);
-       }
-
-done:
-       filp->f_pos = (n << PAGE_CACHE_SHIFT) | offset;
-       filp->f_version = inode->i_version;
-       UPDATE_ATIME(inode);
-       return 0;
-}
-
-/*
- *     ext2_find_entry()
- *
- * finds an entry in the specified directory with the wanted name. It
- * returns the page in which the entry was found, and the entry itself
- * (as a parameter - res_dir). Page is returned mapped and unlocked.
- * Entry is guaranteed to be valid.
- */
-struct ext2_dir_entry_2 * ext2_find_entry (struct inode * dir,
-                       struct dentry *dentry, struct page ** res_page)
-{
-       const char *name = dentry->d_name.name;
-       int namelen = dentry->d_name.len;
-       unsigned reclen = EXT2_DIR_REC_LEN(namelen);
-       unsigned long start, n;
-       unsigned long npages = dir_pages(dir);
-       struct page *page = NULL;
-       ext2_dirent * de;
-
-       /* OFFSET_CACHE */
-       *res_page = NULL;
-
-       //      start = dir->u.ext2_i.i_dir_start_lookup;
-       start = 0;
-       if (start >= npages)
-               start = 0;
-       n = start;
-       do {
-               char *kaddr;
-               page = ext2_get_page(dir, n);
-               if (!IS_ERR(page)) {
-                       kaddr = page_address(page);
-                       de = (ext2_dirent *) kaddr;
-                       kaddr += PAGE_CACHE_SIZE - reclen;
-                       while ((char *) de <= kaddr) {
-                               if (ext2_match (namelen, name, de))
-                                       goto found;
-                               de = ext2_next_entry(de);
-                       }
-                       ext2_put_page(page);
-               }
-               if (++n >= npages)
-                       n = 0;
-       } while (n != start);
-       return NULL;
-
-found:
-       *res_page = page;
-       //      dir->u.ext2_i.i_dir_start_lookup = n;
-       return de;
-}
-
-struct ext2_dir_entry_2 * ext2_dotdot (struct inode *dir, struct page **p)
-{
-       struct page *page = ext2_get_page(dir, 0);
-       ext2_dirent *de = NULL;
-
-       if (!IS_ERR(page)) {
-               de = ext2_next_entry((ext2_dirent *) page_address(page));
-               *p = page;
-       }
-       return de;
-}
-
-ino_t ll_inode_by_name(struct inode * dir, struct dentry *dentry, int *type)
-{
-       ino_t res = 0;
-       struct ext2_dir_entry_2 * de;
-       struct page *page;
-       
-       de = ext2_find_entry (dir, dentry, &page);
-       if (de) {
-               res = le32_to_cpu(de->inode);
-               *type = ll_dt2fmt[de->file_type];
-               kunmap(page);
-               page_cache_release(page);
-       }
-       return res;
-}
-
-/* Releases the page */
-void ext2_set_link(struct inode *dir, struct ext2_dir_entry_2 *de,
-                       struct page *page, struct inode *inode)
-{
-       unsigned from = (char *) de - (char *) page_address(page);
-       unsigned to = from + le16_to_cpu(de->rec_len);
-       int err;
-
-       lock_page(page);
-       err = page->mapping->a_ops->prepare_write(NULL, page, from, to);
-       if (err)
-               BUG();
-       de->inode = cpu_to_le32(inode->i_ino);
-       ext2_set_de_type (de, inode);
-       dir->i_mtime = dir->i_ctime = CURRENT_TIME;
-       err = ext2_commit_chunk(page, from, to);
-       UnlockPage(page);
-       ext2_put_page(page);
-}
-
-/*
- *     Parent is locked.
- */
-int ll_add_link (struct dentry *dentry, struct inode *inode)
-{
-       struct inode *dir = dentry->d_parent->d_inode;
-       const char *name = dentry->d_name.name;
-       int namelen = dentry->d_name.len;
-       unsigned reclen = EXT2_DIR_REC_LEN(namelen);
-       unsigned short rec_len, name_len;
-       struct page *page = NULL;
-       ext2_dirent * de;
-       unsigned long npages = dir_pages(dir);
-       unsigned long n;
-       char *kaddr;
-       unsigned from, to;
-       int err;
-
-       /* We take care of directory expansion in the same loop */
-       for (n = 0; n <= npages; n++) {
-               page = ext2_get_page(dir, n);
-               err = PTR_ERR(page);
-               if (IS_ERR(page))
-                       goto out;
-               kaddr = page_address(page);
-               de = (ext2_dirent *)kaddr;
-               kaddr += PAGE_CACHE_SIZE - reclen;
-               while ((char *)de <= kaddr) {
-                       err = -EEXIST;
-                       if (ext2_match (namelen, name, de))
-                               goto out_page;
-                       name_len = EXT2_DIR_REC_LEN(de->name_len);
-                       rec_len = le16_to_cpu(de->rec_len);
-                       if ( n==npages && rec_len == 0) {
-                               CERROR("Fatal dir behaviour\n");
-                               goto out_page;
-                       }
-                       if (!de->inode && rec_len >= reclen)
-                               goto got_it;
-                       if (rec_len >= name_len + reclen)
-                               goto got_it;
-                       de = (ext2_dirent *) ((char *) de + rec_len);
-               }
-               ext2_put_page(page);
-       }
-       BUG();
-       return -EINVAL;
-
-got_it:
-       from = (char*)de - (char*)page_address(page);
-       to = from + rec_len;
-       lock_page(page);
-       err = page->mapping->a_ops->prepare_write(NULL, page, from, to);
-       if (err)
-               goto out_unlock;
-       if (de->inode) {
-               ext2_dirent *de1 = (ext2_dirent *) ((char *) de + name_len);
-               de1->rec_len = cpu_to_le16(rec_len - name_len);
-               de->rec_len = cpu_to_le16(name_len);
-               de = de1;
-       }
-       de->name_len = namelen;
-       memcpy (de->name, name, namelen);
-       de->inode = cpu_to_le32(inode->i_ino);
-       ext2_set_de_type (de, inode);
-       CDEBUG(D_INODE, "type set to %o\n", de->file_type);
-       dir->i_mtime = dir->i_ctime = CURRENT_TIME;
-       err = ext2_commit_chunk(page, from, to);
-
-       // change_inode happens with the commit_chunk
-       /* XXX OFFSET_CACHE */
-
-out_unlock:
-       UnlockPage(page);
-out_page:
-       ext2_put_page(page);
-out:
-       return err;
-}
-
-/*
- * ext2_delete_entry deletes a directory entry by merging it with the
- * previous entry. Page is up-to-date. Releases the page.
- */
-int ext2_delete_entry (struct ext2_dir_entry_2 * dir, struct page * page )
-{
-       struct address_space *mapping = page->mapping;
-       struct inode *inode = mapping->host;
-       char *kaddr = page_address(page);
-       unsigned from = ((char*)dir - kaddr) & ~(ext2_chunk_size(inode)-1);
-       unsigned to = ((char*)dir - kaddr) + le16_to_cpu(dir->rec_len);
-       ext2_dirent * pde = NULL;
-       ext2_dirent * de = (ext2_dirent *) (kaddr + from);
-       int err;
-
-       while ((char*)de < (char*)dir) {
-               pde = de;
-               de = ext2_next_entry(de);
-       }
-       if (pde)
-               from = (char*)pde - (char*)page_address(page);
-       lock_page(page);
-       err = mapping->a_ops->prepare_write(NULL, page, from, to);
-       if (err)
-               BUG();
-       if (pde)
-               pde->rec_len = cpu_to_le16(to-from);
-       dir->inode = 0;
-       inode->i_ctime = inode->i_mtime = CURRENT_TIME;
-       err = ext2_commit_chunk(page, from, to);
-       UnlockPage(page);
-       ext2_put_page(page);
-       return err;
-}
-
-/*
- * Set the first fragment of directory.
- */
-int ext2_make_empty(struct inode *inode, struct inode *parent)
-{
-       struct address_space *mapping = inode->i_mapping;
-       struct page *page = grab_cache_page(mapping, 0);
-       unsigned chunk_size = ext2_chunk_size(inode);
-       struct ext2_dir_entry_2 * de;
-       char *base;
-       int err;
-       ENTRY;
-
-       if (!page)
-               return -ENOMEM;
-       err = mapping->a_ops->prepare_write(NULL, page, 0, chunk_size);
-       if (err)
-               goto fail;
-
-       base = page_address(page);
-
-       de = (struct ext2_dir_entry_2 *) base;
-       de->name_len = 1;
-       de->rec_len = cpu_to_le16(EXT2_DIR_REC_LEN(1));
-       memcpy (de->name, ".\0\0", 4);
-       de->inode = cpu_to_le32(inode->i_ino);
-       ext2_set_de_type (de, inode);
-
-       de = (struct ext2_dir_entry_2 *) (base + EXT2_DIR_REC_LEN(1));
-       de->name_len = 2;
-       de->rec_len = cpu_to_le16(chunk_size - EXT2_DIR_REC_LEN(1));
-       de->inode = cpu_to_le32(parent->i_ino);
-       memcpy (de->name, "..\0", 4);
-       ext2_set_de_type (de, inode);
-
-       err = ext2_commit_chunk(page, 0, chunk_size);
-fail:
-       UnlockPage(page);
-       page_cache_release(page);
-       ENTRY;
-       return err;
-}
-
-/*
- * routine to check that the specified directory is empty (for rmdir)
- */
-int ext2_empty_dir (struct inode * inode)
-{
-       struct page *page = NULL;
-       unsigned long i, npages = dir_pages(inode);
-       
-       for (i = 0; i < npages; i++) {
-               char *kaddr;
-               ext2_dirent * de;
-               page = ext2_get_page(inode, i);
-
-               if (IS_ERR(page))
-                       continue;
-
-               kaddr = page_address(page);
-               de = (ext2_dirent *)kaddr;
-               kaddr += PAGE_CACHE_SIZE-EXT2_DIR_REC_LEN(1);
-
-               while ((char *)de <= kaddr) {
-                       if (de->inode != 0) {
-                               /* check for . and .. */
-                               if (de->name[0] != '.')
-                                       goto not_empty;
-                               if (de->name_len > 2)
-                                       goto not_empty;
-                               if (de->name_len < 2) {
-                                       if (de->inode !=
-                                           cpu_to_le32(inode->i_ino))
-                                               goto not_empty;
-                               } else if (de->name[1] != '.')
-                                       goto not_empty;
-                       }
-                       de = ext2_next_entry(de);
-               }
-               ext2_put_page(page);
-       }
-       return 1;
-
-not_empty:
-       ext2_put_page(page);
-       return 0;
-}
-
-struct file_operations ll_dir_operations = {
-        read: generic_read_dir,
-        readdir: new_ll_readdir
-};
diff --git a/lustre/llite/file.c b/lustre/llite/file.c
deleted file mode 100644 (file)
index d35a8f7..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- *  linux/fs/ext2/file.c
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- *
- * Copyright (C) 1992, 1993, 1994, 1995
- * Remy Card (card@masi.ibp.fr)
- * Laboratoire MASI - Institut Blaise Pascal
- * Universite Pierre et Marie Curie (Paris VI)
- *
- *  from
- *
- *  linux/fs/minix/file.c
- *
- *  Copyright (C) 1991, 1992  Linus Torvalds
- *
- *  ext2 fs regular file handling primitives
- *
- *  64-bit file support on 64-bit platforms by Jakub Jelinek
- *      (jj@sunsite.ms.mff.cuni.cz)
- */
-
-#include <asm/uaccess.h>
-#include <asm/system.h>
-
-#include <linux/errno.h>
-#include <linux/fs.h>
-#include <linux/fcntl.h>
-#include <linux/sched.h>
-#include <linux/stat.h>
-#include <linux/locks.h>
-#include <linux/mm.h>
-#include <linux/pagemap.h>
-#include <linux/smp_lock.h>
-
-#define DEBUG_SUBSYSTEM S_LLIGHT
-
-#include <linux/obd_support.h>
-#include <linux/lustre_light.h>
-
-extern int ll_setattr(struct dentry *de, struct iattr *attr);
-
-static inline void ll_remove_suid(struct inode *inode)
-{
-        unsigned int mode;
-
-        /* set S_IGID if S_IXGRP is set, and always set S_ISUID */
-        mode = (inode->i_mode & S_IXGRP)*(S_ISGID/S_IXGRP) | S_ISUID;
-
-        /* was any of the uid bits set? */
-        mode &= inode->i_mode;
-        if (mode && !capable(CAP_FSETID)) {
-                inode->i_mode &= ~mode;
-               // XXX careful here - we cannot change the size
-        }
-}
-
-/*
- * Write to a file (through the page cache).
- */
-static ssize_t
-ll_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
-{
-        ssize_t retval;
-        CDEBUG(D_INFO, "Writing inode %ld, %d bytes, offset %Ld\n",
-               file->f_dentry->d_inode->i_ino, count, *ppos);
-
-        retval = generic_file_write(file, buf, count, ppos);
-        CDEBUG(D_INFO, "Wrote %d\n", retval);
-
-       /* update mtime/ctime/atime here, NOT size */
-        if (retval > 0) {
-               struct iattr attr;
-               attr.ia_valid = ATTR_MTIME | ATTR_CTIME | ATTR_ATIME;
-               attr.ia_mtime = attr.ia_ctime = attr.ia_atime =
-                       CURRENT_TIME;
-                ll_setattr(file->f_dentry, &attr);
-        }
-        EXIT;
-        return retval;
-}
-
-
-/* XXX this does not need to do anything for data, it _does_ need to
-   call setattr */ 
-int ll_fsync(struct file *file, struct dentry *dentry, int data)
-{
-       return 0;
-}
-
-struct file_operations ll_file_operations = {
-        read: generic_file_read,
-        write: ll_file_write,
-        mmap: generic_file_mmap,
-       fsync: NULL
-};
-
-
-struct inode_operations ll_file_inode_operations = {
-        truncate: ll_truncate,
-       setattr: ll_setattr
-};
-
diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c
deleted file mode 100644 (file)
index 0d25f91..0000000
+++ /dev/null
@@ -1,568 +0,0 @@
-/*
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- *
- * Copyright (C) 1992, 1993, 1994, 1995
- * Remy Card (card@masi.ibp.fr)
- * Laboratoire MASI - Institut Blaise Pascal
- * Universite Pierre et Marie Curie (Paris VI)
- *
- *  from
- *
- *  linux/fs/ext2/namei.c
- *
- *  Copyright (C) 1991, 1992  Linus Torvalds
- *
- *  Big-endian to little-endian byte-swapping/bitmaps by
- *        David S. Miller (davem@caip.rutgers.edu), 1995
- *  Directory entry file type support and forward compatibility hooks
- *      for B-tree directories by Theodore Ts'o (tytso@mit.edu), 1998
- * 
- *  Changes for use in OBDFS
- *  Copyright (c) 1999, Seagate Technology Inc.
- *  Copyright (C) 2001, Cluster File Systems, Inc.
- *                       Rewritten based on recent ext2 page cache use.
- * 
- */
-
-#include <linux/fs.h>
-#include <linux/locks.h>
-#include <linux/quotaops.h>
-
-#define DEBUG_SUBSYSTEM S_LLIGHT
-
-#include <linux/obd_support.h>
-#include <linux/lustre_light.h>
-extern struct address_space_operations ll_aops;
-
-/* from super.c */
-extern void ll_change_inode(struct inode *inode);
-extern int ll_setattr(struct dentry *de, struct iattr *attr);
-
-/* from dir.c */
-extern int ll_add_link (struct dentry *dentry, struct inode *inode);
-ino_t ll_inode_by_name(struct inode * dir, struct dentry *dentry, int *typ);
-int ext2_make_empty(struct inode *inode, struct inode *parent);
-struct ext2_dir_entry_2 * ext2_find_entry (struct inode * dir,
-                  struct dentry *dentry, struct page ** res_page);
-int ext2_delete_entry (struct ext2_dir_entry_2 * dir, struct page * page );
-int ext2_empty_dir (struct inode * inode);
-struct ext2_dir_entry_2 * ext2_dotdot (struct inode *dir, struct page **p);
-void ext2_set_link(struct inode *dir, struct ext2_dir_entry_2 *de,
-                  struct page *page, struct inode *inode);
-
-/*
- * Couple of helper functions - make the code slightly cleaner.
- */
-static inline void ext2_inc_count(struct inode *inode)
-{
-       inode->i_nlink++;
-}
-
-/* postpone the disk update until the inode really goes away */ 
-static inline void ext2_dec_count(struct inode *inode)
-{
-       inode->i_nlink--;
-}
-
-static inline int ext2_add_nondir(struct dentry *dentry, struct inode *inode)
-{
-       int err;
-       err = ll_add_link(dentry, inode);
-       if (!err) {
-               d_instantiate(dentry, inode);
-               return 0;
-       }
-       ext2_dec_count(inode);
-       iput(inode);
-       return err;
-}
-
-/* methods */
-static struct dentry *ll_lookup(struct inode * dir, struct dentry *dentry)
-{
-       struct mds_rep *rep; 
-       struct ptlrep_hdr *hdr = NULL; 
-       struct inode * inode = NULL;
-        struct ll_sb_info *sbi = ll_i2sbi(dir);
-       int err;
-       int type;
-       ino_t ino;
-       
-        ENTRY;
-       if (dentry->d_name.len > EXT2_NAME_LEN)
-               return ERR_PTR(-ENAMETOOLONG);
-
-       ino = ll_inode_by_name(dir, dentry, &type);
-       if (!ino)
-               goto negative;
-
-       err = mdc_getattr(&sbi->ll_mds_client, ino, type,
-                         OBD_MD_FLNOTOBD|OBD_MD_FLBLOCKS, &rep, &hdr);
-        if ( err ) {
-                CERROR("obdo_fromid failed\n");
-                EXIT;
-                return ERR_PTR(-EACCES); 
-        }
-
-       inode = iget4(dir->i_sb, ino, NULL, rep);
-
-        /* FIXME: this is not the right way to get this size */
-        OBD_FREE(hdr, sizeof(struct ptlrep_hdr) + sizeof(struct mds_rep));
-
-       if (!inode) 
-               return ERR_PTR(-EACCES);
-
- negative:
-       d_add(dentry, inode);
-       return NULL;
-}
-
-
-/*
- * NOTE! unlike strncmp, ext2_match returns 1 for success, 0 for failure.
- *
- * `len <= EXT2_NAME_LEN' is guaranteed by caller.
- * `de != NULL' is guaranteed by caller.
- */
-static inline int ext2_match (int len, const char * const name,
-                       struct ext2_dir_entry_2 * de)
-{
-        if (len != de->name_len)
-                return 0;
-        if (!de->inode)
-                return 0;
-        return !memcmp(name, de->name, len);
-}
-
-static struct inode *ll_create_node(struct inode *dir, const char *name, 
-                                   int namelen, const char *tgt, int tgtlen, 
-                                   int mode, __u64 id)
-{
-        struct inode *inode;
-       struct mds_rep *rep;
-       struct ptlrep_hdr *hdr;
-        int err;
-       time_t time = CURRENT_TIME;
-        struct ll_sb_info *sbi = ll_i2sbi(dir);
-
-        ENTRY;
-
-       err = mdc_create(&sbi->ll_mds_client, dir, name, namelen, tgt, tgtlen,
-                        mode, id, 
-                        current->uid, current->gid, time, &rep, &hdr); 
-       if (err) { 
-                EXIT;
-               return ERR_PTR(err);
-       }
-       if ( hdr->status) {
-               EXIT;
-               return ERR_PTR(hdr->status);
-       }
-       rep->valid = OBD_MD_FLNOTOBD;
-
-       rep->objid = id; 
-       rep->nlink = 1;
-       rep->atime = rep->ctime = rep->mtime = time;
-       rep->mode = mode;
-        CDEBUG(D_INODE, "-- new_inode: objid %lld, ino %d, mode %o\n",
-              rep->objid, rep->ino, rep->mode); 
-
-        inode = iget4(dir->i_sb, rep->ino, NULL, rep);
-        if (IS_ERR(inode)) {
-                CERROR("new_inode -fatal:  %ld\n", PTR_ERR(inode));
-                EXIT;
-                return ERR_PTR(-EIO);
-        }
-
-        if (!list_empty(&inode->i_dentry)) {
-                CERROR("new_inode -fatal: aliases %d, ct %d lnk %d\n", 
-                      rep->ino, atomic_read(&inode->i_count), 
-                      inode->i_nlink);
-                iput(inode);
-                EXIT;
-                return ERR_PTR(-EIO);
-        }
-
-        EXIT;
-        return inode;
-} /* ll_new_inode */
-
-int ll_mdc_unlink(struct inode *dir, const char *name, int len)
-{
-       struct mds_rep *rep;
-       struct ptlrep_hdr *hdr;
-        int err;
-        struct ll_sb_info *sbi = ll_i2sbi(dir);
-
-        ENTRY;
-
-       err = mdc_unlink(&sbi->ll_mds_client, dir, name, len, &rep, &hdr); 
-
-       if (err) { 
-                EXIT;
-               return err;
-       }
-       if ( hdr->status) {
-               EXIT;
-               return hdr->status;
-       }
-
-        EXIT;
-       return 0;
-}
-
-int ll_mdc_link(struct dentry *src, struct inode *dir, 
-               const char *name, int len)
-{
-       struct mds_rep *rep;
-       struct ptlrep_hdr *hdr;
-        int err;
-        struct ll_sb_info *sbi = ll_i2sbi(dir);
-
-        ENTRY;
-
-       err = mdc_link(&sbi->ll_mds_client, src, dir, name, len, &rep, &hdr); 
-
-       if (err) { 
-                EXIT;
-               return err;
-       }
-       if ( hdr->status) {
-               EXIT;
-               return hdr->status;
-       }
-
-        EXIT;
-       return 0;
-}
-
-int ll_mdc_rename(struct inode *src, struct inode *tgt, 
-                 struct dentry *old, struct dentry *new)
-{
-       struct mds_rep *rep;
-       struct ptlrep_hdr *hdr;
-        int err;
-        struct ll_sb_info *sbi = ll_i2sbi(src);
-
-        ENTRY;
-
-       err = mdc_rename(&sbi->ll_mds_client, src, tgt, 
-                        old->d_name.name, old->d_name.len, 
-                        new->d_name.name, new->d_name.len, 
-                        &rep, &hdr); 
-
-       if (err) { 
-                EXIT;
-               return err;
-       }
-       if ( hdr->status) {
-               EXIT;
-               return hdr->status;
-       }
-
-        EXIT;
-       return 0;
-}
-
-/*
- * By the time this is called, we already have created
- * the directory cache entry for the new file, but it
- * is so far negative - it has no inode.
- *
- * If the create succeeds, we fill in the inode information
- * with d_instantiate(). 
- */
-static int ll_create (struct inode * dir, struct dentry * dentry, int mode)
-{
-       int err; 
-       struct obdo oa;
-       struct inode * inode;
-
-       memset(&oa, 0, sizeof(oa)); 
-       oa.o_valid = OBD_MD_FLMODE; 
-       oa.o_mode = S_IFREG | 0600;
-       err = obd_create(ll_i2obdconn(dir), &oa);  
-       if (err) { 
-               EXIT; 
-               return err;
-       }
-
-       mode = mode | S_IFREG;
-        CDEBUG(D_DENTRY, "name %s mode %o\n", dentry->d_name.name, mode);
-       inode = ll_create_node(dir, dentry->d_name.name, dentry->d_name.len, 
-                              NULL, 0,
-                              mode, oa.o_id);
-       err = PTR_ERR(inode);
-       if (!IS_ERR(inode)) {
-               // XXX clean up the object
-               inode->i_op = &ll_file_inode_operations;
-               inode->i_fop = &ll_file_operations;
-               inode->i_mapping->a_ops = &ll_aops;
-               err = ext2_add_nondir(dentry, inode);
-       }
-       EXIT;
-       return err;
-} /* ll_create */
-
-
-static int ll_mknod (struct inode * dir, struct dentry *dentry, int mode, int rdev)
-{
-       struct inode * inode = ll_create_node(dir, dentry->d_name.name, 
-                                             dentry->d_name.len, NULL, 0,
-                                             mode, 0);
-       int err = PTR_ERR(inode);
-       if (!IS_ERR(inode)) {
-               init_special_inode(inode, mode, rdev);
-               err = ext2_add_nondir(dentry, inode);
-       }
-       return err;
-}
-
-static int ll_symlink (struct inode * dir, struct dentry * dentry,
-       const char * symname)
-{
-       int err = -ENAMETOOLONG;
-       unsigned l = strlen(symname);
-       struct inode * inode;
-        struct ll_inode_info *oinfo;
-
-       if (l > LL_INLINESZ)
-               return err;
-
-       inode = ll_create_node(dir, dentry->d_name.name, 
-                              dentry->d_name.len, symname, l,
-                              S_IFLNK | S_IRWXUGO, 0);
-       err = PTR_ERR(inode);
-       if (IS_ERR(inode))
-               return err;
-
-        oinfo = ll_i2info(inode);
-       
-       inode->i_op = &ll_fast_symlink_inode_operations;
-       memcpy(oinfo->lli_inline, symname, l);
-       inode->i_size = l-1;
-
-       err = ext2_add_nondir(dentry, inode);
-
-       if (err) { 
-               ext2_dec_count(inode);
-               iput (inode);
-       }
-       return err;
-}
-
-static int ll_link (struct dentry * old_dentry, struct inode * dir,
-       struct dentry *dentry)
-{
-       int err;
-       struct inode *inode = old_dentry->d_inode;
-
-       if (S_ISDIR(inode->i_mode))
-               return -EPERM;
-
-       if (inode->i_nlink >= EXT2_LINK_MAX)
-               return -EMLINK;
-
-       err = ll_mdc_link(old_dentry, dir, 
-                         dentry->d_name.name, dentry->d_name.len);
-       if (err) { 
-               EXIT;
-               return err;
-       }
-
-       inode->i_ctime = CURRENT_TIME;
-       ext2_inc_count(inode);
-       atomic_inc(&inode->i_count);
-
-       return ext2_add_nondir(dentry, inode);
-}
-
-
-static int ll_mkdir(struct inode * dir, struct dentry * dentry, int mode)
-{
-       struct inode * inode;
-       int err = -EMLINK;
-       ENTRY;
-
-       if (dir->i_nlink >= EXT2_LINK_MAX)
-               goto out;
-
-       ext2_inc_count(dir);
-
-       inode = ll_create_node (dir, dentry->d_name.name, 
-                               dentry->d_name.len, NULL, 0, 
-                               S_IFDIR | mode, 0);
-       err = PTR_ERR(inode);
-       if (IS_ERR(inode))
-               goto out_dir;
-
-       inode->i_op = &ll_dir_inode_operations;
-       inode->i_fop = &ll_dir_operations;
-       inode->i_mapping->a_ops = &ll_aops;
-       inode->i_nlink = 1;
-       ext2_inc_count(inode);
-
-       err = ext2_make_empty(inode, dir);
-       if (err)
-               goto out_fail;
-
-       err = ll_add_link(dentry, inode);
-       if (err)
-               goto out_fail;
-
-       d_instantiate(dentry, inode);
-out:
-       EXIT;
-       return err;
-
-out_fail:
-       ext2_dec_count(inode);
-       ext2_dec_count(inode);
-       iput(inode);
-       EXIT;
-out_dir:
-       ext2_dec_count(dir);
-       EXIT;
-       goto out;
-}
-
-static int ll_unlink(struct inode * dir, struct dentry *dentry)
-{
-       struct inode * inode = dentry->d_inode;
-       struct ext2_dir_entry_2 * de;
-       struct page * page;
-       int err = -ENOENT;
-
-       de = ext2_find_entry (dir, dentry, &page);
-       if (!de)
-               goto out;
-       
-       err = ll_mdc_unlink(dir, dentry->d_name.name, dentry->d_name.len);
-       if (err) 
-               goto out;
-
-
-       err = ext2_delete_entry (de, page);
-       if (err)
-               goto out;
-
-       inode->i_ctime = dir->i_ctime;
-       ext2_dec_count(inode);
-       err = 0;
-out:
-       return err;
-}
-
-
-static int ll_rmdir (struct inode * dir, struct dentry *dentry)
-{
-       struct inode * inode = dentry->d_inode;
-       int err = -ENOTEMPTY;
-
-       if (ext2_empty_dir(inode)) {
-               err = ll_unlink(dir, dentry);
-               if (!err) {
-                       inode->i_size = 0;
-                       ext2_dec_count(inode);
-                       ext2_dec_count(dir);
-               }
-       }
-       return err;
-}
-
-static int ll_rename (struct inode * old_dir, struct dentry * old_dentry,
-       struct inode * new_dir, struct dentry * new_dentry )
-{
-       struct inode * old_inode = old_dentry->d_inode;
-       struct inode * new_inode = new_dentry->d_inode;
-       struct page * dir_page = NULL;
-       struct ext2_dir_entry_2 * dir_de = NULL;
-       struct page * old_page;
-       struct ext2_dir_entry_2 * old_de;
-       int err = -ENOENT;
-
-       err = ll_mdc_rename(old_dir, new_dir, old_dentry, new_dentry); 
-       if (err) 
-               goto out;
-
-       old_de = ext2_find_entry (old_dir, old_dentry, &old_page);
-       if (!old_de)
-               goto out;
-
-       if (S_ISDIR(old_inode->i_mode)) {
-               err = -EIO;
-               dir_de = ext2_dotdot(old_inode, &dir_page);
-               if (!dir_de)
-                       goto out_old;
-       }
-
-       if (new_inode) {
-               struct page *new_page;
-               struct ext2_dir_entry_2 *new_de;
-
-               err = -ENOTEMPTY;
-               if (dir_de && !ext2_empty_dir (new_inode))
-                       goto out_dir;
-
-               err = -ENOENT;
-               new_de = ext2_find_entry (new_dir, new_dentry, &new_page);
-               if (!new_de)
-                       goto out_dir;
-               ext2_inc_count(old_inode);
-               ext2_set_link(new_dir, new_de, new_page, old_inode);
-               new_inode->i_ctime = CURRENT_TIME;
-               if (dir_de)
-                       new_inode->i_nlink--;
-               ext2_dec_count(new_inode);
-       } else {
-               if (dir_de) {
-                       err = -EMLINK;
-                       if (new_dir->i_nlink >= EXT2_LINK_MAX)
-                               goto out_dir;
-               }
-               ext2_inc_count(old_inode);
-               err = ll_add_link(new_dentry, old_inode);
-               if (err) {
-                       ext2_dec_count(old_inode);
-                       goto out_dir;
-               }
-               if (dir_de)
-                       ext2_inc_count(new_dir);
-       }
-
-       ext2_delete_entry (old_de, old_page);
-       ext2_dec_count(old_inode);
-
-       if (dir_de) {
-               ext2_set_link(old_inode, dir_de, dir_page, new_dir);
-               ext2_dec_count(old_dir);
-       }
-       return 0;
-
-
-out_dir:
-       if (dir_de) {
-               kunmap(dir_page);
-               page_cache_release(dir_page);
-       }
-out_old:
-       kunmap(old_page);
-       page_cache_release(old_page);
-out:
-       return err;
-}
-
-struct inode_operations ll_dir_inode_operations = {
-       create:         ll_create,
-       lookup:         ll_lookup,
-       link:           ll_link,
-       unlink:         ll_unlink,
-       symlink:        ll_symlink,
-       mkdir:          ll_mkdir,
-       rmdir:          ll_rmdir,
-       mknod:          ll_mknod,
-       rename:         ll_rename,
-       setattr:        ll_setattr
-};
diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c
deleted file mode 100644 (file)
index 5380675..0000000
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
- * Lustre Light I/O Page Cache
- *
- * Copyright (C) 2002, Cluster File Systems, Inc. 
- */
-
-#include <linux/config.h>
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/string.h>
-#include <linux/stat.h>
-#include <linux/errno.h>
-#include <linux/locks.h>
-#include <linux/unistd.h>
-#include <linux/version.h>
-#include <asm/system.h>
-#include <asm/uaccess.h>
-
-#include <linux/fs.h>
-#include <linux/stat.h>
-#include <asm/uaccess.h>
-#include <asm/segment.h>
-#include <linux/mm.h>
-#include <linux/pagemap.h>
-#include <linux/smp_lock.h>
-
-#define DEBUG_SUBSYSTEM S_LLIGHT
-
-#include <linux/obd_support.h>
-#include <linux/lustre_lib.h>
-#include <linux/lustre_idl.h>
-#include <linux/lustre_mds.h>
-#include <linux/lustre_light.h>
-
-int ll_inode_setattr(struct inode *inode, struct iattr *attr, int do_trunc);
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,10))
-/*
- * Add a page to the dirty page list.
- */
-void __set_page_dirty(struct page *page)
-{
-        struct address_space *mapping;
-        spinlock_t *pg_lock;
-
-        pg_lock = PAGECACHE_LOCK(page);
-        spin_lock(pg_lock);
-
-        mapping = page->mapping;
-        spin_lock(&mapping->page_lock);
-
-        list_del(&page->list);
-        list_add(&page->list, &mapping->dirty_pages);
-
-        spin_unlock(&mapping->page_lock);
-        spin_unlock(pg_lock);
-
-        if (mapping->host)
-                mark_inode_dirty_pages(mapping->host);
-}
-#else
-/*
- * Add a page to the dirty page list.
- */
-void set_page_dirty(struct page *page)
-{
-       if (!test_and_set_bit(PG_dirty, &page->flags)) {
-               struct address_space *mapping = page->mapping;
-
-               if (mapping) {
-                       spin_lock(&pagecache_lock);
-                       list_del(&page->list);
-                       list_add(&page->list, &mapping->dirty_pages);
-                       spin_unlock(&pagecache_lock);
-
-                       if (mapping->host)
-                               mark_inode_dirty_pages(mapping->host);
-               }
-       }
-}
-#endif
-
-inline struct obdo * ll_oa_from_inode(struct inode *inode, int valid)
-{
-        struct ll_inode_info *oinfo = ll_i2info(inode);
-       struct obdo *oa = obdo_alloc();
-        if ( !oa ) {
-               CERROR("no memory to allocate obdo!\n"); 
-                return NULL;
-        }
-       oa->o_valid = valid;
-
-        if ( oa->o_valid & OBD_MD_FLID )
-                oa->o_id = oinfo->lli_objid;
-        if ( oa->o_valid & OBD_MD_FLATIME )
-                oa->o_atime = inode->i_atime;
-        if ( oa->o_valid & OBD_MD_FLMTIME )
-                oa->o_mtime = inode->i_mtime;
-        if ( oa->o_valid & OBD_MD_FLCTIME )
-                oa->o_ctime = inode->i_ctime;
-        if ( oa->o_valid & OBD_MD_FLSIZE )
-                oa->o_size = inode->i_size;
-        if ( oa->o_valid & OBD_MD_FLBLOCKS )   /* allocation of space */
-                oa->o_blocks = inode->i_blocks;
-        if ( oa->o_valid & OBD_MD_FLBLKSZ )
-                oa->o_blksize = inode->i_blksize;
-        if ( oa->o_valid & OBD_MD_FLMODE )
-                oa->o_mode = inode->i_mode;
-        if ( oa->o_valid & OBD_MD_FLUID )
-                oa->o_uid = inode->i_uid;
-        if ( oa->o_valid & OBD_MD_FLGID )
-                oa->o_gid = inode->i_gid;
-        if ( oa->o_valid & OBD_MD_FLFLAGS )
-                oa->o_flags = inode->i_flags;
-        if ( oa->o_valid & OBD_MD_FLNLINK )
-                oa->o_nlink = inode->i_nlink;
-        if ( oa->o_valid & OBD_MD_FLGENER ) 
-                oa->o_generation = inode->i_generation;
-
-        CDEBUG(D_INFO, "src inode %ld, dst obdo %ld valid 0x%08x\n",
-               inode->i_ino, (long)oa->o_id, oa->o_valid);
-#if 0
-       /* this will transfer metadata for the logical object to 
-          the oa: that metadata could contain the constituent objects
-       */
-       if (ll_has_inline(inode)) {
-                CDEBUG(D_INODE, "copying inline data from inode to obdo\n");
-                memcpy(oa->o_inline, oinfo->lli_inline, OBD_INLINESZ);
-                oa->o_obdflags |= OBD_FL_INLINEDATA;
-                oa->o_valid |= OBD_MD_FLINLINE;
-        }
-#endif
-       return oa;
-} /* ll_oa_from_inode */
-
-
-
-/*
- * Remove page from dirty list
- */
-void __set_page_clean(struct page *page)
-{
-       struct address_space *mapping = page->mapping;
-       struct inode *inode;
-       
-       if (!mapping)
-               return;
-
-       list_del(&page->list);
-       list_add(&page->list, &mapping->clean_pages);
-
-       inode = mapping->host;
-       if (list_empty(&mapping->dirty_pages)) { 
-               CDEBUG(D_INODE, "inode clean\n");
-               inode->i_state &= ~I_DIRTY_PAGES;
-       }
-       EXIT;
-}
-
-/* SYNCHRONOUS I/O to object storage for an inode */
-static int ll_brw(int rw, struct inode *inode, struct page *page, int create)
-{
-        obd_count        num_obdo = 1;
-        obd_count        bufs_per_obdo = 1;
-        struct obdo     *oa;
-        obd_size         count = PAGE_SIZE;
-        obd_off          offset = ((obd_off)page->index) << PAGE_SHIFT;
-        obd_flag         flags = create ? OBD_BRW_CREATE : 0;
-        int              err;
-
-        ENTRY;
-
-        oa = ll_oa_from_inode(inode, OBD_MD_FLNOTOBD);
-       if (!oa) { 
-               return -ENOMEM;
-       }
-        err = obd_brw(rw, ll_i2obdconn(inode), num_obdo, &oa, &bufs_per_obdo,
-                               &page, &count, &offset, &flags);
-
-        obdo_free(oa);
-        EXIT;
-        return err;
-} /* ll_brw */
-
-extern void set_page_clean(struct page *);
-
-
-
-/* returns the page unlocked, but with a reference */
-int ll_readpage(struct file *file, struct page *page)
-{
-       struct inode *inode = page->mapping->host;
-        int rc;
-
-        ENTRY;
-
-       if ( ((inode->i_size + PAGE_CACHE_SIZE -1)>>PAGE_SHIFT) 
-            <= page->index) {
-               memset(kmap(page), 0, PAGE_CACHE_SIZE);
-               kunmap(page);
-               goto readpage_out;
-       }
-
-       if (Page_Uptodate(page)) {
-               EXIT;
-               goto readpage_out;
-       }
-
-        rc = ll_brw(OBD_BRW_READ, inode, page, 0);
-        if ( rc ) {
-               EXIT; 
-               return rc;
-        } 
-
- readpage_out:
-       SetPageUptodate(page);
-       obd_unlock_page(page);
-        EXIT;
-        return 0;
-} /* ll_readpage */
-
-
-int ll_prepare_write(struct file *file, struct page *page, unsigned from, unsigned to)
-{
-        struct inode *inode = page->mapping->host;
-        obd_off offset = ((obd_off)page->index) << PAGE_SHIFT;
-        int rc = 0;
-        ENTRY; 
-        
-       kmap(page);
-        if (Page_Uptodate(page)) { 
-                EXIT;
-               goto prepare_done;
-        }
-
-        if ( (from <= offset) && (to >= offset + PAGE_SIZE) ) {
-                EXIT;
-                return 0;
-        }
-        
-        rc = ll_brw(OBD_BRW_READ, inode, page, 0);
-        if ( !rc ) {
-                SetPageUptodate(page);
-        } 
-
- prepare_done:
-       set_page_dirty(page);
-        EXIT;
-        return rc;
-}
-
-/* returns the page unlocked, but with a reference */
-int ll_writepage(struct page *page)
-{
-        struct inode *inode = page->mapping->host;
-        int err;
-        ENTRY;
-
-       err = ll_brw(OBD_BRW_WRITE, inode, page, 1);
-        if ( !err ) {
-                SetPageUptodate(page);
-               set_page_clean(page);
-       } else {
-               CERROR("ll_brw failure %d\n", err);
-       }
-        EXIT;
-       return err;
-}
-
-/* SYNCHRONOUS I/O to object storage for an inode -- object attr will be updated too */
-int ll_commit_write(struct file *file, struct page *page, 
-                   unsigned from, unsigned to)
-{
-       int create = 1;
-       struct inode *inode = page->mapping->host;
-        obd_count        num_obdo = 1;
-        obd_count        bufs_per_obdo = 1;
-        struct obdo     *oa;
-        obd_size         count = to;
-        obd_off          offset = (((obd_off)page->index) << PAGE_SHIFT);
-        obd_flag         flags = create ? OBD_BRW_CREATE : 0;
-        int              err;
-       struct iattr     iattr;
-
-        ENTRY;
-        oa = ll_oa_from_inode(inode, OBD_MD_FLNOTOBD);
-       if (! oa ) { 
-               return -ENOMEM;
-       }
-
-       CDEBUG(D_INODE, "commit_page writing (at %d) to %d, count %Ld\n", 
-              from, to, count);
-
-        err = obd_brw(OBD_BRW_WRITE, ll_i2obdconn(inode), num_obdo, &oa, &bufs_per_obdo,
-                     &page, &count, &offset, &flags);
-        if ( !err ) {
-                SetPageUptodate(page);
-               set_page_clean(page);
-       }
-        kunmap(page);
-
-       if (offset + to > inode->i_size) {
-               iattr.ia_valid = ATTR_SIZE;
-               iattr.ia_size = offset + to;
-               /* do NOT truncate */
-               err = ll_inode_setattr(inode, &iattr, 0);
-               if (err) {
-                       CERROR("failed - %d.\n", err);
-                       obdo_free(oa);
-                       EXIT;
-                       return -EIO;
-               }
-       }
-
-        obdo_free(oa);
-        EXIT;
-        return err;
-} /* ll_brw */
-
-void ll_truncate(struct inode *inode)
-{
-        struct obdo *oa;
-        int err;
-        ENTRY;
-
-       oa = ll_oa_from_inode(inode, OBD_MD_FLNOTOBD);
-        if ( !oa ) {
-                CERROR("no memory to allocate obdo!\n");
-               return; 
-        } 
-       
-       CDEBUG(D_INFO, "calling punch for %ld (%Lu bytes at 0)\n",
-              (long)oa->o_id, oa->o_size);
-       err = obd_punch(ll_i2obdconn(inode), oa, oa->o_size, 0);
-       obdo_free(oa);
-
-        if (err) {
-                CERROR("obd_truncate fails (%d)\n", err);
-        }
-        EXIT;
-       return; 
-} /* ll_truncate */
-
-struct address_space_operations ll_aops = {
-        readpage: ll_readpage,
-        writepage: ll_writepage,
-        sync_page: block_sync_page,
-        prepare_write: ll_prepare_write, 
-        commit_write: ll_commit_write,
-        bmap: NULL
-};
-
diff --git a/lustre/llite/super.c b/lustre/llite/super.c
deleted file mode 100644 (file)
index f2b171c..0000000
+++ /dev/null
@@ -1,417 +0,0 @@
-/*
- * Lustre Light Super operations
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- *
- * Copryright (C) 1996 Peter J. Braam <braam@stelias.com>
- * Copryright (C) 1999 Stelias Computing Inc. <braam@stelias.com>
- * Copryright (C) 1999 Seagate Technology Inc.
- * Copryright (C) 2001 Mountain View Data, Inc.
- * Copryright (C) 2002 Cluster File Systems, Inc.
- *
- */
-
-#include <linux/config.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/string.h>
-#include <linux/stat.h>
-#include <linux/errno.h>
-#include <linux/locks.h>
-#include <linux/unistd.h>
-
-#include <asm/system.h>
-#include <asm/uaccess.h>
-
-#include <linux/fs.h>
-#include <linux/stat.h>
-#include <asm/uaccess.h>
-#include <asm/segment.h>
-
-#define DEBUG_SUBSYSTEM S_LLIGHT
-
-#include <linux/obd_support.h>
-#include <linux/obd_class.h>
-#include <linux/lustre_light.h>
-
-extern struct address_space_operations ll_aops;
-extern struct address_space_operations ll_dir_aops;
-struct super_operations ll_super_operations;
-long obd_memory = 0;
-
-static char *ll_read_opt(const char *opt, char *data)
-{
-        char *value;
-        char *retval;
-       ENTRY;
-
-        CDEBUG(D_INFO, "option: %s, data %s\n", opt, data);
-        if ( strncmp(opt, data, strlen(opt)) ) {
-               EXIT;
-                return NULL;
-       }
-        if ( (value = strchr(data, '=')) == NULL ) {
-               EXIT;
-                return NULL;
-       }
-
-        value++;
-        OBD_ALLOC(retval, strlen(value) + 1);
-        if ( !retval ) {
-                CERROR("out of memory!\n");
-                return NULL;
-        }
-        
-        memcpy(retval, value, strlen(value)+1);
-        CDEBUG(D_SUPER, "Assigned option: %s, value %s\n", opt, retval);
-       EXIT;
-        return retval;
-}
-
-static void ll_options(char *options, char **dev, char **vers)
-{
-        char *this_char;
-       ENTRY; 
-
-        if (!options) { 
-               EXIT;
-                return;
-       }
-
-        for (this_char = strtok (options, ",");
-             this_char != NULL;
-             this_char = strtok (NULL, ",")) {
-                CDEBUG(D_INFO, "this_char %s\n", this_char);
-                if ( (!*dev && (*dev = ll_read_opt("device", this_char)))||
-                     (!*vers && (*vers = ll_read_opt("version", this_char))) )
-                        continue;
-                
-        }
-       EXIT;
-}
-
-static struct super_block * ll_read_super(struct super_block *sb, 
-                                            void *data, int silent)
-{
-        struct inode *root = 0; 
-        struct ll_sb_info *sbi;
-       char *device = NULL;
-        char *version = NULL;
-       int connected = 0;
-        int devno;
-        int err;
-       struct mds_rep *rep; 
-       struct ptlrep_hdr *hdr = NULL; 
-
-        ENTRY;
-        MOD_INC_USE_COUNT; 
-
-       OBD_ALLOC(sbi, sizeof(*sbi));
-       if (!sbi) { 
-               EXIT;
-               return NULL;
-       }
-        memset(sbi, 0, sizeof(*sbi));
-       sb->u.generic_sbp = (struct ll_sb_info *) sbi;
-
-        ll_options(data, &device, &version);
-
-        if ( !device ) {
-                CERROR("no device\n");
-               sb = NULL; 
-                goto ERR;
-        }
-
-       devno = simple_strtoul(device, NULL, 0);
-        if ( devno >= MAX_OBD_DEVICES ) {
-                CERROR("device of %s too high\n", device);
-               sb = NULL; 
-                goto ERR;
-        } 
-
-        sbi->ll_conn.oc_dev = &obd_dev[devno];
-        err = obd_connect(&sbi->ll_conn);
-        if ( err ) {
-                CERROR("cannot connect to %s\n", device);
-               sb = NULL; 
-                goto ERR;
-        }
-       connected = 1;
-
-       err = mdc_create_client("mds", &sbi->ll_mds_client); 
-       if (err) { 
-               CERROR("cannot find MDS\n"); 
-               sb = NULL;
-               goto ERR;
-       }
-        sbi->ll_super = sb;
-       sbi->ll_rootino = 2;
-
-       sb->s_maxbytes = 1LL << 36;
-        sb->s_blocksize = PAGE_SIZE;
-        sb->s_blocksize_bits = (unsigned char)PAGE_SHIFT;
-        sb->s_magic = LL_SUPER_MAGIC;
-        sb->s_op = &ll_super_operations;
-
-        /* make root inode */
-       err = mdc_getattr(&sbi->ll_mds_client, sbi->ll_rootino, S_IFDIR, 
-                         OBD_MD_FLNOTOBD|OBD_MD_FLBLOCKS, 
-                         &rep, &hdr);
-        if (err) {
-                CERROR("mds_getattr failed for root %d\n", err);
-               sb = NULL; 
-                goto ERR;
-        }
-                         
-        root = iget4(sb, sbi->ll_rootino, NULL, rep);
-        if (root) {
-               sb->s_root = d_alloc_root(root);
-       } else {
-            CERROR("lustre_light: bad iget4 for root\n");
-           sb = NULL; 
-            goto ERR;
-        } 
-        
-ERR:
-       if (hdr)
-                /* FIXME: sigh, another stupid hardcoded size */
-                OBD_FREE(hdr, sizeof(struct ptlrep_hdr) +
-                         sizeof(struct mds_rep));
-        if (device)
-                OBD_FREE(device, strlen(device) + 1);
-        if (version)
-                OBD_FREE(version, strlen(version) + 1);
-       if (!sb && connected) 
-               obd_disconnect(&sbi->ll_conn);
-
-        if (!sb && root) {
-                iput(root);
-        }
-       if (!sb) 
-               MOD_DEC_USE_COUNT;
-
-       EXIT;
-        return sb;
-} /* ll_read_super */
-
-static void ll_put_super(struct super_block *sb)
-{
-       struct ll_sb_info *sbi = sb->u.generic_sbp;
-        ENTRY;
-        obd_disconnect(&sbi->ll_conn);
-       OBD_FREE(sb->u.generic_sbp, sizeof(struct ll_sb_info));
-        MOD_DEC_USE_COUNT;
-        EXIT;
-} /* ll_put_super */
-
-
-extern inline struct obdo * ll_oa_from_inode(struct inode *inode, int valid);
-static void ll_delete_inode(struct inode *inode)
-{
-       if (S_ISREG(inode->i_mode)) { 
-               int err; 
-               struct obdo *oa; 
-               oa = ll_oa_from_inode(inode, OBD_MD_FLNOTOBD);
-               if (!oa) { 
-                       CERROR("no memory\n"); 
-               }
-
-               err = obd_destroy(IID(inode), oa); 
-                CDEBUG(D_INODE, "obd destroy of %Ld error %d\n",
-                       oa->o_id, err);
-               obdo_free(oa);
-       }
-
-       clear_inode(inode); 
-}
-
-/* like inode_setattr, but doesn't mark the inode dirty */ 
-static int ll_attr2inode(struct inode * inode, struct iattr * attr, int trunc)
-{
-       unsigned int ia_valid = attr->ia_valid;
-       int error = 0;
-
-       if ((ia_valid & ATTR_SIZE) && trunc ) {
-               error = vmtruncate(inode, attr->ia_size);
-               if (error)
-                       goto out;
-       } else if (ia_valid & ATTR_SIZE) { 
-               inode->i_size = attr->ia_size;
-       }               
-
-       if (ia_valid & ATTR_UID)
-               inode->i_uid = attr->ia_uid;
-       if (ia_valid & ATTR_GID)
-               inode->i_gid = attr->ia_gid;
-       if (ia_valid & ATTR_ATIME)
-               inode->i_atime = attr->ia_atime;
-       if (ia_valid & ATTR_MTIME)
-               inode->i_mtime = attr->ia_mtime;
-       if (ia_valid & ATTR_CTIME)
-               inode->i_ctime = attr->ia_ctime;
-       if (ia_valid & ATTR_MODE) {
-               inode->i_mode = attr->ia_mode;
-               if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID))
-                       inode->i_mode &= ~S_ISGID;
-       }
-out:
-       return error;
-}
-
-int ll_inode_setattr(struct inode *inode, struct iattr *attr, int do_trunc)
-{
-       struct ptlrep_hdr *hdr = NULL;
-        struct ll_sb_info *sbi = ll_i2sbi(inode);
-       int err;
-
-        ENTRY;
-
-       /* change incore inode */
-       ll_attr2inode(inode, attr, do_trunc);
-
-       err = mdc_setattr(&sbi->ll_mds_client, inode, attr, NULL, &hdr); 
-        if ( err )
-                CERROR("ll_setattr fails (%d)\n", err);
-
-        EXIT;
-        return err;
-}
-
-int ll_setattr(struct dentry *de, struct iattr *attr)
-{
-       return ll_inode_setattr(de->d_inode, attr, 1);
-}
-
-static int ll_statfs(struct super_block *sb, struct statfs *buf)
-{
-        struct statfs tmp;
-        int err;
-
-        ENTRY;
-
-        err = obd_statfs(ID(sb), &tmp);
-        if ( err ) { 
-                CERROR("obd_statfs fails (%d)\n", err);
-                return err;
-        }
-       memcpy(buf, &tmp, sizeof(*buf));
-       CDEBUG(D_SUPER, "statfs returns avail %ld\n", tmp.f_bavail);
-        EXIT;
-
-        return err; 
-}
-
-static void inline ll_to_inode(struct inode *dst, struct mds_rep *rep)
-{
-       struct ll_inode_info *ii = 
-               (struct ll_inode_info *) &dst->u.generic_ip;
-
-       /* core attributes first */
-        if ( rep->valid & OBD_MD_FLID )
-                dst->i_ino = rep->ino;
-        if ( rep->valid & OBD_MD_FLATIME ) 
-                dst->i_atime = rep->atime;
-        if ( rep->valid & OBD_MD_FLMTIME ) 
-                dst->i_mtime = rep->mtime;
-        if ( rep->valid & OBD_MD_FLCTIME ) 
-                dst->i_ctime = rep->ctime;
-        if ( rep->valid & OBD_MD_FLSIZE ) 
-                dst->i_size = rep->size;
-        if ( rep->valid & OBD_MD_FLMODE ) 
-                dst->i_mode = rep->mode;
-        if ( rep->valid & OBD_MD_FLUID ) 
-                dst->i_uid = rep->uid;
-        if ( rep->valid & OBD_MD_FLGID ) 
-                dst->i_gid = rep->gid;
-        if ( rep->valid & OBD_MD_FLFLAGS ) 
-                dst->i_flags = rep->flags;
-        if ( rep->valid & OBD_MD_FLNLINK )
-                dst->i_nlink = rep->nlink;
-        if ( rep->valid & OBD_MD_FLGENER )
-                dst->i_generation = rep->generation;
-
-       /* this will become more elaborate for striping etc */ 
-       if (rep->valid & OBD_MD_FLOBJID) 
-               ii->lli_objid = rep->objid;
-#if 0
-
-        if (obdo_has_inline(oa)) {
-               if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode) ||
-                   S_ISFIFO(inode->i_mode)) {
-                       obd_rdev rdev = *((obd_rdev *)oa->o_inline);
-                       CDEBUG(D_INODE,
-                              "copying device %x from obdo to inode\n", rdev);
-                       init_special_inode(inode, inode->i_mode, rdev);
-               } else {
-                       CDEBUG(D_INFO, "copying inline from obdo to inode\n");
-                       memcpy(oinfo->lli_inline, oa->o_inline, OBD_INLINESZ);
-               }
-                oinfo->lli_flags |= OBD_FL_INLINEDATA;
-        }
-#endif 
-} /* ll_to_inode */
-
-static inline void ll_read_inode2(struct inode *inode, void *opaque)
-{
-       struct mds_rep *rep = opaque; 
-       
-       ENTRY;
-       ll_to_inode(inode, rep); 
-
-        /* OIDEBUG(inode); */
-
-        if (S_ISREG(inode->i_mode)) {
-                inode->i_op = &ll_file_inode_operations;
-                inode->i_fop = &ll_file_operations;
-                inode->i_mapping->a_ops = &ll_aops;
-                EXIT;
-        } else if (S_ISDIR(inode->i_mode)) {
-                inode->i_op = &ll_dir_inode_operations;
-                inode->i_fop = &ll_dir_operations; 
-                inode->i_mapping->a_ops = &ll_dir_aops;
-                EXIT;
-        } else if (S_ISLNK(inode->i_mode)) {
-               inode->i_op = &ll_fast_symlink_inode_operations;
-                EXIT;
-        } else {
-                init_special_inode(inode, inode->i_mode,
-                                   ((int *)ll_i2info(inode)->lli_inline)[0]);
-        }
-
-       EXIT;
-        return;
-}
-
-/* exported operations */
-struct super_operations ll_super_operations =
-{
-       read_inode2: ll_read_inode2,
-        delete_inode: ll_delete_inode,
-        put_super: ll_put_super,
-        // statfs: ll_statfs
-};
-
-struct file_system_type lustre_light_fs_type = {
-   "lustre_light", 0, ll_read_super, NULL
-};
-
-static int __init init_lustre_light(void)
-{
-        printk(KERN_INFO "Lustre Light 0.0.1, braam@clusterfs.com\n");
-
-        return register_filesystem(&lustre_light_fs_type);
-}
-
-static void __exit exit_lustre_light(void)
-{
-        unregister_filesystem(&lustre_light_fs_type);
-}
-
-MODULE_AUTHOR("Peter J. Braam <braam@clusterfs.com>");
-MODULE_DESCRIPTION("Lustre Light Client File System v1.0");
-MODULE_LICENSE("GPL");
-
-module_init(init_lustre_light);
-module_exit(exit_lustre_light);
diff --git a/lustre/llite/symlink.c b/lustre/llite/symlink.c
deleted file mode 100644 (file)
index 83c41f4..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- *  linux/fs/ext2/symlink.c
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- *
- * Copyright (C) 1992, 1993, 1994, 1995
- * Remy Card (card@masi.ibp.fr)
- * Laboratoire MASI - Institut Blaise Pascal
- * Universite Pierre et Marie Curie (Paris VI)
- *
- *  from
- *
- *  linux/fs/minix/symlink.c
- *
- *  Copyright (C) 1991, 1992  Linus Torvalds
- *
- *  ext2 symlink handling code
- *
- * Modified for OBDFS: 
- *  Copyright (C) 1999 Seagate Technology Inc. (author: braam@stelias.com)
- */
-
-#include <linux/fs.h>
-#include <linux/mm.h>
-#include <linux/stat.h>
-#include <linux/locks.h>
-
-#define DEBUG_SUBSYSTEM S_LLIGHT
-
-#include <linux/obd_support.h> /* for ENTRY and EXIT only */
-#include <linux/lustre_light.h>
-
-static int ll_fast_readlink(struct dentry *dentry, char *buffer, int buflen)
-{
-        char *s = ll_i2info(dentry->d_inode)->lli_inline;
-        return vfs_readlink(dentry, buffer, buflen, s);
-}
-
-static int ll_fast_follow_link(struct dentry *dentry, struct nameidata *nd)
-{
-        char *s = ll_i2info(dentry->d_inode)->lli_inline;
-        return vfs_follow_link(nd, s); 
-}
-
-extern int ll_setattr(struct dentry *de, struct iattr *attr);
-struct inode_operations ll_fast_symlink_inode_operations = {
-        readlink:       ll_fast_readlink,
-        follow_link:    ll_fast_follow_link,
-       setattr:        ll_setattr
-};
-
diff --git a/lustre/llite/sysctl.c b/lustre/llite/sysctl.c
deleted file mode 100644 (file)
index 3c4ce1f..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2001  Cluster File Systems, Inc.
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- */
-#include <linux/sched.h>
-#include <linux/mm.h>
-#include <linux/sysctl.h>
-#include <linux/swapctl.h>
-#include <linux/proc_fs.h>
-#include <linux/slab.h>
-#include <linux/stat.h>
-#include <linux/ctype.h>
-#include <asm/bitops.h>
-#include <asm/segment.h>
-#include <asm/uaccess.h>
-#include <linux/utsname.h>
-
-struct ctl_table_header *ll_table_header = NULL;
-
-int ll_debug_level = 0;
-int ll_print_entry = 1;
-
-
-#define LL_SYSCTL 1
-
-#define LL_DEBUG           1       /* control debugging */
-#define LL_ENTRY           2       /* control enter/leave pattern */
-#define LL_TIMEOUT         3       /* timeout on upcalls to become intrble */
-#define LL_HARD            4       /* mount type "hard" or "soft" */
-#define LL_VARS            5       
-#define LL_INDEX           6
-#define LL_RESET           7
-
-#define LL_VARS_SLOT       2
-
-static ctl_table ll_table[] = {
-       {LL_DEBUG, "debug", &ll_debug_level, sizeof(int), 0644, NULL, &proc_dointvec},
-       {LL_ENTRY, "trace", &ll_print_entry, sizeof(int), 0644, NULL, &proc_dointvec},
-       { 0 }
-};
-
-static ctl_table top_table[] = {
-       {LL_SYSCTL, "lustre_light",    NULL, 0, 0555, ll_table},
-       {0}
-};
-
-void ll_sysctl_init (void)
-{
-
-#ifdef CONFIG_SYSCTL
-       if ( !ll_table_header )
-               ll_table_header = register_sysctl_table(top_table, 0); 
-#endif
-}
-
-void ll_sysctl_clean (void)
-{
-#ifdef CONFIG_SYSCTL
-       if ( ll_table_header )
-               unregister_sysctl_table(ll_table_header);
-       ll_table_header = NULL;
-#endif
-}
diff --git a/lustre/mdc/.cvsignore b/lustre/mdc/.cvsignore
deleted file mode 100644 (file)
index e530020..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-.Xrefs
-config.log
-config.status
-configure
-Makefile
-Makefile.in
-.deps
-TAGS
diff --git a/lustre/mdc/Makefile.am b/lustre/mdc/Makefile.am
deleted file mode 100644 (file)
index 6fffd8a..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright (C) 2001  Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-
-DEFS:=
-
-MODULE = mdc
-modulefs_DATA = mdc.o
-EXTRA_PROGRAMS = mdc
-
-
-mdc_SOURCES =  mds_pack.c mdc_request.c mdc_reint.c mds_updates.c
-
-mds_pack.c: 
-       ln -s ../lib/mds_pack.c .
-mds_updates.c: 
-       ln -s ../lib/mds_updates.c .
-
-include $(top_srcdir)/Rules
diff --git a/lustre/mdc/mdc_reint.c b/lustre/mdc/mdc_reint.c
deleted file mode 100644 (file)
index 7eed74b..0000000
+++ /dev/null
@@ -1,228 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * Copyright (C) 2001, 2002 Cluster File Systems, Inc.
- *
- *   This file is part of Portals, http://www.sf.net/projects/lustre/
- *
- *   Portals is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   Portals 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 Portals; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#define EXPORT_SYMTAB
-
-#include <linux/config.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/string.h>
-#include <linux/stat.h>
-#include <linux/errno.h>
-#include <linux/locks.h>
-#include <linux/unistd.h>
-
-#include <asm/system.h>
-#include <asm/uaccess.h>
-#include <linux/module.h>
-
-#include <linux/fs.h>
-#include <linux/stat.h>
-#include <asm/uaccess.h>
-#include <asm/segment.h>
-#include <linux/miscdevice.h>
-
-#define DEBUG_SUBSYSTEM S_MDC
-
-#include <linux/obd_support.h>
-#include <linux/lustre_lib.h>
-#include <linux/lustre_idl.h>
-#include <linux/lustre_mds.h>
-
-extern int mdc_reint(struct ptlrpc_client *peer, struct ptlrpc_request *request);
-
-int mdc_setattr(struct ptlrpc_client *peer, 
-               struct inode *inode, struct iattr *iattr,
-               struct mds_rep **rep, struct ptlrep_hdr **hdr)
-{
-       int rc; 
-       struct ptlrpc_request *request;
-       struct mds_rec_setattr *rec;
-
-       request = ptlrpc_prep_req(peer, MDS_REINT, 0, NULL, sizeof(*rec), NULL);
-       if (!request) { 
-               CERROR("mdc request: cannot pack\n");
-               return -ENOMEM;
-       }
-
-       rec = mds_req_tgt(request->rq_req.mds);
-       mds_setattr_pack(rec, inode, iattr); 
-       request->rq_req.mds->opcode = HTON__u32(REINT_SETATTR);
-       request->rq_replen = 
-               sizeof(struct ptlrep_hdr) + sizeof(struct mds_rep);
-
-       rc = mdc_reint(peer, request);
-       if (rc)
-               return rc;
-
-       if (rep) { 
-               *rep = request->rq_rep.mds;
-       }
-       if (hdr) { 
-               *hdr = request->rq_rephdr;
-       }
-
-       return 0;
-}
-
-int mdc_create(struct ptlrpc_client *peer, 
-              struct inode *dir, const char *name, int namelen, 
-              const char *tgt, int tgtlen, 
-              int mode, __u64 id, __u32 uid, __u32 gid, __u64 time, 
-               struct mds_rep **rep, struct ptlrep_hdr **hdr)
-{
-       int rc; 
-       struct ptlrpc_request *request;
-       struct mds_rec_create *rec;
-
-       request = ptlrpc_prep_req(peer, MDS_REINT, 0, NULL, 
-                              sizeof(*rec) + size_round0(namelen) + 
-                              size_round0(tgtlen), NULL);
-       if (!request) { 
-               CERROR("mdc_create: cannot pack\n");
-               return -ENOMEM;
-       }
-
-       request->rq_replen = 
-               sizeof(struct ptlrep_hdr) + sizeof(struct mds_rep);
-
-       rec = mds_req_tgt(request->rq_req.mds);
-       mds_create_pack(rec, dir, name, namelen, mode, id, uid, gid, time, 
-                       tgt, tgtlen); 
-
-       rc = mdc_reint(peer, request);
-
-       if (rep) { 
-               *rep = request->rq_rep.mds;
-       }
-       if (hdr) { 
-               *hdr = request->rq_rephdr;
-       }
-
-        OBD_FREE(request, sizeof(*request));
-       return rc;
-}
-
-int mdc_unlink(struct ptlrpc_client *peer, 
-              struct inode *dir, const char *name, int namelen, 
-               struct mds_rep **rep, struct ptlrep_hdr **hdr)
-{
-       int rc; 
-       struct ptlrpc_request *request;
-       struct mds_rec_unlink *rec;
-
-       request = ptlrpc_prep_req(peer, MDS_REINT, 0, NULL, 
-                              sizeof(*rec) + size_round0(namelen), NULL);
-       if (!request) { 
-               CERROR("mdc_unlink: cannot pack\n");
-               return -ENOMEM;
-       }
-
-       request->rq_replen = 
-               sizeof(struct ptlrep_hdr) + sizeof(struct mds_rep);
-
-       rec = mds_req_tgt(request->rq_req.mds);
-       mds_unlink_pack(rec, dir, name, namelen);
-
-       rc = mdc_reint(peer, request);
-
-       if (rep) { 
-               *rep = request->rq_rep.mds;
-       }
-       if (hdr) { 
-               *hdr = request->rq_rephdr;
-       }
-
-        OBD_FREE(request, sizeof(*request));
-       return rc;
-}
-
-int mdc_link(struct ptlrpc_client *peer, struct dentry *src, 
-            struct inode *dir, const char *name, int namelen, 
-               struct mds_rep **rep, struct ptlrep_hdr **hdr)
-{
-       int rc; 
-       struct ptlrpc_request *request;
-       struct mds_rec_link *rec;
-
-       request = ptlrpc_prep_req(peer, MDS_REINT, 0, NULL, 
-                              sizeof(*rec) + size_round0(namelen), NULL);
-       if (!request) { 
-               CERROR("mdc_link: cannot pack\n");
-               return -ENOMEM;
-       }
-
-       request->rq_replen = 
-               sizeof(struct ptlrep_hdr) + sizeof(struct mds_rep);
-
-       rec = mds_req_tgt(request->rq_req.mds);
-       mds_link_pack(rec, src->d_inode, dir, name, namelen);
-
-       rc = mdc_reint(peer, request);
-
-       if (rep) { 
-               *rep = request->rq_rep.mds;
-       }
-       if (hdr) { 
-               *hdr = request->rq_rephdr;
-       }
-
-        OBD_FREE(request, sizeof(*request));
-       return rc;
-}
-
-int mdc_rename(struct ptlrpc_client *peer, struct inode *src, 
-              struct inode *tgt, const char *old, int oldlen, 
-              const char *new, int newlen, 
-              struct mds_rep **rep, struct ptlrep_hdr **hdr)
-{
-       int rc; 
-       struct ptlrpc_request *request;
-       struct mds_rec_rename *rec;
-
-       request = ptlrpc_prep_req(peer, MDS_REINT, 0, NULL, 
-                              sizeof(*rec) + size_round0(oldlen)
-                              + size_round0(newlen), NULL);
-       if (!request) { 
-               CERROR("mdc_link: cannot pack\n");
-               return -ENOMEM;
-       }
-
-       request->rq_replen = 
-               sizeof(struct ptlrep_hdr) + sizeof(struct mds_rep);
-
-       rec = mds_req_tgt(request->rq_req.mds);
-       mds_rename_pack(rec, src, tgt, old, oldlen, new, newlen);
-
-       rc = mdc_reint(peer, request);
-
-       if (rep) { 
-               *rep = request->rq_rep.mds;
-       }
-       if (hdr) { 
-               *hdr = request->rq_rephdr;
-       }
-
-        OBD_FREE(request, sizeof(*request));
-       return rc;
-}
diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c
deleted file mode 100644 (file)
index b027372..0000000
+++ /dev/null
@@ -1,405 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * Copyright (C) 2001, 2002 Cluster File Systems, Inc.
- *
- *   This file is part of Portals, http://www.sf.net/projects/lustre/
- *
- *   Portals is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   Portals 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 Portals; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#define EXPORT_SYMTAB
-
-#include <linux/config.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/string.h>
-#include <linux/stat.h>
-#include <linux/errno.h>
-#include <linux/locks.h>
-#include <linux/unistd.h>
-
-#include <asm/system.h>
-#include <asm/uaccess.h>
-#include <linux/module.h>
-
-#include <linux/fs.h>
-#include <linux/stat.h>
-#include <asm/uaccess.h>
-#include <asm/segment.h>
-#include <linux/miscdevice.h>
-
-#define DEBUG_SUBSYSTEM S_MDC
-
-#include <linux/obd_support.h>
-#include <linux/lustre_lib.h>
-#include <linux/lustre_idl.h>
-#include <linux/lustre_mds.h>
-
-#define REQUEST_MINOR 244
-
-extern int mds_queue_req(struct ptlrpc_request *);
-
-
-int mdc_getattr(struct ptlrpc_client *peer, ino_t ino, int type, int valid, 
-               struct mds_rep  **rep, struct ptlrep_hdr **hdr)
-{
-       struct ptlrpc_request *request;
-       int rc; 
-
-       request = ptlrpc_prep_req(peer, MDS_GETATTR, 0, NULL, 0, NULL); 
-       if (!request) { 
-               CERROR("llight request: cannot pack\n");
-               return -ENOMEM;
-       }
-
-       ll_ino2fid(&request->rq_req.mds->fid1, ino, 0, type);
-
-       request->rq_req.mds->valid = valid;
-       request->rq_replen = 
-               sizeof(struct ptlrep_hdr) + sizeof(struct mds_rep);
-
-       rc = ptlrpc_queue_wait(request, peer);
-       if (rc) { 
-               CERROR("llight request: error in handling %d\n", rc); 
-               goto out;
-       }
-
-        CDEBUG(0, "mode: %o\n", request->rq_rep.mds->mode);
-
-       if (rep) { 
-               *rep = request->rq_rep.mds;
-       }
-       if (hdr) { 
-               *hdr = request->rq_rephdr;
-       }
-
- out: 
-       ptlrpc_free_req(request);
-       return rc;
-}
-
-int mdc_open(struct ptlrpc_client *peer, ino_t ino, int type, int flags,
-                __u64 *fh, struct mds_rep  **rep, struct ptlrep_hdr **hdr)
-{
-       struct ptlrpc_request *request;
-       int rc; 
-
-       request = ptlrpc_prep_req(peer, MDS_OPEN, 0, NULL, 0, NULL); 
-       if (!request) { 
-               CERROR("llight request: cannot pack\n");
-               return -ENOMEM;
-       }
-
-       ll_ino2fid(&request->rq_req.mds->fid1, ino, 0, type);
-        request->rq_req.mds->flags = flags;
-       request->rq_replen = 
-               sizeof(struct ptlrep_hdr) + sizeof(struct mds_rep);
-
-       rc = ptlrpc_queue_wait(request, peer);
-       if (rc) { 
-               CERROR("llight request: error in handling %d\n", rc); 
-               goto out;
-       }
-
-       if (rep) { 
-               *rep = request->rq_rep.mds;
-       }
-       if (hdr) { 
-               *hdr = request->rq_rephdr;
-       }
-        *fh = request->rq_rep.mds->objid; 
-
- out: 
-       ptlrpc_free_req(request);
-       return rc;
-}
-
-
-int mdc_close(struct ptlrpc_client *peer, ino_t ino, int type, __u64 fh, 
-               struct mds_rep  **rep, struct ptlrep_hdr **hdr)
-{
-       struct ptlrpc_request *request;
-       int rc; 
-
-       request = ptlrpc_prep_req(peer, MDS_CLOSE, 0, NULL, 0, NULL); 
-       if (!request) { 
-               CERROR("llight request: cannot pack\n");
-               return -ENOMEM;
-       }
-
-       ll_ino2fid(&request->rq_req.mds->fid1, ino, 0, type);
-        request->rq_req.mds->objid = fh; 
-       request->rq_replen = 
-               sizeof(struct ptlrep_hdr) + sizeof(struct mds_rep);
-
-       rc = ptlrpc_queue_wait(request, peer);
-       if (rc) { 
-               CERROR("llight request: error in handling %d\n", rc); 
-               goto out;
-       }
-
-       if (rep) { 
-               *rep = request->rq_rep.mds;
-       }
-       if (hdr) { 
-               *hdr = request->rq_rephdr;
-       }
-
- out: 
-       ptlrpc_free_req(request);
-       return rc;
-}
-
-int mdc_readpage(struct ptlrpc_client *peer, ino_t ino, int type, __u64 offset,
-                char *addr, struct mds_rep  **rep, struct ptlrep_hdr **hdr)
-{
-       struct ptlrpc_request *request;
-       struct niobuf niobuf;
-       int rc; 
-
-       niobuf.addr = (__u64) (long) addr;
-
-        CDEBUG(D_INODE, "inode: %ld\n", ino);
-
-       request = ptlrpc_prep_req(peer, MDS_READPAGE, 0, NULL,
-                                  sizeof(struct niobuf), (char *)&niobuf);
-       if (!request) { 
-               CERROR("mdc request: cannot pack\n");
-               return -ENOMEM;
-       }
-
-       request->rq_req.mds->fid1.id = ino;
-       request->rq_req.mds->fid1.f_type = type;
-       request->rq_req.mds->size = offset;
-       request->rq_req.mds->tgtlen = sizeof(niobuf); 
-
-        request->rq_bulklen = PAGE_SIZE;
-        request->rq_bulkbuf = (void *)(long)niobuf.addr;
-       request->rq_bulk_portal = MDS_BULK_PORTAL;
-       request->rq_replen = 
-               sizeof(struct ptlrep_hdr) + sizeof(struct mds_rep);
-
-       rc = ptlrpc_queue_wait(request, peer);
-       if (rc) { 
-               CERROR("mdc request: error in handling %d\n", rc); 
-               goto out;
-       }
-
-        CDEBUG(0, "mode: %o\n", request->rq_rep.mds->mode);
-
-       if (rep) { 
-               *rep = request->rq_rep.mds;
-       }
-       if (hdr) { 
-               *hdr = request->rq_rephdr;
-       }
-
- out: 
-       ptlrpc_free_req(request);
-       return rc;
-}
-
-int mdc_reint(struct ptlrpc_client *peer, struct ptlrpc_request *request)
-{
-       int rc; 
-
-       rc = ptlrpc_queue_wait(request, peer);
-       if (rc) { 
-               CERROR("mdc request: error in handling %d\n", rc); 
-       }
-
-       return rc;
-}
-
-int mdc_create_client(char *uuid, struct ptlrpc_client *cl)
-{
-        int err; 
-
-        memset(cl, 0, sizeof(*cl));
-       cl->cli_xid = 0;
-       cl->cli_rep_unpack = mds_unpack_rep;
-       cl->cli_req_pack = mds_pack_req;
-       err = kportal_uuid_to_peer("mds", &cl->cli_server);
-       if (err == 0) { 
-               cl->cli_request_portal = MDS_REQUEST_PORTAL;
-               cl->cli_reply_portal = MDS_REPLY_PORTAL;
-               
-       } else { 
-               cl->cli_enqueue = mds_queue_req;
-       }
-        return 0;
-}
-
-static int request_ioctl(struct inode *inode, struct file *file, 
-                         unsigned int cmd, unsigned long arg)
-{
-       int err;
-       struct ptlrpc_client peer;
-
-       ENTRY;
-
-       if (MINOR(inode->i_rdev) != REQUEST_MINOR) {
-               EXIT;
-               return -EINVAL;
-       }
-
-       if ( _IOC_TYPE(cmd) != IOC_REQUEST_TYPE || 
-             _IOC_NR(cmd) < IOC_REQUEST_MIN_NR  || 
-             _IOC_NR(cmd) > IOC_REQUEST_MAX_NR ) {
-                CDEBUG(D_IOCTL, "invalid ioctl ( type %d, nr %d, size %d )\n",
-                                _IOC_TYPE(cmd), _IOC_NR(cmd), _IOC_SIZE(cmd));
-                EXIT;
-                return -EINVAL;
-        }
-
-        err = mdc_create_client("mds", &peer);
-       if (err) {
-                CERROR("cannot create client"); 
-                return -EINVAL;
-        }
-       
-       switch (cmd) {
-       case IOC_REQUEST_GETATTR: { 
-               struct ptlrep_hdr *hdr = NULL;
-               CERROR("-- getting attr for ino 2\n"); 
-               err = mdc_getattr(&peer, 2, S_IFDIR, ~0, NULL, &hdr);
-               if (hdr) {
-                        /* FIXME: there must be a better way to get the size */
-                       OBD_FREE(hdr, sizeof(struct ptlrep_hdr) +
-                                 sizeof(struct mds_rep));
-                }
-               CERROR("-- done err %d\n", err);
-               break;
-       }
-
-       case IOC_REQUEST_READPAGE: { 
-               struct ptlrep_hdr *hdr = NULL;
-               char *buf;
-               OBD_ALLOC(buf, PAGE_SIZE);
-               if (!buf) { 
-                       err = -ENOMEM;
-                       break;
-               }
-               CERROR("-- readpage 0 for ino 2\n"); 
-               err = mdc_readpage(&peer, 2, S_IFDIR, 0, buf, NULL, &hdr);
-               CERROR("-- done err %d\n", err);
-               if (!err) { 
-                       CERROR("-- status: %d\n", hdr->status); 
-                       err = hdr->status;
-                        if (hdr)
-                                OBD_FREE(hdr, sizeof(struct ptlrep_hdr) +
-                                         sizeof(struct mds_rep));
-               }
-               OBD_FREE(buf, PAGE_SIZE);
-               break;
-       }
-
-       case IOC_REQUEST_SETATTR: { 
-               struct inode inode;
-               struct ptlrep_hdr *hdr;
-               struct iattr iattr; 
-
-               inode.i_ino = 2;
-               iattr.ia_mode = 040777;
-               iattr.ia_atime = 0;
-               iattr.ia_valid = ATTR_MODE | ATTR_ATIME;
-
-               err = mdc_setattr(&peer, &inode, &iattr, NULL, &hdr);
-               CERROR("-- done err %d\n", err);
-               if (!err) { 
-                       CERROR("-- status: %d\n", hdr->status); 
-                       err = hdr->status;
-               } else {
-                        OBD_FREE(hdr, sizeof(struct ptlrep_hdr) +
-                                 sizeof(struct mds_rep));
-               }
-               break;
-       }
-
-       case IOC_REQUEST_CREATE: { 
-               struct inode inode;
-               struct ptlrep_hdr *hdr;
-               struct iattr iattr; 
-
-               inode.i_ino = 2;
-               iattr.ia_mode = 040777;
-               iattr.ia_atime = 0;
-               iattr.ia_valid = ATTR_MODE | ATTR_ATIME;
-
-               err = mdc_create(&peer, &inode, 
-                                "foofile", strlen("foofile"), 
-                                NULL, 0, 0100707, 47114711, 
-                                11, 47, 0, NULL, &hdr);
-               CERROR("-- done err %d\n", err);
-               if (!err) { 
-                       CERROR("-- status: %d\n", hdr->status); 
-                       err = hdr->status;
-               }
-                OBD_FREE(hdr, sizeof(struct ptlrep_hdr) +
-                         sizeof(struct mds_rep));
-               break;
-       }
-
-       default:                
-               err = -EINVAL;
-               EXIT;
-               break;
-       }
-       EXIT;
-       return err;
-}
-
-
-static struct file_operations requestdev_fops = {
-       ioctl: request_ioctl,
-};
-
-
-static struct miscdevice request_dev = {
-       REQUEST_MINOR,
-       "request",
-       &requestdev_fops
-};
-
-
-static int __init ptlrpc_request_init(void)
-{
-       misc_register(&request_dev);
-        return 0 ;
-}
-
-
-static void __exit ptlrpc_request_exit(void)
-{
-       misc_deregister(&request_dev);
-}
-
-MODULE_AUTHOR("Peter J. Braam <braam@clusterfs.com>");
-MODULE_DESCRIPTION("Lustre MDS Request Tester v1.0");
-MODULE_LICENSE("GPL");
-
-EXPORT_SYMBOL(mdc_create_client); 
-EXPORT_SYMBOL(mdc_create); 
-EXPORT_SYMBOL(mdc_unlink); 
-EXPORT_SYMBOL(mdc_rename); 
-EXPORT_SYMBOL(mdc_link); 
-EXPORT_SYMBOL(mdc_getattr); 
-EXPORT_SYMBOL(mdc_readpage); 
-EXPORT_SYMBOL(mdc_setattr); 
-
-module_init(ptlrpc_request_init);
-module_exit(ptlrpc_request_exit);
diff --git a/lustre/mds/.cvsignore b/lustre/mds/.cvsignore
deleted file mode 100644 (file)
index e530020..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-.Xrefs
-config.log
-config.status
-configure
-Makefile
-Makefile.in
-.deps
-TAGS
diff --git a/lustre/mds/Makefile.am b/lustre/mds/Makefile.am
deleted file mode 100644 (file)
index a78e8b8..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright (C) 2001  Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-
-DEFS:= 
-
-MODULE = mds
-modulefs_DATA = mds.o
-EXTRA_PROGRAMS = mds
-
-mds_pack.c: 
-       ln -s ../lib/mds_pack.c .
-mds_updates.c: 
-       ln -s ../lib/mds_updates.c .
-
-mds_SOURCES = mds_pack.c handler.c mds_reint.c mds_updates.c
-
-include $(top_srcdir)/Rules
-
diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c
deleted file mode 100644 (file)
index d2b611e..0000000
+++ /dev/null
@@ -1,797 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  linux/mds/handler.c
- *  
- *  Lustre Metadata Server (mds) request handler
- * 
- *  Copyright (C) 2001, 2002 Cluster File Systems, Inc.
- *
- *  This code is issued under the GNU General Public License.
- *  See the file COPYING in this distribution
- *
- *  by Peter Braam <braam@clusterfs.com>
- * 
- *  This server is single threaded at present (but can easily be multi threaded). 
- * 
- */
-
-#define EXPORT_SYMTAB
-
-#include <linux/version.h>
-#include <linux/module.h>
-#include <linux/fs.h>
-#include <linux/stat.h>
-#include <linux/locks.h>
-#include <linux/ext2_fs.h>
-#include <linux/quotaops.h>
-#include <asm/unistd.h>
-#include <asm/uaccess.h>
-
-#define DEBUG_SUBSYSTEM S_MDS
-
-#include <linux/obd_support.h>
-#include <linux/obd.h>
-#include <linux/lustre_lib.h>
-#include <linux/lustre_idl.h>
-#include <linux/lustre_mds.h>
-#include <linux/lustre_net.h>
-#include <linux/obd_class.h>
-
-// XXX for testing
-static struct mds_obd *MDS;
-
-// XXX make this networked!  
-static int mds_queue_req(struct ptlrpc_request *req)
-{
-       struct ptlrpc_request *srv_req;
-       
-       if (!MDS) { 
-               EXIT;
-               return -1;
-       }
-
-       OBD_ALLOC(srv_req, sizeof(*srv_req));
-       if (!srv_req) { 
-               EXIT;
-               return -ENOMEM;
-       }
-
-        CDEBUG(0, "---> MDS at %d %p, incoming req %p, srv_req %p\n",
-              __LINE__, MDS, req, srv_req);
-
-       memset(srv_req, 0, sizeof(*req)); 
-
-       /* move the request buffer */
-       srv_req->rq_reqbuf = req->rq_reqbuf;
-       srv_req->rq_reqlen = req->rq_reqlen;
-       srv_req->rq_obd = MDS;
-
-       /* remember where it came from */
-       srv_req->rq_reply_handle = req;
-
-       list_add(&srv_req->rq_list, &MDS->mds_reqs); 
-       wake_up(&MDS->mds_waitq);
-       return 0;
-}
-
-int mds_sendpage(struct ptlrpc_request *req, struct file *file, 
-                 __u64 offset, struct niobuf *dst)
-{
-       int rc; 
-       mm_segment_t oldfs = get_fs();
-
-       if (req->rq_peer.peer_nid == 0) {
-               /* dst->addr is a user address, but in a different task! */
-               set_fs(KERNEL_DS); 
-               rc = generic_file_read(file, (char *)(long)dst->addr, 
-                                      PAGE_SIZE, &offset); 
-               set_fs(oldfs);
-
-               if (rc != PAGE_SIZE) 
-                       return -EIO;
-       } else {
-               char *buf;
-                DECLARE_WAITQUEUE(wait, current);
-
-               OBD_ALLOC(buf, PAGE_SIZE);
-               if (!buf)
-                       return -ENOMEM;
-
-               set_fs(KERNEL_DS); 
-               rc = generic_file_read(file, buf, PAGE_SIZE, &offset); 
-               set_fs(oldfs);
-
-               if (rc != PAGE_SIZE) {
-                        OBD_FREE(buf, PAGE_SIZE);
-                       return -EIO;
-                }
-
-                req->rq_type = PTLRPC_BULK;
-               req->rq_bulkbuf = buf;
-               req->rq_bulklen = PAGE_SIZE;
-
-               init_waitqueue_head(&req->rq_wait_for_bulk);
-               rc = ptl_send_buf(req, &req->rq_peer, MDS_BULK_PORTAL);
-                add_wait_queue(&req->rq_wait_for_bulk, &wait);
-                /* The bulk callback will set rq->bulkbuf to NULL when it's
-                 * been ACKed and it's finished using it. */
-                while (req->rq_bulkbuf != NULL) {
-                        set_current_state(TASK_INTERRUPTIBLE);
-
-                        /* if this process really wants to die, let it go */
-                        if (sigismember(&(current->pending.signal), SIGKILL) ||
-                            sigismember(&(current->pending.signal), SIGINT))
-                                break;
-
-                        schedule();
-                }
-                remove_wait_queue(&req->rq_wait_for_bulk, &wait);
-                set_current_state(TASK_RUNNING);
-
-                if (req->rq_bulkbuf != NULL) {
-                        EXIT;
-                        return -EINTR;
-                }
-
-                OBD_FREE(buf, PAGE_SIZE);
-               req->rq_bulklen = 0; /* FIXME: eek. */
-       }
-
-       return 0;
-}
-
-int mds_reply(struct ptlrpc_request *req)
-{
-       struct ptlrpc_request *clnt_req = req->rq_reply_handle;
-
-       ENTRY;
-       
-       if (req->rq_obd->mds_service != NULL) {
-               /* This is a request that came from the network via portals. */
-
-               /* FIXME: we need to increment the count of handled events */
-                req->rq_type = PTLRPC_REPLY;
-               ptl_send_buf(req, &req->rq_peer, MDS_REPLY_PORTAL);
-       } else {
-               /* This is a local request that came from another thread. */
-
-               /* move the reply to the client */ 
-               clnt_req->rq_replen = req->rq_replen;
-               clnt_req->rq_repbuf = req->rq_repbuf;
-               req->rq_repbuf = NULL;
-               req->rq_replen = 0;
-
-               /* free the request buffer */
-               OBD_FREE(req->rq_reqbuf, req->rq_reqlen);
-               req->rq_reqbuf = NULL;
-
-               /* wake up the client */ 
-               wake_up_interruptible(&clnt_req->rq_wait_for_rep); 
-       }
-
-       EXIT;
-       return 0;
-}
-
-int mds_error(struct ptlrpc_request *req)
-{
-       struct ptlrep_hdr *hdr;
-
-       ENTRY;
-
-       OBD_ALLOC(hdr, sizeof(*hdr));
-       if (!hdr) { 
-               EXIT;
-               return -ENOMEM;
-       }
-
-       memset(hdr, 0, sizeof(*hdr));
-       
-       hdr->seqno = req->rq_reqhdr->seqno;
-       hdr->status = req->rq_status; 
-       hdr->type = MDS_TYPE_ERR;
-
-       req->rq_repbuf = (char *)hdr;
-       req->rq_replen = sizeof(*hdr); 
-
-       EXIT;
-       return mds_reply(req);
-}
-
-struct dentry *mds_fid2dentry(struct mds_obd *mds, struct ll_fid *fid,
-                              struct vfsmount **mnt)
-{
-       /* stolen from NFS */ 
-       struct super_block *sb = mds->mds_sb; 
-       unsigned long ino = fid->id;
-       //__u32 generation = fid->generation;
-       __u32 generation = 0;
-       struct inode *inode;
-       struct list_head *lp;
-       struct dentry *result;
-
-       if (ino == 0)
-               return ERR_PTR(-ESTALE);
-
-       inode = iget(sb, ino);
-       if (inode == NULL)
-               return ERR_PTR(-ENOMEM);
-
-       CDEBUG(D_DENTRY, "--> mds_fid2dentry: sb %p\n", inode->i_sb); 
-
-       if (is_bad_inode(inode)
-           || (generation && inode->i_generation != generation)
-               ) {
-               /* we didn't find the right inode.. */
-               CERROR("bad inode %lu, link: %d ct: %d or version  %u/%u\n",
-                       inode->i_ino,
-                       inode->i_nlink, atomic_read(&inode->i_count),
-                       inode->i_generation,
-                       generation);
-               iput(inode);
-               return ERR_PTR(-ESTALE);
-       }
-
-       /* now to find a dentry.
-        * If possible, get a well-connected one
-        */
-       if (mnt)
-               *mnt = mds->mds_vfsmnt;
-       spin_lock(&dcache_lock);
-       for (lp = inode->i_dentry.next; lp != &inode->i_dentry ; lp=lp->next) {
-               result = list_entry(lp,struct dentry, d_alias);
-               if (! (result->d_flags & DCACHE_NFSD_DISCONNECTED)) {
-                       dget_locked(result);
-                       result->d_vfs_flags |= DCACHE_REFERENCED;
-                       spin_unlock(&dcache_lock);
-                       iput(inode);
-                       if (mnt)
-                               mntget(*mnt);
-                       return result;
-               }
-       }
-       spin_unlock(&dcache_lock);
-       result = d_alloc_root(inode);
-       if (result == NULL) {
-               iput(inode);
-               return ERR_PTR(-ENOMEM);
-       }
-       if (mnt)
-               mntget(*mnt);
-       result->d_flags |= DCACHE_NFSD_DISCONNECTED;
-       return result;
-}
-
-static inline void mds_get_objid(struct inode *inode, __u64 *id)
-{
-       memcpy(id, &inode->u.ext2_i.i_data, sizeof(*id));
-}
-
-int mds_getattr(struct ptlrpc_request *req)
-{
-       struct dentry *de;
-       struct inode *inode;
-       struct mds_rep *rep;
-       int rc;
-       
-       rc = mds_pack_rep(NULL, 0, NULL, 0, &req->rq_rephdr, &req->rq_rep, 
-                         &req->rq_replen, &req->rq_repbuf);
-       if (rc) { 
-               EXIT;
-               CERROR("mds: out of memory\n");
-               req->rq_status = -ENOMEM;
-               return 0;
-       }
-
-       req->rq_rephdr->seqno = req->rq_reqhdr->seqno;
-       rep = req->rq_rep.mds;
-
-       de = mds_fid2dentry(req->rq_obd, &req->rq_req.mds->fid1, NULL);
-       if (IS_ERR(de)) { 
-               EXIT;
-               req->rq_rephdr->status = -ENOENT;
-               return 0;
-       }
-
-       inode = de->d_inode;
-       rep->ino = inode->i_ino;
-       rep->atime = inode->i_atime;
-       rep->ctime = inode->i_ctime;
-       rep->mtime = inode->i_mtime;
-       rep->uid = inode->i_uid;
-       rep->gid = inode->i_gid;
-       rep->size = inode->i_size;
-       rep->mode = inode->i_mode;
-       rep->nlink = inode->i_nlink;
-       rep->valid = ~0;
-       mds_get_objid(inode, &rep->objid);
-       dput(de); 
-       return 0;
-}
-
-int mds_open(struct ptlrpc_request *req)
-{
-       struct dentry *de;
-       struct inode *inode;
-       struct mds_rep *rep;
-       struct file *file;
-       struct vfsmount *mnt;
-       __u32 flags;
-       int rc;
-       
-       rc = mds_pack_rep(NULL, 0, NULL, 0, &req->rq_rephdr, &req->rq_rep, 
-                         &req->rq_replen, &req->rq_repbuf);
-       if (rc) { 
-               EXIT;
-               CERROR("mds: out of memory\n");
-               req->rq_status = -ENOMEM;
-               return 0;
-       }
-
-       req->rq_rephdr->seqno = req->rq_reqhdr->seqno;
-       rep = req->rq_rep.mds;
-
-       de = mds_fid2dentry(req->rq_obd, &req->rq_req.mds->fid1, &mnt);
-       if (IS_ERR(de)) { 
-               EXIT;
-               req->rq_rephdr->status = -ENOENT;
-               return 0;
-       }
-       flags = req->rq_req.mds->flags;
-       file = dentry_open(de, mnt, flags);
-       if (!file || IS_ERR(file)) { 
-               req->rq_rephdr->status = -EINVAL;
-               return 0;
-       }               
-       
-       rep->objid = (__u64) (unsigned long)file; 
-       mds_get_objid(inode, &rep->objid);
-       dput(de); 
-       return 0;
-}
-
-
-int mds_readpage(struct ptlrpc_request *req)
-{
-       struct vfsmount *mnt;
-       struct dentry *de;
-       struct file *file; 
-       struct niobuf *niobuf; 
-       struct mds_rep *rep;
-       int rc;
-       
-       rc = mds_pack_rep(NULL, 0, NULL, 0, &req->rq_rephdr, &req->rq_rep, 
-                         &req->rq_replen, &req->rq_repbuf);
-       if (rc) { 
-               EXIT;
-               CERROR("mds: out of memory\n");
-               req->rq_status = -ENOMEM;
-               return 0;
-       }
-
-       req->rq_rephdr->seqno = req->rq_reqhdr->seqno;
-       rep = req->rq_rep.mds;
-
-       de = mds_fid2dentry(req->rq_obd, &req->rq_req.mds->fid1, &mnt);
-       if (IS_ERR(de)) { 
-               EXIT;
-               req->rq_rephdr->status = PTR_ERR(de); 
-               return 0;
-       }
-
-        CDEBUG(D_INODE, "ino %ld\n", de->d_inode->i_ino);
-
-       file = dentry_open(de, mnt, O_RDONLY | O_LARGEFILE); 
-       /* note: in case of an error, dentry_open puts dentry */
-       if (IS_ERR(file)) { 
-               EXIT;
-               req->rq_rephdr->status = PTR_ERR(file);
-               return 0;
-       }
-
-       niobuf = mds_req_tgt(req->rq_req.mds);
-
-       /* to make this asynchronous make sure that the handling function 
-          doesn't send a reply when this function completes. Instead a 
-          callback function would send the reply */ 
-       rc = mds_sendpage(req, file, req->rq_req.mds->size, niobuf); 
-
-       filp_close(file, 0);
-       req->rq_rephdr->status = rc;
-       EXIT;
-       return 0;
-}
-
-int mds_reint(struct ptlrpc_request *req)
-{
-       int rc;
-       char *buf = mds_req_tgt(req->rq_req.mds);
-       int len = req->rq_req.mds->tgtlen;
-       struct mds_update_record rec;
-       
-       rc = mds_update_unpack(buf, len, &rec);
-       if (rc) { 
-               CERROR("invalid record\n");
-               req->rq_status = -EINVAL;
-               return 0;
-       }
-       /* rc will be used to interrupt a for loop over multiple records */
-       rc = mds_reint_rec(&rec, req); 
-       return 0; 
-}
-
-//int mds_handle(struct mds_conn *conn, int len, char *buf)
-int mds_handle(struct ptlrpc_request *req)
-{
-       int rc;
-       struct ptlreq_hdr *hdr;
-
-       ENTRY;
-
-       hdr = (struct ptlreq_hdr *)req->rq_reqbuf;
-
-       if (NTOH__u32(hdr->type) != MDS_TYPE_REQ) {
-               CERROR("lustre_mds: wrong packet type sent %d\n",
-                      NTOH__u32(hdr->type));
-               rc = -EINVAL;
-               goto out;
-       }
-
-       rc = mds_unpack_req(req->rq_reqbuf, req->rq_reqlen, 
-                           &req->rq_reqhdr, &req->rq_req);
-       if (rc) { 
-               CERROR("lustre_mds: Invalid request\n");
-               EXIT; 
-               goto out;
-       }
-
-       switch (req->rq_reqhdr->opc) { 
-
-       case MDS_GETATTR:
-               CDEBUG(D_INODE, "getattr\n");
-               rc = mds_getattr(req);
-               break;
-
-       case MDS_READPAGE:
-               CDEBUG(D_INODE, "readpage\n");
-               rc = mds_readpage(req);
-               break;
-
-       case MDS_REINT:
-               CDEBUG(D_INODE, "reint\n");
-               rc = mds_reint(req);
-               break;
-
-       default:
-               return mds_error(req);
-       }
-
-out:
-       if (rc) { 
-               CERROR("no header\n");
-               return 0;
-       }
-
-       if( req->rq_status) { 
-               mds_error(req);
-       } else { 
-               CDEBUG(D_INODE, "sending reply\n"); 
-               mds_reply(req); 
-       }
-
-       return 0;
-}
-
-
-static void mds_timer_run(unsigned long __data)
-{
-       struct task_struct * p = (struct task_struct *) __data;
-
-       wake_up_process(p);
-}
-
-int mds_main(void *arg)
-{
-       struct mds_obd *mds = (struct mds_obd *) arg;
-       struct timer_list timer;
-        DECLARE_WAITQUEUE(wait, current);
-
-       lock_kernel();
-       daemonize();
-       spin_lock_irq(&current->sigmask_lock);
-       sigfillset(&current->blocked);
-       recalc_sigpending(current);
-       spin_unlock_irq(&current->sigmask_lock);
-
-       sprintf(current->comm, "lustre_mds");
-
-       /* Set up an interval timer which can be used to trigger a
-           wakeup after the interval expires */
-       init_timer(&timer);
-       timer.data = (unsigned long) current;
-       timer.function = mds_timer_run;
-       mds->mds_timer = &timer;
-
-       /* Record that the  thread is running */
-       mds->mds_thread = current;
-        mds->mds_flags = MDS_RUNNING;
-       wake_up(&mds->mds_done_waitq); 
-
-       /* And now, wait forever for commit wakeup events. */
-       while (1) {
-                int signal;
-               int rc;
-
-               wake_up(&mds->mds_done_waitq);
-               CDEBUG(D_INODE, "mds_wakes pick up req here and continue\n"); 
-
-               if (mds->mds_service != NULL) {
-                       ptl_event_t ev;
-                        struct ptlrpc_request request;
-                        struct ptlrpc_service *service;
-
-                        CDEBUG(D_IOCTL, "-- sleeping\n");
-                        signal = 0;
-                        add_wait_queue(&mds->mds_waitq, &wait);
-                        while (1) {
-                                set_current_state(TASK_INTERRUPTIBLE);
-                               rc = PtlEQGet(mds->mds_service->srv_eq_h, &ev);
-                                if (rc == PTL_OK || rc == PTL_EQ_DROPPED)
-                                        break;
-                                CERROR("EQGet rc %d\n", rc); 
-                                if (mds->mds_flags & MDS_STOPPING)
-                                        break;
-
-                                /* if this process really wants to die,
-                                 * let it go */
-                                if (sigismember(&(current->pending.signal),
-                                                SIGKILL) ||
-                                    sigismember(&(current->pending.signal),
-                                                SIGINT)) {
-                                        signal = 1;
-                                        break;
-                                }
-
-                                schedule();
-                        }
-                        remove_wait_queue(&mds->mds_waitq, &wait);
-                        set_current_state(TASK_RUNNING);
-                        CDEBUG(D_IOCTL, "-- done\n");
-
-                        if (signal == 1) {
-                                /* We broke out because of a signal */
-                                EXIT;
-                                break;
-                        }
-                        if (mds->mds_flags & MDS_STOPPING) { 
-                                break;
-                        }
-
-                        service = (struct ptlrpc_service *)ev.mem_desc.user_ptr;
-
-                        /* FIXME: If we move to an event-driven model,
-                         * we should put the request on the stack of
-                         * mds_handle instead. */
-                        memset(&request, 0, sizeof(request));
-                        request.rq_reqbuf = ev.mem_desc.start + ev.offset;
-                        request.rq_reqlen = ev.mem_desc.length;
-                        request.rq_obd = MDS;
-                        request.rq_xid = ev.match_bits;
-                        CERROR("got req %d\n", request.rq_xid);
-
-                        request.rq_peer.peer_nid = ev.initiator.nid;
-                        /* FIXME: this NI should be the incoming NI.
-                         * We don't know how to find that from here. */
-                        request.rq_peer.peer_ni =
-                                mds->mds_service->srv_self.peer_ni;
-                        rc = mds_handle(&request);
-
-                        /* Inform the rpc layer the event has been handled */ 
-                        ptl_received_rpc(service);
-               } else {
-                       struct ptlrpc_request *request;
-
-                        CDEBUG(D_IOCTL, "-- sleeping\n");
-                        add_wait_queue(&mds->mds_waitq, &wait);
-                        while (1) {
-                                spin_lock(&mds->mds_lock);
-                                if (!list_empty(&mds->mds_reqs))
-                                        break;
-
-                                set_current_state(TASK_INTERRUPTIBLE);
-
-                                /* if this process really wants to die,
-                                 * let it go */
-                                if (sigismember(&(current->pending.signal),
-                                                SIGKILL) ||
-                                    sigismember(&(current->pending.signal),
-                                                SIGINT))
-                                        break;
-
-                                spin_unlock(&mds->mds_lock);
-
-                                schedule();
-                        }
-                        remove_wait_queue(&mds->mds_waitq, &wait);
-                        set_current_state(TASK_RUNNING);
-                        CDEBUG(D_IOCTL, "-- done\n");
-
-                       if (list_empty(&mds->mds_reqs)) {
-                               CDEBUG(D_INODE, "woke because of signal\n");
-                                spin_unlock(&mds->mds_lock);
-                       } else {
-                               request = list_entry(mds->mds_reqs.next,
-                                                    struct ptlrpc_request,
-                                                    rq_list);
-                               list_del(&request->rq_list);
-                                spin_unlock(&mds->mds_lock);
-                               rc = mds_handle(request);
-                       }
-               }
-       }
-
-       del_timer_sync(mds->mds_timer);
-
-       /* XXX maintain a list of all managed devices: cleanup here */
-
-       mds->mds_thread = NULL;
-       wake_up(&mds->mds_done_waitq);
-       CERROR("lustre_mds: exiting\n");
-       return 0;
-}
-
-static void mds_stop_srv_thread(struct mds_obd *mds)
-{
-       mds->mds_flags |= MDS_STOPPING;
-
-       while (mds->mds_thread) {
-               wake_up(&mds->mds_waitq);
-               sleep_on(&mds->mds_done_waitq);
-       }
-}
-
-static void mds_start_srv_thread(struct mds_obd *mds)
-{
-       init_waitqueue_head(&mds->mds_waitq);
-       init_waitqueue_head(&mds->mds_done_waitq);
-       kernel_thread(mds_main, (void *)mds, CLONE_VM | CLONE_FS | CLONE_FILES);
-       while (!mds->mds_thread) 
-               sleep_on(&mds->mds_done_waitq);
-}
-
-/* mount the file system (secretly) */
-static int mds_setup(struct obd_device *obddev, obd_count len,
-                       void *buf)
-                       
-{
-       struct obd_ioctl_data* data = buf;
-       struct mds_obd *mds = &obddev->u.mds;
-       struct vfsmount *mnt;
-       struct lustre_peer peer;
-       int err; 
-        ENTRY;
-
-
-       mnt = do_kern_mount(data->ioc_inlbuf2, 0, data->ioc_inlbuf1, NULL); 
-       err = PTR_ERR(mnt);
-       if (IS_ERR(mnt)) { 
-               EXIT;
-               return err;
-       }
-
-       mds->mds_sb = mnt->mnt_root->d_inode->i_sb;
-       if (!obddev->u.mds.mds_sb) {
-               EXIT;
-               return -ENODEV;
-       }
-
-       mds->mds_vfsmnt = mnt;
-       obddev->u.mds.mds_fstype = strdup(data->ioc_inlbuf2);
-
-       mds->mds_ctxt.pwdmnt = mnt;
-       mds->mds_ctxt.pwd = mnt->mnt_root;
-       mds->mds_ctxt.fs = KERNEL_DS;
-       mds->mds_remote_nid = 0;
-
-       INIT_LIST_HEAD(&mds->mds_reqs);
-       mds->mds_thread = NULL;
-       mds->mds_flags = 0;
-       mds->mds_interval = 3 * HZ;
-       MDS = mds;
-
-       spin_lock_init(&obddev->u.mds.mds_lock);
-
-       err = kportal_uuid_to_peer("self", &peer);
-       if (err == 0) {
-               OBD_ALLOC(mds->mds_service, sizeof(*mds->mds_service));
-               if (mds->mds_service == NULL)
-                       return -ENOMEM;
-               mds->mds_service->srv_buf_size = 64 * 1024;
-               //mds->mds_service->srv_buf_size = 1024;
-               mds->mds_service->srv_portal = MDS_REQUEST_PORTAL;
-               memcpy(&mds->mds_service->srv_self, &peer, sizeof(peer));
-               mds->mds_service->srv_wait_queue = &mds->mds_waitq;
-
-               rpc_register_service(mds->mds_service, "self");
-       }
-
-       mds_start_srv_thread(mds);
-
-        MOD_INC_USE_COUNT;
-        EXIT; 
-        return 0;
-} 
-
-static int mds_cleanup(struct obd_device * obddev)
-{
-        struct super_block *sb;
-       struct mds_obd *mds = &obddev->u.mds;
-
-        ENTRY;
-
-        if ( !(obddev->obd_flags & OBD_SET_UP) ) {
-                EXIT;
-                return 0;
-        }
-
-        if ( !list_empty(&obddev->obd_gen_clients) ) {
-                CERROR("still has clients!\n");
-                EXIT;
-                return -EBUSY;
-        }
-
-       MDS = NULL;
-       mds_stop_srv_thread(mds);
-        rpc_unregister_service(mds->mds_service);
-        OBD_FREE(mds->mds_service, sizeof(*mds->mds_service));
-
-        sb = mds->mds_sb;
-        if (!mds->mds_sb){
-                EXIT;
-                return 0;
-        }
-
-       if (!list_empty(&mds->mds_reqs)) {
-               // XXX reply with errors and clean up
-               CDEBUG(D_INODE, "Request list not empty!\n");
-       }
-
-       unlock_kernel();
-       mntput(mds->mds_vfsmnt); 
-        mds->mds_sb = 0;
-       kfree(mds->mds_fstype);
-       lock_kernel();
-
-        MOD_DEC_USE_COUNT;
-        EXIT;
-        return 0;
-}
-
-/* use obd ops to offer management infrastructure */
-static struct obd_ops mds_obd_ops = {
-        o_setup:       mds_setup,
-        o_cleanup:     mds_cleanup,
-};
-
-static int __init mds_init(void)
-{
-        obd_register_type(&mds_obd_ops, LUSTRE_MDS_NAME);
-       return 0;
-}
-
-static void __exit mds_exit(void)
-{
-       obd_unregister_type(LUSTRE_MDS_NAME);
-}
-
-MODULE_AUTHOR("Peter J. Braam <braam@clusterfs.com>");
-MODULE_DESCRIPTION("Lustre Metadata Server (MDS) v0.01");
-MODULE_LICENSE("GPL");
-
-
-// for testing (maybe this stays)
-EXPORT_SYMBOL(mds_queue_req);
-
-module_init(mds_init);
-module_exit(mds_exit);
diff --git a/lustre/mds/mds_reint.c b/lustre/mds/mds_reint.c
deleted file mode 100644 (file)
index 2ccd98c..0000000
+++ /dev/null
@@ -1,361 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  linux/mds/mds_reint.c
- *  
- *  Lustre Metadata Server (mds) reintegration routines
- * 
- *  Copyright (C) 2002  Cluster File Systems, Inc.
- *  author: Peter Braam <braam@clusterfs.com>
- *
- *  This code is issued under the GNU General Public License.
- *  See the file COPYING in this distribution
- *
- */
-
-// XXX - add transaction sequence numbers
-
-#define EXPORT_SYMTAB
-
-#include <linux/version.h>
-#include <linux/module.h>
-#include <linux/fs.h>
-#include <linux/stat.h>
-#include <linux/locks.h>
-#include <linux/ext2_fs.h>
-#include <linux/quotaops.h>
-#include <asm/unistd.h>
-#include <asm/uaccess.h>
-
-#define DEBUG_SUBSYSTEM S_MDS
-
-#include <linux/obd_support.h>
-#include <linux/obd.h>
-#include <linux/lustre_lib.h>
-#include <linux/lustre_idl.h>
-#include <linux/lustre_mds.h>
-#include <linux/obd_class.h>
-
-extern struct ptlrpc_request *mds_prep_req(int size, int opcode, int namelen, char *name, int tgtlen, char *tgt);
-
-static int mds_reint_setattr(struct mds_update_record *rec, struct ptlrpc_request *req)
-{
-       struct dentry *de;
-
-       de = mds_fid2dentry(req->rq_obd, rec->ur_fid1, NULL);
-       if (IS_ERR(de)) { 
-               req->rq_rephdr->status = -ESTALE;
-               return 0;
-       }
-
-        CDEBUG(D_INODE, "ino %ld\n", de->d_inode->i_ino);
-
-       /* a _really_ horrible hack to avoid removing the data stored
-          in the block pointers; this data is the object id 
-           this will go into an extended attribute at some point.
-       */
-       if ( rec->ur_iattr.ia_valid & ATTR_SIZE ) { 
-               /* ATTR_SIZE would invoke truncate: clear it */ 
-               rec->ur_iattr.ia_valid &= ~ATTR_SIZE;
-               de->d_inode->i_size = rec->ur_iattr.ia_size;
-               /* make sure _something_ gets set - so new inode
-                  goes to disk (probably won't work over XFS */
-               if (!rec->ur_iattr.ia_valid & ATTR_MODE) { 
-                       rec->ur_iattr.ia_valid |= ATTR_MODE;
-                       rec->ur_iattr.ia_mode = de->d_inode->i_mode;
-               }
-       }
-       if ( de->d_inode->i_op->setattr ) {
-               req->rq_rephdr->status =
-                       de->d_inode->i_op->setattr(de, &rec->ur_iattr);
-       } else { 
-               req->rq_rephdr->status =
-                       inode_setattr(de->d_inode, &rec->ur_iattr);
-       }
-
-       l_dput(de);
-       EXIT;
-       return 0;
-}
-
-/* 
-   XXX nasty hack: store the object id in the first two
-   direct block spots 
-*/
-static inline void mds_store_objid(struct inode *inode, __u64 *id)
-{
-       memcpy(&inode->u.ext2_i.i_data, id, sizeof(*id));
-}
-
-
-static int mds_reint_create(struct mds_update_record *rec, 
-                           struct ptlrpc_request *req)
-{
-       int type = rec->ur_mode & S_IFMT;
-       struct dentry *de;
-       struct mds_rep *rep = req->rq_rep.mds;
-       struct dentry *dchild; 
-       int rc;
-       ENTRY;
-
-       de = mds_fid2dentry(req->rq_obd, rec->ur_fid1, NULL);
-       if (IS_ERR(de)) { 
-               req->rq_rephdr->status = -ESTALE;
-               EXIT;
-               return 0;
-       }
-        CDEBUG(D_INODE, "ino %ld\n", de->d_inode->i_ino);
-
-       dchild = lookup_one_len(rec->ur_name, de, rec->ur_namelen - 1);
-       rc = PTR_ERR(dchild);
-       if (IS_ERR(dchild)) { 
-               CERROR("child lookup error %d\n", rc);
-               dput(de); 
-               req->rq_rephdr->status = -ESTALE;
-               EXIT;
-               return 0;
-       }
-
-       if (dchild->d_inode) {
-               CERROR("child exists (dir %ld, name %s)\n", 
-                      de->d_inode->i_ino, rec->ur_name);
-               dput(de); 
-               req->rq_rephdr->status = -EEXIST;
-               EXIT;
-               return 0;
-       }
-
-       switch (type) {
-       case S_IFREG: { 
-               rc = vfs_create(de->d_inode, dchild, rec->ur_mode);
-               
-               EXIT;
-               break;
-       }
-       case S_IFDIR: { 
-               rc = vfs_mkdir(de->d_inode, dchild, rec->ur_mode);
-               EXIT;
-               break;
-       } 
-       case S_IFLNK: { 
-               rc = vfs_symlink(de->d_inode, dchild, rec->ur_tgt);
-               EXIT;
-               break;
-       } 
-       case S_IFCHR:
-       case S_IFBLK:
-       case S_IFIFO:
-       case S_IFSOCK: { 
-               int rdev = rec->ur_id;
-               rc = vfs_mknod(de->d_inode, dchild, rec->ur_mode, rdev); 
-               EXIT;
-               break;
-       }
-       }
-
-       req->rq_rephdr->status = rc;
-       if (!rc) { 
-               if (type == S_IFREG)
-                       mds_store_objid(dchild->d_inode, &rec->ur_id); 
-               dchild->d_inode->i_atime = rec->ur_time;
-               dchild->d_inode->i_ctime = rec->ur_time;
-               dchild->d_inode->i_mtime = rec->ur_time;
-               dchild->d_inode->i_uid = rec->ur_uid;
-               dchild->d_inode->i_gid = rec->ur_gid;
-               rep->ino = dchild->d_inode->i_ino;
-       }
-
-       dput(de);
-       dput(dchild); 
-       EXIT;
-       return 0;
-}
-
-static int mds_reint_unlink(struct mds_update_record *rec, 
-                           struct ptlrpc_request *req)
-{
-       struct dentry *de;
-       struct dentry *dchild; 
-       int rc;
-       ENTRY;
-
-       de = mds_fid2dentry(req->rq_obd, rec->ur_fid1, NULL);
-       if (IS_ERR(de)) { 
-               req->rq_rephdr->status = -ESTALE;
-               EXIT;
-               return 0;
-       }
-        CDEBUG(D_INODE, "ino %ld\n", de->d_inode->i_ino);
-
-       dchild = lookup_one_len(rec->ur_name, de, rec->ur_namelen - 1);
-       rc = PTR_ERR(dchild);
-       if (IS_ERR(dchild)) { 
-               CERROR("child lookup error %d\n", rc);
-               dput(de); 
-               req->rq_rephdr->status = -ESTALE;
-               EXIT;
-               return 0;
-       }
-
-       if (!dchild->d_inode) {
-               CERROR("child doesn't exist (dir %ld, name %s\n", 
-                      de->d_inode->i_ino, rec->ur_name);
-               dput(de); 
-               req->rq_rephdr->status = -ESTALE;
-               EXIT;
-               return 0;
-       }
-
-       switch (dchild->d_inode->i_mode & S_IFMT) {
-       case S_IFDIR:
-               rc = vfs_rmdir(de->d_inode, dchild);
-               EXIT;
-               break;
-       default:
-               rc = vfs_unlink(de->d_inode, dchild);
-               
-               EXIT;
-               break;
-       }
-
-       req->rq_rephdr->status = rc;
-       dput(de);
-       dput(dchild); 
-       EXIT;
-       return 0;
-}
-
-static int mds_reint_link(struct mds_update_record *rec, 
-                           struct ptlrpc_request *req)
-{
-       struct dentry *de_src = NULL;
-       struct dentry *de_tgt_dir = NULL;
-       struct dentry *dchild = NULL; 
-       int rc;
-       ENTRY;
-
-       rc = -ESTALE;
-       de_src = mds_fid2dentry(req->rq_obd, rec->ur_fid1, NULL);
-       if (IS_ERR(de_src)) { 
-               EXIT;
-               goto out_link;
-       }
-
-       de_tgt_dir = mds_fid2dentry(req->rq_obd, rec->ur_fid2, NULL);
-       if (IS_ERR(de_tgt_dir)) { 
-               rc = -ESTALE;
-               EXIT;
-               goto out_link;
-       }
-
-       dchild = lookup_one_len(rec->ur_name, de_tgt_dir, rec->ur_namelen - 1);
-       if (IS_ERR(dchild)) { 
-               CERROR("child lookup error %d\n", rc);
-               req->rq_rephdr->status = -ESTALE;
-               goto out_link;
-       }
-
-       if (dchild->d_inode) {
-               CERROR("child exists (dir %ld, name %s\n", 
-                      de_tgt_dir->d_inode->i_ino, rec->ur_name);
-               EXIT;
-               goto out_link;
-       }
-
-       rc = vfs_link(de_src, de_tgt_dir->d_inode, dchild); 
-
- out_link:
-       req->rq_rephdr->status = rc;
-       l_dput(de_src);
-       l_dput(de_tgt_dir); 
-       l_dput(dchild); 
-       EXIT;
-       return 0;
-}
-
-
-static int mds_reint_rename(struct mds_update_record *rec, 
-                           struct ptlrpc_request *req)
-{
-       struct dentry *de_srcdir = NULL;
-       struct dentry *de_tgtdir = NULL;
-       struct dentry *de_old = NULL; 
-       struct dentry *de_new = NULL; 
-       int rc;
-       ENTRY;
-
-       rc = -ESTALE;
-       de_srcdir = mds_fid2dentry(req->rq_obd, rec->ur_fid1, NULL);
-       if (IS_ERR(de_srcdir)) { 
-               EXIT;
-               goto out_rename;
-       }
-
-       de_tgtdir = mds_fid2dentry(req->rq_obd, rec->ur_fid2, NULL);
-       if (IS_ERR(de_tgtdir)) { 
-               rc = -ESTALE;
-               EXIT;
-               goto out_rename;
-       }
-
-       de_old = lookup_one_len(rec->ur_name, de_srcdir, rec->ur_namelen - 1);
-       if (IS_ERR(de_old)) { 
-               CERROR("child lookup error %d\n", rc);
-               goto out_rename;
-       }
-
-       de_new = lookup_one_len(rec->ur_tgt, de_tgtdir, rec->ur_tgtlen - 1);
-       if (IS_ERR(de_new)) { 
-               CERROR("child lookup error %d\n", rc);
-               goto out_rename;
-       }
-
-       rc = vfs_rename(de_srcdir->d_inode, de_old, de_tgtdir->d_inode, de_new);
-
- out_rename:
-       req->rq_rephdr->status = rc;
-       l_dput(de_new);
-       l_dput(de_old); 
-       l_dput(de_tgtdir); 
-       l_dput(de_srcdir); 
-       EXIT;
-       return 0;
-}
-
-typedef int (*mds_reinter)(struct mds_update_record *, struct ptlrpc_request*); 
-
-static mds_reinter  reinters[REINT_MAX+1] = { 
-       [REINT_SETATTR]   mds_reint_setattr, 
-       [REINT_CREATE]    mds_reint_create,
-       [REINT_UNLINK]    mds_reint_unlink, 
-       [REINT_LINK]      mds_reint_link,
-       [REINT_RENAME]    mds_reint_rename
-};
-
-int mds_reint_rec(struct mds_update_record *rec, struct ptlrpc_request *req)
-{
-       int rc; 
-
-       if (rec->ur_opcode < 0 || rec->ur_opcode > REINT_MAX) { 
-               CERROR("opcode %d not valid\n", 
-                      rec->ur_opcode); 
-               rc = req->rq_status = -EINVAL;
-               return rc;
-       }
-
-       rc = mds_pack_rep(NULL, 0, NULL, 0, &req->rq_rephdr, &req->rq_rep, 
-                         &req->rq_replen, &req->rq_repbuf);
-       if (rc) { 
-               EXIT;
-               CERROR("mds: out of memory\n");
-               rc = req->rq_status = -ENOMEM;
-               return rc;
-       }
-       req->rq_rephdr->seqno = req->rq_reqhdr->seqno;
-
-       rc = reinters[rec->ur_opcode](rec, req); 
-       req->rq_status = rc;
-
-       return rc;
-} 
-
diff --git a/lustre/obdclass/.cvsignore b/lustre/obdclass/.cvsignore
deleted file mode 100644 (file)
index e530020..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-.Xrefs
-config.log
-config.status
-configure
-Makefile
-Makefile.in
-.deps
-TAGS
diff --git a/lustre/obdclass/Makefile.am b/lustre/obdclass/Makefile.am
deleted file mode 100644 (file)
index 01eed46..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-DEFS:=
-MODULE = obdclass
-modulefs_DATA = obdclass.o
-EXTRA_PROGRAMS = obdclass
-obdclass_SOURCES = genops.c proc_lustre.c class_obd.c sysctl.c
-
-include $(top_srcdir)/Rules
diff --git a/lustre/obdclass/class_obd.c b/lustre/obdclass/class_obd.c
deleted file mode 100644 (file)
index 2c3a10f..0000000
+++ /dev/null
@@ -1,847 +0,0 @@
-/*
- *              An implementation of a loadable kernel mode driver providing
- *              multiple kernel/user space bidirectional communications links.
- *
- *              Author:         Alan Cox <alan@cymru.net>
- *
- *              This program is free software; you can redistribute it and/or
- *              modify it under the terms of the GNU General Public License
- *              version 2 as published by the Free Software Foundation.
- * 
- *              Adapted to become the Linux 2.0 Coda pseudo device
- *              Peter  Braam  <braam@maths.ox.ac.uk> 
- *              Michael Callahan <mjc@emmy.smith.edu>           
- *
- *              Changes for Linux 2.1
- *              Copyright (c) 1997 Carnegie-Mellon University
- *
- *              Redone again for Intermezzo
- *              Copyright (c) 1998 Peter J. Braam
- *
- *              Hacked up again for simulated OBD
- *              Copyright (c) 1999 Stelias Computing, Inc.
- *                (authors {pschwan,braam}@stelias.com)
- *              Copyright (C) 1999 Seagate Technology, Inc.
- *              Copyright (C) 2001 Cluster File Systems, Inc.
- *
- * 
- */
-
-#define EXPORT_SYMTAB
-#include <linux/config.h> /* for CONFIG_PROC_FS */
-#include <linux/module.h>
-#include <linux/errno.h>
-#include <linux/kernel.h>
-#include <linux/major.h>
-#include <linux/kmod.h>   /* for request_module() */
-#include <linux/sched.h>
-#include <linux/lp.h>
-#include <linux/slab.h>
-#include <linux/ioport.h>
-#include <linux/fcntl.h>
-#include <linux/delay.h>
-#include <linux/skbuff.h>
-#include <linux/proc_fs.h>
-#include <linux/fs.h>
-#include <linux/poll.h>
-#include <linux/init.h>
-#include <linux/list.h>
-#include <asm/io.h>
-#include <asm/system.h>
-#include <asm/poll.h>
-#include <asm/uaccess.h>
-#include <linux/miscdevice.h>
-
-#define DEBUG_SUBSYSTEM S_CLASS
-
-#include <linux/obd_support.h>
-#include <linux/obd_class.h>
-
-static int obd_init_magic;
-int obd_print_entry = 1;
-int obd_debug_level = ~0;
-long obd_memory = 0;
-struct obd_device obd_dev[MAX_OBD_DEVICES];
-struct list_head obd_types;
-
-/*  opening /dev/obd */
-static int obd_class_open(struct inode * inode, struct file * file)
-{
-        ENTRY;
-
-       file->private_data = NULL;
-        MOD_INC_USE_COUNT;
-        EXIT;
-        return 0;
-}
-
-/*  closing /dev/obd */
-static int obd_class_release(struct inode * inode, struct file * file)
-{
-        ENTRY;
-
-       if (file->private_data)
-               file->private_data = NULL;
-
-        MOD_DEC_USE_COUNT;
-        EXIT;
-        return 0;
-}
-
-/* 
- * support functions: we could use inter-module communication, but this 
- * is more portable to other OS's
- */
-static struct obd_type *obd_search_type(char *nm)
-{
-        struct list_head *tmp;
-        struct obd_type *type;
-        CDEBUG(D_INFO, "SEARCH %s\n", nm);
-        
-        tmp = &obd_types;
-        while ( (tmp = tmp->next) != &obd_types ) {
-                type = list_entry(tmp, struct obd_type, typ_chain);
-                CDEBUG(D_INFO, "TYP %s\n", type->typ_name);
-                if (strlen(type->typ_name) == strlen(nm) &&
-                    strcmp(type->typ_name, nm) == 0 ) {
-                        return type;
-                }
-        }
-       return NULL;
-}
-
-static struct obd_type *obd_nm_to_type(char *nm) 
-{
-        struct obd_type *type = obd_search_type(nm);
-
-#ifdef CONFIG_KMOD
-       if ( !type ) {
-               if ( !request_module(nm) ) {
-                       CDEBUG(D_INFO, "Loaded module '%s'\n", nm);
-                       type = obd_search_type(nm);
-               } else {
-                       CDEBUG(D_INFO, "Can't load module '%s'\n", nm);
-               }
-       }
-#endif
-        return type;
-}
-
-/* to control /dev/obd */
-static int obd_class_ioctl (struct inode * inode, struct file * filp, 
-                            unsigned int cmd, unsigned long arg)
-{
-        /* NOTE this must be larger than any of the ioctl data structs */
-        char buf[1024];
-       struct obd_ioctl_data *data;
-       struct obd_device *obd = filp->private_data;
-       struct obd_conn conn;
-        int err = 0;
-       ENTRY;
-
-       memset(buf, 0, sizeof(buf));
-
-       if (!obd && cmd != OBD_IOC_DEVICE && cmd != TCGETS) {
-               CERROR("OBD ioctl: No device\n");
-               return -EINVAL;
-       } 
-       if (obd_ioctl_getdata(buf, buf + 800, (void *)arg)) { 
-               CERROR("OBD ioctl: data error\n");
-               return -EINVAL;
-       }
-       data = (struct obd_ioctl_data *)buf;
-
-        switch (cmd) {
-        case TCGETS: { 
-               EXIT;
-                return -EINVAL;
-       }
-       case OBD_IOC_DEVICE: { 
-               CDEBUG(D_IOCTL, "\n");
-               if (data->ioc_dev >= MAX_OBD_DEVICES ||
-                   data->ioc_dev < 0) { 
-                       CERROR("OBD ioctl: DEVICE insufficient devices\n");
-                       return -EINVAL;
-               }
-               CDEBUG(D_IOCTL, "device %d\n", data->ioc_dev);
-
-               filp->private_data = &obd_dev[data->ioc_dev];
-               EXIT;
-               return 0;
-       }
-
-        case OBD_IOC_ATTACH: {
-                struct obd_type *type;
-
-                ENTRY;
-                /* have we attached a type to this device */
-                if ( obd->obd_flags & OBD_ATTACHED ) {
-                        CERROR("OBD: Device %d already typed as  %s.\n",
-                               obd->obd_minor, MKSTR(obd->obd_type->typ_name));
-                        return -EBUSY;
-                }
-
-               CDEBUG(D_IOCTL, "attach %s %s\n",  MKSTR(data->ioc_inlbuf1), 
-                      MKSTR(data->ioc_inlbuf2));
-
-                /* find the type */
-                type = obd_nm_to_type(data->ioc_inlbuf1);
-                if ( !type ) {
-                        CERROR("OBD: unknown type dev %d\n", obd->obd_minor);
-                        return -EINVAL;
-                }
-
-                obd->obd_type = type;
-                obd->obd_multi_count = 0;
-                INIT_LIST_HEAD(&obd->obd_gen_clients);
-
-                /* do the attach */
-                if ( OBT(obd) && OBP(obd, attach) ) {
-                       err = OBP(obd, attach)(obd, sizeof(*data), data);
-               }
-
-                if ( err ) {
-                        obd->obd_type = NULL;
-                        EXIT;
-                } else {
-                        obd->obd_flags |=  OBD_ATTACHED;
-                        type->typ_refcnt++;
-                        CDEBUG(D_IOCTL, "OBD: dev %d attached type %s\n", 
-                              obd->obd_minor, data->ioc_inlbuf1);
-                       obd->obd_proc_entry = 
-                               proc_lustre_register_obd_device(obd);
-                        MOD_INC_USE_COUNT;
-                        EXIT;
-                }
-
-                return err;
-        }
-
-        case OBD_IOC_DETACH: {
-                ENTRY;
-                if (obd->obd_flags & OBD_SET_UP) {
-                        CERROR("OBD device %d still set up\n", obd->obd_minor);
-                        return -EBUSY;
-                }
-                if (! (obd->obd_flags & OBD_ATTACHED) ) {
-                        CERROR("OBD device %d not attached\n", obd->obd_minor);
-                        return -ENODEV;
-                }
-                if ( !list_empty(&obd->obd_gen_clients) ) {
-                        CERROR("OBD device %d has connected clients\n",
-                               obd->obd_minor);
-                        return -EBUSY;
-                }
-
-               if (obd->obd_proc_entry)
-                       proc_lustre_release_obd_device(obd);
-
-                obd->obd_flags &= ~OBD_ATTACHED;
-                obd->obd_type->typ_refcnt--;
-                obd->obd_type = NULL;
-                MOD_DEC_USE_COUNT;
-                EXIT;
-                return 0;
-        }
-
-        case OBD_IOC_SETUP: {
-                ENTRY;
-                /* have we attached a type to this device? */
-                if (!(obd->obd_flags & OBD_ATTACHED)) {
-                        CERROR("Device %d not attached\n", obd->obd_minor);
-                        return -ENODEV;
-                }
-
-                /* has this been done already? */
-                if ( obd->obd_flags & OBD_SET_UP ) {
-                        CERROR("Device %d already setup (type %s)\n",
-                               obd->obd_minor, obd->obd_type->typ_name);
-                        return -EBUSY;
-                }
-
-                if ( OBT(obd) && OBP(obd, setup) )
-                       err = OBP(obd, setup)(obd, sizeof(*data), data);
-
-               if (!err) { 
-                       obd->obd_type->typ_refcnt++;
-                       obd->obd_flags |= OBD_SET_UP;
-                       EXIT;
-               }
-
-                return err;
-        }
-        case OBD_IOC_CLEANUP: {
-                ENTRY;
-
-               if ( !(obd->obd_flags & OBD_SET_UP) ) {
-                       EXIT;
-                       return -EINVAL;
-               }
-
-                err = obd_cleanup(obd);
-                if ( err ) {
-                        EXIT;
-                        return err;
-                }
-
-                obd->obd_flags &= ~OBD_SET_UP;
-                obd->obd_type->typ_refcnt--;
-                EXIT;
-                return 0;
-        }
-
-        case OBD_IOC_CONNECT:
-        {
-               conn.oc_id = data->ioc_conn1;
-               conn.oc_dev = obd; 
-
-                err = obd_connect(&conn);
-
-               CDEBUG(D_IOCTL, "assigned connection %d\n", conn.oc_id);
-               data->ioc_conn1 = conn.oc_id;
-                if ( err )
-                        return err;
-
-                return copy_to_user((int *)arg, data, sizeof(*data));
-        }
-
-        case OBD_IOC_DISCONNECT: { 
-               conn.oc_id = data->ioc_conn1;
-               conn.oc_dev = obd;
-
-                err = obd_disconnect(&conn);
-                return err;
-       }               
-
-       case OBD_IOC_DEC_USE_COUNT: { 
-               MOD_DEC_USE_COUNT;
-               return 0;
-       }
-
-        case OBD_IOC_CREATE: {
-                conn.oc_id = data->ioc_conn1;
-               conn.oc_dev = obd;
-
-                err = obd_create(&conn, &data->ioc_obdo1);
-                if (err) {
-                        EXIT;
-                        return err;
-                }
-
-                err = copy_to_user((int *)arg, data, sizeof(*data));
-                EXIT;
-                return err;
-        }
-
-        case OBD_IOC_GETATTR: {
-                conn.oc_id = data->ioc_conn1;
-               conn.oc_dev = obd;
-
-                err = obd_getattr(&conn, &data->ioc_obdo1);
-                if (err) {
-                        EXIT;
-                        return err;
-                }
-
-                err = copy_to_user((int *)arg, data, sizeof(*data));
-                EXIT;
-                return err;
-        }
-
-        case OBD_IOC_SETATTR: {
-                conn.oc_id = data->ioc_conn1;
-               conn.oc_dev = obd;
-
-                err = obd_setattr(&conn, &data->ioc_obdo1);
-                if (err) {
-                        EXIT;
-                        return err;
-                }
-
-                err = copy_to_user((int *)arg, data, sizeof(*data));
-                EXIT;
-                return err;
-       }
-
-        case OBD_IOC_DESTROY: {
-                conn.oc_id = data->ioc_conn1;
-               conn.oc_dev = obd;
-
-                err = obd_destroy(&conn, &data->ioc_obdo1);
-                if (err) {
-                        EXIT;
-                        return err;
-                }
-
-                err = copy_to_user((int *)arg, data, sizeof(*data));
-                EXIT;
-                return err;
-       }
-
-#if 0
-        case OBD_IOC_SYNC: {
-                struct oic_range_s *range = tmp_buf;
-
-                if (!obd->obd_type)
-                        return -ENODEV;
-
-                err = copy_from_user(range, (const void *)arg,  sizeof(*range));
-
-                if ( err ) {
-                        EXIT;
-                        return err;
-                }
-                        
-                if ( !OBT(obd) || !OBP(obd, sync) ) {
-                        err = -EOPNOTSUPP;
-                        EXIT;
-                        return err;
-                }
-
-                /* XXX sync needs to be tested/verified */
-                err = OBP(obd, sync)(&conn, &range->obdo, range->count,
-                                        range->offset);
-
-                if ( err ) {
-                        EXIT;
-                        return err;
-                }
-                        
-                return put_user(err, (int *) arg);
-        }
-
-        case OBD_IOC_READ: {
-                int err;
-                struct oic_rw_s *rw_s = tmp_buf;  /* read, write ioctl str */
-
-                err = copy_from_user(rw_s, (int *)arg, sizeof(*rw_s));
-                if ( err ) {
-                        EXIT;
-                        return err;
-                }
-
-                conn.oc_id = rw_s->conn_id;
-
-                if ( !OBT(obd) || !OBP(obd, read) ) {
-                        err = -EOPNOTSUPP;
-                        EXIT;
-                        return err;
-                }
-
-
-                err = OBP(obd, read)(&conn, &rw_s->obdo, rw_s->buf, 
-                                        &rw_s->count, rw_s->offset);
-                
-                ODEBUG(&rw_s->obdo);
-                CDEBUG(D_INFO, "READ: conn %d, count %Ld, offset %Ld, '%s'\n",
-                       rw_s->conn_id, rw_s->count, rw_s->offset, rw_s->buf);
-                if ( err ) {
-                        EXIT;
-                        return err;
-                }
-                        
-                err = copy_to_user((int*)arg, &rw_s->count, sizeof(rw_s->count));
-                EXIT;
-                return err;
-        }
-
-        case OBD_IOC_WRITE: {
-                struct oic_rw_s *rw_s = tmp_buf;  /* read, write ioctl str */
-
-                err = copy_from_user(rw_s, (int *)arg, sizeof(*rw_s));
-                if ( err ) {
-                        EXIT;
-                        return err;
-                }
-
-                conn.oc_id = rw_s->conn_id;
-
-                if ( !OBT(obd) || !OBP(obd, write) ) {
-                        err = -EOPNOTSUPP;
-                        return err;
-                }
-
-                CDEBUG(D_INFO, "WRITE: conn %d, count %Ld, offset %Ld, '%s'\n",
-                       rw_s->conn_id, rw_s->count, rw_s->offset, rw_s->buf);
-
-                err = OBP(obd, write)(&conn, &rw_s->obdo, rw_s->buf, 
-                                         &rw_s->count, rw_s->offset);
-                ODEBUG(&rw_s->obdo);
-                if ( err ) {
-                        EXIT;
-                        return err;
-                }
-
-                err = copy_to_user((int *)arg, &rw_s->count,
-                                   sizeof(rw_s->count));
-                EXIT;
-                return err;
-        }
-        case OBD_IOC_PREALLOCATE: {
-                struct oic_prealloc_s *prealloc = tmp_buf;
-
-                /* has this minor been registered? */
-                if (!obd->obd_type)
-                        return -ENODEV;
-
-                err = copy_from_user(prealloc, (int *)arg, sizeof(*prealloc));
-                if (err) 
-                        return -EFAULT;
-
-                if ( !(obd->obd_flags & OBD_ATTACHED) ||
-                     !(obd->obd_flags & OBD_SET_UP)) {
-                        CDEBUG(D_IOCTL, "Device not attached or set up\n");
-                        return -ENODEV;
-                }
-
-                if ( !OBT(obd) || !OBP(obd, preallocate) )
-                        return -EOPNOTSUPP;
-
-                conn.oc_id = prealloc->conn_id;
-                err = OBP(obd, preallocate)(&conn, &prealloc->alloc,
-                                               prealloc->ids);
-                if ( err ) {
-                        EXIT;
-                        return err;
-                }
-
-                err =copy_to_user((int *)arg, prealloc, sizeof(*prealloc));
-                EXIT;
-                return err;
-        }
-        case OBD_IOC_STATFS: {
-                struct statfs *tmp;
-                unsigned int conn_id;
-                struct statfs buf;
-
-                /* has this minor been registered? */
-                if (!obd->obd_type)
-                        return -ENODEV;
-
-                tmp = (void *)arg + sizeof(unsigned int);
-                get_user(conn_id, (int *) arg);
-
-                if ( !OBT(obd) || !OBP(obd, statfs) )
-                        return -EOPNOTSUPP;
-
-                conn.oc_id = conn_id;
-                err = OBP(obd, statfs)(&conn, &buf);
-                if ( err ) {
-                        EXIT;
-                        return err;
-                }
-                err = copy_to_user(tmp, &buf, sizeof(buf));
-                EXIT;
-                return err;
-                
-        }
-        case OBD_IOC_COPY: {
-                struct ioc_mv_s *mvdata = tmp_buf;
-
-                if ( (!(obd->obd_flags & OBD_SET_UP)) ||
-                     (!(obd->obd_flags & OBD_ATTACHED))) {
-                        CDEBUG(D_IOCTL, "Device not attached or set up\n");
-                        return -ENODEV;
-                }
-
-                /* get main structure */
-                err = copy_from_user(mvdata, (void *) arg, sizeof(*mvdata));
-                if (err) {
-                        EXIT;
-                        return err;
-                }
-
-                if ( !OBT(obd) || !OBP(obd, copy) )
-                        return -EOPNOTSUPP;
-
-                /* do the partition */
-                CDEBUG(D_INFO, "Copy %d, type %s dst %Ld src %Ld\n", dev, 
-                       obd->obd_type->typ_name, mvdata->dst.o_id, 
-                       mvdata->src.o_id);
-
-                conn.oc_id = mvdata->src_conn_id;
-
-                err = OBP(obd, copy)(&conn, &mvdata->dst, 
-                                        &conn, &mvdata->src, 
-                                        mvdata->src.o_size, 0);
-                return err;
-        }
-
-        case OBD_IOC_MIGR: {
-                struct ioc_mv_s *mvdata = tmp_buf;
-
-                if ( (!(obd->obd_flags & OBD_SET_UP)) ||
-                     (!(obd->obd_flags & OBD_ATTACHED))) {
-                        CDEBUG(D_IOCTL, "Device not attached or set up\n");
-                        return -ENODEV;
-                }
-
-                err = copy_from_user(mvdata, (void *) arg, sizeof(*mvdata));
-                if (err) {
-                        EXIT;
-                        return err;
-                }
-
-                CDEBUG(D_INFO, "Migrate copying %d bytes\n", sizeof(*mvdata));
-
-                if ( !OBT(obd) || !OBP(obd, migrate) )
-                        return -EOPNOTSUPP;
-
-                /* do the partition */
-                CDEBUG(D_INFO, "Migrate %d, type %s conn %d src %Ld dst %Ld\n",
-                       dev, obd->obd_type->typ_name, mvdata->src_conn_id,
-                       mvdata->src.o_id, mvdata->dst.o_id);
-
-                conn.oc_id = mvdata->src_conn_id;
-                err = OBP(obd, migrate)(&conn, &mvdata->dst, &mvdata->src, 
-                                           mvdata->src.o_size, 0);
-
-                return err;
-        }
-        case OBD_IOC_PUNCH: {
-                struct oic_rw_s *rw_s = tmp_buf;  /* read, write ioctl str */
-
-                err = copy_from_user(rw_s, (int *)arg, sizeof(*rw_s));
-                if ( err ) {
-                        EXIT;
-                        return err;
-                }
-
-                conn.oc_id = rw_s->conn_id;
-
-                if ( !OBT(obd) || !OBP(obd, punch) ) {
-                        err = -EOPNOTSUPP;
-                        return err;
-                }
-
-                CDEBUG(D_INFO, "PUNCH: conn %d, count %Ld, offset %Ld\n",
-                       rw_s->conn_id, rw_s->count, rw_s->offset);
-                err = OBP(obd, punch)(&conn, &rw_s->obdo, rw_s->count,
-                                         rw_s->offset);
-                ODEBUG(&rw_s->obdo);
-                if ( err ) {
-                        EXIT;
-                        return err;
-                }
-                EXIT;
-                return err;
-        }
-
-        default: {
-                struct obd_type *type;
-                struct oic_generic input;
-                char *nm;
-                void *karg;
-
-                /* get data structures */
-                err = copy_from_user(&input, (void *)arg, sizeof(input));
-                if ( err ) {
-                        EXIT;
-                        return err;
-                }
-
-                err = getdata(input.att_typelen + 1, &input.att_type);
-                if ( err ) {
-                        EXIT;
-                        return err;
-                }
-
-                /* find the type */
-                nm = input.att_type;
-                type = obd_nm_to_type(nm);
-#ifdef CONFIG_KMOD
-                if ( !type ) {
-                        if ( !request_module(nm) ) {
-                                CDEBUG(D_INFO, "Loaded module '%s'\n", nm);
-                                type = obd_nm_to_type(nm);
-                        } else {
-                                CDEBUG(D_INFO, "Can't load module '%s'\n", nm);
-                        }
-                }
-#endif
-                OBD_FREE(input.att_type, input.att_typelen + 1);
-                if ( !type ) {
-                        CERROR("unknown obd type dev %d\n", dev);
-                        EXIT;
-                        return -EINVAL;
-                }
-                
-                if ( !type->typ_ops || !type->typ_ops->o_iocontrol ) {
-                        EXIT;
-                        return -EOPNOTSUPP;
-                }
-                conn.oc_id = input.att_connid;
-                
-                CDEBUG(D_INFO, "Calling ioctl %x for type %s, len %d\n",
-                       cmd, type->typ_name, input.att_datalen);
-
-                /* get the generic data */
-                karg = input.att_data;
-                err = getdata(input.att_datalen, &karg);
-                if ( err ) {
-                        EXIT;
-                        return err;
-                }
-
-                err = type->typ_ops->o_iocontrol(cmd, &conn, input.att_datalen, 
-                                                 karg, input.att_data);
-                OBD_FREE(karg, input.att_datalen);
-
-                EXIT;
-                return err;
-        }
-#endif 
-       default:
-               return -EINVAL;
-
-        }
-} /* obd_class_ioctl */
-
-
-/* Driver interface done, utility functions follow */
-int obd_register_type(struct obd_ops *ops, char *nm)
-{
-        struct obd_type *type;
-
-        if (obd_init_magic != 0x11223344) {
-                CERROR("bad magic for type\n");
-                EXIT;
-                return -EINVAL;
-        }
-
-        if  ( obd_nm_to_type(nm) ) {
-                CDEBUG(D_IOCTL, "Type %s already registered\n", nm);
-                EXIT;
-                return -EEXIST;
-        }
-        
-        OBD_ALLOC(type, sizeof(*type));
-        if ( !type ) {
-                EXIT;
-                return -ENOMEM;
-        }
-        memset(type, 0, sizeof(*type));
-        INIT_LIST_HEAD(&type->typ_chain);
-        MOD_INC_USE_COUNT;
-        list_add(&type->typ_chain, obd_types.next);
-        type->typ_ops = ops;
-        type->typ_name = nm;
-        EXIT;
-        return 0;
-}
-        
-int obd_unregister_type(char *nm)
-{
-        struct obd_type *type = obd_nm_to_type(nm);
-
-        if ( !type ) {
-                MOD_DEC_USE_COUNT;
-                CERROR("unknown obd type\n");
-                EXIT;
-                return -EINVAL;
-        }
-
-        if ( type->typ_refcnt ) {
-                MOD_DEC_USE_COUNT;
-                CERROR("type %s has refcount (%d)\n", nm, type->typ_refcnt);
-                EXIT;
-                return -EBUSY;
-        }
-
-        list_del(&type->typ_chain);
-        OBD_FREE(type, sizeof(*type));
-        MOD_DEC_USE_COUNT;
-        return 0;
-} /* obd_unregister_type */
-
-/* declare character device */
-static struct file_operations obd_psdev_fops = {
-        ioctl: obd_class_ioctl,       /* ioctl */
-        open: obd_class_open,        /* open */
-        release: obd_class_release,     /* release */
-};
-
-/* modules setup */
-#define OBD_MINOR 241
-static struct miscdevice obd_psdev = {
-        OBD_MINOR,
-        "obd_psdev",
-        &obd_psdev_fops
-};
-
-int init_obd(void)
-{
-        int err;
-        int i;
-
-        printk(KERN_INFO "OBD class driver  v0.01, braam@stelias.com\n");
-        
-        INIT_LIST_HEAD(&obd_types);
-        
-       if ( (err = misc_register(&obd_psdev)) ) { 
-                CERROR("cannot register %d err %d\n", OBD_MINOR, err);
-                return -EIO;
-        }
-
-        for (i = 0; i < MAX_OBD_DEVICES; i++) {
-                memset(&(obd_dev[i]), 0, sizeof(obd_dev[i]));
-                obd_dev[i].obd_minor = i;
-                INIT_LIST_HEAD(&obd_dev[i].obd_gen_clients);
-        }
-
-        err = obd_init_obdo_cache();
-        if (err)
-                return err;
-        obd_sysctl_init();
-        obd_init_magic = 0x11223344;
-        return 0;
-}
-
-EXPORT_SYMBOL(obd_register_type);
-EXPORT_SYMBOL(obd_unregister_type);
-
-EXPORT_SYMBOL(obd_print_entry);
-EXPORT_SYMBOL(obd_debug_level);
-EXPORT_SYMBOL(obd_dev);
-
-EXPORT_SYMBOL(gen_connect);
-EXPORT_SYMBOL(gen_client);
-EXPORT_SYMBOL(gen_cleanup);
-EXPORT_SYMBOL(gen_disconnect);
-EXPORT_SYMBOL(gen_copy_data); 
-EXPORT_SYMBOL(obdo_cachep);
-
-/* EXPORT_SYMBOL(gen_multi_attach); */
-EXPORT_SYMBOL(gen_multi_setup);
-EXPORT_SYMBOL(gen_multi_cleanup);
-EXPORT_SYMBOL(obd_memory);
-
-#ifdef MODULE
-int init_module(void)
-{
-        return init_obd();
-}
-
-void cleanup_module(void)
-{
-        int i;
-        ENTRY;
-
-        misc_deregister(&obd_psdev);
-        for (i = 0; i < MAX_OBD_DEVICES; i++) {
-                struct obd_device *obd = &obd_dev[i];
-                if ( obd->obd_type && 
-                     (obd->obd_flags & OBD_SET_UP) &&
-                     OBT(obd) && OBP(obd, detach) ) {
-                        /* XXX should this call generic detach otherwise? */
-                        OBP(obd, detach)(obd);
-                } 
-        }
-
-        obd_cleanup_obdo_cache();
-        obd_sysctl_clean();
-        CDEBUG(D_MALLOC, "CLASS mem used %ld\n", obd_memory);
-        obd_init_magic = 0;
-        EXIT;
-}
-#endif
diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c
deleted file mode 100644 (file)
index 8140b52..0000000
+++ /dev/null
@@ -1,308 +0,0 @@
-/*
- *  linux/fs/ext2_obd/sim_obd.c
- * Copyright (C) 2001  Cluster File Systems, Inc.
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- *
- * These are the only exported functions; they provide the simulated object-
- * oriented disk.
- *
- */
-
-#include <linux/mm.h>
-#include <linux/pagemap.h>
-#include <linux/fs.h>
-#include <linux/sched.h>
-#include <asm/uaccess.h>
-
-#define DEBUG_SUBSYSTEM S_CLASS
-
-#include <linux/obd_support.h>
-#include <linux/obd_class.h>
-
-extern struct obd_device obd_dev[MAX_OBD_DEVICES];
-kmem_cache_t *obdo_cachep = NULL;
-
-int obd_init_obdo_cache(void)
-{
-        ENTRY;
-        if (obdo_cachep == NULL) {
-                CDEBUG(D_CACHE, "allocating obdo_cache\n");
-                obdo_cachep = kmem_cache_create("obdo_cache",
-                                                sizeof(struct obdo),
-                                                0, SLAB_HWCACHE_ALIGN,
-                                                NULL, NULL);
-                if (obdo_cachep == NULL) {
-                        EXIT;
-                        return -ENOMEM;
-                } else {
-                        CDEBUG(D_CACHE, "allocated cache at %p\n", obdo_cachep);
-                }
-        } else {
-                CDEBUG(D_CACHE, "using existing cache at %p\n", obdo_cachep);
-        }
-        EXIT;
-        return 0;
-}
-
-void obd_cleanup_obdo_cache(void)
-{
-        ENTRY;
-        if (obdo_cachep != NULL) {
-                CDEBUG(D_CACHE, "destroying obdo_cache at %p\n", obdo_cachep);
-                if (kmem_cache_destroy(obdo_cachep))
-                        CERROR("unable to free cache\n");
-        } else
-                CERROR("called with NULL cache pointer\n");
-
-        obdo_cachep = NULL;
-        EXIT;
-}
-
-
-/* map connection to client */
-struct obd_client *gen_client(const struct obd_conn *conn)
-{
-        struct obd_device * obddev = conn->oc_dev;
-        struct list_head * lh, * next;
-        struct obd_client * cli;
-
-        lh = next = &obddev->obd_gen_clients;
-        while ((lh = lh->next) != &obddev->obd_gen_clients) {
-                cli = list_entry(lh, struct obd_client, cli_chain);
-                
-                if (cli->cli_id == conn->oc_id)
-                        return cli;
-        }
-
-        return NULL;
-} /* obd_client */
-
-
-/* a connection defines a context in which preallocation can be managed. */ 
-int gen_connect (struct obd_conn *conn)
-{
-        struct obd_client * cli;
-
-        OBD_ALLOC(cli, sizeof(struct obd_client));
-        if ( !cli ) {
-                CERROR("no memory! (minor %d)\n", conn->oc_dev->obd_minor);
-                return -ENOMEM;
-        }
-
-        INIT_LIST_HEAD(&cli->cli_prealloc_inodes);
-        /* XXX this should probably spinlocked? */
-        cli->cli_id = ++conn->oc_dev->obd_gen_last_id;
-        cli->cli_prealloc_quota = 0;
-        cli->cli_obd = conn->oc_dev;
-        list_add(&(cli->cli_chain), conn->oc_dev->obd_gen_clients.prev);
-
-        CDEBUG(D_INFO, "connect: new ID %u\n", cli->cli_id);
-        conn->oc_id = cli->cli_id;
-        return 0;
-} /* gen_obd_connect */
-
-
-int gen_disconnect(struct obd_conn *conn)
-{
-        struct obd_client * cli;
-        ENTRY;
-
-        if (!(cli = gen_client(conn))) {
-                CDEBUG(D_IOCTL, "disconnect: attempting to free "
-                       "nonexistent client %u\n", conn->oc_id);
-                return -EINVAL;
-        }
-
-
-        list_del(&(cli->cli_chain));
-        OBD_FREE(cli, sizeof(struct obd_client));
-
-        CDEBUG(D_INFO, "disconnect: ID %u\n", conn->oc_id);
-
-        EXIT;
-        return 0;
-} /* gen_obd_disconnect */
-
-
-/* 
- *   raid1 defines a number of connections to child devices,
- *   used to make calls to these devices.
- *   data holds nothing
- */ 
-int gen_multi_setup(struct obd_device *obddev, uint32_t len, void *data)
-{
-        int i;
-
-        for (i = 0 ; i < obddev->obd_multi_count ; i++ ) {
-                int rc;
-                struct obd_conn *ch_conn = &obddev->obd_multi_conn[i];
-                rc  = OBP(ch_conn->oc_dev, connect)(ch_conn);
-
-                if ( rc != 0 ) {
-                        int j;
-
-                        for (j = --i; j >= 0; --j) {
-                                ch_conn = &obddev->obd_multi_conn[i];
-                                OBP(ch_conn->oc_dev, disconnect)(ch_conn);
-                        }
-                        return -EINVAL;
-                }
-        }               
-        return 0;
-}
-
-
-#if 0
-int gen_multi_attach(struct obd_device *obddev, int len, void *data)
-{
-        int i;
-        int count;
-        struct obd_device *rdev = obddev->obd_multi_dev[0];
-
-        count = len/sizeof(int);
-        obddev->obd_multi_count = count;
-        for (i=0 ; i<count ; i++) {
-                rdev = &obd_dev[*((int *)data + i)];
-                rdev = rdev + 1;
-                CDEBUG(D_INFO, "OBD RAID1: replicator %d is of type %s\n", i,
-                       (rdev + i)->obd_type->typ_name);
-        }
-        return 0;
-}
-#endif
-
-
-/*
- *    remove all connections to this device
- *    close all connections to lower devices
- *    needed for forced unloads of OBD client drivers
- */
-int gen_multi_cleanup(struct obd_device *obddev)
-{
-        int i;
-
-        for (i = 0 ; i < obddev->obd_multi_count ; i++ ) {
-                struct obd_conn *ch_conn = &obddev->obd_multi_conn[i];
-                int rc;
-                rc  = OBP(ch_conn->oc_dev, disconnect)(ch_conn);
-
-                if ( rc != 0 ) {
-                        CERROR("disconnect failure %d\n",
-                               ch_conn->oc_dev->obd_minor);
-                }
-        }               
-        return 0;
-} /* gen_multi_cleanup_device */
-
-
-/*
- *    forced cleanup of the device:
- *    - remove connections from the device
- *    - cleanup the device afterwards
- */
-int gen_cleanup(struct obd_device * obddev)
-{
-        struct list_head * lh, * tmp;
-        struct obd_client * cli;
-
-        ENTRY;
-
-        lh = tmp = &obddev->obd_gen_clients;
-        while ((tmp = tmp->next) != lh) {
-                cli = list_entry(tmp, struct obd_client, cli_chain);
-                CDEBUG(D_INFO, "Disconnecting obd_connection %d, at %p\n",
-                       cli->cli_id, cli);
-        }
-        return 0;
-} /* sim_cleanup_device */
-
-void ___wait_on_page(struct page *page)
-{
-        struct task_struct *tsk = current;
-        DECLARE_WAITQUEUE(wait, tsk);
-
-        add_wait_queue(&page->wait, &wait);
-        do {
-                run_task_queue(&tq_disk);
-                set_task_state(tsk, TASK_UNINTERRUPTIBLE);
-                if (!PageLocked(page))
-                        break;
-                schedule();
-        } while (PageLocked(page));
-        tsk->state = TASK_RUNNING;
-        remove_wait_queue(&page->wait, &wait);
-}
-
-void lck_page(struct page *page)
-{
-        while (TryLockPage(page))
-                ___wait_on_page(page);
-}
-
-int gen_copy_data(struct obd_conn *dst_conn, struct obdo *dst,
-                  struct obd_conn *src_conn, struct obdo *src,
-                  obd_size count, obd_off offset)
-{
-        struct page *page;
-        unsigned long index = 0;
-        int err = 0;
-
-        ENTRY;
-        CDEBUG(D_INFO, "src: ino %Ld blocks %Ld, size %Ld, dst: ino %Ld\n", 
-               src->o_id, src->o_blocks, src->o_size, dst->o_id);
-        page = alloc_page(GFP_USER);
-        if ( !page ) {
-                EXIT;
-                return -ENOMEM;
-        }
-        
-        lck_page(page);
-        
-        /* XXX with brw vector I/O, we could batch up reads and writes here,
-         *     all we need to do is allocate multiple pages to handle the I/Os
-         *     and arrays to handle the request parameters.
-         */
-        while (index < ((src->o_size + PAGE_SIZE - 1) >> PAGE_SHIFT)) {
-                obd_count        num_oa = 1;
-                obd_count        num_buf = 1;
-                obd_size         brw_count = PAGE_SIZE;
-                obd_off          brw_offset = (page->index) << PAGE_SHIFT;
-                obd_flag         flagr = 0;
-                obd_flag         flagw = OBD_BRW_CREATE;
-                
-                page->index = index;
-                err = OBP(src_conn->oc_dev, brw)(READ, src_conn, num_oa, &src,
-                                                 &num_buf, &page, &brw_count,
-                                                 &brw_offset, &flagr);
-
-                if ( err ) {
-                        EXIT;
-                        break;
-                }
-                CDEBUG(D_INFO, "Read page %ld ...\n", page->index);
-
-                err = OBP(dst_conn->oc_dev, brw)(WRITE, dst_conn, num_oa, &dst,
-                                                 &num_buf, &page, &brw_count,
-                                                 &brw_offset, &flagw);
-
-                /* XXX should handle dst->o_size, dst->o_blocks here */
-                if ( err ) {
-                        EXIT;
-                        break;
-                }
-
-                CDEBUG(D_INFO, "Wrote page %ld ...\n", page->index);
-                
-                index++;
-        }
-        dst->o_size = src->o_size;
-        dst->o_blocks = src->o_blocks;
-        dst->o_valid |= (OBD_MD_FLSIZE | OBD_MD_FLBLOCKS);
-        obd_unlock_page(page);
-        __free_page(page);
-
-        EXIT;
-        return err;
-}
diff --git a/lustre/obdclass/pack.c b/lustre/obdclass/pack.c
deleted file mode 100644 (file)
index 07ad20a..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *  pack.c
- *  Copyright (C) 2001  Cluster File Systems, Inc.
- *
- *  This code is issued under the GNU General Public License.
- *  See the file COPYING in this distribution
- *
- *  
- */
-
-
-#include <linux/mm.h>
-#include <linux/pagemap.h>
-#include <linux/fs.h>
-#include <linux/sched.h>
-#include <asm/uaccess.h>
-
-#include <linux/obd_support.h>
-#include <linux/obd_class.h>
-#include <linux/obd_lib.h>
-
-
-void obd_req_pack(char **buf, int max, struct obd_req *req)
-{
-       char *ptr;
-
-       ptr = *buf;
-
-       LOGP(ptr, struct obdo, obd req->oa);
-       LOGP(ptr, struct obd_conn, obd req->obd);
-
-}
diff --git a/lustre/obdclass/proc_lustre.c b/lustre/obdclass/proc_lustre.c
deleted file mode 100644 (file)
index 58af539..0000000
+++ /dev/null
@@ -1,240 +0,0 @@
-/* proc_lustre.c manages /proc/lustre/obd. 
- *
- * Copyright (c) 2001 Rumi Zahir <rumi.zahir@intel.com>
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- *
- * OBD devices materialize in /proc as a directory:
- *              /proc/lustre/obd/<number>
- * when /dev/obd<number> is opened. When the device is closed, the 
- * directory entry disappears. 
- * 
- * For each open OBD device, code in this file also creates a file
- * named <status>. "cat /proc/lustre/obd/<number>/status" gives 
- * information about the OBD device's configuration.
- * The class driver manages the "status" entry.
- *
- * Other logical drivers can create their own entries. For example,
- * the obdtrace driver creates /proc/lustre/obd/<obdid>/stats entry.
- *
- * This file defines three functions 
- *               proc_lustre_register_obd_device()
- *               proc_lustre_release_obd_device()
- *               proc_lustre_remove_obd_entry() 
- * that dynamically create/delete /proc/lustre/obd entries:
- *
- *     proc_lustre_register_obd_device() registers an obd device,
- *     and, if this is the first OBD device, creates /proc/lustre/obd.
- *
- *     proc_lustre_release_obd_device() removes device information
- *     from /proc/lustre/obd, and if this is the last OBD device
- *     removes  /proc/lustre/obd.
- *
- *     proc_lustre_remove_obd_entry() removes a
- *     /proc/lustre/obd/<obdid>/ entry by name. This is the only
- *     function that is exported to other modules. 
- */
-
-#define EXPORT_SYMTAB
-#include <linux/config.h>
-#include <linux/module.h>
-#include <linux/version.h>
-#include <linux/proc_fs.h>
-
-#define DEBUG_SUBSYSTEM S_CLASS
-
-#include <linux/obd_support.h>
-#include <linux/obd_class.h>
-
-#ifdef CONFIG_PROC_FS
-extern struct proc_dir_entry proc_root;
-
-static struct proc_dir_entry *proc_lustre_dir_entry = 0;
-static struct proc_dir_entry *proc_lustre_obd_dir_entry = 0;
-
-static struct proc_dir_entry *
-proc_lustre_mkdir(const char* dname, struct proc_dir_entry *parent)
-{
-       struct proc_dir_entry *child_dir_entry;
-
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,0) /*0x20300 */
-       child_dir_entry = proc_mkdir(dname, parent);
-#else
-       child_dir_entry = create_proc_entry(dname,
-                                           S_IFDIR | S_IRUGO | S_IXUGO,
-                                           &proc_root);
-#endif
-       if (!child_dir_entry)
-                CERROR("lustre: failed to create /proc entry %s\n", dname);
-       
-       return child_dir_entry;
-}
-
-static int read_lustre_status(char *page, char **start, off_t offset,
-                             int count, int *eof, void *data)
-{
-       struct obd_device * obddev = (struct obd_device *) data;
-       int p;
-
-       p = sprintf(&page[0], "/dev/obd%d: ", obddev->obd_minor);
-       
-       if (obddev->obd_refcnt==0) { 
-               /* obd is unused */
-               p += sprintf(&page[p], "open but unused\n");
-       }
-       else {  /* obd in use */
-               p += sprintf(&page[p], "refcnt(%d)", obddev->obd_refcnt);
-               
-               if  (obddev->obd_flags & OBD_ATTACHED) {
-                       p += sprintf(&page[p], ", attached(%s)", 
-                                    obddev->obd_type->typ_name);
-               }
-               
-               if  (obddev->obd_flags & OBD_SET_UP) {
-                       struct dentry   *my_dentry;
-                       struct vfsmount *root_mnt;
-                       char *path;
-                       char *pathpage;
-                       
-                       if (!(pathpage = (char*) __get_free_page(GFP_KERNEL)))
-                               return -ENOMEM;
-               
-                       my_dentry = obddev->obd_fsname.dentry;
-                       root_mnt = mntget(current->fs->rootmnt);
-                       path = d_path(my_dentry,root_mnt,pathpage,PAGE_SIZE);
-
-                       p += sprintf(&page[p], ", setup(%s)", path);
-                       
-                       free_page((unsigned long) pathpage);
-               }
-               
-               /* print connections */
-               {
-                       struct list_head * lh;
-                       struct obd_client * cli=0;
-                       
-                       lh = &obddev->obd_gen_clients;
-                       while ((lh = lh->next) != &obddev->obd_gen_clients) {
-                               p += sprintf(&page[p],
-                                            ((cli==0) ? ", connections(" : ",") );
-                               cli = list_entry(lh, struct obd_client, cli_chain);
-                               p += sprintf(&page[p], "%d", cli->cli_id);
-                       } /* while */
-                       if (cli!=0) { /* there was at least one client */
-                               p += sprintf(&page[p], ")");
-                       }
-               }
-               
-               p += sprintf(&page[p], "\n");
-       }
-
-       /* Compute eof and return value */
-
-       if (offset + count >= p) {
-               *eof=1;
-               return (p - offset);
-       }
-       return count;
-}
-
-struct proc_dir_entry *
-proc_lustre_register_obd_device(struct obd_device *obd)
-{
-       char obdname[32];
-       struct proc_dir_entry *obd_dir;
-       struct proc_dir_entry *obd_status = 0;
-
-       if (!proc_lustre_dir_entry) {
-               proc_lustre_dir_entry = 
-                       proc_lustre_mkdir("lustre", &proc_root);
-               if (!proc_lustre_dir_entry)
-                       return 0;
-       
-               proc_lustre_obd_dir_entry = 
-                       proc_lustre_mkdir("obd", proc_lustre_dir_entry);
-               if (!proc_lustre_obd_dir_entry)
-                       return 0;
-       }
-
-       sprintf(obdname, "%d", obd->obd_minor);
-
-       obd_dir =  proc_lustre_mkdir(obdname, proc_lustre_obd_dir_entry);
-       
-        if (obd_dir) 
-               obd_status = create_proc_entry("status", S_IRUSR | S_IFREG, obd_dir);
-
-       if (obd_status) {
-               obd_status->read_proc = read_lustre_status;
-               obd_status->data = (void*) obd;
-       }
-
-       return obd_dir;
-}
-
-void proc_lustre_remove_obd_entry(const char* name, struct obd_device *obd)
-{
-       struct proc_dir_entry *obd_entry = 0;
-       struct proc_dir_entry *obd_dir = obd->obd_proc_entry;
-       
-       remove_proc_entry(name, obd_dir);
-
-       while (obd_dir->subdir==0) {
-               /* if we removed last entry in this directory,
-                * then remove parent directory unless this
-                * is /proc itself
-                */
-               if (obd_dir == &proc_root) 
-                       break;
-                       
-               obd_entry = obd_dir;
-               obd_dir = obd_dir->parent;
-       
-               /* If /proc/lustre/obd/XXX or /proc/lustre/obd or
-                * /proc/lustre are being removed, then reset 
-                * internal variables
-                */
-               
-               if (obd_entry == obd->obd_proc_entry) 
-                       obd->obd_proc_entry=0; /* /proc/lustre/obd/XXX */
-               else 
-                       if (obd_entry == proc_lustre_obd_dir_entry)
-                               proc_lustre_obd_dir_entry=0;
-                       else 
-                               if (obd_entry == proc_lustre_dir_entry) 
-                                       proc_lustre_dir_entry=0;
-
-               remove_proc_entry(obd_entry->name, obd_dir);
-       }
-}
-
-void proc_lustre_release_obd_device(struct obd_device *obd)
-{
-       proc_lustre_remove_obd_entry("status", obd);
-}
-
-
-#else  /* CONFIG_PROC_FS */
-
-struct proc_dir_entry *proc_lustre_register_obd_device(struct obd_device *obd)
-{
-       return 0;
-}
-
-void proc_lustre_remove_obd_entry(const char* name, struct obd_device *obd) {}
-void proc_lustre_release_obd_device(struct obd_device *obd) {}
-
-#endif   /* CONFIG_PROC_FS */
-                                  
-EXPORT_SYMBOL(proc_lustre_remove_obd_entry);
-
-
-
-
-
-
-
-
-
-
-
diff --git a/lustre/obdclass/sysctl.c b/lustre/obdclass/sysctl.c
deleted file mode 100644 (file)
index 1777298..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (C) 2001  Cluster File Systems, Inc.
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- */
-
-#include <linux/module.h>
-#include <linux/autoconf.h>
-#include <linux/sysctl.h>
-#include <linux/sched.h>
-#include <linux/mm.h>
-#include <linux/sysctl.h>
-#include <linux/swapctl.h>
-#include <linux/proc_fs.h>
-#include <linux/slab.h>
-#include <linux/stat.h>
-#include <linux/ctype.h>
-#include <asm/bitops.h>
-#include <asm/segment.h>
-#include <asm/uaccess.h>
-#include <linux/utsname.h>
-
-#define DEBUG_SUBSYSTEM S_CLASS
-
-#include <linux/obd_support.h>
-
-struct ctl_table_header *obd_table_header = NULL;
-
-static int vars[2];
-static int index = 0;
-
-static int obd_sctl_vars( ctl_table * table, int write, struct file *
-                          filp, void * buffer, size_t * lenp );
-static int obd_sctl_reset( ctl_table * table, int write, struct file
-                           * filp, void * buffer, size_t * lenp );
-
-#define OBD_SYSCTL 300
-
-#define OBD_DEBUG           1       /* control debugging */
-#define OBD_ENTRY           2       /* control enter/leave pattern */
-#define OBD_TIMEOUT         3       /* timeout on upcalls to become intrble */
-#define OBD_HARD            4       /* mount type "hard" or "soft" */
-#define OBD_VARS            5       
-#define OBD_INDEX           6
-#define OBD_RESET           7
-
-#define OBD_VARS_SLOT       2
-
-static ctl_table obd_table[] = {
-        {OBD_DEBUG, "debug", &obd_debug_level, sizeof(int), 0644, NULL, &proc_dointvec},
-        {OBD_ENTRY, "trace", &obd_print_entry, sizeof(int), 0644, NULL, &proc_dointvec},
-        {OBD_VARS, "vars", &vars[0], sizeof(int), 0644, NULL, &proc_dointvec},
-        {OBD_INDEX, "index", &index, sizeof(int), 0644, NULL, &obd_sctl_vars},
-        {OBD_RESET, "reset", NULL, 0, 0644, NULL, &obd_sctl_reset},
-       { 0 }
-};
-
-static ctl_table parent_table[] = {
-       {OBD_SYSCTL, "obd",    NULL, 0, 0555, obd_table},
-       {0}
-};
-
-void obd_sysctl_init (void)
-{
-#ifdef CONFIG_SYSCTL
-        if ( !obd_table_header )
-                obd_table_header = register_sysctl_table(parent_table, 0); 
-#endif
-}
-
-void obd_sysctl_clean (void)
-{
-#ifdef CONFIG_SYSCTL
-        if ( obd_table_header )
-                unregister_sysctl_table(obd_table_header);
-        obd_table_header = NULL;
-#endif
-}
-
-int obd_sctl_reset (ctl_table * table, int write, 
-                    struct file * filp, void * buffer, 
-                    size_t * lenp)
-{
-        if ( write ) {
-                /* do something here */
-                vars[0]=0;
-                vars[1]=0;
-        }
-
-        *lenp = 0;
-        return 0;
-}
-
-int obd_sctl_vars (ctl_table * table, int write, 
-                   struct file * filp, void * buffer, 
-                   size_t * lenp)
-{
-        int rc;
-
-        rc = proc_dointvec(table, write, filp, buffer, lenp);
-
-        if ( rc ) 
-                return rc;
-
-        if ( index < 0 || index > 1 ) {
-                CERROR("Illegal index %d!\n", index);
-                index = 0;
-        } else {
-                obd_table[OBD_VARS_SLOT].data = &vars[index];
-        }
-
-        return rc; 
-}
-
-
-
-
diff --git a/lustre/obdfilter/.cvsignore b/lustre/obdfilter/.cvsignore
deleted file mode 100644 (file)
index e530020..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-.Xrefs
-config.log
-config.status
-configure
-Makefile
-Makefile.in
-.deps
-TAGS
diff --git a/lustre/obdfilter/Makefile.am b/lustre/obdfilter/Makefile.am
deleted file mode 100644 (file)
index 403f2ad..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright (C) 2001  Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-
-DEFS:= 
-MODULE = obdfilter
-modulefs_DATA = obdfilter.o
-EXTRA_PROGRAMS = obdfilter
-
-EXT2C = filter.c
-obdfilter_SOURCES = filter.c
-
-include $(top_srcdir)/Rules
-
diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c
deleted file mode 100644 (file)
index 7e8cf22..0000000
+++ /dev/null
@@ -1,846 +0,0 @@
-/*
- *  linux/fs/ext2_obd/ext2_obd.c
- *
- * Copyright (C) 2001  Cluster File Systems, Inc.
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- *
- * by Peter Braam <braam@clusterfs.com>
- */
-
-#define EXPORT_SYMTAB
-
-#include <linux/version.h>
-#include <linux/module.h>
-#include <linux/fs.h>
-#include <linux/stat.h>
-#include <linux/locks.h>
-#include <linux/ext2_fs.h>
-#include <linux/quotaops.h>
-#include <asm/unistd.h>
-
-#define DEBUG_SUBSYSTEM S_FILTER
-
-#include <linux/obd_support.h>
-#include <linux/obd_class.h>
-#include <linux/obd_ext2.h>
-
-extern struct obd_device obd_dev[MAX_OBD_DEVICES];
-long filter_memory;
-
-#define FILTER_ROOTINO 2
-
-#define S_SHIFT 12
-
-static char * obd_type_by_mode[S_IFMT >> S_SHIFT] = {
-       [0]                     "",
-       [S_IFREG >> S_SHIFT]    "R", 
-       [S_IFDIR >> S_SHIFT]    "D",
-       [S_IFCHR >> S_SHIFT]    "C",
-       [S_IFBLK >> S_SHIFT]    "B", 
-       [S_IFIFO >> S_SHIFT]    "F", 
-       [S_IFSOCK >> S_SHIFT]   "S",
-       [S_IFLNK >> S_SHIFT]    "L"
-};
-
-static void filter_id(char *buf, obd_id id, obd_mode mode)
-{
-       sprintf(buf, "O/%s/%Ld", obd_type_by_mode[(mode & S_IFMT) >> S_SHIFT],
-               id);
-}
-
-static struct file *filter_parent(obd_id id, obd_mode mode)
-{
-       char path[64];
-       struct file *file;
-       sprintf(path, "O/%s", obd_type_by_mode[(mode & S_IFMT) >> S_SHIFT]);
-
-       file = filp_open(path, O_RDONLY, 0); 
-       return file;
-}
-
-void push_ctxt(struct run_ctxt *save, struct run_ctxt *new)
-{ 
-       save->fs = get_fs();
-       save->pwd = dget(current->fs->pwd);
-       save->pwdmnt = mntget(current->fs->pwdmnt);
-
-       set_fs(new->fs);
-       set_fs_pwd(current->fs, new->pwdmnt, new->pwd);
-}
-
-void pop_ctxt(struct run_ctxt *saved)
-{
-       set_fs(saved->fs);
-       set_fs_pwd(current->fs, saved->pwdmnt, saved->pwd);
-
-       dput(saved->pwd);
-       mntput(saved->pwdmnt);
-}
-
-static int simple_mkdir(struct dentry *dir, char *name, int mode)
-{
-       struct dentry *dchild; 
-       int err;
-       ENTRY;
-       
-       dchild = lookup_one_len(name, dir, strlen(name));
-       if (IS_ERR(dchild)) { 
-               EXIT;
-               return PTR_ERR(dchild); 
-       }
-
-       if (dchild->d_inode) { 
-               dput(dchild);
-               EXIT;
-               return -EEXIST;
-       }
-
-       err = vfs_mkdir(dir->d_inode, dchild, mode);
-       dput(dchild);
-       
-       EXIT;
-       return err;
-}
-
-static int simple_unlink(struct dentry *dir, char *name)
-{
-       struct dentry *dchild; 
-       int err;
-       ENTRY;
-       
-       dchild = lookup_one_len(name, dir, strlen(name));
-       if (IS_ERR(dchild)) { 
-               EXIT;
-               return PTR_ERR(dchild); 
-       }
-
-       if (!dchild->d_inode) { 
-               dput(dchild);
-               EXIT;
-               return -ENOENT;
-       }
-
-       err = vfs_unlink(dir->d_inode, dchild);
-       dput(dchild);
-       
-       EXIT;
-       return err;
-}
-
-static void filter_prep(struct obd_device *obddev)
-{
-       struct run_ctxt saved;
-       struct file *file;
-       struct inode *inode;
-       loff_t off;
-       long rc;
-       char rootid[128];
-       __u64 lastino = 2;
-
-       push_ctxt(&saved, &obddev->u.filter.fo_ctxt);
-       rc = simple_mkdir(current->fs->pwd, "O", 0700);
-       rc = simple_mkdir(current->fs->pwd, "P", 0700);
-       rc = simple_mkdir(current->fs->pwd, "D", 0700);
-       file  = filp_open("O", O_RDONLY, 0); 
-       if (!file || IS_ERR(file)) { 
-               CERROR("cannot open O\n"); 
-               goto out;
-       }
-       rc = simple_mkdir(file->f_dentry, "R", 0700);  /* regular */
-       rc = simple_mkdir(file->f_dentry, "D", 0700);  /* directory */
-       rc = simple_mkdir(file->f_dentry, "L", 0700);  /* symbolic links */
-       rc = simple_mkdir(file->f_dentry, "C", 0700);  /* character devices */
-       rc = simple_mkdir(file->f_dentry, "B", 0700);  /* block devices */
-       rc = simple_mkdir(file->f_dentry, "F", 0700);  /* fifo's */
-       rc = simple_mkdir(file->f_dentry, "S", 0700);  /* sockets */
-       filp_close(file, NULL); 
-
-       filter_id(rootid, FILTER_ROOTINO, S_IFDIR);
-       file = filp_open(rootid, O_RDWR | O_CREAT, 00755);
-       if (IS_ERR(file)) {
-               CERROR("OBD filter: cannot make root directory"); 
-               goto out;
-       }
-       filp_close(file, 0);
-       rc = simple_mkdir(current->fs->pwd, rootid, 0755);
-
-       file = filp_open("D/status", O_RDWR | O_CREAT, 0700);
-       if ( !file || IS_ERR(file) ) {
-               CERROR("OBD filter: cannot open/create status file\n");
-               goto out;
-       }
-
-       /* steal operations */
-       inode = file->f_dentry->d_inode;
-       obddev->u.filter.fo_fop = file->f_op;
-       obddev->u.filter.fo_iop = inode->i_op;
-       obddev->u.filter.fo_aops = inode->i_mapping->a_ops;
-
-       off = 0;
-       if (inode->i_size == 0) { 
-               rc = file->f_op->write(file, (char *)&lastino, 
-                                      sizeof(lastino), &off);
-               if (rc != sizeof(lastino)) { 
-                       CERROR("OBD filter: error writing lastino\n");
-                       goto out;
-               }
-       } else { 
-               rc = file->f_op->read(file, (char *)&lastino, sizeof(lastino), 
-                                     &off);
-               if (rc != sizeof(lastino)) { 
-                       CERROR("OBD filter: error reading lastino\n");
-                       goto out;
-               }
-       }
-       obddev->u.filter.fo_lastino = lastino;
-
- out:
-       pop_ctxt(&saved);
-}
-
-static void filter_post(struct obd_device *obddev)
-{
-       struct run_ctxt saved;
-       long rc;
-       struct file *file;
-       loff_t off = 0; 
-
-       push_ctxt(&saved, &obddev->u.filter.fo_ctxt);
-       file = filp_open("D/status", O_RDWR | O_CREAT, 0700);
-       if ( !file || IS_ERR(file)) { 
-               CERROR("OBD filter: cannot create status file\n");
-               goto out;
-       }
-       rc = file->f_op->write(file, (char *)&obddev->u.filter.fo_lastino, 
-                      sizeof(obddev->u.filter.fo_lastino), &off);
-       if (rc != sizeof(sizeof(obddev->u.filter.fo_lastino)) ) { 
-               CERROR("OBD filter: error writing lastino\n");
-       }
-
-       rc = filp_close(file, NULL); 
-       if (rc) { 
-               CERROR("OBD filter: cannot close status file\n");
-       }
- out:
-       pop_ctxt(&saved);
-}
-
-
-/* release per client resources */
-static int filter_disconnect(struct obd_conn *conn)
-{
-       /* XXX cleanup preallocated inodes */
-       return gen_disconnect(conn);
-} /* ext2obd_disconnect */
-
-/* mount the file system (secretly) */
-static int filter_setup(struct obd_device *obddev, obd_count len,
-                       void *buf)
-                       
-{
-       struct obd_ioctl_data* data = buf;
-       struct vfsmount *mnt;
-       int err; 
-        ENTRY;
-        
-       
-       mnt = do_kern_mount(data->ioc_inlbuf2, 0, 
-                           data->ioc_inlbuf1, NULL); 
-       err = PTR_ERR(mnt);
-       if (IS_ERR(mnt)) { 
-               EXIT;
-               return err;
-       }
-
-       obddev->u.filter.fo_sb = mnt->mnt_root->d_inode->i_sb;
-       if (!obddev->u.filter.fo_sb) {
-               EXIT;
-               return -ENODEV;
-       }
-
-       obddev->u.filter.fo_vfsmnt = mnt;
-       obddev->u.filter.fo_fstype = strdup(data->ioc_inlbuf2);
-
-       obddev->u.filter.fo_ctxt.pwdmnt = mnt;
-       obddev->u.filter.fo_ctxt.pwd = mnt->mnt_root;
-       obddev->u.filter.fo_ctxt.fs = KERNEL_DS;
-
-       filter_prep(obddev);
-       spin_lock_init(&obddev->u.filter.fo_lock);
-
-        MOD_INC_USE_COUNT;
-        EXIT; 
-        return 0;
-} 
-
-static __u64 filter_next_id(struct obd_device *obddev) 
-{
-       __u64 id;
-       spin_lock(&obddev->u.filter.fo_lock);
-       obddev->u.filter.fo_lastino++;
-       id =    obddev->u.filter.fo_lastino;
-       spin_unlock(&obddev->u.filter.fo_lock);
-       return id;
-}
-
-static int filter_cleanup(struct obd_device * obddev)
-{
-        struct super_block *sb;
-
-        ENTRY;
-
-        if ( !(obddev->obd_flags & OBD_SET_UP) ) {
-                EXIT;
-                return 0;
-        }
-
-        if ( !list_empty(&obddev->obd_gen_clients) ) {
-                CERROR("still has clients!\n");
-                EXIT;
-                return -EBUSY;
-        }
-
-        sb = obddev->u.filter.fo_sb;
-        if (!obddev->u.filter.fo_sb){
-                EXIT;
-                return 0;
-        }
-       filter_post(obddev);
-
-       unlock_kernel();
-       mntput(obddev->u.filter.fo_vfsmnt); 
-        obddev->u.filter.fo_sb = 0;
-       kfree(obddev->u.filter.fo_fstype);
-
-       lock_kernel();
-
-        MOD_DEC_USE_COUNT;
-        EXIT;
-        return 0;
-}
-
-
-static struct file *filter_obj_open(struct obd_device *obddev, 
-                                    struct obdo *oa)
-{
-       struct file *file;
-       int error = 0;
-       char id[24];
-       struct run_ctxt saved;
-       struct super_block *sb;
-
-       sb = obddev->u.filter.fo_sb;
-        if (!sb || !sb->s_dev) {
-                CDEBUG(D_SUPER, "fatal: device not initialized.\n");
-                EXIT;
-                return NULL;
-        }
-
-        if ( !oa->o_id ) {
-                CDEBUG(D_INODE, "fatal: invalid obdo %lu\n", (long)oa->o_id);
-                EXIT;
-                return NULL;
-        }
-
-       if ( ! (oa->o_mode & S_IFMT) ) { 
-               CERROR("OBD filter_obj_open, no type (%Ld), mode %o!\n", 
-                      oa->o_id, oa->o_mode);
-       }
-       filter_id(id, oa->o_id, oa->o_mode); 
-       push_ctxt(&saved, &obddev->u.filter.fo_ctxt);
-       file = filp_open(id , O_RDONLY | O_LARGEFILE, 0);
-       pop_ctxt(&saved);
-
-       if (IS_ERR(file)) { 
-               error = PTR_ERR(file);
-               file = NULL;
-       }
-       CDEBUG(D_INODE, "opening obdo %s\n", id);
-
-       return file;
-}
-
-static struct inode *filter_inode_from_obdo(struct obd_device *obddev, 
-                                    struct obdo *oa)
-{
-       struct file *file;
-       struct inode *inode; 
-
-       file = filter_obj_open(obddev, oa);
-       if ( !file ) { 
-               CERROR("filter_inode_from_obdo failed\n"); 
-               return NULL;
-       }
-
-        inode = iget(file->f_dentry->d_inode->i_sb, file->f_dentry->d_inode->i_ino); 
-       filp_close(file, 0);
-       return inode;
-}
-
-static inline void filter_from_inode(struct obdo *oa, struct inode *inode)
-{
-       int type = oa->o_mode & S_IFMT;
-        ENTRY;
-
-        CDEBUG(D_INFO, "src inode %ld, dst obdo %ld valid 0x%08x\n",
-               inode->i_ino, (long)oa->o_id, oa->o_valid);
-        obdo_from_inode(oa, inode);
-       oa->o_mode &= ~S_IFMT;
-       oa->o_mode |= type;
-
-        if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) {
-               obd_rdev rdev = kdev_t_to_nr(inode->i_rdev);
-                CDEBUG(D_INODE, "copying device %x from inode to obdo\n",
-                      rdev);
-                *((obd_rdev *)oa->o_inline) = rdev;
-                oa->o_obdflags |= OBD_FL_INLINEDATA;
-                oa->o_valid |= OBD_MD_FLINLINE;
-        }
-
-#if 0
- else if (ext2obd_has_inline(inode)) {
-                CDEBUG(D_INFO, "copying inline from inode to obdo\n");
-                memcpy(oa->o_inline, inode->u.ext2_i.i_data,
-                       MIN(sizeof(inode->u.ext2_i.i_data),OBD_INLINESZ));
-                oa->o_obdflags |= OBD_FL_INLINEDATA;
-                oa->o_valid |= OBD_MD_FLINLINE;
-        }
-
-        if (ext2obd_has_obdmd(inode)) {
-                /* XXX this will change when we don't store the obdmd in data */
-                CDEBUG(D_INFO, "copying obdmd from inode to obdo\n");
-                memcpy(oa->o_obdmd, inode->u.ext2_i.i_data,
-                       MIN(sizeof(inode->u.ext2_i.i_data),OBD_INLINESZ));
-                oa->o_obdflags |= OBD_FL_OBDMDEXISTS;
-                oa->o_valid |= OBD_MD_FLOBDMD;
-        }
-#endif
-        EXIT;
-}
-
-static int filter_getattr(struct obd_conn *conn, struct obdo *oa)
-{
-        struct inode *inode;
-
-        ENTRY;
-        if ( !gen_client(conn) ) {
-                CDEBUG(D_IOCTL, "fatal: invalid client %u\n", conn->oc_id);
-                EXIT;
-                return -EINVAL;
-        }
-
-       if ( !(inode = filter_inode_from_obdo(conn->oc_dev, oa)) ) { 
-               EXIT;
-               return -ENOENT;
-       }
-
-       oa->o_valid &= ~OBD_MD_FLID;
-        filter_from_inode(oa, inode);
-       
-        iput(inode);
-        EXIT;
-        return 0;
-} 
-
-static int filter_setattr(struct obd_conn *conn, struct obdo *oa)
-{
-       struct inode *inode;
-       struct iattr iattr;
-       int rc;
-       struct dentry de;
-
-        if (!gen_client(conn)) {
-                CDEBUG(D_IOCTL, "invalid client %u\n", conn->oc_id);
-                return -EINVAL;
-        }
-
-       inode = filter_inode_from_obdo(conn->oc_dev, oa); 
-       if ( !inode ) { 
-               EXIT;
-               return -ENOENT;
-       }
-
-       iattr_from_obdo(&iattr, oa);
-       iattr.ia_mode &= ~S_IFMT;
-       iattr.ia_mode |= S_IFREG;
-       de.d_inode = inode;
-       if ( inode->i_op->setattr ) {
-               rc = inode->i_op->setattr(&de, &iattr);
-       } else { 
-               rc = inode_setattr(inode, &iattr);
-       }
-
-       iput(inode);
-       EXIT;
-       return rc;
-}
-
-static int filter_create (struct obd_conn* conn, struct obdo *oa)
-{
-       char name[64];
-       struct run_ctxt saved;
-       struct file *file;
-       int mode;
-       struct obd_device *obddev = conn->oc_dev;
-       struct iattr;
-       ENTRY;
-
-        if (!gen_client(conn)) {
-                CDEBUG(D_IOCTL, "invalid client %u\n", conn->oc_id);
-                return -EINVAL;
-        }
-       CDEBUG(D_IOCTL, "\n");
-
-       oa->o_id = filter_next_id(conn->oc_dev);
-       if ( !(oa->o_mode && S_IFMT) ) { 
-               CERROR("filter obd: no type!\n");
-               return -ENOENT;
-       }
-
-       filter_id(name, oa->o_id, oa->o_mode);
-       push_ctxt(&saved, &obddev->u.filter.fo_ctxt);
-       mode = oa->o_mode;
-       mode &= ~S_IFMT;
-       mode |= S_IFREG; 
-       file = filp_open(name, O_RDONLY | O_CREAT, mode);
-       pop_ctxt(&saved);
-       if (IS_ERR(file)) { 
-               CERROR("Error mknod obj %s, err %ld\n", name, PTR_ERR(file));
-               return -ENOENT;
-       }
-       filp_close(file, 0);
-       CDEBUG(D_IOCTL, "\n");
-       
-        /* Set flags for fields we have set in ext2_new_inode */
-        oa->o_valid |= OBD_MD_FLID | OBD_MD_FLBLKSZ | OBD_MD_FLBLOCKS |
-                 OBD_MD_FLMTIME | OBD_MD_FLATIME | OBD_MD_FLCTIME |
-                 OBD_MD_FLUID | OBD_MD_FLGID;
-        return 0;
-}
-
-static int filter_destroy(struct obd_conn *conn, struct obdo *oa)
-{
-        struct obd_device * obddev;
-        struct obd_client * cli;
-        struct inode * inode;
-       struct file *dir;
-       int rc;
-       struct run_ctxt saved;
-       char id[128];
-
-        if (!(cli = gen_client(conn))) {
-                CDEBUG(D_IOCTL, "invalid client %u\n", conn->oc_id);
-                EXIT;
-                return -EINVAL;
-        }
-
-        obddev = conn->oc_dev;
-       inode = filter_inode_from_obdo(obddev, oa);
-
-       if (!inode) { 
-               EXIT;
-               return -ENOENT;
-       }
-
-        inode->i_nlink = 1;
-       inode->i_mode = 010000;
-       iput(inode);
-
-       filter_id(id, oa->o_id, oa->o_mode);
-       push_ctxt(&saved, &obddev->u.filter.fo_ctxt);
-       dir = filter_parent(oa->o_id, oa->o_mode); 
-       if (!dir || IS_ERR(dir)) { 
-               goto out;
-       }
-
-       rc = simple_unlink(dir->f_dentry, id);
-       
- out:
-       filp_close(dir, 0); 
-       pop_ctxt(&saved);
-       EXIT;
-        return rc;
-}
-
-static int filter_truncate(struct obd_conn *conn, struct obdo *oa, obd_size count,
-                         obd_off offset)
-{
-       int error;
-
-       error = filter_setattr(conn, oa);
-        oa->o_valid = OBD_MD_FLBLOCKS | OBD_MD_FLCTIME | OBD_MD_FLMTIME;
-
-        EXIT;
-        return error;
-}
-
-/* buffer must lie in user memory here */
-static int filter_read(struct obd_conn *conn, struct obdo *oa, char *buf,
-                        obd_size *count, obd_off offset)
-{
-        struct file * file;
-        unsigned long retval;
-        int err;
-
-        if (!gen_client(conn)) {
-                CDEBUG(D_IOCTL, "invalid client %u\n", conn->oc_id);
-                EXIT;
-                return -EINVAL;
-        }
-
-       file = filter_obj_open(conn->oc_dev, oa); 
-       if (!file || IS_ERR(file)) { 
-               EXIT;
-               return -PTR_ERR(file);
-       }
-
-        /* count doubles as retval */
-        retval = file->f_op->read(file, buf, *count, &offset);
-       filp_close(file, 0);
-
-        if ( retval >= 0 ) {
-                err = 0;
-                *count = retval;
-        } else {
-                err = retval;
-                *count = 0;
-        }
-
-        return err;
-} /* ext2obd_read */
-
-
-/* buffer must lie in user memory here */
-static int filter_write(struct obd_conn *conn, struct obdo *oa, char *buf, 
-                         obd_size *count, obd_off offset)
-{
-        int err;
-        struct file * file;
-        unsigned long retval;
-
-        ENTRY;
-        if (!gen_client(conn)) {
-                CDEBUG(D_IOCTL, "invalid client %u\n", conn->oc_id);
-                EXIT;
-                return -EINVAL;
-        }
-
-       file = filter_obj_open(conn->oc_dev, oa); 
-       if (!file || IS_ERR(file)) { 
-               EXIT;
-               return -PTR_ERR(file);
-       }
-
-        /* count doubles as retval */
-        retval = file->f_op->write(file, buf, *count, &offset);
-       filp_close(file, 0);
-
-        if ( retval >= 0 ) {
-                err = 0;
-                *count = retval;
-                EXIT;
-        } else {
-                err = retval;
-                *count = 0;
-                EXIT;
-        }
-
-        return err;
-} /* ext2obd_write */
-
-static int filter_pgcache_brw(int rw, struct obd_conn *conn, 
-                              obd_count num_oa,
-                              struct obdo **oa, 
-                              obd_count *oa_bufs, 
-                              struct page **pages,
-                              obd_size *count, 
-                              obd_off *offset, 
-                              obd_flag *flags)
-{
-        struct super_block      *sb;
-       mm_segment_t oldfs;
-        int                      onum;          /* index to oas */
-        int                      pnum;          /* index to pages (bufs) */
-        unsigned long            retval;
-        int                      error;
-       struct file *file;
-
-        ENTRY;
-
-        if (!gen_client(conn)) {
-                CDEBUG(D_IOCTL, "invalid client %u\n", conn->oc_id);
-                EXIT;
-                return -EINVAL;
-        }
-
-        sb = conn->oc_dev->u.filter.fo_sb;
-       oldfs = get_fs();
-       set_fs(KERNEL_DS); 
-
-        pnum = 0; /* pnum indexes buf 0..num_pages */
-        for (onum = 0; onum < num_oa; onum++) {
-                int              pg;
-
-               file = filter_obj_open(conn->oc_dev, oa[onum]); 
-               if (!file || IS_ERR(file)) { 
-                       EXIT;
-                       error = -ENOENT;
-                       goto ERROR;
-               }
-
-               /* count doubles as retval */
-                for (pg = 0; pg < oa_bufs[onum]; pg++) {
-                       CDEBUG(D_INODE, "OP %d obdo no/pno: (%d,%d) (%ld,%ld) off count (%Ld,%Ld)\n", 
-                              rw, onum, pnum, file->f_dentry->d_inode->i_ino,
-                              (unsigned long)offset[pnum] >> PAGE_CACHE_SHIFT,
-                              offset[pnum], count[pnum]);
-                       if (rw == WRITE) { 
-                               loff_t off; 
-                               char *buffer;
-                               off = offset[pnum]; 
-                               buffer = kmap(pages[pnum]); 
-                               retval = file->f_op->write(file, buffer, count[pnum], &off);
-                               kunmap(pages[pnum]);
-                               CDEBUG(D_INODE, "retval %ld\n", retval); 
-                       } else { 
-                               loff_t off = offset[pnum]; 
-                               char *buffer = kmap(pages[pnum]);
-
-                               if (off >= file->f_dentry->d_inode->i_size) {
-                                       memset(buffer, 0, count[pnum]);
-                                       retval = count[pnum];
-                               } else {
-                                       retval = file->f_op->read(file, buffer, count[pnum], &off);
-                               } 
-                               kunmap(pages[pnum]);
-
-                               if ( retval != count[pnum] ) {
-                                       filp_close(file, 0);
-                                       retval = -EIO;
-                                       EXIT;
-                                       goto ERROR;
-                               }
-                               CDEBUG(D_INODE, "retval %ld\n", retval); 
-                       }
-                       pnum++;
-               }
-               /* sizes and blocks are set by generic_file_write */
-               /* ctimes/mtimes will follow with a setattr call */ 
-               filp_close(file, 0);
-       }
-       
-       EXIT;
- ERROR:
-       set_fs(oldfs);
-       error = (retval >= 0) ? 0 : retval;
-       return error;
-}
-
-static int filter_statfs (struct obd_conn *conn, struct statfs * statfs)
-{
-       struct super_block *sb;
-        int err;
-
-        ENTRY;
-
-        if (!gen_client(conn)) {
-                CDEBUG(D_IOCTL, "invalid client %u\n", conn->oc_id);
-                EXIT;
-                return -EINVAL;
-        }
-
-        sb = conn->oc_dev->u.filter.fo_sb;
-
-        err = sb->s_op->statfs(sb, statfs);
-        EXIT;
-        return err;
-} /* ext2obd_statfs */
-
-
-static int  filter_get_info(struct obd_conn *conn, obd_count keylen,
-                             void *key, obd_count *vallen, void **val)
-{
-        struct obd_device *obddev;
-        struct obd_client * cli;
-       ENTRY;
-
-        if (!(cli = gen_client(conn))) {
-                CDEBUG(D_IOCTL, "invalid client %u\n", conn->oc_id);
-                return -EINVAL;
-        }
-
-        obddev = conn->oc_dev;
-        
-        if ( keylen == strlen("blocksize") &&
-             memcmp(key, "blocksize", keylen) == 0 ) {
-                *vallen = sizeof(int);
-                *val = (void *)obddev->u.filter.fo_sb->s_blocksize;
-               EXIT;
-                return 0;
-        }
-
-        if ( keylen == strlen("blocksize_bits") &&
-             memcmp(key, "blocksize_bits", keylen) == 0 ){
-                *vallen = sizeof(int);
-                *val = (void *)(int)obddev->u.filter.fo_sb->s_blocksize_bits;
-               EXIT;
-                return 0;
-        }
-
-        if ( keylen == strlen("root_ino") &&
-             memcmp(key, "root_ino", keylen) == 0 ){
-                *vallen = sizeof(int);
-                *val = (void *)(int) FILTER_ROOTINO;
-               EXIT;
-                return 0;
-        }
-        
-        CDEBUG(D_IOCTL, "invalid key\n");
-        return -EINVAL;
-}
-
-
-struct obd_ops filter_obd_ops = {
-        o_iocontrol:   NULL,
-        o_get_info:    filter_get_info,
-        o_setup:       filter_setup,
-        o_cleanup:     filter_cleanup,
-        o_connect:     gen_connect,
-        o_disconnect:  filter_disconnect,
-        o_statfs:      filter_statfs,
-        o_getattr:     filter_getattr,
-        o_create:      filter_create,
-       o_setattr:     filter_setattr,
-        o_destroy:     filter_destroy,
-        o_read:        filter_read,
-        o_write:       filter_write,
-       o_brw:         filter_pgcache_brw,
-        o_punch:       filter_truncate,
-#if 0
-        o_preallocate: ext2obd_preallocate_inodes,
-        o_migrate:     ext2obd_migrate,
-        o_copy:        gen_copy_data,
-        o_iterate:     ext2obd_iterate
-#endif
-};
-
-
-static int __init obdfilter_init(void)
-{
-        printk(KERN_INFO "Filtering OBD driver  v0.001, braam@clusterfs.com\n");
-        return obd_register_type(&filter_obd_ops, OBD_FILTER_DEVICENAME);
-}
-
-static void __exit obdfilter_exit(void)
-{
-        obd_unregister_type(OBD_FILTER_DEVICENAME);
-}
-
-MODULE_AUTHOR("Peter J. Braam <braam@clusterfs.com>");
-MODULE_DESCRIPTION("Lustre Filtering OBD driver v1.0");
-MODULE_LICENSE("GPL"); 
-
-module_init(obdfilter_init);
-module_exit(obdfilter_exit);
diff --git a/lustre/obdfs/.cvsignore b/lustre/obdfs/.cvsignore
deleted file mode 100644 (file)
index e530020..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-.Xrefs
-config.log
-config.status
-configure
-Makefile
-Makefile.in
-.deps
-TAGS
diff --git a/lustre/obdfs/Makefile.am b/lustre/obdfs/Makefile.am
deleted file mode 100644 (file)
index 8470dc1..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-# Copyright (C) 2001  Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-
-DEFS=
-
-MODULE = obdfs
-modulefs_DATA = obdfs.o
-EXTRA_PROGRAMS = obdfs
-obdfs_SOURCES =  rw.c file.c dir.c sysctl.c super.c namei.c symlink.c
-
-include $(top_srcdir)/Rules
diff --git a/lustre/obdfs/README b/lustre/obdfs/README
deleted file mode 100644 (file)
index 12eb4d6..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-OBDFS - v 0.001
-
-This version can mount, list and set the attributes of the root
-directory.
-
-1. configure the obd to use /dev/obd with a scratch file system
-
-2. make
-
-3. insmod obdfs
-
-4. mount -t obdfs -o device=/dev/obd0 /dev/obd0 /mnt/obd
-
-To verify: type mount (output:
-/dev/obd on /mnt/obd type obdfs (rw))
-
-5. ls -ld /mnt/obd
-
-6. chmod 711 /mnt/obd, ls -ld /mnt/obd
-
-7. chown disk /mnt/obd, ls -ld /mnt/obd
-
diff --git a/lustre/obdfs/dir.c b/lustre/obdfs/dir.c
deleted file mode 100644 (file)
index b89abcb..0000000
+++ /dev/null
@@ -1,627 +0,0 @@
-/*
- *  linux/fs/ext2/dir.c
- *
- * Copyright (C) 1992, 1993, 1994, 1995
- * Remy Card (card@masi.ibp.fr)
- * Laboratoire MASI - Institut Blaise Pascal
- * Universite Pierre et Marie Curie (Paris VI)
- *
- *  from
- *
- *  linux/fs/minix/dir.c
- *
- *  Copyright (C) 1991, 1992  Linus Torvalds
- *
- *  ext2 directory handling functions
- *
- *  Big-endian to little-endian byte-swapping/bitmaps by
- *        David S. Miller (davem@caip.rutgers.edu), 1995
- *
- * All code that works with directory layout had been switched to pagecache
- * and moved here. AV
- */
-
-#include <linux/fs.h>
-#include <linux/ext2_fs.h>
-#include <linux/pagemap.h>
-
-#define DEBUG_SUBSYSTEM S_OBDFS
-
-#include <linux/obd_support.h>
-#include <linux/locks.h>
-
-typedef struct ext2_dir_entry_2 ext2_dirent;
-
-#define PageChecked(page)        test_bit(PG_checked, &(page)->flags)
-#define SetPageChecked(page)     set_bit(PG_checked, &(page)->flags)
-
-int waitfor_one_page(struct page *page)
-{
-       int error = 0;
-       struct buffer_head *bh, *head = page->buffers;
-
-       bh = head;
-       do {
-               wait_on_buffer(bh);
-               if (buffer_req(bh) && !buffer_uptodate(bh))
-                       error = -EIO;
-       } while ((bh = bh->b_this_page) != head);
-       return error;
-}
-
-/*
- * ext2 uses block-sized chunks. Arguably, sector-sized ones would be
- * more robust, but we have what we have
- */
-static inline unsigned ext2_chunk_size(struct inode *inode)
-{
-       //return inode->i_sb->s_blocksize;
-       return PAGE_SIZE;
-}
-
-static inline void ext2_put_page(struct page *page)
-{
-       kunmap(page);
-       page_cache_release(page);
-}
-
-static inline unsigned long dir_pages(struct inode *inode)
-{
-       return (inode->i_size+PAGE_CACHE_SIZE-1)>>PAGE_CACHE_SHIFT;
-}
-
-static int ext2_commit_chunk(struct page *page, unsigned from, unsigned to)
-{
-       struct inode *dir = page->mapping->host;
-       int err = 0;
-       dir->i_version = ++event;
-       page->mapping->a_ops->commit_write(NULL, page, from, to);
-       if (IS_SYNC(dir))
-               err = waitfor_one_page(page);
-       return err;
-}
-
-static void ext2_check_page(struct page *page)
-{
-       struct inode *dir = page->mapping->host;
-       unsigned chunk_size = ext2_chunk_size(dir);
-       char *kaddr = page_address(page);
-       //      u32 max_inumber = le32_to_cpu(sb->u.ext2_sb.s_es->s_inodes_count);
-       unsigned offs, rec_len;
-       unsigned limit = PAGE_CACHE_SIZE;
-       ext2_dirent *p;
-       char *error;
-
-       if ((dir->i_size >> PAGE_CACHE_SHIFT) == page->index) {
-               limit = dir->i_size & ~PAGE_CACHE_MASK;
-               if (limit & (chunk_size - 1))
-                       goto Ebadsize;
-               for (offs = limit; offs<PAGE_CACHE_SIZE; offs += chunk_size) {
-                       ext2_dirent *p = (ext2_dirent*)(kaddr + offs);
-                       p->rec_len = cpu_to_le16(chunk_size);
-               }
-               if (!limit)
-                       goto out;
-       }
-       for (offs = 0; offs <= limit - EXT2_DIR_REC_LEN(1); offs += rec_len) {
-               p = (ext2_dirent *)(kaddr + offs);
-               rec_len = le16_to_cpu(p->rec_len);
-
-               if (rec_len < EXT2_DIR_REC_LEN(1))
-                       goto Eshort;
-               if (rec_len & 3)
-                       goto Ealign;
-               if (rec_len < EXT2_DIR_REC_LEN(p->name_len))
-                       goto Enamelen;
-               if (((offs + rec_len - 1) ^ offs) & ~(chunk_size-1))
-                       goto Espan;
-               //              if (le32_to_cpu(p->inode) > max_inumber)
-               //goto Einumber;
-       }
-       if (offs != limit)
-               goto Eend;
-out:
-       SetPageChecked(page);
-       return;
-
-       /* Too bad, we had an error */
-
-Ebadsize:
-       CERROR("ext2_check_page"
-               "size of directory #%lu is not a multiple of chunk size",
-               dir->i_ino
-       );
-       goto fail;
-Eshort:
-       error = "rec_len is smaller than minimal";
-       goto bad_entry;
-Ealign:
-       error = "unaligned directory entry";
-       goto bad_entry;
-Enamelen:
-       error = "rec_len is too small for name_len";
-       goto bad_entry;
-Espan:
-       error = "directory entry across blocks";
-       goto bad_entry;
-       //Einumber:
-       // error = "inode out of bounds";
-bad_entry:
-       CERROR("ext2_check_page" "bad entry in directory #%lu: %s - "
-               "offset=%lu, inode=%lu, rec_len=%d, name_len=%d",
-               dir->i_ino, error, (page->index<<PAGE_CACHE_SHIFT)+offs,
-               (unsigned long) le32_to_cpu(p->inode),
-               rec_len, p->name_len);
-       goto fail;
-Eend:
-       p = (ext2_dirent *)(kaddr + offs);
-       CERROR("ext2_check_page"
-               "entry in directory #%lu spans the page boundary"
-               "offset=%lu, inode=%lu",
-               dir->i_ino, (page->index<<PAGE_CACHE_SHIFT)+offs,
-               (unsigned long) le32_to_cpu(p->inode));
-fail:
-       SetPageChecked(page);
-       SetPageError(page);
-}
-
-static struct page * ext2_get_page(struct inode *dir, unsigned long n)
-{
-       struct address_space *mapping = dir->i_mapping;
-       struct page *page = read_cache_page(mapping, n,
-                               (filler_t*)mapping->a_ops->readpage, NULL);
-       if (!IS_ERR(page)) {
-               wait_on_page(page);
-               kmap(page);
-               if (!Page_Uptodate(page))
-                       goto fail;
-               if (!PageChecked(page))
-                       ext2_check_page(page);
-               if (PageError(page))
-                       goto fail;
-       }
-       return page;
-
-fail:
-       ext2_put_page(page);
-       return ERR_PTR(-EIO);
-}
-
-/*
- * NOTE! unlike strncmp, ext2_match returns 1 for success, 0 for failure.
- *
- * len <= EXT2_NAME_LEN and de != NULL are guaranteed by caller.
- */
-static inline int ext2_match (int len, const char * const name,
-                                       struct ext2_dir_entry_2 * de)
-{
-       if (len != de->name_len)
-               return 0;
-       if (!de->inode)
-               return 0;
-       return !memcmp(name, de->name, len);
-}
-
-/*
- * p is at least 6 bytes before the end of page
- */
-static inline ext2_dirent *ext2_next_entry(ext2_dirent *p)
-{
-       return (ext2_dirent *)((char*)p + le16_to_cpu(p->rec_len));
-}
-
-static inline unsigned 
-ext2_validate_entry(char *base, unsigned offset, unsigned mask)
-{
-       ext2_dirent *de = (ext2_dirent*)(base + offset);
-       ext2_dirent *p = (ext2_dirent*)(base + (offset&mask));
-       while ((char*)p < (char*)de)
-               p = ext2_next_entry(p);
-       return (char *)p - base;
-}
-
-static unsigned char ext2_filetype_table[EXT2_FT_MAX] = {
-       [EXT2_FT_UNKNOWN]       DT_UNKNOWN,
-       [EXT2_FT_REG_FILE]      DT_REG,
-       [EXT2_FT_DIR]           DT_DIR,
-       [EXT2_FT_CHRDEV]        DT_CHR,
-       [EXT2_FT_BLKDEV]        DT_BLK,
-       [EXT2_FT_FIFO]          DT_FIFO,
-       [EXT2_FT_SOCK]          DT_SOCK,
-       [EXT2_FT_SYMLINK]       DT_LNK,
-};
-
-static unsigned int obdfs_dt2fmt[DT_WHT + 1] = {
-       [EXT2_FT_UNKNOWN]       0, 
-       [EXT2_FT_REG_FILE]      S_IFREG,
-       [EXT2_FT_DIR]           S_IFDIR,
-       [EXT2_FT_CHRDEV]        S_IFCHR,
-       [EXT2_FT_BLKDEV]        S_IFBLK, 
-       [EXT2_FT_FIFO]          S_IFIFO,
-       [EXT2_FT_SOCK]          S_IFSOCK,
-       [EXT2_FT_SYMLINK]       S_IFLNK
-};
-       
-#define S_SHIFT 12
-static unsigned char ext2_type_by_mode[S_IFMT >> S_SHIFT] = {
-       [S_IFREG >> S_SHIFT]    EXT2_FT_REG_FILE,
-       [S_IFDIR >> S_SHIFT]    EXT2_FT_DIR,
-       [S_IFCHR >> S_SHIFT]    EXT2_FT_CHRDEV,
-       [S_IFBLK >> S_SHIFT]    EXT2_FT_BLKDEV,
-       [S_IFIFO >> S_SHIFT]    EXT2_FT_FIFO,
-       [S_IFSOCK >> S_SHIFT]   EXT2_FT_SOCK,
-       [S_IFLNK >> S_SHIFT]    EXT2_FT_SYMLINK,
-};
-
-static inline void ext2_set_de_type(ext2_dirent *de, struct inode *inode)
-{
-       mode_t mode = inode->i_mode;
-       de->file_type = ext2_type_by_mode[(mode & S_IFMT)>>S_SHIFT];
-}
-
-int
-new_obdfs_readdir (struct file * filp, void * dirent, filldir_t filldir)
-{
-       loff_t pos = filp->f_pos;
-       struct inode *inode = filp->f_dentry->d_inode;
-       // XXX struct super_block *sb = inode->i_sb;
-       unsigned offset = pos & ~PAGE_CACHE_MASK;
-       unsigned long n = pos >> PAGE_CACHE_SHIFT;
-       unsigned long npages = dir_pages(inode);
-       unsigned chunk_mask = ~(ext2_chunk_size(inode)-1);
-       unsigned char *types = NULL;
-       int need_revalidate = (filp->f_version != inode->i_version);
-
-       if (pos > inode->i_size - EXT2_DIR_REC_LEN(1))
-               goto done;
-
-       types = ext2_filetype_table;
-
-       for ( ; n < npages; n++, offset = 0) {
-               char *kaddr, *limit;
-               ext2_dirent *de;
-               struct page *page = ext2_get_page(inode, n);
-
-               if (IS_ERR(page))
-                       continue;
-               kaddr = page_address(page);
-               if (need_revalidate) {
-                       offset = ext2_validate_entry(kaddr, offset, chunk_mask);
-                       need_revalidate = 0;
-               }
-               de = (ext2_dirent *)(kaddr+offset);
-               limit = kaddr + PAGE_CACHE_SIZE - EXT2_DIR_REC_LEN(1);
-               for ( ;(char*)de <= limit; de = ext2_next_entry(de))
-                       if (de->inode) {
-                               int over;
-                               unsigned char d_type = DT_UNKNOWN;
-
-                               if (types && de->file_type < EXT2_FT_MAX)
-                                       d_type = types[de->file_type];
-
-                               offset = (char *)de - kaddr;
-                               over = filldir(dirent, de->name, de->name_len,
-                                               (n<<PAGE_CACHE_SHIFT) | offset,
-                                               le32_to_cpu(de->inode), d_type);
-                               if (over) {
-                                       ext2_put_page(page);
-                                       goto done;
-                               }
-                       }
-               ext2_put_page(page);
-       }
-
-done:
-       filp->f_pos = (n << PAGE_CACHE_SHIFT) | offset;
-       filp->f_version = inode->i_version;
-       UPDATE_ATIME(inode);
-       return 0;
-}
-
-/*
- *     ext2_find_entry()
- *
- * finds an entry in the specified directory with the wanted name. It
- * returns the page in which the entry was found, and the entry itself
- * (as a parameter - res_dir). Page is returned mapped and unlocked.
- * Entry is guaranteed to be valid.
- */
-struct ext2_dir_entry_2 * ext2_find_entry (struct inode * dir,
-                       struct dentry *dentry, struct page ** res_page)
-{
-       const char *name = dentry->d_name.name;
-       int namelen = dentry->d_name.len;
-       unsigned reclen = EXT2_DIR_REC_LEN(namelen);
-       unsigned long start, n;
-       unsigned long npages = dir_pages(dir);
-       struct page *page = NULL;
-       ext2_dirent * de;
-
-       /* OFFSET_CACHE */
-       *res_page = NULL;
-
-       //      start = dir->u.ext2_i.i_dir_start_lookup;
-       start = 0;
-       if (start >= npages)
-               start = 0;
-       n = start;
-       do {
-               char *kaddr;
-               page = ext2_get_page(dir, n);
-               if (!IS_ERR(page)) {
-                       kaddr = page_address(page);
-                       de = (ext2_dirent *) kaddr;
-                       kaddr += PAGE_CACHE_SIZE - reclen;
-                       while ((char *) de <= kaddr) {
-                               if (ext2_match (namelen, name, de))
-                                       goto found;
-                               de = ext2_next_entry(de);
-                       }
-                       ext2_put_page(page);
-               }
-               if (++n >= npages)
-                       n = 0;
-       } while (n != start);
-       return NULL;
-
-found:
-       *res_page = page;
-       //      dir->u.ext2_i.i_dir_start_lookup = n;
-       return de;
-}
-
-struct ext2_dir_entry_2 * ext2_dotdot (struct inode *dir, struct page **p)
-{
-       struct page *page = ext2_get_page(dir, 0);
-       ext2_dirent *de = NULL;
-
-       if (!IS_ERR(page)) {
-               de = ext2_next_entry((ext2_dirent *) page_address(page));
-               *p = page;
-       }
-       return de;
-}
-
-ino_t obdfs_inode_by_name(struct inode * dir, struct dentry *dentry, int *type)
-{
-       ino_t res = 0;
-       struct ext2_dir_entry_2 * de;
-       struct page *page;
-       
-       de = ext2_find_entry (dir, dentry, &page);
-       if (de) {
-               res = le32_to_cpu(de->inode);
-               *type = obdfs_dt2fmt[de->file_type];
-               kunmap(page);
-               page_cache_release(page);
-       }
-       return res;
-}
-
-/* Releases the page */
-void ext2_set_link(struct inode *dir, struct ext2_dir_entry_2 *de,
-                       struct page *page, struct inode *inode)
-{
-       unsigned from = (char *) de - (char *) page_address(page);
-       unsigned to = from + le16_to_cpu(de->rec_len);
-       int err;
-
-       lock_page(page);
-       err = page->mapping->a_ops->prepare_write(NULL, page, from, to);
-       if (err)
-               BUG();
-       de->inode = cpu_to_le32(inode->i_ino);
-       ext2_set_de_type (de, inode);
-       dir->i_mtime = dir->i_ctime = CURRENT_TIME;
-       err = ext2_commit_chunk(page, from, to);
-       UnlockPage(page);
-       ext2_put_page(page);
-}
-
-/*
- *     Parent is locked.
- */
-int ext2_add_link (struct dentry *dentry, struct inode *inode)
-{
-       struct inode *dir = dentry->d_parent->d_inode;
-       const char *name = dentry->d_name.name;
-       int namelen = dentry->d_name.len;
-       unsigned reclen = EXT2_DIR_REC_LEN(namelen);
-       unsigned short rec_len, name_len;
-       struct page *page = NULL;
-       ext2_dirent * de;
-       unsigned long npages = dir_pages(dir);
-       unsigned long n;
-       char *kaddr;
-       unsigned from, to;
-       int err;
-
-       /* We take care of directory expansion in the same loop */
-       for (n = 0; n <= npages; n++) {
-               page = ext2_get_page(dir, n);
-               err = PTR_ERR(page);
-               if (IS_ERR(page))
-                       goto out;
-               kaddr = page_address(page);
-               de = (ext2_dirent *)kaddr;
-               kaddr += PAGE_CACHE_SIZE - reclen;
-               while ((char *)de <= kaddr) {
-                       err = -EEXIST;
-                       if (ext2_match (namelen, name, de))
-                               goto out_page;
-                       name_len = EXT2_DIR_REC_LEN(de->name_len);
-                       rec_len = le16_to_cpu(de->rec_len);
-                       if ( n==npages && rec_len == 0) {
-                               CERROR("Fatal dir behaviour\n");
-                               goto out_page;
-                       }
-                       if (!de->inode && rec_len >= reclen)
-                               goto got_it;
-                       if (rec_len >= name_len + reclen)
-                               goto got_it;
-                       de = (ext2_dirent *) ((char *) de + rec_len);
-               }
-               ext2_put_page(page);
-       }
-       BUG();
-       return -EINVAL;
-
-got_it:
-       from = (char*)de - (char*)page_address(page);
-       to = from + rec_len;
-       lock_page(page);
-       err = page->mapping->a_ops->prepare_write(NULL, page, from, to);
-       if (err)
-               goto out_unlock;
-       if (de->inode) {
-               ext2_dirent *de1 = (ext2_dirent *) ((char *) de + name_len);
-               de1->rec_len = cpu_to_le16(rec_len - name_len);
-               de->rec_len = cpu_to_le16(name_len);
-               de = de1;
-       }
-       de->name_len = namelen;
-       memcpy (de->name, name, namelen);
-       de->inode = cpu_to_le32(inode->i_ino);
-       ext2_set_de_type (de, inode);
-       CDEBUG(D_INODE, "type set to %o\n", de->file_type);
-       dir->i_mtime = dir->i_ctime = CURRENT_TIME;
-       err = ext2_commit_chunk(page, from, to);
-
-       // change_inode happens with the commit_chunk
-        // obdfs_change_inode(dir);
-       /* OFFSET_CACHE */
-out_unlock:
-       UnlockPage(page);
-out_page:
-       ext2_put_page(page);
-out:
-       return err;
-}
-
-/*
- * ext2_delete_entry deletes a directory entry by merging it with the
- * previous entry. Page is up-to-date. Releases the page.
- */
-int ext2_delete_entry (struct ext2_dir_entry_2 * dir, struct page * page )
-{
-       struct address_space *mapping = page->mapping;
-       struct inode *inode = mapping->host;
-       char *kaddr = page_address(page);
-       unsigned from = ((char*)dir - kaddr) & ~(ext2_chunk_size(inode)-1);
-       unsigned to = ((char*)dir - kaddr) + le16_to_cpu(dir->rec_len);
-       ext2_dirent * pde = NULL;
-       ext2_dirent * de = (ext2_dirent *) (kaddr + from);
-       int err;
-
-       while ((char*)de < (char*)dir) {
-               pde = de;
-               de = ext2_next_entry(de);
-       }
-       if (pde)
-               from = (char*)pde - (char*)page_address(page);
-       lock_page(page);
-       err = mapping->a_ops->prepare_write(NULL, page, from, to);
-       if (err)
-               BUG();
-       if (pde)
-               pde->rec_len = cpu_to_le16(to-from);
-       dir->inode = 0;
-       inode->i_ctime = inode->i_mtime = CURRENT_TIME;
-       err = ext2_commit_chunk(page, from, to);
-       UnlockPage(page);
-       ext2_put_page(page);
-       return err;
-}
-
-/*
- * Set the first fragment of directory.
- */
-int ext2_make_empty(struct inode *inode, struct inode *parent)
-{
-       struct address_space *mapping = inode->i_mapping;
-       struct page *page = grab_cache_page(mapping, 0);
-       unsigned chunk_size = ext2_chunk_size(inode);
-       struct ext2_dir_entry_2 * de;
-       char *base;
-       int err;
-       ENTRY;
-
-       if (!page)
-               return -ENOMEM;
-       err = mapping->a_ops->prepare_write(NULL, page, 0, chunk_size);
-       if (err)
-               goto fail;
-
-       base = page_address(page);
-
-       de = (struct ext2_dir_entry_2 *) base;
-       de->name_len = 1;
-       de->rec_len = cpu_to_le16(EXT2_DIR_REC_LEN(1));
-       memcpy (de->name, ".\0\0", 4);
-       de->inode = cpu_to_le32(inode->i_ino);
-       ext2_set_de_type (de, inode);
-
-       de = (struct ext2_dir_entry_2 *) (base + EXT2_DIR_REC_LEN(1));
-       de->name_len = 2;
-       de->rec_len = cpu_to_le16(chunk_size - EXT2_DIR_REC_LEN(1));
-       de->inode = cpu_to_le32(parent->i_ino);
-       memcpy (de->name, "..\0", 4);
-       ext2_set_de_type (de, inode);
-
-       err = ext2_commit_chunk(page, 0, chunk_size);
-fail:
-       UnlockPage(page);
-       page_cache_release(page);
-       ENTRY;
-       return err;
-}
-
-/*
- * routine to check that the specified directory is empty (for rmdir)
- */
-int ext2_empty_dir (struct inode * inode)
-{
-       struct page *page = NULL;
-       unsigned long i, npages = dir_pages(inode);
-       
-       for (i = 0; i < npages; i++) {
-               char *kaddr;
-               ext2_dirent * de;
-               page = ext2_get_page(inode, i);
-
-               if (IS_ERR(page))
-                       continue;
-
-               kaddr = page_address(page);
-               de = (ext2_dirent *)kaddr;
-               kaddr += PAGE_CACHE_SIZE-EXT2_DIR_REC_LEN(1);
-
-               while ((char *)de <= kaddr) {
-                       if (de->inode != 0) {
-                               /* check for . and .. */
-                               if (de->name[0] != '.')
-                                       goto not_empty;
-                               if (de->name_len > 2)
-                                       goto not_empty;
-                               if (de->name_len < 2) {
-                                       if (de->inode !=
-                                           cpu_to_le32(inode->i_ino))
-                                               goto not_empty;
-                               } else if (de->name[1] != '.')
-                                       goto not_empty;
-                       }
-                       de = ext2_next_entry(de);
-               }
-               ext2_put_page(page);
-       }
-       return 1;
-
-not_empty:
-       ext2_put_page(page);
-       return 0;
-}
-
-struct file_operations obdfs_dir_operations = {
-        read: generic_read_dir,
-        readdir: new_obdfs_readdir
-};
diff --git a/lustre/obdfs/file.c b/lustre/obdfs/file.c
deleted file mode 100644 (file)
index b1bd823..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- *  linux/fs/ext2/file.c
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- *
- * Copyright (C) 1992, 1993, 1994, 1995
- * Remy Card (card@masi.ibp.fr)
- * Laboratoire MASI - Institut Blaise Pascal
- * Universite Pierre et Marie Curie (Paris VI)
- *
- *  from
- *
- *  linux/fs/minix/file.c
- *
- *  Copyright (C) 1991, 1992  Linus Torvalds
- *
- *  ext2 fs regular file handling primitives
- *
- *  64-bit file support on 64-bit platforms by Jakub Jelinek
- *      (jj@sunsite.ms.mff.cuni.cz)
- */
-
-#include <asm/uaccess.h>
-#include <asm/system.h>
-
-#include <linux/errno.h>
-#include <linux/fs.h>
-#include <linux/fcntl.h>
-#include <linux/sched.h>
-#include <linux/stat.h>
-#include <linux/locks.h>
-#include <linux/mm.h>
-#include <linux/pagemap.h>
-#include <linux/smp_lock.h>
-
-#define DEBUG_SUBSYSTEM S_OBDFS
-
-#include <linux/obd_support.h>
-#include <linux/obdfs.h>
-
-extern int obdfs_setattr(struct dentry *de, struct iattr *attr);
-void obdfs_change_inode(struct inode *inode);
-
-static inline void obdfs_remove_suid(struct inode *inode)
-{
-        unsigned int mode;
-
-        /* set S_IGID if S_IXGRP is set, and always set S_ISUID */
-        mode = (inode->i_mode & S_IXGRP)*(S_ISGID/S_IXGRP) | S_ISUID;
-
-        /* was any of the uid bits set? */
-        mode &= inode->i_mode;
-        if (mode && !capable(CAP_FSETID)) {
-                inode->i_mode &= ~mode;
-               // XXX careful here - we cannot change the size
-                //obdfs_change_inode(inode);
-        }
-}
-
-/*
- * Write to a file (through the page cache).
- */
-static ssize_t
-obdfs_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
-{
-        ssize_t retval;
-        CDEBUG(D_INFO, "Writing inode %ld, %d bytes, offset %Ld\n",
-               file->f_dentry->d_inode->i_ino, count, *ppos);
-
-        retval = generic_file_write(file, buf, count, ppos);
-        CDEBUG(D_INFO, "Wrote %d\n", retval);
-
-       /* update mtime/ctime/atime here, NOT size */
-        if (retval > 0) {
-               struct iattr attr;
-               attr.ia_valid = ATTR_MTIME | ATTR_CTIME | ATTR_ATIME;
-               attr.ia_mtime = attr.ia_ctime = attr.ia_atime =
-                       CURRENT_TIME;
-                obdfs_setattr(file->f_dentry, &attr);
-        }
-        EXIT;
-        return retval;
-}
-
-
-/* XXX this does not need to do anything for data, it _does_ need to
-   call setattr */ 
-int obdfs_fsync(struct file *file, struct dentry *dentry, int data)
-{
-       return 0;
-}
-
-struct file_operations obdfs_file_operations = {
-        read: generic_file_read,
-        write: obdfs_file_write,
-        mmap: generic_file_mmap,
-       fsync: NULL
-};
-
-
-struct inode_operations obdfs_file_inode_operations = {
-        truncate: obdfs_truncate,
-       setattr: obdfs_setattr
-};
-
diff --git a/lustre/obdfs/flushd.c b/lustre/obdfs/flushd.c
deleted file mode 100644 (file)
index 9ba45ee..0000000
+++ /dev/null
@@ -1,479 +0,0 @@
-/*
- * OBDFS Super operations - also used for Lustre file system
- *
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- *
- *  Copyright (C) 1991, 1992  Linus Torvalds
- * Copryright (C) 1999 Stelias Computing Inc. <braam@stelias.com>
- * Copryright (C) 1999 Seagate Technology Inc.
- *
- */
-#define __NO_VERSION__
-#include <linux/fs.h>
-#include <linux/locks.h>
-#include <linux/swap.h>
-
-#include <linux/obd_support.h>
-#include <linux/obd_class.h>
-#include <linux/obdfs.h>
-
-
-/* XXX temporary until the real function is available from kernel
- * XXX set this to memory size in pages for max page cache size
- */
-#define nr_free_buffer_pages() 32768
-
-/* Defines for page buf daemon */
-struct pupd_prm {
-        int nfract;  /* Percentage of buffer cache dirty to 
-                        activate bdflush */
-        int ndirty;  /* Maximum number of dirty blocks to write out per
-                        wake-cycle */
-        int nrefill; /* Number of clean buffers to try to obtain
-                                each time we call refill */
-        int nref_dirt; /* Dirty buffer threshold for activating bdflush
-                          when trying to refill buffers. */
-        int interval; /* jiffies delay between pupdate flushes */
-        int age_buffer;  /* Time for normal buffer to age before we flush it */
-        int age_super;  /* Time for superblock to age before we flush it */
-};
-
-
-static struct pupdated {
-       int active;
-       wait_queue_head_t waitq;
-       struct timer_list timer;
-       struct pupd_prm parms;
-} pupdated = {
-       active: -1,
-       parms: {40, 1024, 64, 256, 1*HZ, 30*HZ, 5*HZ }
-};
-
-
-/* Called with the superblock list lock held */
-static int obdfs_enqueue_pages(struct inode *inode, struct obdo **obdo,
-                               int nr_slots, struct page **pages, char **bufs,
-                               obd_size *counts, obd_off *offsets,
-                               obd_flag *flag, unsigned long check_time)
-{
-        struct list_head *page_list = obdfs_iplist(inode);
-        struct list_head *tmp;
-        int num = 0;
-
-        ENTRY;
-
-        tmp = page_list;
-        /* Traverse list in reverse order, so we do FIFO, not LIFO order */
-        while ( (tmp = tmp->prev) != page_list && num < nr_slots ) {
-                struct obdfs_pgrq *req;
-                struct page *page;
-                
-                req = list_entry(tmp, struct obdfs_pgrq, rq_plist);
-                page = req->rq_page;
-
-                
-                if (req->rq_jiffies > check_time)
-                        break;          /* pages are in chronological order */
-
-                /* Only allocate the obdo if we will actually do I/O here */
-                if ( !*obdo ) {
-                        OIDEBUG(inode);
-                        *obdo = obdo_fromid(IID(inode), inode->i_ino,
-                                            OBD_MD_FLNOTOBD);
-                        if ( IS_ERR(*obdo) ) {
-                                int err = PTR_ERR(*obdo);
-                                *obdo = NULL;
-
-                                EXIT;
-                                return err;
-                        }
-
-                        /* FIXME revisit fromid & from_inode */
-                        obdfs_from_inode(*obdo, inode);
-                        *flag = OBD_BRW_CREATE;
-                }
-
-                /* Remove request from list before write to avoid conflict.
-                 * Note that obdfs_pgrq_del() also deletes the request.
-                 */
-                obdfs_pgrq_del(req);
-                if ( !page ) {
-                        CDEBUG(D_CACHE, "no page \n");
-                        continue;
-                }
-
-                bufs[num] = (char *)page_address(page);
-                pages[num] = page;
-                counts[num] = PAGE_SIZE;
-                offsets[num] = ((obd_off)page->index) << PAGE_SHIFT;
-                CDEBUG(D_INFO, "ENQ inode %ld, page %p addr %p to vector\n", 
-                       inode->i_ino, page, (char *)page_address(page));
-                num++;
-        }
-
-        if (!list_empty(page_list))
-                CDEBUG(D_INFO, "inode %ld list not empty\n", inode->i_ino);
-        CDEBUG(D_INFO, "added %d page(s) to vector\n", num);
-
-        EXIT;
-        return num;  
-} /* obdfs_enqueue_pages */
-
-/* Dequeue cached pages for a dying inode without writing them to disk. */
-void obdfs_dequeue_pages(struct inode *inode)
-{
-        struct list_head *tmp;
-
-        ENTRY;
-        obd_down(&obdfs_i2sbi(inode)->osi_list_mutex);
-        tmp = obdfs_islist(inode);
-        if ( list_empty(tmp) ) {
-                CDEBUG(D_INFO, "no dirty pages for inode %ld\n", inode->i_ino);
-                obd_up(&obdfs_i2sbi(inode)->osi_list_mutex);
-                EXIT;
-                return;
-        }
-
-        /* take it out of the super list */
-        list_del(tmp);
-        INIT_LIST_HEAD(obdfs_islist(inode));
-
-        tmp = obdfs_iplist(inode);
-        while ( (tmp = tmp->prev) != obdfs_iplist(inode) ) {
-                struct obdfs_pgrq *req;
-                struct page *page;
-                
-                req = list_entry(tmp, struct obdfs_pgrq, rq_plist);
-                page = req->rq_page;
-                /* take it out of the list and free */
-                obdfs_pgrq_del(req);
-                /* now put the page away */
-                put_page(page);
-        }
-
-        obd_up(&obdfs_i2sbi(inode)->osi_list_mutex);
-
-        /* decrement inode reference for page cache */
-        atomic_dec(&inode->i_count);
-        EXIT;
-}
-
-/* This value is not arbitrarily chosen.  KIO_STATIC_PAGES from linux/iobuf.h */
-#define MAX_IOVEC       (KIO_STATIC_PAGES - 1)
-
-/* Remove writeback requests for the superblock */
-int obdfs_flush_reqs(struct list_head *inode_list, unsigned long check_time)
-{
-        struct list_head *tmp;
-        unsigned long     max_io, total_io = 0;
-        obd_count         num_io;
-        obd_count         num_obdos;
-        struct inode     *inodes[MAX_IOVEC];    /* write data back to these */
-        struct page      *pages[MAX_IOVEC];     /* call put_page on these */
-        struct obdo      *obdos[MAX_IOVEC];
-        char             *bufs[MAX_IOVEC];
-        obd_size          counts[MAX_IOVEC];
-        obd_off           offsets[MAX_IOVEC];
-        obd_flag          flags[MAX_IOVEC];
-        obd_count         bufs_per_obdo[MAX_IOVEC];
-        int               err = 0;
-        struct obdfs_sb_info *sbi;
-
-        ENTRY;
-        if (!inode_list) {
-                CDEBUG(D_INODE, "no list\n");
-                EXIT;
-                return 0;
-        }
-
-        sbi = list_entry(inode_list, struct obdfs_sb_info, osi_inodes);
-
-        obd_down(&sbi->osi_list_mutex);
-        if ( list_empty(inode_list) ) {
-                CDEBUG(D_INFO, "list empty\n");
-                obd_up(&sbi->osi_list_mutex);
-                EXIT;
-                return 0;
-        }
-
-        /* If we are forcing a write, write out all dirty pages */
-        max_io = check_time == ~0UL ? 1<<31 : pupdated.parms.ndirty;
-        CDEBUG(D_INFO, "max_io = %lu\n", max_io);
-
-        /* Add each inode's dirty pages to a write vector, and write it.
-         * Traverse list in reverse order, so we do FIFO, not LIFO order
-         */
- again:
-        tmp = inode_list;
-        num_io = 0;
-        num_obdos = 0;
-        while ( (tmp = tmp->prev) != inode_list && total_io < max_io) {
-                struct obdfs_inode_info *ii;
-                struct inode *inode;
-                int res;
-
-                ii = list_entry(tmp, struct obdfs_inode_info, oi_inodes);
-                inode = list_entry(ii, struct inode, u);
-                inodes[num_obdos] = inode;
-                obdos[num_obdos] = NULL;
-                CDEBUG(D_INFO, "checking inode %ld pages\n", inode->i_ino);
-
-                /* Make sure we reference "inode" and not "inodes[num_obdos]",
-                 * as num_obdos will change after the loop is run.
-                 */
-                if (!list_empty(obdfs_iplist(inode))) {
-                        res = obdfs_enqueue_pages(inode, &obdos[num_obdos],
-                                                  MAX_IOVEC - num_io,
-                                                  &pages[num_io], &bufs[num_io],
-                                                  &counts[num_io],
-                                                  &offsets[num_io],
-                                                  &flags[num_obdos],
-                                                  check_time);
-                        CDEBUG(D_INFO, "FLUSH inode %ld, pages flushed: %d\n",
-                               inode->i_ino, res);
-                        if ( res < 0 ) {
-                                CDEBUG(D_INODE,
-                                       "fatal: unable to enqueue inode %ld (err %d)\n",
-                                       inode->i_ino, res);
-                                /* XXX Move bad inode to end of list so we can
-                                 * continue with flushing list.  This is a
-                                 * temporary measure to avoid machine lockups.
-                                 * Maybe if we have -ENOENT, simply discard.
-                                 */
-                                list_del(tmp);
-                                list_add(tmp, inode_list);
-                                err = res;
-                                EXIT;
-                                goto BREAK;
-                        }
-                        if (res == 0)
-                                continue;
-
-                        num_io += res;
-                        total_io += res;
-                        bufs_per_obdo[num_obdos] = res;
-                        num_obdos++;
-
-                        if ( num_io == MAX_IOVEC ) {
-                                obd_up(&sbi->osi_list_mutex);
-                                err = obdfs_do_vec_wr(inodes, num_io, num_obdos,
-                                                      obdos, bufs_per_obdo,
-                                                      pages, bufs, counts,
-                                                      offsets, flags);
-                                if ( err ) {
-                                        CDEBUG(D_INODE,
-                                               "fatal: do_vec_wr err=%d\n",
-                                               err);
-                                        EXIT;
-                                        goto ERR;
-                                }
-                                obd_down(&sbi->osi_list_mutex);
-                                goto again;
-                        }
-                }
-        }
-
-BREAK:
-        obd_up(&sbi->osi_list_mutex);
-
-        /* flush any remaining I/Os */
-        if ( num_io ) {
-                err = obdfs_do_vec_wr(inodes, num_io, num_obdos, obdos,
-                                      bufs_per_obdo, pages, bufs, counts,
-                                      offsets, flags);
-                if (err)
-                        CDEBUG(D_INODE, "fatal: unable to do vec_wr (err %d)\n", err);
-                num_io = 0;
-                num_obdos = 0;
-        }
-
-        /* Remove inode from superblock dirty list when no more pages.
-         * Make sure we don't point at the current inode with tmp
-         * when we re-init the list on the inode, or we will loop.
-         */
-        obd_down(&sbi->osi_list_mutex);
-        tmp = inode_list;
-        while ( (tmp = tmp->prev) != inode_list ) {
-                struct obdfs_inode_info *ii;
-                struct inode *inode;
-
-                ii = list_entry(tmp, struct obdfs_inode_info, oi_inodes);
-                inode = list_entry(ii, struct inode, u);
-                CDEBUG(D_INFO, "checking inode %ld empty\n", inode->i_ino);
-                if (list_empty(obdfs_iplist(inode))) {
-                        CDEBUG(D_INFO, "remove inode %ld from dirty list\n",
-                               inode->i_ino);
-                        tmp = tmp->next;
-                        list_del(obdfs_islist(inode));
-                        /* decrement inode reference for page cache */
-                        atomic_dec(&inode->i_count);
-                        INIT_LIST_HEAD(obdfs_islist(inode));
-                }
-        }
-        obd_up(&sbi->osi_list_mutex);
-
-        CDEBUG(D_INFO, "flushed %ld pages in total\n", total_io);
-        EXIT;
-ERR:
-        return err ? err : total_io;
-} /* obdfs_flush_reqs */
-
-
-/* Walk all of the superblocks and write out blocks which are too old.
- * Return the maximum number of blocks written for a single filesystem.
- */
-int obdfs_flush_dirty_pages(unsigned long check_time)
-{
-        struct list_head *sl;
-        int max = 0;
-
-       /*        ENTRY; */
-        sl = &obdfs_super_list;
-        while ( (sl = sl->prev) != &obdfs_super_list ) {
-                struct obdfs_sb_info *sbi = 
-                        list_entry(sl, struct obdfs_sb_info, osi_list);
-                int ret;
-
-                /* walk write requests here, use the sb, check the time */
-                ret = obdfs_flush_reqs(&sbi->osi_inodes, check_time);
-                /* XXX handle error?  What to do with it? */
-
-                max = ret > max ? ret : max;
-        }
-        if (max) { EXIT; }
-        return max;
-} /* obdfs_flush_dirty_pages */
-
-
-static void pupdate_wakeup(unsigned long l)
-{
-       wake_up_interruptible(&pupdated.waitq);
-}
-
-
-static int pupdate(void *unused) 
-{
-       u_long flags;
-        int interval = pupdated.parms.interval;
-        long age = pupdated.parms.age_buffer;
-        int wrote = 0;
-
-       if (pupdated.active >= 0) {
-               CDEBUG(D_CACHE, "attempted to run multiple pupdates\n");
-               return 1;
-       }
-
-       init_timer(&pupdated.timer);
-       init_waitqueue_head(&pupdated.waitq);
-       pupdated.timer.function = pupdate_wakeup;
-        
-        exit_files(current);
-        exit_mm(current);
-       daemonize();
-
-        current->session = 1;
-        current->pgrp = 1;
-        strcpy(current->comm, "pupdated");
-
-       CDEBUG(D_CACHE, "pupdated activated...\n");
-       pupdated.active = 1;
-
-        spin_lock_irqsave(&current->sigmask_lock, flags);
-       flush_signals(current);
-        sigfillset(&current->blocked);
-        recalc_sigpending(current);
-        spin_unlock_irqrestore(&current->sigmask_lock, flags);
-
-        do {
-                long dirty_limit;
-
-                /* update interval */
-                if (pupdated.active == 1 && interval) {
-                       mod_timer(&pupdated.timer, jiffies + interval);
-                       interruptible_sleep_on(&pupdated.waitq);
-                }
-                if (pupdated.active == 0) {
-                       del_timer(&pupdated.timer);
-                       /* If stopped, we flush one last time... */
-               }
-
-                /* asynchronous setattr etc for the future ...
-                obdfs_flush_dirty_inodes(jiffies - pupdated.parms.age_super);
-                 */
-                dirty_limit = nr_free_buffer_pages() * pupdated.parms.nfract / 100;
-
-                if (obdfs_cache_count > dirty_limit) {
-                        interval = 0;
-                        if (wrote < pupdated.parms.ndirty)
-                                age >>= 1;
-                        if (wrote) 
-                         CDEBUG(D_CACHE, "wrote %d, age %ld, interval %d\n",
-                                wrote, age, interval);
-                } else {
-                        if (wrote < pupdated.parms.ndirty >> 1 &&
-                           obdfs_cache_count < dirty_limit / 2) {
-                                interval = pupdated.parms.interval;
-                                age = pupdated.parms.age_buffer;
-                                if (wrote) 
-                                 CDEBUG(D_INFO,
-                                       "wrote %d, age %ld, interval %d\n",
-                                       wrote, age, interval);
-                        } else if (obdfs_cache_count > dirty_limit / 2) {
-                                interval >>= 1;
-                                if (wrote < pupdated.parms.ndirty)
-                                        age >>= 1;
-                                if (wrote) 
-                                 CDEBUG(D_CACHE,
-                                       "wrote %d, age %ld, interval %d\n",
-                                       wrote, age, interval);
-                        }
-                }
-
-                wrote = obdfs_flush_dirty_pages(jiffies - age);
-                if (wrote) {
-                        CDEBUG(D_CACHE,
-                               "dirty_limit %ld, cache_count %ld, wrote %d\n",
-                               dirty_limit, obdfs_cache_count, wrote);
-                       run_task_queue(&tq_disk);
-               }
-        } while (pupdated.active == 1);
-
-       CDEBUG(D_CACHE, "pupdated stopped...\n");
-       pupdated.active = -1;
-       wake_up_interruptible (&pupdated.waitq);
-       return 0;
-}
-
-
-int obdfs_flushd_init(void)
-{
-        /*
-        kernel_thread(bdflush, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
-         */
-        kernel_thread(pupdate, NULL, 0);
-        CDEBUG(D_PSDEV, "flushd inited\n");
-        return 0;
-}
-
-int obdfs_flushd_cleanup(void)
-{
-        ENTRY;
-
-       /* Shut down pupdated. */
-        if (pupdated.active > 0) {
-                CDEBUG(D_CACHE, "inform pupdated\n");
-               pupdated.active = 0;
-               wake_up_interruptible(&pupdated.waitq);
-
-                CDEBUG(D_CACHE, "wait for pupdated\n");
-               while (pupdated.active == 0) {
-                       interruptible_sleep_on(&pupdated.waitq);
-               }
-                CDEBUG(D_CACHE, "done waiting for pupdated\n");
-       }               
-
-        EXIT;
-        return 0;
-}
diff --git a/lustre/obdfs/namei.c b/lustre/obdfs/namei.c
deleted file mode 100644 (file)
index b8e3387..0000000
+++ /dev/null
@@ -1,466 +0,0 @@
-/*
- *  linux/fs/obdfs/namei.c
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- *
- * Copyright (C) 1992, 1993, 1994, 1995
- * Remy Card (card@masi.ibp.fr)
- * Laboratoire MASI - Institut Blaise Pascal
- * Universite Pierre et Marie Curie (Paris VI)
- *
- *  from
- *
- *  linux/fs/ext2/namei.c
- *
- *  Copyright (C) 1991, 1992  Linus Torvalds
- *
- *  Big-endian to little-endian byte-swapping/bitmaps by
- *        David S. Miller (davem@caip.rutgers.edu), 1995
- *  Directory entry file type support and forward compatibility hooks
- *      for B-tree directories by Theodore Ts'o (tytso@mit.edu), 1998
- * 
- *  Changes for use in OBDFS
- *  Copyright (c) 1999, Seagate Technology Inc.
- *  Copyright (C) 2001, Cluster File Systems, Inc.
- *                       Rewritten based on recent ext2 page cache use.
- * 
- */
-
-#include <linux/fs.h>
-#include <linux/locks.h>
-#include <linux/quotaops.h>
-
-#define DEBUG_SUBSYSTEM S_OBDFS
-
-#include <linux/obd_support.h>
-#include <linux/obdfs.h>
-extern struct address_space_operations obdfs_aops;
-
-/* from super.c */
-extern void obdfs_change_inode(struct inode *inode);
-extern int obdfs_setattr(struct dentry *de, struct iattr *attr);
-
-/* from dir.c */
-extern int ext2_add_link (struct dentry *dentry, struct inode *inode);
-ino_t obdfs_inode_by_name(struct inode * dir, struct dentry *dentry, int *typ);
-int ext2_make_empty(struct inode *inode, struct inode *parent);
-struct ext2_dir_entry_2 * ext2_find_entry (struct inode * dir,
-                  struct dentry *dentry, struct page ** res_page);
-int ext2_delete_entry (struct ext2_dir_entry_2 * dir, struct page * page );
-int ext2_empty_dir (struct inode * inode);
-struct ext2_dir_entry_2 * ext2_dotdot (struct inode *dir, struct page **p);
-void ext2_set_link(struct inode *dir, struct ext2_dir_entry_2 *de,
-                  struct page *page, struct inode *inode);
-
-/*
- * Couple of helper functions - make the code slightly cleaner.
- */
-static inline void ext2_inc_count(struct inode *inode)
-{
-       inode->i_nlink++;
-       obdfs_change_inode(inode);
-}
-
-/* postpone the disk update until the inode really goes away */ 
-static inline void ext2_dec_count(struct inode *inode)
-{
-       inode->i_nlink--;
-       if (inode->i_nlink > 0) 
-               obdfs_change_inode(inode);
-}
-
-static inline int ext2_add_nondir(struct dentry *dentry, struct inode *inode)
-{
-       int err;
-       err = ext2_add_link(dentry, inode);
-       if (!err) {
-               d_instantiate(dentry, inode);
-               return 0;
-       }
-       ext2_dec_count(inode);
-       iput(inode);
-       return err;
-}
-
-/* methods */
-static struct dentry *obdfs_lookup(struct inode * dir, struct dentry *dentry)
-{
-        struct obdo *oa;
-       struct inode * inode = NULL;
-       int type;
-       ino_t ino;
-       
-        ENTRY;
-       if (dentry->d_name.len > EXT2_NAME_LEN)
-               return ERR_PTR(-ENAMETOOLONG);
-
-       ino = obdfs_inode_by_name(dir, dentry, &type);
-       if (!ino)
-               goto negative;
-
-        oa = obdo_fromid(IID(dir), ino, type, 
-                        OBD_MD_FLNOTOBD | OBD_MD_FLBLOCKS);
-        if ( IS_ERR(oa) ) {
-                CERROR("obdo_fromid failed\n");
-                EXIT;
-                return ERR_PTR(-EACCES); 
-        }
-
-       inode = iget4(dir->i_sb, ino, NULL, oa);
-        obdo_free(oa);
-
-       if (!inode) 
-               return ERR_PTR(-EACCES);
-
- negative:
-       d_add(dentry, inode);
-       return NULL;
-}
-
-
-/*
- * NOTE! unlike strncmp, ext2_match returns 1 for success, 0 for failure.
- *
- * `len <= EXT2_NAME_LEN' is guaranteed by caller.
- * `de != NULL' is guaranteed by caller.
- */
-static inline int ext2_match (int len, const char * const name,
-                       struct ext2_dir_entry_2 * de)
-{
-        if (len != de->name_len)
-                return 0;
-        if (!de->inode)
-                return 0;
-        return !memcmp(name, de->name, len);
-}
-
-static struct inode *obdfs_new_inode(struct inode *dir, int mode)
-{
-        struct obdo *oa;
-        struct inode *inode;
-        int err;
-
-        ENTRY;
-        oa = obdo_alloc();
-        if (!oa) {
-                EXIT;
-                return ERR_PTR(-ENOMEM);
-        }
-
-        /* Send a hint to the create method on the type of file to create */
-        oa->o_mode = mode;
-        oa->o_valid |= OBD_MD_FLMODE;
-       CDEBUG(D_INODE, "\n");
-        err = obd_create(IID(dir), oa);
-       CDEBUG(D_INODE, "\n");
-
-        if ( err ) {
-                CERROR("new_inode - fatal: err %d\n", err);
-                obdo_free(oa);
-                EXIT;
-                return ERR_PTR(err);
-        }
-       CDEBUG(D_INODE, "obdo mode %o\n", oa->o_mode);
-
-        inode = iget4(dir->i_sb, (ino_t)oa->o_id, NULL, oa);
-       CDEBUG(D_INODE, "\n");
-
-        if (!inode) {
-                CERROR("new_inode -fatal:  %ld\n", (long)oa->o_id);
-                obd_destroy(IID(dir), oa);
-               obdo_free(oa);
-                EXIT;
-                return ERR_PTR(-EIO);
-        }
-        obdo_free(oa);
-
-        if (!list_empty(&inode->i_dentry)) {
-                CERROR("new_inode -fatal: aliases %ld, ct %d lnk %d\n", 
-                      (long)oa->o_id,
-                      atomic_read(&inode->i_count), 
-                      inode->i_nlink);
-                obd_destroy(IID(dir), oa);
-                iput(inode);
-                EXIT;
-                return ERR_PTR(-EIO);
-        }
-
-        EXIT;
-        return inode;
-} /* obdfs_new_inode */
-
-
-/*
- * By the time this is called, we already have created
- * the directory cache entry for the new file, but it
- * is so far negative - it has no inode.
- *
- * If the create succeeds, we fill in the inode information
- * with d_instantiate(). 
- */
-static int obdfs_create (struct inode * dir, struct dentry * dentry, int mode)
-{
-       struct inode * inode = obdfs_new_inode (dir, mode);
-       int err = PTR_ERR(inode);
-       if (!IS_ERR(inode)) {
-               inode->i_op = &obdfs_file_inode_operations;
-               inode->i_fop = &obdfs_file_operations;
-               inode->i_mapping->a_ops = &obdfs_aops;
-               err = ext2_add_nondir(dentry, inode);
-       }
-       return err;
-} /* obdfs_create */
-
-
-static int obdfs_mknod (struct inode * dir, struct dentry *dentry, int mode, int rdev)
-{
-       struct inode * inode = obdfs_new_inode (dir, mode);
-       int err = PTR_ERR(inode);
-       if (!IS_ERR(inode)) {
-               init_special_inode(inode, mode, rdev);
-               obdfs_change_inode(inode);
-               err = ext2_add_nondir(dentry, inode);
-       }
-       return err;
-}
-
-static int obdfs_symlink (struct inode * dir, struct dentry * dentry,
-       const char * symname)
-{
-       struct super_block * sb = dir->i_sb;
-       int err = -ENAMETOOLONG;
-       unsigned l = strlen(symname)+1;
-       struct inode * inode;
-        struct obdfs_inode_info *oinfo;
-
-       if (l > sb->s_blocksize)
-               goto out;
-
-       inode = obdfs_new_inode (dir, S_IFLNK | S_IRWXUGO);
-       err = PTR_ERR(inode);
-       if (IS_ERR(inode))
-               goto out;
-
-        oinfo = obdfs_i2info(inode);
-        if (l >= sizeof(oinfo->oi_inline)) {
-               /* slow symlink */
-               inode->i_op = &page_symlink_inode_operations;
-               inode->i_mapping->a_ops = &obdfs_aops;
-               err = block_symlink(inode, symname, l);
-               if (err)
-                       goto out_fail;
-       } else {
-               /* fast symlink */
-               inode->i_op = &obdfs_fast_symlink_inode_operations;
-               memcpy(oinfo->oi_inline, symname, l);
-               inode->i_size = l-1;
-       }
-       obdfs_change_inode(inode);
-
-       err = ext2_add_nondir(dentry, inode);
-out:
-       return err;
-
-out_fail:
-       ext2_dec_count(inode);
-       iput (inode);
-       goto out;
-}
-
-
-
-static int obdfs_link (struct dentry * old_dentry, struct inode * dir,
-       struct dentry *dentry)
-{
-       struct inode *inode = old_dentry->d_inode;
-
-       if (S_ISDIR(inode->i_mode))
-               return -EPERM;
-
-       if (inode->i_nlink >= EXT2_LINK_MAX)
-               return -EMLINK;
-
-       inode->i_ctime = CURRENT_TIME;
-       ext2_inc_count(inode);
-       atomic_inc(&inode->i_count);
-
-       return ext2_add_nondir(dentry, inode);
-}
-
-
-static int obdfs_mkdir(struct inode * dir, struct dentry * dentry, int mode)
-{
-       struct inode * inode;
-       int err = -EMLINK;
-       ENTRY;
-
-       if (dir->i_nlink >= EXT2_LINK_MAX)
-               goto out;
-
-       ext2_inc_count(dir);
-
-       inode = obdfs_new_inode (dir, S_IFDIR | mode);
-       err = PTR_ERR(inode);
-       if (IS_ERR(inode))
-               goto out_dir;
-
-       inode->i_op = &obdfs_dir_inode_operations;
-       inode->i_fop = &obdfs_dir_operations;
-       inode->i_mapping->a_ops = &obdfs_aops;
-
-       ext2_inc_count(inode);
-
-       err = ext2_make_empty(inode, dir);
-       if (err)
-               goto out_fail;
-
-       err = ext2_add_link(dentry, inode);
-       if (err)
-               goto out_fail;
-
-       d_instantiate(dentry, inode);
-out:
-       EXIT;
-       return err;
-
-out_fail:
-       ext2_dec_count(inode);
-       ext2_dec_count(inode);
-       iput(inode);
-       EXIT;
-out_dir:
-       ext2_dec_count(dir);
-       EXIT;
-       goto out;
-}
-
-static int obdfs_unlink(struct inode * dir, struct dentry *dentry)
-{
-       struct inode * inode = dentry->d_inode;
-       struct ext2_dir_entry_2 * de;
-       struct page * page;
-       int err = -ENOENT;
-
-       de = ext2_find_entry (dir, dentry, &page);
-       if (!de)
-               goto out;
-
-       err = ext2_delete_entry (de, page);
-       if (err)
-               goto out;
-
-       inode->i_ctime = dir->i_ctime;
-       ext2_dec_count(inode);
-       err = 0;
-out:
-       return err;
-}
-
-
-static int obdfs_rmdir (struct inode * dir, struct dentry *dentry)
-{
-       struct inode * inode = dentry->d_inode;
-       int err = -ENOTEMPTY;
-
-       if (ext2_empty_dir(inode)) {
-               err = obdfs_unlink(dir, dentry);
-               if (!err) {
-                       inode->i_size = 0;
-                       ext2_dec_count(inode);
-                       ext2_dec_count(dir);
-               }
-       }
-       return err;
-}
-
-static int obdfs_rename (struct inode * old_dir, struct dentry * old_dentry,
-       struct inode * new_dir, struct dentry * new_dentry )
-{
-       struct inode * old_inode = old_dentry->d_inode;
-       struct inode * new_inode = new_dentry->d_inode;
-       struct page * dir_page = NULL;
-       struct ext2_dir_entry_2 * dir_de = NULL;
-       struct page * old_page;
-       struct ext2_dir_entry_2 * old_de;
-       int err = -ENOENT;
-
-       old_de = ext2_find_entry (old_dir, old_dentry, &old_page);
-       if (!old_de)
-               goto out;
-
-       if (S_ISDIR(old_inode->i_mode)) {
-               err = -EIO;
-               dir_de = ext2_dotdot(old_inode, &dir_page);
-               if (!dir_de)
-                       goto out_old;
-       }
-
-       if (new_inode) {
-               struct page *new_page;
-               struct ext2_dir_entry_2 *new_de;
-
-               err = -ENOTEMPTY;
-               if (dir_de && !ext2_empty_dir (new_inode))
-                       goto out_dir;
-
-               err = -ENOENT;
-               new_de = ext2_find_entry (new_dir, new_dentry, &new_page);
-               if (!new_de)
-                       goto out_dir;
-               ext2_inc_count(old_inode);
-               ext2_set_link(new_dir, new_de, new_page, old_inode);
-               new_inode->i_ctime = CURRENT_TIME;
-               if (dir_de)
-                       new_inode->i_nlink--;
-               ext2_dec_count(new_inode);
-       } else {
-               if (dir_de) {
-                       err = -EMLINK;
-                       if (new_dir->i_nlink >= EXT2_LINK_MAX)
-                               goto out_dir;
-               }
-               ext2_inc_count(old_inode);
-               err = ext2_add_link(new_dentry, old_inode);
-               if (err) {
-                       ext2_dec_count(old_inode);
-                       goto out_dir;
-               }
-               if (dir_de)
-                       ext2_inc_count(new_dir);
-       }
-
-       ext2_delete_entry (old_de, old_page);
-       ext2_dec_count(old_inode);
-
-       if (dir_de) {
-               ext2_set_link(old_inode, dir_de, dir_page, new_dir);
-               ext2_dec_count(old_dir);
-       }
-       return 0;
-
-
-out_dir:
-       if (dir_de) {
-               kunmap(dir_page);
-               page_cache_release(dir_page);
-       }
-out_old:
-       kunmap(old_page);
-       page_cache_release(old_page);
-out:
-       return err;
-}
-
-struct inode_operations obdfs_dir_inode_operations = {
-       create:         obdfs_create,
-       lookup:         obdfs_lookup,
-       link:           obdfs_link,
-       unlink:         obdfs_unlink,
-       symlink:        obdfs_symlink,
-       mkdir:          obdfs_mkdir,
-       rmdir:          obdfs_rmdir,
-       mknod:          obdfs_mknod,
-       rename:         obdfs_rename,
-       setattr:        obdfs_setattr
-};
diff --git a/lustre/obdfs/rw.c b/lustre/obdfs/rw.c
deleted file mode 100644 (file)
index e884709..0000000
+++ /dev/null
@@ -1,734 +0,0 @@
-/*
- * OBDFS Super operations
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- *
- * Copyright (C) 1996, 1997, Olaf Kirch <okir@monad.swb.de>
- * Copryright (C) 1999 Stelias Computing Inc, 
- *                (author Peter J. Braam <braam@stelias.com>)
- * Copryright (C) 1999 Seagate Technology Inc.
-*/
-
-
-#include <linux/config.h>
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/string.h>
-#include <linux/stat.h>
-#include <linux/errno.h>
-#include <linux/locks.h>
-#include <linux/unistd.h>
-#include <linux/version.h>
-
-#include <asm/system.h>
-#include <asm/uaccess.h>
-
-#include <linux/fs.h>
-#include <linux/stat.h>
-#include <asm/uaccess.h>
-#include <linux/vmalloc.h>
-#include <asm/segment.h>
-#include <linux/mm.h>
-#include <linux/pagemap.h>
-#include <linux/smp_lock.h>
-
-#define DEBUG_SUBSYSTEM S_OBDFS
-
-#include <linux/obd_support.h>
-#include <linux/obd_ext2.h>
-#include <linux/obdfs.h>
-
-void obdfs_change_inode(struct inode *inode);
-
-static int cache_writes = 0;
-
-
-/* page cache support stuff */ 
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,10)
-/*
- * Add a page to the dirty page list.
- */
-void __set_page_dirty(struct page *page)
-{
-        struct address_space *mapping;
-        spinlock_t *pg_lock;
-
-        pg_lock = PAGECACHE_LOCK(page);
-        spin_lock(pg_lock);
-
-        mapping = page->mapping;
-        spin_lock(&mapping->page_lock);
-
-        list_del(&page->list);
-        list_add(&page->list, &mapping->dirty_pages);
-
-        spin_unlock(&mapping->page_lock);
-        spin_unlock(pg_lock);
-
-        if (mapping->host)
-                mark_inode_dirty_pages(mapping->host);
-}
-/*
- * Remove page from dirty list
- */
-void __set_page_clean(struct page *page)
-{
-       struct address_space *mapping = page->mapping;
-       struct inode *inode;
-       
-       if (!mapping)
-               return;
-
-       list_del(&page->list);
-       list_add(&page->list, &mapping->clean_pages);
-
-       inode = mapping->host;
-       if (list_empty(&mapping->dirty_pages)) { 
-               CDEBUG(D_INODE, "inode clean\n");
-               inode->i_state &= ~I_DIRTY_PAGES;
-       }
-       EXIT;
-}
-
-#else
-/*
- * Add a page to the dirty page list.
- */
-void set_page_dirty(struct page *page)
-{
-       if (!test_and_set_bit(PG_dirty, &page->flags)) {
-               struct address_space *mapping = page->mapping;
-
-               if (mapping) {
-                       spin_lock(&pagecache_lock);
-                       list_del(&page->list);
-                       list_add(&page->list, &mapping->dirty_pages);
-                       spin_unlock(&pagecache_lock);
-
-                       if (mapping->host)
-                               mark_inode_dirty_pages(mapping->host);
-               }
-       }
-}
-/*
- * Remove page from dirty list
- */
-void __set_page_clean(struct page *page)
-{
-       struct address_space *mapping = page->mapping;
-       struct inode *inode;
-       
-       if (!mapping)
-               return;
-
-       spin_lock(&pagecache_lock);
-       list_del(&page->list);
-       list_add(&page->list, &mapping->clean_pages);
-
-       inode = mapping->host;
-       if (list_empty(&mapping->dirty_pages)) { 
-               CDEBUG(D_INODE, "inode clean\n");
-               inode->i_state &= ~I_DIRTY_PAGES;
-       }
-       spin_unlock(&pagecache_lock);
-       EXIT;
-}
-
-#endif
-
-
-inline void set_page_clean(struct page *page)
-{
-       if (PageDirty(page)) { 
-               ClearPageDirty(page);
-               __set_page_clean(page);
-       }
-}
-
-/* SYNCHRONOUS I/O to object storage for an inode -- object attr will be updated too */
-static int obdfs_brw(int rw, struct inode *inode, struct page *page, int create)
-{
-        obd_count        num_obdo = 1;
-        obd_count        bufs_per_obdo = 1;
-        struct obdo     *oa;
-        obd_size         count = PAGE_SIZE;
-        obd_off          offset = ((obd_off)page->index) << PAGE_SHIFT;
-        obd_flag         flags = create ? OBD_BRW_CREATE : 0;
-        int              err;
-
-        ENTRY;
-
-        oa = obdo_alloc();
-        if ( !oa ) {
-                EXIT;
-                return -ENOMEM;
-        }
-       oa->o_valid = OBD_MD_FLNOTOBD;
-        obdfs_from_inode(oa, inode);
-
-        err = obd_brw(rw, IID(inode), num_obdo, &oa, &bufs_per_obdo,
-                      &page, &count, &offset, &flags);
-        //if ( !err )
-       //      obdfs_to_inode(inode, oa); /* copy o_blocks to i_blocks */
-
-        obdo_free(oa);
-        EXIT;
-        return err;
-} /* obdfs_brw */
-
-extern void set_page_clean(struct page *);
-
-/* SYNCHRONOUS I/O to object storage for an inode -- object attr will be updated too */
-static int obdfs_commit_page(struct page *page, int create, int from, int to)
-{
-       struct inode *inode = page->mapping->host;
-        obd_count        num_obdo = 1;
-        obd_count        bufs_per_obdo = 1;
-        struct obdo     *oa;
-        obd_size         count = to;
-        obd_off          offset = (((obd_off)page->index) << PAGE_SHIFT);
-        obd_flag         flags = create ? OBD_BRW_CREATE : 0;
-        int              err;
-
-        ENTRY;
-        oa = obdo_alloc();
-        if ( !oa ) {
-                EXIT;
-                return -ENOMEM;
-        }
-       oa->o_valid = OBD_MD_FLNOTOBD;
-        obdfs_from_inode(oa, inode);
-
-       CDEBUG(D_INODE, "commit_page writing (at %d) to %d, count %Ld\n", 
-              from, to, count);
-
-        err = obd_brw(WRITE, IID(inode), num_obdo, &oa, &bufs_per_obdo,
-                               &page, &count, &offset, &flags);
-        if ( !err ) {
-                SetPageUptodate(page);
-               set_page_clean(page);
-       }
-
-        //if ( !err )
-       //      obdfs_to_inode(inode, oa); /* copy o_blocks to i_blocks */
-
-        obdo_free(oa);
-        EXIT;
-        return err;
-} /* obdfs_brw */
-
-/* returns the page unlocked, but with a reference */
-int obdfs_writepage(struct page *page)
-{
-       int rc;
-       struct inode *inode = page->mapping->host;
-        ENTRY;
-       CERROR("---> writepage called ino %ld!\n", inode->i_ino);
-       BUG();
-       rc = obdfs_brw(OBD_BRW_WRITE, inode, page, 1);
-       if ( !rc ) {
-               set_page_clean(page);
-       } else {
-               CDEBUG(D_INODE, "--> GRR %d\n", rc);
-       }
-        EXIT;
-       return rc;
-}
-
-
-void write_inode_pages(struct inode *inode)
-{
-       struct list_head *tmp = &inode->i_mapping->dirty_pages;
-       
-       while ( (tmp = tmp->next) != &inode->i_mapping->dirty_pages) { 
-               struct page *page;
-               page = list_entry(tmp, struct page, list);
-               obdfs_writepage(page);
-       }
-}
-
-
-/* returns the page unlocked, but with a reference */
-int obdfs_readpage(struct file *file, struct page *page)
-{
-       struct inode *inode = page->mapping->host;
-        int rc;
-
-        ENTRY;
-
-       if ( ((inode->i_size + PAGE_CACHE_SIZE -1)>>PAGE_SHIFT) 
-            <= page->index) {
-               memset(kmap(page), 0, PAGE_CACHE_SIZE);
-               kunmap(page);
-               goto readpage_out;
-       }
-
-       if (Page_Uptodate(page)) {
-               EXIT;
-               goto readpage_out;
-       }
-
-        rc = obdfs_brw(READ, inode, page, 0);
-        if ( rc ) {
-               EXIT; 
-               return rc;
-        } 
-
- readpage_out:
-       SetPageUptodate(page);
-       obd_unlock_page(page);
-        EXIT;
-        return 0;
-} /* obdfs_readpage */
-
-int obdfs_prepare_write(struct file *file, struct page *page, unsigned from, unsigned to)
-{
-        struct inode *inode = page->mapping->host;
-        obd_off offset = ((obd_off)page->index) << PAGE_SHIFT;
-        int rc = 0;
-        ENTRY; 
-        
-       kmap(page);
-        if (Page_Uptodate(page)) { 
-                EXIT;
-               goto prepare_done;
-        }
-
-        if ( (from <= offset) && (to >= offset + PAGE_SIZE) ) {
-                EXIT;
-                return 0;
-        }
-        
-        rc = obdfs_brw(READ, inode, page, 0);
-        if ( !rc ) {
-                SetPageUptodate(page);
-        } 
-
- prepare_done:
-       set_page_dirty(page);
-       //SetPageDirty(page);
-        EXIT;
-        return rc;
-}
-
-
-#if 0
-
-
-
-static kmem_cache_t *obdfs_pgrq_cachep = NULL;
-
-int obdfs_init_pgrqcache(void)
-{
-        ENTRY;
-        if (obdfs_pgrq_cachep == NULL) {
-                CDEBUG(D_CACHE, "allocating obdfs_pgrq_cache\n");
-                obdfs_pgrq_cachep = kmem_cache_create("obdfs_pgrq",
-                                                      sizeof(struct obdfs_pgrq),
-                                                      0, SLAB_HWCACHE_ALIGN,
-                                                      NULL, NULL);
-                if (obdfs_pgrq_cachep == NULL) {
-                        EXIT;
-                        return -ENOMEM;
-                } else {
-                        CDEBUG(D_CACHE, "allocated cache at %p\n",
-                               obdfs_pgrq_cachep);
-                }
-        } else {
-                CDEBUG(D_CACHE, "using existing cache at %p\n",
-                       obdfs_pgrq_cachep);
-        }
-        EXIT;
-        return 0;
-} /* obdfs_init_wreqcache */
-
-inline void obdfs_pgrq_del(struct obdfs_pgrq *pgrq)
-{
-        --obdfs_cache_count;
-        CDEBUG(D_INFO, "deleting page %p from list [count %ld]\n",
-               pgrq->rq_page, obdfs_cache_count);
-        list_del(&pgrq->rq_plist);
-        OBDClearCachePage(pgrq->rq_page);
-        kmem_cache_free(obdfs_pgrq_cachep, pgrq);
-}
-
-void obdfs_cleanup_pgrqcache(void)
-{
-        ENTRY;
-        if (obdfs_pgrq_cachep != NULL) {
-                CDEBUG(D_CACHE, "destroying obdfs_pgrqcache at %p, count %ld\n",
-                       obdfs_pgrq_cachep, obdfs_cache_count);
-                if (kmem_cache_destroy(obdfs_pgrq_cachep))
-                        CERROR("unable to free all of cache\n");
-                obdfs_pgrq_cachep = NULL;
-        } else
-                CERROR("called with NULL pointer\n");
-
-        EXIT;
-} /* obdfs_cleanup_wreqcache */
-
-
-/* called with the list lock held */
-static struct page *obdfs_find_page_index(struct inode *inode,
-                                          unsigned long index)
-{
-        struct list_head *page_list = obdfs_iplist(inode);
-        struct list_head *tmp;
-        struct page *page;
-
-        ENTRY;
-
-        CDEBUG(D_INFO, "looking for inode %ld pageindex %ld\n",
-               inode->i_ino, index);
-        OIDEBUG(inode);
-
-        if (list_empty(page_list)) {
-                EXIT;
-                return NULL;
-        }
-        tmp = page_list;
-        while ( (tmp = tmp->next) != page_list ) {
-                struct obdfs_pgrq *pgrq;
-
-                pgrq = list_entry(tmp, struct obdfs_pgrq, rq_plist);
-                page = pgrq->rq_page;
-                if (index == page->index) {
-                        CDEBUG(D_INFO,
-                               "INDEX SEARCH found page %p, index %ld\n",
-                               page, index);
-                        EXIT;
-                        return page;
-                }
-        } 
-
-        EXIT;
-        return NULL;
-} /* obdfs_find_page_index */
-
-
-/* call and free pages from Linux page cache: called with io lock on inodes */
-int obdfs_do_vec_wr(struct inode **inodes, obd_count num_io,
-                    obd_count num_obdos, struct obdo **obdos,
-                    obd_count *oa_bufs, struct page **pages, char **bufs,
-                    obd_size *counts, obd_off *offsets, obd_flag *flags)
-{
-        int err;
-
-        ENTRY;
-        CDEBUG(D_INFO, "writing %d page(s), %d obdo(s) in vector\n",
-               num_io, num_obdos);
-        if (obd_debug_level & D_INFO) { /* DEBUGGING */
-                int i;
-                printk("OBDOS: ");
-                for (i = 0; i < num_obdos; i++)
-                        printk("%ld:0x%p ", (long)obdos[i]->o_id, obdos[i]);
-
-                printk("\nPAGES: ");
-                for (i = 0; i < num_io; i++)
-                        printk("0x%p ", pages[i]);
-                printk("\n");
-        }
-
-        err = obd_brw(OBD_BRW_WRITE, IID(inodes[0]), num_obdos, obdos,
-                     oa_bufs, pages, counts, offsets, flags);
-
-        CDEBUG(D_INFO, "BRW done\n");
-        /* release the pages from the page cache */
-        while ( num_io > 0 ) {
-                --num_io;
-                CDEBUG(D_INFO, "calling put_page for %p, index %ld\n",
-                       pages[num_io], pages[num_io]->index);
-                /* PDEBUG(pages[num_io], "do_vec_wr"); */
-                put_page(pages[num_io]);
-                /* PDEBUG(pages[num_io], "do_vec_wr"); */
-        }
-        CDEBUG(D_INFO, "put_page done\n");
-
-        while ( num_obdos > 0) {
-                --num_obdos;
-                CDEBUG(D_INFO, "free obdo %ld\n",(long)obdos[num_obdos]->o_id);
-                /* copy o_blocks to i_blocks */
-               obdfs_set_size (inodes[num_obdos], obdos[num_obdos]->o_size);
-                //obdfs_to_inode(inodes[num_obdos], obdos[num_obdos]);
-                obdo_free(obdos[num_obdos]);
-        }
-        CDEBUG(D_INFO, "obdo_free done\n");
-        EXIT;
-        return err;
-}
-
-
-/*
- * Add a page to the write request cache list for later writing.
- * ASYNCHRONOUS write method.
- */
-static int obdfs_add_page_to_cache(struct inode *inode, struct page *page)
-{
-        int err = 0;
-        ENTRY;
-
-        /* The PG_obdcache bit is cleared by obdfs_pgrq_del() BEFORE the page
-         * is written, so at worst we will write the page out twice.
-         *
-         * If the page has the PG_obdcache bit set, then the inode MUST be
-         * on the superblock dirty list so we don't need to check this.
-         * Dirty inodes are removed from the superblock list ONLY when they
-         * don't have any more cached pages.  It is possible to have an inode
-         * with no dirty pages on the superblock list, but not possible to
-         * have an inode with dirty pages NOT on the superblock dirty list.
-         */
-        if (!OBDAddCachePage(page)) {
-                struct obdfs_pgrq *pgrq;
-                pgrq = kmem_cache_alloc(obdfs_pgrq_cachep, SLAB_KERNEL);
-                if (!pgrq) {
-                        OBDClearCachePage(page);
-                        EXIT;
-                        return -ENOMEM;
-                }
-                /* not really necessary since we set all pgrq fields here
-                memset(pgrq, 0, sizeof(*pgrq)); 
-                */
-                
-                pgrq->rq_page = page;
-                pgrq->rq_jiffies = jiffies;
-                get_page(pgrq->rq_page);
-
-                obd_down(&obdfs_i2sbi(inode)->osi_list_mutex);
-                list_add(&pgrq->rq_plist, obdfs_iplist(inode));
-                obdfs_cache_count++;
-               //CERROR("-- count %d\n", obdfs_cache_count);
-
-                /* If inode isn't already on superblock inodes list, add it.
-                 *
-                 * We increment the reference count on the inode to keep it
-                 * from being freed from memory.  This _should_ be an iget()
-                 * with an iput() in both flush_reqs() and put_inode(), but
-                 * since put_inode() is called from iput() we can't call iput()
-                 * again there.  Instead we just increment/decrement i_count,
-                 * which is mostly what iget/iput do for an inode in memory.
-                 */
-                if ( list_empty(obdfs_islist(inode)) ) {
-                        atomic_inc(&inode->i_count);
-                        CDEBUG(D_INFO,
-                               "adding inode %ld to superblock list %p\n",
-                               inode->i_ino, obdfs_slist(inode));
-                        list_add(obdfs_islist(inode), obdfs_slist(inode));
-                }
-                obd_up(&obdfs_i2sbi(inode)->osi_list_mutex);
-
-        }
-
-        /* XXX For testing purposes, we can write out the page here.
-        err = obdfs_flush_reqs(obdfs_slist(inode), ~0UL);
-         */
-
-        EXIT;
-        return err;
-} /* obdfs_add_page_to_cache */
-
-void rebalance(void)
-{
-       if (obdfs_cache_count > 60000) {
-               CERROR("-- count %ld\n", obdfs_cache_count);
-               //obdfs_flush_dirty_pages(~0UL);
-               CERROR("-- count %ld\n", obdfs_cache_count);
-       }
-}
-
-
-
-/* select between SYNC and ASYNC I/O methods */
-int obdfs_do_writepage(struct page *page, int sync)
-{
-        struct inode *inode = page->mapping->host;
-        int err;
-
-        ENTRY;
-        /* PDEBUG(page, "WRITEPAGE"); */
-        if ( sync )
-                err = obdfs_brw(OBD_BRW_WRITE, inode, page, 1);
-        else {
-                err = obdfs_add_page_to_cache(inode, page);
-                CDEBUG(D_INFO, "DO_WR ino: %ld, page %p, err %d, uptodate %d\n",
-                       inode->i_ino, page, err, Page_Uptodate(page));
-        }
-                
-        if ( !err ) {
-                SetPageUptodate(page);
-               set_page_clean(page);
-       }
-        /* PDEBUG(page,"WRITEPAGE"); */
-        EXIT;
-        return err;
-} /* obdfs_do_writepage */
-
-
-
-
-#endif
-
-int obdfs_commit_write(struct file *file, struct page *page, unsigned from, unsigned to)
-{
-        struct inode *inode = page->mapping->host;
-       int rc = 0;
-        loff_t len = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to;
-       ENTRY;
-       CDEBUG(D_INODE, "commit write ino %ld (end at %Ld) from %d to %d ,ind %ld\n",
-              inode->i_ino, len, from, to, page->index);
-
-
-       if (cache_writes == 0) { 
-               rc = obdfs_commit_page(page, 1, from, to);
-       }
-
-        if (len > inode->i_size) {
-               obdfs_set_size(inode, len);
-        }
-
-        kunmap(page);
-       EXIT;
-        return rc;
-}
-
-
-/*
- * This does the "real" work of the write. The generic routine has
- * allocated the page, locked it, done all the page alignment stuff
- * calculations etc. Now we should just copy the data from user
- * space and write it back to the real medium..
- *
- * If the writer ends up delaying the write, the writer needs to
- * increment the page use counts until he is done with the page.
- *
- * Return value is the number of bytes written.
- */
-int obdfs_write_one_page(struct file *file, struct page *page,
-                         unsigned long offset, unsigned long bytes,
-                         const char * buf)
-{
-        struct inode *inode = file->f_dentry->d_inode;
-        int err;
-
-        ENTRY;
-        /* We check for complete page writes here, as we then don't have to
-         * get the page before writing over everything anyways.
-         */
-        if ( !Page_Uptodate(page) && (offset != 0 || bytes != PAGE_SIZE) ) {
-                err = obdfs_brw(READ, inode, page, 0);
-                if ( err )
-                        return err;
-                SetPageUptodate(page);
-        }
-
-        if (copy_from_user((u8*)page_address(page) + offset, buf, bytes))
-                return -EFAULT;
-
-        lock_kernel();
-        err = obdfs_writepage(page);
-        unlock_kernel();
-
-        return (err < 0 ? err : bytes);
-} /* obdfs_write_one_page */
-
-/* 
- * return an up to date page:
- *  - if locked is true then is returned locked
- *  - if create is true the corresponding disk blocks are created 
- *  - page is held, i.e. caller must release the page
- *
- * modeled on NFS code.
- */
-struct page *obdfs_getpage(struct inode *inode, unsigned long offset,
-                           int create, int locked)
-{
-        struct page * page;
-        int index;
-        int err;
-
-        ENTRY;
-
-        offset = offset & PAGE_CACHE_MASK;
-        CDEBUG(D_INFO, "ino: %ld, offset %ld, create %d, locked %d\n",
-               inode->i_ino, offset, create, locked);
-        index = offset >> PAGE_CACHE_SHIFT;
-
-        page = grab_cache_page(&inode->i_data, index);
-
-        /* Yuck, no page */
-        if (! page) {
-            CERROR("grab_cache_page says no dice ...\n");
-            EXIT;
-            return NULL;
-        }
-
-        /* PDEBUG(page, "GETPAGE: got page - before reading\n"); */
-        /* now check if the data in the page is up to date */
-        if ( Page_Uptodate(page)) { 
-                if (!locked) {
-                        if (PageLocked(page))
-                                obd_unlock_page(page);
-                } else {
-                        CERROR("expecting locked page\n");
-                }
-                EXIT;
-                return page;
-        } 
-
-        err = obdfs_brw(READ, inode, page, create);
-
-        if ( err ) {
-                SetPageError(page);
-                obd_unlock_page(page);
-                EXIT;
-                return page;
-        }
-
-        if ( !locked )
-                obd_unlock_page(page);
-        SetPageUptodate(page);
-        /* PDEBUG(page,"GETPAGE - after reading"); */
-        EXIT;
-        return page;
-} /* obdfs_getpage */
-
-
-void obdfs_truncate(struct inode *inode)
-{
-        struct obdo *oa;
-        int err;
-        ENTRY;
-
-        //obdfs_dequeue_pages(inode);
-        oa = obdo_alloc();
-        if ( !oa ) {
-               err = -ENOMEM;
-                CERROR("obdo_alloc failed!\n");
-        } else {
-                oa->o_valid = OBD_MD_FLNOTOBD;
-                obdfs_from_inode(oa, inode);
-
-                CDEBUG(D_INFO, "calling punch for %ld (%Lu bytes at 0)\n",
-                       (long)oa->o_id, oa->o_size);
-                err = obd_punch(IID(inode), oa, oa->o_size, 0);
-
-                obdo_free(oa);
-        }
-
-        if (err) {
-                CERROR("obd_truncate fails (%d)\n", err);
-                EXIT;
-                return;
-        }
-        EXIT;
-} /* obdfs_truncate */
-
-struct address_space_operations obdfs_aops = {
-        readpage: obdfs_readpage,
-        writepage: obdfs_writepage,
-        sync_page: block_sync_page,
-        prepare_write: obdfs_prepare_write, 
-        commit_write: obdfs_commit_write,
-        bmap: NULL
-};
diff --git a/lustre/obdfs/super.c b/lustre/obdfs/super.c
deleted file mode 100644 (file)
index 19d50a2..0000000
+++ /dev/null
@@ -1,523 +0,0 @@
-
-/*
- * OBDFS Super operations
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- *
- * Copryright (C) 1996 Peter J. Braam <braam@stelias.com>
- * Copryright (C) 1999 Stelias Computing Inc. <braam@stelias.com>
- * Copryright (C) 1999 Seagate Technology Inc.
- * Copryright (C) 2001 Mountain View Data, Inc.
- * Copryright (C) 2002 Cluster File Systems, Inc.
- *
- */
-
-#include <linux/config.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/string.h>
-#include <linux/stat.h>
-#include <linux/errno.h>
-#include <linux/locks.h>
-#include <linux/unistd.h>
-
-#include <asm/system.h>
-#include <asm/uaccess.h>
-
-#include <linux/fs.h>
-#include <linux/stat.h>
-#include <asm/uaccess.h>
-#include <linux/vmalloc.h>
-#include <asm/segment.h>
-
-#define DEBUG_SUBSYSTEM S_OBDFS
-
-#include <linux/obd_support.h>
-#include <linux/obd_class.h>
-#include <linux/obdfs.h>
-
-struct list_head obdfs_super_list;
-extern struct address_space_operations obdfs_aops;
-struct super_operations obdfs_super_operations;
-long obdfs_cache_count = 0;
-long obdfs_mutex_start = 0;
-long obd_memory = 0;
-
-static char *obdfs_read_opt(const char *opt, char *data)
-{
-        char *value;
-        char *retval;
-
-        CDEBUG(D_INFO, "option: %s, data %s\n", opt, data);
-        if ( strncmp(opt, data, strlen(opt)) )
-                return NULL;
-
-        if ( (value = strchr(data, '=')) == NULL )
-                return NULL;
-
-        value++;
-        OBD_ALLOC(retval, strlen(value) + 1);
-        if ( !retval ) {
-                CERROR("out of memory!\n");
-                return NULL;
-        }
-        
-        memcpy(retval, value, strlen(value)+1);
-        CDEBUG(D_SUPER, "Assigned option: %s, value %s\n", opt, retval);
-        return retval;
-}
-
-static void obdfs_options(char *options, char **dev, char **vers)
-{
-        char *this_char;
-
-        if (!options)
-                return;
-
-        for (this_char = strtok (options, ",");
-             this_char != NULL;
-             this_char = strtok (NULL, ",")) {
-                CDEBUG(D_INFO, "this_char %s\n", this_char);
-                if ( (!*dev && (*dev = obdfs_read_opt("device", this_char)))||
-                     (!*vers && (*vers = obdfs_read_opt("version", this_char))) )
-                        continue;
-                
-        }
-}
-
-static struct super_block * obdfs_read_super(struct super_block *sb, 
-                                            void *data, int silent)
-{
-        struct inode *root = 0; 
-        struct obdfs_sb_info *sbi = (struct obdfs_sb_info *)(&sb->u.generic_sbp);
-        struct obd_device *obddev;
-       char *device = NULL;
-        char *version = NULL;
-       int connected = 0;
-        int devno;
-        int err;
-        unsigned long blocksize;
-        unsigned long blocksize_bits;
-        unsigned long root_ino;
-        int scratch;
-       struct obdo *oa;
-        
-
-        ENTRY;
-        MOD_INC_USE_COUNT; 
-        
-        memset(sbi, 0, sizeof(*sbi));
-        
-        CDEBUG(D_INFO, "\n"); 
-        obdfs_options(data, &device, &version);
-        if ( !device ) {
-                CERROR("no device\n");
-                EXIT;
-                goto ERR;
-        }
-
-       devno = simple_strtoul(device, NULL, 0);
-        CDEBUG(D_INFO, "\n"); 
-        if ( devno >= MAX_OBD_DEVICES ) {
-                CERROR("device of %s too high (%d)\n", device, devno);
-                EXIT;
-                goto ERR;
-        } 
-
-        CDEBUG(D_INFO, "\n"); 
-
-        obddev = &obd_dev[devno];
-        sbi->osi_obd = obddev;
-        sbi->osi_conn.oc_dev = obddev;
-
-        err = obd_connect(&sbi->osi_conn);
-        if ( err ) {
-                CERROR("OBDFS: cannot connect to %s\n", device);
-                EXIT;
-                goto ERR;
-        }
-
-       connected = 1;
-        CDEBUG(D_INFO, "\n"); 
-        /* list of dirty inodes, and a mutex to hold while modifying it */
-        INIT_LIST_HEAD(&sbi->osi_inodes);
-        init_MUTEX (&sbi->osi_list_mutex);
-
-        CDEBUG(D_INFO, "\n"); 
-        sbi->osi_super = sb;
-
-        CDEBUG(D_INFO, "\n"); 
-        err = obd_get_info(&sbi->osi_conn, strlen("blocksize"),
-                            "blocksize", &scratch,
-                            (void *)&blocksize);
-        if ( err ) {
-                CERROR("getinfo call to drive failed (blocksize)\n");
-                EXIT;
-                goto ERR;
-        }
-
-        CDEBUG(D_INFO, "\n"); 
-        err = obd_get_info(&sbi->osi_conn, strlen("blocksize_bits"),
-                          "blocksize_bits", &scratch,
-                          (void *)&blocksize_bits);
-        if ( err ) {
-                CERROR("getinfo call to drive failed (blocksize_bits)\n");
-                EXIT;
-                goto ERR;
-        }
-
-        CDEBUG(D_INFO, "\n"); 
-        err = obd_get_info(&sbi->osi_conn, strlen("root_ino"), 
-                          "root_ino", &scratch, (void *)&root_ino);
-        if ( err ) {
-                CERROR("getinfo call to drive failed (root_ino)\n");
-                EXIT;
-                goto ERR;
-        }
-        
-        CDEBUG(D_INFO, "\n"); 
-       sb->s_maxbytes = 1LL << 36;
-       CERROR("Max bytes: %Lx\n", sb->s_maxbytes);
-        sb->s_blocksize = PAGE_SIZE;
-        sb->s_blocksize_bits = (unsigned char)PAGE_SHIFT;
-        sb->s_magic = OBDFS_SUPER_MAGIC;
-        sb->s_op = &obdfs_super_operations;
-
-        /* XXX how to get "sb->s_flags |= MS_RDONLY" here for snapshots? */
-
-        /* make root inode */
-        CDEBUG(D_INFO, "\n"); 
-        oa = obdo_fromid(&sbi->osi_conn, root_ino, S_IFDIR,
-                         OBD_MD_FLNOTOBD | OBD_MD_FLBLOCKS);
-        CDEBUG(D_INFO, "mode %o\n", oa->o_mode); 
-        if ( IS_ERR(oa) ) {
-                CERROR("obdo_fromid failed\n");
-               iput(root); 
-                EXIT;
-                goto ERR;
-        }
-        CDEBUG(D_INFO, "\n"); 
-        root = iget4(sb, root_ino, NULL, oa);
-       obdo_free(oa);
-        CDEBUG(D_INFO, "\n"); 
-        if (!root) {
-            CERROR("OBDFS: bad iget4 for root\n");
-            sb->s_dev = 0;
-            err = -ENOENT;
-            EXIT;
-            goto ERR;
-        } 
-        
-        CDEBUG(D_INFO, "sbdev %d, rootino: %ld, dev %s, "
-               "minor: %d, blocksize: %ld, blocksize bits %ld\n", 
-               sb->s_dev, root->i_ino, device, MINOR(devno), 
-               blocksize, blocksize_bits);
-        sb->s_root = d_alloc_root(root);
-        list_add(&sbi->osi_list, &obdfs_super_list);
-        OBD_FREE(device, strlen(device) + 1);
-        if (version)
-                OBD_FREE(version, strlen(version) + 1);
-        EXIT;  
-        return sb;
-
-ERR:
-        MOD_DEC_USE_COUNT;
-        if (device)
-                OBD_FREE(device, strlen(device) + 1);
-        if (version)
-                OBD_FREE(version, strlen(version) + 1);
-       if (connected) 
-               obd_disconnect(&sbi->osi_conn);
-
-        if (sbi) {
-                sbi->osi_super = NULL;
-        }
-        if (root) {
-                iput(root);
-        }
-        sb->s_dev = 0;
-        return NULL;
-} /* obdfs_read_super */
-
-
-static void obdfs_put_super(struct super_block *sb)
-{
-        struct obdfs_sb_info *sbi;
-
-        ENTRY;
-        sb->s_dev = 0;
-        
-        sbi = (struct obdfs_sb_info *) &sb->u.generic_sbp;
-        //obdfs_flush_reqs(&sbi->osi_inodes, ~0UL);
-
-        obd_disconnect(ID(sb));
-        list_del(&sbi->osi_list);
-        
-        CERROR("OBDFS: Bye bye.\n");
-
-        MOD_DEC_USE_COUNT;
-        EXIT;
-} /* obdfs_put_super */
-
-
-void obdfs_do_change_inode(struct inode *inode, int valid)
-{
-        struct obdo *oa;
-        int err;
-        
-        ENTRY;
-        oa = obdo_alloc();
-        if ( !oa ) {
-                CERROR("obdo_alloc failed\n");
-                EXIT;
-                return;
-        }
-
-        oa->o_valid = OBD_MD_FLNOTOBD & (valid | OBD_MD_FLID);
-        obdfs_from_inode(oa, inode);
-       oa->o_mode = inode->i_mode;
-        err = obd_setattr(IID(inode), oa);
-
-        if ( err )
-                CERROR("obd_setattr fails (%d)\n", err);
-
-        EXIT;
-        obdo_free(oa);
-} /* obdfs_write_inode */
-
-void obdfs_change_inode(struct inode *inode, int mask)
-{
-       return obdfs_do_change_inode(inode, OBD_MD_FLNLINK); 
-}
-
-
-extern void write_inode_pages(struct inode *);
-/* This routine is called from iput() (for each unlink on the inode).
- * We can't put this call into delete_inode() since that is called only
- * when i_count == 0, and we need to keep a reference on the inode while
- * it is in the page cache, which means i_count > 0.  Catch 22.
- */
-static void obdfs_put_inode(struct inode *inode)
-{
-        ENTRY;
-        if (inode->i_nlink && (atomic_read(&inode->i_count) == 1)) {
-               write_inode_pages(inode);
-                EXIT;
-                return;
-        }
-
-        //obdfs_dequeue_pages(inode);
-        EXIT;
-} /* obdfs_put_inode */
-
-
-static void obdfs_delete_inode(struct inode *inode)
-{
-       obdfs_do_change_inode(inode, ~0);
-       clear_inode(inode); 
-}
-#if 0
-{
-        struct obdo *oa;
-        int err;
-
-        ENTRY;
-        oa = obdo_alloc();
-        if ( !oa ) {
-                CERROR("obdo_alloc failed\n");
-                EXIT;
-                return;
-        }
-        oa->o_valid = OBD_MD_FLNOTOBD;
-        obdfs_from_inode(oa, inode);
-
-       /* XXX how do we know that this inode is now clean? */
-       CERROR("delete_inode ------> link %d\n", inode->i_nlink);
-        ODEBUG(oa);
-        err = obd_destroy(IID(inode), oa);
-        obdo_free(oa);
-        clear_inode(inode);
-        if (err) {
-                CERROR("obd_destroy fails (%d)\n", err);
-                EXIT;
-                return;
-        }
-
-        EXIT;
-} /* obdfs_delete_inode */
-#endif
-
-
-static int obdfs_attr2inode(struct inode * inode, struct iattr * attr)
-{
-       unsigned int ia_valid = attr->ia_valid;
-       int error = 0;
-
-       if (ia_valid & ATTR_SIZE) {
-               error = vmtruncate(inode, attr->ia_size);
-               if (error)
-                       goto out;
-       }
-
-       if (ia_valid & ATTR_UID)
-               inode->i_uid = attr->ia_uid;
-       if (ia_valid & ATTR_GID)
-               inode->i_gid = attr->ia_gid;
-       if (ia_valid & ATTR_ATIME)
-               inode->i_atime = attr->ia_atime;
-       if (ia_valid & ATTR_MTIME)
-               inode->i_mtime = attr->ia_mtime;
-       if (ia_valid & ATTR_CTIME)
-               inode->i_ctime = attr->ia_ctime;
-       if (ia_valid & ATTR_MODE) {
-               inode->i_mode = attr->ia_mode;
-               if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID))
-                       inode->i_mode &= ~S_ISGID;
-       }
-out:
-       return error;
-}
-
-int obdfs_setattr(struct dentry *de, struct iattr *attr)
-{
-        struct inode *inode = de->d_inode;
-        struct obdo *oa;
-        int err;
-
-        ENTRY;
-        oa = obdo_alloc();
-        if ( !oa ) {
-                CERROR("obdo_alloc failed\n");
-                return -ENOMEM;
-        }
-
-       obdfs_attr2inode(inode, attr);
-        oa->o_id = inode->i_ino;
-       oa->o_mode = inode->i_mode;
-        obdo_from_iattr(oa, attr);
-        err = obd_setattr(IID(inode), oa);
-
-        if ( err )
-                CERROR("obd_setattr fails (%d)\n", err);
-
-        EXIT;
-        obdo_free(oa);
-        return err;
-} /* obdfs_setattr */
-
-
-
-static int obdfs_statfs(struct super_block *sb, struct statfs *buf)
-{
-        struct statfs tmp;
-        int err;
-
-        ENTRY;
-
-        err = obd_statfs(ID(sb), &tmp);
-        if ( err ) { 
-                CERROR("obd_statfs fails (%d)\n", err);
-                return err;
-        }
-       memcpy(buf, &tmp, sizeof(*buf));
-       CDEBUG(D_SUPER, "statfs returns avail %ld\n", tmp.f_bavail);
-        EXIT;
-
-        return err; 
-}
-
-static inline void obdfs_read_inode2(struct inode *inode, void *opaque)
-{
-       struct obdo *oa = opaque; 
-       
-       ENTRY;
-       obdfs_to_inode(inode, oa); 
-
-        INIT_LIST_HEAD(obdfs_iplist(inode)); /* list of dirty pages on inode */
-        INIT_LIST_HEAD(obdfs_islist(inode)); /* list of inodes in superblock */
-
-        /* OIDEBUG(inode); */
-
-        if (S_ISREG(inode->i_mode)) {
-                inode->i_op = &obdfs_file_inode_operations;
-                inode->i_fop = &obdfs_file_operations;
-                inode->i_mapping->a_ops = &obdfs_aops;
-                EXIT;
-        } else if (S_ISDIR(inode->i_mode)) {
-                inode->i_op = &obdfs_dir_inode_operations;
-                inode->i_fop = &obdfs_dir_operations; 
-                inode->i_mapping->a_ops = &obdfs_aops;
-                EXIT;
-        } else if (S_ISLNK(inode->i_mode)) {
-                if (inode->i_blocks) { 
-                        inode->i_op = &obdfs_symlink_inode_operations;
-                        inode->i_mapping->a_ops = &obdfs_aops;
-                }else {
-                        inode->i_op = &obdfs_fast_symlink_inode_operations;
-                }
-                EXIT;
-        } else {
-                init_special_inode(inode, inode->i_mode,
-                                   ((int *)obdfs_i2info(inode)->oi_inline)[0]);
-        }
-
-       EXIT;
-        return;
-}
-
-/* exported operations */
-struct super_operations obdfs_super_operations =
-{
-       read_inode2: obdfs_read_inode2,
-        put_inode: obdfs_put_inode,
-        delete_inode: obdfs_delete_inode,
-        put_super: obdfs_put_super,
-        statfs: obdfs_statfs
-};
-
-
-struct file_system_type obdfs_fs_type = {
-   "obdfs", 0, obdfs_read_super, NULL
-};
-
-int init_obdfs(void)
-{
-        //int err;
-
-        printk(KERN_INFO "OBDFS v0.1, braam@stelias.com\n");
-
-        obdfs_sysctl_init();
-
-        INIT_LIST_HEAD(&obdfs_super_list);
-        //err = obdfs_init_pgrqcache();
-        //if (err)
-       //return err;
-
-       //obdfs_flushd_init();
-        return register_filesystem(&obdfs_fs_type);
-}
-
-
-
-
-#ifdef MODULE
-int init_module(void)
-{
-        return init_obdfs();
-}
-
-void cleanup_module(void)
-{
-        ENTRY;
-
-        //obdfs_flushd_cleanup();
-        obdfs_sysctl_clean();
-        //obdfs_cleanup_pgrqcache();
-        unregister_filesystem(&obdfs_fs_type);
-        CDEBUG(D_MALLOC, "OBDFS mem used %ld\n", obd_memory);
-        EXIT;
-}
-
-#endif
diff --git a/lustre/obdfs/symlink.c b/lustre/obdfs/symlink.c
deleted file mode 100644 (file)
index 3ae8a4d..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- *  linux/fs/ext2/symlink.c
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- *
- * Copyright (C) 1992, 1993, 1994, 1995
- * Remy Card (card@masi.ibp.fr)
- * Laboratoire MASI - Institut Blaise Pascal
- * Universite Pierre et Marie Curie (Paris VI)
- *
- *  from
- *
- *  linux/fs/minix/symlink.c
- *
- *  Copyright (C) 1991, 1992  Linus Torvalds
- *
- *  ext2 symlink handling code
- *
- * Modified for OBDFS.
- * Re-written Oct 2001.
- *
- *  Copyright (C) 2001 Cluster File Systems, Inc. (author: braam@clusterfs.com)
- */
-
-#include <linux/fs.h>
-#include <linux/mm.h>
-#include <linux/stat.h>
-#include <linux/locks.h>
-
-#define DEBUG_SUBSYSTEM S_OBDFS
-
-#include <linux/obd_support.h> /* for ENTRY and EXIT only */
-#include <linux/obdfs.h>
-
-static int obdfs_fast_readlink(struct dentry *dentry, char *buffer, int buflen)
-{
-        char *s = obdfs_i2info(dentry->d_inode)->oi_inline;
-        return vfs_readlink(dentry, buffer, buflen, s);
-}
-
-static int obdfs_fast_follow_link(struct dentry *dentry, struct nameidata *nd)
-{
-        char *s = obdfs_i2info(dentry->d_inode)->oi_inline;
-        return vfs_follow_link(nd, s); 
-}
-
-extern int obdfs_setattr(struct dentry *de, struct iattr *attr);
-struct inode_operations obdfs_fast_symlink_inode_operations = {
-        readlink:       obdfs_fast_readlink,
-        follow_link:    obdfs_fast_follow_link,
-       setattr:        obdfs_setattr
-};
-
-static int obdfs_readlink(struct dentry *dentry, char *buffer, int buflen)
-{
-        struct page *page = NULL;
-        int res;
-
-        ENTRY;
-        OIDEBUG(dentry->d_inode);
-        page = obdfs_getpage(dentry->d_inode, 0, 0, 0);
-        /* PDEBUG(page, "readlink"); */
-        if (!page) {
-                EXIT;
-                return 0;
-        }
-        res = vfs_readlink(dentry, buffer, buflen, (char *)page_address(page));
-        page_cache_release(page);
-        EXIT;
-        return res;
-} /* obdfs_readlink */
-
-static int obdfs_follow_link(struct dentry * dentry,
-                             struct nameidata *nd)
-{
-        struct page *page = NULL;
-        int res;
-
-        ENTRY;
-        OIDEBUG(dentry->d_inode);
-        page = obdfs_getpage(dentry->d_inode, 0, 0, 0);
-        /* PDEBUG(page, "follow_link"); */
-        if (!page) {
-                dput(nd->dentry);
-                EXIT;
-                return -EIO;
-        }
-        res = vfs_follow_link(nd, (char *)page_address(page));
-        page_cache_release(page);
-        EXIT;
-        return res;
-}
-
-struct inode_operations obdfs_symlink_inode_operations = {
-        readlink:       obdfs_readlink,
-        follow_link:    obdfs_follow_link,
-       setattr:        obdfs_setattr
-};
diff --git a/lustre/obdfs/sysctl.c b/lustre/obdfs/sysctl.c
deleted file mode 100644 (file)
index c03b028..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2001  Cluster File Systems, Inc.
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- */
-#include <linux/sched.h>
-#include <linux/mm.h>
-#include <linux/sysctl.h>
-#include <linux/swapctl.h>
-#include <linux/proc_fs.h>
-#include <linux/slab.h>
-#include <linux/stat.h>
-#include <linux/ctype.h>
-#include <asm/bitops.h>
-#include <asm/segment.h>
-#include <asm/uaccess.h>
-#include <linux/utsname.h>
-
-
-struct ctl_table_header *obdfs_table_header = NULL;
-
-int obdfs_debug_level = 0;
-int obdfs_print_entry = 1;
-
-
-#define OBDFS_SYSCTL 1
-
-#define OBDFS_DEBUG        1       /* control debugging */
-#define OBDFS_ENTRY        2       /* control enter/leave pattern */
-#define OBDFS_TIMEOUT         3       /* timeout on upcalls to become intrble */
-#define OBDFS_HARD            4       /* mount type "hard" or "soft" */
-#define OBDFS_VARS            5       
-#define OBDFS_INDEX           6
-#define OBDFS_RESET           7
-
-#define OBDFS_VARS_SLOT       2
-
-static ctl_table obdfs_table[] = {
-       {OBDFS_DEBUG, "debug", &obdfs_debug_level, sizeof(int), 0644, NULL, &proc_dointvec},
-       {OBDFS_ENTRY, "trace", &obdfs_print_entry, sizeof(int), 0644, NULL, &proc_dointvec},
-       { 0 }
-};
-
-static ctl_table top_table[] = {
-       {OBDFS_SYSCTL, "obdfs",    NULL, 0, 0555, obdfs_table},
-       {0}
-};
-
-void obdfs_sysctl_init (void)
-{
-
-#ifdef CONFIG_SYSCTL
-       if ( !obdfs_table_header )
-               obdfs_table_header = register_sysctl_table(top_table, 0); 
-#endif
-}
-
-void obdfs_sysctl_clean (void)
-{
-#ifdef CONFIG_SYSCTL
-       if ( obdfs_table_header )
-               unregister_sysctl_table(obdfs_table_header);
-       obdfs_table_header = NULL;
-#endif
-}
diff --git a/lustre/osc/.cvsignore b/lustre/osc/.cvsignore
deleted file mode 100644 (file)
index e530020..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-.Xrefs
-config.log
-config.status
-configure
-Makefile
-Makefile.in
-.deps
-TAGS
diff --git a/lustre/osc/Makefile.am b/lustre/osc/Makefile.am
deleted file mode 100644 (file)
index 602a073..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright (C) 2001  Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-
-DEFS:=
-
-MODULE = osc
-modulefs_DATA = osc.o
-EXTRA_PROGRAMS = osc
-
-
-osc_SOURCES =  obd_pack.c osc_request.c # super.c rw.c file.c dir.c sysctl.c super.c namei.c symlink.c
-
-obd_pack.c: 
-       ln -s ../lib/obd_pack.c .
-
-include $(top_srcdir)/Rules
diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c
deleted file mode 100644 (file)
index 1b9dd03..0000000
+++ /dev/null
@@ -1,558 +0,0 @@
-/* 
- * Copryright (C) 2001 Cluster File Systems, Inc.
- *
- *  This code is issued under the GNU General Public License.
- *  See the file COPYING in this distribution
- *
- *  Author Peter Braam <braam@clusterfs.com>
- * 
- *  This server is single threaded at present (but can easily be multi
- *  threaded). For testing and management it is treated as an
- *  obd_device, although it does not export a full OBD method table
- *  (the requests are coming in over the wire, so object target
- *  modules do not have a full method table.)
- * 
- */
-
-#define EXPORT_SYMTAB
-
-#include <linux/config.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/string.h>
-#include <linux/stat.h>
-#include <linux/errno.h>
-#include <linux/locks.h>
-#include <linux/unistd.h>
-
-#include <asm/system.h>
-#include <asm/uaccess.h>
-
-#include <linux/fs.h>
-#include <linux/stat.h>
-#include <asm/uaccess.h>
-#include <asm/segment.h>
-#include <linux/miscdevice.h>
-
-#define DEBUG_SUBSYSTEM S_OSC
-
-#include <linux/obd_support.h>
-#include <linux/obd_class.h>
-#include <linux/lustre_lib.h>
-#include <linux/lustre_idl.h>
-
-extern int ost_queue_req(struct obd_device *, struct ptlrpc_request *);
-
-/* FIXME: this belongs in some sort of service struct */
-static int osc_xid = 1;
-
-struct ptlrpc_request *ost_prep_req(int opcode, int buflen1, char *buf1, 
-                                int buflen2, char *buf2)
-{
-       struct ptlrpc_request *request;
-       int rc;
-       ENTRY; 
-
-       OBD_ALLOC(request, sizeof(*request));
-       if (!request) { 
-               CERROR("request allocation out of memory\n");
-               return NULL;
-       }
-
-       memset(request, 0, sizeof(*request));
-       request->rq_xid = osc_xid++;
-
-       rc = ost_pack_req(buf1, buflen1,  buf2, buflen2,
-                         &request->rq_reqhdr, &request->rq_req.ost, 
-                         &request->rq_reqlen, &request->rq_reqbuf);
-       if (rc) { 
-               CERROR("llight request: cannot pack request %d\n", rc); 
-               return NULL;
-       }
-       request->rq_reqhdr->opc = opcode;
-
-       EXIT;
-       return request;
-}
-
-/* XXX: unify with mdc_queue_wait */
-extern int osc_queue_wait(struct obd_conn *conn, struct ptlrpc_request *req)
-{
-       struct obd_device *client = conn->oc_dev;
-       struct lustre_peer *peer = &conn->oc_dev->u.osc.osc_peer;
-       int rc;
-        DECLARE_WAITQUEUE(wait, current);
-
-       ENTRY;
-
-       /* set the connection id */
-       req->rq_req.ost->connid = conn->oc_id;
-       init_waitqueue_head(&req->rq_wait_for_rep);
-
-       /* XXX fix the race here (wait_for_event?)*/
-       if (peer == NULL) {
-               /* Local delivery */
-               CDEBUG(D_INODE, "\n");
-               rc = ost_queue_req(client, req); 
-       } else {
-               /* Remote delivery via portals. */
-               req->rq_req_portal = OST_REQUEST_PORTAL;
-               req->rq_reply_portal = OST_REPLY_PORTAL;
-               rc = ptl_send_rpc(req, peer);
-       }
-       if (rc) { 
-               CERROR("error %d, opcode %d\n", rc, req->rq_reqhdr->opc); 
-               return -rc;
-       }
-
-       CDEBUG(D_INODE, "tgt at %p, conn id %d, opcode %d request at: %p\n", 
-              &conn->oc_dev->u.osc.osc_tgt->u.ost, 
-              conn->oc_id, req->rq_reqhdr->opc, req);
-
-       /* wait for the reply */
-       CDEBUG(D_INODE, "-- sleeping\n");
-        add_wait_queue(&req->rq_wait_for_rep, &wait);
-        while (req->rq_repbuf == NULL) {
-                set_current_state(TASK_INTERRUPTIBLE);
-
-                /* if this process really wants to die, let it go */
-                if (sigismember(&(current->pending.signal), SIGKILL) ||
-                    sigismember(&(current->pending.signal), SIGINT))
-                        break;
-
-                schedule();
-        }
-        remove_wait_queue(&req->rq_wait_for_rep, &wait);
-        set_current_state(TASK_RUNNING);
-       CDEBUG(D_INODE, "-- done\n");
-
-        if (req->rq_repbuf == NULL) {
-                /* We broke out because of a signal */
-                EXIT;
-                return -EINTR;
-        }
-
-       rc = ost_unpack_rep(req->rq_repbuf, req->rq_replen, &req->rq_rephdr, 
-                           &req->rq_rep.ost); 
-       if (rc) {
-               CERROR("mds_unpack_rep failed: %d\n", rc);
-               return rc;
-       }
-
-       if ( req->rq_rephdr->status == 0 )
-               CDEBUG(D_INODE, "buf %p len %d status %d\n", 
-                      req->rq_repbuf, req->rq_replen, 
-                      req->rq_rephdr->status); 
-
-       EXIT;
-       return 0;
-}
-
-static void osc_free_req(struct ptlrpc_request *request)
-{
-       OBD_FREE(request, sizeof(*request));
-}
-
-static int osc_connect(struct obd_conn *conn)
-{
-       struct ptlrpc_request *request;
-       int rc; 
-       ENTRY;
-       
-       request = ost_prep_req(OST_CONNECT, 0, NULL, 0, NULL);
-       if (!request) { 
-               CERROR("cannot pack req!\n"); 
-               return -ENOMEM;
-       }
-
-       request->rq_replen = 
-               sizeof(struct ptlrep_hdr) + sizeof(struct ost_rep);
-
-       rc = osc_queue_wait(conn, request);
-       if (rc) { 
-               EXIT;
-               goto out;
-       }
-      
-       CDEBUG(D_INODE, "received connid %d\n", request->rq_rep.ost->connid); 
-
-       conn->oc_id = request->rq_rep.ost->connid;
- out:
-       osc_free_req(request);
-       EXIT;
-       return rc;
-}
-
-static int osc_disconnect(struct obd_conn *conn)
-{
-       struct ptlrpc_request *request;
-       int rc; 
-       ENTRY;
-       
-       request = ost_prep_req(OST_DISCONNECT, 0, NULL, 0, NULL);
-       if (!request) { 
-               CERROR("cannot pack req!\n"); 
-               return -ENOMEM;
-       }
-
-       request->rq_replen = 
-               sizeof(struct ptlrep_hdr) + sizeof(struct ost_rep);
-
-       rc = osc_queue_wait(conn, request);
-       if (rc) { 
-               EXIT;
-               goto out;
-       }
- out:
-       osc_free_req(request);
-       EXIT;
-       return rc;
-}
-
-
-static int osc_getattr(struct obd_conn *conn, struct obdo *oa)
-{
-       struct ptlrpc_request *request;
-       int rc; 
-
-       request = ost_prep_req(OST_GETATTR, 0, NULL, 0, NULL);
-       if (!request) { 
-               CERROR("cannot pack req!\n"); 
-               return -ENOMEM;
-       }
-       
-       memcpy(&request->rq_req.ost->oa, oa, sizeof(*oa));
-       request->rq_req.ost->oa.o_valid = ~0;
-       request->rq_replen = 
-               sizeof(struct ptlrep_hdr) + sizeof(struct ost_rep);
-       
-       rc = osc_queue_wait(conn, request);
-       if (rc) { 
-               EXIT;
-               goto out;
-       }
-
-       CDEBUG(D_INODE, "mode: %o\n", request->rq_rep.ost->oa.o_mode); 
-       if (oa) { 
-               memcpy(oa, &request->rq_rep.ost->oa, sizeof(*oa));
-       }
-
- out:
-       osc_free_req(request);
-       return 0;
-}
-
-static int osc_setattr(struct obd_conn *conn, struct obdo *oa)
-{
-       struct ptlrpc_request *request;
-       int rc; 
-
-       request = ost_prep_req(OST_SETATTR, 0, NULL, 0, NULL);
-       if (!request) { 
-               CERROR("cannot pack req!\n"); 
-               return -ENOMEM;
-       }
-       
-       memcpy(&request->rq_req.ost->oa, oa, sizeof(*oa));
-       request->rq_replen = 
-               sizeof(struct ptlrep_hdr) + sizeof(struct ost_rep);
-       
-       rc = osc_queue_wait(conn, request);
-       if (rc) { 
-               EXIT;
-               goto out;
-       }
-
- out:
-       osc_free_req(request);
-       return 0;
-}
-
-static int osc_create(struct obd_conn *conn, struct obdo *oa)
-{
-       struct ptlrpc_request *request;
-       int rc; 
-
-       if (!oa) { 
-               CERROR("oa NULL\n"); 
-       }
-       request = ost_prep_req(OST_CREATE, 0, NULL, 0, NULL);
-       if (!request) { 
-               CERROR("cannot pack req!\n"); 
-               return -ENOMEM;
-       }
-       
-       memcpy(&request->rq_req.ost->oa, oa, sizeof(*oa));
-       request->rq_req.ost->oa.o_valid = ~0;
-       request->rq_replen = 
-               sizeof(struct ptlrep_hdr) + sizeof(struct ost_rep);
-       
-       rc = osc_queue_wait(conn, request);
-       if (rc) { 
-               EXIT;
-               goto out;
-       }
-       memcpy(oa, &request->rq_rep.ost->oa, sizeof(*oa));
-
- out:
-       osc_free_req(request);
-       return 0;
-}
-
-static int osc_punch(struct obd_conn *conn, struct obdo *oa, obd_size count, obd_off offset)
-{
-       struct ptlrpc_request *request;
-       int rc; 
-
-       if (!oa) { 
-               CERROR("oa NULL\n"); 
-       }
-       request = ost_prep_req(OST_PUNCH, 0, NULL, 0, NULL);
-       if (!request) { 
-               CERROR("cannot pack req!\n"); 
-               return -ENOMEM;
-       }
-       
-       memcpy(&request->rq_req.ost->oa, oa, sizeof(*oa));
-       request->rq_req.ost->oa.o_valid = ~0;
-       request->rq_req.ost->oa.o_size = offset;
-       request->rq_req.ost->oa.o_blocks = count;
-       request->rq_replen = 
-               sizeof(struct ptlrep_hdr) + sizeof(struct ost_rep);
-       
-       rc = osc_queue_wait(conn, request);
-       if (rc) { 
-               EXIT;
-               goto out;
-       }
-       memcpy(oa, &request->rq_rep.ost->oa, sizeof(*oa));
-
- out:
-       osc_free_req(request);
-       return 0;
-}
-
-static int osc_destroy(struct obd_conn *conn, struct obdo *oa)
-{
-       struct ptlrpc_request *request;
-       int rc; 
-
-       if (!oa) { 
-               CERROR("oa NULL\n"); 
-       }
-       request = ost_prep_req(OST_DESTROY, 0, NULL, 0, NULL);
-       if (!request) { 
-               CERROR("cannot pack req!\n"); 
-               return -ENOMEM;
-       }
-       
-       memcpy(&request->rq_req.ost->oa, oa, sizeof(*oa));
-       request->rq_req.ost->oa.o_valid = ~0;
-       request->rq_replen = 
-               sizeof(struct ptlrep_hdr) + sizeof(struct ost_rep);
-       
-       rc = osc_queue_wait(conn, request);
-       if (rc) { 
-               EXIT;
-               goto out;
-       }
-       memcpy(oa, &request->rq_rep.ost->oa, sizeof(*oa));
-
- out:
-       osc_free_req(request);
-       return 0;
-}
-
-
-/* mount the file system (secretly) */
-static int osc_setup(struct obd_device *obddev, obd_count len,
-                       void *buf)
-                       
-{
-       struct obd_ioctl_data* data = buf;
-       struct osc_obd *osc = &obddev->u.osc;
-        ENTRY;
-
-       if (data->ioc_dev >= 0 && data->ioc_dev < MAX_OBD_DEVICES) {
-               /* This is a local connection */
-               osc->osc_tgt = &obd_dev[data->ioc_dev];
-
-               CERROR("OSC: tgt %d ost at %p\n", data->ioc_dev,
-                      &osc->osc_tgt->u.ost);
-               if ( ! (osc->osc_tgt->obd_flags & OBD_ATTACHED) || 
-                    ! (osc->osc_tgt->obd_flags & OBD_SET_UP) ){
-                       CERROR("device not attached or not set up (%d)\n", 
-                              data->ioc_dev);
-                       EXIT;
-                       return -EINVAL;
-               }
-       } else {
-               int err;
-               /* This is a remote connection using Portals */
-
-               /* XXX: this should become something like ioc_inlbuf1 */
-               err = kportal_uuid_to_peer("ost", &osc->osc_peer);
-               if (err != 0) {
-                       CERROR("Cannot find 'ost' peer.\n");
-                       EXIT;
-                       return -EINVAL;
-               }
-       }
-
-        MOD_INC_USE_COUNT;
-        EXIT;
-        return 0;
-} 
-
-int osc_sendpage(struct ptlrpc_request *req, struct niobuf *dst,
-                 struct niobuf *src)
-{
-        if (req->rq_peer.peer_nid == 0) {
-                /* local sendpage */
-                memcpy((char *)(unsigned long)dst->addr,
-                       (char *)(unsigned long)src->addr, src->len);
-        } else {
-               char *buf;
-                int rc;
-
-               OBD_ALLOC(buf, src->len);
-               if (!buf)
-                       return -ENOMEM;
-
-                memcpy(buf, (char *)(unsigned long)src->addr, src->len);
-
-                req->rq_type = PTLRPC_BULK;
-                req->rq_bulkbuf = buf;
-                req->rq_bulklen = src->len;
-                rc = ptl_send_buf(req, &req->rq_peer, OST_BULK_PORTAL);
-                init_waitqueue_head(&req->rq_wait_for_bulk);
-                sleep_on(&req->rq_wait_for_bulk);
-                OBD_FREE(buf, src->len);
-                req->rq_bulklen = 0; /* FIXME: eek. */
-        }
-
-        return 0;
-}
-
-
-int osc_brw(int rw, struct obd_conn *conn, obd_count num_oa,
-             struct obdo **oa, obd_count *oa_bufs, struct page **buf,
-             obd_size *count, obd_off *offset, obd_flag *flags)
-{
-       struct ptlrpc_request *request;
-       int rc; 
-       struct obd_ioobj ioo;
-       struct niobuf src;
-       int size1, size2 = 0; 
-       void *ptr1, *ptr2;
-       int i, j, n;
-
-       size1 = num_oa * sizeof(ioo); 
-       for (i = 0; i < num_oa; i++) { 
-               size2 += oa_bufs[i] * sizeof(src);
-       }
-
-       request = ost_prep_req(OST_BRW, size1, NULL, size2, NULL);
-       if (!request) { 
-               CERROR("cannot pack req!\n"); 
-               return -ENOMEM;
-       }
-
-       n = 0;
-       request->rq_req.ost->cmd = rw;
-       ptr1 = ost_req_buf1(request->rq_req.ost);
-       ptr2 = ost_req_buf2(request->rq_req.ost);
-        for (i = 0; i < num_oa; i++) {
-               ost_pack_ioo(&ptr1, oa[i], oa_bufs[i]); 
-                for (j = 0; j < oa_bufs[i]; j++) {
-                       ost_pack_niobuf(&ptr2, kmap(buf[n]), offset[n],
-                                       count[n], flags[n]); 
-                       n++;
-               }
-       }
-
-        request->rq_bulk_portal = OST_BULK_PORTAL;
-       request->rq_replen = 
-               sizeof(struct ptlrep_hdr) + sizeof(struct ost_rep) + size2;
-
-       rc = osc_queue_wait(conn, request);
-       if (rc) { 
-               EXIT;
-               goto out;
-       }
-
-#if 0
-       ptr2 = ost_rep_buf2(request->rq_rep.ost); 
-       if (request->rq_rep.ost->buflen2 != n * sizeof(struct niobuf)) { 
-               CERROR("buffer length wrong\n"); 
-               goto out;
-       }
-
-       if (rw == OBD_BRW_READ)
-               goto out;
-
-        for (i = 0; i < num_oa; i++) {
-                for (j = 0; j < oa_bufs[i]; j++) {
-                       struct niobuf *dst;
-                       src.addr = (__u64)(unsigned long)buf[n];
-                       src.len = count[n];
-                       ost_unpack_niobuf(&ptr2, &dst);
-                       osc_sendpage(request, dst, &src);
-                       n++;
-               }
-       }
-#endif
-
- out:
-       if (request->rq_rephdr)
-               OBD_FREE(request->rq_rephdr, request->rq_replen);
-       n = 0;
-        for (i = 0; i < num_oa; i++) {
-                for (j = 0; j < oa_bufs[i]; j++) {
-                       kunmap(buf[n]);
-                       n++;
-               }
-       }
-
-       osc_free_req(request);
-       return 0;
-}
-
-static int osc_cleanup(struct obd_device * obddev)
-{
-        MOD_DEC_USE_COUNT;
-        return 0;
-}
-
-struct obd_ops osc_obd_ops = { 
-       o_setup:   osc_setup,
-       o_cleanup: osc_cleanup, 
-       o_create: osc_create,
-       o_destroy: osc_destroy,
-       o_getattr: osc_getattr,
-       o_setattr: osc_setattr,
-       o_connect: osc_connect,
-       o_disconnect: osc_disconnect,
-       o_brw: osc_brw,
-       o_punch: osc_punch
-};
-
-static int __init osc_init(void)
-{
-        obd_register_type(&osc_obd_ops, LUSTRE_OSC_NAME);
-       return 0;
-}
-
-static void __exit osc_exit(void)
-{
-       obd_unregister_type(LUSTRE_OSC_NAME);
-}
-
-MODULE_AUTHOR("Peter J. Braam <braam@clusterfs.com>");
-MODULE_DESCRIPTION("Lustre Object Storage Client (OSC) v1.0");
-MODULE_LICENSE("GPL"); 
-
-module_init(osc_init);
-module_exit(osc_exit);
-
diff --git a/lustre/ost/.cvsignore b/lustre/ost/.cvsignore
deleted file mode 100644 (file)
index e530020..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-.Xrefs
-config.log
-config.status
-configure
-Makefile
-Makefile.in
-.deps
-TAGS
diff --git a/lustre/ost/Makefile.am b/lustre/ost/Makefile.am
deleted file mode 100644 (file)
index 9ed0b33..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright (C) 2001  Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-
-DEFS:= 
-MODULE = ost
-modulefs_DATA = ost.o
-EXTRA_PROGRAMS = ost
-
-obd_pack.c: 
-       ln -s ../lib/obd_pack.c .
-page.c:
-       ln -s ../lib/page.c
-
-ost_SOURCES = page.c obd_pack.c ost_handler.c
-
-include $(top_srcdir)/Rules
-
diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c
deleted file mode 100644 (file)
index e45c6f9..0000000
+++ /dev/null
@@ -1,819 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 2001, 2002 Cluster File Systems, Inc.
- *   Author: Peter J. Braam <braam@clusterfs.com>
- *   Author: Phil Schwan <phil@clusterfs.com>
- *
- *   This file is part of Lustre, http://www.lustre.org.
- *
- *   Lustre is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   Lustre is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with Lustre; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *  Storage Target Handling functions
- *  Lustre Object Server Module (OST)
- *
- *  This server is single threaded at present (but can easily be multi
- *  threaded). For testing and management it is treated as an
- *  obd_device, although it does not export a full OBD method table
- *  (the requests are coming in over the wire, so object target
- *  modules do not have a full method table.)
- */
-
-#define EXPORT_SYMTAB
-
-#include <linux/version.h>
-#include <linux/module.h>
-#include <linux/fs.h>
-#include <linux/stat.h>
-#include <linux/locks.h>
-#include <linux/ext2_fs.h>
-#include <linux/quotaops.h>
-#include <asm/unistd.h>
-
-#define DEBUG_SUBSYSTEM S_OST
-
-#include <linux/obd_support.h>
-#include <linux/obd.h>
-#include <linux/obd_class.h>
-#include <linux/lustre_lib.h>
-#include <linux/lustre_idl.h>
-#include <linux/lustre_mds.h>
-#include <linux/obd_class.h>
-
-// for testing
-static int ost_queue_req(struct obd_device *obddev, struct ptlrpc_request *req)
-{
-       struct ptlrpc_request *srv_req; 
-       struct ost_obd *ost = &obddev->u.ost;
-       
-       if (!ost) { 
-               EXIT;
-               return -1;
-       }
-
-       OBD_ALLOC(srv_req, sizeof(*srv_req));
-       if (!srv_req) { 
-               EXIT;
-               return -ENOMEM;
-       }
-
-        CDEBUG(0, "---> OST at %d %p, incoming req %p, srv_req %p\n",
-              __LINE__, ost, req, srv_req);
-
-       memset(srv_req, 0, sizeof(*req)); 
-
-       /* move the request buffer */
-       srv_req->rq_reqbuf = req->rq_reqbuf;
-       srv_req->rq_reqlen    = req->rq_reqlen;
-       srv_req->rq_ost = ost;
-
-       /* remember where it came from */
-       srv_req->rq_reply_handle = req;
-
-        spin_lock(&ost->ost_lock);
-       list_add(&srv_req->rq_list, &ost->ost_reqs); 
-        spin_unlock(&ost->ost_lock);
-       wake_up(&ost->ost_waitq);
-       return 0;
-}
-
-int ost_reply(struct obd_device *obddev, struct ptlrpc_request *req)
-{
-       struct ptlrpc_request *clnt_req = req->rq_reply_handle;
-
-       ENTRY;
-
-       if (req->rq_ost->ost_service != NULL) {
-               /* This is a request that came from the network via portals. */
-
-               /* FIXME: we need to increment the count of handled events */
-                req->rq_type = PTLRPC_REPLY;
-               ptl_send_buf(req, &req->rq_peer, OST_REPLY_PORTAL);
-       } else {
-               /* This is a local request that came from another thread. */
-
-               /* move the reply to the client */ 
-               clnt_req->rq_replen = req->rq_replen;
-               clnt_req->rq_repbuf = req->rq_repbuf;
-               req->rq_repbuf = NULL;
-               req->rq_replen = 0;
-
-               /* free the request buffer */
-               OBD_FREE(req->rq_reqbuf, req->rq_reqlen);
-               req->rq_reqbuf = NULL;
-
-               /* wake up the client */ 
-               wake_up_interruptible(&clnt_req->rq_wait_for_rep); 
-       }
-
-       EXIT;
-       return 0;
-}
-
-int ost_error(struct obd_device *obddev, struct ptlrpc_request *req)
-{
-       struct ptlrep_hdr *hdr;
-
-       ENTRY;
-
-       OBD_ALLOC(hdr, sizeof(*hdr));
-       if (!hdr) { 
-               EXIT;
-               return -ENOMEM;
-       }
-
-       memset(hdr, 0, sizeof(*hdr));
-       
-       hdr->seqno = req->rq_reqhdr->seqno;
-       hdr->status = req->rq_status; 
-       hdr->type = OST_TYPE_ERR;
-
-       req->rq_repbuf = (char *)hdr;
-       req->rq_replen = sizeof(*hdr); 
-
-       EXIT;
-       return ost_reply(obddev, req);
-}
-
-static int ost_destroy(struct ost_obd *ost, struct ptlrpc_request *req)
-{
-       struct obd_conn conn; 
-       int rc;
-
-       ENTRY;
-       
-       conn.oc_id = req->rq_req.ost->connid;
-       conn.oc_dev = ost->ost_tgt;
-
-       rc = ost_pack_rep(NULL, 0, NULL, 0, &req->rq_rephdr, &req->rq_rep.ost,
-                         &req->rq_replen, &req->rq_repbuf); 
-       if (rc) { 
-               CERROR("cannot pack reply\n"); 
-               return rc;
-       }
-
-       req->rq_rep.ost->result =ost->ost_tgt->obd_type->typ_ops->o_destroy
-               (&conn, &req->rq_req.ost->oa); 
-
-       EXIT;
-       return 0;
-}
-
-static int ost_getattr(struct ost_obd *ost, struct ptlrpc_request *req)
-{
-       struct obd_conn conn; 
-       int rc;
-
-       ENTRY;
-       
-       conn.oc_id = req->rq_req.ost->connid;
-       conn.oc_dev = ost->ost_tgt;
-
-       rc = ost_pack_rep(NULL, 0, NULL, 0, &req->rq_rephdr, &req->rq_rep.ost,
-                         &req->rq_replen, &req->rq_repbuf); 
-       if (rc) { 
-               CERROR("cannot pack reply\n"); 
-               return rc;
-       }
-       req->rq_rep.ost->oa.o_id = req->rq_req.ost->oa.o_id;
-       req->rq_rep.ost->oa.o_valid = req->rq_req.ost->oa.o_valid;
-
-       req->rq_rep.ost->result =ost->ost_tgt->obd_type->typ_ops->o_getattr
-               (&conn, &req->rq_rep.ost->oa); 
-
-       EXIT;
-       return 0;
-}
-
-static int ost_create(struct ost_obd *ost, struct ptlrpc_request *req)
-{
-       struct obd_conn conn; 
-       int rc;
-
-       ENTRY;
-       
-       conn.oc_id = req->rq_req.ost->connid;
-       conn.oc_dev = ost->ost_tgt;
-
-       rc = ost_pack_rep(NULL, 0, NULL, 0, &req->rq_rephdr, &req->rq_rep.ost,
-                         &req->rq_replen, &req->rq_repbuf); 
-       if (rc) { 
-               CERROR("cannot pack reply\n"); 
-               return rc;
-       }
-
-       memcpy(&req->rq_rep.ost->oa, &req->rq_req.ost->oa, sizeof(req->rq_req.ost->oa));
-
-       req->rq_rep.ost->result =ost->ost_tgt->obd_type->typ_ops->o_create
-               (&conn, &req->rq_rep.ost->oa); 
-
-       EXIT;
-       return 0;
-}
-
-static int ost_punch(struct ost_obd *ost, struct ptlrpc_request *req)
-{
-       struct obd_conn conn; 
-       int rc;
-
-       ENTRY;
-       
-       conn.oc_id = req->rq_req.ost->connid;
-       conn.oc_dev = ost->ost_tgt;
-
-       rc = ost_pack_rep(NULL, 0, NULL, 0, &req->rq_rephdr, &req->rq_rep.ost,
-                         &req->rq_replen, &req->rq_repbuf); 
-       if (rc) { 
-               CERROR("cannot pack reply\n"); 
-               return rc;
-       }
-
-       memcpy(&req->rq_rep.ost->oa, &req->rq_req.ost->oa, sizeof(req->rq_req.ost->oa));
-
-       req->rq_rep.ost->result =ost->ost_tgt->obd_type->typ_ops->o_punch
-               (&conn, &req->rq_rep.ost->oa, 
-                req->rq_rep.ost->oa.o_size,
-                req->rq_rep.ost->oa.o_blocks); 
-
-       EXIT;
-       return 0;
-}
-
-
-static int ost_setattr(struct ost_obd *ost, struct ptlrpc_request *req)
-{
-       struct obd_conn conn; 
-       int rc;
-
-       ENTRY;
-       
-       conn.oc_id = req->rq_req.ost->connid;
-       conn.oc_dev = ost->ost_tgt;
-
-       rc = ost_pack_rep(NULL, 0, NULL, 0, &req->rq_rephdr, &req->rq_rep.ost,
-                         &req->rq_replen, &req->rq_repbuf); 
-       if (rc) { 
-               CERROR("cannot pack reply\n"); 
-               return rc;
-       }
-
-       memcpy(&req->rq_rep.ost->oa, &req->rq_req.ost->oa,
-              sizeof(req->rq_req.ost->oa));
-
-       req->rq_rep.ost->result =ost->ost_tgt->obd_type->typ_ops->o_setattr
-               (&conn, &req->rq_rep.ost->oa); 
-
-       EXIT;
-       return 0;
-}
-
-static int ost_connect(struct ost_obd *ost, struct ptlrpc_request *req)
-{
-       struct obd_conn conn; 
-       int rc;
-
-       ENTRY;
-       
-       conn.oc_dev = ost->ost_tgt;
-
-       rc = ost_pack_rep(NULL, 0, NULL, 0, &req->rq_rephdr, &req->rq_rep.ost,
-                         &req->rq_replen, &req->rq_repbuf); 
-       if (rc) { 
-               CERROR("cannot pack reply\n"); 
-               return rc;
-       }
-
-       req->rq_rep.ost->result =ost->ost_tgt->obd_type->typ_ops->o_connect(&conn);
-
-        CDEBUG(0, "rep buffer %p, id %d\n", req->rq_repbuf,
-              conn.oc_id);
-       req->rq_rep.ost->connid = conn.oc_id;
-       EXIT;
-       return 0;
-}
-
-static int ost_disconnect(struct ost_obd *ost, struct ptlrpc_request *req)
-{
-       struct obd_conn conn; 
-       int rc;
-
-       ENTRY;
-       
-       conn.oc_dev = ost->ost_tgt;
-       conn.oc_id = req->rq_req.ost->connid;
-
-       rc = ost_pack_rep(NULL, 0, NULL, 0, &req->rq_rephdr, &req->rq_rep.ost,
-                         &req->rq_replen, &req->rq_repbuf); 
-       if (rc) { 
-               CERROR("cannot pack reply\n"); 
-               return rc;
-       }
-
-       req->rq_rep.ost->result =ost->ost_tgt->obd_type->typ_ops->o_disconnect(&conn);
-
-       EXIT;
-       return 0;
-}
-
-static int ost_get_info(struct ost_obd *ost, struct ptlrpc_request *req)
-{
-       struct obd_conn conn; 
-       int rc;
-       int vallen;
-       void *val;
-       char *ptr; 
-
-       ENTRY;
-       
-       conn.oc_id = req->rq_req.ost->connid;
-       conn.oc_dev = ost->ost_tgt;
-
-       ptr = ost_req_buf1(req->rq_req.ost);
-       req->rq_rep.ost->result =ost->ost_tgt->obd_type->typ_ops->o_get_info
-               (&conn, req->rq_req.ost->buflen1, ptr, &vallen, &val); 
-
-       rc = ost_pack_rep(val, vallen, NULL, 0, &req->rq_rephdr,
-                          &req->rq_rep.ost, &req->rq_replen, &req->rq_repbuf); 
-       if (rc) { 
-               CERROR("cannot pack reply\n"); 
-               return rc;
-       }
-
-       EXIT;
-       return 0;
-}
-
-int ost_brw(struct ost_obd *obddev, struct ptlrpc_request *req)
-{
-       struct obd_conn conn; 
-       int rc;
-       int i, j;
-       int objcount, niocount;
-       char *tmp1, *tmp2, *end2;
-       char *res;
-       int cmd;
-       struct niobuf *nb, *src, *dst;
-       struct obd_ioobj *ioo;
-       struct ost_req *r = req->rq_req.ost;
-
-       ENTRY;
-       
-       tmp1 = ost_req_buf1(r);
-       tmp2 = ost_req_buf2(r);
-       end2 = tmp2 + req->rq_req.ost->buflen2;
-       objcount = r->buflen1 / sizeof(*ioo); 
-       niocount = r->buflen2 / sizeof(*nb); 
-       cmd = r->cmd;
-
-       conn.oc_id = req->rq_req.ost->connid;
-       conn.oc_dev = req->rq_ost->ost_tgt;
-
-       rc = ost_pack_rep(NULL, niocount, NULL, 0, 
-                         &req->rq_rephdr, &req->rq_rep.ost,
-                         &req->rq_replen, &req->rq_repbuf); 
-       if (rc) { 
-               CERROR("cannot pack reply\n"); 
-               return rc;
-       }
-       res = ost_rep_buf1(req->rq_rep.ost); 
-
-       for (i=0; i < objcount; i++) { 
-               ost_unpack_ioo((void *)&tmp1, &ioo);
-               if (tmp2 + ioo->ioo_bufcnt > end2) { 
-                       rc = -EFAULT;
-                       break; 
-               }
-               for (j = 0 ; j < ioo->ioo_bufcnt ; j++) { 
-                       ost_unpack_niobuf((void *)&tmp2, &nb); 
-               }
-       }
-
-       /* The unpackers move tmp1 and tmp2, so reset them before using */
-       tmp1 = ost_req_buf1(r);
-       tmp2 = ost_req_buf2(r);
-       req->rq_rep.ost->result = 
-               req->rq_ost->ost_tgt->obd_type->typ_ops->o_preprw
-               (cmd, &conn, objcount, (struct obd_ioobj *)tmp1, 
-                niocount, (struct niobuf *)tmp2, (struct niobuf *)res); 
-
-       if (req->rq_rep.ost->result) {
-               EXIT;
-               goto out;
-       }
-
-        if (cmd == OBD_BRW_WRITE) {
-                for (i = 0; i < niocount; i++) {
-                       src = &((struct niobuf *)tmp2)[i];
-                       dst = &((struct niobuf *)res)[i];
-                       memcpy((void *)(unsigned long)dst->addr, 
-                              (void *)(unsigned long)src->addr, 
-                              src->len);
-               }
-               barrier();
-       } else { 
-                for (i = 0; i < niocount; i++) {
-                       dst = &((struct niobuf *)tmp2)[i];
-                       src = &((struct niobuf *)res)[i];
-                       memcpy((void *)(unsigned long)dst->addr, 
-                              (void *)(unsigned long)src->addr, 
-                              PAGE_SIZE); 
-               }
-               barrier();
-       }
-
-       req->rq_rep.ost->result = 
-               req->rq_ost->ost_tgt->obd_type->typ_ops->o_commitrw
-               (cmd, &conn, objcount, (struct obd_ioobj *)tmp1, 
-                niocount, (struct niobuf *)res); 
-
- out:
-       EXIT;
-       return 0;
-}
-
-int ost_handle(struct obd_device *obddev, struct ptlrpc_request *req)
-{
-       int rc;
-       struct ost_obd *ost = &obddev->u.ost;
-       struct ptlreq_hdr *hdr;
-
-       ENTRY;
-        CDEBUG(0, "req at %p\n", req);
-
-       hdr = (struct ptlreq_hdr *)req->rq_reqbuf;
-       if (NTOH__u32(hdr->type) != OST_TYPE_REQ) {
-               CERROR("lustre_ost: wrong packet type sent %d\n",
-                      NTOH__u32(hdr->type));
-               rc = -EINVAL;
-               goto out;
-       }
-
-       rc = ost_unpack_req(req->rq_reqbuf, req->rq_reqlen, 
-                           &req->rq_reqhdr, &req->rq_req.ost);
-       if (rc) { 
-               CERROR("lustre_ost: Invalid request\n");
-               EXIT; 
-               goto out;
-       }
-
-       switch (req->rq_reqhdr->opc) { 
-
-       case OST_CONNECT:
-               CDEBUG(D_INODE, "connect\n");
-               rc = ost_connect(ost, req);
-               break;
-       case OST_DISCONNECT:
-               CDEBUG(D_INODE, "disconnect\n");
-               rc = ost_disconnect(ost, req);
-               break;
-       case OST_GET_INFO:
-               CDEBUG(D_INODE, "get_info\n");
-               rc = ost_get_info(ost, req);
-               break;
-       case OST_CREATE:
-               CDEBUG(D_INODE, "create\n");
-               rc = ost_create(ost, req);
-               break;
-       case OST_DESTROY:
-               CDEBUG(D_INODE, "destroy\n");
-               rc = ost_destroy(ost, req);
-               break;
-       case OST_GETATTR:
-               CDEBUG(D_INODE, "getattr\n");
-               rc = ost_getattr(ost, req);
-               break;
-       case OST_SETATTR:
-               CDEBUG(D_INODE, "setattr\n");
-               rc = ost_setattr(ost, req);
-               break;
-       case OST_BRW:
-               CDEBUG(D_INODE, "brw\n");
-               rc = ost_brw(ost, req);
-               break;
-       case OST_PUNCH:
-               CDEBUG(D_INODE, "punch\n");
-               rc = ost_punch(ost, req);
-               break;
-       default:
-               req->rq_status = -ENOTSUPP;
-               return ost_error(obddev, req);
-       }
-
-out:
-       req->rq_status = rc;
-       if (rc) { 
-               CERROR("ost: processing error %d\n", rc);
-               ost_error(obddev, req);
-       } else { 
-               CDEBUG(D_INODE, "sending reply\n"); 
-               ost_reply(obddev, req); 
-       }
-
-       return 0;
-}
-
-/* FIXME: Serious refactoring needed */
-int ost_main(void *arg)
-{
-        int signal; 
-       struct obd_device *obddev = (struct obd_device *) arg;
-       struct ost_obd *ost = &obddev->u.ost;
-        DECLARE_WAITQUEUE(wait, current);
-
-       ENTRY;
-
-       lock_kernel();
-       daemonize();
-       spin_lock_irq(&current->sigmask_lock);
-       sigfillset(&current->blocked);
-       recalc_sigpending(current);
-       spin_unlock_irq(&current->sigmask_lock);
-
-       sprintf(current->comm, "lustre_ost");
-
-       /* Record that the  thread is running */
-       ost->ost_thread = current;
-       wake_up(&ost->ost_done_waitq); 
-
-       /* XXX maintain a list of all managed devices: insert here */
-
-       /* And now, wait forever for commit wakeup events. */
-       while (1) {
-               int rc; 
-
-               if (ost->ost_service != NULL) {
-                       ptl_event_t ev;
-                        struct ptlrpc_request request;
-                        struct ptlrpc_service *service;
-
-                        CDEBUG(D_IOCTL, "-- sleeping\n");
-                        signal = 0;
-                        add_wait_queue(&ost->ost_waitq, &wait);
-                        while (1) {
-                                set_current_state(TASK_INTERRUPTIBLE);
-                                rc = PtlEQGet(ost->ost_service->srv_eq_h, &ev);
-                                if (rc == PTL_OK || rc == PTL_EQ_DROPPED)
-                                        break;
-                                if (ost->ost_flags & OST_EXIT)
-                                        break;
-
-
-                                /* if this process really wants to die,
-                                 * let it go */
-                                if (sigismember(&(current->pending.signal),
-                                                SIGKILL) ||
-                                    sigismember(&(current->pending.signal),
-                                                SIGINT)) {
-                                        signal = 1;
-                                        break;
-                                }
-
-                                schedule();
-                        }
-                        remove_wait_queue(&ost->ost_waitq, &wait);
-                        set_current_state(TASK_RUNNING);
-                        CDEBUG(D_IOCTL, "-- done\n");
-
-                        if (signal == 1) {
-                                /* We broke out because of a signal */
-                                EXIT;
-                                break;
-                        }
-                        if (ost->ost_flags & OST_EXIT) {
-                                EXIT;
-                                break;
-                        }
-
-                        service = (struct ptlrpc_service *)ev.mem_desc.user_ptr;
-
-                        /* FIXME: If we move to an event-driven model,
-                         * we should put the request on the stack of
-                         * mds_handle instead. */
-                        memset(&request, 0, sizeof(request));
-                        request.rq_reqbuf = ev.mem_desc.start + ev.offset;
-                        request.rq_reqlen = ev.mem_desc.length;
-                        request.rq_ost = ost;
-                        request.rq_xid = ev.match_bits;
-
-                        request.rq_peer.peer_nid = ev.initiator.nid;
-                        /* FIXME: this NI should be the incoming NI.
-                         * We don't know how to find that from here. */
-                        request.rq_peer.peer_ni =
-                                ost->ost_service->srv_self.peer_ni;
-                        rc = ost_handle(obddev, &request);
-
-                        /* Inform the rpc layer the event has been handled */
-                        ptl_received_rpc(service);
-               } else {
-                       struct ptlrpc_request *request;
-
-                        CDEBUG(D_IOCTL, "-- sleeping\n");
-                        add_wait_queue(&ost->ost_waitq, &wait);
-                        while (1) {
-                                spin_lock(&ost->ost_lock);
-                                if (!list_empty(&ost->ost_reqs))
-                                        break;
-
-                                set_current_state(TASK_INTERRUPTIBLE);
-
-                                /* if this process really wants to die,
-                                 * let it go */
-                                if (sigismember(&(current->pending.signal),
-                                                SIGKILL) ||
-                                    sigismember(&(current->pending.signal),
-                                                SIGINT))
-                                        break;
-
-                                spin_unlock(&ost->ost_lock);
-
-                                schedule();
-                        }
-                        remove_wait_queue(&ost->ost_waitq, &wait);
-                        set_current_state(TASK_RUNNING);
-                        CDEBUG(D_IOCTL, "-- done\n");
-
-                       if (list_empty(&ost->ost_reqs)) { 
-                               CDEBUG(D_INODE, "woke because of signal\n");
-                                spin_unlock(&ost->ost_lock);
-                       } else {
-                               request = list_entry(ost->ost_reqs.next,
-                                                    struct ptlrpc_request,
-                                                    rq_list);
-                               list_del(&request->rq_list);
-                                spin_unlock(&ost->ost_lock);
-                               rc = ost_handle(obddev, request); 
-                       }
-               }
-       }
-
-       /* XXX maintain a list of all managed devices: cleanup here */
-
-       ost->ost_thread = NULL;
-       wake_up(&ost->ost_done_waitq);
-       CERROR("lustre_ost: exiting\n");
-       return 0;
-}
-
-static void ost_stop_srv_thread(struct ost_obd *ost)
-{
-       ost->ost_flags |= OST_EXIT;
-
-       while (ost->ost_thread) {
-               wake_up(&ost->ost_waitq);
-               sleep_on(&ost->ost_done_waitq);
-       }
-}
-
-static void ost_start_srv_thread(struct obd_device *obd)
-{
-       struct ost_obd *ost = &obd->u.ost;
-       ENTRY;
-
-       init_waitqueue_head(&ost->ost_waitq);
-       init_waitqueue_head(&ost->ost_done_waitq);
-       kernel_thread(ost_main, (void *)obd, 
-                     CLONE_VM | CLONE_FS | CLONE_FILES);
-       while (!ost->ost_thread) 
-               sleep_on(&ost->ost_done_waitq);
-       EXIT;
-}
-
-/* mount the file system (secretly) */
-static int ost_setup(struct obd_device *obddev, obd_count len,
-                       void *buf)
-                       
-{
-       struct obd_ioctl_data* data = buf;
-       struct ost_obd *ost = &obddev->u.ost;
-       struct obd_device *tgt;
-       struct lustre_peer peer;
-       int err; 
-        ENTRY;
-
-       if (data->ioc_dev  < 0 || data->ioc_dev > MAX_OBD_DEVICES) { 
-               EXIT;
-               return -ENODEV;
-       }
-
-        tgt = &obd_dev[data->ioc_dev];
-       ost->ost_tgt = tgt;
-        if ( ! (tgt->obd_flags & OBD_ATTACHED) || 
-             ! (tgt->obd_flags & OBD_SET_UP) ){
-                CERROR("device not attached or not set up (%d)\n", 
-                       data->ioc_dev);
-                EXIT;
-               return -EINVAL;
-        } 
-
-       ost->ost_conn.oc_dev = tgt;
-       err = tgt->obd_type->typ_ops->o_connect(&ost->ost_conn);
-       if (err) { 
-               CERROR("lustre ost: fail to connect to device %d\n", 
-                      data->ioc_dev); 
-               return -EINVAL;
-       }
-
-       INIT_LIST_HEAD(&ost->ost_reqs);
-       ost->ost_thread = NULL;
-       ost->ost_flags = 0;
-
-       spin_lock_init(&obddev->u.ost.ost_lock);
-
-       err = kportal_uuid_to_peer("self", &peer);
-       if (err == 0) {
-               OBD_ALLOC(ost->ost_service, sizeof(*ost->ost_service));
-               if (ost->ost_service == NULL)
-                       return -ENOMEM;
-               ost->ost_service->srv_buf_size = 64 * 1024;
-               ost->ost_service->srv_portal = OST_REQUEST_PORTAL;
-               memcpy(&ost->ost_service->srv_self, &peer, sizeof(peer));
-               ost->ost_service->srv_wait_queue = &ost->ost_waitq;
-
-               rpc_register_service(ost->ost_service, "self");
-       }
-
-       ost_start_srv_thread(obddev);
-
-        MOD_INC_USE_COUNT;
-        EXIT; 
-        return 0;
-} 
-
-static int ost_cleanup(struct obd_device * obddev)
-{
-       struct ost_obd *ost = &obddev->u.ost;
-       struct obd_device *tgt;
-       int err;
-
-        ENTRY;
-
-        if ( !(obddev->obd_flags & OBD_SET_UP) ) {
-                EXIT;
-                return 0;
-        }
-
-        if ( !list_empty(&obddev->obd_gen_clients) ) {
-                CERROR("still has clients!\n");
-                EXIT;
-                return -EBUSY;
-        }
-
-       ost_stop_srv_thread(ost);
-       rpc_unregister_service(ost->ost_service);
-        OBD_FREE(ost->ost_service, sizeof(*ost->ost_service));
-
-       if (!list_empty(&ost->ost_reqs)) {
-               // XXX reply with errors and clean up
-               CDEBUG(D_INODE, "Request list not empty!\n");
-       }
-
-       tgt = ost->ost_tgt;
-       err = tgt->obd_type->typ_ops->o_disconnect(&ost->ost_conn);
-       if (err) { 
-               CERROR("lustre ost: fail to disconnect device\n");
-               return -EINVAL;
-       }
-       
-
-        MOD_DEC_USE_COUNT;
-        EXIT;
-        return 0;
-}
-
-/* use obd ops to offer management infrastructure */
-static struct obd_ops ost_obd_ops = {
-        o_setup:       ost_setup,
-        o_cleanup:     ost_cleanup,
-};
-
-static int __init ost_init(void)
-{
-        obd_register_type(&ost_obd_ops, LUSTRE_OST_NAME);
-       return 0;
-}
-
-static void __exit ost_exit(void)
-{
-       obd_unregister_type(LUSTRE_OST_NAME);
-}
-
-MODULE_AUTHOR("Peter J. Braam <braam@clusterfs.com>");
-MODULE_DESCRIPTION("Lustre Object Storage Target (OST) v0.01");
-MODULE_LICENSE("GPL");
-
-// for testing (maybe this stays)
-EXPORT_SYMBOL(ost_queue_req);
-
-module_init(ost_init);
-module_exit(ost_exit);
diff --git a/lustre/patches/.cvsignore b/lustre/patches/.cvsignore
deleted file mode 100644 (file)
index e530020..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-.Xrefs
-config.log
-config.status
-configure
-Makefile
-Makefile.in
-.deps
-TAGS
diff --git a/lustre/patches/patch-2.2.10 b/lustre/patches/patch-2.2.10
deleted file mode 100644 (file)
index 62cd23c..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
---- linux-2.2.10/include/linux/fs.h.org        Tue Aug  3 15:09:33 1999
-+++ linux-2.2.10/include/linux/fs.h    Tue Aug  3 15:10:34 1999
-@@ -897,6 +897,9 @@
- #include <linux/minix_fs.h>
- #include <linux/minix_fs_sb.h>
-+struct super_block *get_empty_super(void);
-+void remove_vfsmnt(kdev_t dev);
-+
- #endif /* __KERNEL__ */
- #endif
---- linux-2.2.10/fs/super.c.org        Tue Aug  3 15:08:09 1999
-+++ linux-2.2.10/fs/super.c    Tue Aug  3 15:10:41 1999
-@@ -135,7 +135,7 @@
-       return lptr;
- }
--static void remove_vfsmnt(kdev_t dev)
-+void remove_vfsmnt(kdev_t dev)
- {
-       struct vfsmount *lptr, *tofree;
-@@ -508,7 +508,7 @@
- /*
-  * Find a super_block with no device assigned.
-  */
--static struct super_block *get_empty_super(void)
-+struct super_block *get_empty_super(void)
- {
-       struct super_block *s;
---- linux-2.2.10/kernel/ksyms.c.org    Tue Aug  3 15:10:55 1999
-+++ linux-2.2.10/kernel/ksyms.c        Tue Aug  3 15:11:56 1999
-@@ -78,6 +78,16 @@
- #endif
- EXPORT_SYMBOL(get_options);
-+/* obd stuff */
-+
-+
-+
-+EXPORT_SYMBOL(get_empty_super);
-+EXPORT_SYMBOL(remove_vfsmnt);
-+
-+
-+
-+
- /* process memory management */
- EXPORT_SYMBOL(do_mmap);
- EXPORT_SYMBOL(do_munmap);
diff --git a/lustre/patches/patch-2.3.15 b/lustre/patches/patch-2.3.15
deleted file mode 100644 (file)
index ba02eb1..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
---- linux-2.2.10/include/linux/fs.h.org        Tue Aug  3 15:09:33 1999
-+++ linux-2.2.10/include/linux/fs.h    Tue Aug  3 15:10:34 1999
-@@ -897,6 +897,9 @@
- #include <linux/minix_fs.h>
- #include <linux/minix_fs_sb.h>
-+struct super_block *get_empty_super(void);
-+void remove_vfsmnt(kdev_t dev);
-+
- #endif /* __KERNEL__ */
- #endif
---- linux-2.2.10/fs/super.c.org        Tue Aug  3 15:08:09 1999
-+++ linux-2.2.10/fs/super.c    Tue Aug  3 15:10:41 1999
-@@ -135,7 +135,7 @@
-       return lptr;
- }
--static void remove_vfsmnt(kdev_t dev)
-+void remove_vfsmnt(kdev_t dev)
- {
-       struct vfsmount *lptr, *tofree;
-@@ -508,7 +508,7 @@
- /*
-  * Find a super_block with no device assigned.
-  */
--static struct super_block *get_empty_super(void)
-+struct super_block *get_empty_super(void)
- {
-       struct super_block *s;
---- linux/kernel/ksyms.c.org   Tue Aug 31 05:25:11 1999
-+++ linux/kernel/ksyms.c       Tue Aug 31 05:31:31 1999
-@@ -114,6 +114,8 @@
- EXPORT_SYMBOL(init_mm);
- /* filesystem internal functions */
-+EXPORT_SYMBOL(get_empty_super);
-+EXPORT_SYMBOL(remove_vfsmnt);
- EXPORT_SYMBOL(in_group_p);
- EXPORT_SYMBOL(update_atime);
- EXPORT_SYMBOL(get_super);
diff --git a/lustre/patches/patch-2.3.21 b/lustre/patches/patch-2.3.21
deleted file mode 100644 (file)
index 2914b2d..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
---- linux/include/linux/fs.h.org       Tue Oct 12 10:39:59 1999
-+++ linux/include/linux/fs.h   Tue Oct 12 11:32:46 1999
-@@ -934,6 +934,8 @@
- extern struct super_block *get_super(kdev_t);
-+struct super_block *get_empty_super(void);
-+void remove_vfsmnt(kdev_t dev);
- extern void put_super(kdev_t);
- unsigned long generate_cluster(kdev_t, int b[], int);
- unsigned long generate_cluster_swab32(kdev_t, int b[], int);
---- linux/fs/super.c.org       Tue Oct 12 10:39:05 1999
-+++ linux/fs/super.c   Tue Oct 12 11:18:14 1999
-@@ -135,7 +135,7 @@
-       return lptr;
- }
--static void remove_vfsmnt(kdev_t dev)
-+void remove_vfsmnt(kdev_t dev)
- {
-       struct vfsmount *lptr, *tofree;
-@@ -508,7 +508,7 @@
- /*
-  * Find a super_block with no device assigned.
-  */
--static struct super_block *get_empty_super(void)
-+struct super_block *get_empty_super(void)
- {
-       struct super_block *s;
---- linux/kernel/ksyms.c.or    Tue Oct 12 10:40:21 1999
-+++ linux/kernel/ksyms.c       Tue Oct 12 11:22:45 1999
-@@ -36,6 +36,7 @@
- #include <linux/swap.h>
- #include <linux/ctype.h>
- #include <linux/file.h>
-+#include <linux/iobuf.h>
- #include <linux/console.h>
- #include <linux/poll.h>
- #include <linux/mm.h>
-@@ -118,6 +119,8 @@
- EXPORT_SYMBOL(update_atime);
- EXPORT_SYMBOL(get_super);
- EXPORT_SYMBOL(get_fs_type);
-+EXPORT_SYMBOL(get_empty_super);
-+EXPORT_SYMBOL(remove_vfsmnt);
- EXPORT_SYMBOL(getname);
- EXPORT_SYMBOL(_fput);
- EXPORT_SYMBOL(igrab);
-@@ -140,6 +143,9 @@
- EXPORT_SYMBOL(d_path);
- EXPORT_SYMBOL(__mark_buffer_dirty);
- EXPORT_SYMBOL(__mark_inode_dirty);
-+EXPORT_SYMBOL(free_kiovec);
-+EXPORT_SYMBOL(brw_kiovec);
-+EXPORT_SYMBOL(alloc_kiovec);
- EXPORT_SYMBOL(get_empty_filp);
- EXPORT_SYMBOL(init_private_file);
- EXPORT_SYMBOL(filp_open);
diff --git a/lustre/patches/patch-2.4.16 b/lustre/patches/patch-2.4.16
deleted file mode 100644 (file)
index 8e0c915..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
---- /usr/src/linux-2.4.16/fs/reiserfs/file.c.obd-orig  Thu Dec 13 14:35:00 2001
-+++ /usr/src/linux-2.4.16/fs/reiserfs/file.c   Thu Dec 13 14:35:08 2001
-@@ -28,8 +28,8 @@
-     struct reiserfs_transaction_handle th ;
-     int windex ;
--    if (!S_ISREG (inode->i_mode))
--      BUG ();
-+    //if (!S_ISREG (inode->i_mode))
-+    //BUG ();
-     /* fast out for when nothing needs to be done */
-     if ((atomic_read(&inode->i_count) > 1 ||
---- /usr/src/linux-2.4.16/fs/namespace.c.obd-orig      Tue Dec 11 20:44:15 2001
-+++ /usr/src/linux-2.4.16/fs/namespace.c       Tue Dec 11 20:44:35 2001
-@@ -332,7 +332,7 @@
-       }
- }
--static int do_umount(struct vfsmount *mnt, int flags)
-+int do_umount(struct vfsmount *mnt, int flags)
- {
-       struct super_block * sb = mnt->mnt_sb;
-       int retval = 0;
---- /usr/src/linux-2.4.16/kernel/ksyms.c.obd-orig      Tue Dec 11 14:22:09 2001
-+++ /usr/src/linux-2.4.16/kernel/ksyms.c       Tue Dec 11 18:05:30 2001
-@@ -268,6 +268,7 @@
- EXPORT_SYMBOL(__pollwait);
- EXPORT_SYMBOL(poll_freewait);
- EXPORT_SYMBOL(ROOT_DEV);
-+EXPORT_SYMBOL(pagecache_lock);
- EXPORT_SYMBOL(__find_get_page);
- EXPORT_SYMBOL(__find_lock_page);
- EXPORT_SYMBOL(grab_cache_page);
---- /usr/src/linux-2.4.16/mm/filemap.c.obd-orig        Mon Nov 26 06:29:17 2001
-+++ /usr/src/linux-2.4.16/mm/filemap.c Tue Dec 11 14:29:50 2001
-@@ -2846,8 +2846,7 @@
-  * file system has to do this all by itself, unfortunately.
-  *                                                    okir@monad.swb.de
-  */
--ssize_t
--generic_file_write(struct file *file,const char *buf,size_t count, loff_t *ppos)
-+ssize_t do_generic_file_write(struct file *file,const char *buf,size_t count,loff_t *ppos, int (*actor)(char *, char *, size_t ))
- {
-       struct address_space *mapping = file->f_dentry->d_inode->i_mapping;
-       struct inode    *inode = mapping->host;
-@@ -2862,8 +2861,10 @@
-       if ((ssize_t) count < 0)
-               return -EINVAL;
-+#if 0
-       if (!access_ok(VERIFY_READ, buf, count))
-               return -EFAULT;
-+#endif
-       cached_page = NULL;
-@@ -2987,10 +2988,12 @@
-                * same page as we're writing to, without it being marked
-                * up-to-date.
-                */
-+#if 0
-               { volatile unsigned char dummy;
-                       __get_user(dummy, buf);
-                       __get_user(dummy, buf+bytes-1);
-               }
-+#endif
-               status = -ENOMEM;       /* we'll assign it later anyway */
-               page = __grab_cache_page(mapping, index, &cached_page);
-@@ -3006,7 +3009,7 @@
-               status = mapping->a_ops->prepare_write(file, page, offset, offset+bytes);
-               if (status)
-                       goto unlock;
--              page_fault = __copy_from_user(kaddr+offset, buf, bytes);
-+              page_fault = actor(kaddr+offset, buf, bytes);
-               flush_dcache_page(page);
-               status = mapping->a_ops->commit_write(file, page, offset, offset+bytes);
-               if (page_fault)
-@@ -3072,6 +3075,23 @@
-       goto out_status;
- }
-+
-+static inline int actor_from_user(char *dst, char *src, size_t len)
-+{
-+      if (!access_ok(VERIFY_READ, src, len))
-+              return -EFAULT;
-+              
-+      return __copy_from_user(dst, src, len);
-+}
-+
-+ssize_t
-+generic_file_write(struct file *file,const char *buf,size_t count,loff_t *ppos)
-+{
-+      return do_generic_file_write(file, buf, count, ppos, &actor_from_user);
-+}
-+
-+
-+
- void __init page_cache_init(unsigned long mempages)
- {
-       unsigned long htable_size, order;
---- /usr/src/linux-2.4.16/include/linux/fs.h.obd-orig  Tue Dec 11 14:23:29 2001
-+++ /usr/src/linux-2.4.16/include/linux/fs.h   Tue Dec 11 20:45:00 2001
-@@ -978,8 +978,10 @@
- extern int register_filesystem(struct file_system_type *);
- extern int unregister_filesystem(struct file_system_type *);
- extern struct vfsmount *kern_mount(struct file_system_type *);
-+struct vfsmount *do_kern_mount(char *type, int flags, char *name, void *data);
- extern int may_umount(struct vfsmount *);
- extern long do_mount(char *, char *, char *, unsigned long, void *);
-+int do_umount(struct vfsmount *mnt, int flags);
- #define kern_umount mntput
-@@ -1044,6 +1046,35 @@
- asmlinkage long sys_open(const char *, int, int);
- asmlinkage long sys_close(unsigned int);      /* yes, it's really unsigned */
-+asmlinkage ssize_t sys_read(unsigned int fd, char * buf, size_t count);
-+asmlinkage ssize_t sys_write(unsigned int fd, const char * buf, size_t count);
-+asmlinkage long sys_truncate64(const char * path, loff_t length);
-+asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length);
-+asmlinkage long sys_mount(char * dev_name, char * dir_name, char * type,
-+                        unsigned long flags, void * data);
-+asmlinkage long sys_umount(char * name, int flags);
-+asmlinkage long sys_stat(char * filename, struct __old_kernel_stat * statbuf);
-+asmlinkage long sys_mknod(const char * filename, int mode, dev_t dev);
-+asmlinkage long sys_mkdir(const char * pathname, int mode);
-+asmlinkage long sys_rmdir(const char * pathname);
-+asmlinkage long sys_unlink(const char * pathname);
-+asmlinkage long sys_symlink(const char * oldname, const char * newname);
-+asmlinkage long sys_link(const char * oldname, const char * newname);
-+asmlinkage long sys_rename(const char * oldname, const char * newname);
-+asmlinkage long sys_lstat64(char * filename, struct stat64 * statbuf, long flags);
-+asmlinkage long sys_stat64(char * filename, struct stat64 * statbuf, long flags);
-+asmlinkage long sys_fstat64(unsigned long fd, struct stat64 * statbuf, long flags);
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
- extern int do_truncate(struct dentry *, loff_t start);
- extern struct file *filp_open(const char *, int, int);
-@@ -1395,6 +1426,8 @@
- extern ssize_t generic_file_read(struct file *, char *, size_t, loff_t *);
- extern ssize_t generic_file_write(struct file *, const char *, size_t, loff_t *);
- extern void do_generic_file_read(struct file *, loff_t *, read_descriptor_t *, read_actor_t);
-+ssize_t do_generic_file_write(struct file *file,const char *buf,size_t count,loff_t *ppos, int (*actor)(char *, char *, size_t ));
-+
- extern loff_t no_llseek(struct file *file, loff_t offset, int origin);
- extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin);
- extern ssize_t generic_read_dir(struct file *, char *, size_t, loff_t *);
diff --git a/lustre/patches/patch-2.4.17 b/lustre/patches/patch-2.4.17
deleted file mode 100644 (file)
index 2a72130..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
---- linux-2.4.17/kernel/ksyms.c.lustre Fri Feb 22 15:26:38 2002
-+++ linux-2.4.17/kernel/ksyms.c        Fri Feb 22 15:27:44 2002
-@@ -282,6 +282,11 @@
- EXPORT_SYMBOL(lock_may_write);
- EXPORT_SYMBOL(dcache_readdir);
-+/* lustre */
-+EXPORT_SYMBOL(pagecache_lock);
-+EXPORT_SYMBOL(do_kern_mount);
-+
-+
- /* for stackable file systems (lofs, wrapfs, cryptfs, etc.) */
- EXPORT_SYMBOL(default_llseek);
- EXPORT_SYMBOL(dentry_open);
---- linux-2.4.17/include/linux/fs.h.lustre     Fri Feb 22 15:27:53 2002
-+++ linux-2.4.17/include/linux/fs.h    Fri Feb 22 15:28:52 2002
-@@ -983,7 +984,7 @@
- extern struct vfsmount *kern_mount(struct file_system_type *);
- extern int may_umount(struct vfsmount *);
- extern long do_mount(char *, char *, char *, unsigned long, void *);
--
-+struct vfsmount *do_kern_mount(char *type, int flags, char *name, void *data);
- #define kern_umount mntput
- extern int vfs_statfs(struct super_block *, struct statfs *);
diff --git a/lustre/patches/patch-2.4.3-empty-super b/lustre/patches/patch-2.4.3-empty-super
deleted file mode 100644 (file)
index 02603fd..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
---- linux/fs/super.c.orig      Sat Sep 29 09:40:16 2001
-+++ linux/fs/super.c   Sat Sep 29 09:40:42 2001
-@@ -695,7 +695,7 @@
-  *    the request.
-  */
-  
--static struct super_block *get_empty_super(void)
-+struct super_block *get_empty_super(void)
- {
-       struct super_block *s;
---- linux/include/linux/fs.h.orig      Sat Sep 29 09:42:14 2001
-+++ linux/include/linux/fs.h   Sat Sep 29 09:42:55 2001
-@@ -1360,6 +1360,7 @@
- extern struct file_system_type *get_fs_type(const char *name);
- extern struct super_block *get_super(kdev_t);
- extern void put_super(kdev_t);
-+struct super_block *get_empty_super(void);
- unsigned long generate_cluster(kdev_t, int b[], int);
- unsigned long generate_cluster_swab32(kdev_t, int b[], int);
- extern kdev_t ROOT_DEV;
---- linux/kernel/ksyms.c.orig  Sat Sep 29 09:40:56 2001
-+++ linux/kernel/ksyms.c       Sat Sep 29 09:41:17 2001
-@@ -142,6 +142,7 @@
- EXPORT_SYMBOL(igrab);
- EXPORT_SYMBOL(iunique);
- EXPORT_SYMBOL(iget4);
-+EXPORT_SYMBOL(get_empty_super);
- EXPORT_SYMBOL(iput);
- EXPORT_SYMBOL(force_delete);
- EXPORT_SYMBOL(follow_up);
diff --git a/lustre/patches/patch-2.4.9-ac10 b/lustre/patches/patch-2.4.9-ac10
deleted file mode 100644 (file)
index 0ad2377..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-diff -u linux-2.4.9-ac10.orig/include/linux/fs.h linux-2.4.9-ac10/include/linux/fs.h
---- linux-2.4.9-ac10.orig/include/linux/fs.h   Mon Sep 24 11:15:51 2001
-+++ linux-2.4.9-ac10/include/linux/fs.h        Thu Sep 20 16:55:36 2001
-@@ -1440,6 +1440,7 @@
- extern int dcache_readdir(struct file *, void *, filldir_t);
- extern struct file_system_type *get_fs_type(const char *name);
-+struct vfsmount *do_kern_mount(char *type, int flags, char *name, void *data);
- extern struct super_block *get_super(kdev_t);
- extern void drop_super(struct super_block *sb);
- static inline int is_mounted(kdev_t dev)
-diff -u linux-2.4.9-ac10.orig/kernel/ksyms.c linux-2.4.9-ac10/kernel/ksyms.c
---- linux-2.4.9-ac10.orig/kernel/ksyms.c       Mon Sep 24 11:15:52 2001
-+++ linux-2.4.9-ac10/kernel/ksyms.c    Thu Sep 20 16:42:30 2001
-@@ -131,6 +131,7 @@
- EXPORT_SYMBOL(def_blk_fops);
- EXPORT_SYMBOL(update_atime);
- EXPORT_SYMBOL(get_fs_type);
-+EXPORT_SYMBOL(do_kern_mount);
- EXPORT_SYMBOL(get_super);
- EXPORT_SYMBOL(drop_super);
- EXPORT_SYMBOL(getname);
diff --git a/lustre/patches/patch-2.4.9-rh-ac13-xfs-1 b/lustre/patches/patch-2.4.9-rh-ac13-xfs-1
deleted file mode 100644 (file)
index 6211605..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
---- rpm/build/kernel-2.4.9/linux/include/linux/fs.h    Mon Nov  5 22:20:00 2001
-+++ linux/include/linux/fs.h   Mon Nov  5 22:24:09 2001
-@@ -1049,6 +1049,7 @@
- extern int register_filesystem(struct file_system_type *);
- extern int unregister_filesystem(struct file_system_type *);
- extern struct vfsmount *kern_mount(struct file_system_type *);
-+struct vfsmount *do_kern_mount(char *type, int flags, char *name, void *data);
- extern int may_umount(struct vfsmount *);
- extern long do_mount(char *, char *, char *, unsigned long, void *);
-@@ -1474,6 +1475,7 @@
- extern ssize_t generic_file_read(struct file *, char *, size_t, loff_t *);
- extern ssize_t generic_file_write(struct file *, const char *, size_t, loff_t *);
- extern void do_generic_file_read(struct file *, loff_t *, read_descriptor_t *, read_actor_t, int);
-+ssize_t do_generic_file_write(struct file *file,const char *buf,size_t count,loff_t *ppos, int (*actor)(char *, char *, size_t ));
- extern ssize_t generic_read_dir(struct file *, char *, size_t, loff_t *);
- extern loff_t generic_file_llseek(struct file *, loff_t, int);
---- rpm/build/kernel-2.4.9/linux/kernel/ksyms.c        Mon Nov  5 22:20:00 2001
-+++ linux/kernel/ksyms.c       Mon Nov  5 22:29:41 2001
-@@ -246,6 +246,7 @@
- EXPORT_SYMBOL(do_generic_file_read);
- EXPORT_SYMBOL(flush_inode_pages);
- EXPORT_SYMBOL(generic_file_write);
-+EXPORT_SYMBOL(do_generic_file_write);
- EXPORT_SYMBOL(generic_file_mmap);
- EXPORT_SYMBOL(generic_ro_fops);
- EXPORT_SYMBOL(generic_buffer_fdatasync);
-@@ -286,6 +287,7 @@
- EXPORT_SYMBOL(__pollwait);
- EXPORT_SYMBOL(poll_freewait);
- EXPORT_SYMBOL(ROOT_DEV);
-+//EXPORT_SYMBOL(pagecache_lock);
- EXPORT_SYMBOL(__find_get_page);
- EXPORT_SYMBOL(__find_lock_page);
- EXPORT_SYMBOL(find_get_page_simple);
-@@ -371,6 +373,7 @@
- EXPORT_SYMBOL(register_filesystem);
- EXPORT_SYMBOL(unregister_filesystem);
- EXPORT_SYMBOL(kern_mount);
-+EXPORT_SYMBOL(do_kern_mount);
- EXPORT_SYMBOL(__mntput);
- EXPORT_SYMBOL(may_umount);
---- rpm/build/kernel-2.4.9/linux/mm/filemap.c  Mon Nov  5 22:20:00 2001
-+++ linux/mm/filemap.c Mon Nov  5 22:16:57 2001
-@@ -2672,7 +2672,7 @@
-  *                                                    okir@monad.swb.de
-  */
- ssize_t
--generic_file_write(struct file *file,const char *buf,size_t count,loff_t *ppos)
-+do_generic_file_write(struct file *file,const char *buf,size_t count,loff_t *ppos, int (*actor)(char *, char *, size_t ))
- {
-       struct inode    *inode = file->f_dentry->d_inode; 
-       struct address_space *mapping = inode->i_mapping;
-@@ -2686,8 +2686,10 @@
-       cached_page = NULL;
-+#if 0
-       if (!access_ok(VERIFY_READ, buf, count))
-               return -EFAULT;
-+#endif
-               
-       down(&inode->i_sem);
-@@ -2794,10 +2796,12 @@
-                * same page as we're writing to, without it being marked
-                * up-to-date.
-                */
-+#if 0
-               { volatile unsigned char dummy;
-                       __get_user(dummy, buf);
-                       __get_user(dummy, buf+bytes-1);
-               }
-+#endif
-               status = -ENOMEM;       /* we'll assign it later anyway */
-               page = __grab_cache_page(mapping, index, &cached_page);
-@@ -2813,7 +2817,7 @@
-               if (status)
-                       goto sync_failure;
-               kaddr = page_address(page);
--              page_fault = __copy_from_user(kaddr+offset, buf, bytes);
-+              page_fault = actor(kaddr+offset, buf, bytes);
-               flush_dcache_page(page);
-               status = mapping->a_ops->commit_write(file, page, offset, offset+bytes);
-               if (page_fault)
-@@ -2870,6 +2874,21 @@
-               vmtruncate(inode, inode->i_size);
-       goto done;
- }
-+
-+static inline int actor_from_user(char *dst, char *src, size_t len)
-+{
-+      if (!access_ok(VERIFY_READ, src, len))
-+              return -EFAULT;
-+              
-+      return __copy_from_user(dst, src, len);
-+}
-+
-+ssize_t
-+generic_file_write(struct file *file,const char *buf,size_t count,loff_t *ppos)
-+{
-+      return do_generic_file_write(file, buf, count, ppos, &actor_from_user);
-+}
-+
- void __init page_cache_init(unsigned long mempages)
- {
diff --git a/lustre/ptlrpc/rpc.c b/lustre/ptlrpc/rpc.c
deleted file mode 100644 (file)
index d7f46a1..0000000
+++ /dev/null
@@ -1,653 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 2002 Cluster File Systems, Inc.
- *
- *   This file is part of Lustre, http://www.lustre.org.
- *
- *   Lustre is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   Lustre is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with Lustre; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#define EXPORT_SYMTAB
-
-#include <linux/config.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
-
-#define DEBUG_SUBSYSTEM S_RPC
-
-#include <linux/obd_support.h>
-#include <linux/lustre_net.h>
-
-static ptl_handle_eq_t sent_pkt_eq, rcvd_rep_eq, 
-        bulk_source_eq, bulk_sink_eq;
-
-
-struct ptlrpc_request *ptlrpc_prep_req(struct ptlrpc_client *cl, 
-                                       int opcode, int namelen, char *name,
-                                       int tgtlen, char *tgt)
-{
-       struct ptlrpc_request *request;
-       int rc;
-       ENTRY; 
-
-       OBD_ALLOC(request, sizeof(*request));
-       if (!request) { 
-               CERROR("request allocation out of memory\n");
-               return NULL;
-       }
-
-       memset(request, 0, sizeof(*request));
-       request->rq_xid = cl->cli_xid++;
-
-       rc = cl->cli_req_pack(name, namelen, tgt, tgtlen,
-                         &request->rq_reqhdr, &request->rq_req,
-                         &request->rq_reqlen, &request->rq_reqbuf);
-       if (rc) { 
-               CERROR("cannot pack request %d\n", rc); 
-               return NULL;
-       }
-       request->rq_reqhdr->opc = opcode;
-       request->rq_reqhdr->seqno = request->rq_xid;
-
-       EXIT;
-       return request;
-}
-
-void ptlrpc_free_req(struct ptlrpc_request *request)
-{
-       OBD_FREE(request, sizeof(*request));
-}
-
-/* Abort this request and cleanup any resources associated with it. */
-int ptl_abort_rpc(struct ptlrpc_request *request)
-{
-        /* First remove the MD for the reply; in theory, this means
-         * that we can tear down the buffer safely. */
-        PtlMEUnlink(request->rq_reply_me_h);
-        PtlMDUnlink(request->rq_reply_md_h);
-
-        if (request->rq_bulklen != 0) {
-                PtlMEUnlink(request->rq_bulk_me_h);
-                PtlMDUnlink(request->rq_bulk_md_h);
-        }
-
-        return 0;
-}
-
-int ptlrpc_queue_wait(struct ptlrpc_request *req, struct ptlrpc_client *cl)
-{
-       int rc;
-        DECLARE_WAITQUEUE(wait, current);
-
-       init_waitqueue_head(&req->rq_wait_for_rep);
-
-       if (cl->cli_enqueue) {
-               /* Local delivery */
-                ENTRY;
-               rc = cl->cli_enqueue(req); 
-       } else {
-               /* Remote delivery via portals. */
-               req->rq_req_portal = cl->cli_request_portal;
-               req->rq_reply_portal = cl->cli_reply_portal;
-               rc = ptl_send_rpc(req, &cl->cli_server);
-       }
-       if (rc) { 
-               CERROR("error %d, opcode %d\n", rc, 
-                      req->rq_reqhdr->opc); 
-               return -rc;
-       }
-
-        CDEBUG(0, "-- sleeping\n");
-        add_wait_queue(&req->rq_wait_for_rep, &wait);
-        while (req->rq_repbuf == NULL) {
-                set_current_state(TASK_INTERRUPTIBLE);
-
-                /* if this process really wants to die, let it go */
-                if (sigismember(&(current->pending.signal), SIGKILL) ||
-                    sigismember(&(current->pending.signal), SIGINT))
-                        break;
-
-                schedule();
-        }
-        remove_wait_queue(&req->rq_wait_for_rep, &wait);
-        set_current_state(TASK_RUNNING);
-        CDEBUG(0, "-- done\n");
-
-        if (req->rq_repbuf == NULL) {
-                /* We broke out because of a signal.  Clean up the dangling
-                 * reply buffers! */
-                ptl_abort_rpc(req);
-                EXIT;
-                return -EINTR;
-        }
-
-       rc = cl->cli_rep_unpack(req->rq_repbuf, req->rq_replen, &req->rq_rephdr,
-                                &req->rq_rep);
-       if (rc) {
-               CERROR("unpack_rep failed: %d\n", rc);
-               return rc;
-       }
-        CERROR("got rep %lld\n", req->rq_rephdr->seqno);
-       if ( req->rq_rephdr->status == 0 )
-                CDEBUG(0, "--> buf %p len %d status %d\n",
-                      req->rq_repbuf, req->rq_replen, 
-                      req->rq_rephdr->status); 
-
-       EXIT;
-       return 0;
-}
-/*
- *  Free the packet when it has gone out
- */
-static int sent_packet_callback(ptl_event_t *ev, void *data)
-{
-        ENTRY;
-
-        if (ev->type == PTL_EVENT_SENT) {
-                OBD_FREE(ev->mem_desc.start, ev->mem_desc.length);
-        } else { 
-                // XXX make sure we understand all events, including ACK's
-                CERROR("Unknown event %d\n", ev->type); 
-                BUG();
-        }
-
-        EXIT;
-        return 1;
-}
-
-/*
- * Wake up the thread waiting for the reply once it comes in.
- */
-static int rcvd_reply_callback(ptl_event_t *ev, void *data)
-{
-        struct ptlrpc_request *rpc = ev->mem_desc.user_ptr;
-        ENTRY;
-
-        if (ev->type == PTL_EVENT_PUT) {
-                rpc->rq_repbuf = ev->mem_desc.start + ev->offset;
-                barrier();
-                wake_up_interruptible(&rpc->rq_wait_for_rep);
-        } else { 
-                // XXX make sure we understand all events, including ACK's
-                CERROR("Unknown event %d\n", ev->type); 
-                BUG();
-        }
-
-        EXIT;
-        return 1;
-}
-
-static int server_request_callback(ptl_event_t *ev, void *data)
-{
-        struct ptlrpc_service *service = data;
-        int rc;
-
-        if (ev->rlength != ev->mlength)
-                CERROR("Warning: Possibly truncated rpc (%d/%d)\n",
-                       ev->mlength, ev->rlength);
-
-        /* The ME is unlinked when there is less than 1024 bytes free
-         * on its MD.  This ensures we are always able to handle the rpc, 
-         * although the 1024 value is a guess as to the size of a
-         * large rpc (the known safe margin should be determined).
-         *
-         * NOTE: The portals API by default unlinks all MD's associated
-         *       with an ME when it's unlinked.  For now, this behavior
-         *       has been commented out of the portals library so the
-         *       MD can be unlinked when its ref count drops to zero.
-         *       A new MD and ME will then be created that use the same
-         *       kmalloc()'ed memory and inserted at the ring tail.
-         */
-
-        service->srv_ref_count[service->srv_md_active]++;
-
-        if (ev->offset >= (service->srv_buf_size - 1024)) {
-                CDEBUG(D_INODE, "Unlinking ME %d\n", service->srv_me_active);
-
-                rc = PtlMEUnlink(service->srv_me_h[service->srv_me_active]);
-                service->srv_me_h[service->srv_me_active] = 0;
-
-                if (rc != PTL_OK) {
-                        CERROR("PtlMEUnlink failed - DROPPING soon: %d\n", rc);
-                        return rc;
-                }
-
-                service->srv_me_active = NEXT_INDEX(service->srv_me_active,
-                        service->srv_ring_length);
-
-                if (service->srv_me_h[service->srv_me_active] == 0)
-                        CERROR("All %d ring ME's are unlinked!\n",
-                               service->srv_ring_length);
-        }
-
-        if (ev->type == PTL_EVENT_PUT) {
-                wake_up(service->srv_wait_queue);
-        } else {
-                CERROR("Unexpected event type: %d\n", ev->type);
-        }
-
-        return 0;
-}
-
-static int bulk_source_callback(ptl_event_t *ev, void *data)
-{
-        struct ptlrpc_request *rpc = ev->mem_desc.user_ptr;
-
-        ENTRY;
-
-        if (ev->type == PTL_EVENT_SENT) {
-                CDEBUG(D_NET, "got SENT event\n");
-        } else if (ev->type == PTL_EVENT_ACK) {
-                CDEBUG(D_NET, "got ACK event\n");
-                rpc->rq_bulkbuf = NULL;
-                wake_up_interruptible(&rpc->rq_wait_for_bulk);
-        } else {
-                CERROR("Unexpected event type!\n");
-                BUG();
-        }
-
-        EXIT;
-        return 1;
-}
-
-static int bulk_sink_callback(ptl_event_t *ev, void *data)
-{
-        struct ptlrpc_request *rpc = ev->mem_desc.user_ptr;
-
-        ENTRY;
-
-        if (ev->type == PTL_EVENT_PUT) {
-                if (rpc->rq_bulkbuf != ev->mem_desc.start + ev->offset)
-                        CERROR("bulkbuf != mem_desc -- why?\n");
-                //wake_up_interruptible(&rpc->rq_wait_for_bulk);
-        } else {
-                CERROR("Unexpected event type!\n");
-                BUG();
-        }
-
-        EXIT;
-        return 1;
-}
-
-int ptl_send_buf(struct ptlrpc_request *request, struct lustre_peer *peer,
-                 int portal)
-{
-        int rc;
-        ptl_process_id_t remote_id;
-        ptl_handle_md_t md_h;
-        ptl_ack_req_t ack;
-
-        switch (request->rq_type) {
-        case PTLRPC_BULK:
-                request->rq_req_md.start = request->rq_bulkbuf;
-                request->rq_req_md.length = request->rq_bulklen;
-                request->rq_req_md.eventq = bulk_source_eq;
-                request->rq_req_md.threshold = 2; /* SENT and ACK events */
-                ack = PTL_ACK_REQ;
-                break;
-        case PTLRPC_REQUEST:
-                request->rq_req_md.start = request->rq_reqbuf;
-                request->rq_req_md.length = request->rq_reqlen;
-                request->rq_req_md.eventq = sent_pkt_eq;
-                request->rq_req_md.threshold = 1;
-                ack = PTL_NOACK_REQ;
-                break;
-        case PTLRPC_REPLY:
-                request->rq_req_md.start = request->rq_repbuf;
-                request->rq_req_md.length = request->rq_replen;
-                request->rq_req_md.eventq = sent_pkt_eq;
-                request->rq_req_md.threshold = 1;
-                ack = PTL_NOACK_REQ;
-                break;
-        default:
-                BUG();
-        }
-        request->rq_req_md.options = PTL_MD_OP_PUT;
-        request->rq_req_md.user_ptr = request;
-
-        rc = PtlMDBind(peer->peer_ni, request->rq_req_md, &md_h);
-        if (rc != 0) {
-                BUG();
-                CERROR("PtlMDBind failed: %d\n", rc);
-                return rc;
-        }
-
-        remote_id.addr_kind = PTL_ADDR_NID;
-        remote_id.nid = peer->peer_nid;
-        remote_id.pid = 0;
-
-        CERROR("Sending %d bytes to portal %d, xid %d\n",
-               request->rq_req_md.length, portal, request->rq_xid);
-
-        rc = PtlPut(md_h, ack, remote_id, portal, 0, request->rq_xid, 0, 0);
-        if (rc != PTL_OK) {
-                BUG();
-                CERROR("PtlPut(%d, %d, %d) failed: %d\n", remote_id.nid,
-                       portal, request->rq_xid, rc);
-                /* FIXME: tear down md */
-        }
-
-        return rc;
-}
-
-int ptl_send_rpc(struct ptlrpc_request *request, struct lustre_peer *peer)
-{
-        ptl_process_id_t local_id;
-        int rc;
-        char *repbuf;
-
-        ENTRY;
-
-        if (request->rq_replen == 0) {
-                CERROR("request->rq_replen is 0!\n");
-                EXIT;
-                return -EINVAL;
-        }
-
-        /* request->rq_repbuf is set only when the reply comes in, in
-         * client_packet_callback() */
-        OBD_ALLOC(repbuf, request->rq_replen);
-        if (!repbuf) { 
-                EXIT;
-                return -ENOMEM;
-        }
-
-        local_id.addr_kind = PTL_ADDR_GID;
-        local_id.gid = PTL_ID_ANY;
-        local_id.rid = PTL_ID_ANY;
-
-        CERROR("sending req %d\n", request->rq_xid);
-        rc = PtlMEAttach(peer->peer_ni, request->rq_reply_portal, local_id,
-                         request->rq_xid, 0, PTL_UNLINK,
-                         &request->rq_reply_me_h);
-        if (rc != PTL_OK) {
-                CERROR("PtlMEAttach failed: %d\n", rc);
-                BUG();
-                EXIT;
-                goto cleanup;
-        }
-
-        request->rq_type = PTLRPC_REQUEST;
-        request->rq_reply_md.start = repbuf;
-        request->rq_reply_md.length = request->rq_replen;
-        request->rq_reply_md.threshold = 1;
-        request->rq_reply_md.options = PTL_MD_OP_PUT;
-        request->rq_reply_md.user_ptr = request;
-        request->rq_reply_md.eventq = rcvd_rep_eq;
-
-        rc = PtlMDAttach(request->rq_reply_me_h, request->rq_reply_md,
-                         PTL_UNLINK, &request->rq_reply_md_h);
-        if (rc != PTL_OK) {
-                CERROR("PtlMDAttach failed: %d\n", rc);
-                BUG();
-                EXIT;
-                goto cleanup2;
-        }
-
-        if (request->rq_bulklen != 0) {
-                rc = PtlMEAttach(peer->peer_ni, request->rq_bulk_portal,
-                                 local_id, request->rq_xid, 0, PTL_UNLINK,
-                                 &request->rq_bulk_me_h);
-                if (rc != PTL_OK) {
-                        CERROR("PtlMEAttach failed: %d\n", rc);
-                        BUG();
-                        EXIT;
-                        goto cleanup3;
-                }
-
-                request->rq_bulk_md.start = request->rq_bulkbuf;
-                request->rq_bulk_md.length = request->rq_bulklen;
-                request->rq_bulk_md.threshold = 1;
-                request->rq_bulk_md.options = PTL_MD_OP_PUT;
-                request->rq_bulk_md.user_ptr = request;
-                request->rq_bulk_md.eventq = bulk_sink_eq;
-
-                rc = PtlMDAttach(request->rq_bulk_me_h,
-                                 request->rq_bulk_md, PTL_UNLINK,
-                                 &request->rq_bulk_md_h);
-                if (rc != PTL_OK) {
-                        CERROR("PtlMDAttach failed: %d\n", rc);
-                        BUG();
-                        EXIT;
-                        goto cleanup4;
-                }
-        }
-
-        return ptl_send_buf(request, peer, request->rq_req_portal);
-
- cleanup4:
-        PtlMEUnlink(request->rq_bulk_me_h);
- cleanup3:
-        PtlMDUnlink(request->rq_reply_md_h);
- cleanup2:
-        PtlMEUnlink(request->rq_reply_me_h);
- cleanup:
-        OBD_FREE(repbuf, request->rq_replen);
-
-        return rc;
-}
-
-/* ptl_received_rpc() should be called by the sleeping process once
- * it finishes processing an event.  This ensures the ref count is
- * decremented and that the rpc ring buffer cycles properly.
- */ 
-int ptl_received_rpc(struct ptlrpc_service *service) {
-        int rc, index;
-
-        index = service->srv_md_active;
-        CDEBUG(D_INFO, "MD index=%d Ref Count=%d\n", index,
-               service->srv_ref_count[index]);
-        service->srv_ref_count[index]--;
-
-        if ((service->srv_ref_count[index] <= 0) &&
-            (service->srv_me_h[index] == 0)) {
-
-                /* Replace the unlinked ME and MD */
-                rc = PtlMEInsert(service->srv_me_h[service->srv_me_tail],
-                                 service->srv_id, 0, ~0, PTL_RETAIN,
-                                 PTL_INS_AFTER, &(service->srv_me_h[index]));
-                CDEBUG(D_INFO, "Inserting new ME and MD in ring, rc %d\n", rc);
-                service->srv_me_tail = index;
-                service->srv_ref_count[index] = 0;
-                
-                if (rc != PTL_OK) {
-                        CERROR("PtlMEInsert failed: %d\n", rc);
-                        return rc;
-                }
-
-                service->srv_md[index].start        = service->srv_buf[index];
-                service->srv_md[index].length       = service->srv_buf_size;
-                service->srv_md[index].threshold    = PTL_MD_THRESH_INF;
-                service->srv_md[index].options      = PTL_MD_OP_PUT;
-                service->srv_md[index].user_ptr     = service;
-                service->srv_md[index].eventq       = service->srv_eq_h;
-
-                rc = PtlMDAttach(service->srv_me_h[index],
-                                 service->srv_md[index],
-                                 PTL_RETAIN, &(service->srv_md_h[index]));
-
-                CDEBUG(D_INFO, "Attach MD in ring, rc %d\n", rc);
-                if (rc != PTL_OK) {
-                        /* XXX cleanup */
-                        BUG();
-                        CERROR("PtlMDAttach failed: %d\n", rc);
-                        return rc;
-                }
-
-                service->srv_md_active =
-                        NEXT_INDEX(index, service->srv_ring_length);
-        } 
-        
-        return 0;
-}
-
-int rpc_register_service(struct ptlrpc_service *service, char *uuid)
-{
-        struct lustre_peer peer;
-        int rc, i;
-
-        rc = kportal_uuid_to_peer(uuid, &peer);
-        if (rc != 0) {
-                CERROR("Invalid uuid \"%s\"\n", uuid);
-                return -EINVAL;
-        }
-
-        service->srv_ring_length = RPC_RING_LENGTH;
-        service->srv_me_active = 0;
-        service->srv_md_active = 0;
-
-        service->srv_id.addr_kind = PTL_ADDR_GID;
-        service->srv_id.gid = PTL_ID_ANY;
-        service->srv_id.rid = PTL_ID_ANY;
-
-        rc = PtlEQAlloc(peer.peer_ni, 128, server_request_callback,
-                        service, &(service->srv_eq_h));
-
-        if (rc != PTL_OK) {
-                CERROR("PtlEQAlloc failed: %d\n", rc);
-                return rc;
-        }
-
-        /* Attach the leading ME on which we build the ring */
-        rc = PtlMEAttach(peer.peer_ni, service->srv_portal,
-                         service->srv_id, 0, ~0, PTL_RETAIN,
-                         &(service->srv_me_h[0]));
-
-        if (rc != PTL_OK) {
-                CERROR("PtlMEAttach failed: %d\n", rc);
-                return rc;
-        }
-
-        for (i = 0; i < service->srv_ring_length; i++) {
-                OBD_ALLOC(service->srv_buf[i], service->srv_buf_size);
-
-                if (service->srv_buf[i] == NULL) {
-                        CERROR("no memory\n");
-                        return -ENOMEM;
-                }
-
-                /* Insert additional ME's to the ring */
-                if (i > 0) {
-                        rc = PtlMEInsert(service->srv_me_h[i-1],
-                                         service->srv_id, 0, ~0, PTL_RETAIN,
-                                         PTL_INS_AFTER,&(service->srv_me_h[i]));
-                        service->srv_me_tail = i;
-
-                        if (rc != PTL_OK) {
-                                CERROR("PtlMEInsert failed: %d\n", rc);
-                                return rc;
-                        }
-                }
-
-                service->srv_ref_count[i] = 0;
-                service->srv_md[i].start        = service->srv_buf[i];
-                service->srv_md[i].length        = service->srv_buf_size;
-                service->srv_md[i].threshold        = PTL_MD_THRESH_INF;
-                service->srv_md[i].options        = PTL_MD_OP_PUT;
-                service->srv_md[i].user_ptr        = service;
-                service->srv_md[i].eventq        = service->srv_eq_h;
-
-                rc = PtlMDAttach(service->srv_me_h[i], service->srv_md[i],
-                                 PTL_RETAIN, &(service->srv_md_h[i]));
-
-                if (rc != PTL_OK) {
-                        /* cleanup */
-                        CERROR("PtlMDAttach failed: %d\n", rc);
-                        return rc;
-                }
-        }
-
-        return 0;
-}
-
-int rpc_unregister_service(struct ptlrpc_service *service)
-{
-        int rc, i;
-
-        for (i = 0; i < service->srv_ring_length; i++) {
-                rc = PtlMDUnlink(service->srv_md_h[i]);
-                if (rc)
-                        CERROR("PtlMDUnlink failed: %d\n", rc);
-        
-                rc = PtlMEUnlink(service->srv_me_h[i]);
-                if (rc)
-                        CERROR("PtlMEUnlink failed: %d\n", rc);
-        
-                OBD_FREE(service->srv_buf[i], service->srv_buf_size);                
-        }
-
-        rc = PtlEQFree(service->srv_eq_h);
-        if (rc)
-                CERROR("PtlEQFree failed: %d\n", rc);
-
-        return 0;
-}
-
-static int req_init_portals(void)
-{
-        int rc;
-        const ptl_handle_ni_t *nip;
-        ptl_handle_ni_t ni;
-
-        nip = inter_module_get_request(LUSTRE_NAL "_ni", LUSTRE_NAL);
-        if (nip == NULL) {
-                CERROR("get_ni failed: is the NAL module loaded?\n");
-                return -EIO;
-        }
-        ni = *nip;
-
-        rc = PtlEQAlloc(ni, 128, sent_packet_callback, NULL, &sent_pkt_eq);
-        if (rc != PTL_OK)
-                CERROR("PtlEQAlloc failed: %d\n", rc);
-
-        rc = PtlEQAlloc(ni, 128, rcvd_reply_callback, NULL, &rcvd_rep_eq);
-        if (rc != PTL_OK)
-                CERROR("PtlEQAlloc failed: %d\n", rc);
-
-        rc = PtlEQAlloc(ni, 128, bulk_source_callback, NULL, &bulk_source_eq);
-        if (rc != PTL_OK)
-                CERROR("PtlEQAlloc failed: %d\n", rc);
-
-        rc = PtlEQAlloc(ni, 128, bulk_sink_callback, NULL, &bulk_sink_eq);
-        if (rc != PTL_OK)
-                CERROR("PtlEQAlloc failed: %d\n", rc);
-
-        return rc;
-}
-
-static int __init ptlrpc_init(void)
-{
-        return req_init_portals();
-}
-
-static void __exit ptlrpc_exit(void)
-{
-        PtlEQFree(sent_pkt_eq);
-        PtlEQFree(rcvd_rep_eq);
-        PtlEQFree(bulk_source_eq);
-        PtlEQFree(bulk_sink_eq);
-
-        inter_module_put(LUSTRE_NAL "_ni");
-
-        return;
-}
-
-MODULE_AUTHOR("Peter J. Braam <braam@clusterfs.com>");
-MODULE_DESCRIPTION("Lustre Request Processor v1.0");
-MODULE_LICENSE("GPL"); 
-
-module_init(ptlrpc_init);
-module_exit(ptlrpc_exit);
diff --git a/lustre/scripts/.cvsignore b/lustre/scripts/.cvsignore
deleted file mode 100644 (file)
index e530020..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-.Xrefs
-config.log
-config.status
-configure
-Makefile
-Makefile.in
-.deps
-TAGS
diff --git a/lustre/scripts/Makefile.am b/lustre/scripts/Makefile.am
deleted file mode 100644 (file)
index 31fcb8e..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-# Copyright (C) 2001  Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-
-EXTRA_DIST = license-status maketags.sh mkobddevs obd.spec obdtrace_demo.scr
diff --git a/lustre/scripts/license-status b/lustre/scripts/license-status
deleted file mode 100755 (executable)
index 5407b91..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#! /bin/sh
-# license-status - Display the status of files in the current directory
-# Copyright (C) 2001  Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-#
-# Gordon Matzigkeit <gord@fig.org>, 2001-09-27
-
-for f in `find . -type f | sort`; do
- case "$f" in
- *~ | *.orig | *.gz | */config.* | *.o | \
- */CVS/* | */.cvsignore | */.depfiles/* | \
- */COPYING | */ChangeLog)
-  continue
-  ;;
- esac
-
- if head -20 "$f" | egrep -e 'GNU' > /dev/null; then
-  echo "gpled $f"
- elif head -20 "$f" | egrep -e '\([Cc]\)' > /dev/null; then
-  echo "copyrighted $f"
- else
-  echo "bare $f"
- fi
-done | sort
diff --git a/lustre/scripts/maketags.sh b/lustre/scripts/maketags.sh
deleted file mode 100755 (executable)
index 9bd9f87..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-# Copyright (C) 2001  Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-set -vx
-rm -f TAGS ; find . -name '*.h' -or -name '*.c' | xargs etags
-rm -f ctags; find . -name '*.h' -or -name '*.c' | xargs ctags
diff --git a/lustre/scripts/mkobddevs b/lustre/scripts/mkobddevs
deleted file mode 100755 (executable)
index a35631d..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh -x
-# Copyright (C) 2001  Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-
-mknod -m 0600 /dev/obd0 c 186 0
-mknod -m 0600 /dev/obd1 c 186 1
-mknod -m 0600 /dev/obd2 c 186 2
-mknod -m 0600 /dev/obd3 c 186 3
-mknod -m 0600 /dev/obd4 c 186 4
-mknod -m 0600 /dev/obd5 c 186 5
-mknod -m 0600 /dev/obd6 c 186 6
-mknod -m 0600 /dev/obd7 c 186 7
diff --git a/lustre/scripts/obd.spec b/lustre/scripts/obd.spec
deleted file mode 100644 (file)
index af79292..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-# obd.spec
-%define version 0.007
-%define kversion 2.4.9
-%define aclevel ac10
-%define izolevel 2
-Release: 0
-%define extraversion -%{aclevel}
-%define kuname %{kversion}%{extraversion}
-%define knamever %{kversion}_%{aclevel}
-%define bdir $RPM_BUILD_DIR/obd-%{version}-%{knamever}
-
-Summary: Object-Based Disk utility programs
-Name: lustre
-Version: %{version}
-Copyright: GPL
-Group: Utilities/System
-Requires: lustre-modules, perl-Storable, perl-Term-ReadLine-Gnu
-BuildRoot: /var/tmp/obd-%{version}-root
-Source: ftp://ftp.lustre.com/pub/lustre/obd-%{version}.tar.gz
-
-%description
-Object-Based Disk utilities and demonstration scripts.
-
-%package -n lustre-modules
-Summary: Object-Based Disk storage drivers for Linux %{kuname}
-Group: Development/Kernel
-#Requires: kernel-intermezzo = %{knamever}_%{izolevel}
-
-%description -n lustre-modules
-Object-Based Disk storage drivers for Linux %{kuname}.
-
-%package -n lustre-source
-Summary: Object-Based Disk storage driver source
-Group: Development/Kernel
-
-%description -n lustre-source
-Object-Based Disk storage driver source.
-
-%prep
-%setup -n obd-%{version}
-
-%build
-rm -rf $RPM_BUILD_ROOT
-
-# Create the pristine source directory.
-mkdir -p $RPM_BUILD_ROOT/usr/src/obd-%{version}
-tar -cf - . | (cd $RPM_BUILD_ROOT/usr/src/obd-%{version} && tar -xvBpf -)
-
-# Set an explicit path to our Linux tree, if we can.
-enable=
-linuxdir=/usr/src/linux-%{kuname}
-test -d $linuxdir && enable=--enable-linuxdir=$linuxdir
-./configure $enable
-make
-
-%install
-make install prefix=$RPM_BUILD_ROOT
-
-%files
-%attr(-, root, root) %doc COPYING FDL
-%attr(-, root, root) %doc doc/API.txt doc/OBD-HOWTO.sgml doc/obdspec.sgml
-%attr(-, root, root) %doc doc/OLVM.txt doc/figs doc/notes.txt
-%attr(-, root, root) %doc doc/obdtrace_demo.txt
-%attr(-, root, root) /usr/bin/obdcontrol
-
-%files -n lustre-modules
-%attr(-, root, root) %doc COPYING
-%attr(-, root, root) /lib/modules/%{kuname}/fs/obd*.o
-
-%files -n lustre-source
-%attr(-, root, root) /usr/src/obd-%{version}
-
-%post
-depmod -ae || exit 0
-
-%postun
-depmod -ae || exit 0
-
-%clean
-#rm -rf $RPM_BUILD_ROOT
-
-# end of file
diff --git a/lustre/scripts/obdtrace_demo.scr b/lustre/scripts/obdtrace_demo.scr
deleted file mode 100644 (file)
index 0601235..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-# Copyright (C) 2001  Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-# Print OS version
-shell uname -r
-# Insert Lustre kernel modules
-insmod class/obdclass.o
-procsys trace 0
-procsys debug 0
-insmod ext2obd/obdext2.o
-insmod obdtrace/obdtrace.o
-insmod obdfs/obdfs.o
-# Configure direct driver on /dev/obd0
-device /dev/obd0
-attach obdext2
-setup /dev/sda2
-# Configure obdtrace on /dev/obd1
-device /dev/obd1
-attach obdtrace
-setup /dev/obd0
-# What's the obd status
-status
-shell cat /proc/lustre/obd/1/stats
-# mount obd file system
-shell mkdir -p /mnt/obd
-shell mount -t obdfs -odevice=/dev/obd1 none /mnt/obd
-shell mount
-# Prepare a data set (tar file of current directory)
-shell rm -f /tmp/obdtrace_test.tar
-shell tar cf /tmp/obdtrace_test.tar .
-# make a directory on obd device
-shell mkdir -p /mnt/obd/obdtrace_test_dir
-# Unpack tarfile to obd device 
-shell tar -C /mnt/obd/obdtrace_test_dir -xf /tmp/obdtrace_test.tar
-shell rm -rf /mnt/obd/obdtrace_test_dir
-# Check obdtrace performance stats
-status
-shell cat /proc/lustre/obd/1/stats
-shell echo 0 >  /proc/lustre/obd/1/stats
-shell cat /proc/lustre/obd/1/stats
-# Umount file system
-shell umount /mnt/obd
-# Cleanup /tmp
-shell rm -f /tmp/obdtrace_test.tar
-# Dismantle /dev/obd1
-device /dev/obd1
-cleanup
-detach
-close
-# Dismantle /dev/obd0
-device /dev/obd0
-cleanup
-detach
-close
-# Remove all loaded kernel modules
-rmmod obdfs
-rmmod obdtrace
-rmmod obdext2
-rmmod obdclass
diff --git a/lustre/tests/.cvsignore b/lustre/tests/.cvsignore
deleted file mode 100644 (file)
index e530020..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-.Xrefs
-config.log
-config.status
-configure
-Makefile
-Makefile.in
-.deps
-TAGS
diff --git a/lustre/tests/Makefile.am b/lustre/tests/Makefile.am
deleted file mode 100644 (file)
index fb9f04f..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-CFLAGS:=-g -I. -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I../include -Wall
-KFLAGS:=
-CPPFLAGS :=
-# LDADD := -lreadline -ltermcap # -lefence
-bin_PROGRAMS = testreq truncate
-
-testreq_SOURCES = testreq.c
-truncate_SOURCES = truncate.c
-
diff --git a/lustre/tests/common.sh b/lustre/tests/common.sh
deleted file mode 100644 (file)
index ba676ad..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-if [ -d /r ]; then
-  R=/r
-fi
-
-if [ -b /dev/loop0 ]; then
-  LOOP=/dev/loop
-else
-  if [ -b /dev/loop/0 ]; then
-    LOOP=/dev/loop/
-  else
-    echo "Cannot find /dev/loop0 or /dev/loop/0";
-    exit -1
-  fi
-fi
diff --git a/lustre/tests/fs.sh b/lustre/tests/fs.sh
deleted file mode 100644 (file)
index 1db9a94..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#! /bin/bash
-# Copyright (C) 2001  Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-#!/bin/sh
-
-R=/r
-
-insmod /lib/modules/2.4.17/kernel/drivers/block/loop.o
-dd if=/dev/zero of=/tmp/fs bs=1024 count=10000
-mke2fs -b 4096 -F /tmp/fs
-losetup /dev/loop/0 /tmp/fs
-
-insmod $R/usr/src/obd/class/obdclass.o 
-insmod $R/usr/src/obd/ext2obd/obdext2.o
-mknod /dev/obd c 10 241
-
-$R/usr/src/obd/utils/obdctl <<EOF
-device 0
-attach obdext2
-setup /dev/loop/0
-quit
-EOF
-
-insmod $R/usr/src/obd/obdfs/obdfs.o
-mount -t obdfs -o device=0 none /mnt
diff --git a/lustre/tests/lllocalmount.sh b/lustre/tests/lllocalmount.sh
deleted file mode 100755 (executable)
index 35066cf..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/bin/sh
-
-SRCDIR="`dirname $0`"
-. $SRCDIR/common.sh
-
-mknod /dev/portals c 10 240
-
-insmod $R/usr/src/portals/linux/oslib/portals.o
-insmod $R/usr/src/portals/linux/socknal/ksocknal.o
-
-$R/usr/src/portals/linux/utils/acceptor 1234 &
-
-insmod $R/usr/src/obd/rpc/ptlrpc.o
-insmod $R/usr/src/obd/class/obdclass.o 
-insmod $R/usr/src/obd/ext2obd/obdext2.o
-insmod $R/usr/src/obd/ost/ost.o
-insmod $R/usr/src/obd/osc/osc.o
-insmod $R/usr/src/obd/mds/mds.o
-insmod $R/usr/src/obd/mdc/mdc.o
-insmod $R/usr/src/obd/llight/llight.o
-
-dd if=/dev/zero of=/tmp/ost bs=1024 count=10000
-mke2fs -b 4096 -F /tmp/ost
-losetup ${LOOP}0 /tmp/ost
-
-dd if=/dev/zero of=/tmp/mds bs=1024 count=10000
-mke2fs -b 4096 -F /tmp/mds
-losetup ${LOOP}1 /tmp/mds
-
-mknod /dev/obd c 10 241
-echo 8291 > /proc/sys/obd/debug
-echo 8291 > /proc/sys/obd/trace
-
-$R/usr/src/obd/utils/obdctl <<EOF
-device 0
-attach mds
-setup ${LOOP}1 ext2
-device 1
-attach obdext2
-setup ${LOOP}0
-device 2
-attach ost
-setup 1
-device 3
-attach osc
-setup 2
-quit
-EOF
-
-mkdir /mnt/obd
-# mount -t lustre_light -o device=3 none /mnt/obd
diff --git a/lustre/tests/llmount-client.sh b/lustre/tests/llmount-client.sh
deleted file mode 100644 (file)
index 6fa09c5..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/bin/sh
-export PATH=/sbin:/usr/sbin:$PATH
-
-SRCDIR="`dirname $0`"
-. $SRCDIR/common.sh
-
-SERVER=compila
-
-mknod /dev/portals c 10 240
-
-insmod $R/usr/src/portals/linux/oslib/portals.o
-# insmod $R/usr/src/portals/linux/socknal/ksocknal.o
-insmod $R/usr/src/portals/linux/qswnal/kqswnal.o
-
-$R/usr/src/portals/linux/utils/ptlctl <<EOF
-mynid
-setup elan 
-connect 5
-add_uuid self
-add_uuid mds
-EOF
-
-insmod $R/usr/src/obd/rpc/ptlrpc.o
-insmod $R/usr/src/obd/class/obdclass.o 
-insmod $R/usr/src/obd/ext2obd/obdext2.o
-insmod $R/usr/src/obd/ost/ost.o
-insmod $R/usr/src/obd/osc/osc.o
-insmod $R/usr/src/obd/mds/mds.o
-insmod $R/usr/src/obd/mdc/mdc.o
-insmod $R/usr/src/obd/llight/llight.o
-
-dd if=/dev/zero of=/tmp/ost bs=1024 count=10000
-mke2fs -b 4096 -F /tmp/ost
-losetup ${LOOP}0 /tmp/ost
-
-mknod /dev/obd c 10 241
-
-$R/usr/src/obd/utils/obdctl <<EOF
-device 1
-attach obdext2
-setup ${LOOP}0
-device 2
-attach ost
-setup 1
-device 3
-attach osc
-setup 2
-quit
-EOF
-
-mkdir /mnt/obd
-# mount -t lustre_light -o device=3 none /mnt/obd
diff --git a/lustre/tests/llmount-server.sh b/lustre/tests/llmount-server.sh
deleted file mode 100644 (file)
index 909611d..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/bin/sh
-
-export PATH=/sbin:/usr/sbin:$PATH
-
-SRCDIR="`dirname $0`"
-. $SRCDIR/common.sh
-
-mknod /dev/portals c 10 240
-
-insmod $R/usr/src/portals/linux/oslib/portals.o
-# insmod $R/usr/src/portals/linux/socknal/ksocknal.o
-insmod $R/usr/src/portals/linux/qswnal/kqswnal.o
-
-# $R/usr/src/portals/linux/utils/acceptor 1234 &
-
-$R/usr/src/portals/linux/utils/ptlctl <<EOF
-mynid
-setup elan
-connect 5
-add_uuid self
-EOF
-
-insmod $R/usr/src/obd/rpc/ptlrpc.o
-insmod $R/usr/src/obd/class/obdclass.o 
-insmod $R/usr/src/obd/ext2obd/obdext2.o
-insmod $R/usr/src/obd/ost/ost.o
-insmod $R/usr/src/obd/mds/mds.o
-
-dd if=/dev/zero of=/tmp/ost bs=1024 count=10000
-mke2fs -b 4096 -F /tmp/ost
-losetup ${LOOP}0 /tmp/ost
-
-dd if=/dev/zero of=/tmp/mds bs=1024 count=10000
-mke2fs -b 4096 -F /tmp/mds
-losetup ${LOOP}1 /tmp/mds
-
-mknod /dev/obd c 10 241
-
-$R/usr/src/obd/utils/obdctl <<EOF
-device 0
-attach mds
-setup ${LOOP}1 ext2
-device 1
-attach obdext2
-setup ${LOOP}0
-device 2
-attach ost
-setup 1
-quit
-EOF
diff --git a/lustre/tests/llmount.sh b/lustre/tests/llmount.sh
deleted file mode 100755 (executable)
index bc888bb..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/bin/sh
-
-SRCDIR="`dirname $0`"
-. $SRCDIR/common.sh
-
-mknod /dev/portals c 10 240
-
-insmod $R/usr/src/portals/linux/oslib/portals.o || exit -1
-insmod $R/usr/src/portals/linux/socknal/ksocknal.o || exit -1
-
-$R/usr/src/portals/linux/utils/acceptor 1234 &
-
-insmod $R/usr/src/obd/class/obdclass.o || exit -1
-insmod $R/usr/src/obd/rpc/ptlrpc.o || exit -1
-insmod $R/usr/src/obd/ext2obd/obdext2.o || exit -1
-insmod $R/usr/src/obd/ost/ost.o || exit -1
-insmod $R/usr/src/obd/osc/osc.o || exit -1
-insmod $R/usr/src/obd/mds/mds.o || exit -1
-insmod $R/usr/src/obd/mdc/mdc.o || exit -1
-insmod $R/usr/src/obd/llight/llight.o || exit -1
-
-$R/usr/src/obd/utils/obdctl modules > $R/tmp/ogdb
-echo "The GDB module script is in /tmp/ogdb.  Press enter to continue"
-read
-
-$R/usr/src/portals/linux/utils/ptlctl <<EOF
-mynid localhost
-setup tcp
-connect localhost 1234
-add_uuid self
-add_uuid mds
-add_uuid ost
-quit
-EOF
-
-dd if=/dev/zero of=/tmp/ost bs=1024 count=10000
-mke2fs -b 4096 -F /tmp/ost
-losetup ${LOOP}0 /tmp/ost || exit -1
-
-dd if=/dev/zero of=/tmp/mds bs=1024 count=10000
-mke2fs -b 4096 -F /tmp/mds
-losetup ${LOOP}1 /tmp/mds || exit -1
-
-mknod /dev/obd c 10 241
-echo 8291 > /proc/sys/obd/debug
-echo 8291 > /proc/sys/obd/trace
-
-$R/usr/src/obd/utils/obdctl <<EOF
-device 0
-attach mds
-setup ${LOOP}1 ext2
-device 1
-attach obdext2
-setup ${LOOP}0
-device 2
-attach ost
-setup 1
-device 3
-attach osc
-setup
-quit
-EOF
-
-mkdir /mnt/obd
-mount -t lustre_light -o device=3 none /mnt/obd
diff --git a/lustre/tests/llmountcleanup.sh b/lustre/tests/llmountcleanup.sh
deleted file mode 100755 (executable)
index 548098b..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/sh
-
-SRCDIR="`dirname $0`"
-. $SRCDIR/common.sh
-
-umount /mnt/obd
-
-rmmod llight
-rmmod mdc
-
-$R/usr/src/obd/utils/obdctl <<EOF
-device 3
-cleanup
-detach
-device 2
-cleanup
-detach
-device 1
-cleanup
-detach
-device 0
-cleanup
-detach
-quit
-EOF
-
-rmmod mds
-rmmod osc
-rmmod ost
-rmmod obdext2
-rmmod ptlrpc
-rmmod obdclass
-
-$R/usr/src/portals/linux/utils/ptlctl <<EOF
-setup tcp
-disconnect localhost
-del_uuid self
-del_uuid mds
-del_uuid ost
-quit
-EOF
-
-rmmod ksocknal
-killall acceptor
-rmmod portals
-
-losetup -d ${LOOP}0
-losetup -d ${LOOP}1
\ No newline at end of file
diff --git a/lustre/tests/mdcreq.sh b/lustre/tests/mdcreq.sh
deleted file mode 100644 (file)
index 47f2902..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/bin/sh
-
-SRCDIR="`dirname $0`"
-. $SRCDIR/common.sh
-
-mknod /dev/portals c 10 240
-
-insmod $R/usr/src/portals/linux/oslib/portals.o
-insmod $R/usr/src/portals/linux/socknal/ksocknal.o
-
-$R/usr/src/portals/linux/utils/acceptor 1234 &
-
-$R/usr/src/portals/linux/utils/ptlctl <<EOF
-mynid
-setup tcp
-connect localhost 1234
-add_uuid self
-add_uuid mds
-EOF
-
-insmod $R/usr/src/obd/rpc/ptlrpc.o
-insmod $R/usr/src/obd/class/obdclass.o 
-insmod $R/usr/src/obd/ext2obd/obdext2.o
-insmod $R/usr/src/obd/ost/ost.o
-insmod $R/usr/src/obd/osc/osc.o
-insmod $R/usr/src/obd/mds/mds.o
-insmod $R/usr/src/obd/mdc/mdc.o
-insmod $R/usr/src/obd/llight/llight.o
-
-dd if=/dev/zero of=/tmp/fs bs=1024 count=10000
-mke2fs -b 4096 -F /tmp/fs
-losetup ${LOOP}0 /tmp/fs
-
-mknod /dev/obd c 10 241
-
-$R/usr/src/obd/utils/obdctl <<EOF
-device 0
-attach mds
-setup ${LOOP}0 ext2
-quit
-EOF
-
-mknod /dev/request c 10 244
-# $R/usr/src/obd/tests/testreq
\ No newline at end of file
diff --git a/lustre/tests/mdcreqcleanup.sh b/lustre/tests/mdcreqcleanup.sh
deleted file mode 100755 (executable)
index 5fbc70a..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/sh
-
-SRCDIR="`dirname $0`"
-. $SRCDIR/common.sh
-
-rmmod llight
-rmmod mdc
-
-$R/usr/src/obd/utils/obdctl <<EOF
-device 0
-cleanup
-detach
-quit
-EOF
-
-rmmod mds
-rmmod osc
-rmmod ost
-rmmod obdext2
-rmmod obdclass
-rmmod ptlrpc
-
-$R/usr/src/portals/linux/utils/ptlctl <<EOF
-setup tcp
-disconnect localhost
-del_uuid self
-del_uuid mds
-EOF
-
-losetup -d ${LOOP}0
-
-killall acceptor
-rmmod ksocknal
-rmmod portals
diff --git a/lustre/tests/ostreq.sh b/lustre/tests/ostreq.sh
deleted file mode 100644 (file)
index 685488f..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/bin/sh
-
-SRCDIR="`dirname $0`"
-. $SRCDIR/common.sh
-
-SERVER=localhost
-
-mknod /dev/portals c 10 240
-
-insmod $R/usr/src/portals/linux/oslib/portals.o || exit -1
-insmod $R/usr/src/portals/linux/socknal/ksocknal.o || exit -1
-
-$R/usr/src/portals/linux/utils/acceptor 1234 &
-
-$R/usr/src/portals/linux/utils/ptlctl <<EOF
-mynid
-setup tcp
-connect $SERVER 1234
-add_uuid ost
-add_uuid self
-quit
-EOF
-
-insmod $R/usr/src/obd/rpc/ptlrpc.o || exit -1
-insmod $R/usr/src/obd/class/obdclass.o || exit -1
-insmod $R/usr/src/obd/ext2obd/obdext2.o || exit -1
-insmod $R/usr/src/obd/ost/ost.o || exit -1
-insmod $R/usr/src/obd/osc/osc.o || exit -1
-
-dd if=/dev/zero of=/tmp/fs bs=1024 count=10000
-mke2fs -F /tmp/fs
-losetup ${LOOP}0 /tmp/fs || exit -1
-
-echo 4095 > /proc/sys/obd/debug
-echo 4095 > /proc/sys/obd/trace
-
-mknod /dev/obd c 10 241
-
-$R/usr/src/obd/utils/obdctl <<EOF
-device 0
-attach obdext2
-setup ${LOOP}0
-device 1
-attach ost
-setup 0
-device 2
-attach osc
-setup
-quit
-EOF
diff --git a/lustre/tests/rundbench b/lustre/tests/rundbench
deleted file mode 100755 (executable)
index 25ae732..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-echo 0 > /proc/sys/obd/trace 
-echo 0 > /proc/sys/obd/debug 
-cd /mnt/obd
-cp /usr/src/obd/demos/dbench/client.txt .
-/usr/src/obd/demos/dbench/dbench $1
diff --git a/lustre/tests/snaprun.sh b/lustre/tests/snaprun.sh
deleted file mode 100755 (executable)
index ea77cfb..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/sh
-# Utility script to test several features of a snapshot filesystem
-# Assumes that snapshot has already been configured
-#
-# Copyright (C) 2001  Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-
-OBDDIR="`dirname $0`/.."
-. $OBDDIR/demos/config.sh
-
-qrun ls $MNTOBD
-qrun chown bin.bin $MNTOBD
-qrun ls -ld $MNTOBD
-qrun ls -ld $MNTSNAP
-qrun cp /etc/hosts $MNTOBD
-qrun ls $MNTOBD
-qrun ls $MNTSNAP
-
-# More complicated because we can't pass ">>" as an argument easily
-echo -n "Run 'echo today >> $MNTOBD/hello' [Y/n]" ; read JUNK
-case $JUNK in
-    n*|N*) echo "not run" ;;
-    *) plog log "echo today >> $MNTOBD/hello"
-       echo "today" >> $MNTOBD/hello ;;
-esac
-
-qrun cat $MNTOBD/hello
-qrun cat $MNTSNAP/hello
-qrun cat $MNTOBD/link
-qrun cat $MNTSNAP/link
-qrun rm $MNTOBD/goodbye
-qrun ls $MNTOBD
-qrun ls $MNTSNAP
-qrun cat $MNTSNAP/goodbye
diff --git a/lustre/tests/test.c b/lustre/tests/test.c
deleted file mode 100755 (executable)
index b941d78..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (C) 2001  Cluster File Systems, Inc.
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-#include <asm/statfs.h>
-#include <unistd.h>
-
-#define OBD_IOC_CREATE                 _IOR('f', 3, long)
-#define OBD_IOC_SETUP                  _IOW('f', 4, long)
-#define OBD_IOC_SYNC                   _IOR('f', 16, long)
-#define OBD_IOC_DESTROY                _IOW('f', 6, long)
-#define OBD_IOC_STATFS                _IORW('f', 15, long)
-
-#define LOOP_DEVICE "/dev/loop0"
-#define OBD_DEVICE "/dev/obd"
-
-int main (int argc, char * argv[])
-{
-       int fd, rc, err = -1;
-       struct stat stat_buf;
-       struct statfs stfs;
-
-
-       if (argc < 2) {
-               printf("syntax: %s command [argument]\n", argv[0]);
-               printf("Where command is one of \"setup\", \"create\", \"destroy\", or \"sync\".\n");
-               exit(1);
-       }
-       if (stat(LOOP_DEVICE, &stat_buf)) {
-               printf("Couldn't stat(" LOOP_DEVICE ").\n");
-               exit(1);
-       }
-       printf("Device: %u\n", (unsigned int) stat_buf.st_rdev);
-
-       fd = open (OBD_DEVICE, O_RDONLY);
-       if (fd == -1) {
-               printf("Couldn't open " OBD_DEVICE ".\n");
-               exit(1);
-       }
-
-       if (!strcmp(argv[1], "setup")) {
-               rc = ioctl(fd, OBD_IOC_SETUP, &stat_buf.st_rdev);
-               fprintf(stderr, "rc = %d, errno = %d\n", rc, errno);
-       } else if (!strcmp(argv[1], "create")) {
-               int iter, i;
-
-               if (argc < 3) {
-                       printf("create requires a nonzero argument.\n");
-                       exit(1);
-               }
-
-               iter = atoi(argv[2]);
-               if (iter < 1) {
-                       printf("create requires a nonzero argument.\n");
-                       exit(1);
-               }
-               printf("creating %d objects...\n", iter);
-
-               for (i = 0; i < iter; i++) {
-                       if ((rc = ioctl(fd, OBD_IOC_CREATE, &err))) {
-                               fprintf(stderr, "Error; aborting.\n");
-                               break;
-                       }
-                       if ((rc = ioctl(fd, OBD_IOC_DESTROY, &err))) {
-                               fprintf(stderr, "Error; aborting.\n");
-                               break;
-                       }
-               }
-               fprintf(stderr, "rc = %d, errno = %d, err = %d\n",
-                       rc, errno, err);
-       } else if (!strcmp(argv[1], "sync")) {
-               rc = ioctl(fd, OBD_IOC_SYNC, &err);
-               fprintf(stderr, "rc = %d, errno = %d, err = %d\n",
-                       rc, errno, err);
-       } else if (!strcmp(argv[1], "destroy")) {
-               int ino;
-
-               if (argc < 3) {
-                       printf("destroy requires a nonzero inode number.\n");
-                       exit(1);
-               }
-
-               ino = atoi(argv[2]);
-               if (ino < 1) {
-                       printf("destroy requires a nonzero inode number.\n");
-                       exit(1);
-               }
-
-               rc = ioctl(fd, OBD_IOC_DESTROY, &ino);
-               fprintf(stderr, "rc = %d, errno = %d\n", rc, errno);
-       } else {
-               printf("Invalid command, run with no arguments for help.\n");
-       }
-       close(fd);
-
-       return 0;
-}
diff --git a/lustre/tests/test2.c b/lustre/tests/test2.c
deleted file mode 100755 (executable)
index fbbe6bb..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2001  Cluster File Systems, Inc.
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <sys/types.h>
-
-/* Beware when setting FSROOT that I've not made any attempts to avoid buffer
- * overruns below--this is a test program, it's a static buffer. */
-#define FSROOT "/mnt"
-#define OBD_ITERATIONS 10000
-
-int main (int argc, char * argv[])
-{
-       int fd, rc, err = -1;
-       struct stat stat_buf;
-
-       if (argc < 2) {
-               printf("syntax: %s command\n", argv[0]);
-               printf("Where command is one of \"setup\" or \"create\".\n");
-               exit(1);
-       }
-
-       if (!strcmp(argv[1], "setup")) {
-               printf("This is silly.\n");
-       } else if (!strcmp(argv[1], "create")) {
-               int i, iter;
-
-               if (argc < 3) {
-                       printf("create requires a nonzero argument.\n");
-                       exit(1);
-               }
-
-               iter = atoi(argv[2]);
-
-               if (iter < 1) {
-                       printf("create requires a nonzero argument.\n");
-                       exit(1);
-               }
-               printf("creating %d files...\n", iter);
-
-               for (i = 0; i < iter; i++) {
-                       fd = creat(FSROOT "/foo123", S_IRWXU);
-                       close(fd);
-                       unlink(FSROOT "/foo123");
-               }
-       } else {
-               printf("Invalid command, run with no arguments for help.\n");
-       }
-
-       return 0;
-}
diff --git a/lustre/tests/testreq.c b/lustre/tests/testreq.c
deleted file mode 100644 (file)
index aeacddf..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#include <stdio.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-
-#define IOC_REQUEST_GETATTR            _IOWR('f', 30, long)
-#define IOC_REQUEST_READPAGE           _IOWR('f', 31, long)
-#define IOC_REQUEST_SETATTR            _IOWR('f', 32, long)
-#define IOC_REQUEST_CREATE             _IOWR('f', 33, long)
-
-int main(int argc, char **argv)
-{
-       int fd, rc; 
-       int cmd = IOC_REQUEST_GETATTR;
-
-       printf("ioctl type %d, nr %d size %d\n", 
-              _IOC_TYPE(cmd), _IOC_NR(cmd), _IOC_SIZE(cmd));
-
-       fd = open("/dev/request", O_RDONLY);
-       if (fd == -1) { 
-               printf("error opening /dev/request: %s\n", strerror(errno));
-               return 1;
-       }
-
-       printf("getattr test... ");
-       rc = ioctl(fd, IOC_REQUEST_GETATTR, NULL); 
-       printf("result: %d\n", rc); 
-
-       printf("readpage test... ");
-       rc = ioctl(fd, IOC_REQUEST_READPAGE, NULL); 
-       printf("result: %d\n", rc); 
-
-       printf("setattr test... ");
-       rc = ioctl(fd, IOC_REQUEST_SETATTR, NULL); 
-       printf("result: %d\n", rc); 
-
-       printf("create test... ");
-       rc = ioctl(fd, IOC_REQUEST_CREATE, NULL); 
-       printf("result: %d\n", rc); 
-       return 0;
-}
diff --git a/lustre/tests/truncate.c b/lustre/tests/truncate.c
deleted file mode 100644 (file)
index 66634dd..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <unistd.h>
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-
-int main(int argc, char **argv)
-{
-       unsigned long off;
-       int err;
-
-       if (argc != 3) { 
-               printf("usage %s file offset\n", argv[0]); 
-               return 1;
-       }
-
-       off = strtoul(argv[2], NULL, 0);
-       err = truncate(argv[1], off); 
-       if ( err ) { 
-               printf("Error truncating %s: %s\n", argv[1], strerror(errno));
-       }
-       return err;
-}
diff --git a/lustre/utils/.cvsignore b/lustre/utils/.cvsignore
deleted file mode 100644 (file)
index e530020..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-.Xrefs
-config.log
-config.status
-configure
-Makefile
-Makefile.in
-.deps
-TAGS
diff --git a/lustre/utils/Makefile.am b/lustre/utils/Makefile.am
deleted file mode 100644 (file)
index d632f12..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-DEFS:=
-
-bin_SCRIPTS = obdcontrol
-EXTRA_DIST = $(bin_SCRIPTS)
-
-CFLAGS:=-g -I. -I/usr/include/glib-1.2 -I$(PORTALS)/include -I/usr/lib/glib/include -I../include -Wall
-KFLAGS:=
-CPPFLAGS :=
-LDADD := -lreadline -ltermcap # -lefence
-bin_PROGRAMS = obdctl
-obdctl_SOURCES = parser.c obdctl.c
diff --git a/lustre/utils/Pack.pm b/lustre/utils/Pack.pm
deleted file mode 100644 (file)
index ad9f688..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-package Pack;
-use Carp;
-use Exporter;
-@EXPORT = qw(LOGL, UNLOGL, LOGU32, UNLOGU32, LLOGU32, LUNLOGU32, LOGU64, UNLOGU64, LLOGU64, LUNLOGU64);
-
-sub round_len {
-    return ($_[0] + 3) & ~0x3;
-}
-
-sub roundq_len {
-    return ($_[0] + 3) & ~0x7;
-}
-
-# pack a string $_[2]
-#  at $offset ($_[1]) 
-#  in $buf ($_[0]) 
-#  padd to 32bit alignment move $_[1] forward
-
-sub LOGL{
-    my $len = length($_[2]);
-    my $rlen = round_len($len);
-    my $padd = $rlen + $off - length($_[0]);
-
-    if ($padd > 0) {
-        $_[0] .= pack "x$padd";
-    }
-    substr $_[0], $_[1], $len, $_[2];
-    $_[1] += $rlen;
-}
-
-# pack $_[2], a u32, into $_[0] at offset $_[1]
-sub LOGU32 {
-    if ($_[1] != round_len($_[1])) {
-        confess "packing I on non-word boundary";
-    } 
-    my $padd = 4 + $off - length($_[0]);
-
-    if ($padd > 0) {
-        $_[0] .= pack "L", $_[2];
-    } else {
-        substr $_[0], $_[1], $len, pack "L", $_[2];
-    }
-    $_[1] += 4;
-}
-
-# pack $_[2], a u32, into $_[0] at offset $_[1]
-# use little endian
-sub LLOGU32 {
-    if ($_[1] != round_len($_[1])) {
-        confess "packing V on non-word boundary";
-    } 
-    my $padd = 4 + $off - length($_[0]);
-
-    if ($padd > 0) {
-        $_[0] .= pack "V", $_[2];
-    } else {
-        substr $_[0], $_[1], $len, pack "V", $_[2];
-    }
-    $_[1] += 4;
-}
-
-sub LLOGU64 {
-    if ($_[1] != roundq_len($_[1])) {
-        confess "packing Q on non-word boundary";
-    } 
-    my $padd = 8 + $off - length($_[0]);
-
-    if ($padd > 0) {
-        $_[0] .= pack "VV", $_[3], $_[2];
-    } else {
-        substr $_[0], $_[1], $len, pack "VV", $_[3], $_[2];
-    }
-    $_[1] += 8;
-}
-
-sub LLOGU64 {
-    if ($_[1] != roundq_len($_[1])) {
-        confess "packing Q on non-word boundary";
-    } 
-    my $padd = 8 + $off - length($_[0]);
-
-    if ($padd > 0) {
-        $_[0] .= pack "LL", $_[3], $_[2];
-    } else {
-        substr $_[0], $_[1], $len, pack "LL", $_[3], $_[2];
-    }
-    $_[1] += 8;
-}
-
-sub UNLOGL { 
-    if (length($_[0]) < $_[1] + round_len($_[2]) ) {
-        confess "unpacking buf beyond string length";
-    }
-    
-    $_[3] = unpack "x$_[1]a$_[2]", $_[0];
-    $_[1] += round_len($_[2]);
-    return $_[3];
-}
-
-sub UNLOGU32 { 
-    if (length($_[0]) < $_[1] + 4) {
-        confess "unpacking u32 beyond string length";
-    }
-    
-    $_[2] = unpack "x$_[1]L", $_[0];
-    $_[1] += 4;
-    return $_[2];
-}
-
-sub LUNLOGU32 { 
-    if (length($_[0]) < $_[1] + 4) {
-        confess "lunpacking u32 beyond string length";
-    }
-    $_[2] = unpack "x$_[1]V", $_[0];
-    $_[1] += 4;
-    return $_[2];
-}
-
-sub UNLOGU64 {
-    if (length($_[0]) < $_[1] + 8) {
-        confess "unpacking u64 beyond string length";
-    }
-    
-    ($_[3], $_[2]) = unpack "x$_[1]LL", $_[0];
-    $_[1] += 8;
-    return ($_[2], $_[3]);
-}
-
-sub LUNLOGU64 {
-    if (length($_[0]) < $_[1] + 8) {
-        confess "lunpacking u64 beyond string length";
-    }
-    
-    ($_[3], $_[2]) = unpack "x$_[1]VV", $_[0];
-    $_[1] += 8;
-    return ($_[2], $_[3]);
-}
-
-sub test {
-    $buf = "";
-    $off = 0;
-    
-    LOGL($buf, $off, "moose");
-    print "off $off\n";
-    printf "len %d\n", length($buf);
-    LLOGU64($buf, $off, 0x01020304, 0x05060708);
-    print "off $off\n";
-    printf "len %d\n", length($buf);
-    LLOGU32($buf, $off, 0x01020304);
-    print "off $off\n";
-    printf "len %d\n", length($buf);
-    $off = 0;
-    UNLOGL($buf, $off, length("moose"), $str);
-    print "off $off $str\n";
-    LUNLOGU64($buf, $off, $high, $low);
-    printf "off $off high %x low %x\n", $high, $low;
-    LUNLOGU32($buf, $off, $low);
-    printf "off $off long %x\n", $low;
-    
-    $off = 0;
-    $str = UNLOGL($buf, $off, length("moose"));
-    print "assigned off $off $str\n";
-    ($high, $low) = LUNLOGU64($buf, $off);
-    printf "assigned off $off high %x low %x\n", $high, $low;
-    $low = LUNLOGU32($buf, $off, $low);
-    printf "assigned off $off long %x\n", $low;
-    
-    sysopen F, "/tmp/out", 2;
-    syswrite F, $buf, length($buf);
-}
-
-# test();
diff --git a/lustre/utils/obdcontrol b/lustre/utils/obdcontrol
deleted file mode 100755 (executable)
index 7a0d108..0000000
+++ /dev/null
@@ -1,1798 +0,0 @@
-#!/usr/bin/perl
-
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-#
-# Copyright (C) 1998, Stelias Computing
-# 
-# Modified for InterMezzo from Gordian's HSM bcache device/jcm module
-# Copyright (C) 1999, Carnegie Mellon University
-#
-# Derived from InterMezzo's incontrol, modified for OBD's
-# Copyright (C) 1999, Stelias Computing
-#
-#
-
-#use strict;
-BEGIN { require "asm/errno.ph" };
-BEGIN { require "asm/ioctl.ph" };
-
-# p2ph generated invalid macros for ioctl stuff, so I override some of it here
-eval 'sub OBD_IOC_CREATE () { &_IOC(2, ord(\'f\'), 3, 4);}' unless
-  defined(&OBD_IOC_CREATE);
-eval 'sub OBD_IOC_SETUP () { &_IOC(1, ord(\'f\'), 4, 4);}' unless
-  defined(&OBD_IOC_SETUP);
-eval 'sub OBD_IOC_CLEANUP () { &_IOC(0, ord(\'f\'), 5, 0);}' unless
-  defined(&OBD_IOC_CLEANUP);
-eval 'sub OBD_IOC_DESTROY () { &_IOC(1, ord(\'f\'), 6, 4);}' unless
-  defined(&OBD_IOC_DESTROY);
-eval 'sub OBD_IOC_PREALLOCATE () { &_IOC(3, ord(\'f\'), 7, 4);}' unless
-  defined(&OBD_IOC_PREALLOCATE);
-# FIXME: obsolete?
-eval 'sub OBD_IOC_DEC_USE_COUNT () { &_IOC(0, ord(\'f\'), 8, 0);}' unless
-  defined(&OBD_IOC_DEC_USE_COUNT);
-eval 'sub OBD_IOC_SETATTR () { &_IOC(1, ord(\'f\'), 9, 4);}' unless
-  defined(&OBD_IOC_SETATTR);
-eval 'sub OBD_IOC_GETATTR () { &_IOC(2, ord(\'f\'), 10, 4);}' unless
-  defined(&OBD_IOC_GETATTR);
-eval 'sub OBD_IOC_READ () { &_IOC(3, ord(\'f\'), 11, 4);}' unless
-  defined(&OBD_IOC_READ);
-eval 'sub OBD_IOC_WRITE () { &_IOC(3, ord(\'f\'), 12, 4);}' unless
-  defined(&OBD_IOC_WRITE);
-eval 'sub OBD_IOC_CONNECT () { &_IOC(2, ord(\'f\'), 13, 4);}' unless
-  defined(&OBD_IOC_CONNECT);
-eval 'sub OBD_IOC_DISCONNECT () { &_IOC(1, ord(\'f\'), 14, 4);}' unless
-  defined(&OBD_IOC_DISCONNECT);
-eval 'sub OBD_IOC_STATFS () { &_IOC(3, ord(\'f\'), 15, 4);}' unless
-  defined(&OBD_IOC_STATFS);
-eval 'sub OBD_IOC_SYNC () { &_IOC(2, ord(\'f\'), 16, 4);}' unless
-  defined(&OBD_IOC_SYNC);
-# FIXME: obsolete?
-eval 'sub OBD_IOC_READ2 () { &_IOC(3, ord(\'f\'), 17, 4);}' unless
-  defined(&OBD_IOC_READ2);
-# FIXME: obsolete?
-eval 'sub OBD_IOC_FORMATOBD () { &_IOC(3, ord(\'f\'), 18, 4);}' unless
-  defined(&OBD_IOC_FORMATOBD);
-# FIXME: obsolete?
-eval 'sub OBD_IOC_PARTITION () { &_IOC(3, ord(\'f\'), 19, 4);}' unless
-  defined(&OBD_IOC_PARTITION);
-eval 'sub OBD_IOC_ATTACH () { &_IOC(3, ord(\'f\'), 20, 4);}' unless
-  defined(&OBD_IOC_ATTACH);
-eval 'sub OBD_IOC_DETACH () { &_IOC(3, ord(\'f\'), 21, 4);}' unless
-  defined(&OBD_IOC_DETACH);
-eval 'sub OBD_IOC_COPY () { &_IOC(3, ord(\'f\'), 22, 4);}' unless
-  defined(&OBD_IOC_COPY);
-eval 'sub OBD_IOC_MIGR () { &_IOC(3, ord(\'f\'), 23, 4);}' unless
-  defined(&OBD_IOC_MIGR);
-eval 'sub OBD_IOC_PUNCH () { &_IOC(3, ord(\'f\'), 24, 4);}' unless
-  defined(&OBD_IOC_PUNCH);
-eval 'sub OBD_SNAP_SETTABLE () { &_IOC(3, ord(\'f\'), 40, 4);}' unless
-  defined(&OBD_SNAP_SETTABLE);
-eval 'sub OBD_SNAP_PRINTTABLE () { &_IOC(3, ord(\'f\'), 41, 4);}' unless
-  defined(&OBD_SNAP_PRINTTABLE);
-eval 'sub OBD_SNAP_DELETE() { &_IOC(3, ord(\'f\'), 42, 4);}' unless
-  defined(&OBD_SNAP_DELETE);
-eval 'sub OBD_SNAP_RESTORE() { &_IOC(3, ord(\'f\'), 43, 4);}' unless
-  defined(&OBD_SNAP_RESTORE);
-
-eval 'sub OBD_EXT2_RUNIT () { &_IOC(3, ord(\'f\'), 61, 4);}' unless
-  defined(&OBD_EXT2_RUNIT);
-
-eval 'sub OBD_MD_FLALL   () {~0;}'   unless defined(&OBD_MD_FLALL);
-eval 'sub OBD_MD_FLATIME () {1<<1;}' unless defined(&OBD_MD_FLATIME);
-eval 'sub OBD_MD_FLMTIME () {1<<2;}' unless defined(&OBD_MD_FLMTIME);
-eval 'sub OBD_MD_FLCTIME () {1<<3;}' unless defined(&OBD_MD_FLCTIME);
-eval 'sub OBD_MD_FLSIZE  () {1<<4;}' unless defined(&OBD_MD_FLSIZE);
-eval 'sub OBD_MD_FLMODE  () {1<<7;}' unless defined(&OBD_MD_FLMODE);
-eval 'sub OBD_MD_FLUID   () {1<<8;}' unless defined(&OBD_MD_FLUID);
-eval 'sub OBD_MD_FLGID   () {1<<9;}' unless defined(&OBD_MD_FLGID);
-
-use Getopt::Long;
-use File::stat;
-use Storable;
-use Carp;
-use Term::ReadLine;
-use IO::Handle;
-use Pack;
-
-
-# NOTE long long are layed out in ia32 memory as follows:
-# u = 0xaaaabbbbccccdddd has ccccdddd at &u and aaaabbbb 4 bytes on
-# this may be different on other architectures
-
-# we use 32-bit integers for all 64-bit quantities in this program
-# #define OBD_INLINESZ  60
-# #define OBD_OBDMDSZ   60
-# /* Note: 64-bit types are 64-bit aligned in structure */
-# struct obdo {
-#       obd_id                  o_id;
-#       obd_gr                  o_gr;
-#       obd_time                o_atime;
-#       obd_time                o_mtime;
-#       obd_time                o_ctime;
-#       obd_size                o_size;
-#       obd_blocks              o_blocks;
-#       obd_blksize             o_blksize;
-#       obd_mode                o_mode;
-#       obd_uid                 o_uid;
-#       obd_gid                 o_gid;
-#       obd_flag                o_flags;
-#       obd_flag                o_obdflags;
-#       obd_count               o_nlink;
-#       obd_count               o_generation;
-#       obd_flag                o_valid;        /* hot fields in this obdo */
-#       char                    o_inline[60];
-#       char                    o_obdmd[60];
-#       struct list_head        o_list;
-#       struct obd_ops          *o_op;
-# };
-
-sub obdo_pack {
-    my $obdo = shift;
-    pack "LL LL LL LL LL LL LL L L L L L L L L L a60 a60 L L L", 
-    $obdo->{id}, 0, 
-    $obdo->{gr}, 0, 
-    $obdo->{atime}, 0, 
-    $obdo->{mtime}, 0 ,
-    $obdo->{ctime}, 0, 
-    $obdo->{size}, 0, 
-    $obdo->{blocks}, 0, 
-    $obdo->{blksize},
-    $obdo->{mode},
-    $obdo->{uid},
-    $obdo->{gid},
-    $obdo->{flags},
-    $obdo->{obdflags},
-    $obdo->{nlink},     
-    $obdo->{generation},        
-    $obdo->{valid},     
-    $obdo->{inline},
-    $obdo->{obdmd},
-    0, 0, # struct list_head 
-    0;  #  struct obd_ops 
-}
-
-sub obdo_unpack {
-    my $buf = shift;
-    my $offset = shift;
-    my $obdo;
-    ($obdo->{id},
-    $obdo->{gr},
-    $obdo->{atime},
-    $obdo->{mtime},
-    $obdo->{ctime},
-    $obdo->{size},
-    $obdo->{blocks},
-    $obdo->{blksize},
-    $obdo->{mode},
-    $obdo->{uid},
-    $obdo->{gid},
-    $obdo->{flags},
-    $obdo->{obdflags},
-    $obdo->{nlink},
-    $obdo->{generation},
-    $obdo->{valid},
-    $obdo->{inline},
-    $obdo->{obdmd}) = unpack "x${offset}Lx4 Lx4 Lx4 Lx4 Lx4 Lx4 Lx4 L L L L L L L L L a60 a60", $buf;
-    $obdo;
-}
-
-sub obdo_print {
-
-    my $obdo = shift;
-
-    printf "id: %d\ngrp: %d\natime: %s\nmtime: %s\nctime: %s\nsize: %d\nblocks: %d\nblksize: %d\nmode: %o\nuid: %d\ngid: %d\nflags: %x\nobdflags: %x\nnlink: %d\nvalid: %x\ninline: %s\nobdmd: %s\n",
-    $obdo->{id},
-    $obdo->{gr},
-    $obdo->{atime},
-    $obdo->{mtime},
-    $obdo->{ctime},
-    $obdo->{size},
-    $obdo->{blocks},
-    $obdo->{blksize},
-    $obdo->{mode},
-    $obdo->{uid},
-    $obdo->{gid},
-    $obdo->{flags},
-    $obdo->{obdflags},
-    $obdo->{nlink},
-    $obdo->{valid},
-    $obdo->{inline},
-    $obdo->{obdmd};
-}
-
-
-my ($file);
-
-GetOptions("f!" => \$file, "device=s" => \$::device, ) || die "Getoptions";
-
-
-# get a console for the app
-
-my $line;
-my $command;
-my $arg;
-
-my @procsysobd_objects = ('debug', 'index', 'reset', 'trace', 'vars');
-
-my %commands =
-    ('status' => {func => "Status", doc => "status: show obd device status"},
-     'procsys' => {func => "Procsys", doc => "procsys <file> <value> (set /proc/sys/obd configuration)"},
-     'shell' => {func => "Shell", doc => "shell <shell-command>: execute shell-commands"},
-     'script' => {func => "Script", doc => "script <filename>: read and execute commands from a file"},
-     'insmod' => {func => "Insmod", doc => "insmod <module>: insert kernel module"},
-     'rmmod' => {func => "Rmmod", doc => "rmmod <module>: insert kernel module"},
-     'lsmod' => {func => "Lsmod", doc => "lsmod <module>: list kernel modules"},
-     'device' => {func => "Device", doc => "device <dev>: open another OBD device"},
-     'close' => {func => "Close", doc => "close <dev>: close OBD device"},
-     'create' => {func => "Create", doc => "create [<num> [<mode> [quiet]]]: create new object(s) (files, unless mode is given)"},
-     'attach' => {func => "Attach", doc => "attach { obdext2 | obdsnap snapdev snapidx tableno | obdscsi adapter bus tid lun }: attach this minor device to the specified driver" },
-     'detach' => {func => "Detach", doc => "detach this minor device"},
-     'testext2iterator' => {func => "TestExt2Iterator", doc => "test ext2 iterator function"},
-     'snapset' => {func => "SnapSetTable", doc => "snapset <tableno> <file>: set the table (created with snaptable) as table #tableno" },
-     'snapprint' => {func => "SnapPrint", doc => "snapprint <tableno>: output the contents of table #tableno to the syslog"},
-     'snapdelete' => {func => "SnapDelete", doc => "snapdelete: delete connected snap obd objects from disk"},
-     'snaprestore' => {func => "SnapRestore", doc => "snaprestore : restore connected old snap objects to be current"},
-     'snaptable' => {func => "SnapShotTable", doc => "snaptable: build a snapshot table (interactive)"},
-     'copy' => {func => "Copy", doc => "copy <srcid> <tgtid>: copy objects"},
-     'migrate' => {func => "Migrate", doc => "migrate <srcid> <tgtid>: migrate data from one object to another"},
-# FIXME: obsolete?
-     'partition' => {func => "Partition", doc => "partition <type> <adapter> <bus> <tid> <lun> <partition> <size>: create a partition"},
-# FIXME: obsolete?
-     'format' => {func => "Format", doc => "format <type> <adapter> <bus> <tid> <lun> <size>: format a partition"},
-     'setup' => {func => "Setup", doc => "setup [type]: link this OBD device to the underlying device (default type obdext2)"},
-     'connect' => {func => "Connect", doc => "connect: allocates client ID for this session"},
-     'disconnect' => {func => "Disconnect", doc => "disconnect [id]: frees client resources"},
-     'sync' => {func => "Sync", doc => "sync: flushes buffers to disk"},
-     'destroy' => {func => "Destroy", doc => "destroy <id>: destroys an object"},
-     'cleanup' => {func => "Cleanup", doc => "cleanup the minor obd device"},
-# FIXME: obsolete?
-     'dec_use_count' => {func => "Decusecount", doc => "decreases the module use count so that the module can be removed following an oops"},
-     'read' => {func => "Read", doc => "read <id> <count> [offset]: read data from object"},
-# FIXME: obsolete?
-     'fsread' => {func => "Read2", doc => "read <id> <count> [offset]: read data from object"},
-     'write' => {func => "Write", doc => "write <id> <offset> <text>: write data to object"},
-     'punch' => {func => "Punch", doc => "punch <id> <start> <count>: punch a hole in object"},
-     'setattr' => {func => "Setattr", doc => "setattr <id> [mode [uid [gid [size [atime [mtime [ctime]]]]]]]: sets object attributes"},
-     'getattr' => {func => "Getattr", doc => "getattr <id>: displays object attributes"},
-     'preallocate' => {func => "Preallocate", doc => "preallocate [num]: requests preallocation of num objects."},
-     'statfs' => {func => "Statfs", doc => "statfs: filesystem status information"},
-     'help' => {func => \&Help,  doc => "help: this message"},
-     'quit' => {func => \&Quit,  doc => "see \"exit\""},
-     'exit' => {func => \&Quit,  doc => "see \"quit\""}
-    );
-
-#
-#       setup completion function
-#
-my @jcm_cmd_list = keys %commands;
-
-my $term, $attribs;
-
-
-# Get going....
-
-Device($::device);
-
-sub readl {
-    if ( $file ) {
-        my $str = <STDIN>;
-        chop($str);
-        return $str;
-    } else {
-        return $term->readline(@_);
-    }
-}
-
-
-
-if ( $file ) {
-    while ( <STDIN> ) {
-        print $_;
-        my $rc = execute_line($_);
-        if ($rc != 0) { last; }
-    }
-    exit 0;
-} else {
-    $term = new Term::ReadLine 'obdcontrol ';
-    $attribs = $term->Attribs;
-    $attribs->{attempted_completion_function} = \&completeme;
-    $term->ornaments('md,me,,');        # bold face prompt
-    
-    # make sure stdout is not buffered
-    STDOUT->autoflush(1);
-
-
-    # Get on with the show
-    process_line();
-}
-
-#------------------------------------------------------------------------------
-sub completeme {
-    my ($text, $line, $start, $end) = @_;
-    if (substr($line, 0, $start) =~ /^\s*$/) {
-        if ($] < 5.6) { # PErl version is less than 5.6.0
-            return (exists $commands{$text}) ? $text : 0;
-#Above line doesn't perform command completion, but
-#perl5.005 Term-ReadLine lacks support for completion matching
-#and perl5.6.0 requires glibc2.2.2 that won't run under Redhat6.2......sigh.
-        }
-        else {
-            $attribs->{completion_word} = \@jcm_cmd_list;
-            return $term->completion_matches($text,
-                       $attribs->{'list_completion_function'});
-        }
-    }
-}
-
-sub find_command {
-    my $given = shift;
-    my $name;
-    my @completions = completeme($given, $given, 0, length($given));
-    if ($#completions == 0) {
-        $name = shift @completions;
-    }
-
-    return $name;
-}
-
-# start making requests
-sub process_line {
-  foo:
-    $line = $term->readline("obdcontrol > ");
-    execute_line($line);
-    goto foo;
-}
-
-sub execute_line {
-    my $line = shift;
-
-    my @cmdline = split(' ', $line);
-    my $word = shift @cmdline;
-
-    return 0 unless ($word);
-
-    my $cmd;
-    if ( $file ) {
-        $cmd = $word;
-    } else {
-        $cmd = find_command($word);
-    }
-    unless ($cmd) {
-        printf STDERR "$word: No such command, or not unique.\n";
-        return (-1);
-    }
-
-    # Call the function.
-    return (&{$commands{$cmd}->{func}}(@cmdline));
-}
-
-my %opendevfds = ();
-
-# select the OBD device we talk to
-sub Device {
-    my $device = shift;
-
-    if ( ! $device && ! $::device ) { # first time ever
-        $device = '/dev/obd0';
-    }
-
-    if (($device) && ($::device ne $device)) {
-        local *NEW_OBD;
-        my $newfd;
-
-        if ($::client_id) {
-            print "Disconnecting active session ($::client_id)...";
-            Disconnect($::client_id);
-        }
-
-        if ($opendevfds{$device}) {
-            $::dev_obd = $opendevfds{$device};
-        }
-        else {
-            # Open the device, as we need an FD for the ioctl
-            if (!sysopen(NEW_OBD, $device, 0)) {
-                print "Cannot open $device. Did you insert the obdclass module ?\n";
-                return -1;
-            }
-            print "Opened device $device\n";
-            $opendevfds{$device} = *NEW_OBD;
-            $::dev_obd = *NEW_OBD;
-        }
-        $::device = $device;    
-    }
-    print "Current device is $::device\n";
-    return 0;
-}
-
-sub Close {
-    my $device = shift;
-    my $fd2close;
-
-    if ( ! $device && ! $::device ) { # first time ever
-        print "Nothing to close\n";
-        return -1;
-    }
-
-    if ( ! $device ) {
-        $device = $::device;
-    }
-
-    if ($::device eq $device) {
-        if ($::client_id) {
-            print "Disconnecting active session ($::client_id)...";
-            Disconnect($::client_id);
-        }
-    }
-
-    $fd2close = $opendevfds{$device};
-    if ($fd2close) { # XXXX something wrong in this if statement
-        close ($fd2close);
-        $opendevfds{$device} = undef;
-        print "Closed device $device\n";
-    }
-    else {
-        print "Device $device was not open\n";
-        return -1;
-    }
-    
-    if ($::device eq $device) {
-        $::dev_obd = undef;
-        $::device = undef;
-    }
-    print "No current device. You just closed the current device ($device).\n";
-    return 0; 
-}   
-sub Script {
-    my $cmdfilename = shift;
-    my $rc = 0;
-    if ( ! $cmdfilename )  {
-        print "please specify a command file name\n";
-        return -1;
-    }
-    if (! open(CMDF, $cmdfilename)) {
-        print "Cannot open $cmdfilename: $!\n";
-        return -1;
-    }
-    while (<CMDF>) {
-        if (/^#/) {
-            next;
-        }
-        print "execute> $_";
-        $rc = execute_line($_);
-        if ($rc != 0) {
-            print "Something went wrong .......command exit status: $rc\n";
-            last;
-        }
-    }
-    close(CMDF);
-    return $rc;
-}
-
-sub Shell {
-    my $user_shell=$ENV{'SHELL'};
-    print "% $user_shell -c '@_'\n";
-    if ( ! @_ ) {
-        print "please specify a shell command\n";
-        return;
-    }
-    system("$user_shell -c '@_'");
-    return ($? >> 8);
-}
-  
-sub Status {
-    my $oldfh = select(STDOUT);
-    $| = 1;
-
-    system('cat /proc/lustre/obd/*/status');
-    my $rc = ($? >> 8);
-
-    select($oldfh);
-    $| = 0;
-
-    return $rc;
-}
-
-sub Procsys {
-    my $set_sysobd = shift;
-    my $value = shift;
-
-    foreach $i (0 .. $#procsysobd_objects) {
-        my $sysobd = $procsysobd_objects[$i];
-
-        if (defined $set_sysobd) {
-            if ($sysobd ne $set_sysobd) { next; }
-
-            if (defined $value) { # set this one
-                system("echo \"$value\" > /proc/sys/obd/$sysobd");
-            }
-            system("echo \"/proc/sys/obd/$sysobd:\"; cat /proc/sys/obd/$sysobd");
-            last;
-        }
-        else {
-            system("echo \"/proc/sys/obd/$sysobd:\"; cat /proc/sys/obd/$sysobd");
-        }
-    }
-    return ($? >> 8);
-}
-
-sub Insmod {
-    my $module = shift;
-    system("insmod $module");
-    return ($? >> 8);
-}
-
-sub Rmmod {
-    my $module = shift;
-    system("rmmod $module");
-    return ($? >> 8);
-}
-
-sub Lsmod {
-    my $module = shift;
-    system("lsmod $module");
-    return ($? >> 8);
-}
-
-sub Attach {
-    my $err = 0;
-    my $type = shift;
-    my $data;
-    my $datalen = 0;
-
-    if ( ! $type ) {
-        print "error: missing type\n";
-usage:
-        print "usage: attach {obdext2 | obdsnap | obdscsi | obdtrace }\n";
-        return -1;
-    }
-
-    if ($type eq "obdscsi" ) {
-        my $adapter = shift;
-        my $bus = shift;
-        my $tid = shift;
-        my $lun = shift;
-
-        $data = pack("iiii", $adapter, $bus, $tid, $lun);
-        $datalen = 4 * 4;
-    } elsif ($type eq "obdsnap" ) {
-        my $snapdev = shift;
-        my $snapidx = shift;
-        my $tableno = shift;
-
-        $data = pack("iii", $snapdev, $snapidx, $tableno);
-        $datalen = 3 * 4;
-    } elsif ($type eq "obdext2") {
-        $data = pack("i", 4711);   # bogus data
-        $datalen = 4;
-    } elsif ($type eq "obdtrace") {
-        $data = pack("i", 4711);   # bogus data
-        $datalen = 4;
-    } else {
-        print "error: unknown attach type $type\n";
-        goto usage;
-    }
-
-    my $len = length($type);
-    my $cl = length($data);
-
-    print "type $type (len $len), datalen $datalen ($cl)\n";
-    my $packed = pack("Lipip", $::client_id, length($type), $type, $datalen, $data);
-
-    if (! defined $::dev_obd) {
-        print "No current device.\n";
-        return -1;
-    }
-    my $rc = ioctl($::dev_obd, &OBD_IOC_ATTACH, $packed);
-
-    if (!defined $rc) {
-        print STDERR "ioctl failed: $!\n";
-        return -1;
-    } elsif ($rc eq "0 but true") {
-        print "Finished (success)\n";
-        return 0;
-    } else {
-        print "ioctl returned error code $rc.\n";
-        return -1;
-    }
-}
-
-
-sub Detach {
-    my $err = 0;
-    my $data = "";
-
-    if (! defined $::dev_obd) {
-        print "No current device.\n";
-        return -1;
-    }
-
-    my $rc = ioctl($::dev_obd, &OBD_IOC_DETACH, $data);
-
-    if (!defined $rc) {
-        print STDERR "ioctl failed: $!\n";
-        return -1;
-    } elsif ($rc eq "0 but true") {
-        print "Finished (success)\n";
-        return 0;
-    } else {
-        print "ioctl returned error code $rc.\n";
-        return -1;
-    }
-}
-
-
-sub TestExt2Iterator { 
-    if (!defined($::client_id)) {
-        print "You must first ``connect''.\n";
-        return;
-    }
-
-    my $err = 0;
-    my $type = "obdext2";
-    $data = pack("i", 4711); # bogus data
-    $datalen = 4;
-
-    my $len = length($type);
-    my $cl = length($data);
-    print "type $type (len $len), datalen $datalen ($cl)\n";
-    my $packed = pack("Lipip", $::client_id, length($type), $type, $datalen, $data);
-    if (! defined $::dev_obd) {
-        print "No current device.\n";
-        return -1;
-    }
-
-    my $rc = ioctl($::dev_obd, &OBD_EXT2_RUNIT, $packed);
-
-    if (!defined $rc) {
-        print STDERR "ioctl failed: $!\n";
-        return -1;
-    } elsif ($rc eq "0 but true") {
-        print "Finished (success)\n";
-        return 0;
-    } else {
-        print "ioctl returned error code $rc.\n";
-        return -1;
-    }
-}
-
-
-sub SnapDelete { 
-    if (!defined($::client_id)) {
-        print "You must first ``connect''.\n";
-        return -1;
-    }
-
-    my $err = 0;
-    my $type = "obdsnap";
-    $data = pack("i", 4711); # bogus data
-    $datalen = 4;
-
-    my $len = length($type);
-    my $cl = length($data);
-    print "type $type (len $len), datalen $datalen ($cl)\n";
-    my $packed = pack("Lipip", $::client_id, length($type), $type, $datalen, $data);
-
-    # XXX We need to fix this up so that after the objects in this snapshot
-    #     are deleted, the snapshot itself is also removed from the table.
-
-    if (! defined $::dev_obd) {
-        print "No current device.\n";
-        return -1;
-    }
-
-    my $rc = ioctl($::dev_obd, &OBD_SNAP_DELETE, $packed);
-
-    if (!defined $rc) {
-        print STDERR "ioctl failed: $!\n";
-        return -1;
-    } elsif ($rc eq "0 but true") {
-        print "Finished (success)\n";
-        return 0;
-    } else {
-        print "ioctl returned error code $rc.\n";
-        return -1;
-    }
-}
-
-
-#      this routine does the whole job
-sub SnapRestore { 
-    my $restoreto = shift;
-    my $snaptable = shift;
-    my $tableno = shift;
-    my $restoretime;
-
-    # don't do anything until connected
-    if (!defined($::client_id)) {
-        print "You must first ``connect''.\n";
-        return -1;
-    }
-
-    if ( ! $snaptable || ! defined $restoreto ) {
-        print "Usage: snaprestore \"restore to slot\" \"snaptable\" \"tableno\"\n";
-        return -1;
-    }
-
-    if ( ! -f $snaptable ) {
-        print "Table $snaptable doesn't exist\n";
-        return -1;
-    }
-   
-    my $table = ReadSnapShotTable($snaptable);
-    $restoretime = FindSnapInTable($table, $restoreto);
-    if ( ! defined $table->{0} || ! defined $restoretime ) {
-        PrintSnapShotTable($table);
-        print "No current or $restoreto slot in this table\n";
-        return -1;
-    }
-
-    my $currentindex = $table->{0};
-    if (  $table->{$restoretime} == $currentindex ) {
-        print "You should not restore to the current snapshot\n";
-        return -1;
-    }
-    
-    # swap the entries for 0 and $restoreto
-    my $tmp = $table->{$restoretime};
-    $table->{$restoretime} = $table->{0};
-    $table->{0} = $tmp;
-    # PrintSnapShotTable($table);
-
-    # write it back
-    WriteSnapShotTable($snaptable, $table);
-
-    # set it in the kernel
-    SnapSetTable($tableno, $snaptable);
-
-    # ready for the ioctl
-    my $err = 0;
-    my $type = "obdsnap";
-    $data = pack("i", $currentindex); # slot of previous current snapshot 
-    $datalen = 4;
-
-    my $len = length($type);
-    my $cl = length($data);
-    my $packed = pack("Lipip", $::client_id, length($type), $type, $datalen, $data);
-    if (! defined $::dev_obd) {
-        print "No current device.\n";
-        return -1;
-    }
-
-    my $rc = ioctl($::dev_obd, &OBD_SNAP_RESTORE, $packed);
-
-    if (!defined $rc) {
-        print STDERR "ioctl failed: $!\n";
-        return -1;
-    } elsif ($rc eq "0 but true") {
-        print "Snaprestore finished (success)\n";
-        delete $table->{$restoretime} if defined $restoretime;
-        # write it back
-        WriteSnapShotTable($snaptable, $table);
-        
-        # set it in the kernel
-        SnapSetTable($tableno, $snaptable);
-        # PrintSnapShotTable($table);
-        return 0;
-    } else {
-        print "ioctl returned error code $rc.\n";
-        return -1;
-    }
-}
-
-sub FindSnapInTable { 
-    my $table = shift;
-    my $snapno =shift;
-
-    foreach my $restoretime ( keys %{$table} ) {
-        if ( $table->{$restoretime} == $snapno) { 
-            print "Found key $restoretime for snapno $snapno\n";
-            return $restoretime;
-        }
-    }
-    undef;
-}
-            
-
-sub SnapPrint { 
-    my $err = 0;
-    my $type = "obdsnap";
-    my $snaptableno = shift;
-
-    $data = pack("i", $snaptableno);
-    $datalen = 4;
-
-    my $len = length($type);
-    my $cl = length($data);
-    print "type $type (len $len), datalen $datalen ($cl)\n";
-    my $packed = pack("Lipip", $::client_id, length($type), $type, $datalen, $data);
-    if (! defined $::dev_obd) {
-        print "No current device.\n";
-        return -1;
-    }
-
-    my $rc = ioctl($::dev_obd, &OBD_SNAP_PRINTTABLE, $packed);
-
-    if (!defined $rc) {
-        print STDERR "ioctl failed: $!\n";
-        return -1;
-    } elsif ($rc eq "0 but true") {
-        print "Finished (success)\n";
-        return 0;
-    } else {
-        print "ioctl returned error code $rc.\n";
-        return -1;
-    }
-}
-
-sub SnapSetTable {
-    my $err = 0;
-    my $type = "obdsnap";
-    my $snaptableno = shift;
-    my $file = shift;
-    my $snapcount;
-    my $table = {};
-    my $data;
-    my $datalen = 0;
-
-    if ( ! -f $file ) {
-        print "No such file $file\n";
-        return -1;
-    }
-
-    $table = ReadSnapShotTable($file);
-
-    $snapcount = keys %{$table};
-    print "Snapcount $snapcount\n";
-
-    if ( ! defined $table->{0} ) {
-        print "No current snapshot in table! First make one\n";
-        return -1;
-    }
-    $data = pack("ii", $snaptableno, $snapcount);
-    $datalen = 2 * 4;
-    foreach my $time (sort keys %{$table}) {
-        # XXX we should change to pack LL instead of I for times
-        $data .= pack("Ii", $time, $table->{$time});
-        $datalen += 8;
-    }
-
-    my $len = length($type);
-    my $cl = length($data);
-    print "type $type (len $len), datalen $datalen ($cl)\n";
-    my $packed = pack("Lipip", $::client_id, length($type), $type, $datalen, $data);
-    if (! defined $::dev_obd) {
-        print "No current device.\n";
-        return -1;
-    }
-
-    my $rc = ioctl($::dev_obd, &OBD_SNAP_SETTABLE, $packed);
-
-    if (!defined $rc) {
-        print STDERR "ioctl failed: $!\n";
-        return -1;
-    } elsif ($rc eq "0 but true") {
-        print "Finished (success)\n";
-        return 0;
-    } else {
-        print "ioctl returned error code $rc.\n";
-        return -1;
-    }
-}
-
-
-sub SnapShotTable  {
-
-    my $file = &readl("enter file name: ");
-    if ( ! -f $file ) {
-        `touch $file`;
-    }
-    my $table = ReadSnapShotTable($file);
-  
-  again:
-    PrintSnapShotTable($table);
-    my $action = &readl("Add, Delete or Quit [adq]: ");
-    goto done if ($action  =~ "^q.*" );
-    goto add if ($action =~ "^a.*");
-    goto del  if ($action =~ "^d.*");
-    goto again;
-
-  add:
-    my $idx = &readl("enter index where you want this snapshot: ");
-    my $time = &readl("enter time or 'now' or 'current': ");
-    my $oldtime = SnapFindTimeFromIdx($idx, $table);
-    if (defined $oldtime) {
-        print "This already exists, first clean up\n";
-        goto again;
-    }
-
-    if ( $time  eq 'now' ) {
-        $time = time;
-    } elsif ( $time eq 'current' ) { 
-        $time = 0;
-    }
-    $table->{$time} = $idx;
-    goto again;
-
-  del:
-    $didx = &readl("Enter index to delete: ");
-    my $deltime = SnapFindTimeFromIdx($didx, $table);
-    delete $table->{$deltime} if defined $deltime;
-    goto again;
-
-  done:
-    my $ok = &readl("OK with new table? [Yn]: ");
-    unless ( $ok eq "n" )  {
-        WriteSnapShotTable($file, $table);
-    }
-    return 0;
-}
-
-sub SnapFindTimeFromIdx {
-    my $idx = shift;
-    my $table = shift;
-
-    foreach my $time ( keys %{$table} ) {
-        if ( $table->{$time} == $idx ) {
-            return $time;
-        }
-    }
-    undef;
-}
-
-sub PrintSnapShotTable {
-    my $table = shift;
-    my $time;
-    
-    foreach  $time ( sort keys %{$table} ) {
-        my $stime = localtime($time);
-        if ( ! $time ) { 
-            $stime = "current";
-        }
-        printf "Time: %s -- Index %d\n", $stime, $table->{$time};
-    }
-}
-
-sub ReadSnapShotTable {
-
-    my $file = shift;
-    my $table = {};
-
-    open FH, "<$file";
-    while ( <FH> ) {
-        my ($time, $index) = split ;
-        $table->{$time} = $index;
-    }
-    close FH;
-
-    PrintSnapShotTable($table);
-
-    return $table;
-}
-
-sub WriteSnapShotTable {
-    my $file = shift;
-    my $table = shift;
-
-    open FH, ">$file";
-    foreach my $time ( sort keys %{$table}  ) {
-        print FH "$time $table->{$time}\n";
-    }
-    close FH;
-}
-
-sub Copy {
-    my $err = 0;
-    my $src_obdo;
-    my $dst_obdo;
-
-    # Note: _copy IOCTL takes parameters as dst, src.
-    #       Copy function takes parameters as src, dst.
-    $src_obdo->{id} = shift;
-    $dst_obdo->{id} = shift;
-    $src_obdo->{valid} = &OBD_MD_FLALL;
-
-    # XXX need to fix copy so we can have 2 client IDs here
-    my $packed = pack("L", $::client_id) . obdo_pack($dst_obdo) . pack("L", $::client_id) . obdo_pack($src_obdo);
-    if (! defined $::dev_obd) {
-        print "No current device.\n";
-        return -1;
-    }
-
-    my $rc = ioctl($::dev_obd, &OBD_IOC_COPY, $packed);
-
-    if (!defined $rc) {
-        print STDERR "ioctl failed: $!\n";
-        return -1;
-    } elsif ($rc eq "0 but true") {
-        print "Finished (success)\n";
-        return 0;
-    } else {
-        print "ioctl returned error code $rc.\n";
-        return -1;
-    }
-}
-
-sub Migrate {
-    my $err = 0;
-
-    # Note: _migr IOCTL takes parameters as dst, src.
-    #       Migrate function takes parameters as src, dst.
-    $src_obdo->{id} = shift;
-    $dst_obdo->{id} = shift;
-    $src_obdo->{valid} = &OBD_MD_FLALL;
-
-    # We pack a dummy connection ID here
-    my $packed = pack("L", $::client_id) . obdo_pack($dst_obdo) . pack("L", $::client_id) . obdo_pack($src_obdo);
-    if (! defined $::dev_obd) {
-        print "No current device.\n";
-        return -1;
-    }
-
-    my $rc = ioctl($::dev_obd, &OBD_IOC_MIGR, $packed);
-
-    if (!defined $rc) {
-        print STDERR "ioctl failed: $!\n";
-        return -1;
-    } elsif ($rc eq "0 but true") {
-        print "Finished (success)\n";
-        return 0;
-    } else {
-        print "ioctl returned error code $rc.\n";
-        return -1;
-    }
-}
-
-
-sub Format {
-    my $err = 0;
-    my $size = shift;
-    my $data = pack("i", $size);
-    my $datalen = 4;
-
-    my $packed = pack("ip", $datalen, $data);
-    if (! defined $::dev_obd) {
-        print "No current device.\n";
-        return -1;
-    }
-    my $rc = ioctl($::dev_obd, &OBD_IOC_FORMATOBD, $packed);
-
-    if (!defined $rc) {
-        print STDERR "ioctl failed: $!\n";
-        return -1;
-    } elsif ($rc eq "0 but true") {
-        print "Finished (success)\n";
-        return 0;
-    } else {
-        print "ioctl returned error code $rc.\n";
-        return -1;
-    }
-}
-
-sub Partition {
-    my $err = 0;
-    my $partno = shift;
-    my $size = shift;
-    my $data = pack("ii", $partno, $size);
-    my $datalen = 2 * 4;
-
-    my $packed = pack("ip", $datalen, $data);
-    if (! defined $::dev_obd) {
-        print "No current device.\n";
-        return -1;
-    }
-    my $rc = ioctl($::dev_obd, &OBD_IOC_PARTITION, $packed);
-
-    if (!defined $rc) {
-        print STDERR "ioctl failed: $!\n";
-        return -1;
-    } elsif ($rc eq "0 but true") {
-        print "Finished (success)\n";
-        return 0;
-    } else {
-        print "ioctl returned error code $rc.\n";
-        return -1;
-    }
-}
-
-sub Setup {
-    my $err = 0;
-    my $arg = shift;
-    my $data;
-    my $datalen = 0;
-
-    # XXX we need a getinfo ioctl to validate parameters 
-    # by type here
-
-    if ($arg && !defined($::st = stat($arg))) {
-            print "$arg is not a valid device\n";
-            return -1;
-    }
-
-    printf "setting up %s, device %x\n", $arg, $::st->rdev();
-    if ( $arg ) {
-        $data = $arg;
-        $datalen = length($arg)+1; # need null character also
-    }
-
-    my $packed = pack("iip", $datalen, $::st->rdev(), $data);
-    if (! defined $::dev_obd) {
-        print "No current device.\n";
-        return -1;
-    }
-    my $rc = ioctl($::dev_obd, &OBD_IOC_SETUP, $packed);
-
-    if (!defined $rc) {
-        print STDERR "ioctl failed: $!\n";
-        return -1;
-    } elsif ($rc eq "0 but true") {
-        print "Finished (success)\n";
-        return 0;
-    } else {
-        print "ioctl returned error code $rc.\n";
-        return -1;
-    }
-}
-
-sub Cleanup {
-    my $err = "0";
-    if (! defined $::dev_obd) {
-        print "No current device.\n";
-        return -1;
-    }
-    my $rc = ioctl($::dev_obd, &OBD_IOC_CLEANUP, $err);
-
-    if (!defined $rc) {
-        print STDERR "ioctl failed: $!\n";
-        return -1;
-    } elsif ($rc eq "0 but true") {
-        print "Finished (success)\n";
-        $::client_id = 0;
-        return 0;
-    } else {
-        print "ioctl returned error code $rc.\n";
-        return -1;
-    }
-}
-
-
-sub Connect {
-    my $rc;
-
-    my $packed = "";
-    if (! defined $::dev_obd) {
-        print "No current device.\n";
-        return -1;
-    }
-    $rc = ioctl($::dev_obd, &OBD_IOC_CONNECT, $packed);
-    $id = unpack("I", $packed);
-
-    if (!defined $rc) {
-        print STDERR "ioctl failed: $!\n";
-        return -1;
-    } elsif ($rc eq "0 but true") {
-        $::client_id = $id;
-        print "Client ID     : $id\n";
-        print "Finished (success)\n";
-        return 0;
-    } else {
-        print "ioctl returned error code $rc.\n";
-        return -1;
-    }
-}
-
-sub Disconnect {
-    my $id = shift;
-
-    if (!defined($id)) {
-        $id = $::client_id;
-    }
-
-    if (!defined($id)) {
-        print "syntax: disconnect [client ID]\n";
-        print "When client ID is not given, the last valid client ID to be returned by a\n";
-        print "connect command this session is used; there is no such ID.\n";
-        return -1;
-    }
-
-    my $packed = pack("L", $id);
-    if (! defined $::dev_obd) {
-        print "No current device.\n";
-        return -1;
-    }
-    my $rc = ioctl($::dev_obd, &OBD_IOC_DISCONNECT, $packed);
-
-    if (!defined $rc) {
-        print STDERR "ioctl failed: $!\n";
-        return -1;
-    } elsif ($rc eq "0 but true") {
-        $::client_id = undef;
-        print "Finished (success)\n";
-        return 0;
-    } else {
-        print "ioctl returned error code $rc.\n";
-        return -1;
-    }
-}
-
-sub Create {
-    if (!defined($::client_id)) {
-        print "You must first ``connect''.\n";
-        return -1;
-    }
-
-    my $num = shift;
-    my $mode = shift;
-    my $quiet = shift;
-    my $rc;
-    my $prealloc = 0;
-
-    if (!defined($num)) {
-        $num = 1;
-    }
-
-    if (!defined($mode)) {
-        $mode = 0100644;         # create a file (rw-r--r--) if not specified
-    }
-
-    if (scalar($num) < 1 || defined($quiet) && $quiet ne "quiet") {
-        print "usage: create [<number of objects> [<mode> [quiet]]]\n";
-        return -1;
-    }
-
-    my $i;
-    my $id = 0;                 # can't currently request IDs
-
-    print "Creating " . scalar($num) . " object";
-    if (scalar($num) > 1) {
-        print "s";
-    }
-    print "\n";
-
-    for ($i = 0; $i < scalar($num); $i++) {
-        my $obdo;
-        $obdo->{id} = $id;
-        $obdo->{mode} = scalar($mode);
-        $obdo->{valid} = &OBD_MD_FLMODE;
-
-        my $packed = pack("I", $::client_id) . obdo_pack($obdo);
-        if (! defined $::dev_obd) {
-            print "No current device.\n";
-            return -1;
-        }
-        $rc = ioctl($::dev_obd, &OBD_IOC_CREATE, $packed);
-        if ($rc ne "0 but true") {
-            last;
-        } elsif (!defined($quiet)) {
-            $obdo = obdo_unpack($packed, 4);
-            print "Created object #$obdo->{id}.\n";
-        }
-    }
-
-    if (!defined $rc) {
-        print STDERR "ioctl failed: $!\n";
-        return -1;
-    } elsif ($rc eq "0 but true") {
-        print "Finished (success)\n";
-        return 0;
-    } else {
-        print "ioctl returned error code $rc.\n";
-        return -1;
-    }
-}
-
-sub Sync {
-    my $err = "0";
-    if (! defined $::dev_obd) {
-        print "No current device.\n";
-        return -1;
-    }
-    my $rc = ioctl($::dev_obd, &OBD_IOC_SYNC, $err);
-
-    if (!defined $rc) {
-        print STDERR "ioctl failed: $!\n";
-        return -1;
-    } elsif ($rc eq "0 but true") {
-        print "Finished (success)\n";
-        return 0;
-    } else {
-        print "ioctl returned error code $rc.\n";
-        return -1;
-    }
-}
-
-sub Destroy {
-    if (!defined($::client_id)) {
-        print "You must first ``connect''.\n";
-        return -1;
-    }
-
-    my $id = shift;
-
-    if (!defined($id) || scalar($id) < 1) {
-        print "usage: destroy <object number>\n";
-        return -1;
-    }
-
-    print "Destroying object $id...\n";
-    my $packed = pack("IL", $::client_id, $id);
-    if (! defined $::dev_obd) {
-        print "No current device.\n";
-        return -1;
-    }
-    my $rc = ioctl($::dev_obd, &OBD_IOC_DESTROY, $packed);
-
-    if (!defined $rc) {
-        print STDERR "ioctl failed: $!\n";
-        return -1;
-    } elsif ($rc eq "0 but true") {
-        print "Finished (success)\n";
-        return 0;
-    } else {
-        print "ioctl returned error code $rc.\n";
-        return -1;
-    }
-}
-
-sub Getattr {
-    if (!defined($::client_id)) {
-        print "You must first ``connect''.\n";
-        return -1;
-    }
-
-    my $id = shift;
-
-    if (!defined($id) || scalar($id) < 1) {
-        print "invalid arguments; type \"help getattr\" for a synopsis\n";
-        return -1;
-    }
-
-    # see Setattr
-    my $obdo;
-    $obdo->{id} = $id;
-    $obdo->{valid} = &OBD_MD_FLALL;
-    my $packed = pack("L", $::client_id) . obdo_pack($obdo);
-    if (! defined $::dev_obd) {
-        print "No current device.\n";
-        return -1;
-    }
-    my $rc = ioctl($::dev_obd, &OBD_IOC_GETATTR, $packed);
-    
-    if (!defined $rc) {
-        print STDERR "ioctl failed: $!\n";
-        return -1;
-    } elsif ($rc eq "0 but true") {
-        $obdo = obdo_unpack($packed,  4); 
-        obdo_print($obdo);
-        return 0;
-    } else {
-        print "ioctl returned error code $rc.\n";
-        return -1;
-    }
-}
-
-sub Setattr {
-    if (!defined($::client_id)) {
-        print "You must first ``connect''.\n";
-        return -1;
-    }
-
-    my $id = shift;
-
-    if (!defined($id) || scalar($id) < 1) {
-        print "invalid arguments; type \"help setattr\" for a synopsis\n";
-        return -1;
-    }
-
-    # XXX we do not currently set all of the fields in the obdo
-    my $obdo;
-    $obdo->{id} = $id;
-    $obdo->{mode} = oct(shift);
-    $obdo->{uid} = shift;
-    $obdo->{gid} = shift;
-    $obdo->{size} = shift;
-    $obdo->{atime} = shift;
-    $obdo->{mtime} = shift;
-    $obdo->{ctime} = shift;
-    $obdo->{valid} = 0;
-
-    if (defined($obdo->{atime})) {
-        $obdo->{valid} |= &OBD_MD_FLATIME;
-    }
-    if (defined($obdo->{mtime})) {
-        $obdo->{valid} |= &OBD_MD_FLMTIME;
-    }
-    if (defined($obdo->{ctime})) {
-        $obdo->{valid} |= &OBD_MD_FLCTIME;
-    }
-    if (defined($obdo->{size})) {
-        $obdo->{valid} |= &OBD_MD_FLSIZE;
-    }
-    if (defined($obdo->{mode})) {
-        $obdo->{valid} |= &OBD_MD_FLMODE;
-    }
-    if (defined($obdo->{uid})) {
-        $obdo->{valid} |= &OBD_MD_FLUID;
-    }
-    if (defined($obdo->{gid})) {
-        $obdo->{valid} |= &OBD_MD_FLGID;
-    }
-
-    printf "valid is %x, mode is %o\n", $obdo->{valid}, $obdo->{mode};
-    my $packed = pack("L", $::client_id) . obdo_pack($obdo);
-    if (! defined $::dev_obd) {
-        print "No current device.\n";
-        return -1;
-    }
-    my $rc = ioctl($::dev_obd, &OBD_IOC_SETATTR, $packed);
-
-    if (!defined $rc) {
-        print STDERR "ioctl failed: $!\n";
-        return -1;
-    } elsif ($rc eq "0 but true") {
-        print "Finished (success)\n";
-        return 0;
-    } else {
-        print "ioctl returned error code $rc.\n";
-        return -1;
-    }
-}
-
-sub Read {
-    if (!defined($::client_id)) {
-        print "You must first ``connect''.\n";
-        return -1;
-    }
-
-    my $id = shift;
-    my $count = shift;
-    my $offset = shift;
-  
-    if (!defined($id) || scalar($id) < 1 || !defined($count) ||
-        $count < 1 || (defined($offset) && $offset < 0)) {
-        print "invalid arguments; type \"help read\" for a synopsis\n";
-        return -1;
-    }
-
-    if (!defined($offset)) {
-        $offset = 0;
-    }
-
-    print("Reading $count bytes starting at byte $offset from object " .
-          "$id...\n");
-
-    # "allocate" a large enough buffer
-    my $buf = sprintf("%${count}s", " ");
-    die "suck" if (length($buf) != $count);
-
-    my $obdo;
-    $obdo->{id} = $id;
-
-    # the perl we're using doesn't support pack type Q, and offset is 64 bits
-    my $packed = pack("L", $::client_id) . obdo_pack($obdo) .
-                 pack("p LL LL", $buf, $count, $offset);
-
-    if (! defined $::dev_obd) {
-        print "No current device.\n";
-        return -1;
-    }
-    my $rc = ioctl($::dev_obd, &OBD_IOC_READ, $packed);
-
-    $retval = unpack("l", $packed);
-
-    if (!defined $rc) {
-        print STDERR "ioctl failed: $!\n";
-        return -1;
-    } elsif ($rc eq "0 but true") {
-        if ($retval >= 0) {
-                print substr($buf, 0, $retval);
-                print "\nRead $retval of an attempted $count bytes.\n";
-                print "Finished (success)\n";
-                return 0;
-        } else {
-                print "Finished (error $retval)\n";
-                return $retval;
-        }
-    } else {
-        print "ioctl returned error code $rc.\n";
-        return -1;
-    }
-}
-
-sub Read2 {
-    if (!defined($::client_id)) {
-        print "You must first ``connect''.\n";
-        return -1;
-    }
-
-    my $id = shift;
-    my $count = shift;
-    my $offset = shift;
-  
-    if (!defined($id) || scalar($id) < 1 || !defined($count) ||
-        $count < 1 || (defined($offset) && $offset < 0)) {
-        print "invalid arguments; type \"help read\" for a synopsis\n";
-        return -1;
-    }
-
-    if (!defined($offset)) {
-        $offset = 0;
-    }
-
-    print("Reading $count bytes starting at byte $offset from object " .
-          "$id...\n");
-
-    # "allocate" a large enough buffer
-    my $buf = sprintf("%${count}s", " ");
-    die "suck" if (length($buf) != $count);
-
-    my $obdo;
-    $obdo->{id} = $id;
-
-    # the perl we're using doesn't support pack type Q, and offset is 64 bits
-    my $packed = pack("L", $::client_id) . obdo_pack($obdo) .
-                 pack("p LL LL", $buf, $count, $offset);
-
-    if (! defined $::dev_obd) {
-        print "No current device.\n";
-        return -1;
-    }
-    my $rc = ioctl($::dev_obd, &OBD_IOC_READ2, $packed);
-
-    $retval = unpack("l", $packed);
-
-    if (!defined $rc) {
-        print STDERR "ioctl failed: $!\n";
-        return -1;
-    } elsif ($rc eq "0 but true") {
-        if ($retval >= 0) {
-                print substr($buf, 0, $retval);
-                print "\nRead $retval of an attempted $count bytes.\n";
-                print "Finished (success)\n";
-                return 0;
-         } else {
-                print "Finished (error $retval)\n";
-                return $retval;
-        }
-    } else {
-        print "ioctl returned error code $rc.\n";
-        return -1;
-    }
-}
-
-sub Write {
-    if (!defined($::client_id)) {
-        print "You must first ``connect''.\n";
-        return -1;
-    }
-
-    my $id = shift;
-    my $offset = shift;
-    my $text = join(' ', @_);
-    my $count = length($text);
-
-    if (!defined($id) || scalar($id) < 1 || !defined($offset) ||
-        scalar($offset) < 0) {
-        print "invalid arguments; type \"help write\" for a synopsis\n";
-        return -1;
-    }
-
-    if (!defined($text)) {
-        $text = "";
-        $count = 0;
-    }
-
-    print("Writing $count bytes starting at byte $offset to object $id...\n");
-
-    my $obdo;
-    $obdo->{id} = $id;
-
-    # the perl we're using doesn't support pack type Q
-    my $packed = pack("L", $::client_id) . obdo_pack($obdo) .
-                 pack("p LL LL", $text, $count, $offset);
-
-    if (! defined $::dev_obd) {
-        print "No current device.\n";
-        return -1;
-    }
-    my $rc = ioctl($::dev_obd, &OBD_IOC_WRITE, $packed);
-
-    $retval = unpack("l", $packed);
-
-    if (!defined $rc) {
-        print STDERR "ioctl failed: $!\n";
-        return -1;
-    } elsif ($rc eq "0 but true") {
-        if ($retval >= 0) {
-                print "\nWrote $retval of an attempted $count bytes.\n";
-                print "Finished (success)\n";
-                return 0;
-        } else {
-                print "Finished (error $retval)\n";
-                return $retval;
-        }
-    } else {
-        print "ioctl returned error code $rc.\n";
-        return -1;
-    }
-}
-
-sub Punch {
-    if (!defined($::client_id)) {
-        print "You must first ``connect''.\n";
-        return -1;
-    }
-
-    my $id = shift;
-    my $start = shift;
-    my $count = shift;
-
-    if (!defined($id) || scalar($id) < 1 || !defined($start) ||
-        scalar($start) < 0 || !defined($count) || scalar($count) < 0) {
-        print "invalid arguments; type \"help punch\" for a synopsis\n";
-        return -1;
-    }
-
-    print("Punching $count bytes starting at byte $start from object $id...\n");
-
-    my $obdo;
-    $obdo->{id} = $id;
-
-    # the perl we're using doesn't support pack type Q
-    my $packed = pack("L", $::client_id) . obdo_pack($obdo) .
-                 pack("p LL LL", $buf, $start, $count);
-
-    if (! defined $::dev_obd) {
-        print "No current device.\n";
-        return -1;
-    }
-    my $rc = ioctl($::dev_obd, &OBD_IOC_PUNCH, $packed);
-
-    $retval = unpack("l", $packed);
-
-    if (!defined $rc) {
-        print STDERR "ioctl failed: $!\n";
-    } elsif ($rc eq "0 but true") {
-        if ($retval >= 0) {
-                print "\nPunched $retval of an attempted $count bytes.\n";
-                print "Finished (success)\n";
-                return 0;
-        } else {
-                print "Finished (error $retval)\n";
-                return $retval;
-        }
-    } else {
-        print "ioctl returned error code $rc.\n";
-        return -1;
-    }
-}
-
-sub Preallocate {
-    my $num = shift;
-
-    if (!defined($::client_id)) {
-        print "You must first ``connect''.\n";
-        return -1;
-    }
-
-    if (!defined($num) || scalar($num) < 1 || scalar($num) > 32) {
-        $num = 32;
-    }
-
-    print "Preallocating $num objects...\n";
-    # client id, alloc, id[32]
-    my $packed = pack("LLx128", $::client_id, $num);
-
-    if (! defined $::dev_obd) {
-        print "No current device.\n";
-        return -1;
-    }
-    my $rc = ioctl($::dev_obd, &OBD_IOC_PREALLOCATE, $packed);
-
-    if (!defined $rc) {
-        print STDERR "ioctl failed: $!\n";
-        return -1;
-    } elsif ($rc eq "0 but true") {
-        my $alloc = unpack("x4L", $packed);
-        my @ids = unpack("x8L32", $packed);
-        my $i;
-
-        print "Got $alloc objects: ";
-        foreach $i (@ids) {
-            print $i . " ";
-        }
-        print "\nFinished (success)\n";
-        return 0;
-    } else {
-        print "ioctl returned error code $rc.\n";
-        return -1;
-    }
-}
-
-sub Decusecount {
-    if (! defined $::dev_obd) {
-        print "No current device.\n";
-        return -1;
-    }
-    my $rc = ioctl($::dev_obd, &OBD_IOC_DEC_USE_COUNT, 0);
-
-    if (!defined $rc) {
-        print STDERR "ioctl failed: $!\n";
-        return -1;
-    } elsif ($rc eq "0 but true") {
-        print "Finished (success)\n";
-        return 0;
-    } else {
-        print "ioctl returned error code $rc.\n";
-        return -1;
-    }
-}
-
-sub Statfs {
-    if (!defined($::client_id)) {
-        print "You must first ``connect''.\n";
-        return -1;
-    }
-
-    # struct statfs {
-    #         long f_type;
-    #         long f_bsize;
-    #         long f_blocks;
-    #         long f_bfree;
-    #         long f_bavail;
-    #         long f_files;
-    #         long f_ffree;
-    #         __kernel_fsid_t f_fsid; (64 bits)
-    #         long f_namelen;
-    #         long f_spare[6];
-    # };
-
-    my $packed = pack("LLLLLLLIILL6", $::client_id, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-                      0, 0, 0, 0, 0, 0);
-
-    if (! defined $::dev_obd) {
-        print "No current device.\n";
-        return -1;
-    }
-    my $rc = ioctl($::dev_obd, &OBD_IOC_STATFS, $packed);
-
-    if (!defined $rc) {
-        print STDERR "ioctl failed: $!\n";
-        return -1;
-    } elsif ($rc eq "0 but true") {
-        # skip both the conn_id and the fs_type in the buffer
-        my ($bsize, $blocks, $bfree, $bavail, $files, $ffree) =
-            unpack("x4x4LLLLLL", $packed);
-        print("$bsize byte blocks: $blocks, " . ($blocks - $bfree) . " used, " .
-              "$bfree free ($bavail available).\n");
-        print "$files files, " . ($files - $ffree) . " used, $ffree free.\n";
-        print "Finished (success)\n";
-        return 0;
-    } else {
-        print "ioctl returned error code $rc.\n";
-        return -1;
-    }
-}
-
-sub Help {
-    my $cmd = shift;
-
-    if ( !$cmd || !$commands{$cmd} ) {
-        print "Comands: ", join( ' ', @jcm_cmd_list), "\n";
-    } else {
-        print "Usage: " .  $commands{$cmd}->{doc} . "\n";
-    }
-    return 0;
-}
-
-sub Quit {
-    if ($::client_id) {
-        print "Disconnecting active session ($::client_id)...";
-        Disconnect($::client_id);
-    }
-    exit;
-}
diff --git a/lustre/utils/obdctl.c b/lustre/utils/obdctl.c
deleted file mode 100644 (file)
index 979a665..0000000
+++ /dev/null
@@ -1,495 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 2002 Cluster File Systems, Inc.
- *   Author: Peter J. Braam <braam@clusterfs.com>
- *   Author: Phil Schwan <phil@clusterfs.com>
- *
- *   This file is part of Lustre, http://www.lustre.org.
- *
- *   Lustre is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   Lustre is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with Lustre; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#include <stdlib.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#define printk printf
-#include <linux/lustre_lib.h>
-#include <linux/lustre_idl.h>
-#include <unistd.h>
-#include <sys/un.h>
-#include <sys/time.h>
-#include <netinet/in.h>
-#include <errno.h>
-#include <string.h>
-#include <linux/module.h>
-
-#define __KERNEL__
-#include <linux/list.h>
-#undef __KERNEL__
-
-#include "parser.h"
-#include <stdio.h>
-
-int fd = -1;
-int connid = -1;
-char rawbuf[8192];
-char *buf = rawbuf;
-int max = 8192;
-
-#define IOCINIT(data) do { memset(&data, 0, sizeof(data)); data.ioc_version = OBD_IOCTL_VERSION; data.ioc_conn1 = connid; data.ioc_len = sizeof(data); if (fd < 0) { printf("No device open, use device\n"); return 1;}} while (0)
-
-/*
-    pack "LL LL LL LL LL LL LL L L L L L L L L L a60 a60 L L L", 
-    $obdo->{id}, 0, 
-    $obdo->{gr}, 0, 
-    $obdo->{atime}, 0, 
-    $obdo->{mtime}, 0 ,
-    $obdo->{ctime}, 0, 
-    $obdo->{size}, 0, 
-    $obdo->{blocks}, 0, 
-    $obdo->{blksize},
-    $obdo->{mode},
-    $obdo->{uid},
-    $obdo->{gid},
-    $obdo->{flags},
-    $obdo->{obdflags},
-    $obdo->{nlink},     
-    $obdo->{generation},        
-    $obdo->{valid},     
-    $obdo->{inline},
-    $obdo->{obdmd},
-    0, 0, # struct list_head 
-    0;  #  struct obd_ops 
-}
-
-*/
-
-char * obdo_print(struct obdo *obd)
-{
-       char buf[1024];
-
-       sprintf(buf, "id: %Ld\ngrp: %Ld\natime: %Ld\nmtime: %Ld\nctime: %Ld\nsize: %Ld\nblocks: %Ld\nblksize: %d\nmode: %o\nuid: %d\ngid: %d\nflags: %x\nobdflags: %x\nnlink: %d,\nvalid %x\n",
-               obd->o_id,
-               obd->o_gr,
-               obd->o_atime,
-               obd->o_mtime,
-               obd->o_ctime,
-               obd->o_size,
-               obd->o_blocks,
-               obd->o_blksize,
-               obd->o_mode,
-               obd->o_uid,
-               obd->o_gid,
-               obd->o_flags,
-               obd->o_obdflags,
-               obd->o_nlink,
-               obd->o_valid);
-       return strdup(buf);
-}
-
-static int jt_device(int argc, char **argv)
-{
-       struct obd_ioctl_data data;
-       int rc;
-
-       memset(&data, 0, sizeof(data));
-       if ( argc != 2 ) {
-               fprintf(stderr, "Usage: %s devno\n", argv[0]);
-               return 1;
-       }
-
-       data.ioc_dev = atoi(argv[1]);
-
-       if (obd_ioctl_pack(&data, &buf, max)) { 
-               printf("invalid ioctl\n"); 
-               return 1;
-       }
-
-       if (fd == -1) 
-               fd = open("/dev/obd", O_RDWR);
-       if (fd == -1) {
-               printf("Opening /dev/obd: %s\n", strerror(errno));
-               return 1;
-       }
-
-       rc = ioctl(fd, OBD_IOC_DEVICE , buf);
-       if (rc < 0) {
-               printf("Device: %x %s\n", OBD_IOC_DEVICE, strerror(errno));
-               return 1;
-       }
-
-       return 0;
-}
-
-static int jt_connect(int argc, char **argv)
-{
-       struct obd_ioctl_data data;
-       int rc;
-
-       IOCINIT(data);
-
-       if ( argc != 1 ) {
-               fprintf(stderr, "Usage: %s\n", argv[0]);
-               return 1;
-       }
-
-       rc = ioctl(fd, OBD_IOC_CONNECT , &data);
-       if (rc < 0) {
-               printf("Device: %x %s\n", OBD_IOC_CONNECT, strerror(errno));
-               return 1;
-       }
-       connid = data.ioc_conn1;
-
-       return 0;
-}
-
-static int jt_disconnect(int argc, char **argv)
-{
-       struct obd_ioctl_data data;
-       int rc;
-
-       IOCINIT(data);
-
-       if ( argc != 1 ) {
-               fprintf(stderr, "Usage: %s\n", argv[0]);
-               return 1;
-       }
-
-       rc = ioctl(fd, OBD_IOC_DISCONNECT , &data);
-       if (rc < 0) {
-               printf("Device: %x %s\n", OBD_IOC_DISCONNECT, strerror(errno));
-               return 1;
-       }
-       connid = -1;
-
-       return 0;
-}
-
-
-static int jt_detach(int argc, char **argv)
-{
-       struct obd_ioctl_data data;
-       int rc;
-
-       IOCINIT(data);
-
-       if ( argc != 1 ) {
-               fprintf(stderr, "Usage: %s\n", argv[0]);
-               return 1;
-       }
-
-       if (obd_ioctl_pack(&data, &buf, max)) { 
-               printf("invalid ioctl\n"); 
-               return 1;
-       }
-
-       rc = ioctl(fd, OBD_IOC_DETACH , buf);
-       if (rc < 0) {
-               printf("Detach: %s\n", strerror(errno));
-               return 1;
-       }
-       return 0;
-}
-
-static int jt_cleanup(int argc, char **argv)
-{
-       struct obd_ioctl_data data;
-       int rc;
-
-       IOCINIT(data);
-
-       if ( argc != 1 ) {
-               fprintf(stderr, "Usage: %s\n", argv[0]);
-               return 1;
-       }
-
-       rc = ioctl(fd, OBD_IOC_CLEANUP , &data);
-       if (rc < 0) {
-               printf("Detach: %s\n", strerror(errno));
-               return 1;
-       }
-       return 0;
-}
-
-static int jt_attach(int argc, char **argv)
-{
-       struct obd_ioctl_data data;
-       int rc;
-
-       IOCINIT(data);
-
-       if ( argc != 2 && argc != 3  ) {
-               fprintf(stderr, "Usage: %s type [data]\n", argv[0]);
-               return 1;
-       }
-
-       data.ioc_inllen1 =  strlen(argv[1]) + 1;
-       data.ioc_inlbuf1 = argv[1];
-       if ( argc == 3 ) { 
-               data.ioc_inllen2 = strlen(argv[2]) + 1;
-               data.ioc_inlbuf2 = argv[2];
-       }
-
-       printf("attach len %d addr %p type %s data %s\n", data.ioc_len, buf, 
-              MKSTR(data.ioc_inlbuf1), MKSTR(data.ioc_inlbuf2));
-
-       if (obd_ioctl_pack(&data, &buf, max)) { 
-               printf("invalid ioctl\n"); 
-               return 1;
-       }
-       printf("attach len %d addr %p raw %p type %s data %s and %s\n", data.ioc_len, buf, rawbuf,
-              MKSTR(data.ioc_inlbuf1), MKSTR(data.ioc_inlbuf2), &buf[516]);
-
-       rc = ioctl(fd, OBD_IOC_ATTACH , buf);
-       if (rc < 0) {
-               printf("Attach: %x %s\n", OBD_IOC_ATTACH, strerror(errno));
-               return 1;
-       }
-       return 0;
-}
-
-static int jt_setup(int argc, char **argv)
-{
-       struct obd_ioctl_data data;
-       int rc;
-
-       IOCINIT(data);
-
-       if ( argc > 3  ) {
-               fprintf(stderr, "Usage: %s [device] [fstype]\n", argv[0]);
-               return 1;
-       }
-
-       if (argc > 1) {
-               data.ioc_inllen1 =  strlen(argv[1]) + 1;
-               data.ioc_inlbuf1 = argv[1];
-               data.ioc_dev = strtoul(argv[1], NULL, 0);
-       } else {
-               data.ioc_dev = -1;
-       }
-       if ( argc == 3 ) { 
-               data.ioc_inllen2 = strlen(argv[2]) + 1;
-               data.ioc_inlbuf2 = argv[2];
-       }
-
-       printf("setup len %d addr %p device %s type %s\n", data.ioc_len, buf, 
-              MKSTR(data.ioc_inlbuf1), MKSTR(data.ioc_inlbuf2));
-
-       if (obd_ioctl_pack(&data, &buf, max)) { 
-               printf("invalid ioctl\n"); 
-               return 1;
-       }
-       printf("setup len %d addr %p raw %p device %s type %s\n", 
-              data.ioc_len, buf, rawbuf,
-              MKSTR(data.ioc_inlbuf1), MKSTR(data.ioc_inlbuf2));
-
-       rc = ioctl(fd, OBD_IOC_SETUP , buf);
-       if (rc < 0) {
-               printf("setup: %x %s\n", OBD_IOC_SETUP, strerror(errno));
-               return 1;
-       }
-       return 0;
-}
-
-
-static int jt_create(int argc, char **argv)
-{
-       struct obd_ioctl_data data;
-       int num = 1;
-       int silent = 0;
-       int i;
-       int rc;
-
-       IOCINIT(data);
-       if (argc > 1) { 
-               num = strtoul(argv[1], NULL, 0);
-       } else { 
-               printf("usage %s num [mode] [silent]\n", argv[0]); 
-       }
-
-       if (argc > 2) { 
-               data.ioc_obdo1.o_mode = strtoul(argv[2], NULL, 0);
-       } else { 
-               data.ioc_obdo1.o_mode = 0100644;
-       }
-       data.ioc_obdo1.o_valid = OBD_MD_FLMODE;
-
-       if (argc > 3) { 
-               silent = strtoul(argv[3], NULL, 0);
-       }
-               
-       printf("Creating %d obdos\n", num);
-
-       for (i = 0 ; i<num ; i++) { 
-               rc = ioctl(fd, OBD_IOC_CREATE , &data);
-               if (rc < 0) {
-                       printf("Create: %x %s\n", OBD_IOC_CREATE, 
-                              strerror(errno));
-                       return 1;
-               }
-               printf("created obdo %Ld\n", data.ioc_obdo1.o_id);
-       }
-       return 0;
-}
-
-static int jt_setattr(int argc, char **argv)
-{
-       struct obd_ioctl_data data;
-       int rc;
-
-       IOCINIT(data);
-       if (argc < 2) { 
-               printf("usage: %s id mode\n", argv[0]); 
-               return -1;
-       }
-
-        data.ioc_obdo1.o_id = strtoul(argv[1], NULL, 0);
-        data.ioc_obdo1.o_mode = strtoul(argv[2], NULL, 0);
-        data.ioc_obdo1.o_valid = OBD_MD_FLMODE; 
-
-       rc = ioctl(fd, OBD_IOC_SETATTR , &data);
-       if (rc < 0) {
-               printf("setattr: %x %s\n", OBD_IOC_SETATTR, strerror(errno));
-       }
-       return rc;
-}
-
-static int jt_destroy(int argc, char **argv)
-{
-       struct obd_ioctl_data data;
-       int rc;
-
-       IOCINIT(data);
-       if (argc < 1) { 
-               printf("usage %s id\n", argv[0]); 
-       }
-
-        data.ioc_obdo1.o_id = strtoul(argv[1], NULL, 0);
-
-       rc = ioctl(fd, OBD_IOC_DESTROY , &data);
-       if (rc < 0) {
-               printf("setattr: %x %s\n", OBD_IOC_DESTROY, strerror(errno));
-       }
-       return rc;
-}
-
-static int jt_getattr(int argc, char **argv)
-{
-       struct obd_ioctl_data data;
-       int rc;
-
-       IOCINIT(data);
-       if (argc != 1) { 
-               data.ioc_obdo1.o_id = strtoul(argv[1], NULL, 0);
-               data.ioc_obdo1.o_valid = 0xffffffff;
-               printf("getting attr for %Ld\n", data.ioc_obdo1.o_id);
-       } else { 
-               printf("usage %s id\n", argv[0]); 
-               return 0;
-       }
-
-       rc = ioctl(fd, OBD_IOC_GETATTR , &data);
-       if (rc) { 
-               printf("Error: %s\n", strerror(rc)); 
-       } else { 
-               printf("attr obdo %Ld, mode %o\n", data.ioc_obdo1.o_id, 
-                      data.ioc_obdo1.o_mode);
-       }
-       return 0;
-}
-
-static int jt_modules(int argc, char **argv)
-{
-        char *modules[] = {"portals", "ksocknal", "obdclass", "ptlrpc",
-                           "obdext2", "ost", "osc", "mds", "mdc", "llight",
-                           NULL};
-        char *paths[] = {"portals/linux/oslib", "portals/linux/socknal",
-                         "obd/class", "obd/rpc", "obd/ext2obd", "obd/ost",
-                         "obd/osc", "obd/mds", "obd/mdc", "obd/llight", NULL};
-        char *path = "..";
-        char *kernel = "linux";
-        int i;
-
-        if (argc >= 2)
-                path = argv[1];
-        if (argc == 3) 
-                kernel = argv[2];
-        if (argc > 3) {
-                printf("%s [path] [kernel]\n", argv[0]);
-                return 0;
-        }
-
-        printf("symbol-file\nsymbol-file %s\nb panic\nb stop\n", kernel); 
-
-        for (i = 0; modules[i] != NULL; i++) {
-                struct module_info info;
-                int rc;
-                size_t crap;
-                int query_module(const char *name, int which, void *buf,
-                                 size_t bufsize, size_t *ret);
-
-                rc = query_module(modules[i], QM_INFO, &info, sizeof(info),
-                                  &crap);
-                if (rc < 0) {
-                        if (errno != ENOENT)
-                                printf("query_module(%s) failed: %s\n",
-                                       modules[i], strerror(errno));
-                } else {
-                        printf("add-symbol-file %s/%s/%s.o 0x%0lx\n", path,
-                               paths[i], modules[i],
-                               info.addr + sizeof(struct module));
-                }
-        }
-
-        return 0;
-}
-
-command_t list[] = {
-       {"device", jt_device, 0, "set current device (args device no)"},
-        {"attach", jt_attach, 0, "name the typed of device (args: type data"},
-        {"setup", jt_setup, 0, "setup device (args: blkdev, data"},
-        {"detach", jt_detach, 0, "detach the current device (arg: )"},
-        {"cleanup", jt_cleanup, 0, "cleanup the current device (arg: )"},
-        {"create", jt_create, 0, "create [count [mode [silent]]]"},
-        {"destroy", jt_destroy, 0, "destroy id"},
-        {"getattr", jt_getattr, 0, "getattr id"},
-        {"setattr", jt_setattr, 0, "setattr id mode"},
-        {"connect", jt_connect, 0, "connect - get a connection to device"},
-        {"disconnect", jt_disconnect, 0, "disconnect - break connection to device"},
-        {"modules", jt_modules, 0, "provide gdb-friendly module info (arg: <path>)"},
-        {"help", Parser_help, 0, "help"},
-        {"exit", Parser_quit, 0, "quit"},
-        {"quit", Parser_quit, 0, "quit"},
-        { 0, 0, 0, NULL }
-};
-
-int main(int argc, char **argv)
-{
-
-       if (argc > 1) { 
-               return Parser_execarg(argc - 1, &argv[1], list);
-       }
-
-       Parser_init("obdctl > ", list);
-       Parser_commands();
-
-       return 0;
-}
-
diff --git a/lustre/utils/parser.c b/lustre/utils/parser.c
deleted file mode 100644 (file)
index d3087a7..0000000
+++ /dev/null
@@ -1,585 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <string.h>
-#include <stddef.h>
-#include <sys/param.h>
-#include <assert.h>
-
-#define        READLINE_LIBRARY
-#include <readline/readline.h>
-
-//extern char **completion_matches __P((char *, rl_compentry_func_t *));
-extern void using_history(void);
-extern void stifle_history(int);
-extern void add_history(char *);
-
-#include "parser.h"
-#define CMD_COMPLETE 0
-#define CMD_INCOMPLETE 1
-#define CMD_NONE 2
-#define CMD_AMBIG 3
-
-static command_t * top_level;     /* Top level of commands, initialized by
-                                   * InitParser                            */
-static command_t * match_tbl;     /* Command completion against this table */
-static char * parser_prompt = NULL;/* Parser prompt, set by InitParser      */
-static int done;                  /* Set to 1 if user types exit or quit   */
-
-
-/* static functions */
-static char *skipwhitespace(char *s);
-static char *skiptowhitespace(char *s);
-static command_t *find_cmd(char *name, command_t cmds[], char **next);
-static int process(char *s, char **next, command_t *lookup, command_t **result, char **prev);
-static char *command_generator(const char *text, int state);
-static char **command_completion(char *text, int start, int end);
-static void print_commands(char *str, command_t *table);
-
-static char * skipwhitespace(char * s) 
-{
-    char * t;
-    int    len;
-
-    len = (int)strlen(s);
-    for (t = s; t <= s + len && isspace(*t); t++);
-    return(t);
-}
-
-
-static char * skiptowhitespace(char * s) 
-{
-    char * t;
-
-    for (t = s; *t && !isspace(*t); t++);
-    return(t);
-}
-
-static int line2args(char *line, char **argv, int maxargs)
-{
-    char *arg;
-    int i = 0; 
-    
-    arg = strtok(line, " \t");
-    if ( arg ) {
-       argv[i] = arg;
-       i++;
-    } else 
-       return 0;
-
-    while( (arg = strtok(NULL, " \t")) && (i <= maxargs)) {
-       argv[i] = arg;
-       i++;
-    }
-    return i;
-}
-
-/* find a command -- return it if unique otherwise print alternatives */
-    
-static command_t *Parser_findargcmd(char *name, command_t cmds[])
-{
-       command_t *cmd;
-       int i;
-
-       for (i = 0; cmds[i].pc_name; i++) {
-               cmd = &cmds[i];
-
-               if (strlen(name) != strlen(cmd->pc_name))
-                       continue;
-
-               if (strlen(name) == strlen(cmd->pc_name)) {
-                       if (strcmp(name, cmd->pc_name) == 0) 
-                               return cmd;
-                       else
-                               continue;
-               }
-
-       }
-       return NULL;
-}
-
-int Parser_execarg(int argc, char **argv, command_t cmds[])
-{
-       command_t *cmd;
-       int i;
-
-        cmd = Parser_findargcmd(argv[0], cmds);
-       if ( cmd ) {
-               return (cmd->pc_func)(argc, argv);
-       } else {
-               printf("Try interactive use without arguments or use one of: ");
-               for (i=0 ; cmds[i].pc_name ; i++) {
-                       cmd = &cmds[i];
-                       printf("\"%s\" ", cmd->pc_name);
-               }
-               printf("as argument.\n");
-       }
-       return -1;
-}
-
-/* returns the command_t * (NULL if not found) corresponding to a
-   _partial_ match with the first token in name.  It sets *next to
-   point to the following token. Does not modify *name. */
-static command_t * find_cmd(char * name, command_t cmds[], char ** next) 
-{
-    int    i, len;
-    
-    if (!cmds || !name ) 
-        return NULL;
-    
-    /* This sets name to point to the first non-white space character,
-    and next to the first whitespace after name, len to the length: do
-    this with strtok*/
-    name = skipwhitespace(name);
-    *next = skiptowhitespace(name);
-    len = *next - name;
-    if (len == 0) 
-       return NULL;
-
-    for (i = 0; cmds[i].pc_name; i++) {
-       if (strncasecmp(name, cmds[i].pc_name, len) == 0) {
-           *next = skipwhitespace(*next);
-           return(&cmds[i]);
-       }
-    }
-    return NULL;
-}
-
-/* Recursively process a command line string s and find the command
-   corresponding to it. This can be ambiguous, full, incomplete,
-   non-existent. */
-static int process(char *s, char ** next, command_t *lookup,
-                  command_t **result, char **prev)
-{
-    *result = find_cmd(s, lookup, next);
-    *prev = s; 
-
-    /* non existent */
-    if ( ! *result ) 
-       return CMD_NONE;
-
-    /* found entry: is it ambigous, i.e. not exact command name and
-       more than one command in the list matches.  Note that find_cmd
-       points to the first ambiguous entry */
-    if ( strncasecmp(s, (*result)->pc_name, strlen((*result)->pc_name)) &&
-        find_cmd(s, (*result) + 1, next)) 
-       return CMD_AMBIG;
-
-    /* found a unique command: component or full? */
-    if ( (*result)->pc_func ) {
-       return CMD_COMPLETE;
-    } else {
-       if ( *next == '\0' ) {
-           return CMD_INCOMPLETE;
-       } else {
-           return process(*next, next, (*result)->pc_sub_cmd, result, prev);
-       }
-    }
-}
-
-static char * command_generator(const char * text, int state) 
-{
-    static int index,
-              len;
-    char       *name;
-
-    /* Do we have a match table? */
-    if (!match_tbl) 
-       return NULL;
-    
-    /* If this is the first time called on this word, state is 0 */
-    if (!state) {
-       index = 0;
-       len = (int)strlen(text);
-    }
-
-    /* Return the next name in the command list that paritally matches test */
-    while ( (name = (match_tbl + index)->pc_name) ) {
-       index++;
-
-       if (strncasecmp(name, text, len) == 0) {
-           return(strdup(name));
-       }
-    }
-
-    /* No more matches */
-    return NULL;
-}
-
-/* probably called by readline */
-static char **command_completion(char * text, int start, int end) 
-{
-    command_t  * table;
-    char       * pos;
-
-    match_tbl = top_level;
-    for (table = find_cmd(rl_line_buffer, match_tbl, &pos);
-        table;
-        table = find_cmd(pos, match_tbl, &pos)) {
-
-       if (*(pos - 1) == ' ') match_tbl = table->pc_sub_cmd;
-    }
-
-    return(completion_matches(text, command_generator));
-}
-
-/* take a string and execute the function or print help */
-void execute_line(char * line) 
-{
-    command_t  *cmd, *ambig;
-    char *prev;
-    char *next, *tmp;
-    char *argv[MAXARGS];
-    int         i;
-
-    switch( process(line, &next, top_level, &cmd, &prev) ) {
-    case CMD_AMBIG:
-       fprintf(stderr, "Ambiguous command \'%s\'\nOptions: ", line);
-       while( (ambig = find_cmd(prev, cmd, &tmp)) ) {
-           fprintf(stderr, "%s ", ambig->pc_name);
-           cmd = ambig + 1;
-       }
-       fprintf(stderr, "\n");
-       break;
-    case CMD_NONE:
-       fprintf(stderr, "No such command, type help\n");
-       break;
-    case CMD_INCOMPLETE:
-       fprintf(stderr,
-               "'%s' incomplete command.  Use '%s x' where x is one of:\n",
-               line, line);
-       fprintf(stderr, "\t");
-       for (i = 0; cmd->pc_sub_cmd[i].pc_name; i++) {
-           fprintf(stderr, "%s ", cmd->pc_sub_cmd[i].pc_name);
-       }
-       fprintf(stderr, "\n");
-       break;
-    case CMD_COMPLETE:
-       i = line2args(line, argv, MAXARGS);
-       (cmd->pc_func)(i, argv);
-       break;
-    }
-    
-    return;
-}
-
-/* this is the command execution machine */
-void Parser_commands(void) 
-{
-    char *line,
-        *s;
-
-    using_history();
-    stifle_history(HISTORY);
-
-    rl_attempted_completion_function = 
-           (CPPFunction *)command_completion;
-    rl_completion_entry_function = (void *)command_generator;
-    
-    while(!done) {
-       line = readline(parser_prompt);
-
-       if (!line) break;
-
-       s = skipwhitespace(line);
-
-       if (*s) {
-           add_history(s);
-           execute_line(s);
-       }
-
-       free(line);
-    }
-}
-
-
-/* sets the parser prompt */
-void Parser_init(char * prompt, command_t * cmds) 
-{
-    done = 0;
-    top_level = cmds;
-    if (parser_prompt) free(parser_prompt);
-    parser_prompt = strdup(prompt);
-}
-
-/* frees the parser prompt */
-void Parser_exit(int argc, char *argv[]) 
-{
-    done = 1;
-    free(parser_prompt);
-    parser_prompt = NULL;
-}
-
-/* convert a string to an integer */
-int Parser_int(char *s, int *val)
-{
-    int ret;
-
-    if (*s != '0')
-       ret = sscanf(s, "%d", val);
-    else if (*(s+1) != 'x')
-       ret = sscanf(s, "%o", val);
-    else {
-       s++;
-       ret = sscanf(++s, "%x", val);
-    }
-
-    return(ret);
-}
-
-
-    
-void Parser_qhelp(int argc, char *argv[]) {
-
-    printf("Available commands are:\n");
-       
-    print_commands(NULL, top_level);
-    printf("For more help type: help command-name\n");
-}
-
-int Parser_help(int argc, char **argv) 
-{
-    char line[1024];
-    char *next, *prev, *tmp;
-    command_t *result, *ambig;
-    int i;
-
-    if ( argc == 1 ) {
-       Parser_qhelp(argc, argv);
-       return 0;
-    }
-
-    line[0]='\0';
-    for ( i = 1 ;  i < argc ; i++ ) {
-       strcat(line, argv[i]);
-    }
-
-    switch ( process(line, &next, top_level, &result, &prev) ) {
-    case CMD_COMPLETE:
-       fprintf(stderr, "%s: %s\n",line, result->pc_help);
-       break;
-    case CMD_NONE:
-       fprintf(stderr, "%s: Unknown command.\n", line);
-       break;
-    case CMD_INCOMPLETE:
-       fprintf(stderr,
-               "'%s' incomplete command.  Use '%s x' where x is one of:\n",
-               line, line);
-       fprintf(stderr, "\t");
-       for (i = 0; result->pc_sub_cmd[i].pc_name; i++) {
-           fprintf(stderr, "%s ", result->pc_sub_cmd[i].pc_name);
-       }
-       fprintf(stderr, "\n");
-       break;
-    case CMD_AMBIG:
-       fprintf(stderr, "Ambiguous command \'%s\'\nOptions: ", line);
-       while( (ambig = find_cmd(prev, result, &tmp)) ) {
-           fprintf(stderr, "%s ", ambig->pc_name);
-           result = ambig + 1;
-       }
-       fprintf(stderr, "\n");
-       break;
-    }
-    return 0;
-}  
-
-/*************************************************************************
- * COMMANDS                                                             *
- *************************************************************************/ 
-
-
-static void print_commands(char * str, command_t * table) {
-    command_t * cmds;
-    char       buf[80];
-
-    for (cmds = table; cmds->pc_name; cmds++) {
-       if (cmds->pc_func) {
-           if (str) printf("\t%s %s\n", str, cmds->pc_name);
-           else printf("\t%s\n", cmds->pc_name);
-       }
-       if (cmds->pc_sub_cmd) {
-           if (str) {
-               sprintf(buf, "%s %s", str, cmds->pc_name);
-               print_commands(buf, cmds->pc_sub_cmd);
-           } else {
-               print_commands(cmds->pc_name, cmds->pc_sub_cmd);
-           }
-       }
-    }
-}
-
-char *Parser_getstr(const char *prompt, const char *deft, char *res, 
-                   size_t len)
-{
-    char *line = NULL;
-    int size = strlen(prompt) + strlen(deft) + 8;
-    char *theprompt;
-    theprompt = malloc(size);
-    assert(theprompt);
-
-    sprintf(theprompt, "%s [%s]: ", prompt, deft);
-
-    line  = readline(theprompt);
-    free(theprompt);
-
-    if ( line == NULL || *line == '\0' ) {
-       strncpy(res, deft, len);
-    } else {
-       strncpy(res, line, len);
-    }
-
-    if ( line ) {
-       free(line);
-       return res;
-    } else {
-       return NULL;
-    }
-}
-
-/* get integer from prompt, loop forever to get it */
-int Parser_getint(const char *prompt, long min, long max, long deft, int base)
-{
-    int rc;
-    long result;
-    char *line;
-    int size = strlen(prompt) + 40;
-    char *theprompt = malloc(size);
-    assert(theprompt);
-    sprintf(theprompt,"%s [%ld, (0x%lx)]: ", prompt, deft, deft);
-
-    fflush(stdout);
-
-    do {
-       line = NULL;
-       line = readline(theprompt);
-       if ( !line ) {
-           fprintf(stdout, "Please enter an integer.\n");
-           fflush(stdout);
-           continue;
-       }
-       if ( *line == '\0' ) {
-           free(line);
-           result =  deft;
-           break;
-       }
-       rc = Parser_arg2int(line, &result, base);
-       free(line);
-       if ( rc != 0 ) {
-           fprintf(stdout, "Invalid string.\n");
-           fflush(stdout);
-       } else if ( result > max || result < min ) {
-           fprintf(stdout, "Error: response must lie between %ld and %ld.\n",
-                   min, max);
-           fflush(stdout);
-       } else {
-           break;
-       }
-    } while ( 1 ) ;
-
-    if (theprompt)
-       free(theprompt);
-    return result;
-
-}
-
-/* get boolean (starting with YyNn; loop forever */
-int Parser_getbool(const char *prompt, int deft)
-{
-    int result = 0;
-    char *line;
-    int size = strlen(prompt) + 8;
-    char *theprompt = malloc(size);
-    assert(theprompt);
-
-    fflush(stdout);
-    
-    if ( deft != 0 && deft != 1 ) {
-       fprintf(stderr, "Error: Parser_getbool given bad default (%d).\n",
-               deft);
-       assert ( 0 );
-    }
-    sprintf(theprompt, "%s [%s]: ", prompt, (deft==0)? "N" : "Y");
-
-    do {
-       line = NULL;
-       line = readline(theprompt);
-       if ( line == NULL ) {
-           result = deft;
-           break;
-       }
-       if ( *line == '\0' ) {
-           result = deft;
-           break;
-       }
-       if ( *line == 'y' || *line == 'Y' ) {
-           result = 1;
-           break;
-       }
-       if ( *line == 'n' || *line == 'N' ) {
-           result = 0;
-           break;
-       }
-       if ( line ) 
-           free(line);
-       fprintf(stdout, "Invalid string. Must start with yY or nN\n");
-       fflush(stdout);
-    } while ( 1 );
-
-    if ( line ) 
-       free(line);
-    if ( theprompt ) 
-       free(theprompt);
-    return result;
-}
-
-/* parse int out of a string or prompt for it */
-long Parser_intarg(const char *inp, const char *prompt, int deft,
-                 int min, int max, int base)
-{
-    long result;
-    int rc; 
-    
-    rc = Parser_arg2int(inp, &result, base);
-
-    if ( rc == 0 ) {
-       return result;
-    } else {
-       return Parser_getint(prompt, deft, min, max, base);
-    }
-}
-
-/* parse int out of a string or prompt for it */
-char *Parser_strarg(char *inp, const char *prompt, const char *deft,
-                   char *answer, int len)
-{
-    
-    if ( inp == NULL || *inp == '\0' ) {
-       return Parser_getstr(prompt, deft, answer, len);
-    } else 
-       return inp;
-}
-
-/* change a string into a number: return 0 on success. No invalid characters
-   allowed. The processing of base and validity follows strtol(3)*/
-int Parser_arg2int(const char *inp, long *result, int base)
-{
-    char *endptr;
-
-    if ( (base !=0) && (base < 2 || base > 36) )
-       return 1;
-
-    *result = strtol(inp, &endptr, base);
-
-    if ( *inp != '\0' && *endptr == '\0' )
-       return 0;
-    else 
-       return 1;
-}
-
-int Parser_quit(int argc, char **argv)
-{
-       argc = argc;
-       argv = argv;
-       exit(0);
-       return 0;
-}
diff --git a/lustre/utils/parser.h b/lustre/utils/parser.h
deleted file mode 100644 (file)
index 6bb252f..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef _PARSER_H_
-#define _PARSER_H_
-
-#define HISTORY        100             /* Don't let history grow unbounded    */
-#define MAXARGS 100
-
-typedef struct parser_cmd {
-       char    *pc_name;
-       int     (* pc_func)(int, char **);
-       struct parser_cmd * pc_sub_cmd;
-       char *pc_help;
-} command_t;
-
-typedef struct argcmd {
-       char    *ac_name;
-       int      (*ac_func)(int, char **);
-       char     *ac_help;
-} argcmd_t;
-
-int  Parser_quit(int argc, char **argv);
-void Parser_init(char *, command_t *); /* Set prompt and load command list */
-void Parser_commands(void);                    /* Start the command parser */
-void Parser_qhelp(int, char **);       /* Quick help routine */
-int Parser_help(int, char **);         /* Detailed help routine */
-void Parser_exit(int, char **);                /* Shuts down command parser */
-int Parser_execarg(int argc, char **argv, command_t cmds[]);
-void execute_line(char * line);
-
-/* Converts a string to an integer */
-int Parser_int(char *, int *);
-
-/* Prompts for a string, with default values and a maximum length */
-char *Parser_getstr(const char *prompt, const char *deft, char *res, 
-                   size_t len);
-
-/* Prompts for an integer, with minimum, maximum and default values and base */
-int Parser_getint(const char *prompt, long min, long max, long deft,
-                 int base);
-
-/* Prompts for a yes/no, with default */
-int Parser_getbool(const char *prompt, int deft);
-
-/* Extracts an integer from a string, or prompts if it cannot get one */
-long Parser_intarg(const char *inp, const char *prompt, int deft,
-                  int min, int max, int base);
-
-/* Extracts a word from the input, or propmts if it cannot get one */
-char *Parser_strarg(char *inp, const char *prompt, const char *deft,
-                   char *answer, int len);
-
-/* Extracts an integer from a string  with a base */
-int Parser_arg2int(const char *inp, long *result, int base);
-
-
-#endif