From 6ac6a67a4c5352a308171322affd569eabe23dff Mon Sep 17 00:00:00 2001 From: braam Date: Sat, 29 Dec 2001 00:20:44 +0000 Subject: [PATCH] - fixes to the MDS: it now answers requests from the request test program. - beginning of OST client/server code - needs work. --- lustre/demos/Makefile.in | 233 -------------------- lustre/include/linux/lustre_mds.h | 11 +- lustre/lib/mds_pack.c | 24 +-- lustre/lib/obd_pack.c | 191 +++++++++++++++++ lustre/mds/handler.c | 67 ++++-- lustre/obdclass/Makefile.in | 328 ---------------------------- lustre/obdfs/Makefile.in | 333 ----------------------------- lustre/ost/Makefile.am | 16 ++ lustre/ost/handler.c | 434 ++++++++++++++++++++++++++++++++++++++ lustre/scripts/Makefile.in | 186 ---------------- lustre/utils/Makefile.am | 3 +- 11 files changed, 720 insertions(+), 1106 deletions(-) delete mode 100644 lustre/demos/Makefile.in create mode 100644 lustre/lib/obd_pack.c delete mode 100644 lustre/obdclass/Makefile.in delete mode 100644 lustre/obdfs/Makefile.in create mode 100644 lustre/ost/Makefile.am create mode 100644 lustre/ost/handler.c delete mode 100644 lustre/scripts/Makefile.in diff --git a/lustre/demos/Makefile.in b/lustre/demos/Makefile.in deleted file mode 100644 index 177d824..0000000 --- a/lustre/demos/Makefile.in +++ /dev/null @@ -1,233 +0,0 @@ -# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am - -# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -# Copyright (C) 2001 Cluster File Systems, Inc. -# -# This code is issued under the GNU General Public License. -# See the file COPYING in this distribution - - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include - -DESTDIR = - -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ - -top_builddir = .. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -transform = @program_transform_name@ - -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -CC = @CC@ -KFLAGS = @KFLAGS@ -LINUX = @LINUX@ -MAKEINFO = @MAKEINFO@ -MFLAGS = @MFLAGS@ -PACKAGE = @PACKAGE@ -RANLIB = @RANLIB@ -RELEASE = @RELEASE@ -SMPFLAG = @SMPFLAG@ -VERSION = @VERSION@ -demodir = @demodir@ -docdir = @docdir@ -moduledir = @moduledir@ -modulefsdir = @modulefsdir@ - -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) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_CLEAN_FILES = -SCRIPTS = $(demo_SCRIPTS) - -DATA = $(demo_DATA) - -DIST_COMMON = Makefile.am Makefile.in - - -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = gtar -GZIP_ENV = --best -all: all-redirect -.SUFFIXES: -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu demos/Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status - - -install-demoSCRIPTS: $(demo_SCRIPTS) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(demodir) - @list='$(demo_SCRIPTS)'; for p in $$list; do \ - if test -f $$p; then \ - echo " $(INSTALL_SCRIPT) $$p $(DESTDIR)$(demodir)/`echo $$p|sed '$(transform)'`"; \ - $(INSTALL_SCRIPT) $$p $(DESTDIR)$(demodir)/`echo $$p|sed '$(transform)'`; \ - else if test -f $(srcdir)/$$p; then \ - echo " $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(demodir)/`echo $$p|sed '$(transform)'`"; \ - $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(demodir)/`echo $$p|sed '$(transform)'`; \ - else :; fi; fi; \ - done - -uninstall-demoSCRIPTS: - @$(NORMAL_UNINSTALL) - list='$(demo_SCRIPTS)'; for p in $$list; do \ - rm -f $(DESTDIR)$(demodir)/`echo $$p|sed '$(transform)'`; \ - done - -install-demoDATA: $(demo_DATA) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(demodir) - @list='$(demo_DATA)'; for p in $$list; do \ - if test -f $(srcdir)/$$p; then \ - echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(demodir)/$$p"; \ - $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(demodir)/$$p; \ - else if test -f $$p; then \ - echo " $(INSTALL_DATA) $$p $(DESTDIR)$(demodir)/$$p"; \ - $(INSTALL_DATA) $$p $(DESTDIR)$(demodir)/$$p; \ - fi; fi; \ - done - -uninstall-demoDATA: - @$(NORMAL_UNINSTALL) - list='$(demo_DATA)'; for p in $$list; do \ - rm -f $(DESTDIR)$(demodir)/$$p; \ - done -tags: TAGS -TAGS: - - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -subdir = demos - -distdir: $(DISTFILES) - here=`cd $(top_builddir) && pwd`; \ - top_distdir=`cd $(top_distdir) && pwd`; \ - distdir=`cd $(distdir) && pwd`; \ - cd $(top_srcdir) \ - && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu demos/Makefile - @for file in $(DISTFILES); do \ - d=$(srcdir); \ - if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done -info-am: -info: info-am -dvi-am: -dvi: dvi-am -check-am: all-am -check: check-am -installcheck-am: -installcheck: installcheck-am -install-exec-am: -install-exec: install-exec-am - -install-data-am: install-demoSCRIPTS install-demoDATA -install-data: install-data-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: uninstall-demoSCRIPTS uninstall-demoDATA -uninstall: uninstall-am -all-am: Makefile $(SCRIPTS) $(DATA) -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install -installdirs: - $(mkinstalldirs) $(DESTDIR)$(demodir) $(DESTDIR)$(demodir) - - -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* - -maintainer-clean-generic: -mostlyclean-am: mostlyclean-generic - -mostlyclean: mostlyclean-am - -clean-am: clean-generic mostlyclean-am - -clean: clean-am - -distclean-am: distclean-generic clean-am - -distclean: distclean-am - -maintainer-clean-am: maintainer-clean-generic distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - -maintainer-clean: maintainer-clean-am - -.PHONY: uninstall-demoSCRIPTS install-demoSCRIPTS uninstall-demoDATA \ -install-demoDATA tags distdir info-am info dvi-am dvi check check-am \ -installcheck-am installcheck install-exec-am install-exec \ -install-data-am install-data install-am install uninstall-am uninstall \ -all-redirect all-am all installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/lustre/include/linux/lustre_mds.h b/lustre/include/linux/lustre_mds.h index 3465630..e293dfb 100644 --- a/lustre/include/linux/lustre_mds.h +++ b/lustre/include/linux/lustre_mds.h @@ -45,7 +45,7 @@ struct mds_obd { #define MDS_RENAME 11 struct mds_request { - struct list_head *rq_list; + struct list_head rq_list; struct mds_obd *rq_obd; int rq_status; @@ -70,6 +70,15 @@ int mds_pack_rep(char *name, int namelen, char *tgt, int tgtlen, struct mds_rep_ int mds_unpack_rep(char *buf, int len, struct mds_rep_hdr **hdr, struct mds_rep **rep); +/* llight/request.c */ + +/* 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_MAX_NR 30 + #endif diff --git a/lustre/lib/mds_pack.c b/lustre/lib/mds_pack.c index da1c3dd..88d8188 100644 --- a/lustre/lib/mds_pack.c +++ b/lustre/lib/mds_pack.c @@ -56,7 +56,7 @@ int mds_pack_req(char *name, int namelen, char *tgt, int tgtlen, { char *ptr; - *len = sizeof(**hdr) + size_round(namelen) + sizeround(tgtlen) + + *len = sizeof(**hdr) + size_round(namelen) + size_round(tgtlen) + sizeof(**req); *buf = kmalloc(*len, GFP_KERNEL); @@ -72,12 +72,12 @@ int mds_pack_req(char *name, int namelen, char *tgt, int tgtlen, (*hdr)->type = MDS_TYPE_REQ; - (*req)->namelen = NTOH_u32(namelen); + (*req)->namelen = NTOH__u32(namelen); if (name) { LOGL(name, namelen, ptr); } - (*req)->tgtlen = NTOH_u32(tgtlen); + (*req)->tgtlen = NTOH__u32(tgtlen); if (tgt) { LOGL(tgt, tgtlen, ptr); } @@ -95,8 +95,8 @@ int mds_unpack_req(char *buf, int len, *hdr = (struct mds_req_hdr *) (buf); *req = (struct mds_req *) (buf + sizeof(**hdr)); - (*req)->namelen = NTOH_u32((*req)->namelen); - (*req)->tgtlen = NTOH_u32((*req)->namelen); + (*req)->namelen = NTOH__u32((*req)->namelen); + (*req)->tgtlen = NTOH__u32((*req)->namelen); if (len < sizeof(**hdr) + sizeof(**req) + (*req)->namelen + (*req)->tgtlen ) { @@ -112,7 +112,7 @@ int mds_unpack_req(char *buf, int len, if ((*req)->tgtlen) { (*req)->tgt = buf + sizeof(**hdr) + sizeof(**req) + - sizerount((*req)->namelen); + size_round((*req)->namelen); } else { (*req)->tgt = NULL; } @@ -127,7 +127,7 @@ int mds_pack_rep(char *name, int namelen, char *tgt, int tgtlen, { char *ptr; - *len = sizeof(**hdr) + size_round(namelen) + sizeround(tgtlen) + + *len = sizeof(**hdr) + size_round(namelen) + size_round(tgtlen) + sizeof(**rep); *buf = kmalloc(*len, GFP_KERNEL); @@ -141,12 +141,12 @@ int mds_pack_rep(char *name, int namelen, char *tgt, int tgtlen, *rep = (struct mds_rep *)(*buf + sizeof(**hdr)); ptr = *buf + sizeof(**hdr) + sizeof(**rep); - (*rep)->namelen = NTOH_u32(namelen); + (*rep)->namelen = NTOH__u32(namelen); if (name) { LOGL(name, namelen, ptr); } - (*rep)->tgtlen = NTOH_u32(tgtlen); + (*rep)->tgtlen = NTOH__u32(tgtlen); if (tgt) { LOGL(tgt, tgtlen, ptr); } @@ -164,8 +164,8 @@ int mds_unpack_rep(char *buf, int len, *hdr = (struct mds_rep_hdr *) (buf); *rep = (struct mds_rep *) (buf + sizeof(**hdr)); - (*rep)->namelen = NTOH_u32((*rep)->namelen); - (*rep)->tgtlen = NTOH_u32((*rep)->namelen); + (*rep)->namelen = NTOH__u32((*rep)->namelen); + (*rep)->tgtlen = NTOH__u32((*rep)->namelen); if (len < sizeof(**hdr) + sizeof(**rep) + (*rep)->namelen + (*rep)->tgtlen ) { @@ -181,7 +181,7 @@ int mds_unpack_rep(char *buf, int len, if ((*rep)->tgtlen) { (*rep)->tgt = buf + sizeof(**hdr) + sizeof(**rep) + - sizerount((*rep)->namelen); + size_round((*rep)->namelen); } else { (*rep)->tgt = NULL; } diff --git a/lustre/lib/obd_pack.c b/lustre/lib/obd_pack.c new file mode 100644 index 0000000..88d8188 --- /dev/null +++ b/lustre/lib/obd_pack.c @@ -0,0 +1,191 @@ +/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- + * vim:expandtab:shiftwidth=8:tabstop=8: + * + * Copyright (C) 2001 Cluster File Systems, Inc. + * + * This file is part of InterMezzo, http://www.inter-mezzo.org. + * + * InterMezzo 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. + * + * InterMezzo 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 InterMezzo; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Unpacking of KML records + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + + +int mds_pack_req(char *name, int namelen, char *tgt, int tgtlen, + struct mds_req_hdr **hdr, struct mds_req **req, + int *len, char **buf) +{ + char *ptr; + + *len = sizeof(**hdr) + size_round(namelen) + size_round(tgtlen) + + sizeof(**req); + + *buf = kmalloc(*len, GFP_KERNEL); + if (!*buf) { + EXIT; + return -ENOMEM; + } + + memset(*buf, 0, *len); + *hdr = (struct mds_req_hdr *)(*buf); + *req = (struct mds_req *)(*buf + sizeof(**hdr)); + 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 mds_req_hdr **hdr, struct mds_req **req) +{ + if (len < sizeof(**hdr) + sizeof(**req)) { + EXIT; + return -EINVAL; + } + + *hdr = (struct mds_req_hdr *) (buf); + *req = (struct mds_req *) (buf + sizeof(**hdr)); + (*req)->namelen = NTOH__u32((*req)->namelen); + (*req)->tgtlen = NTOH__u32((*req)->namelen); + + if (len < sizeof(**hdr) + sizeof(**req) + (*req)->namelen + + (*req)->tgtlen ) { + EXIT; + return -EINVAL; + } + + if ((*req)->namelen) { + (*req)->name = buf + sizeof(**hdr) + sizeof(**req); + } else { + (*req)->name = NULL; + } + + if ((*req)->tgtlen) { + (*req)->tgt = buf + sizeof(**hdr) + sizeof(**req) + + size_round((*req)->namelen); + } else { + (*req)->tgt = NULL; + } + + EXIT; + return 0; +} + +int mds_pack_rep(char *name, int namelen, char *tgt, int tgtlen, + struct mds_rep_hdr **hdr, struct mds_rep **rep, + int *len, char **buf) +{ + char *ptr; + + *len = sizeof(**hdr) + size_round(namelen) + size_round(tgtlen) + + sizeof(**rep); + + *buf = kmalloc(*len, GFP_KERNEL); + if (!*buf) { + EXIT; + return -ENOMEM; + } + + memset(*buf, 0, *len); + *hdr = (struct mds_rep_hdr *)(*buf); + *rep = (struct mds_rep *)(*buf + sizeof(**hdr)); + ptr = *buf + sizeof(**hdr) + sizeof(**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 mds_rep_hdr **hdr, struct mds_rep **rep) +{ + if (len < sizeof(**hdr) + sizeof(**rep)) { + EXIT; + return -EINVAL; + } + + *hdr = (struct mds_rep_hdr *) (buf); + *rep = (struct mds_rep *) (buf + sizeof(**hdr)); + (*rep)->namelen = NTOH__u32((*rep)->namelen); + (*rep)->tgtlen = NTOH__u32((*rep)->namelen); + + if (len < sizeof(**hdr) + sizeof(**rep) + (*rep)->namelen + + (*rep)->tgtlen ) { + EXIT; + return -EINVAL; + } + + if ((*rep)->namelen) { + (*rep)->name = buf + sizeof(**hdr) + sizeof(**rep); + } else { + (*rep)->name = NULL; + } + + if ((*rep)->tgtlen) { + (*rep)->tgt = buf + sizeof(**hdr) + sizeof(**rep) + + size_round((*rep)->namelen); + } else { + (*rep)->tgt = NULL; + } + + EXIT; + return 0; +} diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index 2380d69..fe58fbc 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -1,14 +1,20 @@ /* - * linux/fs/ext2_obd/ext2_obd.c + * linux/mds/handler.c + * + * Lustre Metadata Server (mds) request handler + * + * Copyright (C) 2001 Cluster File Systems, Inc. * - * Copyright (C) 2001 Cluster File Systems, Inc. + * This code is issued under the GNU General Public License. + * See the file COPYING in this distribution * - * This code is issued under the GNU General Public License. - * See the file COPYING in this distribution - * - * by Peter Braam + * by Peter Braam + * + * This server is single threaded at present (but can easily be multi threaded). + * */ + #define EXPORT_SYMTAB #include @@ -26,6 +32,27 @@ #include #include +// for testing +static struct mds_obd *MDS; + +// for testing +static int mds_queue_req(struct mds_request *req) +{ + + if (!MDS) { + EXIT; + return -1; + } + + list_add(&req->rq_list, &MDS->mds_reqs); + init_waitqueue_head(&req->rq_wait_for_mds_rep); + req->rq_obd = MDS; + wake_up(&MDS->mds_waitq); + printk("-- sleeping\n"); + interruptible_sleep_on(&req->rq_wait_for_mds_rep); + printk("-- done\n"); + return 0; +} static struct dentry *mds_fid2dentry(struct mds_obd *mds, struct lustre_fid *fid) { @@ -52,7 +79,7 @@ int mds_getattr(struct mds_request *req) { struct dentry *de = mds_fid2dentry(req->rq_obd, &req->rq_req->fid1); struct inode *inode; - struct mds_rep *rep = req->rq_rep; + struct mds_rep *rep; int rc; rc = mds_pack_rep(NULL, 0, NULL, 0, &req->rq_rephdr, &req->rq_rep, @@ -65,6 +92,7 @@ int mds_getattr(struct mds_request *req) } req->rq_rephdr->seqno = req->rq_reqhdr->seqno; + rep = req->rq_rep; if (!de) { EXIT; @@ -81,6 +109,7 @@ int mds_getattr(struct mds_request *req) rep->size = inode->i_size; rep->mode = inode->i_mode; + dput(de); return 0; } @@ -126,9 +155,9 @@ int mds_handle(struct mds_request *req) hdr = (struct mds_req_hdr *)req->rq_reqbuf; - if (NTOH_u32(hdr->type) != MDS_TYPE_REQ) { + if (NTOH__u32(hdr->type) != MDS_TYPE_REQ) { printk("lustre_mds: wrong packet type sent %d\n", - NTOH_u32(hdr->type)); + NTOH__u32(hdr->type)); rc = -EINVAL; goto out; } @@ -227,13 +256,16 @@ int mds_main(void *arg) mds->mds_thread = current; wake_up(&mds->mds_done_waitq); - printk(KERN_INFO "lustre_mds starting. Commit interval %ld seconds\n", + printk(KERN_INFO "lustre_mds starting. Commit interval %d seconds\n", mds->mds_interval / HZ); /* XXX maintain a list of all managed devices: insert here */ /* And now, wait forever for commit wakeup events. */ while (1) { + struct mds_request *request; + int rc; + if (mds->mds_flags & MDS_UNMOUNT) break; @@ -246,6 +278,11 @@ int mds_main(void *arg) if (list_empty(&mds->mds_reqs)) { CDEBUG(D_INODE, "woke because of timer\n"); + } else { + request = list_entry(mds->mds_reqs.next, + struct mds_request, rq_list); + list_del(&request->rq_list); + rc = mds_handle(request); } } @@ -314,6 +351,7 @@ static int mds_setup(struct obd_device *obddev, obd_count len, mds->mds_ctxt.pwdmnt = mnt; mds->mds_ctxt.pwd = mnt->mnt_root; mds->mds_ctxt.fs = KERNEL_DS; + MDS = mds; spin_lock_init(&obddev->u.mds.fo_lock); @@ -342,6 +380,7 @@ static int mds_cleanup(struct obd_device * obddev) return -EBUSY; } + MDS = NULL; mds_stop_srv_thread(mds); sb = mds->mds_sb; if (!mds->mds_sb){ @@ -374,8 +413,8 @@ static struct obd_ops mds_obd_ops = { static int __init mds_init(void) { - printk(KERN_INFO "Lustre MDS v0.01, braam@clusterfs.com\n"); obd_register_type(&mds_obd_ops, LUSTRE_MDS_NAME); + return 0; } static void __exit mds_exit(void) @@ -384,8 +423,12 @@ static void __exit mds_exit(void) } MODULE_AUTHOR("Peter J. Braam "); -MODULE_DESCRIPTION("Lustre Metadata server module"); +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/obdclass/Makefile.in b/lustre/obdclass/Makefile.in deleted file mode 100644 index 45b7007..0000000 --- a/lustre/obdclass/Makefile.in +++ /dev/null @@ -1,328 +0,0 @@ -# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am - -# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - - -# Copyright (C) 2001 Cluster File Systems, Inc. -# -# This code is issued under the GNU General Public License. -# See the file COPYING in this distribution - -# Build a kernel module, name.o, and install it in $(moduledir) by: -# MODULE = name -# module_DATA = name.o -# EXTRA_PROGRAMS = name -# name_SOURCES = my.c files.c -# include $(top_srcdir)/Rules - - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include - -DESTDIR = - -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ - -top_builddir = .. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -transform = @program_transform_name@ - -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -CC = @CC@ -KFLAGS = @KFLAGS@ -LINUX = @LINUX@ -MAKEINFO = @MAKEINFO@ -MFLAGS = @MFLAGS@ -PACKAGE = @PACKAGE@ -RANLIB = @RANLIB@ -RELEASE = @RELEASE@ -SMPFLAG = @SMPFLAG@ -VERSION = @VERSION@ -demodir = @demodir@ -docdir = @docdir@ -moduledir = @moduledir@ -modulefsdir = @modulefsdir@ - -MODULE = obdclass -modulefs_DATA = obdclass.o -EXTRA_PROGRAMS = obdclass -obdclass_SOURCES = genops.c proc_lustre.c class_obd.c sysctl.c -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_CLEAN_FILES = - -DEFS = @DEFS@ -I. -I$(srcdir) -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ -obdclass_OBJECTS = genops.o proc_lustre.o class_obd.o sysctl.o -obdclass_LDADD = $(LDADD) -obdclass_DEPENDENCIES = -obdclass_LDFLAGS = -CFLAGS = @CFLAGS@ -COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ -DATA = $(modulefs_DATA) - -DIST_COMMON = Makefile.am Makefile.in - - -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = gtar -GZIP_ENV = --best -DEP_FILES = .deps/class_obd.P .deps/genops.P .deps/proc_lustre.P \ -.deps/sysctl.P -SOURCES = $(obdclass_SOURCES) -OBJECTS = $(obdclass_OBJECTS) - -all: all-redirect -.SUFFIXES: -.SUFFIXES: .S .c .o .s -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/Rules - cd $(top_srcdir) && $(AUTOMAKE) --gnu class/Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status - - -.s.o: - $(COMPILE) -c $< - -.S.o: - $(COMPILE) -c $< - -mostlyclean-compile: - -rm -f *.o core *.core - -clean-compile: - -distclean-compile: - -rm -f *.tab.c - -maintainer-clean-compile: - -obdclass: $(obdclass_OBJECTS) $(obdclass_DEPENDENCIES) - @rm -f obdclass - $(LINK) $(obdclass_LDFLAGS) $(obdclass_OBJECTS) $(obdclass_LDADD) $(LIBS) - -install-modulefsDATA: $(modulefs_DATA) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(modulefsdir) - @list='$(modulefs_DATA)'; for p in $$list; do \ - if test -f $(srcdir)/$$p; then \ - echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(modulefsdir)/$$p"; \ - $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(modulefsdir)/$$p; \ - else if test -f $$p; then \ - echo " $(INSTALL_DATA) $$p $(DESTDIR)$(modulefsdir)/$$p"; \ - $(INSTALL_DATA) $$p $(DESTDIR)$(modulefsdir)/$$p; \ - fi; fi; \ - done - -uninstall-modulefsDATA: - @$(NORMAL_UNINSTALL) - list='$(modulefs_DATA)'; for p in $$list; do \ - rm -f $(DESTDIR)$(modulefsdir)/$$p; \ - done - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - here=`pwd` && cd $(srcdir) \ - && mkid -f$$here/ID $$unique $(LISP) - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) - -mostlyclean-tags: - -clean-tags: - -distclean-tags: - -rm -f TAGS ID - -maintainer-clean-tags: - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -subdir = class - -distdir: $(DISTFILES) - here=`cd $(top_builddir) && pwd`; \ - top_distdir=`cd $(top_distdir) && pwd`; \ - distdir=`cd $(distdir) && pwd`; \ - cd $(top_srcdir) \ - && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu class/Makefile - @for file in $(DISTFILES); do \ - d=$(srcdir); \ - if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done - -DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) - --include $(DEP_FILES) - -mostlyclean-depend: - -clean-depend: - -distclean-depend: - -rm -rf .deps - -maintainer-clean-depend: - -%.o: %.c - @echo '$(COMPILE) -c $<'; \ - $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< - @-cp .deps/$(*F).pp .deps/$(*F).P; \ - tr ' ' '\012' < .deps/$(*F).pp \ - | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ - >> .deps/$(*F).P; \ - rm .deps/$(*F).pp - -%.lo: %.c - @echo '$(LTCOMPILE) -c $<'; \ - $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< - @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ - < .deps/$(*F).pp > .deps/$(*F).P; \ - tr ' ' '\012' < .deps/$(*F).pp \ - | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ - >> .deps/$(*F).P; \ - rm -f .deps/$(*F).pp -info-am: -info: info-am -dvi-am: -dvi: dvi-am -check-am: all-am -check: check-am -installcheck-am: -installcheck: installcheck-am -install-exec-am: -install-exec: install-exec-am - -install-data-am: install-modulefsDATA -install-data: install-data-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: uninstall-modulefsDATA -uninstall: uninstall-am -all-am: Makefile $(DATA) -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install -installdirs: - $(mkinstalldirs) $(DESTDIR)$(modulefsdir) - - -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* - -maintainer-clean-generic: -mostlyclean-am: mostlyclean-compile mostlyclean-tags mostlyclean-depend \ - mostlyclean-generic - -mostlyclean: mostlyclean-am - -clean-am: clean-compile clean-tags clean-depend clean-generic \ - mostlyclean-am - -clean: clean-am - -distclean-am: distclean-compile distclean-tags distclean-depend \ - distclean-generic clean-am - -distclean: distclean-am - -maintainer-clean-am: maintainer-clean-compile maintainer-clean-tags \ - maintainer-clean-depend maintainer-clean-generic \ - distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - -maintainer-clean: maintainer-clean-am - -.PHONY: mostlyclean-compile distclean-compile clean-compile \ -maintainer-clean-compile uninstall-modulefsDATA install-modulefsDATA \ -tags mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \ -distdir mostlyclean-depend distclean-depend clean-depend \ -maintainer-clean-depend info-am info dvi-am dvi check check-am \ -installcheck-am installcheck install-exec-am install-exec \ -install-data-am install-data install-am install uninstall-am uninstall \ -all-redirect all-am all installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean - - -$(MODULE).o: $($(MODULE)_OBJECTS) - $(LD) -m "`$(LD) --help | awk '/supported emulations/ {print $$4}'`" -r -o $(MODULE).o $($(MODULE)_OBJECTS) - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/lustre/obdfs/Makefile.in b/lustre/obdfs/Makefile.in deleted file mode 100644 index 84ba0b5..0000000 --- a/lustre/obdfs/Makefile.in +++ /dev/null @@ -1,333 +0,0 @@ -# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am - -# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -# Copyright (C) 2001 Cluster File Systems, Inc. -# -# This code is issued under the GNU General Public License. -# See the file COPYING in this distribution - - -# Copyright (C) 2001 Cluster File Systems, Inc. -# -# This code is issued under the GNU General Public License. -# See the file COPYING in this distribution - -# Build a kernel module, name.o, and install it in $(moduledir) by: -# MODULE = name -# module_DATA = name.o -# EXTRA_PROGRAMS = name -# name_SOURCES = my.c files.c -# include $(top_srcdir)/Rules - - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include - -DESTDIR = - -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ - -top_builddir = .. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -transform = @program_transform_name@ - -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -CC = @CC@ -KFLAGS = @KFLAGS@ -LINUX = @LINUX@ -MAKEINFO = @MAKEINFO@ -MFLAGS = @MFLAGS@ -PACKAGE = @PACKAGE@ -RANLIB = @RANLIB@ -RELEASE = @RELEASE@ -SMPFLAG = @SMPFLAG@ -VERSION = @VERSION@ -demodir = @demodir@ -docdir = @docdir@ -moduledir = @moduledir@ -modulefsdir = @modulefsdir@ - -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 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_CLEAN_FILES = - -DEFS = @DEFS@ -I. -I$(srcdir) -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ -obdfs_OBJECTS = rw.o file.o dir.o sysctl.o super.o namei.o symlink.o -obdfs_LDADD = $(LDADD) -obdfs_DEPENDENCIES = -obdfs_LDFLAGS = -CFLAGS = @CFLAGS@ -COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ -DATA = $(modulefs_DATA) - -DIST_COMMON = README Makefile.am Makefile.in - - -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = gtar -GZIP_ENV = --best -DEP_FILES = .deps/dir.P .deps/file.P .deps/namei.P .deps/rw.P \ -.deps/super.P .deps/symlink.P .deps/sysctl.P -SOURCES = $(obdfs_SOURCES) -OBJECTS = $(obdfs_OBJECTS) - -all: all-redirect -.SUFFIXES: -.SUFFIXES: .S .c .o .s -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/Rules - cd $(top_srcdir) && $(AUTOMAKE) --gnu obdfs/Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status - - -.s.o: - $(COMPILE) -c $< - -.S.o: - $(COMPILE) -c $< - -mostlyclean-compile: - -rm -f *.o core *.core - -clean-compile: - -distclean-compile: - -rm -f *.tab.c - -maintainer-clean-compile: - -obdfs: $(obdfs_OBJECTS) $(obdfs_DEPENDENCIES) - @rm -f obdfs - $(LINK) $(obdfs_LDFLAGS) $(obdfs_OBJECTS) $(obdfs_LDADD) $(LIBS) - -install-modulefsDATA: $(modulefs_DATA) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(modulefsdir) - @list='$(modulefs_DATA)'; for p in $$list; do \ - if test -f $(srcdir)/$$p; then \ - echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(modulefsdir)/$$p"; \ - $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(modulefsdir)/$$p; \ - else if test -f $$p; then \ - echo " $(INSTALL_DATA) $$p $(DESTDIR)$(modulefsdir)/$$p"; \ - $(INSTALL_DATA) $$p $(DESTDIR)$(modulefsdir)/$$p; \ - fi; fi; \ - done - -uninstall-modulefsDATA: - @$(NORMAL_UNINSTALL) - list='$(modulefs_DATA)'; for p in $$list; do \ - rm -f $(DESTDIR)$(modulefsdir)/$$p; \ - done - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - here=`pwd` && cd $(srcdir) \ - && mkid -f$$here/ID $$unique $(LISP) - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) - -mostlyclean-tags: - -clean-tags: - -distclean-tags: - -rm -f TAGS ID - -maintainer-clean-tags: - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -subdir = obdfs - -distdir: $(DISTFILES) - here=`cd $(top_builddir) && pwd`; \ - top_distdir=`cd $(top_distdir) && pwd`; \ - distdir=`cd $(distdir) && pwd`; \ - cd $(top_srcdir) \ - && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu obdfs/Makefile - @for file in $(DISTFILES); do \ - d=$(srcdir); \ - if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done - -DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) - --include $(DEP_FILES) - -mostlyclean-depend: - -clean-depend: - -distclean-depend: - -rm -rf .deps - -maintainer-clean-depend: - -%.o: %.c - @echo '$(COMPILE) -c $<'; \ - $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< - @-cp .deps/$(*F).pp .deps/$(*F).P; \ - tr ' ' '\012' < .deps/$(*F).pp \ - | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ - >> .deps/$(*F).P; \ - rm .deps/$(*F).pp - -%.lo: %.c - @echo '$(LTCOMPILE) -c $<'; \ - $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< - @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ - < .deps/$(*F).pp > .deps/$(*F).P; \ - tr ' ' '\012' < .deps/$(*F).pp \ - | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ - >> .deps/$(*F).P; \ - rm -f .deps/$(*F).pp -info-am: -info: info-am -dvi-am: -dvi: dvi-am -check-am: all-am -check: check-am -installcheck-am: -installcheck: installcheck-am -install-exec-am: -install-exec: install-exec-am - -install-data-am: install-modulefsDATA -install-data: install-data-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: uninstall-modulefsDATA -uninstall: uninstall-am -all-am: Makefile $(DATA) -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install -installdirs: - $(mkinstalldirs) $(DESTDIR)$(modulefsdir) - - -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* - -maintainer-clean-generic: -mostlyclean-am: mostlyclean-compile mostlyclean-tags mostlyclean-depend \ - mostlyclean-generic - -mostlyclean: mostlyclean-am - -clean-am: clean-compile clean-tags clean-depend clean-generic \ - mostlyclean-am - -clean: clean-am - -distclean-am: distclean-compile distclean-tags distclean-depend \ - distclean-generic clean-am - -distclean: distclean-am - -maintainer-clean-am: maintainer-clean-compile maintainer-clean-tags \ - maintainer-clean-depend maintainer-clean-generic \ - distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - -maintainer-clean: maintainer-clean-am - -.PHONY: mostlyclean-compile distclean-compile clean-compile \ -maintainer-clean-compile uninstall-modulefsDATA install-modulefsDATA \ -tags mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \ -distdir mostlyclean-depend distclean-depend clean-depend \ -maintainer-clean-depend info-am info dvi-am dvi check check-am \ -installcheck-am installcheck install-exec-am install-exec \ -install-data-am install-data install-am install uninstall-am uninstall \ -all-redirect all-am all installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean - - -$(MODULE).o: $($(MODULE)_OBJECTS) - $(LD) -m "`$(LD) --help | awk '/supported emulations/ {print $$4}'`" -r -o $(MODULE).o $($(MODULE)_OBJECTS) - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/lustre/ost/Makefile.am b/lustre/ost/Makefile.am new file mode 100644 index 0000000..31965cb --- /dev/null +++ b/lustre/ost/Makefile.am @@ -0,0 +1,16 @@ +# Copyright (C) 2001 Cluster File Systems, Inc. +# +# This code is issued under the GNU General Public License. +# See the file COPYING in this distribution + +MODULE = ost +modulefs_DATA = ost.o +EXTRA_PROGRAMS = ost + +obd_pack.c: + ln -s ../lib/obd_pack.c . + +ost_SOURCES = obd_pack.c handler.c + +include $(top_srcdir)/Rules + diff --git a/lustre/ost/handler.c b/lustre/ost/handler.c new file mode 100644 index 0000000..fe58fbc --- /dev/null +++ b/lustre/ost/handler.c @@ -0,0 +1,434 @@ +/* + * linux/mds/handler.c + * + * Lustre Metadata Server (mds) request handler + * + * 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 + * + * This server is single threaded at present (but can easily be multi threaded). + * + */ + + +#define EXPORT_SYMTAB + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// for testing +static struct mds_obd *MDS; + +// for testing +static int mds_queue_req(struct mds_request *req) +{ + + if (!MDS) { + EXIT; + return -1; + } + + list_add(&req->rq_list, &MDS->mds_reqs); + init_waitqueue_head(&req->rq_wait_for_mds_rep); + req->rq_obd = MDS; + wake_up(&MDS->mds_waitq); + printk("-- sleeping\n"); + interruptible_sleep_on(&req->rq_wait_for_mds_rep); + printk("-- done\n"); + return 0; +} + +static struct dentry *mds_fid2dentry(struct mds_obd *mds, struct lustre_fid *fid) +{ + struct dentry *de; + struct inode *inode; + + inode = iget(mds->mds_sb, fid->id); + if (!inode) { + EXIT; + } + + de = d_alloc_root(inode); + if (!de) { + iput(inode); + EXIT; + return NULL; + } + + de->d_inode = inode; + return de; +} + +int mds_getattr(struct mds_request *req) +{ + struct dentry *de = mds_fid2dentry(req->rq_obd, &req->rq_req->fid1); + 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; + printk("mds: out of memory\n"); + req->rq_status = -ENOMEM; + return -ENOMEM; + } + + req->rq_rephdr->seqno = req->rq_reqhdr->seqno; + rep = req->rq_rep; + + if (!de) { + EXIT; + req->rq_rephdr->status = -ENOENT; + return 0; + } + + inode = de->d_inode; + 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; + + dput(de); + return 0; +} + +int mds_reply(struct mds_request *req) +{ + ENTRY; + kfree(req->rq_reqbuf); + req->rq_reqbuf = NULL; + wake_up_interruptible(&req->rq_wait_for_mds_rep); + EXIT; + return 0; +} + +int mds_error(struct mds_request *req) +{ + struct mds_rep_hdr *hdr; + + ENTRY; + hdr = kmalloc(sizeof(*hdr), GFP_KERNEL); + 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; + + EXIT; + return mds_reply(req); +} + +//int mds_handle(struct mds_conn *conn, int len, char *buf) +int mds_handle(struct mds_request *req) +{ + int rc; + struct mds_req_hdr *hdr; + + ENTRY; + + hdr = (struct mds_req_hdr *)req->rq_reqbuf; + + if (NTOH__u32(hdr->type) != MDS_TYPE_REQ) { + printk("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) { + printk("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_OPEN: + return mds_getattr(req); + + case MDS_SETATTR: + return mds_getattr(req); + + case MDS_CREATE: + return mds_getattr(req); + + case MDS_MKDIR: + return mds_getattr(req); + + case MDS_RMDIR: + return mds_getattr(req); + + case MDS_SYMLINK: + return mds_getattr(req); + + case MDS_LINK: + return mds_getattr(req); + + case MDS_MKNOD: + return mds_getattr(req); + + case MDS_UNLINK: + return mds_getattr(req); + + case MDS_RENAME: + return mds_getattr(req); + + default: + return mds_error(req); + } + +out: + if (rc) { + printk("mds: processing error %d\n", rc); + 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; + + lock_kernel(); + daemonize(); + spin_lock_irq(¤t->sigmask_lock); + sigfillset(¤t->blocked); + recalc_sigpending(current); + spin_unlock_irq(¤t->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; + wake_up(&mds->mds_done_waitq); + + printk(KERN_INFO "lustre_mds starting. Commit interval %d seconds\n", + mds->mds_interval / HZ); + + /* XXX maintain a list of all managed devices: insert here */ + + /* And now, wait forever for commit wakeup events. */ + while (1) { + struct mds_request *request; + int rc; + + if (mds->mds_flags & MDS_UNMOUNT) + break; + + + wake_up(&mds->mds_done_waitq); + interruptible_sleep_on(&mds->mds_waitq); + + CDEBUG(D_INODE, "lustre_mds wakes\n"); + CDEBUG(D_INODE, "pick up req here and continue\n"); + + if (list_empty(&mds->mds_reqs)) { + CDEBUG(D_INODE, "woke because of timer\n"); + } else { + request = list_entry(mds->mds_reqs.next, + struct mds_request, rq_list); + list_del(&request->rq_list); + 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); + printk("lustre_mds: exiting\n"); + return 0; +} + +static void mds_stop_srv_thread(struct mds_obd *mds) +{ + mds->mds_flags |= MDS_UNMOUNT; + + 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; + 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; + } + + INIT_LIST_HEAD(&mds->mds_reqs); + mds->mds_thread = NULL; + mds->mds_flags = 0; + mds->mds_interval = 3 * HZ; + 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; + + spin_lock_init(&obddev->u.mds.fo_lock); + + 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) ) { + printk(KERN_WARNING __FUNCTION__ ": still has clients!\n"); + EXIT; + return -EBUSY; + } + + MDS = NULL; + mds_stop_srv_thread(mds); + 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 "); +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/scripts/Makefile.in b/lustre/scripts/Makefile.in deleted file mode 100644 index 4e5fad9..0000000 --- a/lustre/scripts/Makefile.in +++ /dev/null @@ -1,186 +0,0 @@ -# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am - -# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -# Copyright (C) 2001 Cluster File Systems, Inc. -# -# This code is issued under the GNU General Public License. -# See the file COPYING in this distribution - - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include - -DESTDIR = - -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ - -top_builddir = .. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -transform = @program_transform_name@ - -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -CC = @CC@ -KFLAGS = @KFLAGS@ -LINUX = @LINUX@ -MAKEINFO = @MAKEINFO@ -MFLAGS = @MFLAGS@ -PACKAGE = @PACKAGE@ -RANLIB = @RANLIB@ -RELEASE = @RELEASE@ -SMPFLAG = @SMPFLAG@ -VERSION = @VERSION@ -demodir = @demodir@ -docdir = @docdir@ -moduledir = @moduledir@ -modulefsdir = @modulefsdir@ - -EXTRA_DIST = license-status maketags.sh mkobddevs obd.spec obdtrace_demo.scr -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_CLEAN_FILES = -DIST_COMMON = Makefile.am Makefile.in - - -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = gtar -GZIP_ENV = --best -all: all-redirect -.SUFFIXES: -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status - -tags: TAGS -TAGS: - - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -subdir = scripts - -distdir: $(DISTFILES) - here=`cd $(top_builddir) && pwd`; \ - top_distdir=`cd $(top_distdir) && pwd`; \ - distdir=`cd $(distdir) && pwd`; \ - cd $(top_srcdir) \ - && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu scripts/Makefile - @for file in $(DISTFILES); do \ - d=$(srcdir); \ - if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done -info-am: -info: info-am -dvi-am: -dvi: dvi-am -check-am: all-am -check: check-am -installcheck-am: -installcheck: installcheck-am -install-exec-am: -install-exec: install-exec-am - -install-data-am: -install-data: install-data-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: -uninstall: uninstall-am -all-am: Makefile -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install -installdirs: - - -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* - -maintainer-clean-generic: -mostlyclean-am: mostlyclean-generic - -mostlyclean: mostlyclean-am - -clean-am: clean-generic mostlyclean-am - -clean: clean-am - -distclean-am: distclean-generic clean-am - -distclean: distclean-am - -maintainer-clean-am: maintainer-clean-generic distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - -maintainer-clean: maintainer-clean-am - -.PHONY: tags distdir info-am info dvi-am dvi check check-am \ -installcheck-am installcheck install-exec-am install-exec \ -install-data-am install-data install-am install uninstall-am uninstall \ -all-redirect all-am all installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/lustre/utils/Makefile.am b/lustre/utils/Makefile.am index 2e8010b..1dc91d6 100644 --- a/lustre/utils/Makefile.am +++ b/lustre/utils/Makefile.am @@ -5,6 +5,7 @@ CFLAGS:=-g -I. -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I../include -Wal KFLAGS:= CPPFLAGS := LDADD := -lreadline -ltermcap # -lefence -bin_PROGRAMS = obdctl +bin_PROGRAMS = obdctl testreq obdctl_SOURCES = parser.c obdctl.c +testreq_SOURCES = testreq.c -- 1.8.3.1