From 30462b862782e07ad1c43d60ad271f34052df6f4 Mon Sep 17 00:00:00 2001 From: braam Date: Sat, 29 Sep 2001 19:59:42 +0000 Subject: [PATCH] Fixes to get things running on 2.4.3. - iozone runs very well - copying large trees fails when debugging is enabled --- lustre/demos/baseclean.sh | 2 +- lustre/demos/basesetup.sh | 2 +- lustre/demos/config.sh | 3 +- lustre/demos/obdfssetup.sh | 1 - lustre/obdclass/class_obd.c | 63 ++++++++++++++++++++++------------ lustre/patches/patch-2.4.3-empty-super | 31 +++++++++++++++++ 6 files changed, 76 insertions(+), 26 deletions(-) create mode 100644 lustre/patches/patch-2.4.3-empty-super diff --git a/lustre/demos/baseclean.sh b/lustre/demos/baseclean.sh index 033c8d8..93730ee 100755 --- a/lustre/demos/baseclean.sh +++ b/lustre/demos/baseclean.sh @@ -33,7 +33,7 @@ if [ "$LOOPDEV" ]; then rmmod loop > /dev/null 2>&1 fi -if [ "$TMPFILE" -a -f "$TMPFILE" ]; then +if [ "$LOOPDEV" -a "$TMPFILE" -a -f "$TMPFILE" ]; then rm -i $TMPFILE fi diff --git a/lustre/demos/basesetup.sh b/lustre/demos/basesetup.sh index ba7db5b..f2cf372 100755 --- a/lustre/demos/basesetup.sh +++ b/lustre/demos/basesetup.sh @@ -25,7 +25,7 @@ fi # temp file -if [ "$TMPFILE" -a -f $TMPFILE ]; then +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 diff --git a/lustre/demos/config.sh b/lustre/demos/config.sh index 2ff55e3..5a5140d 100644 --- a/lustre/demos/config.sh +++ b/lustre/demos/config.sh @@ -25,7 +25,8 @@ OBDMAJ=186 # 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!! -BASEDEV="$LOOPDEV" +LOOPDEV="" +BASEDEV="/dev/hda5" # The following are mount points for the filesystems during the test. MNTOBD="/mnt/obd" diff --git a/lustre/demos/obdfssetup.sh b/lustre/demos/obdfssetup.sh index c88e92e..bff240c 100755 --- a/lustre/demos/obdfssetup.sh +++ b/lustre/demos/obdfssetup.sh @@ -10,7 +10,6 @@ OBDDIR="`dirname $0`/.." . $OBDDIR/demos/config.sh $OBDDIR/demos/basesetup.sh -#losetup /dev/loop0 /tmp/obdfs.tmpfile if [ x$? != x0 ]; then echo "Error running basesetup.sh" diff --git a/lustre/obdclass/class_obd.c b/lustre/obdclass/class_obd.c index 68fa910..d29ed08 100644 --- a/lustre/obdclass/class_obd.c +++ b/lustre/obdclass/class_obd.c @@ -23,6 +23,7 @@ * Copyright (c) 1999 Stelias Computing, Inc. * (authors {pschwan,braam}@stelias.com) * Copyright (C) 1999 Seagate Technology, Inc. + * Copyright (C) 2001 Cluster File Systems, Inc. * * */ @@ -115,8 +116,11 @@ static int obd_class_release(struct inode * inode, struct file * file) return 0; } -/* support function */ -static struct obd_type *obd_nm_to_type(char *nm) +/* + * 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; @@ -131,7 +135,24 @@ static struct obd_type *obd_nm_to_type(char *nm) return type; } } - return NULL; + 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_PSDEV, "Loaded module '%s'\n", nm); + type = obd_search_type(nm); + } else { + CDEBUG(D_PSDEV, "Can't load module '%s'\n", nm); + } + } +#endif + return type; } @@ -163,18 +184,23 @@ static int getdata(int len, void **data) static int obd_devicename_from_path(obd_devicename* whoami, uint32_t klen, - char* kname) + char* kname, char *user_path) { + int err; + struct nameidata nd; whoami->len = klen; whoami->name = kname; -/* err = user_path_walk(user_string, &nd); */ -/* if (!err) { */ -/* whoami->dentry = nd.dentry; */ -/* path_release(&nd); */ -/* } */ -/* return err; */ +#if (LINUX_VERSION_CODE <= 0x20403) + err = user_path_walk(user_path, &nd); + if (!err) { + CDEBUG(D_INFO, "found dentry for %s\n", kname); + whoami->dentry = nd.dentry; + path_release(&nd); + } + return err; +#endif return 0; } @@ -238,16 +264,6 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp, /* find the type */ nm = input->att_type; type = obd_nm_to_type(nm); -#ifdef CONFIG_KMOD - if ( !type ) { - if ( !request_module(nm) ) { - CDEBUG(D_PSDEV, "Loaded module '%s'\n", nm); - type = obd_nm_to_type(nm); - } else { - CDEBUG(D_PSDEV, "Can't load module '%s'\n", nm); - } - } -#endif OBD_FREE(input->att_type, input->att_typelen + 1); if ( !type ) { @@ -339,6 +355,7 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp, int setup_datalen; void *setup_data; } *setup; + char *user_path; setup = tmp_buf; @@ -367,7 +384,8 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp, EXIT; return err; } - + user_path = setup->setup_data; + /* get the attach data */ err = getdata(setup->setup_datalen, &setup->setup_data); if ( err ) { @@ -377,7 +395,8 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp, err = obd_devicename_from_path(&(obddev->obd_fsname), setup->setup_datalen, - (char*) setup->setup_data); + (char*) setup->setup_data, + user_path); if (err) { memset(&(obddev->obd_fsname), 0, sizeof(obd_devicename)); EXIT; diff --git a/lustre/patches/patch-2.4.3-empty-super b/lustre/patches/patch-2.4.3-empty-super new file mode 100644 index 0000000..02603fd --- /dev/null +++ b/lustre/patches/patch-2.4.3-empty-super @@ -0,0 +1,31 @@ +--- 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); -- 1.8.3.1