From 1d03a4f8459d174fe921be7201350b9c80ebe750 Mon Sep 17 00:00:00 2001 From: vitaly Date: Fri, 30 Jun 2006 15:05:36 +0000 Subject: [PATCH] Merge b1_5 from b1_4 (20060630_1438) --- .../patches/ext3-lookup-dotdot-2.6.9.patch | 4 +- lustre/include/linux/obd.h | 1 - lustre/include/lustre/liblustreapi.h | 5 +- lustre/include/lustre_net.h | 15 +- lustre/include/obd.h | 2 +- lustre/include/obd_class.h | 7 +- .../kernel-2.4.21-rhel-2.4-i686-smp.config | 6 +- .../kernel-2.4.21-rhel-2.4-i686.config | 4 + .../kernel-2.4.21-rhel-2.4-ia64-smp.config | 4 + .../kernel-2.4.21-rhel-2.4-ia64.config | 4 + .../kernel-2.4.21-rhel-2.4-x86_64-smp.config | 7 +- .../kernel-2.4.21-rhel-2.4-x86_64.config | 6 +- .../patches/compile-fixes-2.4.21-rhel.patch | 105 +- .../patches/ext3-lookup-dotdot-2.4.20.patch | 4 +- .../patches/ext3-lookup-dotdot-2.6.9.patch | 4 +- .../llnl-frame-pointer-walk-2.4.21-rhel.patch | 27 +- .../llnl-frame-pointer-walk-fix-2.4.21-rhel.patch | 68 +- .../patches/raid5-configurable-cachesize.patch | 48 + lustre/kernel_patches/patches/raid5-large-io.patch | 16 + .../kernel_patches/patches/raid5-merge-ios.patch | 127 + .../patches/raid5-optimize-memcpy.patch | 223 + .../patches/raid5-serialize-ovelapping-reqs.patch | 136 + lustre/kernel_patches/patches/raid5-stats.patch | 198 + .../patches/raid5-stripe-by-stripe-handling.patch | 100 + .../patches/small_scatterlist-2.4.21-rhel.patch | 4810 ++++++++++---------- .../patches/vfs_intent-2.4.21-rhel.patch | 382 +- .../kernel_patches/series/2.6-rhel4-titech.series | 30 + lustre/kernel_patches/series/2.6-rhel4.series | 6 + lustre/kernel_patches/targets/2.6-rhel4.target.in | 2 +- lustre/kernel_patches/targets/2.6-suse.target.in | 2 +- lustre/kernel_patches/targets/rhel-2.4.target.in | 2 +- lustre/ldlm/ldlm_flock.c | 5 +- lustre/ldlm/ldlm_lib.c | 16 +- lustre/ldlm/ldlm_lockd.c | 2 +- lustre/ldlm/ldlm_request.c | 5 +- lustre/liblustre/file.c | 26 +- lustre/liblustre/namei.c | 4 +- lustre/liblustre/super.c | 191 +- lustre/liblustre/tests/Makefile.am | 2 +- lustre/liblustre/tests/sanity.c | 167 + lustre/llite/llite_lib.c | 26 +- lustre/llite/namei.c | 17 +- lustre/llite/rw.c | 1 - lustre/lov/lov_merge.c | 18 +- lustre/lov/lov_obd.c | 12 +- lustre/mdc/mdc_lib.c | 4 + lustre/mdc/mdc_locks.c | 15 +- lustre/mds/handler.c | 5 +- lustre/mds/mds_join.c | 4 +- lustre/mds/mds_open.c | 6 +- lustre/mds/mds_reint.c | 10 +- lustre/obdclass/genops.c | 29 +- lustre/obdclass/lprocfs_status.c | 11 +- lustre/obdecho/echo.c | 6 +- lustre/obdecho/echo_client.c | 30 +- lustre/obdfilter/filter_io_26.c | 16 +- lustre/ptlrpc/client.c | 131 +- lustre/ptlrpc/events.c | 30 +- lustre/ptlrpc/import.c | 81 +- lustre/ptlrpc/lproc_ptlrpc.c | 20 +- lustre/ptlrpc/niobuf.c | 9 +- lustre/ptlrpc/pack_generic.c | 32 +- lustre/ptlrpc/pinger.c | 10 +- lustre/ptlrpc/ptlrpcd.c | 9 +- lustre/ptlrpc/recover.c | 39 +- lustre/ptlrpc/service.c | 108 +- lustre/tests/conf-sanity.sh | 1 + lustre/tests/recovery-small.sh | 5 +- lustre/tests/replay-dual.sh | 1 + lustre/tests/replay-ost-single.sh | 8 +- lustre/tests/sanity.sh | 89 +- lustre/tests/sanityN.sh | 22 + lustre/tests/utime.c | 85 +- lustre/utils/liblustreapi.c | 123 +- lustre/utils/wirecheck.c | 55 +- 75 files changed, 4483 insertions(+), 3358 deletions(-) create mode 100644 lustre/kernel_patches/patches/raid5-configurable-cachesize.patch create mode 100644 lustre/kernel_patches/patches/raid5-large-io.patch create mode 100644 lustre/kernel_patches/patches/raid5-merge-ios.patch create mode 100644 lustre/kernel_patches/patches/raid5-optimize-memcpy.patch create mode 100644 lustre/kernel_patches/patches/raid5-serialize-ovelapping-reqs.patch create mode 100644 lustre/kernel_patches/patches/raid5-stats.patch create mode 100644 lustre/kernel_patches/patches/raid5-stripe-by-stripe-handling.patch create mode 100644 lustre/kernel_patches/series/2.6-rhel4-titech.series diff --git a/ldiskfs/kernel_patches/patches/ext3-lookup-dotdot-2.6.9.patch b/ldiskfs/kernel_patches/patches/ext3-lookup-dotdot-2.6.9.patch index f9d4857..a05256b 100644 --- a/ldiskfs/kernel_patches/patches/ext3-lookup-dotdot-2.6.9.patch +++ b/ldiskfs/kernel_patches/patches/ext3-lookup-dotdot-2.6.9.patch @@ -29,8 +29,8 @@ Index: linux-2.6.9-full/fs/ext3/namei.c + /* ".." shouldn't go into dcache to preserve dcache hierarchy + * otherwise we'll get parent being a child of actual child. + * see bug 10458 for details -bzzz */ -+ if (dentry->d_name.name[0] == '.' && (dentry->d_name.len == 1 || -+ (dentry->d_name.len == 2 && dentry->d_name.name[1] == '.'))) { ++ if (inode && (dentry->d_name.name[0] == '.' && (dentry->d_name.len == 1 || ++ (dentry->d_name.len == 2 && dentry->d_name.name[1] == '.')))) { + struct dentry *tmp, *goal = NULL; + struct list_head *lp; + diff --git a/lustre/include/linux/obd.h b/lustre/include/linux/obd.h index 3b58632..5ae97f4 100644 --- a/lustre/include/linux/obd.h +++ b/lustre/include/linux/obd.h @@ -36,7 +36,6 @@ static inline void client_obd_list_lock(client_obd_lock_t *lock) static inline void client_obd_list_unlock(client_obd_lock_t *lock) { - spin_unlock(lock); } #endif /* __LINUX_OBD_H */ diff --git a/lustre/include/lustre/liblustreapi.h b/lustre/include/lustre/liblustreapi.h index 44a25f4..36571bb 100644 --- a/lustre/include/lustre/liblustreapi.h +++ b/lustre/include/lustre/liblustreapi.h @@ -26,9 +26,9 @@ struct find_param { int asign; int csign; int msign; - int zeroend; - int recursive; + int zeroend:1, recursive:1, got_uuids:1, obds_printed:1; + int verbose; int quiet; @@ -40,7 +40,6 @@ struct find_param { /* In-precess parameters. */ unsigned int depth; - int got_uuids; dev_t st_dev; }; diff --git a/lustre/include/lustre_net.h b/lustre/include/lustre_net.h index 5b03428..abc0f03 100644 --- a/lustre/include/lustre_net.h +++ b/lustre/include/lustre_net.h @@ -600,12 +600,11 @@ void ptlrpc_unregister_bulk (struct ptlrpc_request *req); static inline int ptlrpc_bulk_active (struct ptlrpc_bulk_desc *desc) { - unsigned long flags; int rc; - spin_lock_irqsave (&desc->bd_lock, flags); + spin_lock(&desc->bd_lock); rc = desc->bd_network_rw; - spin_unlock_irqrestore (&desc->bd_lock, flags); + spin_unlock(&desc->bd_lock); return (rc); } @@ -625,24 +624,22 @@ struct ptlrpc_connection *ptlrpc_uuid_to_connection(struct obd_uuid *uuid); static inline int ptlrpc_client_receiving_reply (struct ptlrpc_request *req) { - unsigned long flags; int rc; - spin_lock_irqsave(&req->rq_lock, flags); + spin_lock(&req->rq_lock); rc = req->rq_receiving_reply; - spin_unlock_irqrestore(&req->rq_lock, flags); + spin_unlock(&req->rq_lock); return (rc); } static inline int ptlrpc_client_replied (struct ptlrpc_request *req) { - unsigned long flags; int rc; - spin_lock_irqsave(&req->rq_lock, flags); + spin_lock(&req->rq_lock); rc = req->rq_replied; - spin_unlock_irqrestore(&req->rq_lock, flags); + spin_unlock(&req->rq_lock); return (rc); } diff --git a/lustre/include/obd.h b/lustre/include/obd.h index 7799809..809edbd 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -770,7 +770,7 @@ struct obd_device { int obd_max_recoverable_clients; int obd_connected_clients; int obd_recoverable_clients; - spinlock_t obd_processing_task_lock; + spinlock_t obd_processing_task_lock; /* BH lock (timer) */ pid_t obd_processing_task; __u64 obd_next_recovery_transno; int obd_replayed_requests; diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index f191d6f..c13de30 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -706,7 +706,7 @@ static inline int obd_statfs_async(struct obd_device *obd, OBD_CHECK_OP(obd, statfs, -EOPNOTSUPP); OBD_COUNTER_INCREMENT(obd, statfs); - CDEBUG(D_SUPER, "osfs "CFS_TIME_T", max_age "CFS_TIME_T"\n", + CDEBUG(D_SUPER, "osfs "CFS_TIME_T", max_age "CFS_TIME_T"\n", obd->obd_osfs_age, max_age); if (cfs_time_before(obd->obd_osfs_age, max_age)) { rc = OBP(obd, statfs_async)(obd, oinfo, max_age, rqset); @@ -722,8 +722,7 @@ static inline int obd_statfs_async(struct obd_device *obd, } static inline int obd_statfs_rqset(struct obd_device *obd, - struct obd_statfs *osfs, - cfs_time_t max_age) + struct obd_statfs *osfs, cfs_time_t max_age) { struct ptlrpc_request_set *set = NULL; struct obd_info oinfo = { { { 0 } } }; @@ -757,7 +756,7 @@ static inline int obd_statfs(struct obd_device *obd, struct obd_statfs *osfs, OBD_CHECK_OP(obd, statfs, -EOPNOTSUPP); OBD_COUNTER_INCREMENT(obd, statfs); - CDEBUG(D_SUPER, "osfs "CFS_TIME_T", max_age "CFS_TIME_T"\n", + CDEBUG(D_SUPER, "osfs "CFS_TIME_T", max_age "CFS_TIME_T"\n", obd->obd_osfs_age, max_age); if (cfs_time_before(obd->obd_osfs_age, max_age)) { rc = OBP(obd, statfs)(obd, osfs, max_age); diff --git a/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-i686-smp.config b/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-i686-smp.config index 6d1a75b..21c0c0b 100644 --- a/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-i686-smp.config +++ b/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-i686-smp.config @@ -622,6 +622,7 @@ CONFIG_SCSI_IN2000=m CONFIG_SCSI_AM53C974=m CONFIG_SCSI_MEGARAID=m CONFIG_SCSI_MEGARAID2=m +CONFIG_SCSI_MEGARAID_SAS=m CONFIG_SCSI_SATA=y CONFIG_SCSI_SATA_AHCI=m CONFIG_SCSI_SATA_SVW=m @@ -714,7 +715,7 @@ CONFIG_PCMCIA_QLOGIC=m CONFIG_FUSION=m # CONFIG_FUSION_BOOT is not set CONFIG_FUSION_MAX_SGE=40 -# CONFIG_FUSION_ISENSE is not set +CONFIG_FUSION_ISENSE=m CONFIG_FUSION_CTL=m CONFIG_FUSION_LAN=m CONFIG_NET_FC=y @@ -872,6 +873,7 @@ CONFIG_YELLOWFIN=m CONFIG_R8169=m CONFIG_SK98LIN=m CONFIG_TIGON3=m +CONFIG_BNX2=m # # Quadrics QsNet device support @@ -2053,6 +2055,8 @@ CONFIG_FC_QLA2300=m CONFIG_SCSI_ISCSI=m # CONFIG_SCSI_IPR is not set CONFIG_SCSI_LPFC=m +CONFIG_FUSION_ISENSE=m +CONFIG_DELL_RBU=m # # Bluetooth support diff --git a/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-i686.config b/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-i686.config index 6d1a75b..658522a 100644 --- a/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-i686.config +++ b/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-i686.config @@ -622,6 +622,7 @@ CONFIG_SCSI_IN2000=m CONFIG_SCSI_AM53C974=m CONFIG_SCSI_MEGARAID=m CONFIG_SCSI_MEGARAID2=m +CONFIG_SCSI_MEGARAID_SAS=m CONFIG_SCSI_SATA=y CONFIG_SCSI_SATA_AHCI=m CONFIG_SCSI_SATA_SVW=m @@ -872,6 +873,7 @@ CONFIG_YELLOWFIN=m CONFIG_R8169=m CONFIG_SK98LIN=m CONFIG_TIGON3=m +CONFIG_BNX2=m # # Quadrics QsNet device support @@ -2053,6 +2055,8 @@ CONFIG_FC_QLA2300=m CONFIG_SCSI_ISCSI=m # CONFIG_SCSI_IPR is not set CONFIG_SCSI_LPFC=m +# CONFIG_FUSION_ISENSE is not set +CONFIG_DELL_RBU=m # # Bluetooth support diff --git a/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-ia64-smp.config b/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-ia64-smp.config index 4fb3337..a43b807 100644 --- a/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-ia64-smp.config +++ b/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-ia64-smp.config @@ -570,6 +570,7 @@ CONFIG_AIC7XXX_OLD_PROC_STATS=y # CONFIG_SCSI_AM53C974 is not set CONFIG_SCSI_MEGARAID=m CONFIG_SCSI_MEGARAID2=m +CONFIG_SCSI_MEGARAID_SAS=m CONFIG_SCSI_SATA=y CONFIG_SCSI_SATA_AHCI=m CONFIG_SCSI_SATA_SVW=m @@ -721,6 +722,7 @@ CONFIG_YELLOWFIN=m CONFIG_R8169=m CONFIG_SK98LIN=m CONFIG_TIGON3=m +CONFIG_BNX2=m # # Quadrics QsNet device support @@ -1426,6 +1428,8 @@ CONFIG_FC_QLA2300=m CONFIG_SCSI_ISCSI=m # CONFIG_SCSI_IPR is not set CONFIG_SCSI_LPFC=m +# CONFIG_FUSION_ISENSE is not set +CONFIG_DELL_RBU=m # # Kernel hacking diff --git a/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-ia64.config b/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-ia64.config index 4fb3337..a43b807 100644 --- a/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-ia64.config +++ b/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-ia64.config @@ -570,6 +570,7 @@ CONFIG_AIC7XXX_OLD_PROC_STATS=y # CONFIG_SCSI_AM53C974 is not set CONFIG_SCSI_MEGARAID=m CONFIG_SCSI_MEGARAID2=m +CONFIG_SCSI_MEGARAID_SAS=m CONFIG_SCSI_SATA=y CONFIG_SCSI_SATA_AHCI=m CONFIG_SCSI_SATA_SVW=m @@ -721,6 +722,7 @@ CONFIG_YELLOWFIN=m CONFIG_R8169=m CONFIG_SK98LIN=m CONFIG_TIGON3=m +CONFIG_BNX2=m # # Quadrics QsNet device support @@ -1426,6 +1428,8 @@ CONFIG_FC_QLA2300=m CONFIG_SCSI_ISCSI=m # CONFIG_SCSI_IPR is not set CONFIG_SCSI_LPFC=m +# CONFIG_FUSION_ISENSE is not set +CONFIG_DELL_RBU=m # # Kernel hacking diff --git a/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-x86_64-smp.config b/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-x86_64-smp.config index 9b1c043..03230c2 100644 --- a/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-x86_64-smp.config +++ b/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-x86_64-smp.config @@ -26,7 +26,7 @@ CONFIG_KMOD=y # # Processor type and features # -# CONFIG_MK8 +# CONFIG_MK8 is not set # CONFIG_IA32E is not set CONFIG_GENERIC_CPU=y CONFIG_X86_L1_CACHE_BYTES=64 @@ -116,6 +116,7 @@ CONFIG_ACPI_THERMAL=m # CONFIG_ACPI_ASUS is not set # CONFIG_ACPI_TOSHIBA is not set # CONFIG_ACPI_DEBUG is not set +# CONFIG_ACPI_PMTMR is not set # # Memory Technology Devices (MTD) @@ -576,6 +577,7 @@ CONFIG_AIC7XXX_OLD_PROC_STATS=y # CONFIG_SCSI_AM53C974 is not set CONFIG_SCSI_MEGARAID=m CONFIG_SCSI_MEGARAID2=m +CONFIG_SCSI_MEGARAID_SAS=m CONFIG_SCSI_SATA=y CONFIG_SCSI_SATA_AHCI=m CONFIG_SCSI_SATA_SVW=m @@ -781,6 +783,7 @@ CONFIG_YELLOWFIN=m CONFIG_R8169=m CONFIG_SK98LIN=m CONFIG_TIGON3=m +CONFIG_BNX2=m # # Quadrics QsNet device support @@ -1755,6 +1758,8 @@ CONFIG_FC_QLA2300=m CONFIG_SCSI_ISCSI=m # CONFIG_SCSI_IPR is not set CONFIG_SCSI_LPFC=m +# CONFIG_FUSION_ISENSE is not set +CONFIG_DELL_RBU=m # # Kernel hacking diff --git a/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-x86_64.config b/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-x86_64.config index ea03f03..03230c2 100644 --- a/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-x86_64.config +++ b/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-x86_64.config @@ -116,6 +116,7 @@ CONFIG_ACPI_THERMAL=m # CONFIG_ACPI_ASUS is not set # CONFIG_ACPI_TOSHIBA is not set # CONFIG_ACPI_DEBUG is not set +# CONFIG_ACPI_PMTMR is not set # # Memory Technology Devices (MTD) @@ -576,6 +577,7 @@ CONFIG_AIC7XXX_OLD_PROC_STATS=y # CONFIG_SCSI_AM53C974 is not set CONFIG_SCSI_MEGARAID=m CONFIG_SCSI_MEGARAID2=m +CONFIG_SCSI_MEGARAID_SAS=m CONFIG_SCSI_SATA=y CONFIG_SCSI_SATA_AHCI=m CONFIG_SCSI_SATA_SVW=m @@ -781,6 +783,7 @@ CONFIG_YELLOWFIN=m CONFIG_R8169=m CONFIG_SK98LIN=m CONFIG_TIGON3=m +CONFIG_BNX2=m # # Quadrics QsNet device support @@ -1755,6 +1758,8 @@ CONFIG_FC_QLA2300=m CONFIG_SCSI_ISCSI=m # CONFIG_SCSI_IPR is not set CONFIG_SCSI_LPFC=m +# CONFIG_FUSION_ISENSE is not set +CONFIG_DELL_RBU=m # # Kernel hacking @@ -1777,4 +1782,3 @@ CONFIG_CRC32=m CONFIG_ZLIB_INFLATE=y CONFIG_ZLIB_DEFLATE=y CONFIG_QSORT=y -CONFIG_IEEE1394_PCILYNX=m diff --git a/lustre/kernel_patches/patches/compile-fixes-2.4.21-rhel.patch b/lustre/kernel_patches/patches/compile-fixes-2.4.21-rhel.patch index 7c370d93..dae8a47 100644 --- a/lustre/kernel_patches/patches/compile-fixes-2.4.21-rhel.patch +++ b/lustre/kernel_patches/patches/compile-fixes-2.4.21-rhel.patch @@ -1,8 +1,7 @@ -Index: linux-2.4.21/drivers/i2c/i2c-ali1535.c -=================================================================== ---- linux-2.4.21.orig/drivers/i2c/i2c-ali1535.c 2004-09-11 10:16:33.000000000 -0400 -+++ linux-2.4.21/drivers/i2c/i2c-ali1535.c 2004-11-03 17:40:31.000000000 -0500 -@@ -672,8 +672,8 @@ +diff -X dontdiff -urp kern_oldest/drivers/i2c/i2c-ali1535.c kern_fix/drivers/i2c/i2c-ali1535.c +--- kern_oldest/drivers/i2c/i2c-ali1535.c 2006-05-01 11:55:43.000000000 -0700 ++++ kern_fix/drivers/i2c/i2c-ali1535.c 2006-05-01 15:25:34.000000000 -0700 +@@ -672,8 +672,8 @@ EXPORT_NO_SYMBOLS; #ifdef MODULE MODULE_AUTHOR @@ -13,30 +12,26 @@ Index: linux-2.4.21/drivers/i2c/i2c-ali1535.c MODULE_DESCRIPTION("ALI1535 SMBus driver"); int init_module(void) -Index: linux-2.4.21/drivers/sensors/lm87.c -=================================================================== ---- linux-2.4.21.orig/drivers/sensors/lm87.c 2004-09-11 10:16:33.000000000 -0400 -+++ linux-2.4.21/drivers/sensors/lm87.c 2004-11-03 17:40:31.000000000 -0500 -@@ -1060,10 +1060,10 @@ - #endif - - MODULE_AUTHOR -- ("Frodo Looijaard , -- Philip Edelbrock , -- Mark Studebaker , -- and Stephen Rousset "); -+ ("Frodo Looijaard , " -+ "Philip Edelbrock , " -+ "Mark Studebaker , " -+ "and Stephen Rousset "); - - MODULE_DESCRIPTION("LM87 driver"); - -Index: linux-2.4.21/drivers/net/wan/sbni.c -=================================================================== ---- linux-2.4.21.orig/drivers/net/wan/sbni.c 2002-11-28 18:53:14.000000000 -0500 -+++ linux-2.4.21/drivers/net/wan/sbni.c 2004-11-03 17:40:31.000000000 -0500 -@@ -1552,13 +1552,13 @@ +diff -X dontdiff -urp kern_oldest/drivers/net/pcmcia/wvlan_cs.c kern_fix/drivers/net/pcmcia/wvlan_cs.c +--- kern_oldest/drivers/net/pcmcia/wvlan_cs.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/net/pcmcia/wvlan_cs.c 2006-05-01 15:25:34.000000000 -0700 +@@ -1084,9 +1084,9 @@ static int wvlan_hw_config (struct net_d + /* This is a PrismII card. It is is *very* similar + * to the Lucent, and the driver work 95%, + * therefore, we attempt to support it... */ +- printk(KERN_NOTICE "%s: This is a PrismII card, not a Wavelan IEEE card :-( +-You may want report firmare revision (0x%X) and what the card support. +-I will try to make it work, but you should look for a better driver.\n", dev_info, firmware); ++ printk(KERN_NOTICE "%s: This is a PrismII card, not a Wavelan IEEE card :-(\n" ++"You may want report firmare revision (0x%X) and what the card support.\n" ++"I will try to make it work, but you should look for a better driver.\n", dev_info, firmware); + local->has_port3 = 1; + local->has_ibssid = 0; + local->has_mwo = 0; +diff -X dontdiff -urp kern_oldest/drivers/net/wan/sbni.c kern_fix/drivers/net/wan/sbni.c +--- kern_oldest/drivers/net/wan/sbni.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/net/wan/sbni.c 2006-05-01 15:25:34.000000000 -0700 +@@ -1552,13 +1552,13 @@ __setup( "sbni=", sbni_setup ); static u32 calc_crc32( u32 crc, u8 *p, u32 len ) { @@ -53,7 +48,7 @@ Index: linux-2.4.21/drivers/net/wan/sbni.c "movl $crc32tab, %%edi\n" "shrl $2, %%ecx\n" "jz 1f\n" -@@ -1594,7 +1594,7 @@ +@@ -1594,7 +1594,7 @@ calc_crc32( u32 crc, u8 *p, u32 len "jnz 0b\n" "1:\n" @@ -62,7 +57,7 @@ Index: linux-2.4.21/drivers/net/wan/sbni.c "andl $3, %%ecx\n" "jz 2f\n" -@@ -1619,9 +1619,9 @@ +@@ -1619,9 +1619,9 @@ calc_crc32( u32 crc, u8 *p, u32 len "xorb 2(%%esi), %%bl\n" "xorl (%%edi,%%ebx,4), %%eax\n" "2:\n" @@ -75,33 +70,21 @@ Index: linux-2.4.21/drivers/net/wan/sbni.c ); return _crc; -Index: linux-2.4.21/drivers/net/pcmcia/wvlan_cs.c -=================================================================== ---- linux-2.4.21.orig/drivers/net/pcmcia/wvlan_cs.c 2004-09-11 10:16:39.000000000 -0400 -+++ linux-2.4.21/drivers/net/pcmcia/wvlan_cs.c 2004-11-03 17:40:31.000000000 -0500 -@@ -1084,9 +1084,9 @@ - /* This is a PrismII card. It is is *very* similar - * to the Lucent, and the driver work 95%, - * therefore, we attempt to support it... */ -- printk(KERN_NOTICE "%s: This is a PrismII card, not a Wavelan IEEE card :-( --You may want report firmare revision (0x%X) and what the card support. --I will try to make it work, but you should look for a better driver.\n", dev_info, firmware); -+ printk(KERN_NOTICE "%s: This is a PrismII card, not a Wavelan IEEE card :-(\n" -+"You may want report firmare revision (0x%X) and what the card support.\n" -+"I will try to make it work, but you should look for a better driver.\n", dev_info, firmware); - local->has_port3 = 1; - local->has_ibssid = 0; - local->has_mwo = 0; -Index: linux-2.4.21/Makefile -=================================================================== ---- linux-2.4.21.orig/Makefile 2004-09-11 10:16:39.000000000 -0400 -+++ linux-2.4.21/Makefile 2004-11-03 17:41:35.000000000 -0500 -@@ -539,7 +539,7 @@ - ifdef CONFIG_MODVERSIONS - $(MAKE) update-modverfile - endif -- scripts/mkdep -- `find $(FINDHPATH) \( -name SCCS -o -name .svn \) -prune -o -follow -name \*.h ! -name modversions.h -print` > .hdepend -+ find $(FINDHPATH) \( -name SCCS -o -name .svn \) -prune -o -follow -name \*.h ! -name modversions.h -print | xargs scripts/mkdep -- > .hdepend - scripts/mkdep -- init/*.c > .depend - (find $(TOPDIR) \( -name .depend -o -name .hdepend \) -print | xargs $(AWK) -f scripts/include_deps) > tmp_include_depends - sed -ne 's/^\([^ ].*\):.*/ \1 \\/p' tmp_include_depends > tmp_include_depends_1 +diff -X dontdiff -urp kern_oldest/drivers/sensors/lm87.c kern_fix/drivers/sensors/lm87.c +--- kern_oldest/drivers/sensors/lm87.c 2006-05-01 11:55:44.000000000 -0700 ++++ kern_fix/drivers/sensors/lm87.c 2006-05-01 15:25:34.000000000 -0700 +@@ -1060,10 +1060,10 @@ MODULE_LICENSE("GPL"); + #endif + + MODULE_AUTHOR +- ("Frodo Looijaard , +- Philip Edelbrock , +- Mark Studebaker , +- and Stephen Rousset "); ++ ("Frodo Looijaard , " ++ "Philip Edelbrock , " ++ "Mark Studebaker , " ++ "and Stephen Rousset "); + + MODULE_DESCRIPTION("LM87 driver"); + diff --git a/lustre/kernel_patches/patches/ext3-lookup-dotdot-2.4.20.patch b/lustre/kernel_patches/patches/ext3-lookup-dotdot-2.4.20.patch index 0329dfe..8fc1bd7 100644 --- a/lustre/kernel_patches/patches/ext3-lookup-dotdot-2.4.20.patch +++ b/lustre/kernel_patches/patches/ext3-lookup-dotdot-2.4.20.patch @@ -9,8 +9,8 @@ Index: linux-2.4.21/fs/ext3/namei.c + /* ".." shouldn't go into dcache to preserve dcache hierarchy + * otherwise we'll get parent being a child of actual child. + * see bug 10458 for details -bzzz */ -+ if (dentry->d_name.name[0] == '.' && (dentry->d_name.len == 1 || -+ (dentry->d_name.len == 2 && dentry->d_name.name[1] == '.'))) { ++ if (inode && (dentry->d_name.name[0] == '.' && (dentry->d_name.len == 1 || ++ (dentry->d_name.len == 2 && dentry->d_name.name[1] == '.')))) { + struct dentry *tmp, *goal = NULL; + struct list_head *lp; + diff --git a/lustre/kernel_patches/patches/ext3-lookup-dotdot-2.6.9.patch b/lustre/kernel_patches/patches/ext3-lookup-dotdot-2.6.9.patch index f9d4857..a05256b 100644 --- a/lustre/kernel_patches/patches/ext3-lookup-dotdot-2.6.9.patch +++ b/lustre/kernel_patches/patches/ext3-lookup-dotdot-2.6.9.patch @@ -29,8 +29,8 @@ Index: linux-2.6.9-full/fs/ext3/namei.c + /* ".." shouldn't go into dcache to preserve dcache hierarchy + * otherwise we'll get parent being a child of actual child. + * see bug 10458 for details -bzzz */ -+ if (dentry->d_name.name[0] == '.' && (dentry->d_name.len == 1 || -+ (dentry->d_name.len == 2 && dentry->d_name.name[1] == '.'))) { ++ if (inode && (dentry->d_name.name[0] == '.' && (dentry->d_name.len == 1 || ++ (dentry->d_name.len == 2 && dentry->d_name.name[1] == '.')))) { + struct dentry *tmp, *goal = NULL; + struct list_head *lp; + diff --git a/lustre/kernel_patches/patches/llnl-frame-pointer-walk-2.4.21-rhel.patch b/lustre/kernel_patches/patches/llnl-frame-pointer-walk-2.4.21-rhel.patch index 57b0e37..4d234af 100644 --- a/lustre/kernel_patches/patches/llnl-frame-pointer-walk-2.4.21-rhel.patch +++ b/lustre/kernel_patches/patches/llnl-frame-pointer-walk-2.4.21-rhel.patch @@ -1,12 +1,7 @@ -Index: linux/arch/i386/kernel/traps.c -=================================================================== -RCS file: /chaos/cvs/kernel-rh/linux/arch/i386/kernel/traps.c,v -retrieving revision 1.3.6.4 -retrieving revision 1.3.6.2.2.5 -diff -u -r1.3.6.4 -r1.3.6.2.2.5 ---- linux/arch/i386/kernel/traps.c 3 Dec 2003 21:39:03 -0000 1.3.6.4 -+++ linux/arch/i386/kernel/traps.c 3 Oct 2003 22:45:43 -0000 1.3.6.2.2.5 -@@ -133,6 +137,80 @@ +diff -X dontdiff -urp kern_oldest/arch/i386/kernel/traps.c kern_fix/arch/i386/kernel/traps.c +--- kern_oldest/arch/i386/kernel/traps.c 2006-05-01 11:56:31.000000000 -0700 ++++ kern_fix/arch/i386/kernel/traps.c 2006-05-01 14:56:40.000000000 -0700 +@@ -133,6 +133,80 @@ static inline int kernel_text_address(un #endif @@ -87,14 +82,7 @@ diff -u -r1.3.6.4 -r1.3.6.2.2.5 void show_trace(unsigned long * stack) { #if !CONFIG_FRAME_POINTER -@@ -145,29 +223,20 @@ - if (!stack) - stack = (unsigned long*)&stack; - -- printk("Call Trace: "); -+ printk("Call Trace:\n"); - /* - * If we have frame pointers then use them to get +@@ -151,16 +225,7 @@ void show_trace(unsigned long * stack) * a 100% exact backtrace, up until the entry frame: */ #if CONFIG_FRAME_POINTER @@ -111,7 +99,8 @@ diff -u -r1.3.6.4 -r1.3.6.2.2.5 + frame_pointer_walk(stack); #else i = 1; - while (((long) stack & (THREAD_SIZE-1)) != 0) { + limit = ((unsigned long)stack & ~(THREAD_SIZE - 1)) + THREAD_SIZE - 3; +@@ -168,7 +233,7 @@ out: addr = *stack++; if (kernel_text_address(addr)) { lookup_symbol(addr, buffer, 512); @@ -120,7 +109,7 @@ diff -u -r1.3.6.4 -r1.3.6.2.2.5 i++; } } -@@ -242,7 +305,7 @@ +@@ -244,7 +309,7 @@ void show_registers(struct pt_regs *regs lookup_symbol(regs->eip, buffer, 512); printk("CPU: %d\nEIP: %04x:[<%08lx>] %s\nEFLAGS: %08lx\n", smp_processor_id(), 0xffff & regs->xcs, regs->eip, print_tainted(), regs->eflags); diff --git a/lustre/kernel_patches/patches/llnl-frame-pointer-walk-fix-2.4.21-rhel.patch b/lustre/kernel_patches/patches/llnl-frame-pointer-walk-fix-2.4.21-rhel.patch index 11416e6..64d652a 100644 --- a/lustre/kernel_patches/patches/llnl-frame-pointer-walk-fix-2.4.21-rhel.patch +++ b/lustre/kernel_patches/patches/llnl-frame-pointer-walk-fix-2.4.21-rhel.patch @@ -1,11 +1,7 @@ -Index: linux/arch/i386/kernel/traps.c=================================================================== -RCS file: /chaos/cvs/kernel-rh/linux/arch/i386/kernel/traps.c,v -retrieving revision 1.3.6.2.2.11 -retrieving revision 1.3.6.2.2.12 -Index: linux-2.4.21/arch/i386/kernel/traps.c +Index: kernel/arch/i386/kernel/traps.c =================================================================== ---- linux-2.4.21.orig/arch/i386/kernel/traps.c 2004-11-01 22:00:55.000000000 -0500 -+++ linux-2.4.21/arch/i386/kernel/traps.c 2004-11-02 14:20:54.000000000 -0500 +--- kernel.orig/arch/i386/kernel/traps.c 2006-05-26 16:12:28.000000000 -0700 ++++ kernel/arch/i386/kernel/traps.c 2006-05-26 16:15:54.000000000 -0700 @@ -133,6 +133,30 @@ #endif @@ -75,7 +71,7 @@ Index: linux-2.4.21/arch/i386/kernel/traps.c for (; ; ) { next_frame_ptr = (unsigned long *) (*frame_ptr); -@@ -196,50 +216,58 @@ +@@ -196,9 +216,9 @@ eip = *eip_ptr; if (kernel_text_address(eip)) { @@ -87,19 +83,19 @@ Index: linux-2.4.21/arch/i386/kernel/traps.c eip_ptr); } - frame_ptr = next_frame_ptr; - } +@@ -207,40 +227,49 @@ } --#endif -+ -+typedef void (*stack_trace_fn_t) (unsigned long *stack); + #endif ++typedef void (*stack_trace_fn_t) (unsigned long *stack); ++ ++#if CONFIG_FRAME_POINTER void show_trace(unsigned long * stack) { -#if !CONFIG_FRAME_POINTER - int i; -#endif -- unsigned long addr; +- unsigned long addr, limit; - /* static to not take up stackspace; if we race here too bad */ - static char buffer[512]; + static const stack_trace_fn_t trace_fn_vector[] = @@ -110,25 +106,17 @@ Index: linux-2.4.21/arch/i386/kernel/traps.c if (!stack) stack = (unsigned long*)&stack; - printk("Call Trace:\n"); + printk("Call Trace: "); - /* - * If we have frame pointers then use them to get - * a 100% exact backtrace, up until the entry frame: -+ addr = (unsigned long) stack; -+ task_addr = (unsigned long) current; -+ stack_base = task_addr + THREAD_SIZE - 1; -+ task_is_current = (addr >= task_addr) && (addr <= stack_base); -+ -+ /* We may use frame pointers to do a stack trace only if the current -+ * task is being traced. Tracing some other task in this manner -+ * would require a saved %ebp register value. Perhaps in the future -+ * I'll consider providing a means of obtaining this. - */ +- */ -#if CONFIG_FRAME_POINTER - frame_pointer_walk(stack); -#else - i = 1; -- while (((long) stack & (THREAD_SIZE-1)) != 0) { +- limit = ((unsigned long)stack & ~(THREAD_SIZE - 1)) + THREAD_SIZE - 3; +- while ((unsigned long)stack < limit) { - addr = *stack++; - if (kernel_text_address(addr)) { - lookup_symbol(addr, buffer, 512); @@ -137,11 +125,21 @@ Index: linux-2.4.21/arch/i386/kernel/traps.c - } - } -#endif ++ addr = (unsigned long) stack; ++ task_addr = (unsigned long) current; ++ stack_base = task_addr + THREAD_SIZE - 1; ++ task_is_current = (addr >= task_addr) && (addr <= stack_base); ++ ++ /* We may use frame pointers to do a stack trace only if the current ++ * task is being traced. Tracing some other task in this manner ++ * would require a saved %ebp register value. Perhaps in the future ++ * I'll consider providing a means of obtaining this. ++ */ + trace_fn_vector[task_is_current](stack); + - printk("\n"); - } - ++ printk("\n"); ++} ++ +#else /* CONFIG_FRAME_POINTER */ + +void show_trace(unsigned long * stack) @@ -151,18 +149,18 @@ Index: linux-2.4.21/arch/i386/kernel/traps.c + + printk("Call Trace:\n"); + scan_stack(stack); -+ printk("\n"); -+} -+ + printk("\n"); + } + +#endif /* CONFIG_FRAME_POINTER */ + void show_trace_task(struct task_struct *tsk) { unsigned long esp = tsk->thread.esp; -Index: linux-2.4.21/include/asm-i386/hw_irq.h +Index: kernel/include/asm-i386/hw_irq.h =================================================================== ---- linux-2.4.21.orig/include/asm-i386/hw_irq.h 2004-11-01 21:59:54.000000000 -0500 -+++ linux-2.4.21/include/asm-i386/hw_irq.h 2004-11-02 14:20:03.000000000 -0500 +--- kernel.orig/include/asm-i386/hw_irq.h 2006-05-26 16:11:33.000000000 -0700 ++++ kernel/include/asm-i386/hw_irq.h 2006-05-26 16:13:51.000000000 -0700 @@ -153,6 +153,9 @@ /* there is a second layer of macro just to get the symbolic name for the vector evaluated. This change is for RTLinux */ diff --git a/lustre/kernel_patches/patches/raid5-configurable-cachesize.patch b/lustre/kernel_patches/patches/raid5-configurable-cachesize.patch new file mode 100644 index 0000000..4519573 --- /dev/null +++ b/lustre/kernel_patches/patches/raid5-configurable-cachesize.patch @@ -0,0 +1,48 @@ +Index: linux-2.6.9/drivers/md/raid5.c +=================================================================== +--- linux-2.6.9.orig/drivers/md/raid5.c 2006-05-21 17:57:25.000000000 +0400 ++++ linux-2.6.9/drivers/md/raid5.c 2006-05-22 00:01:30.000000000 +0400 +@@ -28,7 +28,8 @@ + * Stripe cache + */ + +-#define NR_STRIPES 256 ++static int raid5_nr_stripes = 256 * 8; ++ + #define STRIPE_SIZE PAGE_SIZE + #define STRIPE_SHIFT (PAGE_SHIFT - 9) + #define STRIPE_SECTORS (STRIPE_SIZE>>9) +@@ -92,7 +93,7 @@ static inline void __release_stripe(raid + list_add_tail(&sh->lru, &conf->inactive_list); + atomic_dec(&conf->active_stripes); + if (!conf->inactive_blocked || +- atomic_read(&conf->active_stripes) < (NR_STRIPES*3/4)) ++ atomic_read(&conf->active_stripes) < (conf->max_nr_stripes*3/4)) + wake_up(&conf->wait_for_stripe); + } + } +@@ -255,7 +256,7 @@ static struct stripe_head *get_active_st + conf->inactive_blocked = 1; + wait_event_lock_irq(conf->wait_for_stripe, + !list_empty(&conf->inactive_list) && +- (atomic_read(&conf->active_stripes) < (NR_STRIPES *3/4) ++ (atomic_read(&conf->active_stripes) < (conf->max_nr_stripes *3/4) + || !conf->inactive_blocked), + conf->device_lock, + unplug_slaves(conf->mddev); +@@ -1637,7 +1638,7 @@ static int run (mddev_t *mddev) + conf->chunk_size = mddev->chunk_size; + conf->level = mddev->level; + conf->algorithm = mddev->layout; +- conf->max_nr_stripes = NR_STRIPES; ++ conf->max_nr_stripes = raid5_nr_stripes; + + /* device size must be a multiple of chunk size */ + mddev->size &= ~(mddev->chunk_size/1024 -1); +@@ -1957,5 +1958,6 @@ static void raid5_exit (void) + + module_init(raid5_init); + module_exit(raid5_exit); ++module_param(raid5_nr_stripes, int, 0644); + MODULE_LICENSE("GPL"); + MODULE_ALIAS("md-personality-4"); /* RAID5 */ diff --git a/lustre/kernel_patches/patches/raid5-large-io.patch b/lustre/kernel_patches/patches/raid5-large-io.patch new file mode 100644 index 0000000..cb7cb57 --- /dev/null +++ b/lustre/kernel_patches/patches/raid5-large-io.patch @@ -0,0 +1,16 @@ +Index: linux-2.6.9/drivers/md/raid5.c +=================================================================== +--- linux-2.6.9.orig/drivers/md/raid5.c 2006-05-22 00:01:30.000000000 +0400 ++++ linux-2.6.9/drivers/md/raid5.c 2006-05-22 00:09:56.000000000 +0400 +@@ -1609,6 +1609,11 @@ static int run (mddev_t *mddev) + mddev->queue->unplug_fn = raid5_unplug_device; + mddev->queue->issue_flush_fn = raid5_issue_flush; + ++ /* in order to support large I/Os */ ++ blk_queue_max_sectors(mddev->queue, mddev->chunk_size * mddev->raid_disks >> 9); ++ mddev->queue->max_phys_segments = mddev->chunk_size * mddev->raid_disks >> PAGE_SHIFT; ++ mddev->queue->max_hw_segments = mddev->chunk_size * mddev->raid_disks >> PAGE_SHIFT;; ++ + PRINTK("raid5: run(%s) called.\n", mdname(mddev)); + + ITERATE_RDEV(mddev,rdev,tmp) { diff --git a/lustre/kernel_patches/patches/raid5-merge-ios.patch b/lustre/kernel_patches/patches/raid5-merge-ios.patch new file mode 100644 index 0000000..60ff905 --- /dev/null +++ b/lustre/kernel_patches/patches/raid5-merge-ios.patch @@ -0,0 +1,127 @@ +Index: linux-2.6.9/drivers/md/raid5.c +=================================================================== +--- linux-2.6.9.orig/drivers/md/raid5.c 2006-05-22 00:10:04.000000000 +0400 ++++ linux-2.6.9/drivers/md/raid5.c 2006-05-22 00:10:06.000000000 +0400 +@@ -934,6 +934,26 @@ static void add_stripe_bio (struct strip + } + } + ++/* ++ * The whole idea is to collect all bio's and then issue them ++ * disk by disk to assist merging a bit -bzzz ++ */ ++static void raid5_flush_bios(raid5_conf_t *conf, struct bio *bios[], int raid_disks) ++{ ++ struct bio *bio, *nbio; ++ int i; ++ ++ for (i = 0; i < raid_disks; i++) { ++ bio = bios[i]; ++ while (bio) { ++ nbio = bio->bi_next; ++ bio->bi_next = NULL; ++ generic_make_request(bio); ++ bio = nbio; ++ } ++ bios[i] = NULL; ++ } ++} + + /* + * handle_stripe - do things to a stripe. +@@ -953,7 +973,7 @@ static void add_stripe_bio (struct strip + * + */ + +-static void handle_stripe(struct stripe_head *sh) ++static void handle_stripe(struct stripe_head *sh, struct bio *bios[]) + { + raid5_conf_t *conf = sh->raid_conf; + int disks = conf->raid_disks; +@@ -1376,7 +1396,11 @@ static void handle_stripe(struct stripe_ + bi->bi_size = STRIPE_SIZE; + bi->bi_next = NULL; + atomic_inc(&conf->out_reqs_in_queue); +- generic_make_request(bi); ++ if (bios) { ++ bi->bi_next = bios[i]; ++ bios[i] = bi; ++ } else ++ generic_make_request(bi); + } else { + PRINTK("skip op %ld on disc %d for sector %llu\n", + bi->bi_rw, i, (unsigned long long)sh->sector); +@@ -1501,6 +1525,7 @@ static int make_request (request_queue_t + int sectors_per_chunk = conf->chunk_size >> 9; + int stripes_per_chunk, sectors_per_block; + int sectors_per_stripe; ++ struct bio *bios[MD_SB_DISKS]; + int i, j; + + atomic_inc(&conf->in_reqs_in_queue); +@@ -1530,6 +1555,7 @@ static int make_request (request_queue_t + sector_div(block, sectors_per_block); + sectors = bi->bi_size >> 9; + ++ memset(&bios, 0, sizeof(bios)); + repeat: + stripe = block * sectors_per_block / data_disks; + b_sector = stripe * data_disks; +@@ -1549,9 +1575,17 @@ repeat: + new_sector = raid5_compute_sector(r_sector, raid_disks, + data_disks, &dd_idx, + &pd_idx, conf); +- if (sh == NULL) +- sh = get_active_stripe(conf, new_sector, pd_idx, +- (bi->bi_rw&RWA_MASK)); ++ if (sh == NULL) { ++ /* first, try to get stripe w/o blocking ++ * if we can't, then it's time to submit ++ * all collected bio's in order to free ++ * some space in the cache -bzzz */ ++ sh = get_active_stripe(conf, new_sector, pd_idx, 1); ++ if (!sh && !(bi->bi_rw&RWA_MASK)) { ++ raid5_flush_bios(conf, bios, raid_disks); ++ sh = get_active_stripe(conf, new_sector, pd_idx, 0); ++ } ++ } + if (sh) { + add_stripe_bio(sh, bi, dd_idx, (bi->bi_rw&RW_MASK)); + } else { +@@ -1571,7 +1605,7 @@ repeat: + } + if (sh) { + raid5_plug_device(conf); +- handle_stripe(sh); ++ handle_stripe(sh, bios); + release_stripe(sh); + sh = NULL; + } +@@ -1581,6 +1615,9 @@ repeat: + if (sectors > 0) + goto repeat; + ++ /* now flush all bio's */ ++ raid5_flush_bios(conf, bios, raid_disks); ++ + spin_lock_irq(&conf->device_lock); + if (--bi->bi_phys_segments == 0) { + int bytes = bi->bi_size; +@@ -1636,7 +1673,7 @@ static int sync_request (mddev_t *mddev, + clear_bit(STRIPE_INSYNC, &sh->state); + spin_unlock(&sh->lock); + +- handle_stripe(sh); ++ handle_stripe(sh, NULL); + release_stripe(sh); + + return STRIPE_SECTORS; +@@ -1685,7 +1722,7 @@ static void raid5d (mddev_t *mddev) + + handled++; + atomic_inc(&conf->handled_in_raid5d); +- handle_stripe(sh); ++ handle_stripe(sh, NULL); + release_stripe(sh); + + spin_lock_irq(&conf->device_lock); diff --git a/lustre/kernel_patches/patches/raid5-optimize-memcpy.patch b/lustre/kernel_patches/patches/raid5-optimize-memcpy.patch new file mode 100644 index 0000000..60d0a6f --- /dev/null +++ b/lustre/kernel_patches/patches/raid5-optimize-memcpy.patch @@ -0,0 +1,223 @@ +Index: linux-2.6.9/include/linux/raid/raid5.h +=================================================================== +--- linux-2.6.9.orig/include/linux/raid/raid5.h 2006-05-21 17:57:25.000000000 +0400 ++++ linux-2.6.9/include/linux/raid/raid5.h 2006-05-22 00:10:04.000000000 +0400 +@@ -152,6 +152,7 @@ struct stripe_head { + #define R5_Wantread 4 /* want to schedule a read */ + #define R5_Wantwrite 5 + #define R5_Syncio 6 /* this io need to be accounted as resync io */ ++#define R5_Direct 7 /* use page fom passed bio to avoid memcpy */ + + /* + * Write method +Index: linux-2.6.9/drivers/md/raid5.c +=================================================================== +--- linux-2.6.9.orig/drivers/md/raid5.c 2006-05-22 00:10:01.000000000 +0400 ++++ linux-2.6.9/drivers/md/raid5.c 2006-05-22 00:10:04.000000000 +0400 +@@ -411,6 +411,8 @@ static int raid5_end_read_request (struc + clear_buffer_uptodate(bh); + } + #endif ++ if (test_bit(R5_Direct, &sh->dev[i].flags)) ++ printk("R5_Direct for READ ?!\n"); + clear_bit(R5_LOCKED, &sh->dev[i].flags); + set_bit(STRIPE_HANDLE, &sh->state); + release_stripe(sh); +@@ -449,6 +451,10 @@ static int raid5_end_write_request (stru + + rdev_dec_pending(conf->disks[i].rdev, conf->mddev); + ++ if (test_bit(R5_Direct, &sh->dev[i].flags)) { ++ BUG_ON(sh->dev[i].req.bi_io_vec[0].bv_page == sh->dev[i].page); ++ sh->dev[i].req.bi_io_vec[0].bv_page = sh->dev[i].page; ++ } + clear_bit(R5_LOCKED, &sh->dev[i].flags); + set_bit(STRIPE_HANDLE, &sh->state); + __release_stripe(conf, sh); +@@ -673,6 +679,49 @@ static void copy_data(int frombio, struc + } + } + ++static struct page *zero_copy_data(struct bio *bio, sector_t sector) ++{ ++ struct bio_vec *bvl; ++ int i; ++ ++ for (;bio && bio->bi_sector < sector+STRIPE_SECTORS; ++ bio = r5_next_bio(bio, sector) ) { ++ int page_offset; ++ if (bio->bi_sector >= sector) ++ page_offset = (signed)(bio->bi_sector - sector) * 512; ++ else ++ page_offset = (signed)(sector - bio->bi_sector) * -512; ++ bio_for_each_segment(bvl, bio, i) { ++ int len = bio_iovec_idx(bio,i)->bv_len; ++ int clen; ++ int b_offset = 0; ++ ++ if (page_offset < 0) { ++ b_offset = -page_offset; ++ page_offset += b_offset; ++ len -= b_offset; ++ } ++ ++ if (len > 0 && page_offset + len > STRIPE_SIZE) ++ clen = STRIPE_SIZE - page_offset; ++ else clen = len; ++ ++ if (clen > 0) { ++ BUG_ON(clen < STRIPE_SIZE); ++ /*printk(" sector %lu: page %p from index %u\n", ++ (unsigned long) sector, ++ bio_iovec_idx(bio, i)->bv_page, i);*/ ++ return bio_iovec_idx(bio, i)->bv_page; ++ } ++ if (clen < len) /* hit end of page */ ++ break; ++ page_offset += len; ++ } ++ } ++ BUG(); ++ return NULL; ++} ++ + #define check_xor() do { \ + if (count == MAX_XOR_BLOCKS) { \ + xor_block(count, STRIPE_SIZE, ptr); \ +@@ -717,6 +766,8 @@ static void compute_parity(struct stripe + int i, pd_idx = sh->pd_idx, disks = conf->raid_disks, count; + void *ptr[MAX_XOR_BLOCKS]; + struct bio *chosen; ++ struct page *page; ++ int zerocopy = 0; + + PRINTK("compute_parity, stripe %llu, method %d\n", + (unsigned long long)sh->sector, method); +@@ -743,13 +794,17 @@ static void compute_parity(struct stripe + break; + case RECONSTRUCT_WRITE: + memset(ptr[0], 0, STRIPE_SIZE); +- for (i= disks; i-- ;) ++ zerocopy = 1; ++ for (i= disks; i-- ;) { ++ if (i != pd_idx && !sh->dev[i].towrite) ++ zerocopy = 0; + if (i!=pd_idx && sh->dev[i].towrite) { + chosen = sh->dev[i].towrite; + sh->dev[i].towrite = NULL; + if (sh->dev[i].written) BUG(); + sh->dev[i].written = chosen; + } ++ } + break; + case CHECK_PARITY: + break; +@@ -759,34 +814,61 @@ static void compute_parity(struct stripe + count = 1; + } + +- for (i = disks; i--;) +- if (sh->dev[i].written) { +- sector_t sector = sh->dev[i].sector; +- struct bio *wbi = sh->dev[i].written; +- while (wbi && wbi->bi_sector < sector + STRIPE_SECTORS) { +- copy_data(1, wbi, sh->dev[i].page, sector); +- wbi = r5_next_bio(wbi, sector); +- } ++ for (i = disks; i--;) { ++ struct bio *wbi = sh->dev[i].written; ++ sector_t sector; ++ ++ if (!wbi) ++ continue; ++ ++ sector = sh->dev[i].sector; ++ set_bit(R5_LOCKED, &sh->dev[i].flags); ++ BUG_ON(test_bit(R5_Direct, &sh->dev[i].flags)); ++ ++ /* check if it's covered by a single page ++ and whole stripe is written at once. ++ * in this case we can avoid memcpy() */ ++ if (zerocopy && wbi && wbi->bi_next == NULL && ++ test_bit(R5_OVERWRITE, &sh->dev[i].flags)) { ++ page = zero_copy_data(wbi, sector); ++ BUG_ON(PageHighMem(page)); ++ sh->dev[i].req.bi_io_vec[0].bv_page = page; ++ set_bit(R5_Direct, &sh->dev[i].flags); ++ continue; ++ } + +- set_bit(R5_LOCKED, &sh->dev[i].flags); +- set_bit(R5_UPTODATE, &sh->dev[i].flags); ++ set_bit(R5_UPTODATE, &sh->dev[i].flags); ++ while (wbi && wbi->bi_sector < sector + STRIPE_SECTORS) { ++ copy_data(1, wbi, sh->dev[i].page, sector); ++ wbi = r5_next_bio(wbi, sector); + } ++ } + + switch(method) { + case RECONSTRUCT_WRITE: + case CHECK_PARITY: +- for (i=disks; i--;) +- if (i != pd_idx) { +- ptr[count++] = page_address(sh->dev[i].page); +- check_xor(); +- } ++ for (i=disks; i--;) { ++ if (i == pd_idx) ++ continue; ++ if (test_bit(R5_Direct, &sh->dev[i].flags)) ++ page = sh->dev[i].req.bi_io_vec[0].bv_page; ++ else ++ page = sh->dev[i].page; ++ ptr[count++] = page_address(page); ++ check_xor(); ++ } + break; + case READ_MODIFY_WRITE: +- for (i = disks; i--;) +- if (sh->dev[i].written) { +- ptr[count++] = page_address(sh->dev[i].page); +- check_xor(); +- } ++ for (i = disks; i--;) { ++ if (!sh->dev[i].written) ++ continue; ++ if (test_bit(R5_Direct, &sh->dev[i].flags)) ++ page = sh->dev[i].req.bi_io_vec[0].bv_page; ++ else ++ page = sh->dev[i].page; ++ ptr[count++] = page_address(page); ++ check_xor(); ++ } + } + if (count != 1) + xor_block(count, STRIPE_SIZE, ptr); +@@ -1012,7 +1094,7 @@ static void handle_stripe(struct stripe_ + dev = &sh->dev[sh->pd_idx]; + if ( written && + ( (test_bit(R5_Insync, &dev->flags) && !test_bit(R5_LOCKED, &dev->flags) && +- test_bit(R5_UPTODATE, &dev->flags)) ++ (test_bit(R5_UPTODATE, &dev->flags) || test_bit(R5_Direct, &dev->flags))) + || (failed == 1 && failed_num == sh->pd_idx)) + ) { + /* any written block on an uptodate or failed drive can be returned. +@@ -1023,13 +1105,16 @@ static void handle_stripe(struct stripe_ + if (sh->dev[i].written) { + dev = &sh->dev[i]; + if (!test_bit(R5_LOCKED, &dev->flags) && +- test_bit(R5_UPTODATE, &dev->flags) ) { ++ (test_bit(R5_UPTODATE, &dev->flags) || ++ test_bit(R5_Direct, &dev->flags)) ) { + /* We can return any write requests */ + struct bio *wbi, *wbi2; + PRINTK("Return write for disc %d\n", i); + spin_lock_irq(&conf->device_lock); + wbi = dev->written; + dev->written = NULL; ++ if (test_bit(R5_Direct, &dev->flags)) ++ clear_bit(R5_Direct, &dev->flags); + while (wbi && wbi->bi_sector < dev->sector + STRIPE_SECTORS) { + wbi2 = r5_next_bio(wbi, dev->sector); + if (--wbi->bi_phys_segments == 0) { diff --git a/lustre/kernel_patches/patches/raid5-serialize-ovelapping-reqs.patch b/lustre/kernel_patches/patches/raid5-serialize-ovelapping-reqs.patch new file mode 100644 index 0000000..77cde30 --- /dev/null +++ b/lustre/kernel_patches/patches/raid5-serialize-ovelapping-reqs.patch @@ -0,0 +1,136 @@ +Index: linux-2.6.9/include/linux/raid/raid5.h +=================================================================== +--- linux-2.6.9.orig/include/linux/raid/raid5.h 2006-05-22 00:11:21.000000000 +0400 ++++ linux-2.6.9/include/linux/raid/raid5.h 2006-05-22 00:11:21.000000000 +0400 +@@ -134,6 +134,7 @@ struct stripe_head { + unsigned long state; /* state flags */ + atomic_t count; /* nr of active thread/requests */ + spinlock_t lock; ++ wait_queue_head_t wait; /* waitchan for overlapped bio's */ + struct r5dev { + struct bio req; + struct bio_vec vec; +Index: linux-2.6.9/drivers/md/raid5.c +=================================================================== +--- linux-2.6.9.orig/drivers/md/raid5.c 2006-05-22 00:11:21.000000000 +0400 ++++ linux-2.6.9/drivers/md/raid5.c 2006-05-22 00:19:27.000000000 +0400 +@@ -308,6 +308,7 @@ static int grow_stripes(raid5_conf_t *co + memset(sh, 0, sizeof(*sh) + (devs-1)*sizeof(struct r5dev)); + sh->raid_conf = conf; + sh->lock = SPIN_LOCK_UNLOCKED; ++ init_waitqueue_head(&sh->wait); + + if (grow_buffers(sh, conf->raid_disks)) { + shrink_buffers(sh, conf->raid_disks); +@@ -878,6 +879,9 @@ static void compute_parity(struct stripe + set_bit(R5_LOCKED, &sh->dev[pd_idx].flags); + } else + clear_bit(R5_UPTODATE, &sh->dev[pd_idx].flags); ++ ++ /* probably someone waits for our completion? */ ++ wake_up(&sh->wait); + } + + /* +@@ -885,7 +889,7 @@ static void compute_parity(struct stripe + * toread/towrite point to the first in a chain. + * The bi_next chain must be in order. + */ +-static void add_stripe_bio (struct stripe_head *sh, struct bio *bi, int dd_idx, int forwrite) ++static int add_stripe_bio (struct stripe_head *sh, struct bio *bi, int dd_idx, int forwrite) + { + struct bio **bip; + raid5_conf_t *conf = sh->raid_conf; +@@ -894,13 +898,21 @@ static void add_stripe_bio (struct strip + (unsigned long long)bi->bi_sector, + (unsigned long long)sh->sector); + +- + spin_lock(&sh->lock); + spin_lock_irq(&conf->device_lock); + if (forwrite) + bip = &sh->dev[dd_idx].towrite; + else + bip = &sh->dev[dd_idx].toread; ++ ++#if 1 ++ if (*bip) { ++ /* overlapping bio, let's wait till first one is completed */ ++ spin_unlock_irq(&conf->device_lock); ++ spin_unlock(&sh->lock); ++ return 1; ++ } ++#else + while (*bip && (*bip)->bi_sector < bi->bi_sector) { + BUG_ON((*bip)->bi_sector + ((*bip)->bi_size >> 9) > bi->bi_sector); + bip = & (*bip)->bi_next; +@@ -910,6 +922,7 @@ static void add_stripe_bio (struct strip + BUG(); + if (*bip) + bi->bi_next = *bip; ++#endif + *bip = bi; + bi->bi_phys_segments ++; + spin_unlock_irq(&conf->device_lock); +@@ -932,6 +945,7 @@ static void add_stripe_bio (struct strip + if (sector >= sh->dev[dd_idx].sector + STRIPE_SECTORS) + set_bit(R5_OVERWRITE, &sh->dev[dd_idx].flags); + } ++ return 0; + } + + /* +@@ -1014,6 +1028,7 @@ static void handle_stripe(struct stripe_ + rbi = dev->toread; + dev->toread = NULL; + spin_unlock_irq(&conf->device_lock); ++ wake_up(&sh->wait); + while (rbi && rbi->bi_sector < dev->sector + STRIPE_SECTORS) { + copy_data(0, rbi, dev->page, dev->sector); + rbi2 = r5_next_bio(rbi, dev->sector); +@@ -1059,6 +1074,7 @@ static void handle_stripe(struct stripe_ + bi = sh->dev[i].towrite; + sh->dev[i].towrite = NULL; + if (bi) to_write--; ++ wake_up(&sh->wait); + + while (bi && bi->bi_sector < sh->dev[i].sector + STRIPE_SECTORS){ + struct bio *nextbi = r5_next_bio(bi, sh->dev[i].sector); +@@ -1511,6 +1527,16 @@ static inline void raid5_plug_device(rai + spin_unlock_irq(&conf->device_lock); + } + ++static inline void raid5_wait_stripe(struct stripe_head *sh, int dd_idx, int forwrite) ++{ ++ struct bio **bip; ++ if (forwrite) ++ bip = &sh->dev[dd_idx].towrite; ++ else ++ bip = &sh->dev[dd_idx].toread; ++ wait_event(sh->wait, *bip == NULL); ++} ++ + static int make_request (request_queue_t *q, struct bio * bi) + { + mddev_t *mddev = q->queuedata; +@@ -1580,6 +1606,7 @@ repeat: + * if we can't, then it's time to submit + * all collected bio's in order to free + * some space in the cache -bzzz */ ++try_stripe: + sh = get_active_stripe(conf, new_sector, pd_idx, 1); + if (!sh && !(bi->bi_rw&RWA_MASK)) { + raid5_flush_bios(conf, bios, raid_disks); +@@ -1587,7 +1614,11 @@ repeat: + } + } + if (sh) { +- add_stripe_bio(sh, bi, dd_idx, (bi->bi_rw&RW_MASK)); ++ if (add_stripe_bio(sh, bi, dd_idx, (bi->bi_rw&RW_MASK))) { ++ release_stripe(sh); ++ raid5_wait_stripe(sh, dd_idx, bi->bi_rw&RW_MASK); ++ goto try_stripe; ++ } + } else { + /* cannot get stripe for read-ahead, just give-up */ + clear_bit(BIO_UPTODATE, &bi->bi_flags); diff --git a/lustre/kernel_patches/patches/raid5-stats.patch b/lustre/kernel_patches/patches/raid5-stats.patch new file mode 100644 index 0000000..396bc6d --- /dev/null +++ b/lustre/kernel_patches/patches/raid5-stats.patch @@ -0,0 +1,198 @@ +Index: linux-2.6.9/include/linux/raid/raid5.h +=================================================================== +--- linux-2.6.9.orig/include/linux/raid/raid5.h 2004-10-19 01:54:55.000000000 +0400 ++++ linux-2.6.9/include/linux/raid/raid5.h 2006-05-17 14:10:53.000000000 +0400 +@@ -222,6 +222,22 @@ struct raid5_private_data { + int inactive_blocked; /* release of inactive stripes blocked, + * waiting for 25% to be free + */ ++ /* ++ * Stats ++ */ ++ atomic_t reads_in; ++ atomic_t writes_in; ++ atomic_t reads_out; ++ atomic_t writes_out; ++ atomic_t handled_in_raid5d; ++ atomic_t out_of_stripes; ++ atomic_t reads_for_rmw; ++ atomic_t reads_for_rcw; ++ atomic_t handle_called; ++ atomic_t delayed; ++ atomic_t in_reqs_in_queue; ++ atomic_t out_reqs_in_queue; ++ + spinlock_t device_lock; + struct disk_info disks[0]; + }; +Index: linux-2.6.9/drivers/md/raid5.c +=================================================================== +--- linux-2.6.9.orig/drivers/md/raid5.c 2006-03-10 18:20:48.000000000 +0300 ++++ linux-2.6.9/drivers/md/raid5.c 2006-05-17 14:10:53.000000000 +0400 +@@ -77,9 +77,10 @@ static inline void __release_stripe(raid + if (atomic_read(&conf->active_stripes)==0) + BUG(); + if (test_bit(STRIPE_HANDLE, &sh->state)) { +- if (test_bit(STRIPE_DELAYED, &sh->state)) ++ if (test_bit(STRIPE_DELAYED, &sh->state)) { + list_add_tail(&sh->lru, &conf->delayed_list); +- else ++ atomic_inc(&conf->delayed); ++ } else + list_add_tail(&sh->lru, &conf->handle_list); + md_wakeup_thread(conf->mddev->thread); + } else { +@@ -250,6 +251,7 @@ static struct stripe_head *get_active_st + if (noblock && sh == NULL) + break; + if (!sh) { ++ atomic_inc(&conf->out_of_stripes); + conf->inactive_blocked = 1; + wait_event_lock_irq(conf->wait_for_stripe, + !list_empty(&conf->inactive_list) && +@@ -271,6 +273,8 @@ static struct stripe_head *get_active_st + if (list_empty(&sh->lru)) + BUG(); + list_del_init(&sh->lru); ++ if (test_bit(STRIPE_DELAYED, &sh->state)) ++ atomic_dec(&conf->delayed); + } + } + } while (sh == NULL); +@@ -349,6 +353,8 @@ static int raid5_end_read_request (struc + if (bi->bi_size) + return 1; + ++ atomic_dec(&conf->out_reqs_in_queue); ++ + for (i=0 ; idev[i].req) + break; +@@ -422,6 +428,8 @@ static int raid5_end_write_request (stru + if (bi->bi_size) + return 1; + ++ atomic_dec(&conf->out_reqs_in_queue); ++ + for (i=0 ; idev[i].req) + break; +@@ -882,6 +890,7 @@ static void handle_stripe(struct stripe_ + spin_lock(&sh->lock); + clear_bit(STRIPE_HANDLE, &sh->state); + clear_bit(STRIPE_DELAYED, &sh->state); ++ atomic_inc(&conf->handle_called); + + syncing = test_bit(STRIPE_SYNCING, &sh->state); + /* Now to look around and see what can be done */ +@@ -1127,6 +1136,7 @@ static void handle_stripe(struct stripe_ + set_bit(R5_LOCKED, &dev->flags); + set_bit(R5_Wantread, &dev->flags); + locked++; ++ atomic_inc(&conf->reads_for_rmw); + } else { + set_bit(STRIPE_DELAYED, &sh->state); + set_bit(STRIPE_HANDLE, &sh->state); +@@ -1146,6 +1156,7 @@ static void handle_stripe(struct stripe_ + set_bit(R5_LOCKED, &dev->flags); + set_bit(R5_Wantread, &dev->flags); + locked++; ++ atomic_inc(&conf->reads_for_rcw); + } else { + set_bit(STRIPE_DELAYED, &sh->state); + set_bit(STRIPE_HANDLE, &sh->state); +@@ -1228,6 +1239,7 @@ static void handle_stripe(struct stripe_ + bi->bi_next = NULL; + bi->bi_size = 0; + bi->bi_end_io(bi, bytes, 0); ++ atomic_dec(&conf->in_reqs_in_queue); + } + for (i=disks; i-- ;) { + int rw; +@@ -1243,10 +1255,13 @@ static void handle_stripe(struct stripe_ + bi = &sh->dev[i].req; + + bi->bi_rw = rw; +- if (rw) ++ if (rw) { ++ atomic_inc(&conf->writes_out); + bi->bi_end_io = raid5_end_write_request; +- else ++ } else { ++ atomic_inc(&conf->reads_out); + bi->bi_end_io = raid5_end_read_request; ++ } + + spin_lock_irq(&conf->device_lock); + rdev = conf->disks[i].rdev; +@@ -1274,6 +1289,7 @@ static void handle_stripe(struct stripe_ + bi->bi_io_vec[0].bv_offset = 0; + bi->bi_size = STRIPE_SIZE; + bi->bi_next = NULL; ++ atomic_inc(&conf->out_reqs_in_queue); + generic_make_request(bi); + } else { + PRINTK("skip op %ld on disc %d for sector %llu\n", +@@ -1296,6 +1312,7 @@ static inline void raid5_activate_delaye + if (!test_and_set_bit(STRIPE_PREREAD_ACTIVE, &sh->state)) + atomic_inc(&conf->preread_active_stripes); + list_add_tail(&sh->lru, &conf->handle_list); ++ atomic_dec(&conf->delayed); + } + } + } +@@ -1395,12 +1412,16 @@ static int make_request (request_queue_t + sector_t logical_sector, last_sector; + struct stripe_head *sh; + ++ atomic_inc(&conf->in_reqs_in_queue); ++ + if (bio_data_dir(bi)==WRITE) { + disk_stat_inc(mddev->gendisk, writes); + disk_stat_add(mddev->gendisk, write_sectors, bio_sectors(bi)); ++ atomic_inc(&conf->writes_in); + } else { + disk_stat_inc(mddev->gendisk, reads); + disk_stat_add(mddev->gendisk, read_sectors, bio_sectors(bi)); ++ atomic_inc(&conf->reads_in); + } + + logical_sector = bi->bi_sector & ~((sector_t)STRIPE_SECTORS-1); +@@ -1439,6 +1460,7 @@ static int make_request (request_queue_t + + if ( bio_data_dir(bi) == WRITE ) + md_write_end(mddev); ++ atomic_dec(&conf->in_reqs_in_queue); + bi->bi_size = 0; + bi->bi_end_io(bi, bytes, 0); + } +@@ -1535,6 +1557,7 @@ static void raid5d (mddev_t *mddev) + spin_unlock_irq(&conf->device_lock); + + handled++; ++ atomic_inc(&conf->handled_in_raid5d); + handle_stripe(sh); + release_stripe(sh); + +@@ -1767,6 +1790,21 @@ static void status (struct seq_file *seq + conf->disks[i].rdev && + conf->disks[i].rdev->in_sync ? "U" : "_"); + seq_printf (seq, "]"); ++ seq_printf (seq, "\n\t\tin: %u reads, %u writes; out: %u reads, %u writes", ++ atomic_read(&conf->reads_in), atomic_read(&conf->writes_in), ++ atomic_read(&conf->reads_out), atomic_read(&conf->writes_out)); ++ seq_printf (seq, "\n\t\t%u in raid5d, %u out of stripes, %u handle called", ++ atomic_read(&conf->handled_in_raid5d), ++ atomic_read(&conf->out_of_stripes), ++ atomic_read(&conf->handle_called)); ++ seq_printf (seq, "\n\t\treads: %u for rmw, %u for rcw", ++ atomic_read(&conf->reads_for_rmw), ++ atomic_read(&conf->reads_for_rcw)); ++ seq_printf (seq, "\n\t\t%u delayed, %u active, queues: %u in, %u out\n", ++ atomic_read(&conf->delayed), ++ atomic_read(&conf->active_stripes), ++ atomic_read(&conf->in_reqs_in_queue), ++ atomic_read(&conf->out_reqs_in_queue)); + #if RAID5_DEBUG + #define D(x) \ + seq_printf (seq, "<"#x":%d>", atomic_read(&conf->x)) diff --git a/lustre/kernel_patches/patches/raid5-stripe-by-stripe-handling.patch b/lustre/kernel_patches/patches/raid5-stripe-by-stripe-handling.patch new file mode 100644 index 0000000..1faf3ec --- /dev/null +++ b/lustre/kernel_patches/patches/raid5-stripe-by-stripe-handling.patch @@ -0,0 +1,100 @@ +Index: linux-2.6.9/drivers/md/raid5.c +=================================================================== +--- linux-2.6.9.orig/drivers/md/raid5.c 2006-05-22 00:09:56.000000000 +0400 ++++ linux-2.6.9/drivers/md/raid5.c 2006-05-22 00:10:01.000000000 +0400 +@@ -1412,6 +1412,11 @@ static int make_request (request_queue_t + sector_t new_sector; + sector_t logical_sector, last_sector; + struct stripe_head *sh; ++ sector_t stripe, sectors, block, r_sector, b_sector; ++ int sectors_per_chunk = conf->chunk_size >> 9; ++ int stripes_per_chunk, sectors_per_block; ++ int sectors_per_stripe; ++ int i, j; + + atomic_inc(&conf->in_reqs_in_queue); + +@@ -1431,30 +1436,66 @@ static int make_request (request_queue_t + bi->bi_phys_segments = 1; /* over-loaded to count active stripes */ + if ( bio_data_dir(bi) == WRITE ) + md_write_start(mddev); +- for (;logical_sector < last_sector; logical_sector += STRIPE_SECTORS) { +- +- new_sector = raid5_compute_sector(logical_sector, +- raid_disks, data_disks, &dd_idx, &pd_idx, conf); +- +- PRINTK("raid5: make_request, sector %Lu logical %Lu\n", +- (unsigned long long)new_sector, +- (unsigned long long)logical_sector); + +- sh = get_active_stripe(conf, new_sector, pd_idx, (bi->bi_rw&RWA_MASK)); ++ stripes_per_chunk = conf->chunk_size / STRIPE_SIZE; ++ sectors_per_stripe = STRIPE_SECTORS * data_disks; ++ sectors_per_block = stripes_per_chunk * sectors_per_stripe; ++ ++ block = logical_sector & ~((sector_t)sectors_per_block - 1); ++ sector_div(block, sectors_per_block); ++ sectors = bi->bi_size >> 9; ++ ++repeat: ++ stripe = block * sectors_per_block / data_disks; ++ b_sector = stripe * data_disks; ++ /* iterate through all stripes in this block, ++ * where block is a set of internal stripes ++ * which covers chunk */ ++ for (i = 0; i < stripes_per_chunk && sectors > 0; i++) { ++ r_sector = b_sector + (i * STRIPE_SECTORS); ++ sh = NULL; ++ /* iterrate through all pages in the stripe */ ++ for (j = 0; j < data_disks && sectors > 0; j++) { ++ if (r_sector + STRIPE_SECTORS <= bi->bi_sector || ++ r_sector >= last_sector) { ++ r_sector += sectors_per_chunk; ++ continue; ++ } ++ new_sector = raid5_compute_sector(r_sector, raid_disks, ++ data_disks, &dd_idx, ++ &pd_idx, conf); ++ if (sh == NULL) ++ sh = get_active_stripe(conf, new_sector, pd_idx, ++ (bi->bi_rw&RWA_MASK)); ++ if (sh) { ++ add_stripe_bio(sh, bi, dd_idx, (bi->bi_rw&RW_MASK)); ++ } else { ++ /* cannot get stripe for read-ahead, just give-up */ ++ clear_bit(BIO_UPTODATE, &bi->bi_flags); ++ sectors = 0; ++ break; ++ } ++ ++ BUG_ON (new_sector != stripe); ++ sectors -= STRIPE_SECTORS; ++ if (bi->bi_sector > r_sector) ++ sectors += bi->bi_sector - r_sector; ++ if (r_sector + STRIPE_SECTORS > last_sector) ++ sectors += r_sector + STRIPE_SECTORS - last_sector; ++ r_sector += sectors_per_chunk; ++ } + if (sh) { +- +- add_stripe_bio(sh, bi, dd_idx, (bi->bi_rw&RW_MASK)); +- + raid5_plug_device(conf); + handle_stripe(sh); + release_stripe(sh); +- } else { +- /* cannot get stripe for read-ahead, just give-up */ +- clear_bit(BIO_UPTODATE, &bi->bi_flags); +- break; ++ sh = NULL; + } +- ++ stripe += STRIPE_SECTORS; + } ++ block++; ++ if (sectors > 0) ++ goto repeat; ++ + spin_lock_irq(&conf->device_lock); + if (--bi->bi_phys_segments == 0) { + int bytes = bi->bi_size; diff --git a/lustre/kernel_patches/patches/small_scatterlist-2.4.21-rhel.patch b/lustre/kernel_patches/patches/small_scatterlist-2.4.21-rhel.patch index 41d9d8a..625f85f 100644 --- a/lustre/kernel_patches/patches/small_scatterlist-2.4.21-rhel.patch +++ b/lustre/kernel_patches/patches/small_scatterlist-2.4.21-rhel.patch @@ -1,8 +1,7 @@ -Index: linux-2.4.21/crypto/cipher.c -=================================================================== ---- linux-2.4.21.orig/crypto/cipher.c 2005-06-01 22:51:50.000000000 -0400 -+++ linux-2.4.21/crypto/cipher.c 2005-06-01 23:07:51.067582960 -0400 -@@ -88,12 +88,21 @@ +diff -X dontdiff -urp kern_oldest/crypto/cipher.c kern_fix/crypto/cipher.c +--- kern_oldest/crypto/cipher.c 2006-05-01 11:55:53.000000000 -0700 ++++ kern_fix/crypto/cipher.c 2006-05-01 14:14:13.000000000 -0700 +@@ -88,12 +88,21 @@ static void scatterwalk_start(struct sca walk->sg = sg; @@ -24,11 +23,10 @@ Index: linux-2.4.21/crypto/cipher.c } static void scatterwalk_map(struct scatter_walk *walk, int out) -Index: linux-2.4.21/crypto/digest.c -=================================================================== ---- linux-2.4.21.orig/crypto/digest.c 2005-06-01 22:51:50.000000000 -0400 -+++ linux-2.4.21/crypto/digest.c 2005-06-01 23:07:51.068582808 -0400 -@@ -29,7 +29,11 @@ +diff -X dontdiff -urp kern_oldest/crypto/digest.c kern_fix/crypto/digest.c +--- kern_oldest/crypto/digest.c 2006-05-01 11:55:53.000000000 -0700 ++++ kern_fix/crypto/digest.c 2006-05-01 14:14:13.000000000 -0700 +@@ -29,7 +29,11 @@ static void update(struct crypto_tfm *tf unsigned int i; for (i = 0; i < nsg; i++) { @@ -40,7 +38,7 @@ Index: linux-2.4.21/crypto/digest.c tfm->__crt_alg->cra_digest.dia_update(crypto_tfm_ctx(tfm), p, sg[i].length); crypto_kunmap(p, 0); -@@ -50,7 +54,11 @@ +@@ -50,7 +54,11 @@ static void digest(struct crypto_tfm *tf tfm->crt_digest.dit_init(tfm); for (i = 0; i < nsg; i++) { @@ -52,11 +50,10 @@ Index: linux-2.4.21/crypto/digest.c tfm->__crt_alg->cra_digest.dia_update(crypto_tfm_ctx(tfm), p, sg[i].length); crypto_kunmap(p, 0); -Index: linux-2.4.21/crypto/hmac.c -=================================================================== ---- linux-2.4.21.orig/crypto/hmac.c 2005-06-01 22:51:50.000000000 -0400 -+++ linux-2.4.21/crypto/hmac.c 2005-06-01 23:07:51.068582808 -0400 -@@ -25,8 +25,14 @@ +diff -X dontdiff -urp kern_oldest/crypto/hmac.c kern_fix/crypto/hmac.c +--- kern_oldest/crypto/hmac.c 2006-05-01 11:55:53.000000000 -0700 ++++ kern_fix/crypto/hmac.c 2006-05-01 14:14:13.000000000 -0700 +@@ -25,8 +25,14 @@ static void hash_key(struct crypto_tfm * { struct scatterlist tmp; @@ -71,7 +68,7 @@ Index: linux-2.4.21/crypto/hmac.c tmp.length = keylen; crypto_digest_digest(tfm, &tmp, 1, key); -@@ -70,8 +76,14 @@ +@@ -70,8 +76,14 @@ void crypto_hmac_init(struct crypto_tfm for (i = 0; i < crypto_tfm_alg_blocksize(tfm); i++) ipad[i] ^= 0x36; @@ -86,7 +83,7 @@ Index: linux-2.4.21/crypto/hmac.c tmp.length = crypto_tfm_alg_blocksize(tfm); crypto_digest_init(tfm); -@@ -104,15 +116,27 @@ +@@ -104,15 +116,27 @@ void crypto_hmac_final(struct crypto_tfm for (i = 0; i < crypto_tfm_alg_blocksize(tfm); i++) opad[i] ^= 0x5c; @@ -114,10 +111,9 @@ Index: linux-2.4.21/crypto/hmac.c tmp.length = crypto_tfm_alg_digestsize(tfm); crypto_digest_update(tfm, &tmp, 1); -Index: linux-2.4.21/crypto/tcrypt.c -=================================================================== ---- linux-2.4.21.orig/crypto/tcrypt.c 2005-06-01 22:51:50.000000000 -0400 -+++ linux-2.4.21/crypto/tcrypt.c 2005-06-01 23:07:51.071582352 -0400 +diff -X dontdiff -urp kern_oldest/crypto/tcrypt.c kern_fix/crypto/tcrypt.c +--- kern_oldest/crypto/tcrypt.c 2006-05-01 11:55:53.000000000 -0700 ++++ kern_fix/crypto/tcrypt.c 2006-05-01 14:14:13.000000000 -0700 @@ -24,6 +24,15 @@ #include #include "tcrypt.h" @@ -134,7 +130,7 @@ Index: linux-2.4.21/crypto/tcrypt.c /* * Need to kmalloc() memory for testing kmap(). */ -@@ -95,8 +104,8 @@ +@@ -95,8 +104,8 @@ test_md5(void) memset(result, 0, sizeof (result)); p = md5_tv[i].plaintext; @@ -145,7 +141,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[0].length = strlen(md5_tv[i].plaintext); crypto_digest_init(tfm); -@@ -118,13 +127,13 @@ +@@ -118,13 +127,13 @@ test_md5(void) memcpy(&xbuf[IDX2], "nopqrstuvwxyz", 13); p = &xbuf[IDX1]; @@ -163,7 +159,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[1].length = 13; memset(result, 0, sizeof (result)); -@@ -172,8 +181,8 @@ +@@ -172,8 +181,8 @@ test_hmac_md5(void) memset(result, 0, sizeof (result)); p = hmac_md5_tv[i].plaintext; @@ -174,7 +170,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[0].length = strlen(hmac_md5_tv[i].plaintext); klen = strlen(hmac_md5_tv[i].key); -@@ -194,13 +203,13 @@ +@@ -194,13 +203,13 @@ test_hmac_md5(void) memcpy(&xbuf[IDX2], "for nothing?", 12); p = &xbuf[IDX1]; @@ -192,7 +188,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[1].length = 12; memset(result, 0, sizeof (result)); -@@ -249,8 +258,8 @@ +@@ -249,8 +258,8 @@ test_hmac_sha1(void) memset(result, 0, sizeof (result)); p = hmac_sha1_tv[i].plaintext; @@ -203,7 +199,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[0].length = strlen(hmac_sha1_tv[i].plaintext); klen = strlen(hmac_sha1_tv[i].key); -@@ -273,13 +282,13 @@ +@@ -273,13 +282,13 @@ test_hmac_sha1(void) memcpy(&xbuf[IDX2], "for nothing?", 12); p = &xbuf[IDX1]; @@ -221,7 +217,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[1].length = 12; memset(result, 0, sizeof (result)); -@@ -328,8 +337,8 @@ +@@ -328,8 +337,8 @@ test_hmac_sha256(void) memset(result, 0, sizeof (result)); p = hmac_sha256_tv[i].plaintext; @@ -232,7 +228,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[0].length = strlen(hmac_sha256_tv[i].plaintext); klen = strlen(hmac_sha256_tv[i].key); -@@ -382,8 +391,8 @@ +@@ -382,8 +391,8 @@ test_md4(void) memset(result, 0, sizeof (result)); p = md4_tv[i].plaintext; @@ -243,7 +239,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[0].length = strlen(md4_tv[i].plaintext); crypto_digest_digest(tfm, sg, 1, result); -@@ -432,8 +441,8 @@ +@@ -432,8 +441,8 @@ test_sha1(void) memset(result, 0, sizeof (result)); p = sha1_tv[i].plaintext; @@ -254,7 +250,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[0].length = strlen(sha1_tv[i].plaintext); crypto_digest_init(tfm); -@@ -455,13 +464,13 @@ +@@ -455,13 +464,13 @@ test_sha1(void) memcpy(&xbuf[IDX2], "hijkijkljklmklmnlmnomnopnopq", 28); p = &xbuf[IDX1]; @@ -272,7 +268,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[1].length = 28; memset(result, 0, sizeof (result)); -@@ -507,8 +516,8 @@ +@@ -507,8 +516,8 @@ test_sha256(void) memset(result, 0, sizeof (result)); p = sha256_tv[i].plaintext; @@ -283,7 +279,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[0].length = strlen(sha256_tv[i].plaintext); crypto_digest_init(tfm); -@@ -530,13 +539,13 @@ +@@ -530,13 +539,13 @@ test_sha256(void) memcpy(&xbuf[IDX2], "hijkijkljklmklmnlmnomnopnopq", 28); p = &xbuf[IDX1]; @@ -301,7 +297,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[1].length = 28; memset(result, 0, sizeof (result)); -@@ -583,8 +592,8 @@ +@@ -583,8 +592,8 @@ test_sha384(void) memset(result, 0, sizeof (result)); p = sha384_tv[i].plaintext; @@ -312,7 +308,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[0].length = strlen(sha384_tv[i].plaintext); crypto_digest_init(tfm); -@@ -635,8 +644,8 @@ +@@ -635,8 +644,8 @@ test_sha512(void) memset(result, 0, sizeof (result)); p = sha512_tv[i].plaintext; @@ -323,7 +319,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[0].length = strlen(sha512_tv[i].plaintext); crypto_digest_init(tfm); -@@ -700,8 +709,8 @@ +@@ -700,8 +709,8 @@ test_des(void) len = des_tv[i].len; p = des_tv[i].plaintext; @@ -334,7 +330,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[0].length = len; ret = crypto_cipher_encrypt(tfm, sg, sg, len); if (ret) { -@@ -709,7 +718,7 @@ +@@ -709,7 +718,7 @@ test_des(void) goto out; } @@ -343,7 +339,7 @@ Index: linux-2.4.21/crypto/tcrypt.c hexdump(q, len); printk("%s\n", -@@ -737,13 +746,13 @@ +@@ -737,13 +746,13 @@ test_des(void) memcpy(&xbuf[IDX2], des_tv[i].plaintext + 8, 8); p = &xbuf[IDX1]; @@ -361,7 +357,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[1].length = 8; ret = crypto_cipher_encrypt(tfm, sg, sg, 16); -@@ -753,12 +762,12 @@ +@@ -753,12 +762,12 @@ test_des(void) } printk("page 1\n"); @@ -376,7 +372,7 @@ Index: linux-2.4.21/crypto/tcrypt.c hexdump(q, 8); printk("%s\n", memcmp(q, des_tv[i].result + 8, 8) ? "fail" : "pass"); -@@ -800,18 +809,18 @@ +@@ -800,18 +809,18 @@ test_des(void) memcpy(&xbuf[IDX5], des_tv[i].plaintext + 24, 8); p = &xbuf[IDX3]; @@ -401,7 +397,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[2].length = 8; ret = crypto_cipher_encrypt(tfm, sg, sg, 32); -@@ -822,17 +831,17 @@ +@@ -822,17 +831,17 @@ test_des(void) } printk("page 1\n"); @@ -422,7 +418,7 @@ Index: linux-2.4.21/crypto/tcrypt.c hexdump(q, 8); printk("%s\n", memcmp(q, des_tv[i].result + 24, 8) ? "fail" : "pass"); -@@ -871,23 +880,23 @@ +@@ -871,23 +880,23 @@ test_des(void) memcpy(&xbuf[IDX6], des_tv[i].plaintext + 6, 18); p = &xbuf[IDX3]; @@ -454,7 +450,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[3].length = 18; ret = crypto_cipher_encrypt(tfm, sg, sg, 24); -@@ -898,22 +907,22 @@ +@@ -898,22 +907,22 @@ test_des(void) } printk("page 1\n"); @@ -481,7 +477,7 @@ Index: linux-2.4.21/crypto/tcrypt.c hexdump(q, 18); printk("%s\n", memcmp(q, des_tv[i].result + 6, 18) ? "fail" : "pass"); -@@ -955,28 +964,28 @@ +@@ -955,28 +964,28 @@ test_des(void) memcpy(&xbuf[IDX7], des_tv[i].plaintext + 8, 8); p = &xbuf[IDX3]; @@ -520,7 +516,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[4].length = 8; ret = crypto_cipher_encrypt(tfm, sg, sg, 16); -@@ -987,27 +996,27 @@ +@@ -987,27 +996,27 @@ test_des(void) } printk("page 1\n"); @@ -553,7 +549,7 @@ Index: linux-2.4.21/crypto/tcrypt.c hexdump(q, 8); printk("%s\n", memcmp(q, des_tv[i].result + 8, 8) ? "fail" : "pass"); -@@ -1039,43 +1048,43 @@ +@@ -1039,43 +1048,43 @@ test_des(void) xbuf[IDX8] = des_tv[i].plaintext[7]; p = &xbuf[IDX1]; @@ -613,7 +609,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[7].length = 1; ret = crypto_cipher_encrypt(tfm, sg, sg, 8); -@@ -1085,7 +1094,7 @@ +@@ -1085,7 +1094,7 @@ test_des(void) } for (i = 0; i < 8; i++) @@ -622,7 +618,7 @@ Index: linux-2.4.21/crypto/tcrypt.c hexdump(res, 8); printk("%s\n", memcmp(res, des_tv[7].result, 8) ? "fail" : "pass"); -@@ -1116,8 +1125,8 @@ +@@ -1116,8 +1125,8 @@ test_des(void) len = des_tv[i].len; p = des_tv[i].plaintext; @@ -633,7 +629,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[0].length = len; ret = crypto_cipher_decrypt(tfm, sg, sg, sg[0].length); -@@ -1127,7 +1136,7 @@ +@@ -1127,7 +1136,7 @@ test_des(void) goto out; } @@ -642,7 +638,7 @@ Index: linux-2.4.21/crypto/tcrypt.c hexdump(q, len); printk("%s\n", -@@ -1154,13 +1163,13 @@ +@@ -1154,13 +1163,13 @@ test_des(void) memcpy(&xbuf[IDX2], des_tv[i].plaintext + 8, 8); p = &xbuf[IDX1]; @@ -660,7 +656,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[1].length = 8; ret = crypto_cipher_decrypt(tfm, sg, sg, 16); -@@ -1170,12 +1179,12 @@ +@@ -1170,12 +1179,12 @@ test_des(void) } printk("page 1\n"); @@ -675,7 +671,7 @@ Index: linux-2.4.21/crypto/tcrypt.c hexdump(q, 8); printk("%s\n", memcmp(q, des_tv[i].result + 8, 8) ? "fail" : "pass"); -@@ -1206,18 +1215,18 @@ +@@ -1206,18 +1215,18 @@ test_des(void) memcpy(&xbuf[IDX3], des_tv[i].plaintext + 15, 1); p = &xbuf[IDX1]; @@ -700,7 +696,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[2].length = 1; ret = crypto_cipher_decrypt(tfm, sg, sg, 16); -@@ -1228,17 +1237,17 @@ +@@ -1228,17 +1237,17 @@ test_des(void) } printk("page 1\n"); @@ -721,7 +717,7 @@ Index: linux-2.4.21/crypto/tcrypt.c hexdump(q, 1); printk("%s\n", memcmp(q, des_tv[i].result + 15, 1) ? "fail" : "pass"); -@@ -1283,8 +1292,8 @@ +@@ -1283,8 +1292,8 @@ test_des(void) len = des_tv[i].len; p = des_tv[i].plaintext; @@ -732,7 +728,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[0].length = len; crypto_cipher_set_iv(tfm, des_tv[i].iv, -@@ -1297,7 +1306,7 @@ +@@ -1297,7 +1306,7 @@ test_des(void) goto out; } @@ -741,7 +737,7 @@ Index: linux-2.4.21/crypto/tcrypt.c hexdump(q, len); printk("%s\n", -@@ -1338,13 +1347,13 @@ +@@ -1338,13 +1347,13 @@ test_des(void) memcpy(&xbuf[IDX2], des_tv[i].plaintext + 13, 11); p = &xbuf[IDX1]; @@ -759,7 +755,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[1].length = 11; crypto_cipher_set_iv(tfm, des_tv[i].iv, crypto_tfm_alg_ivsize(tfm)); -@@ -1356,12 +1365,12 @@ +@@ -1356,12 +1365,12 @@ test_des(void) } printk("page 1\n"); @@ -774,7 +770,7 @@ Index: linux-2.4.21/crypto/tcrypt.c hexdump(q, 11); printk("%s\n", memcmp(q, des_tv[i].result + 13, 11) ? "fail" : "pass"); -@@ -1391,8 +1400,8 @@ +@@ -1391,8 +1400,8 @@ test_des(void) len = des_tv[i].len; p = des_tv[i].plaintext; @@ -785,7 +781,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[0].length = len; crypto_cipher_set_iv(tfm, des_tv[i].iv, -@@ -1407,7 +1416,7 @@ +@@ -1407,7 +1416,7 @@ test_des(void) hexdump(tfm->crt_cipher.cit_iv, 8); @@ -794,7 +790,7 @@ Index: linux-2.4.21/crypto/tcrypt.c hexdump(q, len); printk("%s\n", -@@ -1439,13 +1448,13 @@ +@@ -1439,13 +1448,13 @@ test_des(void) memcpy(&xbuf[IDX2], des_tv[i].plaintext + 4, 4); p = &xbuf[IDX1]; @@ -812,7 +808,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[1].length = 4; crypto_cipher_set_iv(tfm, des_tv[i].iv, crypto_tfm_alg_ivsize(tfm)); -@@ -1457,12 +1466,12 @@ +@@ -1457,12 +1466,12 @@ test_des(void) } printk("page 1\n"); @@ -827,7 +823,7 @@ Index: linux-2.4.21/crypto/tcrypt.c hexdump(q, 4); printk("%s\n", memcmp(q, des_tv[i].result + 4, 4) ? "fail" : "pass"); -@@ -1515,8 +1524,8 @@ +@@ -1515,8 +1524,8 @@ test_des3_ede(void) len = des_tv[i].len; p = des_tv[i].plaintext; @@ -838,7 +834,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[0].length = len; ret = crypto_cipher_encrypt(tfm, sg, sg, len); if (ret) { -@@ -1524,7 +1533,7 @@ +@@ -1524,7 +1533,7 @@ test_des3_ede(void) goto out; } @@ -847,7 +843,7 @@ Index: linux-2.4.21/crypto/tcrypt.c hexdump(q, len); printk("%s\n", -@@ -1558,8 +1567,8 @@ +@@ -1558,8 +1567,8 @@ test_des3_ede(void) len = des_tv[i].len; p = des_tv[i].plaintext; @@ -858,7 +854,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[0].length = len; ret = crypto_cipher_decrypt(tfm, sg, sg, len); if (ret) { -@@ -1567,7 +1576,7 @@ +@@ -1567,7 +1576,7 @@ test_des3_ede(void) goto out; } @@ -867,7 +863,7 @@ Index: linux-2.4.21/crypto/tcrypt.c hexdump(q, len); printk("%s\n", -@@ -1621,8 +1630,8 @@ +@@ -1621,8 +1630,8 @@ test_blowfish(void) } p = bf_tv[i].plaintext; @@ -878,7 +874,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[0].length = bf_tv[i].plen; ret = crypto_cipher_encrypt(tfm, sg, sg, sg[0].length); if (ret) { -@@ -1630,7 +1639,7 @@ +@@ -1630,7 +1639,7 @@ test_blowfish(void) goto out; } @@ -887,7 +883,7 @@ Index: linux-2.4.21/crypto/tcrypt.c hexdump(q, bf_tv[i].rlen); printk("%s\n", memcmp(q, bf_tv[i].result, bf_tv[i].rlen) ? -@@ -1663,8 +1672,8 @@ +@@ -1663,8 +1672,8 @@ test_blowfish(void) } p = bf_tv[i].plaintext; @@ -898,7 +894,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[0].length = bf_tv[i].plen; ret = crypto_cipher_decrypt(tfm, sg, sg, sg[0].length); if (ret) { -@@ -1672,7 +1681,7 @@ +@@ -1672,7 +1681,7 @@ test_blowfish(void) goto out; } @@ -907,7 +903,7 @@ Index: linux-2.4.21/crypto/tcrypt.c hexdump(q, bf_tv[i].rlen); printk("%s\n", memcmp(q, bf_tv[i].result, bf_tv[i].rlen) ? -@@ -1712,8 +1721,8 @@ +@@ -1712,8 +1721,8 @@ test_blowfish(void) p = bf_tv[i].plaintext; @@ -918,7 +914,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[0].length = bf_tv[i].plen; crypto_cipher_set_iv(tfm, bf_tv[i].iv, -@@ -1726,7 +1735,7 @@ +@@ -1726,7 +1735,7 @@ test_blowfish(void) goto out; } @@ -927,7 +923,7 @@ Index: linux-2.4.21/crypto/tcrypt.c hexdump(q, bf_tv[i].rlen); printk("%s\n", memcmp(q, bf_tv[i].result, bf_tv[i].rlen) -@@ -1757,8 +1766,8 @@ +@@ -1757,8 +1766,8 @@ test_blowfish(void) p = bf_tv[i].plaintext; @@ -938,7 +934,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[0].length = bf_tv[i].plen; crypto_cipher_set_iv(tfm, bf_tv[i].iv, -@@ -1771,7 +1780,7 @@ +@@ -1771,7 +1780,7 @@ test_blowfish(void) goto out; } @@ -947,7 +943,7 @@ Index: linux-2.4.21/crypto/tcrypt.c hexdump(q, bf_tv[i].rlen); printk("%s\n", memcmp(q, bf_tv[i].result, bf_tv[i].rlen) -@@ -1826,8 +1835,8 @@ +@@ -1826,8 +1835,8 @@ test_twofish(void) } p = tf_tv[i].plaintext; @@ -958,7 +954,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[0].length = tf_tv[i].plen; ret = crypto_cipher_encrypt(tfm, sg, sg, sg[0].length); if (ret) { -@@ -1835,7 +1844,7 @@ +@@ -1835,7 +1844,7 @@ test_twofish(void) goto out; } @@ -967,7 +963,7 @@ Index: linux-2.4.21/crypto/tcrypt.c hexdump(q, tf_tv[i].rlen); printk("%s\n", memcmp(q, tf_tv[i].result, tf_tv[i].rlen) ? -@@ -1868,8 +1877,8 @@ +@@ -1868,8 +1877,8 @@ test_twofish(void) } p = tf_tv[i].plaintext; @@ -978,7 +974,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[0].length = tf_tv[i].plen; ret = crypto_cipher_decrypt(tfm, sg, sg, sg[0].length); if (ret) { -@@ -1877,7 +1886,7 @@ +@@ -1877,7 +1886,7 @@ test_twofish(void) goto out; } @@ -987,7 +983,7 @@ Index: linux-2.4.21/crypto/tcrypt.c hexdump(q, tf_tv[i].rlen); printk("%s\n", memcmp(q, tf_tv[i].result, tf_tv[i].rlen) ? -@@ -1917,8 +1926,8 @@ +@@ -1917,8 +1926,8 @@ test_twofish(void) p = tf_tv[i].plaintext; @@ -998,7 +994,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[0].length = tf_tv[i].plen; crypto_cipher_set_iv(tfm, tf_tv[i].iv, -@@ -1931,7 +1940,7 @@ +@@ -1931,7 +1940,7 @@ test_twofish(void) goto out; } @@ -1007,7 +1003,7 @@ Index: linux-2.4.21/crypto/tcrypt.c hexdump(q, tf_tv[i].rlen); printk("%s\n", memcmp(q, tf_tv[i].result, tf_tv[i].rlen) -@@ -1963,8 +1972,8 @@ +@@ -1963,8 +1972,8 @@ test_twofish(void) p = tf_tv[i].plaintext; @@ -1018,7 +1014,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[0].length = tf_tv[i].plen; crypto_cipher_set_iv(tfm, tf_tv[i].iv, -@@ -1977,7 +1986,7 @@ +@@ -1977,7 +1986,7 @@ test_twofish(void) goto out; } @@ -1027,7 +1023,7 @@ Index: linux-2.4.21/crypto/tcrypt.c hexdump(q, tf_tv[i].rlen); printk("%s\n", memcmp(q, tf_tv[i].result, tf_tv[i].rlen) -@@ -2027,8 +2036,8 @@ +@@ -2027,8 +2036,8 @@ test_serpent(void) } p = serp_tv[i].plaintext; @@ -1038,7 +1034,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[0].length = sizeof(serp_tv[i].plaintext); ret = crypto_cipher_encrypt(tfm, sg, sg, sg[0].length); if (ret) { -@@ -2036,7 +2045,7 @@ +@@ -2036,7 +2045,7 @@ test_serpent(void) goto out; } @@ -1047,7 +1043,7 @@ Index: linux-2.4.21/crypto/tcrypt.c hexdump(q, sizeof(serp_tv[i].result)); printk("%s\n", memcmp(q, serp_tv[i].result, -@@ -2067,8 +2076,8 @@ +@@ -2067,8 +2076,8 @@ test_serpent(void) } p = serp_tv[i].plaintext; @@ -1058,7 +1054,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[0].length = sizeof(serp_tv[i].plaintext); ret = crypto_cipher_decrypt(tfm, sg, sg, sg[0].length); if (ret) { -@@ -2076,7 +2085,7 @@ +@@ -2076,7 +2085,7 @@ test_serpent(void) goto out; } @@ -1067,7 +1063,7 @@ Index: linux-2.4.21/crypto/tcrypt.c hexdump(q, sizeof(serp_tv[i].result)); printk("%s\n", memcmp(q, serp_tv[i].result, -@@ -2126,8 +2135,8 @@ +@@ -2126,8 +2135,8 @@ test_cast6(void) } p = cast_tv[i].plaintext; @@ -1078,7 +1074,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[0].length = sizeof(cast_tv[i].plaintext); ret = crypto_cipher_encrypt(tfm, sg, sg, sg[0].length); if (ret) { -@@ -2135,7 +2144,7 @@ +@@ -2135,7 +2144,7 @@ test_cast6(void) goto out; } @@ -1087,7 +1083,7 @@ Index: linux-2.4.21/crypto/tcrypt.c hexdump(q, sizeof(cast_tv[i].result)); printk("%s\n", memcmp(q, cast_tv[i].result, -@@ -2166,8 +2175,8 @@ +@@ -2166,8 +2175,8 @@ test_cast6(void) } p = cast_tv[i].plaintext; @@ -1098,7 +1094,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[0].length = sizeof(cast_tv[i].plaintext); ret = crypto_cipher_decrypt(tfm, sg, sg, sg[0].length); if (ret) { -@@ -2175,7 +2184,7 @@ +@@ -2175,7 +2184,7 @@ test_cast6(void) goto out; } @@ -1107,7 +1103,7 @@ Index: linux-2.4.21/crypto/tcrypt.c hexdump(q, sizeof(cast_tv[i].result)); printk("%s\n", memcmp(q, cast_tv[i].result, -@@ -2229,8 +2238,8 @@ +@@ -2229,8 +2238,8 @@ test_aes(void) } p = aes_tv[i].plaintext; @@ -1118,7 +1114,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[0].length = aes_tv[i].plen; ret = crypto_cipher_encrypt(tfm, sg, sg, sg[0].length); if (ret) { -@@ -2238,7 +2247,7 @@ +@@ -2238,7 +2247,7 @@ test_aes(void) goto out; } @@ -1127,7 +1123,7 @@ Index: linux-2.4.21/crypto/tcrypt.c hexdump(q, aes_tv[i].rlen); printk("%s\n", memcmp(q, aes_tv[i].result, aes_tv[i].rlen) ? -@@ -2271,8 +2280,8 @@ +@@ -2271,8 +2280,8 @@ test_aes(void) } p = aes_tv[i].plaintext; @@ -1138,7 +1134,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[0].length = aes_tv[i].plen; ret = crypto_cipher_decrypt(tfm, sg, sg, sg[0].length); if (ret) { -@@ -2280,7 +2289,7 @@ +@@ -2280,7 +2289,7 @@ test_aes(void) goto out; } @@ -1147,7 +1143,7 @@ Index: linux-2.4.21/crypto/tcrypt.c hexdump(q, aes_tv[i].rlen); printk("%s\n", memcmp(q, aes_tv[i].result, aes_tv[i].rlen) ? -@@ -2330,8 +2339,8 @@ +@@ -2330,8 +2339,8 @@ test_cast5(void) } p = c5_tv[i].plaintext; @@ -1158,7 +1154,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[0].length = sizeof(c5_tv[i].plaintext); ret = crypto_cipher_encrypt(tfm, sg, sg, sg[0].length); if (ret) { -@@ -2339,7 +2348,7 @@ +@@ -2339,7 +2348,7 @@ test_cast5(void) goto out; } @@ -1167,7 +1163,7 @@ Index: linux-2.4.21/crypto/tcrypt.c hexdump(q, sizeof(c5_tv[i].ciphertext)); printk("%s\n", memcmp(q, c5_tv[i].ciphertext, -@@ -2368,8 +2377,8 @@ +@@ -2368,8 +2377,8 @@ test_cast5(void) } p = c5_tv[i].plaintext; @@ -1178,7 +1174,7 @@ Index: linux-2.4.21/crypto/tcrypt.c sg[0].length = sizeof(c5_tv[i].plaintext); ret = crypto_cipher_decrypt(tfm, sg, sg, sg[0].length); if (ret) { -@@ -2377,7 +2386,7 @@ +@@ -2377,7 +2386,7 @@ test_cast5(void) goto out; } @@ -1187,11 +1183,244 @@ Index: linux-2.4.21/crypto/tcrypt.c hexdump(q, sizeof(c5_tv[i].ciphertext)); printk("%s\n", memcmp(q, c5_tv[i].ciphertext, -Index: linux-2.4.21/drivers/ide/ide-dma.c -=================================================================== ---- linux-2.4.21.orig/drivers/ide/ide-dma.c 2005-06-01 22:52:05.000000000 -0400 -+++ linux-2.4.21/drivers/ide/ide-dma.c 2005-06-01 23:07:51.072582200 -0400 -@@ -280,14 +280,25 @@ +diff -X dontdiff -urp kern_oldest/drivers/addon/iscsi_sfnet/iscsi.c kern_fix/drivers/addon/iscsi_sfnet/iscsi.c +--- kern_oldest/drivers/addon/iscsi_sfnet/iscsi.c 2006-05-01 11:55:44.000000000 -0700 ++++ kern_fix/drivers/addon/iscsi_sfnet/iscsi.c 2006-05-01 14:14:13.000000000 -0700 +@@ -118,6 +118,16 @@ + #include "iscsi-probe.h" + #include "iscsi-crc.h" + ++#if SMALL_SCATTERLIST ++#define ISCSI_SG_ADDRESS(sg) (sg->u.address) ++#define ISCSI_SG_PAGE(sg) (sg->u.page.page) ++#define ISCSI_SG_OFFSET(sg) (sg->u.page.offset) ++#else ++#define ISCSI_SG_ADDRESS(sg) (sg->address) ++#define ISCSI_SG_PAGE(sg) (sg->page) ++#define ISCSI_SG_OFFSET(sg) (sg->offset) ++#endif ++ + /* + * IMPORTANT NOTE: to prevent deadlock, when holding multiple locks, + * the following locking order must be followed at all times: +@@ -2932,15 +2942,17 @@ print_cmnd(Scsi_Cmnd * sc) + #if (HAS_SCATTERLIST_PAGE && HAS_SCATTERLIST_ADDRESS) + printk("iSCSI: sglist %p index %02d = addr %p, page %p, " + "offset %u, len %u\n", +- sglist, i, sglist->address, sglist->page, sglist->offset, +- sglist->length); ++ sglist, i, ISCSI_SG_ADDRESS(sglist), ++ ISCSI_SG_PAGE(sglist), ++ ISCSI_SG_OFFSET(sglist), sglist->length); + #elif HAS_SCATTERLIST_PAGE + printk("iSCSI: sglist %p index %02d = page %p, offset %u, " + "len %u\n", +- sglist, i, sglist->page, sglist->offset, sglist->length); ++ sglist, i, ISCSI_SG_PAGE(sglist), ISCSI_SG_OFFSET(sglist), ++ sglist->length); + #else + printk("iSCSI: sglist %p index %02d = addr %p, len %u\n", +- sglist, i, sglist->address, sglist->length); ++ sglist, i, ISCSI_SG_ADDRESS(sglist), sglist->length); + #endif + sglist++; + } +@@ -5305,7 +5317,7 @@ iscsi_xmit_task(iscsi_task_t * task) + bytes_from_segment = sg->length - segment_offset; + if (bytes_from_segment > bytes_to_fill) { + /* only need part of this segment */ +- iov[iovn].iov_base = sg->address + segment_offset; ++ iov[iovn].iov_base = ISCSI_SG_ADDRESS(sg) + segment_offset; + iov[iovn].iov_len = bytes_to_fill; + xfrlen += bytes_to_fill; + DEBUG_FLOW("iSCSI: session %p xmit_data xfrlen %d, " +@@ -5862,21 +5874,21 @@ sg_virtual_address(struct scatterlist *s + { + #if (HAS_SCATTERLIST_PAGE && HAS_SCATTERLIST_ADDRESS) + /* page may or may not be mapped */ +- if (sg->address) { +- return sg->address; +- } else if (sg->page) { +- return page_address(sg->page) + sg->offset; ++ if (ISCSI_SG_ADDRESS(sg)) { ++ return ISCSI_SG_ADDRESS(sg); ++ } else if (ISCSI_SG_PAGE(sg)) { ++ return page_address(ISCSI_SG_PAGE(sg)) + ISCSI_SG_OFFSET(sg); + } + return NULL; + + #elif HAS_SCATTERLIST_PAGE + /* should have already mapped the page */ +- if (sg->page) { +- return page_address(sg->page) + sg->offset; ++ if (ISCSI_SG_PAGE(sg)) { ++ return page_address(ISCSI_SG_PAGE(sg)) + ISCSI_SG_OFFSET(sg); + } + return NULL; + #else +- return sg->address; ++ return ISCSI_SG_ADDRESS(sg); + #endif + + } +@@ -5899,12 +5911,12 @@ kmap_sg(struct scatterlist *sg) + { + #if (HAS_SCATTERLIST_PAGE && HAS_SCATTERLIST_ADDRESS) + /* page may or may not be mapped if HIGHMEM is in use */ +- if (sg->address) { +- DEBUG_FLOW("iSCSI: kmap sg %p to address %p\n", sg, sg->address); +- return sg->address; +- } else if (sg->page) { +- void *addr = kmap(sg->page); +- DEBUG_FLOW("iSCSI: kmap sg %p page %p to addr %p\n", sg, sg->page, ++ if (ISCSI_SG_ADDRESS(sg)) { ++ DEBUG_FLOW("iSCSI: kmap sg %p to address %p\n", sg, ISCSI_SG_ADDRESS(sg)); ++ return ISCSI_SG_ADDRESS(sg); ++ } else if (ISCSI_SG_PAGE(sg)) { ++ void *addr = kmap(ISCSI_SG_PAGE(sg)); ++ DEBUG_FLOW("iSCSI: kmap sg %p page %p to addr %p\n", sg, ISCSI_SG_PAGE(sg), + addr); + return addr; + } +@@ -5912,15 +5924,15 @@ kmap_sg(struct scatterlist *sg) + + #elif HAS_SCATTERLIST_PAGE + /* there is no address, must kmap the page */ +- if (sg->page) { +- return kmap(sg->page); ++ if (ISCSI_SG_PAGE(sg)) { ++ return kmap(ISCSI_SG_PAGE(sg)); + } + return NULL; + + #else + /* just use the address */ +- DEBUG_FLOW("iSCSI: kmap sg %p to address %p\n", sg, sg->address); +- return sg->address; ++ DEBUG_FLOW("iSCSI: kmap sg %p to address %p\n", sg, ISCSI_SG_ADDRESS(sg)); ++ return ISCSI_SG_ADDRESS(sg); + #endif + } + +@@ -5932,11 +5944,11 @@ static inline void + kunmap_sg(struct scatterlist *sg) + { + #if (HAS_SCATTERLIST_PAGE && HAS_SCATTERLIST_ADDRESS) +- if (!sg->address && sg->page) +- kunmap(sg->page); ++ if (!ISCSI_SG_ADDRESS(sg) && ISCSI_SG_PAGE(sg)) ++ kunmap(ISCSI_SG_PAGE(sg)); + #elif HAS_SCATTERLIST_PAGE +- if (sg->page) +- kunmap(sg->page); ++ if (ISCSI_SG_PAGE(sg)) ++ kunmap(ISCSI_SG_PAGE(sg)); + #endif + return; + } +diff -X dontdiff -urp kern_oldest/drivers/block/cciss.c kern_fix/drivers/block/cciss.c +--- kern_oldest/drivers/block/cciss.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/block/cciss.c 2006-05-01 14:14:13.000000000 -0700 +@@ -2636,9 +2636,14 @@ next: + } else { + if (seg == MAXSGENTRIES) + BUG(); ++#if SMALL_SCATTERLIST ++ tmp_sg[seg].u.page.page = bh->b_page; ++ tmp_sg[seg].u.page.offset = bh_offset(bh); ++#else + tmp_sg[seg].page = bh->b_page; +- tmp_sg[seg].length = bh->b_size; + tmp_sg[seg].offset = bh_offset(bh); ++#endif ++ tmp_sg[seg].length = bh->b_size; + lastdataend = bh_phys(bh) + bh->b_size; + seg++; + } +@@ -2652,8 +2657,16 @@ next: + ddir = PCI_DMA_TODEVICE; + for (i=0; iSG[i].Len = tmp_sg[i].length; +- temp64.val = pci_map_page(h->pdev, tmp_sg[i].page, +- tmp_sg[i].offset, tmp_sg[i].length, ddir); ++#if SMALL_SCATTERLIST ++ temp64.val = pci_map_page(h->pdev, ++ tmp_sg[i].u.page.page, ++ tmp_sg[i].u.page.offset, ++ tmp_sg[i].length, ddir); ++#else ++ temp64.val = pci_map_page(h->pdev, ++ tmp_sg[i].page, tmp_sg[i].offset, ++ tmp_sg[i].length, ddir); ++#endif + c->SG[i].Addr.lower = temp64.val32.lower; + c->SG[i].Addr.upper = temp64.val32.upper; + c->SG[i].Ext = 0; /* we are not chaining */ +diff -X dontdiff -urp kern_oldest/drivers/block/cpqarray.c kern_fix/drivers/block/cpqarray.c +--- kern_oldest/drivers/block/cpqarray.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/block/cpqarray.c 2006-05-01 14:14:13.000000000 -0700 +@@ -1003,9 +1003,14 @@ DBGPX( + } else { + if (seg == SG_MAX) + BUG(); ++#if SMALL_SCATTERLIST ++ tmp_sg[seg].u.page.page = bh->b_page; ++ tmp_sg[seg].u.page.offset = bh_offset(bh); ++#else + tmp_sg[seg].page = bh->b_page; +- tmp_sg[seg].length = bh->b_size; + tmp_sg[seg].offset = bh_offset(bh); ++#endif ++ tmp_sg[seg].length = bh->b_size; + lastdataend = bh_phys(bh) + bh->b_size; + seg++; + } +@@ -1014,11 +1019,21 @@ DBGPX( + /* Now do all the DMA Mappings */ + for( i=0; i < seg; i++) { + c->req.sg[i].size = tmp_sg[i].length; ++#if SMALL_SCATTERLIST ++ c->req.sg[i].addr = (__u32) pci_map_page( ++ h->pci_dev, ++ tmp_sg[i].u.page.page, tmp_sg[i].u.page.offset, ++ tmp_sg[i].length, ++ (creq->cmd == READ) ? ++ PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE); ++#else + c->req.sg[i].addr = (__u32) pci_map_page( +- h->pci_dev, tmp_sg[i].page, tmp_sg[i].offset, ++ h->pci_dev, ++ tmp_sg[i].page, tmp_sg[i].offset, + tmp_sg[i].length, + (creq->cmd == READ) ? + PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE); ++#endif + } + DBGPX( printk("Submitting %d sectors in %d segments\n", sect, seg); ); + c->req.hdr.sg_cnt = seg; +diff -X dontdiff -urp kern_oldest/drivers/block/sx8.c kern_fix/drivers/block/sx8.c +--- kern_oldest/drivers/block/sx8.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/block/sx8.c 2006-05-01 14:14:13.000000000 -0700 +@@ -1103,9 +1103,15 @@ static int blk_rq_map_sg(request_queue_t + } else { + if (unlikely(n_elem == CARM_MAX_REQ_SG)) + BUG(); ++#if SMALL_SCATTERLIST ++ sg[n_elem].u.page.page = bh->b_page; ++ sg[n_elem].length = bh->b_size; ++ sg[n_elem].u.page.offset = bh_offset(bh); ++#else + sg[n_elem].page = bh->b_page; + sg[n_elem].length = bh->b_size; + sg[n_elem].offset = bh_offset(bh); ++#endif /* !SMALL_SCATTERLIST */ + last_phys = bh_phys(bh) + bh->b_size; + n_elem++; + } +diff -X dontdiff -urp kern_oldest/drivers/ide/ide-dma.c kern_fix/drivers/ide/ide-dma.c +--- kern_oldest/drivers/ide/ide-dma.c 2006-05-01 11:55:42.000000000 -0700 ++++ kern_fix/drivers/ide/ide-dma.c 2006-05-01 14:14:13.000000000 -0700 +@@ -280,14 +280,25 @@ static int ide_build_sglist (ide_hwif_t memset(&sg[nents], 0, sizeof(*sg)); if (bh->b_page) { @@ -1217,7 +1446,7 @@ Index: linux-2.4.21/drivers/ide/ide-dma.c lastdataend = (unsigned long) bh->b_data + bh->b_size; } -@@ -328,14 +339,24 @@ +@@ -328,14 +339,24 @@ static int ide_raw_build_sglist (ide_hwi #if 1 if (sector_count > 128) { memset(&sg[nents], 0, sizeof(*sg)); @@ -1242,562 +1471,1021 @@ Index: linux-2.4.21/drivers/ide/ide-dma.c sg[nents].length = sector_count * SECTOR_SIZE; nents++; #else -Index: linux-2.4.21/drivers/scsi/dpt_i2o.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/dpt_i2o.c 2005-06-01 22:51:54.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/dpt_i2o.c 2005-06-01 23:07:51.074581896 -0400 -@@ -2152,7 +2152,13 @@ - for(i = 0 ; i < cmd->use_sg; i++) { - *mptr++ = direction|0x10000000|sg->length; - len+=sg->length; +diff -X dontdiff -urp kern_oldest/drivers/ieee1394/dma.c kern_fix/drivers/ieee1394/dma.c +--- kern_oldest/drivers/ieee1394/dma.c 2006-05-01 11:55:43.000000000 -0700 ++++ kern_fix/drivers/ieee1394/dma.c 2006-05-01 14:14:13.000000000 -0700 +@@ -97,8 +97,12 @@ int dma_region_alloc(struct dma_region * + /* fill scatter/gather list with pages */ + for(i = 0; i < dma->n_pages; i++) { + unsigned long va = (unsigned long) dma->kvirt + i * PAGE_SIZE; +- ++ +#if SMALL_SCATTERLIST -+ if (sg->ispaged) -+ BUG(); -+ *mptr++ = virt_to_bus(sg->u.address); -+#else - *mptr++ = virt_to_bus(sg->address); -+#endif - sg++; - } - /* Make this an end of list */ -Index: linux-2.4.21/drivers/scsi/scsi_debug.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/scsi_debug.c 2002-11-28 18:53:14.000000000 -0500 -+++ linux-2.4.21/drivers/scsi/scsi_debug.c 2005-06-01 23:07:51.075581744 -0400 -@@ -186,7 +186,13 @@ - struct scatterlist *sgpnt = (struct scatterlist *) - SCpnt->request_buffer; - -+#if SMALL_SCATTERLIST -+ if (sgpnt[0].ispaged) -+ BUG(); -+ buff = sgpnt[0].u.address; ++ dma->sglist[i].u.page.page = vmalloc_to_page((void *)va); +#else - buff = sgpnt[0].address; + dma->sglist[i].page = vmalloc_to_page((void *)va); +#endif - bufflen = sgpnt[0].length; - /* READ and WRITE process scatterlist themselves */ + dma->sglist[i].length = PAGE_SIZE; } -@@ -672,7 +678,13 @@ - if (SCpnt->use_sg) { - sgcount = 0; - sgpnt = (struct scatterlist *) buff; + +diff -X dontdiff -urp kern_oldest/drivers/ieee1394/sbp2.c kern_fix/drivers/ieee1394/sbp2.c +--- kern_oldest/drivers/ieee1394/sbp2.c 2006-05-01 11:55:43.000000000 -0700 ++++ kern_fix/drivers/ieee1394/sbp2.c 2006-05-01 14:14:13.000000000 -0700 +@@ -2036,11 +2036,19 @@ static int sbp2_create_command_orb(struc + command->dma_dir = dma_dir; + command->dma_size = sgpnt[0].length; + command->dma_type = CMD_DMA_PAGE; +#if SMALL_SCATTERLIST -+ if (sgpnt[sgcount].ispaged) -+ BUG(); -+ buff = sgpnt[sgcount].u.address; ++ command->cmd_dma = pci_map_page(hi->host->pdev, ++ sgpnt[0].u.page.page, ++ sgpnt[0].u.page.offset, ++ command->dma_size, ++ command->dma_dir); +#else - buff = sgpnt[sgcount].address; + command->cmd_dma = pci_map_page(hi->host->pdev, + sgpnt[0].page, + sgpnt[0].offset, + command->dma_size, + command->dma_dir); +#endif - bufflen = sgpnt[sgcount].length; - } - do { -@@ -682,7 +694,13 @@ - block += bufflen >> POW2_SECT_SIZE; - sgcount++; - if (nbytes) { + SBP2_DMA_ALLOC("single page scatter element"); + + command_orb->data_descriptor_hi = ORB_SET_NODE_ID(hi->host->node_id); +diff -X dontdiff -urp kern_oldest/drivers/message/i2o/i2o_scsi.c kern_fix/drivers/message/i2o/i2o_scsi.c +--- kern_oldest/drivers/message/i2o/i2o_scsi.c 2006-05-01 11:55:43.000000000 -0700 ++++ kern_fix/drivers/message/i2o/i2o_scsi.c 2006-05-01 14:14:13.000000000 -0700 +@@ -693,7 +693,11 @@ static int i2o_scsi_queuecommand(Scsi_Cm + { + *mptr++=direction|0x10000000|sg->length; + len+=sg->length; +#if SMALL_SCATTERLIST -+ if (sgpnt[sgcount].ispaged) -+ BUG(); -+ buff = sgpnt[sgcount].u.address; ++ *mptr++=virt_to_bus(sg->u.address); +#else - buff = sgpnt[sgcount].address; + *mptr++=virt_to_bus(sg->address); +#endif - bufflen = sgpnt[sgcount].length; + sg++; } - } else if (nbytes > 0) -@@ -713,7 +731,13 @@ - if (SCpnt->use_sg) { - sgcount = 0; - sgpnt = (struct scatterlist *) buff; + mptr[-2]=direction|0xD0000000|(sg-1)->length; +@@ -704,7 +708,11 @@ static int i2o_scsi_queuecommand(Scsi_Cm + { + i2o_raw_writel(direction|0x10000000|sg->length, mptr++); + len+=sg->length; +#if SMALL_SCATTERLIST -+ if (sgpnt[sgcount].ispaged) -+ BUG(); -+ buff = sgpnt[sgcount].u.address; ++ i2o_raw_writel(virt_to_bus(sg->u.address), mptr++); +#else - buff = sgpnt[sgcount].address; + i2o_raw_writel(virt_to_bus(sg->address), mptr++); +#endif - bufflen = sgpnt[sgcount].length; - } - do { -@@ -724,7 +748,13 @@ - block += bufflen >> POW2_SECT_SIZE; - sgcount++; - if (nbytes) { + sg++; + } + +diff -X dontdiff -urp kern_oldest/drivers/net/fc/iph5526.c kern_fix/drivers/net/fc/iph5526.c +--- kern_oldest/drivers/net/fc/iph5526.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/net/fc/iph5526.c 2006-05-01 14:14:13.000000000 -0700 +@@ -4249,7 +4249,11 @@ int no_of_sg = 0; + if (Cmnd->use_sg) { + int count = 0, j; + for(i = 0; i < no_of_sg; i++) { +#if SMALL_SCATTERLIST -+ if (sgpnt[sgcount].ispaged) -+ BUG(); -+ buff = sgpnt[sgcount].u.address; ++ char *addr_ptr = sl2->u.address; +#else - buff = sgpnt[sgcount].address; + char *addr_ptr = sl2->address; +#endif - bufflen = sgpnt[sgcount].length; - } - } else if (nbytes > 0) -Index: linux-2.4.21/drivers/scsi/scsi_lib.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/scsi_lib.c 2005-06-01 22:52:05.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/scsi_lib.c 2005-06-01 23:07:51.076581592 -0400 -@@ -554,7 +554,13 @@ - if (bbpnt) { - for (i = 0; i < SCpnt->use_sg; i++) { - if (bbpnt[i]) + count = sl2->length / SEST_BUFFER_SIZE; + if (sl2->length % SEST_BUFFER_SIZE) + count++; +@@ -4349,7 +4353,11 @@ int no_of_sg = 0; + int count = 0, j; + count = sl1->length / SEST_BUFFER_SIZE; + for (j = 0; j < count; j++) { +#if SMALL_SCATTERLIST -+ if (sgpnt[i].ispaged) -+ BUG(); -+ scsi_free(sgpnt[i].u.address, sgpnt[i].length); ++ build_EDB(fi, (char *)sl1->u.address, 0, SEST_BUFFER_SIZE); +#else - scsi_free(sgpnt[i].address, sgpnt[i].length); + build_EDB(fi, (char *)sl1->address, 0, SEST_BUFFER_SIZE); +#endif - } - } - scsi_free(SCpnt->request_buffer, SCpnt->sglist_len); -@@ -630,12 +636,23 @@ - if (bbpnt) { - for (i = 0; i < SCpnt->use_sg; i++) { - if (bbpnt[i]) { + memcpy(fi->q.ptr_edb[fi->q.edb_buffer_indx], &(fi->g.edb), sizeof(EDB)); + /* Mark this EDB as being in use */ + fi->q.free_edb_list[fi->q.edb_buffer_indx] = EDB_BUSY; +@@ -4358,13 +4366,21 @@ int no_of_sg = 0; + * safe. + */ + update_EDB_indx(fi); +#if SMALL_SCATTERLIST -+ if (sgpnt[i].ispaged) -+ BUG(); -+ if (req->cmd == READ) { -+ memcpy(bbpnt[i], -+ sgpnt[i].u.address, -+ sgpnt[i].length); -+ } -+ scsi_free(sgpnt[i].u.address, sgpnt[i].length); ++ sl1->u.address += SEST_BUFFER_SIZE; +#else - if (req->cmd == READ) { - memcpy(bbpnt[i], - sgpnt[i].address, - sgpnt[i].length); + sl1->address += SEST_BUFFER_SIZE; ++#endif } - scsi_free(sgpnt[i].address, sgpnt[i].length); + /* Just in case itz not a multiple of + * SEST_BUFFER_SIZE bytes. + */ + if (sl1->length % SEST_BUFFER_SIZE) { ++#if SMALL_SCATTERLIST ++ build_EDB(fi, (char *)sl1->u.address, 0, sl1->length % SEST_BUFFER_SIZE); ++#else + build_EDB(fi, (char *)sl1->address, 0, sl1->length % SEST_BUFFER_SIZE); +#endif - } - } - } -Index: linux-2.4.21/drivers/scsi/scsi_merge.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/scsi_merge.c 2005-06-01 22:51:45.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/scsi_merge.c 2005-06-01 23:07:51.077581440 -0400 -@@ -144,11 +144,21 @@ - */ - for(jj=0; jj < SCpnt->use_sg; jj++) - { + memcpy(fi->q.ptr_edb[fi->q.edb_buffer_indx], &(fi->g.edb), sizeof(EDB)); + fi->q.free_edb_list[fi->q.edb_buffer_indx] = EDB_BUSY; + update_EDB_indx(fi); +diff -X dontdiff -urp kern_oldest/drivers/net/wireless/airo.c kern_fix/drivers/net/wireless/airo.c +--- kern_oldest/drivers/net/wireless/airo.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/net/wireless/airo.c 2006-05-01 14:14:13.000000000 -0700 +@@ -1584,11 +1584,20 @@ void emmh32_setseed(emmh32_context *cont + aes_counter[12] = (u8)(counter >> 24); + counter++; + memcpy (plain, aes_counter, 16); +#if SMALL_SCATTERLIST -+ if (sgpnt[jj].ispaged) -+ BUG(); -+ printk("[%d]\tlen:%d\taddr:%p\tbounce:%p\n", -+ jj, -+ sgpnt[jj].length, -+ sgpnt[jj].u.address, -+ (bbpnt ? bbpnt[jj] : NULL)); ++ sg[0].u.page.page = virt_to_page(plain); ++ sg[0].u.page.offset = ((long) plain & ~PAGE_MASK); +#else - printk("[%d]\tlen:%d\taddr:%p\tbounce:%p\n", - jj, - sgpnt[jj].length, - sgpnt[jj].address, - (bbpnt ? bbpnt[jj] : NULL)); + sg[0].page = virt_to_page(plain); + sg[0].offset = ((long) plain & ~PAGE_MASK); +#endif - if (bbpnt && bbpnt[jj]) - consumed += sgpnt[jj].length; - } -@@ -612,6 +622,9 @@ - max_segments = scsi_max_sg; - - #ifdef DMA_CHUNK_SIZE -+# if SMALL_SCATTERLIST -+# error "This defeats the purpose of SMALL_SCATTERLIST" -+# endif - if (max_segments > 64) - max_segments = 64; - -@@ -929,15 +942,26 @@ - } - - if (SCpnt->host->highmem_io) { + sg[0].length = 16; + crypto_cipher_encrypt(tfm, sg, sg, 16); +#if SMALL_SCATTERLIST -+ sgpnt[count].ispaged = 1; -+ sgpnt[count].u.page.page = bh->b_page; -+ sgpnt[count].u.page.offset = bh_offset(bh); ++ cipher = kmap(sg[0].u.page.page) + sg[0].u.page.offset; +#else - sgpnt[count].page = bh->b_page; - sgpnt[count].offset = bh_offset(bh); - sgpnt[count].address = NULL; + cipher = kmap(sg[0].page) + sg[0].offset; +#endif - } else { - if (PageHighMem(bh->b_page)) - BUG(); + for (j=0; (j<16) && (i< (sizeof(context->coeff)/sizeof(context->coeff[0]))); ) { + context->coeff[i++] = ntohl(*(u32 *)&cipher[j]); + j += 4; +diff -X dontdiff -urp kern_oldest/drivers/scsi/53c7,8xx.c kern_fix/drivers/scsi/53c7,8xx.c +--- kern_oldest/drivers/scsi/53c7,8xx.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/53c7,8xx.c 2006-05-01 14:14:13.000000000 -0700 +@@ -3787,7 +3787,11 @@ create_cmd (Scsi_Cmnd *cmd) { + for (i = 0; cmd->use_sg ? (i < cmd->use_sg) : !i; cmd_datain += 4, + cmd_dataout += 4, ++i) { + u32 buf = cmd->use_sg ? ++#if SMALL_SCATTERLIST ++ virt_to_bus(((struct scatterlist *)cmd->buffer)[i].u.address) : ++#else + virt_to_bus(((struct scatterlist *)cmd->buffer)[i].address) : ++#endif + virt_to_bus(cmd->request_buffer); + u32 count = cmd->use_sg ? + ((struct scatterlist *)cmd->buffer)[i].length : +@@ -5752,8 +5756,13 @@ insn_to_offset (Scsi_Cmnd *cmd, u32 *ins + if ((buffers = cmd->use_sg)) { + for (offset = 0, + segment = (struct scatterlist *) cmd->buffer; ++#if SMALL_SCATTERLIST ++ buffers && !((found = ((ptr >= segment->u.address) && ++ (ptr < (segment->u.address + segment->length))))); ++#else + buffers && !((found = ((ptr >= segment->address) && + (ptr < (segment->address + segment->length))))); ++#endif + --buffers, offset += segment->length, ++segment) + #if 0 + printk("scsi%d: comparing 0x%p to 0x%p\n", +@@ -5761,7 +5770,11 @@ insn_to_offset (Scsi_Cmnd *cmd, u32 *ins + #else + ; + #endif ++#if SMALL_SCATTERLIST ++ offset += ptr - segment->u.address; ++#else + offset += ptr - segment->address; ++#endif + } else { + found = 1; + offset = ptr - (char *) (cmd->request_buffer); +diff -X dontdiff -urp kern_oldest/drivers/scsi/advansys.c kern_fix/drivers/scsi/advansys.c +--- kern_oldest/drivers/scsi/advansys.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/advansys.c 2006-05-01 14:14:13.000000000 -0700 +@@ -6803,7 +6803,11 @@ asc_build_req(asc_board_t *boardp, Scsi_ + slp = (struct scatterlist *) scp->request_buffer; + for (sgcnt = 0; sgcnt < scp->use_sg; sgcnt++, slp++) { + asc_sg_head.sg_list[sgcnt].addr = ++#if SMALL_SCATTERLIST ++ cpu_to_le32(virt_to_bus(slp->u.address)); ++#else + cpu_to_le32(virt_to_bus(slp->address)); ++#endif + asc_sg_head.sg_list[sgcnt].bytes = cpu_to_le32(slp->length); + ASC_STATS_ADD(scp->host, sg_xfer, ASC_CEILING(slp->length, 512)); + } +@@ -7061,7 +7065,11 @@ adv_get_sglist(asc_board_t *boardp, adv_ + for (i = 0; i < NO_OF_SG_PER_BLOCK; i++) + { + sg_block->sg_list[i].sg_addr = ++#if SMALL_SCATTERLIST ++ cpu_to_le32(virt_to_bus(slp->u.address)); ++#else + cpu_to_le32(virt_to_bus(slp->address)); ++#endif + sg_block->sg_list[i].sg_count = cpu_to_le32(slp->length); + ASC_STATS_ADD(scp->host, sg_xfer, ASC_CEILING(slp->length, 512)); + +diff -X dontdiff -urp kern_oldest/drivers/scsi/aha152x.c kern_fix/drivers/scsi/aha152x.c +--- kern_oldest/drivers/scsi/aha152x.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/aha152x.c 2006-05-01 14:14:13.000000000 -0700 +@@ -603,7 +603,11 @@ struct aha152x_scdata { + #define SCSEM(SCpnt) SCDATA(SCpnt)->sem + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) +#if SMALL_SCATTERLIST -+ sgpnt[count].ispaged = 0; -+ sgpnt[count].u.address = bh->b_data; ++#define SG_ADDRESS(buffer) ((buffer)->u.address) +#else - sgpnt[count].page = NULL; - sgpnt[count].address = bh->b_data; + #define SG_ADDRESS(buffer) ((buffer)->address) +#endif - } - - sgpnt[count].length = bh->b_size; -@@ -972,6 +996,50 @@ - * only done for dma_host, in which case .page is not - * set since it's guarenteed to be a low memory page - */ + #else + #define SG_ADDRESS(buffer) ((char *) (page_address((buffer)->page)+(buffer)->offset)) + #endif +diff -X dontdiff -urp kern_oldest/drivers/scsi/aha1542.c kern_fix/drivers/scsi/aha1542.c +--- kern_oldest/drivers/scsi/aha1542.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/aha1542.c 2006-05-01 14:14:13.000000000 -0700 +@@ -69,8 +69,13 @@ static void BAD_SG_DMA(Scsi_Cmnd * SCpnt + { + printk(KERN_CRIT "sgpnt[%d:%d] addr %p/0x%lx length %d\n", + badseg, nseg, +#if SMALL_SCATTERLIST -+ if (sgpnt[i].ispaged) -+ BUG(); -+ if (virt_to_phys(sgpnt[i].u.address) + sgpnt[i].length - 1 > -+ ISA_DMA_THRESHOLD) { -+ if( scsi_dma_free_sectors - sectors <= 10 ) { -+ /* -+ * If this would nearly drain the DMA -+ * pool empty, then let's stop here. -+ * Don't make this request any larger. -+ * This is kind of a safety valve that -+ * we use - we could get screwed later -+ * on if we run out completely. -+ */ -+ SCpnt->request_bufflen -= sgpnt[i].length; -+ SCpnt->use_sg = i; -+ if (i == 0) { -+ goto big_trouble; -+ } -+ break; -+ } ++ sgpnt[badseg].u.address, ++ SCSI_PA(sgpnt[badseg].u.address), ++#else + sgpnt[badseg].address, + SCSI_PA(sgpnt[badseg].address), ++#endif + sgpnt[badseg].length); + + /* +@@ -710,11 +715,21 @@ static int aha1542_queuecommand(Scsi_Cmn + panic("aha1542.c: unable to allocate DMA memory\n"); + for (i = 0; i < SCpnt->use_sg; i++) { + if (sgpnt[i].length == 0 || SCpnt->use_sg > 16 || +- (((int) sgpnt[i].address) & 1) || (sgpnt[i].length & 1)) { ++#if SMALL_SCATTERLIST ++ (((int) sgpnt[i].u.address) & 1) ++#else ++ (((int) sgpnt[i].address) & 1) ++#endif ++ || (sgpnt[i].length & 1)) { + unsigned char *ptr; + printk(KERN_CRIT "Bad segment list supplied to aha1542.c (%d, %d)\n", SCpnt->use_sg, i); + for (i = 0; i < SCpnt->use_sg; i++) { +- printk(KERN_CRIT "%d: %p %d\n", i, sgpnt[i].address, ++ printk(KERN_CRIT "%d: %p %d\n", i, ++#if SMALL_SCATTERLIST ++ sgpnt[i].u.address, ++#else ++ sgpnt[i].address, ++#endif + sgpnt[i].length); + }; + printk(KERN_CRIT "cptr %x: ", (unsigned int) cptr); +@@ -723,8 +738,13 @@ static int aha1542_queuecommand(Scsi_Cmn + printk("%02x ", ptr[i]); + panic("Foooooooood fight!"); + }; ++#if SMALL_SCATTERLIST ++ any2scsi(cptr[i].dataptr, SCSI_PA(sgpnt[i].u.address)); ++ if (SCSI_PA(sgpnt[i].u.address + sgpnt[i].length - 1) > ISA_DMA_THRESHOLD) ++#else + any2scsi(cptr[i].dataptr, SCSI_PA(sgpnt[i].address)); + if (SCSI_PA(sgpnt[i].address + sgpnt[i].length - 1) > ISA_DMA_THRESHOLD) ++#endif + BAD_SG_DMA(SCpnt, sgpnt, SCpnt->use_sg, i); + any2scsi(cptr[i].datalen, sgpnt[i].length); + }; +diff -X dontdiff -urp kern_oldest/drivers/scsi/aha1740.c kern_fix/drivers/scsi/aha1740.c +--- kern_oldest/drivers/scsi/aha1740.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/aha1740.c 2006-05-01 14:14:13.000000000 -0700 +@@ -397,7 +397,11 @@ int aha1740_queuecommand(Scsi_Cmnd * SCp + for(i=0; iuse_sg; i++) + { + cptr[i].datalen = sgpnt[i].length; ++#if SMALL_SCATTERLIST ++ cptr[i].dataptr = virt_to_bus(sgpnt[i].u.address); ++#else + cptr[i].dataptr = virt_to_bus(sgpnt[i].address); ++#endif + } + host->ecb[ecbno].datalen = SCpnt->use_sg * sizeof(struct aha1740_chain); + host->ecb[ecbno].dataptr = virt_to_bus(cptr); +diff -X dontdiff -urp kern_oldest/drivers/scsi/aic7xxx_old.c kern_fix/drivers/scsi/aic7xxx_old.c +--- kern_oldest/drivers/scsi/aic7xxx_old.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/aic7xxx_old.c 2006-05-01 14:14:13.000000000 -0700 +@@ -2845,7 +2845,11 @@ aic7xxx_done(struct aic7xxx_host *p, str + struct scatterlist *sg; + + sg = (struct scatterlist *)cmd->request_buffer; ++#if SMALL_SCATTERLIST ++ buffer = (char *)sg[0].u.address; ++#else + buffer = (char *)sg[0].address; ++#endif + } + else + { +diff -X dontdiff -urp kern_oldest/drivers/scsi/AM53C974.c kern_fix/drivers/scsi/AM53C974.c +--- kern_oldest/drivers/scsi/AM53C974.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/AM53C974.c 2006-05-01 14:14:13.000000000 -0700 +@@ -842,7 +842,11 @@ static __inline__ void initialize_SCp(Sc + if (cmd->use_sg) { + cmd->SCp.buffer = (struct scatterlist *) cmd->buffer; + cmd->SCp.buffers_residual = cmd->use_sg - 1; ++#if SMALL_SCATTERLIST ++ cmd->SCp.ptr = (char *) cmd->SCp.buffer->u.address; ++#else + cmd->SCp.ptr = (char *) cmd->SCp.buffer->address; ++#endif + cmd->SCp.this_residual = cmd->SCp.buffer->length; + } else { + cmd->SCp.buffer = NULL; +@@ -1555,7 +1559,11 @@ static void AM53C974_information_transfe + if ((!cmd->SCp.this_residual) && cmd->SCp.buffers_residual) { + cmd->SCp.buffer++; + cmd->SCp.buffers_residual--; ++#if SMALL_SCATTERLIST ++ cmd->SCp.ptr = (unsigned char *) cmd->SCp.buffer->u.address; ++#else + cmd->SCp.ptr = (unsigned char *) cmd->SCp.buffer->address; ++#endif + cmd->SCp.this_residual = cmd->SCp.buffer->length; + } + if (cmd->SCp.this_residual) { +diff -X dontdiff -urp kern_oldest/drivers/scsi/atp870u.c kern_fix/drivers/scsi/atp870u.c +--- kern_oldest/drivers/scsi/atp870u.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/atp870u.c 2006-05-01 14:14:13.000000000 -0700 +@@ -804,7 +804,11 @@ oktosend: + sgpnt = (struct scatterlist *) workrequ->request_buffer; + i = 0; + for (j = 0; j < workrequ->use_sg; j++) { ++#if SMALL_SCATTERLIST ++ bttl = virt_to_bus(sgpnt[j].u.address); ++#else + bttl = virt_to_bus(sgpnt[j].address); ++#endif + l = sgpnt[j].length; + while (l > 0x10000) { + (unsigned short int) (((unsigned short int *) (prd))[i + 3]) = 0x0000; +diff -X dontdiff -urp kern_oldest/drivers/scsi/BusLogic.c kern_fix/drivers/scsi/BusLogic.c +--- kern_oldest/drivers/scsi/BusLogic.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/BusLogic.c 2006-05-01 14:14:13.000000000 -0700 +@@ -3402,7 +3402,12 @@ int BusLogic_QueueCommand(SCSI_Command_T + CCB->ScatterGatherList[Segment].SegmentByteCount = + ScatterList[Segment].length; + CCB->ScatterGatherList[Segment].SegmentDataPointer = ++#if SMALL_SCATTERLIST ++ Virtual_to_Bus(ScatterList[Segment].u.address); ++#else + Virtual_to_Bus(ScatterList[Segment].address); ++#endif + -+ bbpnt[i] = sgpnt[i].u.address; -+ sgpnt[i].u.address = -+ (char *) scsi_malloc(sgpnt[i].length); -+ /* -+ * If we cannot allocate memory for this DMA bounce -+ * buffer, then queue just what we have done so far. -+ */ -+ if (sgpnt[i].u.address == NULL) { -+ printk("Warning - running low on DMA memory\n"); -+ SCpnt->request_bufflen -= sgpnt[i].length; -+ SCpnt->use_sg = i; -+ if (i == 0) { -+ goto big_trouble; -+ } -+ break; -+ } -+ if (req->cmd == WRITE) { -+ memcpy(sgpnt[i].u.address, bbpnt[i], -+ sgpnt[i].length); -+ } -+ } + } + } + switch (CDB[0]) +diff -X dontdiff -urp kern_oldest/drivers/scsi/dpt_i2o.c kern_fix/drivers/scsi/dpt_i2o.c +--- kern_oldest/drivers/scsi/dpt_i2o.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/dpt_i2o.c 2006-05-01 14:14:13.000000000 -0700 +@@ -2166,7 +2166,13 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pH + for(i = 0 ; i < cmd->use_sg; i++) { + *mptr++ = direction|0x10000000|sg->length; + len+=sg->length; ++#if SMALL_SCATTERLIST ++ if (sg->ispaged) ++ BUG(); ++ *mptr++ = virt_to_bus(sg->u.address); ++#else + *mptr++ = virt_to_bus(sg->address); ++#endif + sg++; + } + /* Make this an end of list */ +diff -X dontdiff -urp kern_oldest/drivers/scsi/eata_dma.c kern_fix/drivers/scsi/eata_dma.c +--- kern_oldest/drivers/scsi/eata_dma.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/eata_dma.c 2006-05-01 14:14:13.000000000 -0700 +@@ -571,7 +571,11 @@ int eata_queue(Scsi_Cmnd * cmd, void (* + ccb->cp_datalen = htonl(cmd->use_sg * sizeof(struct eata_sg_list)); + sl=(struct scatterlist *)cmd->request_buffer; + for(i = 0; i < cmd->use_sg; i++, sl++){ ++#if SMALL_SCATTERLIST ++ ccb->sg_list[i].data = htonl(virt_to_bus(sl->u.address)); ++#else + ccb->sg_list[i].data = htonl(virt_to_bus(sl->address)); ++#endif + ccb->sg_list[i].len = htonl((u32) sl->length); + } + } else { +diff -X dontdiff -urp kern_oldest/drivers/scsi/eata_pio.c kern_fix/drivers/scsi/eata_pio.c +--- kern_oldest/drivers/scsi/eata_pio.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/eata_pio.c 2006-05-01 14:14:13.000000000 -0700 +@@ -99,7 +99,11 @@ void IncStat(Scsi_Pointer *SCp, uint Inc + else + { + SCp->buffer++; ++#if SMALL_SCATTERLIST ++ SCp->ptr=SCp->buffer->u.address; ++#else + SCp->ptr=SCp->buffer->address; ++#endif + SCp->this_residual=SCp->buffer->length; + } + } +@@ -371,7 +375,11 @@ int eata_pio_queue(Scsi_Cmnd * cmd, void + } else { + cmd->SCp.buffer = cmd->request_buffer; + cmd->SCp.buffers_residual = cmd->use_sg; ++#if SMALL_SCATTERLIST ++ cmd->SCp.ptr = cmd->SCp.buffer->u.address; ++#else + cmd->SCp.ptr = cmd->SCp.buffer->address; ++#endif + cmd->SCp.this_residual = cmd->SCp.buffer->length; + } + cmd->SCp.Status = (cmd->SCp.this_residual != 0); /* TRUE as long as bytes +diff -X dontdiff -urp kern_oldest/drivers/scsi/fdomain.c kern_fix/drivers/scsi/fdomain.c +--- kern_oldest/drivers/scsi/fdomain.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/fdomain.c 2006-05-01 14:14:13.000000000 -0700 +@@ -1564,7 +1564,11 @@ void do_fdomain_16x0_intr( int irq, void + if (current_SC->SCp.buffers_residual) { + --current_SC->SCp.buffers_residual; + ++current_SC->SCp.buffer; ++#if SMALL_SCATTERLIST ++ current_SC->SCp.ptr = current_SC->SCp.buffer->u.address; ++#else + current_SC->SCp.ptr = current_SC->SCp.buffer->address; ++#endif + current_SC->SCp.this_residual = current_SC->SCp.buffer->length; + } else + break; +@@ -1597,7 +1601,11 @@ void do_fdomain_16x0_intr( int irq, void + && current_SC->SCp.buffers_residual) { + --current_SC->SCp.buffers_residual; + ++current_SC->SCp.buffer; ++#if SMALL_SCATTERLIST ++ current_SC->SCp.ptr = current_SC->SCp.buffer->u.address; ++#else + current_SC->SCp.ptr = current_SC->SCp.buffer->address; ++#endif + current_SC->SCp.this_residual = current_SC->SCp.buffer->length; + } + } +@@ -1683,7 +1691,11 @@ int fdomain_16x0_queue( Scsi_Cmnd * SCpn + if (current_SC->use_sg) { + current_SC->SCp.buffer = + (struct scatterlist *)current_SC->request_buffer; ++#if SMALL_SCATTERLIST ++ current_SC->SCp.ptr = current_SC->SCp.buffer->u.address; ++#else + current_SC->SCp.ptr = current_SC->SCp.buffer->address; ++#endif + current_SC->SCp.this_residual = current_SC->SCp.buffer->length; + current_SC->SCp.buffers_residual = current_SC->use_sg - 1; + } else { +diff -X dontdiff -urp kern_oldest/drivers/scsi/gdth.c kern_fix/drivers/scsi/gdth.c +--- kern_oldest/drivers/scsi/gdth.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/gdth.c 2006-05-01 14:14:13.000000000 -0700 +@@ -2662,7 +2662,11 @@ static void gdth_copy_internal_data(Scsi + if (cpsum+cpnow > cpcount) + cpnow = cpcount - cpsum; + cpsum += cpnow; ++#if SMALL_SCATTERLIST ++ memcpy((char*)sl->u.address,buffer,cpnow); ++#else + memcpy((char*)sl->address,buffer,cpnow); ++#endif + if (cpsum == cpcount) + break; + buffer += cpnow; +@@ -2837,7 +2841,11 @@ static int gdth_fill_cache_cmd(int hanum + cmdp->u.cache.DestAddr= 0xffffffff; + sl = (struct scatterlist *)scp->request_buffer; + for (i=0; iuse_sg; ++i,++sl) { ++#if SMALL_SCATTERLIST ++ cmdp->u.cache.sg_lst[i].sg_ptr = virt_to_bus(sl->u.address); ++#else + cmdp->u.cache.sg_lst[i].sg_ptr = virt_to_bus(sl->address); ++#endif + cmdp->u.cache.sg_lst[i].sg_len = (ulong32)sl->length; + } + cmdp->u.cache.sg_canz = (ulong32)i; +@@ -2954,7 +2962,11 @@ static int gdth_fill_raw_cmd(int hanum,S + cmdp->u.raw.sdata = 0xffffffff; + sl = (struct scatterlist *)scp->request_buffer; + for (i=0; iuse_sg; ++i,++sl) { ++#if SMALL_SCATTERLIST ++ cmdp->u.raw.sg_lst[i].sg_ptr = virt_to_bus(sl->u.address); ++#else + cmdp->u.raw.sg_lst[i].sg_ptr = virt_to_bus(sl->address); ++#endif + cmdp->u.raw.sg_lst[i].sg_len = (ulong32)sl->length; + } + cmdp->u.raw.sg_ranz = (ulong32)i; +diff -X dontdiff -urp kern_oldest/drivers/scsi/ide-scsi.c kern_fix/drivers/scsi/ide-scsi.c +--- kern_oldest/drivers/scsi/ide-scsi.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/ide-scsi.c 2006-05-01 14:14:13.000000000 -0700 +@@ -154,7 +154,11 @@ static void idescsi_input_buffers (ide_d + return; + } + count = IDE_MIN(pc->sg->length - pc->b_count, bcount); ++#if SMALL_SCATTERLIST ++ HWIF(drive)->atapi_input_bytes(drive, pc->sg->u.address + pc->b_count, count); ++#else + HWIF(drive)->atapi_input_bytes(drive, pc->sg->address + pc->b_count, count); ++#endif + bcount -= count; + pc->b_count += count; + if (pc->b_count == pc->sg->length) { +@@ -176,7 +180,11 @@ static void idescsi_output_buffers (ide_ + return; + } + count = IDE_MIN(pc->sg->length - pc->b_count, bcount); ++#if SMALL_SCATTERLIST ++ HWIF(drive)->atapi_output_bytes(drive, pc->sg->u.address + pc->b_count, count); ++#else + HWIF(drive)->atapi_output_bytes(drive, pc->sg->address + pc->b_count, count); ++#endif + bcount -= count; + pc->b_count += count; + if (pc->b_count == pc->sg->length) { +@@ -1026,6 +1034,19 @@ static inline struct buffer_head *idescs + pc->request_transfer >> 10); + #endif /* IDESCSI_DEBUG_LOG */ + while (segments--) { ++#if SMALL_SCATTERLIST ++#if 1 ++ bh->b_data = sg->u.address; +#else - if (virt_to_phys(sgpnt[i].address) + sgpnt[i].length - 1 > - ISA_DMA_THRESHOLD) { - if( scsi_dma_free_sectors - sectors <= 10 ) { -@@ -1012,6 +1080,7 @@ - sgpnt[i].length); ++ if (sg->u.address) { ++ bh->b_page = virt_to_page(sg->u.address); ++ bh->b_data = (char *) ((unsigned long) sg->u.address & ~PAGE_MASK); ++ } else if (sg->u.page.page) { ++ bh->b_page = sg->u.page.page; ++ bh->b_data = (char *) sg->u.page.offset; ++ } ++#endif ++#else /* !SMALL_SCATTERLIST */ + #if 1 + bh->b_data = sg->address; + #else +@@ -1037,6 +1058,7 @@ static inline struct buffer_head *idescs + bh->b_data = (char *) sg->offset; } - } + #endif ++#endif /* !SMALL_SCATTERLIST */ + bh->b_size = sg->length; + bh = bh->b_reqnext; + sg++; +diff -X dontdiff -urp kern_oldest/drivers/scsi/imm.c kern_fix/drivers/scsi/imm.c +--- kern_oldest/drivers/scsi/imm.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/imm.c 2006-05-01 14:14:13.000000000 -0700 +@@ -834,7 +834,11 @@ static int imm_completion(Scsi_Cmnd * cm + if (cmd->SCp.buffers_residual--) { + cmd->SCp.buffer++; + cmd->SCp.this_residual = cmd->SCp.buffer->length; ++#if SMALL_SCATTERLIST ++ cmd->SCp.ptr = cmd->SCp.buffer->u.address; ++#else + cmd->SCp.ptr = cmd->SCp.buffer->address; +#endif - } - return 1; -Index: linux-2.4.21/drivers/scsi/sg.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/sg.c 2005-06-01 22:52:05.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/sg.c 2005-06-01 23:07:51.080580984 -0400 -@@ -1077,7 +1077,11 @@ - - for (k = 0; k < rsv_schp->k_use_sg; ++k, ++sclp) { - for (m = PAGE_SIZE; m < sclp->length; m += PAGE_SIZE) { + /* + * Make sure that we transfer even number of bytes +@@ -1008,7 +1012,11 @@ static int imm_engine(imm_struct * tmp, + /* if many buffers are available, start filling the first */ + cmd->SCp.buffer = (struct scatterlist *) cmd->request_buffer; + cmd->SCp.this_residual = cmd->SCp.buffer->length; +#if SMALL_SCATTERLIST -+ page_ptr = (unsigned char *)sclp->u.address + m; ++ cmd->SCp.ptr = cmd->SCp.buffer->u.address; +#else - page_ptr = (unsigned char *)sclp->address + m; + cmd->SCp.ptr = cmd->SCp.buffer->address; +#endif - page = virt_to_page(page_ptr); - if (startFinish) - get_page(page); /* increment page count */ -@@ -1130,7 +1134,11 @@ - len = vma->vm_end - sa; - len = (len < sclp->length) ? len : sclp->length; - if (offset < len) { + } else { + /* else fill the only available buffer */ + cmd->SCp.buffer = NULL; +diff -X dontdiff -urp kern_oldest/drivers/scsi/in2000.c kern_fix/drivers/scsi/in2000.c +--- kern_oldest/drivers/scsi/in2000.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/in2000.c 2006-05-01 14:14:13.000000000 -0700 +@@ -355,7 +355,11 @@ DB(DB_QUEUE_COMMAND,printk("Q-%d-%02x-%l + if (cmd->use_sg) { + cmd->SCp.buffer = (struct scatterlist *)cmd->buffer; + cmd->SCp.buffers_residual = cmd->use_sg - 1; +#if SMALL_SCATTERLIST -+ page_ptr = (unsigned char *)sclp->u.address + offset; ++ cmd->SCp.ptr = (char *)cmd->SCp.buffer->u.address; +#else - page_ptr = (unsigned char *)sclp->address + offset; + cmd->SCp.ptr = (char *)cmd->SCp.buffer->address; +#endif - page = virt_to_page(page_ptr); - get_page(page); /* increment page count */ - break; -@@ -1175,8 +1183,13 @@ - - for (k = 0; (k < rsv_schp->k_use_sg) && (sa < vma->vm_end); - ++k, ++sclp) { + cmd->SCp.this_residual = cmd->SCp.buffer->length; + } + else { +@@ -762,7 +766,11 @@ int i; + ++cmd->SCp.buffer; + --cmd->SCp.buffers_residual; + cmd->SCp.this_residual = cmd->SCp.buffer->length; +#if SMALL_SCATTERLIST -+ if ((unsigned long)sclp->u.address & (PAGE_SIZE - 1)) -+ return -EFAULT; /* non page aligned memory ?? */ ++ cmd->SCp.ptr = cmd->SCp.buffer->u.address; +#else - if ((unsigned long)sclp->address & (PAGE_SIZE - 1)) - return -EFAULT; /* non page aligned memory ?? */ + cmd->SCp.ptr = cmd->SCp.buffer->address; +#endif - len = vma->vm_end - sa; - len = (len < sclp->length) ? len : sclp->length; - sa += len; -@@ -1725,16 +1738,27 @@ - offset = (0 == k) ? kp->offset : 0; - num = (rem_sz > (PAGE_SIZE - offset)) ? (PAGE_SIZE - offset) : - rem_sz; + } + + /* Set up hardware registers */ +diff -X dontdiff -urp kern_oldest/drivers/scsi/ini9100u.c kern_fix/drivers/scsi/ini9100u.c +--- kern_oldest/drivers/scsi/ini9100u.c 2006-05-01 11:55:41.000000000 -0700 ++++ kern_fix/drivers/scsi/ini9100u.c 2006-05-01 14:14:13.000000000 -0700 +@@ -489,7 +489,11 @@ static void i91uBuildSCB(HCS * pHCB, SCB + if (SCpnt->use_sg) { + pSrbSG = (struct scatterlist *) SCpnt->request_buffer; + if (SCpnt->use_sg == 1) { /* If only one entry in the list *//* treat it as regular I/O */ +#if SMALL_SCATTERLIST -+ sclp->u.address = page_address(kp->maplist[k]) + offset; -+ sclp->ispaged = 0; ++ pSCB->SCB_BufPtr = (U32) VIRT_TO_BUS(pSrbSG->u.address); +#else - sclp->address = page_address(kp->maplist[k]) + offset; - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,13) - sclp->page = NULL; - #endif + pSCB->SCB_BufPtr = (U32) VIRT_TO_BUS(pSrbSG->address); +#endif - sclp->length = num; - mem_src_arr[k] = SG_USER_MEM; - rem_sz -= num; + TotalLen = pSrbSG->length; + pSCB->SCB_SGLen = 0; + } else { /* Assign SG physical address */ +@@ -498,7 +502,11 @@ static void i91uBuildSCB(HCS * pHCB, SCB + for (i = 0, TotalLen = 0, pSG = &pSCB->SCB_SGList[0]; /* 1.01g */ + i < SCpnt->use_sg; + i++, pSG++, pSrbSG++) { +#if SMALL_SCATTERLIST -+ SCSI_LOG_TIMEOUT(5, -+ printk("sg_build_dir: k=%d, a=0x%p, len=%d, ms=%d\n", -+ k, sclp->u.address, num, mem_src_arr[k])); ++ pSG->SG_Ptr = (U32) VIRT_TO_BUS(pSrbSG->u.address); +#else - SCSI_LOG_TIMEOUT(5, - printk("sg_build_dir: k=%d, a=0x%p, len=%d, ms=%d\n", - k, sclp->address, num, mem_src_arr[k])); + pSG->SG_Ptr = (U32) VIRT_TO_BUS(pSrbSG->address); +#endif - } - schp->k_use_sg = k; - SCSI_LOG_TIMEOUT(5, -@@ -1814,16 +1838,27 @@ - if (! p) - break; - } + TotalLen += pSG->SG_Len = pSrbSG->length; + } + pSCB->SCB_SGLen = i; +diff -X dontdiff -urp kern_oldest/drivers/scsi/inia100.c kern_fix/drivers/scsi/inia100.c +--- kern_oldest/drivers/scsi/inia100.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/inia100.c 2006-05-01 14:14:13.000000000 -0700 +@@ -494,7 +494,11 @@ static void inia100BuildSCB(ORC_HCS * pH + pSCB->SCB_SGLen = (U32) (SCpnt->use_sg * 8); + pSrbSG = (struct scatterlist *) SCpnt->request_buffer; + for (i = 0; i < SCpnt->use_sg; i++, pSG++, pSrbSG++) { +#if SMALL_SCATTERLIST -+ sclp->u.address = p; -+ sclp->ispaged = 0; ++ pSG->SG_Ptr = (U32) (VIRT_TO_BUS(pSrbSG->u.address)); +#else - sclp->address = p; - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,13) - sclp->page = NULL; - #endif + pSG->SG_Ptr = (U32) (VIRT_TO_BUS(pSrbSG->address)); +#endif - sclp->length = ret_sz; - mem_src_arr[k] = mem_src; + pSG->SG_Len = (U32) pSrbSG->length; + TotalLen += (U32) pSrbSG->length; + } +diff -X dontdiff -urp kern_oldest/drivers/scsi/ips.c kern_fix/drivers/scsi/ips.c +--- kern_oldest/drivers/scsi/ips.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/ips.c 2006-05-01 14:14:13.000000000 -0700 +@@ -217,7 +217,11 @@ MODULE_PARM(ips, "s"); + #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0) + #include + #include "sd.h" ++#ifdef SMALL_SCATTERLIST ++#define IPS_SG_ADDRESS(sg) ((sg)->u.address) ++#else + #define IPS_SG_ADDRESS(sg) ((sg)->address) ++#endif /* !SMALL_SCATTERLIST */ + #define IPS_LOCK_SAVE(lock,flags) spin_lock_irqsave(&io_request_lock,flags) + #define IPS_UNLOCK_RESTORE(lock,flags) spin_unlock_irqrestore(&io_request_lock,flags) + #ifndef __devexit_p +diff -X dontdiff -urp kern_oldest/drivers/scsi/libata-core.c kern_fix/drivers/scsi/libata-core.c +--- kern_oldest/drivers/scsi/libata-core.c 2006-05-01 11:55:41.000000000 -0700 ++++ kern_fix/drivers/scsi/libata-core.c 2006-05-01 14:14:13.000000000 -0700 +@@ -3010,8 +3010,13 @@ static void ata_pio_sector(struct ata_qu + if (qc->cursect == (qc->nsect - 1)) + ap->hsm_task_state = HSM_ST_LAST; +#if SMALL_SCATTERLIST -+ SCSI_LOG_TIMEOUT(5, -+ printk("sg_build_build: k=%d, a=0x%p, len=%d, ms=%d\n", -+ k, sclp->u.address, ret_sz, mem_src)); ++ page = sg[qc->cursg].u.page.page; ++ offset = sg[qc->cursg].u.page.offset + qc->cursg_ofs * ATA_SECT_SIZE; +#else - SCSI_LOG_TIMEOUT(5, - printk("sg_build_build: k=%d, a=0x%p, len=%d, ms=%d\n", - k, sclp->address, ret_sz, mem_src)); -+#endif - } /* end of for loop */ - schp->k_use_sg = k; - SCSI_LOG_TIMEOUT(5, -@@ -1888,13 +1923,21 @@ - struct scatterlist * sclp = (struct scatterlist *)schp->buffer; - char * mem_src_arr = sg_get_sgat_msa(schp); - ksglen = (int)sclp->length; + page = sg[qc->cursg].page; + offset = sg[qc->cursg].offset + qc->cursg_ofs * ATA_SECT_SIZE; ++#endif /* SMALL_SCATTERLIST */ + + /* get the current page and offset */ + page = nth_page(page, (offset >> PAGE_SHIFT)); +@@ -3086,8 +3091,13 @@ next_sg: + + sg = &qc->__sg[qc->cursg]; + +#if SMALL_SCATTERLIST -+ p = sclp->u.address; ++ page = sg->u.page.page; ++ offset = sg->u.page.offset + qc->cursg_ofs; +#else - p = sclp->address; + page = sg->page; + offset = sg->offset + qc->cursg_ofs; +#endif - for (j = 0, k = 0; j < onum; ++j) { - res = sg_u_iovec(hp, iovec_count, j, 1, &usglen, &up); - if (res) return res; + /* get the current page and offset */ + page = nth_page(page, (offset >> PAGE_SHIFT)); +diff -X dontdiff -urp kern_oldest/drivers/scsi/libata-scsi.c kern_fix/drivers/scsi/libata-scsi.c +--- kern_oldest/drivers/scsi/libata-scsi.c 2006-05-01 11:55:41.000000000 -0700 ++++ kern_fix/drivers/scsi/libata-scsi.c 2006-05-01 14:14:13.000000000 -0700 +@@ -1314,7 +1314,11 @@ static unsigned int ata_scsi_rbuf_get(st + struct scatterlist *sg; + + sg = (struct scatterlist *) cmd->request_buffer; ++#if SMALL_SCATTERLIST ++ buf = kmap_atomic(sg->u.page.page, KM_USER0) + sg->u.page.offset; ++#else + buf = kmap_atomic(sg->page, KM_USER0) + sg->offset; ++#endif /* !SMALL_SCATTERLIST */ + buflen = sg->length; + } else { + buf = cmd->request_buffer; +@@ -1342,7 +1346,11 @@ static inline void ata_scsi_rbuf_put(str + struct scatterlist *sg; + sg = (struct scatterlist *) cmd->request_buffer; +#if SMALL_SCATTERLIST -+ for ( ; p; ++sclp, ksglen = (int)sclp->length, p = sclp->u.address) { ++ kunmap_atomic(buf - sg->u.page.offset, KM_USER0); +#else - for ( ; p; ++sclp, ksglen = (int)sclp->length, p = sclp->address) { -+#endif - ok = (SG_USER_MEM != mem_src_arr[k]); - if (usglen <= 0) - break; -@@ -1971,6 +2014,18 @@ - struct scatterlist * sclp = (struct scatterlist *)schp->buffer; - char * mem_src_arr = sg_get_sgat_msa(schp); + kunmap_atomic(buf - sg->offset, KM_USER0); ++#endif /* !SMALL_SCATTERLIST */ + } + } +diff -X dontdiff -urp kern_oldest/drivers/scsi/megaraid2.c kern_fix/drivers/scsi/megaraid2.c +--- kern_oldest/drivers/scsi/megaraid2.c 2006-05-01 11:55:41.000000000 -0700 ++++ kern_fix/drivers/scsi/megaraid2.c 2006-05-01 14:14:13.000000000 -0700 +@@ -2068,7 +2068,11 @@ mega_cmd_done(adapter_t *adapter, u8 com + if( cmd->use_sg ) { + sgl = (struct scatterlist *) + cmd->request_buffer; +#if SMALL_SCATTERLIST -+ for (k = 0; (k < schp->k_use_sg) && sclp->u.address; ++k, ++sclp) { -+ mem_src = mem_src_arr[k]; -+ SCSI_LOG_TIMEOUT(5, -+ printk("sg_remove_scat: k=%d, a=0x%p, len=%d, ms=%d\n", -+ k, sclp->u.address, sclp->length, mem_src)); -+ sg_free(sclp->u.address, sclp->length, mem_src); -+ sclp->u.address = NULL; -+ sclp->ispaged = 0; -+ sclp->length = 0; -+ } ++ c = *(u8 *)sgl[0].u.address; +#else - for (k = 0; (k < schp->k_use_sg) && sclp->address; ++k, ++sclp) { - mem_src = mem_src_arr[k]; - SCSI_LOG_TIMEOUT(5, -@@ -1983,6 +2038,7 @@ - #endif - sclp->length = 0; - } + c = *(u8 *)sgl[0].address; +#endif - sg_free(schp->buffer, schp->sglist_len, schp->buffer_mem_src); - } - else if (schp->buffer) -@@ -2043,13 +2099,21 @@ - struct scatterlist * sclp = (struct scatterlist *)schp->buffer; - char * mem_src_arr = sg_get_sgat_msa(schp); - ksglen = (int)sclp->length; + } + else { + c = *(u8 *)cmd->request_buffer; +diff -X dontdiff -urp kern_oldest/drivers/scsi/megaraid.c kern_fix/drivers/scsi/megaraid.c +--- kern_oldest/drivers/scsi/megaraid.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/megaraid.c 2006-05-01 14:14:13.000000000 -0700 +@@ -1201,8 +1201,13 @@ static void mega_cmd_done (mega_host_con + case READ_CAPACITY: + if ( SCpnt->use_sg ) { + sgList = (struct scatterlist *)SCpnt->request_buffer; ++#if SMALL_SCATTERLIST ++ memcpy(sgList[0].u.address, pScb->bounce_buffer, ++ SCpnt->request_bufflen); ++#else + memcpy(sgList[0].address, pScb->bounce_buffer, +- SCpnt->request_bufflen); ++ SCpnt->request_bufflen); ++#endif + } else { + memcpy (SCpnt->request_buffer, pScb->bounce_buffer, + SCpnt->request_bufflen); +@@ -1226,7 +1231,11 @@ static void mega_cmd_done (mega_host_con + if (SCpnt->cmnd[0] == INQUIRY && !islogical) { + if ( SCpnt->use_sg ) { + sgList = (struct scatterlist *)SCpnt->request_buffer; +#if SMALL_SCATTERLIST -+ p = sclp->u.address; ++ memcpy(&c, sgList[0].u.address, 0x1); +#else - p = sclp->address; + memcpy(&c, sgList[0].address, 0x1); +#endif - - for (j = 0, k = 0; j < onum; ++j) { - res = sg_u_iovec(hp, iovec_count, j, 0, &usglen, &up); - if (res) return res; - + } else { + memcpy(&c, SCpnt->request_buffer, 0x1); + } +diff -X dontdiff -urp kern_oldest/drivers/scsi/NCR5380.c kern_fix/drivers/scsi/NCR5380.c +--- kern_oldest/drivers/scsi/NCR5380.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/NCR5380.c 2006-05-01 14:14:13.000000000 -0700 +@@ -337,7 +337,11 @@ static __inline__ void initialize_SCp(Sc + if (cmd->use_sg) { + cmd->SCp.buffer = (struct scatterlist *) cmd->buffer; + cmd->SCp.buffers_residual = cmd->use_sg - 1; +#if SMALL_SCATTERLIST -+ for ( ; p; ++sclp, ksglen = (int)sclp->length, p = sclp->u.address) { ++ cmd->SCp.ptr = (char *) cmd->SCp.buffer->u.address; +#else - for ( ; p; ++sclp, ksglen = (int)sclp->length, p = sclp->address) { + cmd->SCp.ptr = (char *) cmd->SCp.buffer->address; +#endif - ok = (SG_USER_MEM != mem_src_arr[k]); - if (usglen <= 0) - break; -@@ -2093,14 +2157,26 @@ - int k, num; - struct scatterlist * sclp = (struct scatterlist *)schp->buffer; - + cmd->SCp.this_residual = cmd->SCp.buffer->length; + } else { + cmd->SCp.buffer = NULL; +@@ -2308,7 +2312,11 @@ static void NCR5380_information_transfer + ++cmd->SCp.buffer; + --cmd->SCp.buffers_residual; + cmd->SCp.this_residual = cmd->SCp.buffer->length; +#if SMALL_SCATTERLIST -+ for (k = 0; (k < schp->k_use_sg) && sclp->u.address; ++k, ++sclp) { ++ cmd->SCp.ptr = cmd->SCp.buffer->u.address; +#else - for (k = 0; (k < schp->k_use_sg) && sclp->address; ++k, ++sclp) { + cmd->SCp.ptr = cmd->SCp.buffer->address; +#endif - num = (int)sclp->length; - if (num > num_read_xfer) { + dprintk(NDEBUG_INFORMATION, ("scsi%d : %d bytes and %d buffers left\n", instance->host_no, cmd->SCp.this_residual, cmd->SCp.buffers_residual)); + } + /* +diff -X dontdiff -urp kern_oldest/drivers/scsi/NCR53c406a.c kern_fix/drivers/scsi/NCR53c406a.c +--- kern_oldest/drivers/scsi/NCR53c406a.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/NCR53c406a.c 2006-05-01 14:14:13.000000000 -0700 +@@ -895,7 +895,11 @@ NCR53c406a_intr(int unused, void *dev_id + sgcount = current_SC->use_sg; + sglist = current_SC->request_buffer; + while( sgcount-- ) { +#if SMALL_SCATTERLIST -+ __copy_to_user(outp, sclp->u.address, num_read_xfer); ++ NCR53c406a_pio_write(sglist->u.address, sglist->length); +#else - __copy_to_user(outp, sclp->address, num_read_xfer); + NCR53c406a_pio_write(sglist->address, sglist->length); +#endif - break; + sglist++; + } } - else { +@@ -924,7 +928,11 @@ NCR53c406a_intr(int unused, void *dev_id + sgcount = current_SC->use_sg; + sglist = current_SC->request_buffer; + while( sgcount-- ) { +#if SMALL_SCATTERLIST -+ __copy_to_user(outp, sclp->u.address, num); ++ NCR53c406a_pio_read(sglist->u.address, sglist->length); +#else - __copy_to_user(outp, sclp->address, num); + NCR53c406a_pio_read(sglist->address, sglist->length); +#endif - num_read_xfer -= num; - if (num_read_xfer <= 0) - break; -@@ -2146,7 +2222,11 @@ - if (rem <= num) { - if (0 == k) { - req_schp->k_use_sg = 0; + sglist++; + } + } +diff -X dontdiff -urp kern_oldest/drivers/scsi/osst.c kern_fix/drivers/scsi/osst.c +--- kern_oldest/drivers/scsi/osst.c 2006-05-01 11:55:41.000000000 -0700 ++++ kern_fix/drivers/scsi/osst.c 2006-05-01 14:14:13.000000000 -0700 +@@ -477,7 +477,11 @@ static int osst_verify_frame(OS_Scsi_Tap + if (STp->raw) { + if (STp->buffer->syscall_result) { + for (i=0; i < STp->buffer->sg_segs; i++) +#if SMALL_SCATTERLIST -+ req_schp->buffer = sclp->u.address; ++ memset(STp->buffer->sg[i].u.address, 0, STp->buffer->sg[i].length); +#else - req_schp->buffer = sclp->address; + memset(STp->buffer->sg[i].address, 0, STp->buffer->sg[i].length); +#endif - } - else { - sfp->save_scat_len = num; -Index: linux-2.4.21/drivers/scsi/sr.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/sr.c 2005-06-01 22:51:55.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/sr.c 2005-06-01 23:07:51.080580984 -0400 -@@ -343,7 +343,12 @@ - - i = 0; - if (fsize) { + strcpy(STp->buffer->b_data, "READ ERROR ON FRAME"); + } else + STp->buffer->buffer_bytes = OS_FRAME_SIZE; +@@ -4460,10 +4464,19 @@ static int os_scsi_tape_open(struct inod + for (i = 0, b_size = 0; + i < STp->buffer->sg_segs && (b_size + STp->buffer->sg[i].length) <= OS_DATA_SIZE; + b_size += STp->buffer->sg[i++].length); +#if SMALL_SCATTERLIST -+ sg[0].ispaged = 0; -+ sg[0].u.address = bbpnt[0] = front; ++ STp->buffer->aux = (os_aux_t *) (STp->buffer->sg[i].u.address + OS_DATA_SIZE - b_size); +#else - sg[0].address = bbpnt[0] = front; + STp->buffer->aux = (os_aux_t *) (STp->buffer->sg[i].address + OS_DATA_SIZE - b_size); +#endif - sg[0].length = fsize; - i++; - } -@@ -354,7 +359,12 @@ - scsi_free(old_sg, (((SCpnt->use_sg * sizeof(struct scatterlist)) + - (SCpnt->use_sg * sizeof(void *))) + 511) & ~511); - } else { + #if DEBUG + printk(OSST_DEB_MSG "osst%d:D: b_data points to %p in segment 0 at %p\n", dev, +- STp->buffer->b_data, STp->buffer->sg[0].address); ++ STp->buffer->b_data, +#if SMALL_SCATTERLIST -+ sg[i].ispaged = 0; -+ sg[i].u.address = SCpnt->request_buffer; ++ STp->buffer->sg[0].u.address); +#else - sg[i].address = SCpnt->request_buffer; ++ STp->buffer->sg[0].address); +#endif - sg[i].length = SCpnt->request_bufflen; - } - -@@ -364,7 +374,12 @@ - SCpnt->use_sg += i; + printk(OSST_DEB_MSG "osst%d:D: AUX points to %p in segment %d at %p\n", dev, + STp->buffer->aux, i, STp->buffer->sg[i].address); + #endif +@@ -5007,6 +5020,12 @@ out: + + /* Memory handling routines */ - if (bsize) { +#if SMALL_SCATTERLIST -+ sg[SCpnt->use_sg].ispaged = 0; -+ sg[SCpnt->use_sg].u.address = back; ++#define SG_ADDRESS(sg) ((sg).u.address) +#else - sg[SCpnt->use_sg].address = back; ++#define SG_ADDRESS(sg) ((sg).address) +#endif - bbpnt[SCpnt->use_sg] = back; - sg[SCpnt->use_sg].length = bsize; - SCpnt->use_sg++; -Index: linux-2.4.21/drivers/scsi/sim710.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/sim710.c 2002-08-02 20:39:44.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/sim710.c 2005-06-01 23:07:51.082580680 -0400 -@@ -1164,7 +1164,11 @@ ++ + /* Try to allocate a new tape buffer */ + static OSST_buffer * new_tape_buffer( int from_initialization, int need_dma ) + { +@@ -5035,15 +5054,19 @@ static OSST_buffer * new_tape_buffer( in + b_size *= 2, order++ ); - for (i = 0; cmd->use_sg ? (i < cmd->use_sg) : !i; i++) { - u32 vbuf = cmd->use_sg ? + for ( ; b_size >= PAGE_SIZE; order--, b_size /= 2) { +- tb->sg[0].address = ++ SG_ADDRESS(tb->sg[0]) = + (unsigned char *)__get_free_pages(priority, order); +- if (tb->sg[0].address != NULL) { ++ if (SG_ADDRESS(tb->sg[0]) != NULL) { +#if SMALL_SCATTERLIST -+ (u32)(((struct scatterlist *)cmd->buffer)[i].u.address) : ++ tb->sg[0].ispaged = 0; +#else - (u32)(((struct scatterlist *)cmd->buffer)[i].address) : + tb->sg[0].page = NULL; +#endif - (u32)(cmd->request_buffer); - u32 bbuf = virt_to_bus((void *)vbuf); - u32 cnt = cmd->use_sg ? -Index: linux-2.4.21/drivers/scsi/advansys.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/advansys.c 2005-06-01 22:52:05.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/advansys.c 2005-06-01 23:07:51.097578400 -0400 -@@ -6803,7 +6803,11 @@ - slp = (struct scatterlist *) scp->request_buffer; - for (sgcnt = 0; sgcnt < scp->use_sg; sgcnt++, slp++) { - asc_sg_head.sg_list[sgcnt].addr = + tb->sg[0].length = b_size; + break; + } + } +- if (tb->sg[segs].address == NULL) { ++ if (SG_ADDRESS(tb->sg[segs]) == NULL) { + kfree(tb); + tb = NULL; + } +@@ -5055,9 +5078,9 @@ static OSST_buffer * new_tape_buffer( in + + for (segs=1, got=tb->sg[0].length; + got < osst_buffer_size && segs < OSST_FIRST_SG; ) { +- tb->sg[segs].address = ++ SG_ADDRESS(tb->sg[segs]) = + (unsigned char *)__get_free_pages(priority, order); +- if (tb->sg[segs].address == NULL) { ++ if (SG_ADDRESS(tb->sg[segs]) == NULL) { + if (osst_buffer_size - got <= + (OSST_FIRST_SG - segs) * b_size / 2) { + b_size /= 2; /* Large enough for the rest of the buffers */ +@@ -5074,7 +5097,11 @@ static OSST_buffer * new_tape_buffer( in + tb = NULL; + break; + } +#if SMALL_SCATTERLIST -+ cpu_to_le32(virt_to_bus(slp->u.address)); ++ tb->sg[segs].ispaged = 0; +#else - cpu_to_le32(virt_to_bus(slp->address)); + tb->sg[segs].page = NULL; +#endif - asc_sg_head.sg_list[sgcnt].bytes = cpu_to_le32(slp->length); - ASC_STATS_ADD(scp->host, sg_xfer, ASC_CEILING(slp->length, 512)); - } -@@ -7061,7 +7065,11 @@ - for (i = 0; i < NO_OF_SG_PER_BLOCK; i++) - { - sg_block->sg_list[i].sg_addr = + tb->sg[segs].length = b_size; + got += b_size; + segs++; +@@ -5087,7 +5114,7 @@ static OSST_buffer * new_tape_buffer( in + return NULL; + } + tb->sg_segs = tb->orig_sg_segs = segs; +- tb->b_data = tb->sg[0].address; ++ tb->b_data = SG_ADDRESS(tb->sg[0]); + + #if DEBUG + if (debugging) { +@@ -5132,9 +5159,9 @@ static int enlarge_buffer(OSST_buffer *S + + for (segs=STbuffer->sg_segs, got=STbuffer->buffer_size; + segs < max_segs && got < new_size; ) { +- STbuffer->sg[segs].address = ++ SG_ADDRESS(STbuffer->sg[segs]) = + (unsigned char *)__get_free_pages(priority, order); +- if (STbuffer->sg[segs].address == NULL) { ++ if (SG_ADDRESS(STbuffer->sg[segs]) == NULL) { + if (new_size - got <= (max_segs - segs) * b_size / 2) { + b_size /= 2; /* Large enough for the rest of the buffers */ + order--; +@@ -5148,7 +5175,11 @@ static int enlarge_buffer(OSST_buffer *S + normalize_buffer(STbuffer); + return FALSE; + } +#if SMALL_SCATTERLIST -+ cpu_to_le32(virt_to_bus(slp->u.address)); ++ STbuffer->sg[segs].ispaged = 0; +#else - cpu_to_le32(virt_to_bus(slp->address)); + STbuffer->sg[segs].page = NULL; +#endif - sg_block->sg_list[i].sg_count = cpu_to_le32(slp->length); - ASC_STATS_ADD(scp->host, sg_xfer, ASC_CEILING(slp->length, 512)); - -Index: linux-2.4.21/drivers/scsi/pci2000.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/pci2000.c 2001-11-09 17:05:06.000000000 -0500 -+++ linux-2.4.21/drivers/scsi/pci2000.c 2005-06-01 23:07:51.098578248 -0400 -@@ -513,7 +513,11 @@ + STbuffer->sg[segs].length = b_size; + STbuffer->sg_segs += 1; + got += b_size; +@@ -5181,8 +5212,8 @@ static void normalize_buffer(OSST_buffer + for (b_size = PAGE_SIZE, order = 0; + b_size < STbuffer->sg[i].length; + b_size *= 2, order++); +- +- free_pages((unsigned long)STbuffer->sg[i].address, order); ++ ++ free_pages((unsigned long)SG_ADDRESS(STbuffer->sg[i]), order); + STbuffer->buffer_size -= STbuffer->sg[i].length; + } + #if DEBUG +@@ -5210,7 +5241,7 @@ static int append_to_buffer(const char * + for ( ; i < st_bp->sg_segs && do_count > 0; i++) { + cnt = st_bp->sg[i].length - offset < do_count ? + st_bp->sg[i].length - offset : do_count; +- res = copy_from_user(st_bp->sg[i].address + offset, ubp, cnt); ++ res = copy_from_user(SG_ADDRESS(st_bp->sg[i]) + offset, ubp, cnt); + if (res) + return (-EFAULT); + do_count -= cnt; +@@ -5243,7 +5274,7 @@ static int from_buffer(OSST_buffer *st_b + for ( ; i < st_bp->sg_segs && do_count > 0; i++) { + cnt = st_bp->sg[i].length - offset < do_count ? + st_bp->sg[i].length - offset : do_count; +- res = copy_to_user(ubp, st_bp->sg[i].address + offset, cnt); ++ res = copy_to_user(ubp, SG_ADDRESS(st_bp->sg[i]) + offset, cnt); + if (res) + return (-EFAULT); + do_count -= cnt; +@@ -5276,7 +5307,7 @@ static int osst_zero_buffer_tail(OSST_bu + i < st_bp->sg_segs && do_count > 0; i++) { + cnt = st_bp->sg[i].length - offset < do_count ? + st_bp->sg[i].length - offset : do_count ; +- memset(st_bp->sg[i].address + offset, 0, cnt); ++ memset(SG_ADDRESS(st_bp->sg[i]) + offset, 0, cnt); + do_count -= cnt; + offset = 0; + } +@@ -5296,7 +5327,7 @@ static int osst_copy_to_buffer(OSST_buff + for (i = 0; i < st_bp->sg_segs && do_count > 0; i++) { + cnt = st_bp->sg[i].length < do_count ? + st_bp->sg[i].length : do_count ; +- memcpy(st_bp->sg[i].address, ptr, cnt); ++ memcpy(SG_ADDRESS(st_bp->sg[i]), ptr, cnt); + do_count -= cnt; + ptr += cnt; + } +@@ -5317,7 +5348,7 @@ static int osst_copy_from_buffer(OSST_bu + for (i = 0; i < st_bp->sg_segs && do_count > 0; i++) { + cnt = st_bp->sg[i].length < do_count ? + st_bp->sg[i].length : do_count ; +- memcpy(ptr, st_bp->sg[i].address, cnt); ++ memcpy(ptr, SG_ADDRESS(st_bp->sg[i]), cnt); + do_count -= cnt; + ptr += cnt; + } +diff -X dontdiff -urp kern_oldest/drivers/scsi/pci2000.c kern_fix/drivers/scsi/pci2000.c +--- kern_oldest/drivers/scsi/pci2000.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/pci2000.c 2006-05-01 14:14:13.000000000 -0700 +@@ -513,7 +513,11 @@ int Pci2000_QueueCommand (Scsi_Cmnd *SCp if ( SCpnt->use_sg ) { @@ -1809,7 +2497,7 @@ Index: linux-2.4.21/drivers/scsi/pci2000.c SCpnt->request_bufflen, scsi_to_pci_dma_dir (SCpnt->sc_data_direction)); } else -@@ -536,7 +540,11 @@ +@@ -536,7 +540,11 @@ int Pci2000_QueueCommand (Scsi_Cmnd *SCp case SCSIOP_READ_CAPACITY: // read capacity CDB if ( SCpnt->use_sg ) { @@ -1821,11 +2509,10 @@ Index: linux-2.4.21/drivers/scsi/pci2000.c 8, PCI_DMA_FROMDEVICE); } else -Index: linux-2.4.21/drivers/scsi/pci2220i.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/pci2220i.c 2001-11-09 17:05:06.000000000 -0500 -+++ linux-2.4.21/drivers/scsi/pci2220i.c 2005-06-01 23:07:51.100577944 -0400 -@@ -463,7 +463,11 @@ +diff -X dontdiff -urp kern_oldest/drivers/scsi/pci2220i.c kern_fix/drivers/scsi/pci2220i.c +--- kern_oldest/drivers/scsi/pci2220i.c 2006-05-01 11:55:41.000000000 -0700 ++++ kern_fix/drivers/scsi/pci2220i.c 2006-05-01 14:14:13.000000000 -0700 +@@ -463,7 +463,11 @@ static void WalkScatGath (PADAPTER2220I { if ( padapter->nextSg < padapter->SCpnt->use_sg ) { @@ -1837,7 +2524,7 @@ Index: linux-2.4.21/drivers/scsi/pci2220i.c padapter->currentSgCount = ((struct scatterlist *)padapter->SCpnt->request_buffer)[padapter->nextSg].length; padapter->nextSg++; } -@@ -2057,7 +2061,11 @@ +@@ -2057,7 +2061,11 @@ int Pci2220i_QueueCommand (Scsi_Cmnd *SC if ( SCpnt->use_sg ) { @@ -1849,316 +2536,76 @@ Index: linux-2.4.21/drivers/scsi/pci2220i.c padapter->currentSgCount = ((struct scatterlist *)SCpnt->request_buffer)[0].length; } else -Index: linux-2.4.21/drivers/scsi/BusLogic.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/BusLogic.c 2001-12-21 12:41:55.000000000 -0500 -+++ linux-2.4.21/drivers/scsi/BusLogic.c 2005-06-01 23:07:51.104577336 -0400 -@@ -3402,7 +3402,12 @@ - CCB->ScatterGatherList[Segment].SegmentByteCount = - ScatterList[Segment].length; - CCB->ScatterGatherList[Segment].SegmentDataPointer = -+#if SMALL_SCATTERLIST -+ Virtual_to_Bus(ScatterList[Segment].u.address); -+#else - Virtual_to_Bus(ScatterList[Segment].address); -+#endif -+ - } - } - switch (CDB[0]) -Index: linux-2.4.21/drivers/scsi/ultrastor.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/ultrastor.c 2002-08-02 20:39:44.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/ultrastor.c 2005-06-01 23:07:51.105577184 -0400 -@@ -666,7 +666,11 @@ - sl = (struct scatterlist *) SCpnt->request_buffer; - max = SCpnt->use_sg; - for (i = 0; i < max; i++) { -+#if SMALL_SCATTERLIST -+ mscp->sglist[i].address = virt_to_bus(sl[i].u.address); -+#else - mscp->sglist[i].address = virt_to_bus(sl[i].address); -+#endif - mscp->sglist[i].num_bytes = sl[i].length; - transfer_length += sl[i].length; - } -Index: linux-2.4.21/drivers/scsi/aha152x.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/aha152x.c 2003-06-13 10:51:36.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/aha152x.c 2005-06-01 23:07:51.108576728 -0400 -@@ -603,7 +603,11 @@ - #define SCSEM(SCpnt) SCDATA(SCpnt)->sem - - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) -+#if SMALL_SCATTERLIST -+#define SG_ADDRESS(buffer) ((buffer)->u.address) -+#else - #define SG_ADDRESS(buffer) ((buffer)->address) -+#endif - #else - #define SG_ADDRESS(buffer) ((char *) (page_address((buffer)->page)+(buffer)->offset)) - #endif -Index: linux-2.4.21/drivers/scsi/aha1542.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/aha1542.c 2001-10-12 18:35:53.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/aha1542.c 2005-06-01 23:07:51.109576576 -0400 -@@ -69,8 +69,13 @@ - { - printk(KERN_CRIT "sgpnt[%d:%d] addr %p/0x%lx length %d\n", - badseg, nseg, -+#if SMALL_SCATTERLIST -+ sgpnt[badseg].u.address, -+ SCSI_PA(sgpnt[badseg].u.address), -+#else - sgpnt[badseg].address, - SCSI_PA(sgpnt[badseg].address), -+#endif - sgpnt[badseg].length); - - /* -@@ -710,11 +715,21 @@ - panic("aha1542.c: unable to allocate DMA memory\n"); - for (i = 0; i < SCpnt->use_sg; i++) { - if (sgpnt[i].length == 0 || SCpnt->use_sg > 16 || -- (((int) sgpnt[i].address) & 1) || (sgpnt[i].length & 1)) { -+#if SMALL_SCATTERLIST -+ (((int) sgpnt[i].u.address) & 1) -+#else -+ (((int) sgpnt[i].address) & 1) -+#endif -+ || (sgpnt[i].length & 1)) { - unsigned char *ptr; - printk(KERN_CRIT "Bad segment list supplied to aha1542.c (%d, %d)\n", SCpnt->use_sg, i); - for (i = 0; i < SCpnt->use_sg; i++) { -- printk(KERN_CRIT "%d: %p %d\n", i, sgpnt[i].address, -+ printk(KERN_CRIT "%d: %p %d\n", i, -+#if SMALL_SCATTERLIST -+ sgpnt[i].u.address, -+#else -+ sgpnt[i].address, -+#endif - sgpnt[i].length); - }; - printk(KERN_CRIT "cptr %x: ", (unsigned int) cptr); -@@ -723,8 +738,13 @@ - printk("%02x ", ptr[i]); - panic("Foooooooood fight!"); - }; +diff -X dontdiff -urp kern_oldest/drivers/scsi/pcmcia/nsp_cs.c kern_fix/drivers/scsi/pcmcia/nsp_cs.c +--- kern_oldest/drivers/scsi/pcmcia/nsp_cs.c 2006-05-01 11:55:41.000000000 -0700 ++++ kern_fix/drivers/scsi/pcmcia/nsp_cs.c 2006-05-01 14:14:13.000000000 -0700 +@@ -201,7 +201,11 @@ static int nsp_queuecommand(Scsi_Cmnd *S + SCp.phase : current state of the command */ + if (SCpnt->use_sg) { + SCpnt->SCp.buffer = (struct scatterlist *) SCpnt->request_buffer; +#if SMALL_SCATTERLIST -+ any2scsi(cptr[i].dataptr, SCSI_PA(sgpnt[i].u.address)); -+ if (SCSI_PA(sgpnt[i].u.address + sgpnt[i].length - 1) > ISA_DMA_THRESHOLD) ++ SCpnt->SCp.ptr = SCpnt->SCp.buffer->u.address; +#else - any2scsi(cptr[i].dataptr, SCSI_PA(sgpnt[i].address)); - if (SCSI_PA(sgpnt[i].address + sgpnt[i].length - 1) > ISA_DMA_THRESHOLD) + SCpnt->SCp.ptr = SCpnt->SCp.buffer->address; +#endif - BAD_SG_DMA(SCpnt, sgpnt, SCpnt->use_sg, i); - any2scsi(cptr[i].datalen, sgpnt[i].length); - }; -Index: linux-2.4.21/drivers/scsi/aha1740.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/aha1740.c 2001-09-30 15:26:07.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/aha1740.c 2005-06-01 23:07:51.110576424 -0400 -@@ -397,7 +397,11 @@ - for(i=0; iuse_sg; i++) - { - cptr[i].datalen = sgpnt[i].length; + SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; + SCpnt->SCp.buffers_residual = SCpnt->use_sg - 1; + } else { +@@ -713,7 +717,11 @@ static void nsp_pio_read(Scsi_Cmnd *SCpn + //DEBUG(0, " scatterlist next timeout=%d\n", time_out); + SCpnt->SCp.buffers_residual--; + SCpnt->SCp.buffer++; +#if SMALL_SCATTERLIST -+ cptr[i].dataptr = virt_to_bus(sgpnt[i].u.address); ++ SCpnt->SCp.ptr = SCpnt->SCp.buffer->u.address; +#else - cptr[i].dataptr = virt_to_bus(sgpnt[i].address); + SCpnt->SCp.ptr = SCpnt->SCp.buffer->address; +#endif - } - host->ecb[ecbno].datalen = SCpnt->use_sg * sizeof(struct aha1740_chain); - host->ecb[ecbno].dataptr = virt_to_bus(cptr); -Index: linux-2.4.21/drivers/scsi/aic7xxx_old.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/aic7xxx_old.c 2005-06-01 22:51:54.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/aic7xxx_old.c 2005-06-01 23:07:51.118575208 -0400 -@@ -2845,7 +2845,11 @@ - struct scatterlist *sg; + SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; + } - sg = (struct scatterlist *)cmd->request_buffer; -+#if SMALL_SCATTERLIST -+ buffer = (char *)sg[0].u.address; -+#else - buffer = (char *)sg[0].address; -+#endif - } - else - { -Index: linux-2.4.21/drivers/scsi/fdomain.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/fdomain.c 2002-11-28 18:53:14.000000000 -0500 -+++ linux-2.4.21/drivers/scsi/fdomain.c 2005-06-01 23:07:51.120574904 -0400 -@@ -1564,7 +1564,11 @@ - if (current_SC->SCp.buffers_residual) { - --current_SC->SCp.buffers_residual; - ++current_SC->SCp.buffer; -+#if SMALL_SCATTERLIST -+ current_SC->SCp.ptr = current_SC->SCp.buffer->u.address; -+#else - current_SC->SCp.ptr = current_SC->SCp.buffer->address; -+#endif - current_SC->SCp.this_residual = current_SC->SCp.buffer->length; - } else - break; -@@ -1597,7 +1601,11 @@ - && current_SC->SCp.buffers_residual) { - --current_SC->SCp.buffers_residual; - ++current_SC->SCp.buffer; -+#if SMALL_SCATTERLIST -+ current_SC->SCp.ptr = current_SC->SCp.buffer->u.address; -+#else - current_SC->SCp.ptr = current_SC->SCp.buffer->address; -+#endif - current_SC->SCp.this_residual = current_SC->SCp.buffer->length; - } - } -@@ -1683,7 +1691,11 @@ - if (current_SC->use_sg) { - current_SC->SCp.buffer = - (struct scatterlist *)current_SC->request_buffer; -+#if SMALL_SCATTERLIST -+ current_SC->SCp.ptr = current_SC->SCp.buffer->u.address; -+#else - current_SC->SCp.ptr = current_SC->SCp.buffer->address; -+#endif - current_SC->SCp.this_residual = current_SC->SCp.buffer->length; - current_SC->SCp.buffers_residual = current_SC->use_sg - 1; - } else { -Index: linux-2.4.21/drivers/scsi/in2000.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/in2000.c 2003-06-13 10:51:36.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/in2000.c 2005-06-01 23:07:51.122574600 -0400 -@@ -355,7 +355,11 @@ - if (cmd->use_sg) { - cmd->SCp.buffer = (struct scatterlist *)cmd->buffer; - cmd->SCp.buffers_residual = cmd->use_sg - 1; -+#if SMALL_SCATTERLIST -+ cmd->SCp.ptr = (char *)cmd->SCp.buffer->u.address; -+#else - cmd->SCp.ptr = (char *)cmd->SCp.buffer->address; -+#endif - cmd->SCp.this_residual = cmd->SCp.buffer->length; - } - else { -@@ -762,7 +766,11 @@ - ++cmd->SCp.buffer; - --cmd->SCp.buffers_residual; - cmd->SCp.this_residual = cmd->SCp.buffer->length; +@@ -786,7 +794,11 @@ static void nsp_pio_write(Scsi_Cmnd *SCp + //DEBUG(0, " scatterlist next\n"); + SCpnt->SCp.buffers_residual--; + SCpnt->SCp.buffer++; +#if SMALL_SCATTERLIST -+ cmd->SCp.ptr = cmd->SCp.buffer->u.address; ++ SCpnt->SCp.ptr = SCpnt->SCp.buffer->u.address; +#else - cmd->SCp.ptr = cmd->SCp.buffer->address; + SCpnt->SCp.ptr = SCpnt->SCp.buffer->address; +#endif - } + SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; + } - /* Set up hardware registers */ -Index: linux-2.4.21/drivers/scsi/NCR5380.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/NCR5380.c 2003-06-13 10:51:36.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/NCR5380.c 2005-06-01 23:07:51.124574296 -0400 -@@ -337,7 +337,11 @@ - if (cmd->use_sg) { - cmd->SCp.buffer = (struct scatterlist *) cmd->buffer; - cmd->SCp.buffers_residual = cmd->use_sg - 1; -+#if SMALL_SCATTERLIST -+ cmd->SCp.ptr = (char *) cmd->SCp.buffer->u.address; -+#else - cmd->SCp.ptr = (char *) cmd->SCp.buffer->address; -+#endif +diff -X dontdiff -urp kern_oldest/drivers/scsi/ppa.c kern_fix/drivers/scsi/ppa.c +--- kern_oldest/drivers/scsi/ppa.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/ppa.c 2006-05-01 14:14:13.000000000 -0700 +@@ -740,7 +740,11 @@ static int ppa_completion(Scsi_Cmnd * cm + if (cmd->SCp.buffers_residual--) { + cmd->SCp.buffer++; cmd->SCp.this_residual = cmd->SCp.buffer->length; - } else { - cmd->SCp.buffer = NULL; -@@ -2308,7 +2312,11 @@ - ++cmd->SCp.buffer; - --cmd->SCp.buffers_residual; - cmd->SCp.this_residual = cmd->SCp.buffer->length; -+#if SMALL_SCATTERLIST -+ cmd->SCp.ptr = cmd->SCp.buffer->u.address; -+#else - cmd->SCp.ptr = cmd->SCp.buffer->address; -+#endif - dprintk(NDEBUG_INFORMATION, ("scsi%d : %d bytes and %d buffers left\n", instance->host_no, cmd->SCp.this_residual, cmd->SCp.buffers_residual)); - } - /* -Index: linux-2.4.21/drivers/scsi/NCR53c406a.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/NCR53c406a.c 2001-09-30 15:26:07.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/NCR53c406a.c 2005-06-01 23:07:51.125574144 -0400 -@@ -895,7 +895,11 @@ - sgcount = current_SC->use_sg; - sglist = current_SC->request_buffer; - while( sgcount-- ) { -+#if SMALL_SCATTERLIST -+ NCR53c406a_pio_write(sglist->u.address, sglist->length); -+#else - NCR53c406a_pio_write(sglist->address, sglist->length); -+#endif - sglist++; - } - } -@@ -924,7 +928,11 @@ - sgcount = current_SC->use_sg; - sglist = current_SC->request_buffer; - while( sgcount-- ) { +#if SMALL_SCATTERLIST -+ NCR53c406a_pio_read(sglist->u.address, sglist->length); -+#else - NCR53c406a_pio_read(sglist->address, sglist->length); -+#endif - sglist++; - } - } -Index: linux-2.4.21/drivers/scsi/sym53c416.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/sym53c416.c 2001-09-30 15:26:07.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/sym53c416.c 2005-06-01 23:07:51.126573992 -0400 -@@ -448,7 +448,11 @@ - sglist = current_command->request_buffer; - while(sgcount--) - { -+#if SMALL_SCATTERLIST -+ tot_trans += sym53c416_write(base, sglist->u.address, sglist->length); -+#else - tot_trans += sym53c416_write(base, sglist->address, sglist->length); -+#endif - sglist++; - } - } -@@ -474,7 +478,11 @@ - sglist = current_command->request_buffer; - while(sgcount--) - { -+#if SMALL_SCATTERLIST -+ tot_trans += sym53c416_read(base, sglist->u.address, sglist->length); ++ cmd->SCp.ptr = cmd->SCp.buffer->u.address; +#else - tot_trans += sym53c416_read(base, sglist->address, sglist->length); -+#endif - sglist++; - } - } -Index: linux-2.4.21/drivers/scsi/qlogicfas.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/qlogicfas.c 2003-06-13 10:51:36.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/qlogicfas.c 2005-06-01 23:07:51.126573992 -0400 -@@ -393,7 +393,11 @@ - REG0; - return ((qabort == 1 ? DID_ABORT : DID_RESET) << 16); - } + cmd->SCp.ptr = cmd->SCp.buffer->address; ++#endif + } + } + /* Now check to see if the drive is ready to comunicate */ +@@ -925,7 +929,11 @@ static int ppa_engine(ppa_struct * tmp, + /* if many buffers are available, start filling the first */ + cmd->SCp.buffer = (struct scatterlist *) cmd->request_buffer; + cmd->SCp.this_residual = cmd->SCp.buffer->length; +#if SMALL_SCATTERLIST -+ if (ql_pdma(phase, sglist->u.address, sglist->length)) ++ cmd->SCp.ptr = cmd->SCp.buffer->u.address; +#else - if (ql_pdma(phase, sglist->address, sglist->length)) + cmd->SCp.ptr = cmd->SCp.buffer->address; +#endif - break; - sglist++; - } -Index: linux-2.4.21/drivers/scsi/qla1280.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/qla1280.c 2001-09-30 15:26:07.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/qla1280.c 2005-06-01 23:07:51.131573232 -0400 -@@ -3985,8 +3985,13 @@ + } else { + /* else fill the only available buffer */ + cmd->SCp.buffer = NULL; +diff -X dontdiff -urp kern_oldest/drivers/scsi/qla1280.c kern_fix/drivers/scsi/qla1280.c +--- kern_oldest/drivers/scsi/qla1280.c 2006-05-01 11:55:41.000000000 -0700 ++++ kern_fix/drivers/scsi/qla1280.c 2006-05-01 14:14:13.000000000 -0700 +@@ -3985,8 +3985,13 @@ qla1280_64bit_start_scsi(scsi_qla_host_t { DEBUG(sprintf(debug_buff,"SG Segment ap=0x%p, len=0x%x\n\r",sg->address,sg->length)); DEBUG(qla1280_print(debug_buff)); @@ -2172,7 +2619,7 @@ Index: linux-2.4.21/drivers/scsi/qla1280.c *dword_ptr++ = sg->length; sg++; } -@@ -4038,8 +4043,13 @@ +@@ -4038,8 +4043,13 @@ qla1280_64bit_start_scsi(scsi_qla_host_t /* Load continuation entry data segments. */ for (cnt = 0; cnt < 5 && seg_cnt; cnt++, seg_cnt--) { @@ -2186,7 +2633,7 @@ Index: linux-2.4.21/drivers/scsi/qla1280.c *dword_ptr++ = sg->length; sg++; } -@@ -4325,7 +4335,11 @@ +@@ -4325,7 +4335,11 @@ qla1280_32bit_start_scsi(scsi_qla_host_t /* Load command entry data segments. */ for (cnt = 0; cnt < 4 && seg_cnt; cnt++, seg_cnt--) { @@ -2198,7 +2645,7 @@ Index: linux-2.4.21/drivers/scsi/qla1280.c *dword_ptr++ = sg->length; DEBUG(sprintf(debug_buff,"SG Segment ap=0x%p, len=0x%x\n\r",sg->address,sg->length)); DEBUG(qla1280_print(debug_buff)); -@@ -4368,7 +4382,11 @@ +@@ -4368,7 +4382,11 @@ qla1280_32bit_start_scsi(scsi_qla_host_t /* Load continuation entry data segments. */ for (cnt = 0; cnt < 7 && seg_cnt; cnt++, seg_cnt--) { @@ -2210,154 +2657,98 @@ Index: linux-2.4.21/drivers/scsi/qla1280.c *dword_ptr++ = sg->length; sg++; } -Index: linux-2.4.21/drivers/scsi/seagate.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/seagate.c 2005-06-01 22:51:40.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/seagate.c 2005-06-01 23:07:51.133572928 -0400 -@@ -1070,7 +1070,11 @@ - - buffer = (struct scatterlist *) SCint->buffer; - len = buffer->length; -+#if SMALL_SCATTERLIST -+ data = (unsigned char *) buffer->u.address; -+#else - data = (unsigned char *) buffer->address; -+#endif - } else { - DPRINTK (DEBUG_SG, - "scsi%d : scatter gather not requested.\n", -@@ -1337,7 +1341,11 @@ - ++buffer; - len = buffer->length; - data = -- (unsigned char *) buffer->address; -+#if SMALL_SCATTERLIST -+ (unsigned char *)buffer->u.address; -+#else -+ (unsigned char *)buffer->address; -+#endif - DPRINTK (DEBUG_SG, - "scsi%d : next scatter-gather buffer len = %d address = %08x\n", - hostno, len, data); -@@ -1521,7 +1529,11 @@ - ++buffer; - len = buffer->length; - data = -+#if SMALL_SCATTERLIST -+ (unsigned char *)buffer->u.address; -+#else - (unsigned char *) buffer->address; -+#endif - DPRINTK (DEBUG_SG, - "scsi%d : next scatter-gather buffer len = %d address = %08x\n", - hostno, len, data); -Index: linux-2.4.21/drivers/scsi/53c7,8xx.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/53c7,8xx.c 2002-02-25 14:38:04.000000000 -0500 -+++ linux-2.4.21/drivers/scsi/53c7,8xx.c 2005-06-01 23:07:51.137572320 -0400 -@@ -3787,7 +3787,11 @@ - for (i = 0; cmd->use_sg ? (i < cmd->use_sg) : !i; cmd_datain += 4, - cmd_dataout += 4, ++i) { - u32 buf = cmd->use_sg ? -+#if SMALL_SCATTERLIST -+ virt_to_bus(((struct scatterlist *)cmd->buffer)[i].u.address) : -+#else - virt_to_bus(((struct scatterlist *)cmd->buffer)[i].address) : -+#endif - virt_to_bus(cmd->request_buffer); - u32 count = cmd->use_sg ? - ((struct scatterlist *)cmd->buffer)[i].length : -@@ -5752,8 +5756,13 @@ - if ((buffers = cmd->use_sg)) { - for (offset = 0, - segment = (struct scatterlist *) cmd->buffer; +diff -X dontdiff -urp kern_oldest/drivers/scsi/qlogicfas.c kern_fix/drivers/scsi/qlogicfas.c +--- kern_oldest/drivers/scsi/qlogicfas.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/qlogicfas.c 2006-05-01 14:14:13.000000000 -0700 +@@ -393,7 +393,11 @@ rtrc(2) + REG0; + return ((qabort == 1 ? DID_ABORT : DID_RESET) << 16); + } +#if SMALL_SCATTERLIST -+ buffers && !((found = ((ptr >= segment->u.address) && -+ (ptr < (segment->u.address + segment->length))))); ++ if (ql_pdma(phase, sglist->u.address, sglist->length)) +#else - buffers && !((found = ((ptr >= segment->address) && - (ptr < (segment->address + segment->length))))); + if (ql_pdma(phase, sglist->address, sglist->length)) +#endif - --buffers, offset += segment->length, ++segment) - #if 0 - printk("scsi%d: comparing 0x%p to 0x%p\n", -@@ -5761,7 +5770,11 @@ - #else - ; - #endif -+#if SMALL_SCATTERLIST -+ offset += ptr - segment->u.address; + break; + sglist++; + } +diff -X dontdiff -urp kern_oldest/drivers/scsi/scsi_debug.c kern_fix/drivers/scsi/scsi_debug.c +--- kern_oldest/drivers/scsi/scsi_debug.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/scsi_debug.c 2006-05-01 14:14:13.000000000 -0700 +@@ -186,7 +186,13 @@ int scsi_debug_queuecommand(Scsi_Cmnd * + struct scatterlist *sgpnt = (struct scatterlist *) + SCpnt->request_buffer; + ++#if SMALL_SCATTERLIST ++ if (sgpnt[0].ispaged) ++ BUG(); ++ buff = sgpnt[0].u.address; +#else - offset += ptr - segment->address; + buff = sgpnt[0].address; +#endif - } else { - found = 1; - offset = ptr - (char *) (cmd->request_buffer); -Index: linux-2.4.21/drivers/scsi/eata_dma.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/eata_dma.c 2005-06-01 22:52:05.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/eata_dma.c 2005-06-01 23:07:51.138572168 -0400 -@@ -571,7 +571,11 @@ - ccb->cp_datalen = htonl(cmd->use_sg * sizeof(struct eata_sg_list)); - sl=(struct scatterlist *)cmd->request_buffer; - for(i = 0; i < cmd->use_sg; i++, sl++){ + bufflen = sgpnt[0].length; + /* READ and WRITE process scatterlist themselves */ + } +@@ -672,7 +678,13 @@ static int resp_read(Scsi_Cmnd * SCpnt, + if (SCpnt->use_sg) { + sgcount = 0; + sgpnt = (struct scatterlist *) buff; +#if SMALL_SCATTERLIST -+ ccb->sg_list[i].data = htonl(virt_to_bus(sl->u.address)); ++ if (sgpnt[sgcount].ispaged) ++ BUG(); ++ buff = sgpnt[sgcount].u.address; +#else - ccb->sg_list[i].data = htonl(virt_to_bus(sl->address)); + buff = sgpnt[sgcount].address; +#endif - ccb->sg_list[i].len = htonl((u32) sl->length); + bufflen = sgpnt[sgcount].length; } - } else { -Index: linux-2.4.21/drivers/scsi/eata_pio.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/eata_pio.c 2001-09-30 15:26:07.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/eata_pio.c 2005-06-01 23:07:51.139572016 -0400 -@@ -99,7 +99,11 @@ - else - { - SCp->buffer++; + do { +@@ -682,7 +694,13 @@ static int resp_read(Scsi_Cmnd * SCpnt, + block += bufflen >> POW2_SECT_SIZE; + sgcount++; + if (nbytes) { +#if SMALL_SCATTERLIST -+ SCp->ptr=SCp->buffer->u.address; ++ if (sgpnt[sgcount].ispaged) ++ BUG(); ++ buff = sgpnt[sgcount].u.address; +#else - SCp->ptr=SCp->buffer->address; + buff = sgpnt[sgcount].address; +#endif - SCp->this_residual=SCp->buffer->length; - } - } -@@ -371,7 +375,11 @@ - } else { - cmd->SCp.buffer = cmd->request_buffer; - cmd->SCp.buffers_residual = cmd->use_sg; + bufflen = sgpnt[sgcount].length; + } + } else if (nbytes > 0) +@@ -713,7 +731,13 @@ static int resp_write(Scsi_Cmnd * SCpnt, + if (SCpnt->use_sg) { + sgcount = 0; + sgpnt = (struct scatterlist *) buff; +#if SMALL_SCATTERLIST -+ cmd->SCp.ptr = cmd->SCp.buffer->u.address; ++ if (sgpnt[sgcount].ispaged) ++ BUG(); ++ buff = sgpnt[sgcount].u.address; +#else - cmd->SCp.ptr = cmd->SCp.buffer->address; + buff = sgpnt[sgcount].address; +#endif - cmd->SCp.this_residual = cmd->SCp.buffer->length; - } - cmd->SCp.Status = (cmd->SCp.this_residual != 0); /* TRUE as long as bytes -Index: linux-2.4.21/drivers/scsi/wd7000.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/wd7000.c 2001-09-30 15:26:08.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/wd7000.c 2005-06-01 23:07:51.140571864 -0400 -@@ -1189,7 +1189,11 @@ - any2scsi (scb->maxlen, SCpnt->use_sg * sizeof (Sgb)); - - for (i = 0; i < SCpnt->use_sg; i++) { + bufflen = sgpnt[sgcount].length; + } + do { +@@ -724,7 +748,13 @@ static int resp_write(Scsi_Cmnd * SCpnt, + block += bufflen >> POW2_SECT_SIZE; + sgcount++; + if (nbytes) { +#if SMALL_SCATTERLIST -+ any2scsi (sgb[i].ptr, (int) sg[i].u.address); ++ if (sgpnt[sgcount].ispaged) ++ BUG(); ++ buff = sgpnt[sgcount].u.address; +#else - any2scsi (sgb[i].ptr, (int) sg[i].address); + buff = sgpnt[sgcount].address; +#endif - any2scsi (sgb[i].len, sg[i].length); - } - } -Index: linux-2.4.21/drivers/scsi/scsiiom.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/scsiiom.c 2000-12-31 14:06:00.000000000 -0500 -+++ linux-2.4.21/drivers/scsi/scsiiom.c 2005-06-01 23:07:51.142571560 -0400 -@@ -379,7 +379,11 @@ + bufflen = sgpnt[sgcount].length; + } + } else if (nbytes > 0) +diff -X dontdiff -urp kern_oldest/drivers/scsi/scsiiom.c kern_fix/drivers/scsi/scsiiom.c +--- kern_oldest/drivers/scsi/scsiiom.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/scsiiom.c 2006-05-01 14:14:13.000000000 -0700 +@@ -379,7 +379,11 @@ dc390_DataOut_0( PACB pACB, PSRB pSRB, P pSRB->pSegmentList++; psgl = pSRB->pSegmentList; @@ -2369,7 +2760,7 @@ Index: linux-2.4.21/drivers/scsi/scsiiom.c pSRB->SGToBeXferLen = (ULONG) psgl->length; } else -@@ -443,7 +447,11 @@ +@@ -443,7 +447,11 @@ dc390_DataIn_0( PACB pACB, PSRB pSRB, PU pSRB->pSegmentList++; psgl = pSRB->pSegmentList; @@ -2381,7 +2772,7 @@ Index: linux-2.4.21/drivers/scsi/scsiiom.c pSRB->SGToBeXferLen = (ULONG) psgl->length; } else -@@ -742,7 +750,11 @@ +@@ -742,7 +750,11 @@ dc390_restore_ptr (PACB pACB, PSRB pSRB) pSRB->pSegmentList++; psgl = pSRB->pSegmentList; @@ -2393,7 +2784,7 @@ Index: linux-2.4.21/drivers/scsi/scsiiom.c pSRB->SGToBeXferLen = (ULONG) psgl->length; } else -@@ -756,10 +768,17 @@ +@@ -756,10 +768,17 @@ dc390_restore_ptr (PACB pACB, PSRB pSRB) { pSRB->SGcount = 1; pSRB->pSegmentList = (PSGL) &pSRB->Segmentx; @@ -2408,377 +2799,539 @@ Index: linux-2.4.21/drivers/scsi/scsiiom.c printk (KERN_INFO "DC390: Pointer restored. Total %li, Bus %p\n", pSRB->Saved_Ptr, pSRB->Segmentx.address); +#endif - } - else - { -@@ -893,7 +912,11 @@ - if( !pSRB->SGToBeXferLen ) + } + else + { +@@ -893,7 +912,11 @@ dc390_DataIO_Comm( PACB pACB, PSRB pSRB, + if( !pSRB->SGToBeXferLen ) + { + psgl = pSRB->pSegmentList; ++#if SMALL_SCATTERLIST ++ pSRB->SGBusAddr = virt_to_bus( psgl->u.address ); ++#else + pSRB->SGBusAddr = virt_to_bus( psgl->address ); ++#endif + pSRB->SGToBeXferLen = (ULONG) psgl->length; + DEBUG1(printk (KERN_DEBUG " DC390: Next SG segment.");) + } +@@ -1368,7 +1391,11 @@ dc390_SRBdone( PACB pACB, PDCB pDCB, PSR + status = pSRB->TargetStatus; + ptr = (PSCSI_INQDATA) (pcmd->request_buffer); + if( pcmd->use_sg ) ++#if SMALL_SCATTERLIST ++ ptr = (PSCSI_INQDATA) (((PSGL) ptr)->u.address); ++#else + ptr = (PSCSI_INQDATA) (((PSGL) ptr)->address); ++#endif + + DEBUG0(printk (" SRBdone (%02x,%08x), SRB %p, pid %li\n", status, pcmd->result,\ + pSRB, pcmd->pid);) +@@ -1443,7 +1470,11 @@ dc390_SRBdone( PACB pACB, PDCB pDCB, PSR + else if( pcmd->request_buffer ) + { + pSRB->pSegmentList = (PSGL) &pSRB->Segmentx; ++#if SMALL_SCATTERLIST ++ pSRB->Segmentx.u.address = (PUCHAR) pcmd->request_buffer; ++#else + pSRB->Segmentx.address = (PUCHAR) pcmd->request_buffer; ++#endif + pSRB->Segmentx.length = pcmd->request_bufflen; + } + if( dc390_StartSCSI( pACB, pDCB, pSRB ) ) { +@@ -1518,7 +1549,11 @@ dc390_SRBdone( PACB pACB, PDCB pDCB, PSR + else if( pcmd->request_buffer ) + { + pSRB->pSegmentList = (PSGL) &pSRB->Segmentx; ++#if SMALL_SCATTERLIST ++ pSRB->Segmentx.u.address = (PUCHAR) pcmd->request_buffer; ++#else + pSRB->Segmentx.address = (PUCHAR) pcmd->request_buffer; ++#endif + pSRB->Segmentx.length = pcmd->request_bufflen; + } + if( dc390_StartSCSI( pACB, pDCB, pSRB ) ) { +@@ -1759,7 +1794,11 @@ dc390_RequestSense( PACB pACB, PDCB pDCB + + pcmd = pSRB->pcmd; + ++#if SMALL_SCATTERLIST ++ pSRB->Segmentx.u.address = (PUCHAR) &(pcmd->sense_buffer); ++#else + pSRB->Segmentx.address = (PUCHAR) &(pcmd->sense_buffer); ++#endif + pSRB->Segmentx.length = sizeof(pcmd->sense_buffer); + pSRB->pSegmentList = &pSRB->Segmentx; + pSRB->SGcount = 1; +diff -X dontdiff -urp kern_oldest/drivers/scsi/scsi_lib.c kern_fix/drivers/scsi/scsi_lib.c +--- kern_oldest/drivers/scsi/scsi_lib.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/scsi_lib.c 2006-05-01 14:14:13.000000000 -0700 +@@ -553,7 +553,13 @@ static void scsi_release_buffers(Scsi_Cm + if (bbpnt) { + for (i = 0; i < SCpnt->use_sg; i++) { + if (bbpnt[i]) ++#if SMALL_SCATTERLIST ++ if (sgpnt[i].ispaged) ++ BUG(); ++ scsi_free(sgpnt[i].u.address, sgpnt[i].length); ++#else + scsi_free(sgpnt[i].address, sgpnt[i].length); ++#endif + } + } + scsi_free(SCpnt->request_buffer, SCpnt->sglist_len); +@@ -629,12 +635,23 @@ void scsi_io_completion(Scsi_Cmnd * SCpn + if (bbpnt) { + for (i = 0; i < SCpnt->use_sg; i++) { + if (bbpnt[i]) { ++#if SMALL_SCATTERLIST ++ if (sgpnt[i].ispaged) ++ BUG(); ++ if (req->cmd == READ) { ++ memcpy(bbpnt[i], ++ sgpnt[i].u.address, ++ sgpnt[i].length); ++ } ++ scsi_free(sgpnt[i].u.address, sgpnt[i].length); ++#else + if (req->cmd == READ) { + memcpy(bbpnt[i], + sgpnt[i].address, + sgpnt[i].length); + } + scsi_free(sgpnt[i].address, sgpnt[i].length); ++#endif + } + } + } +diff -X dontdiff -urp kern_oldest/drivers/scsi/scsi_merge.c kern_fix/drivers/scsi/scsi_merge.c +--- kern_oldest/drivers/scsi/scsi_merge.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/scsi_merge.c 2006-05-01 14:14:13.000000000 -0700 +@@ -144,11 +144,21 @@ static void dma_exhausted(Scsi_Cmnd * SC + */ + for(jj=0; jj < SCpnt->use_sg; jj++) { - psgl = pSRB->pSegmentList; +#if SMALL_SCATTERLIST -+ pSRB->SGBusAddr = virt_to_bus( psgl->u.address ); ++ if (sgpnt[jj].ispaged) ++ BUG(); ++ printk("[%d]\tlen:%d\taddr:%p\tbounce:%p\n", ++ jj, ++ sgpnt[jj].length, ++ sgpnt[jj].u.address, ++ (bbpnt ? bbpnt[jj] : NULL)); +#else - pSRB->SGBusAddr = virt_to_bus( psgl->address ); + printk("[%d]\tlen:%d\taddr:%p\tbounce:%p\n", + jj, + sgpnt[jj].length, + sgpnt[jj].address, + (bbpnt ? bbpnt[jj] : NULL)); +#endif - pSRB->SGToBeXferLen = (ULONG) psgl->length; - DEBUG1(printk (KERN_DEBUG " DC390: Next SG segment.");) + if (bbpnt && bbpnt[jj]) + consumed += sgpnt[jj].length; } -@@ -1368,7 +1391,11 @@ - status = pSRB->TargetStatus; - ptr = (PSCSI_INQDATA) (pcmd->request_buffer); - if( pcmd->use_sg ) +@@ -612,6 +622,9 @@ __inline static int __scsi_merge_request + max_segments = scsi_max_sg; + + #ifdef DMA_CHUNK_SIZE ++# if SMALL_SCATTERLIST ++# error "This defeats the purpose of SMALL_SCATTERLIST" ++# endif + if (max_segments > 64) + max_segments = 64; + +@@ -929,15 +942,26 @@ __inline static int __init_io(Scsi_Cmnd + } + + if (SCpnt->host->highmem_io) { +#if SMALL_SCATTERLIST -+ ptr = (PSCSI_INQDATA) (((PSGL) ptr)->u.address); ++ sgpnt[count].ispaged = 1; ++ sgpnt[count].u.page.page = bh->b_page; ++ sgpnt[count].u.page.offset = bh_offset(bh); +#else - ptr = (PSCSI_INQDATA) (((PSGL) ptr)->address); + sgpnt[count].page = bh->b_page; + sgpnt[count].offset = bh_offset(bh); + sgpnt[count].address = NULL; +#endif - - DEBUG0(printk (" SRBdone (%02x,%08x), SRB %p, pid %li\n", status, pcmd->result,\ - pSRB, pcmd->pid);) -@@ -1443,7 +1470,11 @@ - else if( pcmd->request_buffer ) - { - pSRB->pSegmentList = (PSGL) &pSRB->Segmentx; + } else { + if (PageHighMem(bh->b_page)) + BUG(); + +#if SMALL_SCATTERLIST -+ pSRB->Segmentx.u.address = (PUCHAR) pcmd->request_buffer; ++ sgpnt[count].ispaged = 0; ++ sgpnt[count].u.address = bh->b_data; +#else - pSRB->Segmentx.address = (PUCHAR) pcmd->request_buffer; + sgpnt[count].page = NULL; + sgpnt[count].address = bh->b_data; +#endif - pSRB->Segmentx.length = pcmd->request_bufflen; - } - if( dc390_StartSCSI( pACB, pDCB, pSRB ) ) { -@@ -1518,7 +1549,11 @@ - else if( pcmd->request_buffer ) - { - pSRB->pSegmentList = (PSGL) &pSRB->Segmentx; + } + + sgpnt[count].length = bh->b_size; +@@ -972,6 +996,50 @@ __inline static int __init_io(Scsi_Cmnd + * only done for dma_host, in which case .page is not + * set since it's guarenteed to be a low memory page + */ +#if SMALL_SCATTERLIST -+ pSRB->Segmentx.u.address = (PUCHAR) pcmd->request_buffer; ++ if (sgpnt[i].ispaged) ++ BUG(); ++ if (virt_to_phys(sgpnt[i].u.address) + sgpnt[i].length - 1 > ++ ISA_DMA_THRESHOLD) { ++ if( scsi_dma_free_sectors - sectors <= 10 ) { ++ /* ++ * If this would nearly drain the DMA ++ * pool empty, then let's stop here. ++ * Don't make this request any larger. ++ * This is kind of a safety valve that ++ * we use - we could get screwed later ++ * on if we run out completely. ++ */ ++ SCpnt->request_bufflen -= sgpnt[i].length; ++ SCpnt->use_sg = i; ++ if (i == 0) { ++ goto big_trouble; ++ } ++ break; ++ } ++ ++ bbpnt[i] = sgpnt[i].u.address; ++ sgpnt[i].u.address = ++ (char *) scsi_malloc(sgpnt[i].length); ++ /* ++ * If we cannot allocate memory for this DMA bounce ++ * buffer, then queue just what we have done so far. ++ */ ++ if (sgpnt[i].u.address == NULL) { ++ printk("Warning - running low on DMA memory\n"); ++ SCpnt->request_bufflen -= sgpnt[i].length; ++ SCpnt->use_sg = i; ++ if (i == 0) { ++ goto big_trouble; ++ } ++ break; ++ } ++ if (req->cmd == WRITE) { ++ memcpy(sgpnt[i].u.address, bbpnt[i], ++ sgpnt[i].length); ++ } ++ } +#else - pSRB->Segmentx.address = (PUCHAR) pcmd->request_buffer; -+#endif - pSRB->Segmentx.length = pcmd->request_bufflen; + if (virt_to_phys(sgpnt[i].address) + sgpnt[i].length - 1 > + ISA_DMA_THRESHOLD) { + if( scsi_dma_free_sectors - sectors <= 10 ) { +@@ -1012,6 +1080,7 @@ __inline static int __init_io(Scsi_Cmnd + sgpnt[i].length); + } } - if( dc390_StartSCSI( pACB, pDCB, pSRB ) ) { -@@ -1759,7 +1794,11 @@ ++#endif + } + return 1; - pcmd = pSRB->pcmd; +diff -X dontdiff -urp kern_oldest/drivers/scsi/seagate.c kern_fix/drivers/scsi/seagate.c +--- kern_oldest/drivers/scsi/seagate.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/seagate.c 2006-05-01 14:14:13.000000000 -0700 +@@ -1070,7 +1070,11 @@ static int internal_command (unsigned ch + buffer = (struct scatterlist *) SCint->buffer; + len = buffer->length; +#if SMALL_SCATTERLIST -+ pSRB->Segmentx.u.address = (PUCHAR) &(pcmd->sense_buffer); ++ data = (unsigned char *) buffer->u.address; +#else - pSRB->Segmentx.address = (PUCHAR) &(pcmd->sense_buffer); + data = (unsigned char *) buffer->address; +#endif - pSRB->Segmentx.length = sizeof(pcmd->sense_buffer); - pSRB->pSegmentList = &pSRB->Segmentx; - pSRB->SGcount = 1; -Index: linux-2.4.21/drivers/scsi/tmscsim.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/tmscsim.c 2001-12-21 12:41:55.000000000 -0500 -+++ linux-2.4.21/drivers/scsi/tmscsim.c 2005-06-01 23:07:51.144571256 -0400 -@@ -1146,7 +1146,11 @@ - { - pSRB->SGcount = 1; - pSRB->pSegmentList = (PSGL) &pSRB->Segmentx; + } else { + DPRINTK (DEBUG_SG, + "scsi%d : scatter gather not requested.\n", +@@ -1337,7 +1341,11 @@ static int internal_command (unsigned ch + ++buffer; + len = buffer->length; + data = +- (unsigned char *) buffer->address; +#if SMALL_SCATTERLIST -+ pSRB->Segmentx.u.address = (PUCHAR) pcmd->request_buffer; ++ (unsigned char *)buffer->u.address; +#else - pSRB->Segmentx.address = (PUCHAR) pcmd->request_buffer; ++ (unsigned char *)buffer->address; +#endif - pSRB->Segmentx.length = pcmd->request_bufflen; - } - else -Index: linux-2.4.21/drivers/scsi/AM53C974.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/AM53C974.c 2001-09-30 15:26:07.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/AM53C974.c 2005-06-01 23:07:51.146570952 -0400 -@@ -842,7 +842,11 @@ - if (cmd->use_sg) { - cmd->SCp.buffer = (struct scatterlist *) cmd->buffer; - cmd->SCp.buffers_residual = cmd->use_sg - 1; + DPRINTK (DEBUG_SG, + "scsi%d : next scatter-gather buffer len = %d address = %08x\n", + hostno, len, data); +@@ -1521,7 +1529,11 @@ static int internal_command (unsigned ch + ++buffer; + len = buffer->length; + data = +#if SMALL_SCATTERLIST -+ cmd->SCp.ptr = (char *) cmd->SCp.buffer->u.address; ++ (unsigned char *)buffer->u.address; +#else - cmd->SCp.ptr = (char *) cmd->SCp.buffer->address; + (unsigned char *) buffer->address; +#endif - cmd->SCp.this_residual = cmd->SCp.buffer->length; - } else { - cmd->SCp.buffer = NULL; -@@ -1555,7 +1559,11 @@ - if ((!cmd->SCp.this_residual) && cmd->SCp.buffers_residual) { - cmd->SCp.buffer++; - cmd->SCp.buffers_residual--; + DPRINTK (DEBUG_SG, + "scsi%d : next scatter-gather buffer len = %d address = %08x\n", + hostno, len, data); +diff -X dontdiff -urp kern_oldest/drivers/scsi/sg.c kern_fix/drivers/scsi/sg.c +--- kern_oldest/drivers/scsi/sg.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/sg.c 2006-05-01 14:14:13.000000000 -0700 +@@ -1077,7 +1077,11 @@ static void sg_rb_correct4mmap(Sg_scatte + + for (k = 0; k < rsv_schp->k_use_sg; ++k, ++sclp) { + for (m = PAGE_SIZE; m < sclp->length; m += PAGE_SIZE) { +#if SMALL_SCATTERLIST -+ cmd->SCp.ptr = (unsigned char *) cmd->SCp.buffer->u.address; ++ page_ptr = (unsigned char *)sclp->u.address + m; +#else - cmd->SCp.ptr = (unsigned char *) cmd->SCp.buffer->address; + page_ptr = (unsigned char *)sclp->address + m; +#endif - cmd->SCp.this_residual = cmd->SCp.buffer->length; - } - if (cmd->SCp.this_residual) { -Index: linux-2.4.21/drivers/scsi/megaraid2.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/megaraid2.c 2005-06-01 22:51:54.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/megaraid2.c 2005-06-01 23:07:51.149570496 -0400 -@@ -2180,7 +2180,11 @@ - if( cmd->use_sg ) { - sgl = (struct scatterlist *) - cmd->request_buffer; + page = virt_to_page(page_ptr); + if (startFinish) + get_page(page); /* increment page count */ +@@ -1130,7 +1134,11 @@ static struct page * sg_vma_nopage(struc + len = vma->vm_end - sa; + len = (len < sclp->length) ? len : sclp->length; + if (offset < len) { +#if SMALL_SCATTERLIST -+ c = *(u8 *)sgl[0].u.address; ++ page_ptr = (unsigned char *)sclp->u.address + offset; +#else - c = *(u8 *)sgl[0].address; + page_ptr = (unsigned char *)sclp->address + offset; +#endif - } - else { - c = *(u8 *)cmd->request_buffer; -Index: linux-2.4.21/drivers/scsi/megaraid.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/megaraid.c 2005-06-01 22:51:54.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/megaraid.c 2005-06-01 23:07:51.152570040 -0400 -@@ -1201,8 +1201,13 @@ - case READ_CAPACITY: - if ( SCpnt->use_sg ) { - sgList = (struct scatterlist *)SCpnt->request_buffer; + page = virt_to_page(page_ptr); + get_page(page); /* increment page count */ + break; +@@ -1175,8 +1183,13 @@ static int sg_mmap(struct file * filp, s + + for (k = 0; (k < rsv_schp->k_use_sg) && (sa < vma->vm_end); + ++k, ++sclp) { +#if SMALL_SCATTERLIST -+ memcpy(sgList[0].u.address, pScb->bounce_buffer, -+ SCpnt->request_bufflen); ++ if ((unsigned long)sclp->u.address & (PAGE_SIZE - 1)) ++ return -EFAULT; /* non page aligned memory ?? */ +#else - memcpy(sgList[0].address, pScb->bounce_buffer, -- SCpnt->request_bufflen); -+ SCpnt->request_bufflen); + if ((unsigned long)sclp->address & (PAGE_SIZE - 1)) + return -EFAULT; /* non page aligned memory ?? */ ++#endif + len = vma->vm_end - sa; + len = (len < sclp->length) ? len : sclp->length; + sa += len; +@@ -1725,16 +1738,27 @@ static int sg_build_dir(Sg_request * srp + offset = (0 == k) ? kp->offset : 0; + num = (rem_sz > (PAGE_SIZE - offset)) ? (PAGE_SIZE - offset) : + rem_sz; ++#if SMALL_SCATTERLIST ++ sclp->u.address = page_address(kp->maplist[k]) + offset; ++ sclp->ispaged = 0; ++#else + sclp->address = page_address(kp->maplist[k]) + offset; + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,13) + sclp->page = NULL; + #endif ++#endif + sclp->length = num; + mem_src_arr[k] = SG_USER_MEM; + rem_sz -= num; ++#if SMALL_SCATTERLIST ++ SCSI_LOG_TIMEOUT(5, ++ printk("sg_build_dir: k=%d, a=0x%p, len=%d, ms=%d\n", ++ k, sclp->u.address, num, mem_src_arr[k])); ++#else + SCSI_LOG_TIMEOUT(5, + printk("sg_build_dir: k=%d, a=0x%p, len=%d, ms=%d\n", + k, sclp->address, num, mem_src_arr[k])); +#endif - } else { - memcpy (SCpnt->request_buffer, pScb->bounce_buffer, - SCpnt->request_bufflen); -@@ -1226,7 +1231,11 @@ - if (SCpnt->cmnd[0] == INQUIRY && !islogical) { - if ( SCpnt->use_sg ) { - sgList = (struct scatterlist *)SCpnt->request_buffer; + } + schp->k_use_sg = k; + SCSI_LOG_TIMEOUT(5, +@@ -1814,16 +1838,27 @@ static int sg_build_indi(Sg_scatter_hold + if (! p) + break; + } +#if SMALL_SCATTERLIST -+ memcpy(&c, sgList[0].u.address, 0x1); ++ sclp->u.address = p; ++ sclp->ispaged = 0; +#else - memcpy(&c, sgList[0].address, 0x1); + sclp->address = p; + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,13) + sclp->page = NULL; + #endif +#endif - } else { - memcpy(&c, SCpnt->request_buffer, 0x1); - } -Index: linux-2.4.21/drivers/scsi/atp870u.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/atp870u.c 2002-08-02 20:39:44.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/atp870u.c 2005-06-01 23:07:51.154569736 -0400 -@@ -804,7 +804,11 @@ - sgpnt = (struct scatterlist *) workrequ->request_buffer; - i = 0; - for (j = 0; j < workrequ->use_sg; j++) { + sclp->length = ret_sz; + mem_src_arr[k] = mem_src; + +#if SMALL_SCATTERLIST -+ bttl = virt_to_bus(sgpnt[j].u.address); ++ SCSI_LOG_TIMEOUT(5, ++ printk("sg_build_build: k=%d, a=0x%p, len=%d, ms=%d\n", ++ k, sclp->u.address, ret_sz, mem_src)); +#else - bttl = virt_to_bus(sgpnt[j].address); + SCSI_LOG_TIMEOUT(5, + printk("sg_build_build: k=%d, a=0x%p, len=%d, ms=%d\n", + k, sclp->address, ret_sz, mem_src)); +#endif - l = sgpnt[j].length; - while (l > 0x10000) { - (unsigned short int) (((unsigned short int *) (prd))[i + 3]) = 0x0000; -Index: linux-2.4.21/drivers/scsi/gdth.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/gdth.c 2003-06-13 10:51:36.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/gdth.c 2005-06-01 23:07:51.158569128 -0400 -@@ -2662,7 +2662,11 @@ - if (cpsum+cpnow > cpcount) - cpnow = cpcount - cpsum; - cpsum += cpnow; + } /* end of for loop */ + schp->k_use_sg = k; + SCSI_LOG_TIMEOUT(5, +@@ -1888,13 +1923,21 @@ static int sg_write_xfer(Sg_request * sr + struct scatterlist * sclp = (struct scatterlist *)schp->buffer; + char * mem_src_arr = sg_get_sgat_msa(schp); + ksglen = (int)sclp->length; +#if SMALL_SCATTERLIST -+ memcpy((char*)sl->u.address,buffer,cpnow); ++ p = sclp->u.address; +#else - memcpy((char*)sl->address,buffer,cpnow); + p = sclp->address; +#endif - if (cpsum == cpcount) - break; - buffer += cpnow; -@@ -2837,7 +2841,11 @@ - cmdp->u.cache.DestAddr= 0xffffffff; - sl = (struct scatterlist *)scp->request_buffer; - for (i=0; iuse_sg; ++i,++sl) { + + for (j = 0, k = 0; j < onum; ++j) { + res = sg_u_iovec(hp, iovec_count, j, 1, &usglen, &up); + if (res) return res; + +#if SMALL_SCATTERLIST -+ cmdp->u.cache.sg_lst[i].sg_ptr = virt_to_bus(sl->u.address); ++ for ( ; p; ++sclp, ksglen = (int)sclp->length, p = sclp->u.address) { +#else - cmdp->u.cache.sg_lst[i].sg_ptr = virt_to_bus(sl->address); + for ( ; p; ++sclp, ksglen = (int)sclp->length, p = sclp->address) { +#endif - cmdp->u.cache.sg_lst[i].sg_len = (ulong32)sl->length; - } - cmdp->u.cache.sg_canz = (ulong32)i; -@@ -2954,7 +2962,11 @@ - cmdp->u.raw.sdata = 0xffffffff; - sl = (struct scatterlist *)scp->request_buffer; - for (i=0; iuse_sg; ++i,++sl) { + ok = (SG_USER_MEM != mem_src_arr[k]); + if (usglen <= 0) + break; +@@ -1971,6 +2014,18 @@ static void sg_remove_scat(Sg_scatter_ho + struct scatterlist * sclp = (struct scatterlist *)schp->buffer; + char * mem_src_arr = sg_get_sgat_msa(schp); + +#if SMALL_SCATTERLIST -+ cmdp->u.raw.sg_lst[i].sg_ptr = virt_to_bus(sl->u.address); ++ for (k = 0; (k < schp->k_use_sg) && sclp->u.address; ++k, ++sclp) { ++ mem_src = mem_src_arr[k]; ++ SCSI_LOG_TIMEOUT(5, ++ printk("sg_remove_scat: k=%d, a=0x%p, len=%d, ms=%d\n", ++ k, sclp->u.address, sclp->length, mem_src)); ++ sg_free(sclp->u.address, sclp->length, mem_src); ++ sclp->u.address = NULL; ++ sclp->ispaged = 0; ++ sclp->length = 0; ++ } +#else - cmdp->u.raw.sg_lst[i].sg_ptr = virt_to_bus(sl->address); + for (k = 0; (k < schp->k_use_sg) && sclp->address; ++k, ++sclp) { + mem_src = mem_src_arr[k]; + SCSI_LOG_TIMEOUT(5, +@@ -1983,6 +2038,7 @@ static void sg_remove_scat(Sg_scatter_ho + #endif + sclp->length = 0; + } +#endif - cmdp->u.raw.sg_lst[i].sg_len = (ulong32)sl->length; - } - cmdp->u.raw.sg_ranz = (ulong32)i; -Index: linux-2.4.21/drivers/scsi/ini9100u.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/ini9100u.c 2001-09-30 15:26:07.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/ini9100u.c 2005-06-01 23:07:51.159568976 -0400 -@@ -489,7 +489,11 @@ - if (SCpnt->use_sg) { - pSrbSG = (struct scatterlist *) SCpnt->request_buffer; - if (SCpnt->use_sg == 1) { /* If only one entry in the list *//* treat it as regular I/O */ + sg_free(schp->buffer, schp->sglist_len, schp->buffer_mem_src); + } + else if (schp->buffer) +@@ -2043,13 +2099,21 @@ static int sg_read_xfer(Sg_request * srp + struct scatterlist * sclp = (struct scatterlist *)schp->buffer; + char * mem_src_arr = sg_get_sgat_msa(schp); + ksglen = (int)sclp->length; +#if SMALL_SCATTERLIST -+ pSCB->SCB_BufPtr = (U32) VIRT_TO_BUS(pSrbSG->u.address); ++ p = sclp->u.address; +#else - pSCB->SCB_BufPtr = (U32) VIRT_TO_BUS(pSrbSG->address); + p = sclp->address; +#endif - TotalLen = pSrbSG->length; - pSCB->SCB_SGLen = 0; - } else { /* Assign SG physical address */ -@@ -498,7 +502,11 @@ - for (i = 0, TotalLen = 0, pSG = &pSCB->SCB_SGList[0]; /* 1.01g */ - i < SCpnt->use_sg; - i++, pSG++, pSrbSG++) { + + for (j = 0, k = 0; j < onum; ++j) { + res = sg_u_iovec(hp, iovec_count, j, 0, &usglen, &up); + if (res) return res; + +#if SMALL_SCATTERLIST -+ pSG->SG_Ptr = (U32) VIRT_TO_BUS(pSrbSG->u.address); ++ for ( ; p; ++sclp, ksglen = (int)sclp->length, p = sclp->u.address) { +#else - pSG->SG_Ptr = (U32) VIRT_TO_BUS(pSrbSG->address); + for ( ; p; ++sclp, ksglen = (int)sclp->length, p = sclp->address) { +#endif - TotalLen += pSG->SG_Len = pSrbSG->length; - } - pSCB->SCB_SGLen = i; -Index: linux-2.4.21/drivers/scsi/inia100.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/inia100.c 2001-09-30 15:26:07.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/inia100.c 2005-06-01 23:07:51.159568976 -0400 -@@ -494,7 +494,11 @@ - pSCB->SCB_SGLen = (U32) (SCpnt->use_sg * 8); - pSrbSG = (struct scatterlist *) SCpnt->request_buffer; - for (i = 0; i < SCpnt->use_sg; i++, pSG++, pSrbSG++) { + ok = (SG_USER_MEM != mem_src_arr[k]); + if (usglen <= 0) + break; +@@ -2093,14 +2157,26 @@ static void sg_read_oxfer(Sg_request * s + int k, num; + struct scatterlist * sclp = (struct scatterlist *)schp->buffer; + +#if SMALL_SCATTERLIST -+ pSG->SG_Ptr = (U32) (VIRT_TO_BUS(pSrbSG->u.address)); ++ for (k = 0; (k < schp->k_use_sg) && sclp->u.address; ++k, ++sclp) { +#else - pSG->SG_Ptr = (U32) (VIRT_TO_BUS(pSrbSG->address)); + for (k = 0; (k < schp->k_use_sg) && sclp->address; ++k, ++sclp) { +#endif - pSG->SG_Len = (U32) pSrbSG->length; - TotalLen += (U32) pSrbSG->length; - } -Index: linux-2.4.21/drivers/scsi/ide-scsi.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/ide-scsi.c 2005-06-01 22:52:05.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/ide-scsi.c 2005-06-01 23:07:51.160568824 -0400 -@@ -154,7 +154,11 @@ - return; - } - count = IDE_MIN(pc->sg->length - pc->b_count, bcount); + num = (int)sclp->length; + if (num > num_read_xfer) { +#if SMALL_SCATTERLIST -+ HWIF(drive)->atapi_input_bytes(drive, pc->sg->u.address + pc->b_count, count); ++ __copy_to_user(outp, sclp->u.address, num_read_xfer); +#else - HWIF(drive)->atapi_input_bytes(drive, pc->sg->address + pc->b_count, count); + __copy_to_user(outp, sclp->address, num_read_xfer); +#endif - bcount -= count; - pc->b_count += count; - if (pc->b_count == pc->sg->length) { -@@ -176,7 +180,11 @@ - return; - } - count = IDE_MIN(pc->sg->length - pc->b_count, bcount); + break; + } + else { +#if SMALL_SCATTERLIST -+ HWIF(drive)->atapi_output_bytes(drive, pc->sg->u.address + pc->b_count, count); ++ __copy_to_user(outp, sclp->u.address, num); +#else - HWIF(drive)->atapi_output_bytes(drive, pc->sg->address + pc->b_count, count); + __copy_to_user(outp, sclp->address, num); +#endif - bcount -= count; - pc->b_count += count; - if (pc->b_count == pc->sg->length) { -@@ -1026,6 +1034,19 @@ - pc->request_transfer >> 10); - #endif /* IDESCSI_DEBUG_LOG */ - while (segments--) { + num_read_xfer -= num; + if (num_read_xfer <= 0) + break; +@@ -2146,7 +2222,11 @@ static void sg_link_reserve(Sg_fd * sfp, + if (rem <= num) { + if (0 == k) { + req_schp->k_use_sg = 0; +#if SMALL_SCATTERLIST -+#if 1 -+ bh->b_data = sg->u.address; ++ req_schp->buffer = sclp->u.address; +#else -+ if (sg->u.address) { -+ bh->b_page = virt_to_page(sg->u.address); -+ bh->b_data = (char *) ((unsigned long) sg->u.address & ~PAGE_MASK); -+ } else if (sg->u.page.page) { -+ bh->b_page = sg->u.page.page; -+ bh->b_data = (char *) sg->u.page.offset; -+ } + req_schp->buffer = sclp->address; +#endif -+#else /* !SMALL_SCATTERLIST */ - #if 1 - bh->b_data = sg->address; - #else -@@ -1037,6 +1058,7 @@ - bh->b_data = (char *) sg->offset; - } - #endif -+#endif /* !SMALL_SCATTERLIST */ - bh->b_size = sg->length; - bh = bh->b_reqnext; - sg++; -Index: linux-2.4.21/drivers/scsi/ppa.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/ppa.c 2005-06-01 22:52:05.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/ppa.c 2005-06-01 23:07:51.161568672 -0400 -@@ -740,7 +740,11 @@ - if (cmd->SCp.buffers_residual--) { - cmd->SCp.buffer++; - cmd->SCp.this_residual = cmd->SCp.buffer->length; + } + else { + sfp->save_scat_len = num; +diff -X dontdiff -urp kern_oldest/drivers/scsi/sim710.c kern_fix/drivers/scsi/sim710.c +--- kern_oldest/drivers/scsi/sim710.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/sim710.c 2006-05-01 14:14:13.000000000 -0700 +@@ -1164,7 +1164,11 @@ run_command (struct sim710_hostdata *hos + + for (i = 0; cmd->use_sg ? (i < cmd->use_sg) : !i; i++) { + u32 vbuf = cmd->use_sg ? +#if SMALL_SCATTERLIST -+ cmd->SCp.ptr = cmd->SCp.buffer->u.address; ++ (u32)(((struct scatterlist *)cmd->buffer)[i].u.address) : +#else - cmd->SCp.ptr = cmd->SCp.buffer->address; + (u32)(((struct scatterlist *)cmd->buffer)[i].address) : +#endif - } - } - /* Now check to see if the drive is ready to comunicate */ -@@ -925,7 +929,11 @@ - /* if many buffers are available, start filling the first */ - cmd->SCp.buffer = (struct scatterlist *) cmd->request_buffer; - cmd->SCp.this_residual = cmd->SCp.buffer->length; + (u32)(cmd->request_buffer); + u32 bbuf = virt_to_bus((void *)vbuf); + u32 cnt = cmd->use_sg ? +diff -X dontdiff -urp kern_oldest/drivers/scsi/sr.c kern_fix/drivers/scsi/sr.c +--- kern_oldest/drivers/scsi/sr.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/sr.c 2006-05-01 14:14:13.000000000 -0700 +@@ -343,7 +343,12 @@ static int sr_scatter_pad(Scsi_Cmnd *SCp + + i = 0; + if (fsize) { +#if SMALL_SCATTERLIST -+ cmd->SCp.ptr = cmd->SCp.buffer->u.address; ++ sg[0].ispaged = 0; ++ sg[0].u.address = bbpnt[0] = front; +#else - cmd->SCp.ptr = cmd->SCp.buffer->address; + sg[0].address = bbpnt[0] = front; +#endif + sg[0].length = fsize; + i++; + } +@@ -354,7 +359,12 @@ static int sr_scatter_pad(Scsi_Cmnd *SCp + scsi_free(old_sg, (((SCpnt->use_sg * sizeof(struct scatterlist)) + + (SCpnt->use_sg * sizeof(void *))) + 511) & ~511); } else { - /* else fill the only available buffer */ - cmd->SCp.buffer = NULL; -Index: linux-2.4.21/drivers/scsi/imm.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/imm.c 2005-06-01 22:52:05.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/imm.c 2005-06-01 23:07:51.162568520 -0400 -@@ -834,7 +834,11 @@ - if (cmd->SCp.buffers_residual--) { - cmd->SCp.buffer++; - cmd->SCp.this_residual = cmd->SCp.buffer->length; +#if SMALL_SCATTERLIST -+ cmd->SCp.ptr = cmd->SCp.buffer->u.address; ++ sg[i].ispaged = 0; ++ sg[i].u.address = SCpnt->request_buffer; +#else - cmd->SCp.ptr = cmd->SCp.buffer->address; + sg[i].address = SCpnt->request_buffer; +#endif + sg[i].length = SCpnt->request_bufflen; + } + +@@ -364,7 +374,12 @@ static int sr_scatter_pad(Scsi_Cmnd *SCp + SCpnt->use_sg += i; - /* - * Make sure that we transfer even number of bytes -@@ -1008,7 +1012,11 @@ - /* if many buffers are available, start filling the first */ - cmd->SCp.buffer = (struct scatterlist *) cmd->request_buffer; - cmd->SCp.this_residual = cmd->SCp.buffer->length; + if (bsize) { +#if SMALL_SCATTERLIST -+ cmd->SCp.ptr = cmd->SCp.buffer->u.address; ++ sg[SCpnt->use_sg].ispaged = 0; ++ sg[SCpnt->use_sg].u.address = back; +#else - cmd->SCp.ptr = cmd->SCp.buffer->address; + sg[SCpnt->use_sg].address = back; +#endif - } else { - /* else fill the only available buffer */ - cmd->SCp.buffer = NULL; -Index: linux-2.4.21/drivers/scsi/st.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/st.c 2005-06-01 22:52:04.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/st.c 2005-06-01 23:07:51.164568216 -0400 -@@ -3409,6 +3409,12 @@ + bbpnt[SCpnt->use_sg] = back; + sg[SCpnt->use_sg].length = bsize; + SCpnt->use_sg++; +diff -X dontdiff -urp kern_oldest/drivers/scsi/st.c kern_fix/drivers/scsi/st.c +--- kern_oldest/drivers/scsi/st.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/st.c 2006-05-01 14:14:13.000000000 -0700 +@@ -3410,6 +3410,12 @@ static int st_ioctl(struct inode *inode, } @@ -2791,7 +3344,7 @@ Index: linux-2.4.21/drivers/scsi/st.c /* Try to allocate a new tape buffer. Calling function must not hold dev_arr_lock. */ static ST_buffer * -@@ -3446,18 +3452,23 @@ +@@ -3447,18 +3453,23 @@ static ST_buffer * order++, b_size *= 2) ; for ( ; b_size >= PAGE_SIZE; order--, b_size /= 2) { @@ -2819,7 +3372,7 @@ Index: linux-2.4.21/drivers/scsi/st.c for (b_size = PAGE_SIZE, order=0; st_buffer_size > -@@ -3466,10 +3477,10 @@ +@@ -3467,10 +3478,10 @@ static ST_buffer * ; for (segs = 1, got = tb->sg_lengths[0]; got < st_buffer_size && segs < ST_FIRST_SG;) { @@ -2832,7 +3385,7 @@ Index: linux-2.4.21/drivers/scsi/st.c if (st_buffer_size - got <= (ST_FIRST_SG - segs) * b_size / 2) { b_size /= 2; /* Large enough for the -@@ -3485,7 +3496,11 @@ +@@ -3486,7 +3497,11 @@ static ST_buffer * tb = NULL; break; } @@ -2844,7 +3397,7 @@ Index: linux-2.4.21/drivers/scsi/st.c tb->sg_lengths[segs] = b_size; got += b_size; segs++; -@@ -3499,7 +3514,7 @@ +@@ -3500,7 +3515,7 @@ static ST_buffer * return NULL; } tb->sg_segs = tb->orig_sg_segs = segs; @@ -2853,7 +3406,7 @@ Index: linux-2.4.21/drivers/scsi/st.c DEBC(printk(ST_DEB_MSG "st: Allocated tape buffer %d (%d bytes, %d segments, dma: %d, a: %p).\n", -@@ -3545,9 +3560,9 @@ +@@ -3546,9 +3561,9 @@ static int enlarge_buffer(ST_buffer * ST for (segs = STbuffer->sg_segs, got = STbuffer->buffer_size; segs < max_segs && got < new_size;) { @@ -2865,7 +3418,7 @@ Index: linux-2.4.21/drivers/scsi/st.c if (new_size - got <= (max_segs - segs) * b_size / 2) { b_size /= 2; /* Large enough for the rest of the buffers */ order--; -@@ -3559,7 +3574,11 @@ +@@ -3560,7 +3575,11 @@ static int enlarge_buffer(ST_buffer * ST normalize_buffer(STbuffer); return FALSE; } @@ -2877,7 +3430,7 @@ Index: linux-2.4.21/drivers/scsi/st.c STbuffer->sg_lengths[segs] = b_size; STbuffer->sg_segs += 1; got += b_size; -@@ -3583,13 +3602,13 @@ +@@ -3584,13 +3603,13 @@ static void normalize_buffer(ST_buffer * for (b_size=PAGE_SIZE, order=0; b_size < STbuffer->sg_lengths[i]; order++, b_size *= 2) ; /* empty */ @@ -2893,7 +3446,7 @@ Index: linux-2.4.21/drivers/scsi/st.c STbuffer->sg_segs); ) /* end DEB */ STbuffer->sg_segs = STbuffer->orig_sg_segs; -@@ -3612,7 +3631,7 @@ +@@ -3613,7 +3632,7 @@ static int append_to_buffer(const char * for (; i < st_bp->sg_segs && do_count > 0; i++) { cnt = st_bp->sg_lengths[i] - offset < do_count ? st_bp->sg_lengths[i] - offset : do_count; @@ -2902,7 +3455,7 @@ Index: linux-2.4.21/drivers/scsi/st.c if (res) return (-EFAULT); do_count -= cnt; -@@ -3645,7 +3664,7 @@ +@@ -3646,7 +3665,7 @@ static int from_buffer(ST_buffer * st_bp for (; i < st_bp->sg_segs && do_count > 0; i++) { cnt = st_bp->sg_lengths[i] - offset < do_count ? st_bp->sg_lengths[i] - offset : do_count; @@ -2911,7 +3464,7 @@ Index: linux-2.4.21/drivers/scsi/st.c if (res) return (-EFAULT); do_count -= cnt; -@@ -3688,8 +3707,8 @@ +@@ -3689,8 +3708,8 @@ static void move_buffer_data(ST_buffer * for (dst_seg=dst_offset=0; total > 0; ) { count = min(st_bp->sg_lengths[dst_seg] - dst_offset, st_bp->sg_lengths[src_seg] - src_offset); @@ -2922,632 +3475,338 @@ Index: linux-2.4.21/drivers/scsi/st.c printk("st: move (%d,%d) -> (%d,%d) count %d\n", src_seg, src_offset, dst_seg, dst_offset, count); src_offset += count; -Index: linux-2.4.21/drivers/scsi/osst.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/osst.c 2005-06-01 22:52:04.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/osst.c 2005-06-01 23:07:51.169567456 -0400 -@@ -477,7 +477,11 @@ - if (STp->raw) { - if (STp->buffer->syscall_result) { - for (i=0; i < STp->buffer->sg_segs; i++) -+#if SMALL_SCATTERLIST -+ memset(STp->buffer->sg[i].u.address, 0, STp->buffer->sg[i].length); -+#else - memset(STp->buffer->sg[i].address, 0, STp->buffer->sg[i].length); -+#endif - strcpy(STp->buffer->b_data, "READ ERROR ON FRAME"); - } else - STp->buffer->buffer_bytes = OS_FRAME_SIZE; -@@ -4460,10 +4464,19 @@ - for (i = 0, b_size = 0; - i < STp->buffer->sg_segs && (b_size + STp->buffer->sg[i].length) <= OS_DATA_SIZE; - b_size += STp->buffer->sg[i++].length); -+#if SMALL_SCATTERLIST -+ STp->buffer->aux = (os_aux_t *) (STp->buffer->sg[i].u.address + OS_DATA_SIZE - b_size); -+#else - STp->buffer->aux = (os_aux_t *) (STp->buffer->sg[i].address + OS_DATA_SIZE - b_size); -+#endif - #if DEBUG - printk(OSST_DEB_MSG "osst%d:D: b_data points to %p in segment 0 at %p\n", dev, -- STp->buffer->b_data, STp->buffer->sg[0].address); -+ STp->buffer->b_data, -+#if SMALL_SCATTERLIST -+ STp->buffer->sg[0].u.address); -+#else -+ STp->buffer->sg[0].address); -+#endif - printk(OSST_DEB_MSG "osst%d:D: AUX points to %p in segment %d at %p\n", dev, - STp->buffer->aux, i, STp->buffer->sg[i].address); - #endif -@@ -5007,6 +5020,12 @@ - - /* Memory handling routines */ - -+#if SMALL_SCATTERLIST -+#define SG_ADDRESS(sg) ((sg).u.address) -+#else -+#define SG_ADDRESS(sg) ((sg).address) -+#endif -+ - /* Try to allocate a new tape buffer */ - static OSST_buffer * new_tape_buffer( int from_initialization, int need_dma ) - { -@@ -5035,15 +5054,19 @@ - b_size *= 2, order++ ); - - for ( ; b_size >= PAGE_SIZE; order--, b_size /= 2) { -- tb->sg[0].address = -+ SG_ADDRESS(tb->sg[0]) = - (unsigned char *)__get_free_pages(priority, order); -- if (tb->sg[0].address != NULL) { -+ if (SG_ADDRESS(tb->sg[0]) != NULL) { -+#if SMALL_SCATTERLIST -+ tb->sg[0].ispaged = 0; -+#else - tb->sg[0].page = NULL; -+#endif - tb->sg[0].length = b_size; - break; - } - } -- if (tb->sg[segs].address == NULL) { -+ if (SG_ADDRESS(tb->sg[segs]) == NULL) { - kfree(tb); - tb = NULL; - } -@@ -5055,9 +5078,9 @@ - - for (segs=1, got=tb->sg[0].length; - got < osst_buffer_size && segs < OSST_FIRST_SG; ) { -- tb->sg[segs].address = -+ SG_ADDRESS(tb->sg[segs]) = - (unsigned char *)__get_free_pages(priority, order); -- if (tb->sg[segs].address == NULL) { -+ if (SG_ADDRESS(tb->sg[segs]) == NULL) { - if (osst_buffer_size - got <= - (OSST_FIRST_SG - segs) * b_size / 2) { - b_size /= 2; /* Large enough for the rest of the buffers */ -@@ -5074,7 +5097,11 @@ - tb = NULL; - break; - } -+#if SMALL_SCATTERLIST -+ tb->sg[segs].ispaged = 0; -+#else - tb->sg[segs].page = NULL; -+#endif - tb->sg[segs].length = b_size; - got += b_size; - segs++; -@@ -5087,7 +5114,7 @@ - return NULL; - } - tb->sg_segs = tb->orig_sg_segs = segs; -- tb->b_data = tb->sg[0].address; -+ tb->b_data = SG_ADDRESS(tb->sg[0]); - - #if DEBUG - if (debugging) { -@@ -5132,9 +5159,9 @@ - - for (segs=STbuffer->sg_segs, got=STbuffer->buffer_size; - segs < max_segs && got < new_size; ) { -- STbuffer->sg[segs].address = -+ SG_ADDRESS(STbuffer->sg[segs]) = - (unsigned char *)__get_free_pages(priority, order); -- if (STbuffer->sg[segs].address == NULL) { -+ if (SG_ADDRESS(STbuffer->sg[segs]) == NULL) { - if (new_size - got <= (max_segs - segs) * b_size / 2) { - b_size /= 2; /* Large enough for the rest of the buffers */ - order--; -@@ -5148,7 +5175,11 @@ - normalize_buffer(STbuffer); - return FALSE; - } -+#if SMALL_SCATTERLIST -+ STbuffer->sg[segs].ispaged = 0; -+#else - STbuffer->sg[segs].page = NULL; -+#endif - STbuffer->sg[segs].length = b_size; - STbuffer->sg_segs += 1; - got += b_size; -@@ -5181,8 +5212,8 @@ - for (b_size = PAGE_SIZE, order = 0; - b_size < STbuffer->sg[i].length; - b_size *= 2, order++); -- -- free_pages((unsigned long)STbuffer->sg[i].address, order); -+ -+ free_pages((unsigned long)SG_ADDRESS(STbuffer->sg[i]), order); - STbuffer->buffer_size -= STbuffer->sg[i].length; - } - #if DEBUG -@@ -5210,7 +5241,7 @@ - for ( ; i < st_bp->sg_segs && do_count > 0; i++) { - cnt = st_bp->sg[i].length - offset < do_count ? - st_bp->sg[i].length - offset : do_count; -- res = copy_from_user(st_bp->sg[i].address + offset, ubp, cnt); -+ res = copy_from_user(SG_ADDRESS(st_bp->sg[i]) + offset, ubp, cnt); - if (res) - return (-EFAULT); - do_count -= cnt; -@@ -5243,7 +5274,7 @@ - for ( ; i < st_bp->sg_segs && do_count > 0; i++) { - cnt = st_bp->sg[i].length - offset < do_count ? - st_bp->sg[i].length - offset : do_count; -- res = copy_to_user(ubp, st_bp->sg[i].address + offset, cnt); -+ res = copy_to_user(ubp, SG_ADDRESS(st_bp->sg[i]) + offset, cnt); - if (res) - return (-EFAULT); - do_count -= cnt; -@@ -5276,7 +5307,7 @@ - i < st_bp->sg_segs && do_count > 0; i++) { - cnt = st_bp->sg[i].length - offset < do_count ? - st_bp->sg[i].length - offset : do_count ; -- memset(st_bp->sg[i].address + offset, 0, cnt); -+ memset(SG_ADDRESS(st_bp->sg[i]) + offset, 0, cnt); - do_count -= cnt; - offset = 0; - } -@@ -5296,7 +5327,7 @@ - for (i = 0; i < st_bp->sg_segs && do_count > 0; i++) { - cnt = st_bp->sg[i].length < do_count ? - st_bp->sg[i].length : do_count ; -- memcpy(st_bp->sg[i].address, ptr, cnt); -+ memcpy(SG_ADDRESS(st_bp->sg[i]), ptr, cnt); - do_count -= cnt; - ptr += cnt; - } -@@ -5317,7 +5348,7 @@ - for (i = 0; i < st_bp->sg_segs && do_count > 0; i++) { - cnt = st_bp->sg[i].length < do_count ? - st_bp->sg[i].length : do_count ; -- memcpy(ptr, st_bp->sg[i].address, cnt); -+ memcpy(ptr, SG_ADDRESS(st_bp->sg[i]), cnt); - do_count -= cnt; - ptr += cnt; - } -Index: linux-2.4.21/drivers/scsi/pcmcia/nsp_cs.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/pcmcia/nsp_cs.c 2003-06-13 10:51:36.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/pcmcia/nsp_cs.c 2005-06-01 23:07:51.170567304 -0400 -@@ -201,7 +201,11 @@ - SCp.phase : current state of the command */ - if (SCpnt->use_sg) { - SCpnt->SCp.buffer = (struct scatterlist *) SCpnt->request_buffer; -+#if SMALL_SCATTERLIST -+ SCpnt->SCp.ptr = SCpnt->SCp.buffer->u.address; -+#else - SCpnt->SCp.ptr = SCpnt->SCp.buffer->address; -+#endif - SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; - SCpnt->SCp.buffers_residual = SCpnt->use_sg - 1; - } else { -@@ -713,7 +717,11 @@ - //DEBUG(0, " scatterlist next timeout=%d\n", time_out); - SCpnt->SCp.buffers_residual--; - SCpnt->SCp.buffer++; -+#if SMALL_SCATTERLIST -+ SCpnt->SCp.ptr = SCpnt->SCp.buffer->u.address; -+#else - SCpnt->SCp.ptr = SCpnt->SCp.buffer->address; -+#endif - SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; - } - -@@ -786,7 +794,11 @@ - //DEBUG(0, " scatterlist next\n"); - SCpnt->SCp.buffers_residual--; - SCpnt->SCp.buffer++; +diff -X dontdiff -urp kern_oldest/drivers/scsi/sym53c416.c kern_fix/drivers/scsi/sym53c416.c +--- kern_oldest/drivers/scsi/sym53c416.c 2006-05-01 11:55:41.000000000 -0700 ++++ kern_fix/drivers/scsi/sym53c416.c 2006-05-01 14:14:13.000000000 -0700 +@@ -448,7 +448,11 @@ static void sym53c416_intr_handle(int ir + sglist = current_command->request_buffer; + while(sgcount--) + { +#if SMALL_SCATTERLIST -+ SCpnt->SCp.ptr = SCpnt->SCp.buffer->u.address; ++ tot_trans += sym53c416_write(base, sglist->u.address, sglist->length); +#else - SCpnt->SCp.ptr = SCpnt->SCp.buffer->address; + tot_trans += sym53c416_write(base, sglist->address, sglist->length); +#endif - SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; - } - -Index: linux-2.4.21/drivers/scsi/ips.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/ips.c 2005-06-01 22:51:54.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/ips.c 2005-06-01 23:07:51.175566544 -0400 -@@ -217,7 +217,11 @@ - #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0) - #include - #include "sd.h" -+#if SMALL_SCATTERLIST -+#define IPS_SG_ADDRESS(sg) ((sg)->u.address) -+#else - #define IPS_SG_ADDRESS(sg) ((sg)->address) -+#endif /* !SMALL_SCATTERLIST */ - #define IPS_LOCK_SAVE(lock,flags) spin_lock_irqsave(&io_request_lock,flags) - #define IPS_UNLOCK_RESTORE(lock,flags) spin_unlock_irqrestore(&io_request_lock,flags) - #ifndef __devexit_p -Index: linux-2.4.21/drivers/scsi/libata-core.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/libata-core.c 2005-06-01 22:51:58.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/libata-core.c 2005-06-01 23:36:21.244596536 -0400 -@@ -2068,8 +2068,13 @@ - qc->buf_virt = buf; - - sg = qc->sg; -+#if SMALL_SCATTERLIST -+ sg->u.page.page = virt_to_page(buf); -+ sg->u.page.offset = (unsigned long) buf & ~PAGE_MASK; -+#else - sg->page = virt_to_page(buf); - sg->offset = (unsigned long) buf & ~PAGE_MASK; -+#endif /* !SMALL_SCATTERLIST */ - sg->length = buflen; - } - -@@ -2297,8 +2302,13 @@ - if (qc->cursect == (qc->nsect - 1)) - ap->pio_task_state = PIO_ST_LAST; - -+#if SMALL_SCATTERLIST -+ page = sg[qc->cursg].u.page.page; -+ offset = sg[qc->cursg].u.page.offset + qc->cursg_ofs * ATA_SECT_SIZE; -+#else - page = sg[qc->cursg].page; - offset = sg[qc->cursg].offset + qc->cursg_ofs * ATA_SECT_SIZE; -+#endif /* SMALL_SCATTERLIST */ - - /* get the current page and offset */ - page = nth_page(page, (offset >> PAGE_SHIFT)); -@@ -2339,8 +2349,13 @@ - next_sg: - sg = &qc->sg[qc->cursg]; - + sglist++; + } + } +@@ -474,7 +478,11 @@ static void sym53c416_intr_handle(int ir + sglist = current_command->request_buffer; + while(sgcount--) + { +#if SMALL_SCATTERLIST -+ page = sg->u.page.page; -+ offset = sg->u.page.offset + qc->cursg_ofs; ++ tot_trans += sym53c416_read(base, sglist->u.address, sglist->length); +#else - page = sg->page; - offset = sg->offset + qc->cursg_ofs; + tot_trans += sym53c416_read(base, sglist->address, sglist->length); +#endif - - /* get the current page and offset */ - page = nth_page(page, (offset >> PAGE_SHIFT)); -Index: linux-2.4.21/drivers/scsi/libata-scsi.c -=================================================================== ---- linux-2.4.21.orig/drivers/scsi/libata-scsi.c 2005-06-01 22:51:58.000000000 -0400 -+++ linux-2.4.21/drivers/scsi/libata-scsi.c 2005-06-01 23:12:15.112442040 -0400 -@@ -689,7 +689,11 @@ - struct scatterlist *sg; - - sg = (struct scatterlist *) cmd->request_buffer; + sglist++; + } + } +diff -X dontdiff -urp kern_oldest/drivers/scsi/tmscsim.c kern_fix/drivers/scsi/tmscsim.c +--- kern_oldest/drivers/scsi/tmscsim.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/tmscsim.c 2006-05-01 14:14:13.000000000 -0700 +@@ -1146,7 +1146,11 @@ static void dc390_BuildSRB (Scsi_Cmnd* p + { + pSRB->SGcount = 1; + pSRB->pSegmentList = (PSGL) &pSRB->Segmentx; +#if SMALL_SCATTERLIST -+ buf = kmap_atomic(sg->u.page.page, KM_USER0) + sg->u.page.offset; ++ pSRB->Segmentx.u.address = (PUCHAR) pcmd->request_buffer; +#else - buf = kmap_atomic(sg->page, KM_USER0) + sg->offset; -+#endif /* !SMALL_SCATTERLIST */ - buflen = sg->length; - } else { - buf = cmd->request_buffer; -@@ -717,7 +721,11 @@ - struct scatterlist *sg; - - sg = (struct scatterlist *) cmd->request_buffer; + pSRB->Segmentx.address = (PUCHAR) pcmd->request_buffer; ++#endif + pSRB->Segmentx.length = pcmd->request_bufflen; + } + else +diff -X dontdiff -urp kern_oldest/drivers/scsi/ultrastor.c kern_fix/drivers/scsi/ultrastor.c +--- kern_oldest/drivers/scsi/ultrastor.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/ultrastor.c 2006-05-01 14:14:13.000000000 -0700 +@@ -666,7 +666,11 @@ static inline void build_sg_list(registe + sl = (struct scatterlist *) SCpnt->request_buffer; + max = SCpnt->use_sg; + for (i = 0; i < max; i++) { +#if SMALL_SCATTERLIST -+ kunmap_atomic(buf - sg->u.page.offset, KM_USER0); ++ mscp->sglist[i].address = virt_to_bus(sl[i].u.address); +#else - kunmap_atomic(buf - sg->offset, KM_USER0); -+#endif /* !SMALL_SCATTERLIST */ + mscp->sglist[i].address = virt_to_bus(sl[i].address); ++#endif + mscp->sglist[i].num_bytes = sl[i].length; + transfer_length += sl[i].length; } - } +diff -X dontdiff -urp kern_oldest/drivers/scsi/wd7000.c kern_fix/drivers/scsi/wd7000.c +--- kern_oldest/drivers/scsi/wd7000.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/drivers/scsi/wd7000.c 2006-05-01 14:14:13.000000000 -0700 +@@ -1189,7 +1189,11 @@ int wd7000_queuecommand (Scsi_Cmnd *SCpn + any2scsi (scb->maxlen, SCpnt->use_sg * sizeof (Sgb)); -Index: linux-2.4.21/drivers/block/cpqarray.c -=================================================================== ---- linux-2.4.21.orig/drivers/block/cpqarray.c 2005-06-01 22:51:54.000000000 -0400 -+++ linux-2.4.21/drivers/block/cpqarray.c 2005-06-01 23:07:51.183565328 -0400 -@@ -1003,9 +1003,14 @@ - } else { - if (seg == SG_MAX) - BUG(); + for (i = 0; i < SCpnt->use_sg; i++) { +#if SMALL_SCATTERLIST -+ tmp_sg[seg].u.page.page = bh->b_page; -+ tmp_sg[seg].u.page.offset = bh_offset(bh); ++ any2scsi (sgb[i].ptr, (int) sg[i].u.address); +#else - tmp_sg[seg].page = bh->b_page; -- tmp_sg[seg].length = bh->b_size; - tmp_sg[seg].offset = bh_offset(bh); + any2scsi (sgb[i].ptr, (int) sg[i].address); +#endif -+ tmp_sg[seg].length = bh->b_size; - lastdataend = bh_phys(bh) + bh->b_size; - seg++; - } -@@ -1014,11 +1019,21 @@ - /* Now do all the DMA Mappings */ - for( i=0; i < seg; i++) { - c->req.sg[i].size = tmp_sg[i].length; + any2scsi (sgb[i].len, sg[i].length); + } + } +diff -X dontdiff -urp kern_oldest/drivers/usb/hpusbscsi.c kern_fix/drivers/usb/hpusbscsi.c +--- kern_oldest/drivers/usb/hpusbscsi.c 2006-05-01 11:55:42.000000000 -0700 ++++ kern_fix/drivers/usb/hpusbscsi.c 2006-05-01 14:14:13.000000000 -0700 +@@ -576,6 +576,17 @@ static void scatter_gather_callback(stru + hpusbscsi->state = HP_STATE_WORKING; + PDEBUG(2, "state= %s", states[hpusbscsi->state]); + +#if SMALL_SCATTERLIST -+ c->req.sg[i].addr = (__u32) pci_map_page( -+ h->pci_dev, -+ tmp_sg[i].u.page.page, tmp_sg[i].u.page.offset, -+ tmp_sg[i].length, -+ (creq->cmd == READ) ? -+ PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE); ++ FILL_BULK_URB( ++ u, ++ hpusbscsi->dev, ++ hpusbscsi->current_data_pipe, ++ sg[hpusbscsi->fragment].u.address, ++ sg[hpusbscsi->fragment++].length, ++ callback, ++ hpusbscsi ++ ); +#else - c->req.sg[i].addr = (__u32) pci_map_page( -- h->pci_dev, tmp_sg[i].page, tmp_sg[i].offset, -+ h->pci_dev, -+ tmp_sg[i].page, tmp_sg[i].offset, - tmp_sg[i].length, - (creq->cmd == READ) ? - PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE); + FILL_BULK_URB( + u, + hpusbscsi->dev, +@@ -585,6 +596,7 @@ static void scatter_gather_callback(stru + callback, + hpusbscsi + ); +#endif - } - DBGPX( printk("Submitting %d sectors in %d segments\n", sect, seg); ); - c->req.hdr.sg_cnt = seg; -Index: linux-2.4.21/drivers/block/cciss.c -=================================================================== ---- linux-2.4.21.orig/drivers/block/cciss.c 2005-06-01 22:51:54.000000000 -0400 -+++ linux-2.4.21/drivers/block/cciss.c 2005-06-01 23:07:51.185565024 -0400 -@@ -2491,9 +2491,14 @@ - } else { - if (seg == MAXSGENTRIES) - BUG(); + + res = usb_submit_urb(u); + if (res) +diff -X dontdiff -urp kern_oldest/drivers/usb/microtek.c kern_fix/drivers/usb/microtek.c +--- kern_oldest/drivers/usb/microtek.c 2006-05-01 11:55:42.000000000 -0700 ++++ kern_fix/drivers/usb/microtek.c 2006-05-01 14:14:13.000000000 -0700 +@@ -623,7 +623,11 @@ static void mts_do_sg (struct urb* trans + context->fragment++; + mts_int_submit_urb(transfer, + context->data_pipe, +#if SMALL_SCATTERLIST -+ tmp_sg[seg].u.page.page = bh->b_page; -+ tmp_sg[seg].u.page.offset = bh_offset(bh); ++ sg[context->fragment].u.address, +#else - tmp_sg[seg].page = bh->b_page; -- tmp_sg[seg].length = bh->b_size; - tmp_sg[seg].offset = bh_offset(bh); + sg[context->fragment].address, +#endif -+ tmp_sg[seg].length = bh->b_size; - lastdataend = bh_phys(bh) + bh->b_size; - seg++; - } -@@ -2507,8 +2512,16 @@ - ddir = PCI_DMA_TODEVICE; - for (i=0; iSG[i].Len = tmp_sg[i].length; -- temp64.val = pci_map_page(h->pdev, tmp_sg[i].page, -- tmp_sg[i].offset, tmp_sg[i].length, ddir); + sg[context->fragment].length, + context->fragment + 1 == context->srb->use_sg ? mts_data_done : mts_do_sg); + return; +@@ -667,7 +671,11 @@ mts_build_transfer_context( Scsi_Cmnd *s + } else { + MTS_DEBUG("Using scatter/gather\n"); + sg = srb->buffer; +#if SMALL_SCATTERLIST -+ temp64.val = pci_map_page(h->pdev, -+ tmp_sg[i].u.page.page, -+ tmp_sg[i].u.page.offset, -+ tmp_sg[i].length, ddir); ++ desc->context.data = sg[0].u.address; +#else -+ temp64.val = pci_map_page(h->pdev, -+ tmp_sg[i].page, tmp_sg[i].offset, -+ tmp_sg[i].length, ddir); + desc->context.data = sg[0].address; +#endif - c->SG[i].Addr.lower = temp64.val32.lower; - c->SG[i].Addr.upper = temp64.val32.upper; - c->SG[i].Ext = 0; /* we are not chaining */ -Index: linux-2.4.21/drivers/block/sx8.c -=================================================================== ---- linux-2.4.21.orig/drivers/block/sx8.c 2005-06-01 22:51:58.000000000 -0400 -+++ linux-2.4.21/drivers/block/sx8.c 2005-06-01 23:07:51.186564872 -0400 -@@ -1103,9 +1103,15 @@ - } else { - if (unlikely(n_elem == CARM_MAX_REQ_SG)) - BUG(); + desc->context.data_length = sg[0].length; + } + +diff -X dontdiff -urp kern_oldest/drivers/usb/storage/datafab.c kern_fix/drivers/usb/storage/datafab.c +--- kern_oldest/drivers/usb/storage/datafab.c 2006-05-01 11:55:42.000000000 -0700 ++++ kern_fix/drivers/usb/storage/datafab.c 2006-05-01 14:14:13.000000000 -0700 +@@ -265,18 +265,30 @@ static int datafab_read_data(struct us_d + while (sg_idx < use_sg && transferred < len) { + if (len - transferred >= sg[sg_idx].length - current_sg_offset) { + US_DEBUGP("datafab_read_data: adding %d bytes to %d byte sg buffer\n", sg[sg_idx].length - current_sg_offset, sg[sg_idx].length); +#if SMALL_SCATTERLIST -+ sg[n_elem].u.page.page = bh->b_page; -+ sg[n_elem].length = bh->b_size; -+ sg[n_elem].u.page.offset = bh_offset(bh); ++ memcpy(sg[sg_idx].u.address + current_sg_offset, ++ buffer + transferred, ++ sg[sg_idx].length - current_sg_offset); +#else - sg[n_elem].page = bh->b_page; - sg[n_elem].length = bh->b_size; - sg[n_elem].offset = bh_offset(bh); -+#endif /* !SMALL_SCATTERLIST */ - last_phys = bh_phys(bh) + bh->b_size; - n_elem++; - } -Index: linux-2.4.21/drivers/ieee1394/dma.c -=================================================================== ---- linux-2.4.21.orig/drivers/ieee1394/dma.c 2005-06-01 22:52:05.000000000 -0400 -+++ linux-2.4.21/drivers/ieee1394/dma.c 2005-06-01 23:07:51.187564720 -0400 -@@ -97,8 +97,12 @@ - /* fill scatter/gather list with pages */ - for(i = 0; i < dma->n_pages; i++) { - unsigned long va = (unsigned long) dma->kvirt + i * PAGE_SIZE; -- -+ + memcpy(sg[sg_idx].address + current_sg_offset, + buffer + transferred, + sg[sg_idx].length - current_sg_offset); ++#endif + transferred += sg[sg_idx].length - current_sg_offset; + current_sg_offset = 0; + // on to the next sg buffer + ++sg_idx; + } else { + US_DEBUGP("datafab_read_data: adding %d bytes to %d byte sg buffer\n", len - transferred, sg[sg_idx].length); +#if SMALL_SCATTERLIST -+ dma->sglist[i].u.page.page = vmalloc_to_page((void *)va); ++ memcpy(sg[sg_idx].u.address + current_sg_offset, ++ buffer + transferred, ++ len - transferred); +#else - dma->sglist[i].page = vmalloc_to_page((void *)va); + memcpy(sg[sg_idx].address + current_sg_offset, + buffer + transferred, + len - transferred); +#endif - dma->sglist[i].length = PAGE_SIZE; - } - -Index: linux-2.4.21/drivers/ieee1394/sbp2.c -=================================================================== ---- linux-2.4.21.orig/drivers/ieee1394/sbp2.c 2003-06-13 10:51:34.000000000 -0400 -+++ linux-2.4.21/drivers/ieee1394/sbp2.c 2005-06-01 23:07:51.189564416 -0400 -@@ -2036,11 +2036,19 @@ - command->dma_dir = dma_dir; - command->dma_size = sgpnt[0].length; - command->dma_type = CMD_DMA_PAGE; + current_sg_offset += len - transferred; + // this sg buffer is only partially full and we're out of data to copy in + break; +@@ -355,18 +367,30 @@ static int datafab_write_data(struct us_ + while (transferred < len) { + if (len - transferred >= sg[sg_idx].length - current_sg_offset) { + US_DEBUGP("datafab_write_data: getting %d bytes from %d byte sg buffer\n", sg[sg_idx].length - current_sg_offset, sg[sg_idx].length); +#if SMALL_SCATTERLIST -+ command->cmd_dma = pci_map_page(hi->host->pdev, -+ sgpnt[0].u.page.page, -+ sgpnt[0].u.page.offset, -+ command->dma_size, -+ command->dma_dir); ++ memcpy(ptr + transferred, ++ sg[sg_idx].u.address + current_sg_offset, ++ sg[sg_idx].length - current_sg_offset); +#else - command->cmd_dma = pci_map_page(hi->host->pdev, - sgpnt[0].page, - sgpnt[0].offset, - command->dma_size, - command->dma_dir); + memcpy(ptr + transferred, + sg[sg_idx].address + current_sg_offset, + sg[sg_idx].length - current_sg_offset); +#endif - SBP2_DMA_ALLOC("single page scatter element"); - - command_orb->data_descriptor_hi = ORB_SET_NODE_ID(hi->host->node_id); -Index: linux-2.4.21/drivers/message/i2o/i2o_scsi.c -=================================================================== ---- linux-2.4.21.orig/drivers/message/i2o/i2o_scsi.c 2002-08-02 20:39:44.000000000 -0400 -+++ linux-2.4.21/drivers/message/i2o/i2o_scsi.c 2005-06-01 23:07:51.190564264 -0400 -@@ -693,7 +693,11 @@ - { - *mptr++=direction|0x10000000|sg->length; - len+=sg->length; + transferred += sg[sg_idx].length - current_sg_offset; + current_sg_offset = 0; + // on to the next sg buffer + ++sg_idx; + } else { + US_DEBUGP("datafab_write_data: getting %d bytes from %d byte sg buffer\n", len - transferred, sg[sg_idx].length); +#if SMALL_SCATTERLIST -+ *mptr++=virt_to_bus(sg->u.address); ++ memcpy(ptr + transferred, ++ sg[sg_idx].u.address + current_sg_offset, ++ len - transferred); +#else - *mptr++=virt_to_bus(sg->address); + memcpy(ptr + transferred, + sg[sg_idx].address + current_sg_offset, + len - transferred); +#endif - sg++; - } - mptr[-2]=direction|0xD0000000|(sg-1)->length; -@@ -704,7 +708,11 @@ - { - i2o_raw_writel(direction|0x10000000|sg->length, mptr++); - len+=sg->length; + current_sg_offset += len - transferred; + // we only copied part of this sg buffer + break; +diff -X dontdiff -urp kern_oldest/drivers/usb/storage/freecom.c kern_fix/drivers/usb/storage/freecom.c +--- kern_oldest/drivers/usb/storage/freecom.c 2006-05-01 11:55:42.000000000 -0700 ++++ kern_fix/drivers/usb/storage/freecom.c 2006-05-01 14:14:13.000000000 -0700 +@@ -144,11 +144,20 @@ static void us_transfer_freecom(Scsi_Cmn + if (transfer_amount - total_transferred >= + sg[i].length) { + result = usb_stor_transfer_partial(us, +- sg[i].address, sg[i].length); +#if SMALL_SCATTERLIST -+ i2o_raw_writel(virt_to_bus(sg->u.address), mptr++); ++ sg[i].u.address, +#else - i2o_raw_writel(virt_to_bus(sg->address), mptr++); ++ sg[i].address, +#endif - sg++; - } - -Index: linux-2.4.21/drivers/net/fc/iph5526.c -=================================================================== ---- linux-2.4.21.orig/drivers/net/fc/iph5526.c 2003-06-13 10:51:34.000000000 -0400 -+++ linux-2.4.21/drivers/net/fc/iph5526.c 2005-06-01 23:07:51.193563808 -0400 -@@ -4249,7 +4249,11 @@ - if (Cmnd->use_sg) { - int count = 0, j; - for(i = 0; i < no_of_sg; i++) { ++ sg[i].length); + total_transferred += sg[i].length; + } else { + result = usb_stor_transfer_partial(us, +#if SMALL_SCATTERLIST -+ char *addr_ptr = sl2->u.address; ++ sg[i].u.address, +#else - char *addr_ptr = sl2->address; + sg[i].address, +#endif - count = sl2->length / SEST_BUFFER_SIZE; - if (sl2->length % SEST_BUFFER_SIZE) - count++; -@@ -4349,7 +4353,11 @@ - int count = 0, j; - count = sl1->length / SEST_BUFFER_SIZE; - for (j = 0; j < count; j++) { + transfer_amount - total_transferred); + total_transferred += transfer_amount - total_transferred; + } +diff -X dontdiff -urp kern_oldest/drivers/usb/storage/isd200.c kern_fix/drivers/usb/storage/isd200.c +--- kern_oldest/drivers/usb/storage/isd200.c 2006-05-01 11:55:42.000000000 -0700 ++++ kern_fix/drivers/usb/storage/isd200.c 2006-05-01 14:14:13.000000000 -0700 +@@ -494,13 +494,21 @@ static void isd200_transfer( struct us_d + sg[i].length) { + result = isd200_transfer_partial(us, + srb->sc_data_direction, +#if SMALL_SCATTERLIST -+ build_EDB(fi, (char *)sl1->u.address, 0, SEST_BUFFER_SIZE); ++ sg[i].u.address, +#else - build_EDB(fi, (char *)sl1->address, 0, SEST_BUFFER_SIZE); + sg[i].address, +#endif - memcpy(fi->q.ptr_edb[fi->q.edb_buffer_indx], &(fi->g.edb), sizeof(EDB)); - /* Mark this EDB as being in use */ - fi->q.free_edb_list[fi->q.edb_buffer_indx] = EDB_BUSY; -@@ -4358,13 +4366,21 @@ - * safe. - */ - update_EDB_indx(fi); + sg[i].length); + total_transferred += sg[i].length; + } else + result = isd200_transfer_partial(us, + srb->sc_data_direction, +#if SMALL_SCATTERLIST -+ sl1->u.address += SEST_BUFFER_SIZE; ++ sg[i].u.address, +#else - sl1->address += SEST_BUFFER_SIZE; + sg[i].address, +#endif - } - /* Just in case itz not a multiple of - * SEST_BUFFER_SIZE bytes. - */ - if (sl1->length % SEST_BUFFER_SIZE) { + transfer_amount - total_transferred); + + /* if we get an error, end the loop here */ +@@ -1396,10 +1404,18 @@ void isd200_data_copy(Scsi_Cmnd *srb, ch + /* transfer the lesser of the next buffer or the + * remaining data */ + if (len - total >= sg[i].length) { +#if SMALL_SCATTERLIST -+ build_EDB(fi, (char *)sl1->u.address, 0, sl1->length % SEST_BUFFER_SIZE); ++ memcpy(sg[i].u.address, src + total, sg[i].length); +#else - build_EDB(fi, (char *)sl1->address, 0, sl1->length % SEST_BUFFER_SIZE); + memcpy(sg[i].address, src + total, sg[i].length); +#endif - memcpy(fi->q.ptr_edb[fi->q.edb_buffer_indx], &(fi->g.edb), sizeof(EDB)); - fi->q.free_edb_list[fi->q.edb_buffer_indx] = EDB_BUSY; - update_EDB_indx(fi); -Index: linux-2.4.21/drivers/net/wireless/airo.c -=================================================================== ---- linux-2.4.21.orig/drivers/net/wireless/airo.c 2005-06-01 22:51:55.000000000 -0400 -+++ linux-2.4.21/drivers/net/wireless/airo.c 2005-06-01 23:07:51.198563048 -0400 -@@ -1584,11 +1584,20 @@ - aes_counter[12] = (u8)(counter >> 24); - counter++; - memcpy (plain, aes_counter, 16); + total += sg[i].length; + } else { +#if SMALL_SCATTERLIST -+ sg[0].u.page.page = virt_to_page(plain); -+ sg[0].u.page.offset = ((long) plain & ~PAGE_MASK); ++ memcpy(sg[i].u.address, src + total, len - total); +#else - sg[0].page = virt_to_page(plain); - sg[0].offset = ((long) plain & ~PAGE_MASK); + memcpy(sg[i].address, src + total, len - total); +#endif - sg[0].length = 16; - crypto_cipher_encrypt(tfm, sg, sg, 16); + total = len; + } + } +diff -X dontdiff -urp kern_oldest/drivers/usb/storage/jumpshot.c kern_fix/drivers/usb/storage/jumpshot.c +--- kern_oldest/drivers/usb/storage/jumpshot.c 2006-05-01 11:55:42.000000000 -0700 ++++ kern_fix/drivers/usb/storage/jumpshot.c 2006-05-01 14:14:13.000000000 -0700 +@@ -341,18 +341,30 @@ static int jumpshot_read_data(struct us_ + while (sg_idx < use_sg && transferred < len) { + if (len - transferred >= sg[sg_idx].length - current_sg_offset) { + US_DEBUGP("jumpshot_read_data: adding %d bytes to %d byte sg buffer\n", sg[sg_idx].length - current_sg_offset, sg[sg_idx].length); +#if SMALL_SCATTERLIST -+ cipher = kmap(sg[0].u.page.page) + sg[0].u.page.offset; ++ memcpy(sg[sg_idx].u.address + current_sg_offset, ++ buffer + transferred, ++ sg[sg_idx].length - current_sg_offset); +#else - cipher = kmap(sg[0].page) + sg[0].offset; + memcpy(sg[sg_idx].address + current_sg_offset, + buffer + transferred, + sg[sg_idx].length - current_sg_offset); +#endif - for (j=0; (j<16) && (i< (sizeof(context->coeff)/sizeof(context->coeff[0]))); ) { - context->coeff[i++] = ntohl(*(u32 *)&cipher[j]); - j += 4; -Index: linux-2.4.21/drivers/usb/microtek.c -=================================================================== ---- linux-2.4.21.orig/drivers/usb/microtek.c 2002-11-28 18:53:14.000000000 -0500 -+++ linux-2.4.21/drivers/usb/microtek.c 2005-06-01 23:07:51.199562896 -0400 -@@ -623,7 +623,11 @@ - context->fragment++; - mts_int_submit_urb(transfer, - context->data_pipe, + transferred += sg[sg_idx].length - current_sg_offset; + current_sg_offset = 0; + // on to the next sg buffer + ++sg_idx; + } else { + US_DEBUGP("jumpshot_read_data: adding %d bytes to %d byte sg buffer\n", len - transferred, sg[sg_idx].length); +#if SMALL_SCATTERLIST -+ sg[context->fragment].u.address, ++ memcpy(sg[sg_idx].u.address + current_sg_offset, ++ buffer + transferred, ++ len - transferred); +#else - sg[context->fragment].address, + memcpy(sg[sg_idx].address + current_sg_offset, + buffer + transferred, + len - transferred); +#endif - sg[context->fragment].length, - context->fragment + 1 == context->srb->use_sg ? mts_data_done : mts_do_sg); - return; -@@ -667,7 +671,11 @@ - } else { - MTS_DEBUG("Using scatter/gather\n"); - sg = srb->buffer; + current_sg_offset += len - transferred; + // this sg buffer is only partially full and we're out of data to copy in + break; +@@ -422,18 +434,31 @@ static int jumpshot_write_data(struct us + while (transferred < len) { + if (len - transferred >= sg[sg_idx].length - current_sg_offset) { + US_DEBUGP("jumpshot_write_data: getting %d bytes from %d byte sg buffer\n", sg[sg_idx].length - current_sg_offset, sg[sg_idx].length); +#if SMALL_SCATTERLIST -+ desc->context.data = sg[0].u.address; ++ memcpy(ptr + transferred, ++ sg[sg_idx].u.address + current_sg_offset, ++ sg[sg_idx].length - current_sg_offset); +#else - desc->context.data = sg[0].address; + memcpy(ptr + transferred, + sg[sg_idx].address + current_sg_offset, + sg[sg_idx].length - current_sg_offset); ++ +#endif - desc->context.data_length = sg[0].length; - } - -Index: linux-2.4.21/drivers/usb/hpusbscsi.c -=================================================================== ---- linux-2.4.21.orig/drivers/usb/hpusbscsi.c 2003-06-13 10:51:36.000000000 -0400 -+++ linux-2.4.21/drivers/usb/hpusbscsi.c 2005-06-01 23:07:51.199562896 -0400 -@@ -576,6 +576,17 @@ - hpusbscsi->state = HP_STATE_WORKING; - PDEBUG(2, "state= %s", states[hpusbscsi->state]); - + transferred += sg[sg_idx].length - current_sg_offset; + current_sg_offset = 0; + // on to the next sg buffer + ++sg_idx; + } else { + US_DEBUGP("jumpshot_write_data: getting %d bytes from %d byte sg buffer\n", len - transferred, sg[sg_idx].length); +#if SMALL_SCATTERLIST -+ FILL_BULK_URB( -+ u, -+ hpusbscsi->dev, -+ hpusbscsi->current_data_pipe, -+ sg[hpusbscsi->fragment].u.address, -+ sg[hpusbscsi->fragment++].length, -+ callback, -+ hpusbscsi -+ ); ++ memcpy(ptr + transferred, ++ sg[sg_idx].u.address + current_sg_offset, ++ len - transferred); +#else - FILL_BULK_URB( - u, - hpusbscsi->dev, -@@ -585,6 +596,7 @@ - callback, - hpusbscsi - ); + memcpy(ptr + transferred, + sg[sg_idx].address + current_sg_offset, + len - transferred); +#endif - - res = usb_submit_urb(u); - if (res) -Index: linux-2.4.21/drivers/usb/storage/protocol.c -=================================================================== ---- linux-2.4.21.orig/drivers/usb/storage/protocol.c 2002-08-02 20:39:45.000000000 -0400 -+++ linux-2.4.21/drivers/usb/storage/protocol.c 2005-06-01 23:07:51.200562744 -0400 -@@ -72,7 +72,11 @@ + current_sg_offset += len - transferred; + // we only copied part of this sg buffer + break; +diff -X dontdiff -urp kern_oldest/drivers/usb/storage/protocol.c kern_fix/drivers/usb/storage/protocol.c +--- kern_oldest/drivers/usb/storage/protocol.c 2006-05-01 11:55:42.000000000 -0700 ++++ kern_fix/drivers/usb/storage/protocol.c 2006-05-01 14:14:13.000000000 -0700 +@@ -72,7 +72,11 @@ void fix_inquiry_data(Scsi_Cmnd *srb) struct scatterlist *sg; sg = (struct scatterlist *) srb->request_buffer; @@ -3559,109 +3818,85 @@ Index: linux-2.4.21/drivers/usb/storage/protocol.c } else data_ptr = (unsigned char *)srb->request_buffer; -Index: linux-2.4.21/drivers/usb/storage/transport.c -=================================================================== ---- linux-2.4.21.orig/drivers/usb/storage/transport.c 2005-06-01 22:51:52.000000000 -0400 -+++ linux-2.4.21/drivers/usb/storage/transport.c 2005-06-01 23:07:51.201562592 -0400 -@@ -592,11 +592,20 @@ - if (transfer_amount - total_transferred >= - sg[i].length) { - result = usb_stor_transfer_partial(us, -- sg[i].address, sg[i].length); -+#if SMALL_SCATTERLIST -+ sg[i].u.address, -+#else -+ sg[i].address, -+#endif -+ sg[i].length); - total_transferred += sg[i].length; - } else - result = usb_stor_transfer_partial(us, -+#if SMALL_SCATTERLIST -+ sg[i].u.address, -+#else - sg[i].address, -+#endif - transfer_amount - total_transferred); +diff -X dontdiff -urp kern_oldest/drivers/usb/storage/scsiglue.c kern_fix/drivers/usb/storage/scsiglue.c +--- kern_oldest/drivers/usb/storage/scsiglue.c 2006-05-01 11:55:42.000000000 -0700 ++++ kern_fix/drivers/usb/storage/scsiglue.c 2006-05-01 14:14:13.000000000 -0700 +@@ -606,7 +606,11 @@ int usb_stor_scsiSense10to6( Scsi_Cmnd* + } - /* if we get an error, end the loop here */ -Index: linux-2.4.21/drivers/usb/storage/usb.c -=================================================================== ---- linux-2.4.21.orig/drivers/usb/storage/usb.c 2005-06-01 22:51:52.000000000 -0400 -+++ linux-2.4.21/drivers/usb/storage/usb.c 2005-06-01 23:07:51.202562440 -0400 -@@ -291,13 +291,21 @@ - if (us->srb->use_sg) { - sg = (struct scatterlist *)us->srb->request_buffer; - for (i=0; isrb->use_sg; i++) + /* copy one byte */ +#if SMALL_SCATTERLIST -+ memset(sg[i].u.address, 0, sg[i].length); ++ sg[db].u.address[di] = sg[sb].u.address[si]; +#else - memset(sg[i].address, 0, sg[i].length); + sg[db].address[di] = sg[sb].address[si]; +#endif - for (i=0, transferred=0; - isrb->use_sg && transferred < len; - i++) { - amt = sg[i].length > len-transferred ? - len-transferred : sg[i].length; + + /* get next destination */ + if ( sg[db].length-1 == di ) +@@ -644,7 +648,11 @@ int usb_stor_scsiSense10to6( Scsi_Cmnd* + break; + } + +#if SMALL_SCATTERLIST -+ memcpy(sg[i].u.address, data+transferred, amt); ++ sg[db].u.address[di] = 0; +#else - memcpy(sg[i].address, data+transferred, amt); + sg[db].address[di] = 0; +#endif - transferred -= amt; - } - } else { -Index: linux-2.4.21/drivers/usb/storage/shuttle_usbat.c -=================================================================== ---- linux-2.4.21.orig/drivers/usb/storage/shuttle_usbat.c 2003-06-13 10:51:37.000000000 -0400 -+++ linux-2.4.21/drivers/usb/storage/shuttle_usbat.c 2005-06-01 23:07:51.202562440 -0400 -@@ -217,7 +217,11 @@ - sg = (struct scatterlist *)data; - for (i=0; i sg[i].length ? - sg[i].length : len-transferred); - if (result!=US_BULK_TRANSFER_GOOD) -@@ -742,17 +746,29 @@ - while (amount= - sg[sg_segment].length-sg_offset) { + + /* get next destination */ + if ( di == 0 ) +@@ -831,7 +843,11 @@ int usb_stor_scsiSense6to10( Scsi_Cmnd* + break; + } + +#if SMALL_SCATTERLIST -+ memcpy(sg[sg_segment].u.address + sg_offset, -+ buffer + amount, -+ sg[sg_segment].length - sg_offset); ++ sg[db].u.address[di] = tempBuffer[element-USB_STOR_SCSI_SENSE_HDRSZ]; +#else - memcpy(sg[sg_segment].address + sg_offset, - buffer + amount, - sg[sg_segment].length - sg_offset); -+#endif - amount += - sg[sg_segment].length-sg_offset; - sg_segment++; - sg_offset=0; - } else { + sg[db].address[di] = tempBuffer[element-USB_STOR_SCSI_SENSE_HDRSZ]; ++#endif + + /* get next destination */ + if ( di == 0 ) +@@ -881,6 +897,15 @@ void usb_stor_scsiSenseParseBuffer( Scsi + if ( element < USB_STOR_SCSI_SENSE_HDRSZ ) + { + /* fill in the pointers for both header types */ +#if SMALL_SCATTERLIST -+ memcpy(sg[sg_segment].u.address + sg_offset, -+ buffer + amount, -+ len - amount); ++ the6->array[element] = &(sg[i].u.address[j]); ++ the10->array[element] = &(sg[i].u.address[j]); ++ } ++ else if ( element < USB_STOR_SCSI_SENSE_10_HDRSZ ) ++ { ++ /* only the longer headers still cares now */ ++ the10->array[element] = &(sg[i].u.address[j]); +#else - memcpy(sg[sg_segment].address + sg_offset, - buffer + amount, - len - amount); + the6->array[element] = &(sg[i].address[j]); + the10->array[element] = &(sg[i].address[j]); + } +@@ -888,6 +913,7 @@ void usb_stor_scsiSenseParseBuffer( Scsi + { + /* only the longer headers still cares now */ + the10->array[element] = &(sg[i].address[j]); +#endif - sg_offset += (len - amount); - amount = len; - } -Index: linux-2.4.21/drivers/usb/storage/sddr09.c -=================================================================== ---- linux-2.4.21.orig/drivers/usb/storage/sddr09.c 2003-06-13 10:51:37.000000000 -0400 -+++ linux-2.4.21/drivers/usb/storage/sddr09.c 2005-06-01 23:07:51.204562136 -0400 -@@ -387,7 +387,11 @@ + } + /* increase element counter */ + element++; +diff -X dontdiff -urp kern_oldest/drivers/usb/storage/sddr09.c kern_fix/drivers/usb/storage/sddr09.c +--- kern_oldest/drivers/usb/storage/sddr09.c 2006-05-01 11:55:42.000000000 -0700 ++++ kern_fix/drivers/usb/storage/sddr09.c 2006-05-01 14:14:13.000000000 -0700 +@@ -387,7 +387,11 @@ sddr09_bulk_transport(struct us_data *us unsigned char *buf; unsigned int length; @@ -3673,7 +3908,7 @@ Index: linux-2.4.21/drivers/usb/storage/sddr09.c length = len-transferred; if (length > sg[i].length) length = sg[i].length; -@@ -903,7 +907,11 @@ +@@ -903,7 +907,11 @@ sddr09_read_data(struct us_data *us, int transferred = 0; for (i=0; ilba_to_pba = NULL; info->pba_to_lba = NULL; for (i=0; ilba_to_pba[i] = info->pba_to_lba[i] = UNDEF; @@ -3784,7 +4019,7 @@ Index: linux-2.4.21/drivers/usb/storage/sddr09.c /* * Define lba-pba translation table -@@ -1374,7 +1420,11 @@ +@@ -1374,7 +1420,11 @@ sddr09_read_map(struct us_data *us) { printk("sddr09: no translation today\n"); #else for (i=0; ipba_to_lba[i] = UNUSABLE; -@@ -1477,7 +1527,11 @@ +@@ -1477,7 +1527,11 @@ sddr09_read_map(struct us_data *us) { US_DEBUGP("Found %d LBA's\n", lbact); for (i=0; i= - sg[i].length) { - result = usb_stor_transfer_partial(us, -- sg[i].address, sg[i].length); -+#if SMALL_SCATTERLIST -+ sg[i].u.address, -+#else -+ sg[i].address, -+#endif -+ sg[i].length); - total_transferred += sg[i].length; - } else { - result = usb_stor_transfer_partial(us, -+#if SMALL_SCATTERLIST -+ sg[i].u.address, -+#else - sg[i].address, -+#endif - transfer_amount - total_transferred); - total_transferred += transfer_amount - total_transferred; - } -Index: linux-2.4.21/drivers/usb/storage/isd200.c -=================================================================== ---- linux-2.4.21.orig/drivers/usb/storage/isd200.c 2003-06-13 10:51:37.000000000 -0400 -+++ linux-2.4.21/drivers/usb/storage/isd200.c 2005-06-01 23:07:51.206561832 -0400 -@@ -494,13 +494,21 @@ - sg[i].length) { - result = isd200_transfer_partial(us, - srb->sc_data_direction, -+#if SMALL_SCATTERLIST -+ sg[i].u.address, -+#else - sg[i].address, -+#endif - sg[i].length); - total_transferred += sg[i].length; - } else - result = isd200_transfer_partial(us, - srb->sc_data_direction, -+#if SMALL_SCATTERLIST -+ sg[i].u.address, -+#else - sg[i].address, -+#endif - transfer_amount - total_transferred); - - /* if we get an error, end the loop here */ -@@ -1396,10 +1404,18 @@ - /* transfer the lesser of the next buffer or the - * remaining data */ - if (len - total >= sg[i].length) { -+#if SMALL_SCATTERLIST -+ memcpy(sg[i].u.address, src + total, sg[i].length); -+#else - memcpy(sg[i].address, src + total, sg[i].length); -+#endif - total += sg[i].length; - } else { -+#if SMALL_SCATTERLIST -+ memcpy(sg[i].u.address, src + total, len - total); -+#else - memcpy(sg[i].address, src + total, len - total); -+#endif - total = len; - } - } -Index: linux-2.4.21/drivers/usb/storage/datafab.c -=================================================================== ---- linux-2.4.21.orig/drivers/usb/storage/datafab.c 2003-06-13 10:51:37.000000000 -0400 -+++ linux-2.4.21/drivers/usb/storage/datafab.c 2005-06-01 23:07:51.207561680 -0400 -@@ -265,18 +265,30 @@ - while (sg_idx < use_sg && transferred < len) { - if (len - transferred >= sg[sg_idx].length - current_sg_offset) { - US_DEBUGP("datafab_read_data: adding %d bytes to %d byte sg buffer\n", sg[sg_idx].length - current_sg_offset, sg[sg_idx].length); -+#if SMALL_SCATTERLIST -+ memcpy(sg[sg_idx].u.address + current_sg_offset, -+ buffer + transferred, -+ sg[sg_idx].length - current_sg_offset); -+#else - memcpy(sg[sg_idx].address + current_sg_offset, - buffer + transferred, - sg[sg_idx].length - current_sg_offset); -+#endif - transferred += sg[sg_idx].length - current_sg_offset; - current_sg_offset = 0; - // on to the next sg buffer - ++sg_idx; - } else { - US_DEBUGP("datafab_read_data: adding %d bytes to %d byte sg buffer\n", len - transferred, sg[sg_idx].length); +diff -X dontdiff -urp kern_oldest/drivers/usb/storage/shuttle_usbat.c kern_fix/drivers/usb/storage/shuttle_usbat.c +--- kern_oldest/drivers/usb/storage/shuttle_usbat.c 2006-05-01 11:55:42.000000000 -0700 ++++ kern_fix/drivers/usb/storage/shuttle_usbat.c 2006-05-01 14:14:13.000000000 -0700 +@@ -217,7 +217,11 @@ static int usbat_bulk_transport(struct u + sg = (struct scatterlist *)data; + for (i=0; i= sg[sg_idx].length - current_sg_offset) { - US_DEBUGP("datafab_write_data: getting %d bytes from %d byte sg buffer\n", sg[sg_idx].length - current_sg_offset, sg[sg_idx].length); + len-transferred > sg[i].length ? + sg[i].length : len-transferred); + if (result!=US_BULK_TRANSFER_GOOD) +@@ -742,17 +746,29 @@ int usbat_handle_read10(struct us_data * + while (amount= + sg[sg_segment].length-sg_offset) { +#if SMALL_SCATTERLIST -+ memcpy(ptr + transferred, -+ sg[sg_idx].u.address + current_sg_offset, -+ sg[sg_idx].length - current_sg_offset); ++ memcpy(sg[sg_segment].u.address + sg_offset, ++ buffer + amount, ++ sg[sg_segment].length - sg_offset); +#else - memcpy(ptr + transferred, - sg[sg_idx].address + current_sg_offset, - sg[sg_idx].length - current_sg_offset); + memcpy(sg[sg_segment].address + sg_offset, + buffer + amount, + sg[sg_segment].length - sg_offset); +#endif - transferred += sg[sg_idx].length - current_sg_offset; - current_sg_offset = 0; - // on to the next sg buffer - ++sg_idx; + amount += + sg[sg_segment].length-sg_offset; + sg_segment++; + sg_offset=0; } else { - US_DEBUGP("datafab_write_data: getting %d bytes from %d byte sg buffer\n", len - transferred, sg[sg_idx].length); -+#if SMALL_SCATTERLIST -+ memcpy(ptr + transferred, -+ sg[sg_idx].u.address + current_sg_offset, -+ len - transferred); -+#else - memcpy(ptr + transferred, - sg[sg_idx].address + current_sg_offset, - len - transferred); -+#endif - current_sg_offset += len - transferred; - // we only copied part of this sg buffer - break; -Index: linux-2.4.21/drivers/usb/storage/jumpshot.c -=================================================================== ---- linux-2.4.21.orig/drivers/usb/storage/jumpshot.c 2003-06-13 10:51:37.000000000 -0400 -+++ linux-2.4.21/drivers/usb/storage/jumpshot.c 2005-06-01 23:07:51.208561528 -0400 -@@ -341,18 +341,30 @@ - while (sg_idx < use_sg && transferred < len) { - if (len - transferred >= sg[sg_idx].length - current_sg_offset) { - US_DEBUGP("jumpshot_read_data: adding %d bytes to %d byte sg buffer\n", sg[sg_idx].length - current_sg_offset, sg[sg_idx].length); -+#if SMALL_SCATTERLIST -+ memcpy(sg[sg_idx].u.address + current_sg_offset, -+ buffer + transferred, -+ sg[sg_idx].length - current_sg_offset); -+#else - memcpy(sg[sg_idx].address + current_sg_offset, - buffer + transferred, - sg[sg_idx].length - current_sg_offset); -+#endif - transferred += sg[sg_idx].length - current_sg_offset; - current_sg_offset = 0; - // on to the next sg buffer - ++sg_idx; - } else { - US_DEBUGP("jumpshot_read_data: adding %d bytes to %d byte sg buffer\n", len - transferred, sg[sg_idx].length); -+#if SMALL_SCATTERLIST -+ memcpy(sg[sg_idx].u.address + current_sg_offset, -+ buffer + transferred, -+ len - transferred); -+#else - memcpy(sg[sg_idx].address + current_sg_offset, - buffer + transferred, - len - transferred); -+#endif - current_sg_offset += len - transferred; - // this sg buffer is only partially full and we're out of data to copy in - break; -@@ -422,18 +434,31 @@ - while (transferred < len) { - if (len - transferred >= sg[sg_idx].length - current_sg_offset) { - US_DEBUGP("jumpshot_write_data: getting %d bytes from %d byte sg buffer\n", sg[sg_idx].length - current_sg_offset, sg[sg_idx].length); -+#if SMALL_SCATTERLIST -+ memcpy(ptr + transferred, -+ sg[sg_idx].u.address + current_sg_offset, -+ sg[sg_idx].length - current_sg_offset); -+#else - memcpy(ptr + transferred, - sg[sg_idx].address + current_sg_offset, - sg[sg_idx].length - current_sg_offset); -+ -+#endif - transferred += sg[sg_idx].length - current_sg_offset; - current_sg_offset = 0; - // on to the next sg buffer - ++sg_idx; - } else { - US_DEBUGP("jumpshot_write_data: getting %d bytes from %d byte sg buffer\n", len - transferred, sg[sg_idx].length); -+#if SMALL_SCATTERLIST -+ memcpy(ptr + transferred, -+ sg[sg_idx].u.address + current_sg_offset, -+ len - transferred); -+#else - memcpy(ptr + transferred, - sg[sg_idx].address + current_sg_offset, - len - transferred); -+#endif - current_sg_offset += len - transferred; - // we only copied part of this sg buffer - break; -Index: linux-2.4.21/drivers/usb/storage/scsiglue.c -=================================================================== ---- linux-2.4.21.orig/drivers/usb/storage/scsiglue.c 2005-06-01 22:51:52.000000000 -0400 -+++ linux-2.4.21/drivers/usb/storage/scsiglue.c 2005-06-01 23:07:51.209561376 -0400 -@@ -606,7 +606,11 @@ - } - - /* copy one byte */ -+#if SMALL_SCATTERLIST -+ sg[db].u.address[di] = sg[sb].u.address[si]; -+#else - sg[db].address[di] = sg[sb].address[si]; -+#endif - - /* get next destination */ - if ( sg[db].length-1 == di ) -@@ -644,7 +648,11 @@ - break; - } - +#if SMALL_SCATTERLIST -+ sg[db].u.address[di] = 0; ++ memcpy(sg[sg_segment].u.address + sg_offset, ++ buffer + amount, ++ len - amount); +#else - sg[db].address[di] = 0; + memcpy(sg[sg_segment].address + sg_offset, + buffer + amount, + len - amount); +#endif - - /* get next destination */ - if ( sg[db].length-1 == di ) -@@ -794,7 +802,11 @@ - } - - /* copy one byte */ + sg_offset += (len - amount); + amount = len; + } +diff -X dontdiff -urp kern_oldest/drivers/usb/storage/transport.c kern_fix/drivers/usb/storage/transport.c +--- kern_oldest/drivers/usb/storage/transport.c 2006-05-01 11:55:42.000000000 -0700 ++++ kern_fix/drivers/usb/storage/transport.c 2006-05-01 14:14:13.000000000 -0700 +@@ -592,11 +592,20 @@ void usb_stor_transfer(Scsi_Cmnd *srb, s + if (transfer_amount - total_transferred >= + sg[i].length) { + result = usb_stor_transfer_partial(us, +- sg[i].address, sg[i].length); +#if SMALL_SCATTERLIST -+ sg[db].u.address[di] = sg[sb].u.address[si]; ++ sg[i].u.address, +#else - sg[db].address[di] = sg[sb].address[si]; ++ sg[i].address, +#endif - - /* get next destination */ - if ( di == 0 ) -@@ -831,7 +843,11 @@ - break; - } - ++ sg[i].length); + total_transferred += sg[i].length; + } else + result = usb_stor_transfer_partial(us, +#if SMALL_SCATTERLIST -+ sg[db].u.address[di] = tempBuffer[element-USB_STOR_SCSI_SENSE_HDRSZ]; ++ sg[i].u.address, +#else - sg[db].address[di] = tempBuffer[element-USB_STOR_SCSI_SENSE_HDRSZ]; + sg[i].address, +#endif + transfer_amount - total_transferred); - /* get next destination */ - if ( di == 0 ) -@@ -881,6 +897,15 @@ - if ( element < USB_STOR_SCSI_SENSE_HDRSZ ) - { - /* fill in the pointers for both header types */ + /* if we get an error, end the loop here */ +diff -X dontdiff -urp kern_oldest/drivers/usb/storage/usb.c kern_fix/drivers/usb/storage/usb.c +--- kern_oldest/drivers/usb/storage/usb.c 2006-05-01 11:55:42.000000000 -0700 ++++ kern_fix/drivers/usb/storage/usb.c 2006-05-01 14:14:13.000000000 -0700 +@@ -291,13 +291,21 @@ void fill_inquiry_response(struct us_dat + if (us->srb->use_sg) { + sg = (struct scatterlist *)us->srb->request_buffer; + for (i=0; isrb->use_sg; i++) +#if SMALL_SCATTERLIST -+ the6->array[element] = &(sg[i].u.address[j]); -+ the10->array[element] = &(sg[i].u.address[j]); -+ } -+ else if ( element < USB_STOR_SCSI_SENSE_10_HDRSZ ) -+ { -+ /* only the longer headers still cares now */ -+ the10->array[element] = &(sg[i].u.address[j]); -+#else - the6->array[element] = &(sg[i].address[j]); - the10->array[element] = &(sg[i].address[j]); - } -@@ -888,6 +913,7 @@ - { - /* only the longer headers still cares now */ - the10->array[element] = &(sg[i].address[j]); -+#endif - } - /* increase element counter */ - element++; -Index: linux-2.4.21/drivers/addon/ips_70015/ips.c -=================================================================== ---- linux-2.4.21.orig/drivers/addon/ips_70015/ips.c 2005-06-01 22:51:54.000000000 -0400 -+++ linux-2.4.21/drivers/addon/ips_70015/ips.c 2005-06-01 23:07:51.214560616 -0400 -@@ -207,7 +207,11 @@ - #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0) - #include - #include "sd.h" -+#ifdef SMALL_SCATTERLIST -+#define IPS_SG_ADDRESS(sg) ((sg)->u.address) ++ memset(sg[i].u.address, 0, sg[i].length); +#else - #define IPS_SG_ADDRESS(sg) ((sg)->address) + memset(sg[i].address, 0, sg[i].length); +#endif - #define IPS_LOCK_SAVE(lock,flags) spin_lock_irqsave(&io_request_lock,flags) - #define IPS_UNLOCK_RESTORE(lock,flags) spin_unlock_irqrestore(&io_request_lock,flags) - #ifndef __devexit_p -Index: linux-2.4.21/drivers/addon/megaraid_2106/megaraid2.c -=================================================================== ---- linux-2.4.21.orig/drivers/addon/megaraid_2106/megaraid2.c 2005-06-01 22:51:54.000000000 -0400 -+++ linux-2.4.21/drivers/addon/megaraid_2106/megaraid2.c 2005-06-01 23:07:51.217560160 -0400 -@@ -2198,7 +2198,11 @@ - if( cmd->use_sg ) { - sgl = (struct scatterlist *) - cmd->request_buffer; + for (i=0, transferred=0; + isrb->use_sg && transferred < len; + i++) { + amt = sg[i].length > len-transferred ? + len-transferred : sg[i].length; +#if SMALL_SCATTERLIST -+ c = *(u8 *)sgl[0].u.address; ++ memcpy(sg[i].u.address, data+transferred, amt); +#else - c = *(u8 *)sgl[0].address; + memcpy(sg[i].address, data+transferred, amt); +#endif - } - else { - c = *(u8 *)cmd->request_buffer; -Index: linux-2.4.21/drivers/addon/iscsi_sfnet/iscsi.c -=================================================================== ---- linux-2.4.21.orig/drivers/addon/iscsi_sfnet/iscsi.c 2005-06-01 22:51:59.000000000 -0400 -+++ linux-2.4.21/drivers/addon/iscsi_sfnet/iscsi.c 2005-06-01 23:07:51.229558336 -0400 -@@ -118,6 +118,16 @@ - #include "iscsi-probe.h" - #include "iscsi-crc.h" + transferred -= amt; + } + } else { +diff -X dontdiff -urp kern_oldest/net/ipv6/addrconf.c kern_fix/net/ipv6/addrconf.c +--- kern_oldest/net/ipv6/addrconf.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/net/ipv6/addrconf.c 2006-05-01 14:14:24.000000000 -0700 +@@ -1047,11 +1047,18 @@ static int __ipv6_regen_rndid(struct ine + u8 digest[16]; + struct scatterlist sg[2]; +- sg[0].page = virt_to_page(idev->entropy); +#if SMALL_SCATTERLIST -+#define ISCSI_SG_ADDRESS(sg) (sg->u.address) -+#define ISCSI_SG_PAGE(sg) (sg->u.page.page) -+#define ISCSI_SG_OFFSET(sg) (sg->u.page.offset) ++ sg[0].u.page.page = virt_to_page(idev->entropy); ++ sg[0].u.page.offset = ((long) idev->entropy & ~PAGE_MASK); ++ sg[1].u.page.page = virt_to_page(eui64); ++ sg[1].u.page.offset = ((long) eui64 & ~PAGE_MASK); +#else -+#define ISCSI_SG_ADDRESS(sg) (sg->address) -+#define ISCSI_SG_PAGE(sg) (sg->page) -+#define ISCSI_SG_OFFSET(sg) (sg->offset) ++ sg[0].page = virt_to_page(idev->entropy); + sg[0].offset = ((long) idev->entropy & ~PAGE_MASK); +- sg[0].length = 8; + sg[1].page = virt_to_page(eui64); + sg[1].offset = ((long) eui64 & ~PAGE_MASK); +#endif -+ - /* - * IMPORTANT NOTE: to prevent deadlock, when holding multiple locks, - * the following locking order must be followed at all times: -@@ -2932,15 +2942,17 @@ - #if (HAS_SCATTERLIST_PAGE && HAS_SCATTERLIST_ADDRESS) - printk("iSCSI: sglist %p index %02d = addr %p, page %p, " - "offset %u, len %u\n", -- sglist, i, sglist->address, sglist->page, sglist->offset, -- sglist->length); -+ sglist, i, ISCSI_SG_ADDRESS(sglist), -+ ISCSI_SG_PAGE(sglist), -+ ISCSI_SG_OFFSET(sglist), sglist->length); - #elif HAS_SCATTERLIST_PAGE - printk("iSCSI: sglist %p index %02d = page %p, offset %u, " - "len %u\n", -- sglist, i, sglist->page, sglist->offset, sglist->length); -+ sglist, i, ISCSI_SG_PAGE(sglist), ISCSI_SG_OFFSET(sglist), -+ sglist->length); - #else - printk("iSCSI: sglist %p index %02d = addr %p, len %u\n", -- sglist, i, sglist->address, sglist->length); -+ sglist, i, ISCSI_SG_ADDRESS(sglist), sglist->length); - #endif - sglist++; - } -@@ -5306,7 +5318,7 @@ - bytes_from_segment = sg->length - segment_offset; - if (bytes_from_segment > bytes_to_fill) { - /* only need part of this segment */ -- iov[iovn].iov_base = sg->address + segment_offset; -+ iov[iovn].iov_base = ISCSI_SG_ADDRESS(sg) + segment_offset; - iov[iovn].iov_len = bytes_to_fill; - xfrlen += bytes_to_fill; - DEBUG_FLOW("iSCSI: session %p xmit_data xfrlen %d, " -@@ -5863,21 +5875,21 @@ - { - #if (HAS_SCATTERLIST_PAGE && HAS_SCATTERLIST_ADDRESS) - /* page may or may not be mapped */ -- if (sg->address) { -- return sg->address; -- } else if (sg->page) { -- return page_address(sg->page) + sg->offset; -+ if (ISCSI_SG_ADDRESS(sg)) { -+ return ISCSI_SG_ADDRESS(sg); -+ } else if (ISCSI_SG_PAGE(sg)) { -+ return page_address(ISCSI_SG_PAGE(sg)) + ISCSI_SG_OFFSET(sg); - } - return NULL; - - #elif HAS_SCATTERLIST_PAGE - /* should have already mapped the page */ -- if (sg->page) { -- return page_address(sg->page) + sg->offset; -+ if (ISCSI_SG_PAGE(sg)) { -+ return page_address(ISCSI_SG_PAGE(sg)) + ISCSI_SG_OFFSET(sg); - } - return NULL; - #else -- return sg->address; -+ return ISCSI_SG_ADDRESS(sg); - #endif - - } -@@ -5900,12 +5912,12 @@ - { - #if (HAS_SCATTERLIST_PAGE && HAS_SCATTERLIST_ADDRESS) - /* page may or may not be mapped if HIGHMEM is in use */ -- if (sg->address) { -- DEBUG_FLOW("iSCSI: kmap sg %p to address %p\n", sg, sg->address); -- return sg->address; -- } else if (sg->page) { -- void *addr = kmap(sg->page); -- DEBUG_FLOW("iSCSI: kmap sg %p page %p to addr %p\n", sg, sg->page, -+ if (ISCSI_SG_ADDRESS(sg)) { -+ DEBUG_FLOW("iSCSI: kmap sg %p to address %p\n", sg, ISCSI_SG_ADDRESS(sg)); -+ return ISCSI_SG_ADDRESS(sg); -+ } else if (ISCSI_SG_PAGE(sg)) { -+ void *addr = kmap(ISCSI_SG_PAGE(sg)); -+ DEBUG_FLOW("iSCSI: kmap sg %p page %p to addr %p\n", sg, ISCSI_SG_PAGE(sg), - addr); - return addr; - } -@@ -5913,15 +5925,15 @@ - - #elif HAS_SCATTERLIST_PAGE - /* there is no address, must kmap the page */ -- if (sg->page) { -- return kmap(sg->page); -+ if (ISCSI_SG_PAGE(sg)) { -+ return kmap(ISCSI_SG_PAGE(sg)); - } - return NULL; - - #else - /* just use the address */ -- DEBUG_FLOW("iSCSI: kmap sg %p to address %p\n", sg, sg->address); -- return sg->address; -+ DEBUG_FLOW("iSCSI: kmap sg %p to address %p\n", sg, ISCSI_SG_ADDRESS(sg)); -+ return ISCSI_SG_ADDRESS(sg); - #endif - } ++ sg[0].length = 8; + sg[1].length = 8; -@@ -5933,11 +5945,11 @@ - kunmap_sg(struct scatterlist *sg) - { - #if (HAS_SCATTERLIST_PAGE && HAS_SCATTERLIST_ADDRESS) -- if (!sg->address && sg->page) -- kunmap(sg->page); -+ if (!ISCSI_SG_ADDRESS(sg) && ISCSI_SG_PAGE(sg)) -+ kunmap(ISCSI_SG_PAGE(sg)); - #elif HAS_SCATTERLIST_PAGE -- if (sg->page) -- kunmap(sg->page); -+ if (ISCSI_SG_PAGE(sg)) -+ kunmap(ISCSI_SG_PAGE(sg)); - #endif - return; - } -Index: linux-2.4.21/include/asm-i386/pci.h -=================================================================== ---- linux-2.4.21.orig/include/asm-i386/pci.h 2005-06-01 22:51:45.000000000 -0400 -+++ linux-2.4.21/include/asm-i386/pci.h 2005-06-01 23:21:02.208311288 -0400 -@@ -157,6 +157,17 @@ - * temporary 2.4 hack - */ - for (i = 0; i < nents; i++ ) { -+#if SMALL_SCATTERLIST -+ if (sg[i].ispaged) { -+ if (!sg[i].u.page.page) -+ out_of_line_bug(); -+ sg[i].dma_address = page_to_bus(sg[i].u.page.page) + sg[i].u.page.offset; -+ } else { -+ if (!sg[i].u.address) -+ out_of_line_bug(); -+ sg[i].dma_address = virt_to_bus(sg[i].u.address); -+ } -+#else - if (sg[i].address && sg[i].page) - out_of_line_bug(); - else if (!sg[i].address && !sg[i].page) -@@ -166,6 +177,7 @@ - sg[i].dma_address = virt_to_bus(sg[i].address); - else - sg[i].dma_address = page_to_bus(sg[i].page) + sg[i].offset; -+#endif - } - - flush_write_buffers(); -Index: linux-2.4.21/include/asm-i386/scatterlist.h -=================================================================== ---- linux-2.4.21.orig/include/asm-i386/scatterlist.h 2002-11-28 18:53:15.000000000 -0500 -+++ linux-2.4.21/include/asm-i386/scatterlist.h 2005-06-01 23:07:51.230558184 -0400 -@@ -19,7 +19,25 @@ - * - * and that's it. There's no excuse for not highmem enabling YOUR driver. /jens - */ -+ -+/* Define SMALL_SCATTERLIST non-zero if you want to compress scatter/gather -+ descriptors to fit in 1 page. NB this file is arch-specific, so we only -+ define this where we actually need/want it */ -+#define SMALL_SCATTERLIST 1 -+ - struct scatterlist { -+#if SMALL_SCATTERLIST -+ union { -+ char *address; /* mapped address... */ -+ struct { -+ struct page *page; /* ...or page + offset... */ -+ unsigned int offset; -+ } page; -+ } u; -+ dma_addr_t dma_address; -+ unsigned int length:31; /* ...steal 1 bit from the length */ -+ unsigned int ispaged:1; /* to discriminate */ -+#else - char * address; /* Location data is to be transferred to, NULL for - * highmem page */ - struct page * page; /* Location for highmem page, if any */ -@@ -27,6 +45,7 @@ - - dma_addr_t dma_address; - unsigned int length; -+#endif - }; - - #define ISA_DMA_THRESHOLD (0x00ffffff) -Index: linux-2.4.21/net/xfrm/xfrm_algo.c -=================================================================== ---- linux-2.4.21.orig/net/xfrm/xfrm_algo.c 2005-06-01 22:51:50.000000000 -0400 -+++ linux-2.4.21/net/xfrm/xfrm_algo.c 2005-06-01 23:07:51.231558032 -0400 -@@ -487,9 +487,14 @@ + dev = idev->dev; +diff -X dontdiff -urp kern_oldest/net/xfrm/xfrm_algo.c kern_fix/net/xfrm/xfrm_algo.c +--- kern_oldest/net/xfrm/xfrm_algo.c 2006-05-01 11:55:40.000000000 -0700 ++++ kern_fix/net/xfrm/xfrm_algo.c 2006-05-01 14:14:24.000000000 -0700 +@@ -487,9 +487,14 @@ void skb_icv_walk(const struct sk_buff * if (copy > 0) { if (copy > len) copy = len; @@ -4380,7 +4216,7 @@ Index: linux-2.4.21/net/xfrm/xfrm_algo.c sg.length = copy; icv_update(tfm, &sg, 1); -@@ -511,8 +516,14 @@ +@@ -511,8 +516,14 @@ void skb_icv_walk(const struct sk_buff * if (copy > len) copy = len; @@ -4395,7 +4231,7 @@ Index: linux-2.4.21/net/xfrm/xfrm_algo.c sg.length = copy; icv_update(tfm, &sg, 1); -@@ -562,8 +573,15 @@ +@@ -562,8 +573,15 @@ skb_to_sgvec(struct sk_buff *skb, struct if (copy > 0) { if (copy > len) copy = len; @@ -4411,7 +4247,7 @@ Index: linux-2.4.21/net/xfrm/xfrm_algo.c sg[elt].length = copy; elt++; if ((len -= copy) == 0) -@@ -582,8 +600,13 @@ +@@ -582,8 +600,13 @@ skb_to_sgvec(struct sk_buff *skb, struct if (copy > len) copy = len; @@ -4425,28 +4261,74 @@ Index: linux-2.4.21/net/xfrm/xfrm_algo.c sg[elt].length = copy; elt++; if (!(len -= copy)) -Index: linux-2.4.21/net/ipv6/addrconf.c -=================================================================== ---- linux-2.4.21.orig/net/ipv6/addrconf.c 2005-06-01 22:51:50.000000000 -0400 -+++ linux-2.4.21/net/ipv6/addrconf.c 2005-06-01 23:07:51.232557880 -0400 -@@ -1047,11 +1047,18 @@ - u8 digest[16]; - struct scatterlist sg[2]; +diff -urp a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c +--- a/drivers/scsi/libata-core.c 2006-05-15 00:42:16.000000000 -0700 ++++ b/drivers/scsi/libata-core.c 2006-05-15 00:40:14.000000000 -0700 +@@ -54,6 +54,7 @@ + #include + #include + #include ++#include + + #include "libata.h" + +@@ -2424,9 +2425,15 @@ static void ata_sg_clean(struct ata_queu + sg[qc->orig_n_elem - 1].length += qc->pad_len; + if (pad_buf) { + struct scatterlist *psg = &qc->pad_sgent; ++#if SMALL_SCATTERLIST ++ void *addr = kmap_atomic(psg->u.page.page, KM_IRQ0); ++ memcpy(addr + psg->u.page.offset, pad_buf, qc->pad_len); ++ kunmap_atomic(psg->u.page.page, KM_IRQ0); ++#else + void *addr = kmap_atomic(psg->page, KM_IRQ0); + memcpy(addr + psg->offset, pad_buf, qc->pad_len); + kunmap_atomic(psg->page, KM_IRQ0); ++#endif + } + } else { + if (sg_dma_len(&sg[0]) > 0) +@@ -2693,14 +2700,26 @@ static int ata_sg_setup(struct ata_queue + * psg->page/offset are used to copy to-be-written + * data in this function or read data in ata_sg_clean. + */ ++#if SMALL_SCATTERLIST ++ offset = lsg->u.page.offset + lsg->length - qc->pad_len; ++ psg->u.page.page = nth_page(lsg->u.page.page, offset >> PAGE_SHIFT); ++ psg->u.page.offset = offset_in_page(offset); ++#else + offset = lsg->offset + lsg->length - qc->pad_len; + psg->page = nth_page(lsg->page, offset >> PAGE_SHIFT); + psg->offset = offset_in_page(offset); ++#endif -- sg[0].page = virt_to_page(idev->entropy); + if (qc->tf.flags & ATA_TFLAG_WRITE) { +#if SMALL_SCATTERLIST -+ sg[0].u.page.page = virt_to_page(idev->entropy); -+ sg[0].u.page.offset = ((long) idev->entropy & ~PAGE_MASK); -+ sg[1].u.page.page = virt_to_page(eui64); -+ sg[1].u.page.offset = ((long) eui64 & ~PAGE_MASK); ++ void *addr = kmap_atomic(psg->u.page.page, KM_IRQ0); ++ memcpy(pad_buf, addr + psg->u.page.offset, qc->pad_len); ++ kunmap_atomic(psg->u.page.page, KM_IRQ0); +#else -+ sg[0].page = virt_to_page(idev->entropy); - sg[0].offset = ((long) idev->entropy & ~PAGE_MASK); -- sg[0].length = 8; - sg[1].page = virt_to_page(eui64); - sg[1].offset = ((long) eui64 & ~PAGE_MASK); + void *addr = kmap_atomic(psg->page, KM_IRQ0); + memcpy(pad_buf, addr + psg->offset, qc->pad_len); + kunmap_atomic(psg->page, KM_IRQ0); +#endif -+ sg[0].length = 8; - sg[1].length = 8; + } + + sg_dma_address(psg) = ap->pad_dma + (qc->tag * ATA_DMA_PAD_SZ); +diff -urp a/include/linux/libata-compat.h b/include/linux/libata-compat.h +--- a/include/linux/libata-compat.h 2006-05-15 00:41:42.000000000 -0700 ++++ b/include/linux/libata-compat.h 2006-05-15 00:39:53.000000000 -0700 +@@ -198,8 +198,13 @@ pci_iomap(struct pci_dev *dev, int bar, + static inline void sg_set_buf(struct scatterlist *sg, void *buf, + unsigned int buflen) + { ++#if SMALL_SCATTERLIST ++ sg->u.page.page = virt_to_page(buf); ++ sg->u.page.offset = offset_in_page(buf); ++#else + sg->page = virt_to_page(buf); + sg->offset = offset_in_page(buf); ++#endif + sg->length = buflen; + } - dev = idev->dev; diff --git a/lustre/kernel_patches/patches/vfs_intent-2.4.21-rhel.patch b/lustre/kernel_patches/patches/vfs_intent-2.4.21-rhel.patch index 1055dee..9030e8c 100644 --- a/lustre/kernel_patches/patches/vfs_intent-2.4.21-rhel.patch +++ b/lustre/kernel_patches/patches/vfs_intent-2.4.21-rhel.patch @@ -1,22 +1,7 @@ - fs/dcache.c | 19 ++ - fs/exec.c | 17 +- - fs/namei.c | 295 +++++++++++++++++++++++++++++++++++++++------- - fs/namespace.c | 28 +++- - fs/open.c | 172 +++++++++++++++++++------- - fs/stat.c | 52 +++++--- - include/linux/dcache.h | 60 +++++++++ - include/linux/fs.h | 32 ++++ - include/linux/fs_struct.h | 4 - kernel/exit.c | 3 - kernel/fork.c | 3 - kernel/ksyms.c | 1 - 12 files changed, 558 insertions(+), 128 deletions(-) - -Index: linux-2.4.21/fs/dcache.c -=================================================================== ---- linux-2.4.21.orig/fs/dcache.c 2005-06-01 22:51:55.000000000 -0400 -+++ linux-2.4.21/fs/dcache.c 2005-06-01 22:58:09.043064136 -0400 -@@ -187,6 +187,13 @@ +diff -X dontdiff -urp kern_oldest/fs/dcache.c kern_new/fs/dcache.c +--- kern_oldest/fs/dcache.c 2006-05-01 11:55:39.000000000 -0700 ++++ kern_new/fs/dcache.c 2006-05-02 20:21:49.000000000 -0700 +@@ -187,6 +187,13 @@ int d_invalidate(struct dentry * dentry) spin_unlock(&dcache_lock); return 0; } @@ -30,7 +15,7 @@ Index: linux-2.4.21/fs/dcache.c /* * Check whether to do a partial shrink_dcache * to get rid of unused child entries. -@@ -848,13 +855,19 @@ +@@ -848,13 +855,19 @@ void d_delete(struct dentry * dentry) * Adds a dentry to the hash according to its name. */ @@ -53,11 +38,10 @@ Index: linux-2.4.21/fs/dcache.c } #define do_switch(x,y) do { \ -Index: linux-2.4.21/fs/exec.c -=================================================================== ---- linux-2.4.21.orig/fs/exec.c 2005-06-01 22:52:05.000000000 -0400 -+++ linux-2.4.21/fs/exec.c 2005-06-01 22:58:09.044063984 -0400 -@@ -116,8 +116,10 @@ +diff -X dontdiff -urp kern_oldest/fs/exec.c kern_new/fs/exec.c +--- kern_oldest/fs/exec.c 2006-05-01 11:55:39.000000000 -0700 ++++ kern_new/fs/exec.c 2006-05-02 20:21:49.000000000 -0700 +@@ -116,8 +116,10 @@ asmlinkage long sys_uselib(const char * struct file * file; struct nameidata nd; int error; @@ -69,7 +53,7 @@ Index: linux-2.4.21/fs/exec.c if (error) goto out; -@@ -129,7 +131,8 @@ +@@ -129,7 +131,8 @@ asmlinkage long sys_uselib(const char * if (error) goto exit; @@ -79,7 +63,7 @@ Index: linux-2.4.21/fs/exec.c error = PTR_ERR(file); if (IS_ERR(file)) goto out; -@@ -405,8 +408,10 @@ +@@ -405,8 +408,10 @@ struct file *open_exec(const char *name) struct inode *inode; struct file *file; int err = 0; @@ -91,7 +75,7 @@ Index: linux-2.4.21/fs/exec.c file = ERR_PTR(err); if (!err) { inode = nd.dentry->d_inode; -@@ -418,7 +423,8 @@ +@@ -418,7 +423,8 @@ struct file *open_exec(const char *name) err = -EACCES; file = ERR_PTR(err); if (!err) { @@ -101,7 +85,7 @@ Index: linux-2.4.21/fs/exec.c if (!IS_ERR(file)) { err = deny_write_access(file); if (err) { -@@ -430,6 +436,7 @@ +@@ -430,6 +436,7 @@ out: return file; } } @@ -109,7 +93,7 @@ Index: linux-2.4.21/fs/exec.c path_release(&nd); } goto out; -@@ -1368,7 +1375,7 @@ +@@ -1383,7 +1390,7 @@ int do_coredump(long signr, int exit_cod goto close_fail; if (!file->f_op->write) goto close_fail; @@ -118,10 +102,9 @@ Index: linux-2.4.21/fs/exec.c goto close_fail; retval = binfmt->core_dump(signr, regs, file); -Index: linux-2.4.21/fs/namei.c -=================================================================== ---- linux-2.4.21.orig/fs/namei.c 2005-06-01 22:52:05.000000000 -0400 -+++ linux-2.4.21/fs/namei.c 2005-06-01 23:01:30.065504080 -0400 +diff -X dontdiff -urp kern_oldest/fs/namei.c kern_new/fs/namei.c +--- kern_oldest/fs/namei.c 2006-05-01 11:55:39.000000000 -0700 ++++ kern_new/fs/namei.c 2006-05-02 20:21:49.000000000 -0700 @@ -94,6 +94,13 @@ * XEmacs seems to be relying on it... */ @@ -136,7 +119,7 @@ Index: linux-2.4.21/fs/namei.c /* In order to reduce some races, while at the same time doing additional * checking and hopefully speeding things up, we copy filenames to the * kernel data space before using them.. -@@ -260,10 +267,19 @@ +@@ -260,10 +267,19 @@ void path_release(struct nameidata *nd) * Internal lookup() using the new generic dcache. * SMP-safe */ @@ -157,7 +140,7 @@ Index: linux-2.4.21/fs/namei.c if (dentry && dentry->d_op && dentry->d_op->d_revalidate) { if (!dentry->d_op->d_revalidate(dentry, flags) && !d_invalidate(dentry)) { dput(dentry); -@@ -281,11 +297,15 @@ +@@ -281,11 +297,15 @@ static struct dentry * cached_lookup(str * make sure that nobody added the entry to the dcache in the meantime.. * SMP-safe */ @@ -174,7 +157,7 @@ Index: linux-2.4.21/fs/namei.c down(&dir->i_sem); /* * First re-do the cached lookup just in case it was created -@@ -300,6 +320,9 @@ +@@ -300,6 +320,9 @@ static struct dentry * real_lookup(struc result = ERR_PTR(-ENOMEM); if (dentry) { lock_kernel(); @@ -184,7 +167,7 @@ Index: linux-2.4.21/fs/namei.c result = dir->i_op->lookup(dir, dentry); unlock_kernel(); if (result) -@@ -321,6 +344,15 @@ +@@ -321,6 +344,15 @@ static struct dentry * real_lookup(struc dput(result); result = ERR_PTR(-ENOENT); } @@ -200,7 +183,7 @@ Index: linux-2.4.21/fs/namei.c } return result; } -@@ -332,7 +364,8 @@ +@@ -332,7 +364,8 @@ static struct dentry * real_lookup(struc * Without that kind of total limit, nasty chains of consecutive * symlinks can cause almost arbitrarily long lookups. */ @@ -210,7 +193,7 @@ Index: linux-2.4.21/fs/namei.c { int err; if (current->link_count >= 8) -@@ -346,10 +379,12 @@ +@@ -346,10 +379,12 @@ static inline int do_follow_link(struct current->link_count++; current->total_link_count++; UPDATE_ATIME(dentry->d_inode); @@ -223,7 +206,7 @@ Index: linux-2.4.21/fs/namei.c path_release(nd); return -ELOOP; } -@@ -447,7 +482,8 @@ +@@ -447,7 +482,8 @@ static inline void follow_dotdot(struct * * We expect 'base' to be positive and a directory. */ @@ -233,7 +216,7 @@ Index: linux-2.4.21/fs/namei.c { struct dentry *dentry; struct inode *inode; -@@ -524,12 +560,12 @@ +@@ -524,12 +560,12 @@ int link_path_walk(const char * name, st break; } /* This does the actual lookups.. */ @@ -248,7 +231,7 @@ Index: linux-2.4.21/fs/namei.c err = PTR_ERR(dentry); if (IS_ERR(dentry)) break; -@@ -548,7 +584,7 @@ +@@ -548,7 +584,7 @@ int link_path_walk(const char * name, st if (inode->i_op->follow_link) { struct vfsmount *mnt = mntget(nd->mnt); @@ -257,7 +240,7 @@ Index: linux-2.4.21/fs/namei.c dput(dentry); mntput(mnt); if (err) -@@ -565,7 +601,7 @@ +@@ -565,7 +601,7 @@ int link_path_walk(const char * name, st nd->dentry = dentry; } err = -ENOTDIR; @@ -266,7 +249,7 @@ Index: linux-2.4.21/fs/namei.c break; continue; /* here ends the main loop */ -@@ -592,12 +628,12 @@ +@@ -592,12 +628,12 @@ last_component: if (err < 0) break; } @@ -281,7 +264,7 @@ Index: linux-2.4.21/fs/namei.c err = PTR_ERR(dentry); if (IS_ERR(dentry)) break; -@@ -608,7 +644,7 @@ +@@ -608,7 +644,7 @@ last_component: if ((lookup_flags & LOOKUP_FOLLOW) && inode && inode->i_op && inode->i_op->follow_link) { struct vfsmount *mnt = mntget(nd->mnt); @@ -290,7 +273,7 @@ Index: linux-2.4.21/fs/namei.c dput(dentry); mntput(mnt); if (err) -@@ -623,7 +659,8 @@ +@@ -623,7 +659,8 @@ last_component: goto no_inode; if (lookup_flags & LOOKUP_DIRECTORY) { err = -ENOTDIR; @@ -300,7 +283,7 @@ Index: linux-2.4.21/fs/namei.c break; } goto return_base; -@@ -641,12 +678,42 @@ +@@ -641,12 +678,42 @@ lookup_parent: nd->last_type = LAST_DOT; else if (this.len == 2 && this.name[1] == '.') nd->last_type = LAST_DOTDOT; @@ -343,7 +326,7 @@ Index: linux-2.4.21/fs/namei.c if (dentry && dentry->d_op && dentry->d_op->d_revalidate) { err = -ESTALE; if (!dentry->d_op->d_revalidate(dentry, 0)) { -@@ -660,15 +727,28 @@ +@@ -660,15 +727,28 @@ out_dput: dput(dentry); break; } @@ -373,7 +356,7 @@ Index: linux-2.4.21/fs/namei.c } /* SMP-safe */ -@@ -753,6 +833,17 @@ +@@ -753,6 +833,17 @@ walk_init_root(const char *name, struct } /* SMP-safe */ @@ -391,7 +374,7 @@ Index: linux-2.4.21/fs/namei.c int path_lookup(const char *path, unsigned flags, struct nameidata *nd) { int error = 0; -@@ -767,6 +858,7 @@ +@@ -767,6 +858,7 @@ int path_init(const char *name, unsigned { nd->last_type = LAST_ROOT; /* if there are only slashes... */ nd->flags = flags; @@ -399,7 +382,7 @@ Index: linux-2.4.21/fs/namei.c if (*name=='/') return walk_init_root(name,nd); read_lock(¤t->fs->lock); -@@ -781,7 +873,8 @@ +@@ -781,7 +873,8 @@ int path_init(const char *name, unsigned * needs parent already locked. Doesn't follow mounts. * SMP-safe. */ @@ -409,7 +392,7 @@ Index: linux-2.4.21/fs/namei.c { struct dentry * dentry; struct inode *inode; -@@ -804,13 +897,16 @@ +@@ -804,13 +897,16 @@ struct dentry * lookup_hash(struct qstr goto out; } @@ -427,7 +410,7 @@ Index: linux-2.4.21/fs/namei.c dentry = inode->i_op->lookup(inode, new); unlock_kernel(); if (!dentry) -@@ -822,6 +918,12 @@ +@@ -822,6 +918,12 @@ out: return dentry; } @@ -440,7 +423,7 @@ Index: linux-2.4.21/fs/namei.c /* SMP-safe */ struct dentry * lookup_one_len(const char * name, struct dentry * base, int len) { -@@ -843,7 +945,7 @@ +@@ -843,7 +945,7 @@ struct dentry * lookup_one_len(const cha } this.hash = end_name_hash(hash); @@ -449,7 +432,7 @@ Index: linux-2.4.21/fs/namei.c access: return ERR_PTR(-EACCES); } -@@ -874,6 +976,23 @@ +@@ -874,6 +976,23 @@ int __user_walk(const char *name, unsign return err; } @@ -473,7 +456,7 @@ Index: linux-2.4.21/fs/namei.c /* * It's inline, so penalty for filesystems that don't use sticky bit is * minimal. -@@ -971,7 +1090,8 @@ +@@ -971,7 +1090,8 @@ static inline int lookup_flags(unsigned return retval; } @@ -483,7 +466,7 @@ Index: linux-2.4.21/fs/namei.c { int error; -@@ -984,12 +1104,15 @@ +@@ -984,12 +1104,15 @@ int vfs_create(struct inode *dir, struct goto exit_lock; error = -EACCES; /* shouldn't it be ENOSYS? */ @@ -501,7 +484,7 @@ Index: linux-2.4.21/fs/namei.c unlock_kernel(); exit_lock: up(&dir->i_zombie); -@@ -998,6 +1121,11 @@ +@@ -998,6 +1121,11 @@ exit_lock: return error; } @@ -513,7 +496,7 @@ Index: linux-2.4.21/fs/namei.c /* * open_namei() * -@@ -1012,7 +1140,8 @@ +@@ -1012,7 +1140,8 @@ exit_lock: * for symlinks (where the permissions are checked later). * SMP-safe */ @@ -523,7 +506,7 @@ Index: linux-2.4.21/fs/namei.c { int acc_mode, error = 0; struct inode *inode; -@@ -1023,11 +1152,14 @@ +@@ -1023,11 +1152,14 @@ int open_namei(const char * pathname, in acc_mode = ACC_MODE(flag); @@ -539,7 +522,7 @@ Index: linux-2.4.21/fs/namei.c if (error) return error; dentry = nd->dentry; -@@ -1037,6 +1169,10 @@ +@@ -1037,6 +1169,10 @@ int open_namei(const char * pathname, in /* * Create - we need to know the parent. */ @@ -550,7 +533,7 @@ Index: linux-2.4.21/fs/namei.c error = path_lookup(pathname, LOOKUP_PARENT, nd); if (error) return error; -@@ -1052,7 +1188,7 @@ +@@ -1052,7 +1188,7 @@ int open_namei(const char * pathname, in dir = nd->dentry; down(&dir->d_inode->i_sem); @@ -559,7 +542,7 @@ Index: linux-2.4.21/fs/namei.c do_last: error = PTR_ERR(dentry); -@@ -1061,11 +1197,12 @@ +@@ -1061,11 +1197,12 @@ do_last: goto exit; } @@ -573,7 +556,7 @@ Index: linux-2.4.21/fs/namei.c up(&dir->d_inode->i_sem); dput(nd->dentry); nd->dentry = dentry; -@@ -1169,7 +1306,7 @@ +@@ -1169,7 +1306,7 @@ ok: if (!error) { DQUOT_INIT(inode); @@ -582,7 +565,7 @@ Index: linux-2.4.21/fs/namei.c } put_write_access(inode); if (error) -@@ -1181,8 +1318,10 @@ +@@ -1181,8 +1318,10 @@ ok: return 0; exit_dput: @@ -593,7 +576,7 @@ Index: linux-2.4.21/fs/namei.c path_release(nd); return error; -@@ -1202,7 +1341,10 @@ +@@ -1202,7 +1341,10 @@ do_link: */ UPDATE_ATIME(dentry->d_inode); mnt = mntget(nd->mnt); @@ -604,7 +587,7 @@ Index: linux-2.4.21/fs/namei.c dput(dentry); mntput(mnt); if (error) -@@ -1225,13 +1367,20 @@ +@@ -1225,13 +1367,20 @@ do_link: } dir = nd->dentry; down(&dir->d_inode->i_sem); @@ -627,7 +610,7 @@ Index: linux-2.4.21/fs/namei.c { struct dentry *dentry; -@@ -1239,7 +1388,7 @@ +@@ -1239,7 +1388,7 @@ static struct dentry *lookup_create(stru dentry = ERR_PTR(-EEXIST); if (nd->last_type != LAST_NORM) goto fail; @@ -636,7 +619,7 @@ Index: linux-2.4.21/fs/namei.c if (IS_ERR(dentry)) goto fail; if (!is_dir && nd->last.name[nd->last.len] && !dentry->d_inode) -@@ -1295,7 +1444,20 @@ +@@ -1295,7 +1444,20 @@ asmlinkage long sys_mknod(const char * f error = path_lookup(tmp, LOOKUP_PARENT, &nd); if (error) goto out; @@ -658,7 +641,7 @@ Index: linux-2.4.21/fs/namei.c error = PTR_ERR(dentry); if (!IS_POSIXACL(nd.dentry->d_inode)) -@@ -1317,6 +1479,7 @@ +@@ -1317,6 +1479,7 @@ asmlinkage long sys_mknod(const char * f dput(dentry); } up(&nd.dentry->d_inode->i_sem); @@ -666,7 +649,7 @@ Index: linux-2.4.21/fs/namei.c path_release(&nd); out: putname(tmp); -@@ -1364,7 +1527,18 @@ +@@ -1364,7 +1527,18 @@ asmlinkage long sys_mkdir(const char * p error = path_lookup(tmp, LOOKUP_PARENT, &nd); if (error) goto out; @@ -686,7 +669,7 @@ Index: linux-2.4.21/fs/namei.c error = PTR_ERR(dentry); if (!IS_ERR(dentry)) { if (!IS_POSIXACL(nd.dentry->d_inode)) -@@ -1373,6 +1547,7 @@ +@@ -1373,6 +1547,7 @@ asmlinkage long sys_mkdir(const char * p dput(dentry); } up(&nd.dentry->d_inode->i_sem); @@ -694,7 +677,7 @@ Index: linux-2.4.21/fs/namei.c path_release(&nd); out: putname(tmp); -@@ -1473,8 +1648,16 @@ +@@ -1473,8 +1648,16 @@ asmlinkage long sys_rmdir(const char * p error = -EBUSY; goto exit1; } @@ -712,7 +695,7 @@ Index: linux-2.4.21/fs/namei.c error = PTR_ERR(dentry); if (!IS_ERR(dentry)) { error = vfs_rmdir(nd.dentry->d_inode, dentry); -@@ -1532,8 +1715,15 @@ +@@ -1532,8 +1715,15 @@ asmlinkage long sys_unlink(const char * error = -EISDIR; if (nd.last_type != LAST_NORM) goto exit1; @@ -729,7 +712,7 @@ Index: linux-2.4.21/fs/namei.c error = PTR_ERR(dentry); if (!IS_ERR(dentry)) { /* Why not before? Because we want correct error value */ -@@ -1600,15 +1790,27 @@ +@@ -1600,15 +1790,27 @@ asmlinkage long sys_symlink(const char * error = path_lookup(to, LOOKUP_PARENT, &nd); if (error) goto out; @@ -759,7 +742,7 @@ Index: linux-2.4.21/fs/namei.c putname(to); } putname(from); -@@ -1684,7 +1886,18 @@ +@@ -1684,7 +1886,18 @@ asmlinkage long sys_link(const char * ol error = -EXDEV; if (old_nd.mnt != nd.mnt) goto out_release; @@ -779,7 +762,7 @@ Index: linux-2.4.21/fs/namei.c error = PTR_ERR(new_dentry); if (!IS_ERR(new_dentry)) { error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry); -@@ -1728,7 +1941,7 @@ +@@ -1728,7 +1941,7 @@ exit: * locking]. */ int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry, @@ -788,7 +771,7 @@ Index: linux-2.4.21/fs/namei.c { int error; struct inode *target; -@@ -1807,7 +2020,7 @@ +@@ -1807,7 +2020,7 @@ out_unlock: } int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry, @@ -797,7 +780,7 @@ Index: linux-2.4.21/fs/namei.c { int error; -@@ -1895,9 +2108,18 @@ +@@ -1895,9 +2108,18 @@ static inline int do_rename(const char * if (newnd.last_type != LAST_NORM) goto exit2; @@ -817,7 +800,7 @@ Index: linux-2.4.21/fs/namei.c error = PTR_ERR(old_dentry); if (IS_ERR(old_dentry)) goto exit3; -@@ -1913,16 +2135,16 @@ +@@ -1913,16 +2135,16 @@ static inline int do_rename(const char * if (newnd.last.name[newnd.last.len]) goto exit4; } @@ -836,7 +819,7 @@ Index: linux-2.4.21/fs/namei.c dput(new_dentry); exit4: dput(old_dentry); -@@ -1973,20 +2195,26 @@ +@@ -1973,20 +2195,26 @@ out: } static inline int @@ -865,7 +848,7 @@ Index: linux-2.4.21/fs/namei.c out: if (current->link_count || res || nd->last_type!=LAST_NORM) return res; -@@ -2010,7 +2238,13 @@ +@@ -2010,7 +2238,13 @@ fail: int vfs_follow_link(struct nameidata *nd, const char *link) { @@ -880,7 +863,7 @@ Index: linux-2.4.21/fs/namei.c } /* get the link contents into pagecache */ -@@ -2052,7 +2286,7 @@ +@@ -2052,7 +2286,7 @@ int page_follow_link(struct dentry *dent { struct page *page = NULL; char *s = page_getlink(dentry, &page); @@ -889,11 +872,10 @@ Index: linux-2.4.21/fs/namei.c if (page) { kunmap(page); page_cache_release(page); -Index: linux-2.4.21/fs/namespace.c -=================================================================== ---- linux-2.4.21.orig/fs/namespace.c 2005-06-01 22:51:42.000000000 -0400 -+++ linux-2.4.21/fs/namespace.c 2005-06-01 22:58:09.048063376 -0400 -@@ -98,6 +98,7 @@ +diff -X dontdiff -urp kern_oldest/fs/namespace.c kern_new/fs/namespace.c +--- kern_oldest/fs/namespace.c 2006-05-01 11:55:39.000000000 -0700 ++++ kern_new/fs/namespace.c 2006-05-02 20:21:49.000000000 -0700 +@@ -98,6 +98,7 @@ static void detach_mnt(struct vfsmount * { old_nd->dentry = mnt->mnt_mountpoint; old_nd->mnt = mnt->mnt_parent; @@ -901,7 +883,7 @@ Index: linux-2.4.21/fs/namespace.c mnt->mnt_parent = mnt; mnt->mnt_mountpoint = mnt->mnt_root; list_del_init(&mnt->mnt_child); -@@ -109,6 +110,7 @@ +@@ -109,6 +110,7 @@ static void attach_mnt(struct vfsmount * { mnt->mnt_parent = mntget(nd->mnt); mnt->mnt_mountpoint = dget(nd->dentry); @@ -909,7 +891,7 @@ Index: linux-2.4.21/fs/namespace.c list_add(&mnt->mnt_hash, mount_hashtable+hash(nd->mnt, nd->dentry)); list_add(&mnt->mnt_child, &nd->mnt->mnt_mounts); nd->dentry->d_mounted++; -@@ -488,14 +490,17 @@ +@@ -488,14 +490,17 @@ static int do_loopback(struct nameidata { struct nameidata old_nd; struct vfsmount *mnt = NULL; @@ -929,7 +911,7 @@ Index: linux-2.4.21/fs/namespace.c down_write(¤t->namespace->sem); err = -EINVAL; -@@ -518,6 +523,7 @@ +@@ -518,6 +523,7 @@ static int do_loopback(struct nameidata } up_write(¤t->namespace->sem); @@ -937,7 +919,7 @@ Index: linux-2.4.21/fs/namespace.c path_release(&old_nd); return err; } -@@ -701,6 +707,7 @@ +@@ -701,6 +707,7 @@ long do_mount(char * dev_name, char * di unsigned long flags, void *data_page) { struct nameidata nd; @@ -945,7 +927,7 @@ Index: linux-2.4.21/fs/namespace.c int retval = 0; int mnt_flags = 0; -@@ -725,9 +732,11 @@ +@@ -725,9 +732,11 @@ long do_mount(char * dev_name, char * di flags &= ~(MS_NOSUID|MS_NOEXEC|MS_NODEV); /* ... and get the mountpoint */ @@ -959,7 +941,7 @@ Index: linux-2.4.21/fs/namespace.c if (flags & MS_REMOUNT) retval = do_remount(&nd, flags & ~MS_REMOUNT, mnt_flags, -@@ -739,6 +748,8 @@ +@@ -739,6 +748,8 @@ long do_mount(char * dev_name, char * di else retval = do_add_mount(&nd, type_page, flags, mnt_flags, dev_name, data_page); @@ -968,7 +950,7 @@ Index: linux-2.4.21/fs/namespace.c path_release(&nd); return retval; } -@@ -904,6 +915,8 @@ +@@ -904,6 +915,8 @@ asmlinkage long sys_pivot_root(const cha { struct vfsmount *tmp; struct nameidata new_nd, old_nd, parent_nd, root_parent, user_nd; @@ -977,7 +959,7 @@ Index: linux-2.4.21/fs/namespace.c int error; if (!capable(CAP_SYS_ADMIN)) -@@ -911,14 +924,14 @@ +@@ -911,14 +924,14 @@ asmlinkage long sys_pivot_root(const cha lock_kernel(); @@ -994,7 +976,7 @@ Index: linux-2.4.21/fs/namespace.c if (error) goto out1; -@@ -973,8 +986,10 @@ +@@ -973,8 +986,10 @@ out2: up(&old_nd.dentry->d_inode->i_zombie); up_write(¤t->namespace->sem); path_release(&user_nd); @@ -1005,11 +987,10 @@ Index: linux-2.4.21/fs/namespace.c path_release(&new_nd); out0: unlock_kernel(); -Index: linux-2.4.21/fs/open.c -=================================================================== ---- linux-2.4.21.orig/fs/open.c 2005-06-01 22:51:55.000000000 -0400 -+++ linux-2.4.21/fs/open.c 2005-06-01 22:58:09.050063072 -0400 -@@ -19,6 +19,8 @@ +diff -X dontdiff -urp kern_oldest/fs/open.c kern_new/fs/open.c +--- kern_oldest/fs/open.c 2006-05-01 11:55:39.000000000 -0700 ++++ kern_new/fs/open.c 2006-05-02 20:23:34.000000000 -0700 +@@ -20,6 +20,8 @@ #include #define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m)) @@ -1018,7 +999,7 @@ Index: linux-2.4.21/fs/open.c int vfs_statfs(struct super_block *sb, struct statfs *buf) { -@@ -169,9 +171,10 @@ +@@ -170,9 +172,10 @@ void fd_install(unsigned int fd, struct write_unlock(&files->file_lock); } @@ -1030,7 +1011,7 @@ Index: linux-2.4.21/fs/open.c int error; struct iattr newattrs; -@@ -183,7 +186,13 @@ +@@ -184,7 +187,13 @@ int do_truncate(struct dentry *dentry, l down(&inode->i_sem); newattrs.ia_size = length; newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; @@ -1045,7 +1026,7 @@ Index: linux-2.4.21/fs/open.c up(&inode->i_sem); up_write(&inode->i_alloc_sem); return error; -@@ -194,12 +203,13 @@ +@@ -195,12 +204,13 @@ static inline long do_sys_truncate(const struct nameidata nd; struct inode * inode; int error; @@ -1060,7 +1041,7 @@ Index: linux-2.4.21/fs/open.c if (error) goto out; inode = nd.dentry->d_inode; -@@ -239,11 +249,13 @@ +@@ -240,11 +250,13 @@ static inline long do_sys_truncate(const error = locks_verify_truncate(inode, NULL, length); if (!error) { DQUOT_INIT(inode); @@ -1075,7 +1056,7 @@ Index: linux-2.4.21/fs/open.c path_release(&nd); out: return error; -@@ -291,7 +303,7 @@ +@@ -292,7 +304,7 @@ static inline long do_sys_ftruncate(unsi error = locks_verify_truncate(inode, file, length); if (!error) @@ -1084,7 +1065,7 @@ Index: linux-2.4.21/fs/open.c out_putf: fput(file); out: -@@ -336,11 +348,13 @@ +@@ -337,11 +349,13 @@ asmlinkage long sys_utime(char * filenam struct inode * inode; struct iattr newattrs; @@ -1099,7 +1080,7 @@ Index: linux-2.4.21/fs/open.c error = -EROFS; if (IS_RDONLY(inode)) goto dput_and_out; -@@ -355,11 +369,25 @@ +@@ -356,11 +370,25 @@ asmlinkage long sys_utime(char * filenam goto dput_and_out; newattrs.ia_valid |= ATTR_ATIME_SET | ATTR_MTIME_SET; @@ -1126,7 +1107,7 @@ Index: linux-2.4.21/fs/open.c error = notify_change(nd.dentry, &newattrs); dput_and_out: path_release(&nd); -@@ -380,12 +408,14 @@ +@@ -381,12 +409,14 @@ asmlinkage long sys_utimes(char * filena struct inode * inode; struct iattr newattrs; @@ -1142,7 +1123,7 @@ Index: linux-2.4.21/fs/open.c error = -EROFS; if (IS_RDONLY(inode)) goto dput_and_out; -@@ -400,7 +430,20 @@ +@@ -401,7 +431,20 @@ asmlinkage long sys_utimes(char * filena newattrs.ia_atime = times[0].tv_sec; newattrs.ia_mtime = times[1].tv_sec; newattrs.ia_valid |= ATTR_ATIME_SET | ATTR_MTIME_SET; @@ -1164,7 +1145,7 @@ Index: linux-2.4.21/fs/open.c if (current->fsuid != inode->i_uid && (error = permission(inode,MAY_WRITE)) != 0) goto dput_and_out; -@@ -423,6 +466,7 @@ +@@ -424,6 +467,7 @@ asmlinkage long sys_access(const char * int old_fsuid, old_fsgid; kernel_cap_t old_cap; int res; @@ -1172,7 +1153,7 @@ Index: linux-2.4.21/fs/open.c if (mode & ~S_IRWXO) /* where's F_OK, X_OK, W_OK, R_OK? */ return -EINVAL; -@@ -440,13 +484,14 @@ +@@ -441,13 +485,14 @@ asmlinkage long sys_access(const char * else current->cap_effective = current->cap_permitted; @@ -1188,7 +1169,7 @@ Index: linux-2.4.21/fs/open.c path_release(&nd); } -@@ -461,8 +506,9 @@ +@@ -462,8 +507,9 @@ asmlinkage long sys_chdir(const char * f { int error; struct nameidata nd; @@ -1199,7 +1180,7 @@ Index: linux-2.4.21/fs/open.c if (error) goto out; -@@ -473,6 +519,7 @@ +@@ -474,6 +520,7 @@ asmlinkage long sys_chdir(const char * f set_fs_pwd(current->fs, nd.mnt, nd.dentry); dput_and_out: @@ -1207,7 +1188,7 @@ Index: linux-2.4.21/fs/open.c path_release(&nd); out: return error; -@@ -512,9 +559,10 @@ +@@ -513,9 +560,10 @@ asmlinkage long sys_chroot(const char * { int error; struct nameidata nd; @@ -1220,7 +1201,7 @@ Index: linux-2.4.21/fs/open.c if (error) goto out; -@@ -530,39 +578,56 @@ +@@ -531,39 +579,56 @@ asmlinkage long sys_chroot(const char * set_fs_altroot(); error = 0; dput_and_out: @@ -1291,7 +1272,7 @@ Index: linux-2.4.21/fs/open.c fput(file); out: return err; -@@ -571,30 +636,14 @@ +@@ -572,30 +637,14 @@ out: asmlinkage long sys_chmod(const char * filename, mode_t mode) { struct nameidata nd; @@ -1307,23 +1288,23 @@ Index: linux-2.4.21/fs/open.c - error = -EROFS; - if (IS_RDONLY(inode)) - goto dput_and_out; -- + - error = -EPERM; - if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) - goto dput_and_out; ++ error = chmod_common(nd.dentry, mode); - if (mode == (mode_t) -1) - mode = inode->i_mode; - newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO); - newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; - error = notify_change(nd.dentry, &newattrs); -+ error = chmod_common(nd.dentry, mode); - +- -dput_and_out: path_release(&nd); out: return error; -@@ -614,6 +663,20 @@ +@@ -615,6 +664,20 @@ static int chown_common(struct dentry * error = -EROFS; if (IS_RDONLY(inode)) goto out; @@ -1344,36 +1325,59 @@ Index: linux-2.4.21/fs/open.c error = -EPERM; if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) goto out; -@@ -718,6 +781,7 @@ +@@ -701,7 +764,7 @@ asmlinkage long sys_fchown(unsigned int + return error; + } + +-static struct file *__dentry_open(struct dentry *, struct vfsmount *, int, struct file *); ++static struct file *__dentry_open(struct dentry *, struct vfsmount *, int, struct file *, struct lookup_intent *); + + /* + * Note that while the flag value (low two bits) for sys_open means: +@@ -721,6 +784,7 @@ struct file *filp_open(const char * file { int namei_flags, error; struct nameidata nd; + struct lookup_intent it = { .it_op = IT_OPEN }; + struct file *f; namei_flags = flags; - if ((namei_flags+1) & O_ACCMODE) -@@ -725,14 +789,15 @@ - if (namei_flags & O_TRUNC) - namei_flags |= 2; +@@ -734,15 +798,16 @@ struct file *filp_open(const char * file + if (f == NULL) + return ERR_PTR(error); - error = open_namei(filename, namei_flags, mode, &nd); - if (!error) -- return dentry_open(nd.dentry, nd.mnt, flags); +- return __dentry_open(nd.dentry, nd.mnt, flags, f); + error = open_namei_it(filename, namei_flags, mode, &nd, &it); + if (error) + return ERR_PTR(error); + put_filp(f); - return ERR_PTR(error); + return dentry_open_it(nd.dentry, nd.mnt, flags, &it); } -struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags) -+struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt, -+ int flags, struct lookup_intent *it) ++struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt, ++ int flags, struct lookup_intent *it) + { + struct file *f; + +@@ -753,10 +818,10 @@ struct file *dentry_open(struct dentry * + return ERR_PTR(-ENFILE); + } + +- return __dentry_open(dentry, mnt, flags, f); ++ return __dentry_open(dentry, mnt, flags, f, it); + } + +-static struct file *__dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags, struct file *f) ++static struct file *__dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags, struct file *f, struct lookup_intent *it) { - struct file * f; struct inode *inode; -@@ -769,7 +834,9 @@ + static LIST_HEAD(kill_list); +@@ -788,7 +853,9 @@ static struct file *__dentry_open(struct } if (f->f_op && f->f_op->open) { @@ -1383,7 +1387,7 @@ Index: linux-2.4.21/fs/open.c if (error) goto cleanup_all; } -@@ -785,6 +852,7 @@ +@@ -804,6 +871,7 @@ static struct file *__dentry_open(struct } } @@ -1391,10 +1395,10 @@ Index: linux-2.4.21/fs/open.c return f; cleanup_all: -@@ -799,11 +867,17 @@ +@@ -817,11 +885,17 @@ cleanup_all: + f->f_vfsmnt = NULL; cleanup_file: put_filp(f); - cleanup_dentry: + intent_release(it); dput(dentry); mntput(mnt); @@ -1409,10 +1413,9 @@ Index: linux-2.4.21/fs/open.c /* * Find an empty file descriptor entry, and mark it busy. */ -Index: linux-2.4.21/fs/stat.c -=================================================================== ---- linux-2.4.21.orig/fs/stat.c 2005-06-01 22:51:55.000000000 -0400 -+++ linux-2.4.21/fs/stat.c 2005-06-01 22:58:09.051062920 -0400 +diff -X dontdiff -urp kern_oldest/fs/stat.c kern_new/fs/stat.c +--- kern_oldest/fs/stat.c 2006-05-01 11:55:39.000000000 -0700 ++++ kern_new/fs/stat.c 2006-05-02 20:21:49.000000000 -0700 @@ -17,10 +17,12 @@ * Revalidate the inode. This is required for proper NFS attribute caching. */ @@ -1428,7 +1431,7 @@ Index: linux-2.4.21/fs/stat.c return inode->i_op->revalidate(dentry); return 0; } -@@ -143,14 +145,16 @@ +@@ -143,14 +145,16 @@ static int cp_new_stat(struct inode * in asmlinkage long sys_stat(char * filename, struct __old_kernel_stat * statbuf) { struct nameidata nd; @@ -1447,7 +1450,7 @@ Index: linux-2.4.21/fs/stat.c path_release(&nd); } if (error == -ESTALE && !errcnt) { -@@ -164,14 +168,16 @@ +@@ -164,14 +168,16 @@ again: asmlinkage long sys_newstat(char * filename, struct stat * statbuf) { struct nameidata nd; @@ -1466,7 +1469,7 @@ Index: linux-2.4.21/fs/stat.c path_release(&nd); } if (error == -ESTALE && !errcnt) { -@@ -191,14 +197,16 @@ +@@ -191,14 +197,16 @@ again: asmlinkage long sys_lstat(char * filename, struct __old_kernel_stat * statbuf) { struct nameidata nd; @@ -1485,7 +1488,7 @@ Index: linux-2.4.21/fs/stat.c path_release(&nd); } if (error == -ESTALE && !errcnt) { -@@ -214,14 +222,16 @@ +@@ -214,14 +222,16 @@ again: asmlinkage long sys_newlstat(char * filename, struct stat * statbuf) { struct nameidata nd; @@ -1504,7 +1507,7 @@ Index: linux-2.4.21/fs/stat.c path_release(&nd); } -@@ -248,7 +258,7 @@ +@@ -248,7 +258,7 @@ asmlinkage long sys_fstat(unsigned int f if (f) { struct dentry * dentry = f->f_dentry; @@ -1513,7 +1516,7 @@ Index: linux-2.4.21/fs/stat.c if (!err) err = cp_old_stat(dentry->d_inode, statbuf); fput(f); -@@ -267,7 +277,7 @@ +@@ -267,7 +277,7 @@ asmlinkage long sys_newfstat(unsigned in if (f) { struct dentry * dentry = f->f_dentry; @@ -1522,7 +1525,7 @@ Index: linux-2.4.21/fs/stat.c if (!err) err = cp_new_stat(dentry->d_inode, statbuf); fput(f); -@@ -289,7 +299,7 @@ +@@ -289,7 +299,7 @@ asmlinkage long sys_readlink(const char error = -EINVAL; if (inode->i_op && inode->i_op->readlink && @@ -1531,7 +1534,7 @@ Index: linux-2.4.21/fs/stat.c UPDATE_ATIME(inode); error = inode->i_op->readlink(nd.dentry, buf, bufsiz); } -@@ -364,14 +374,16 @@ +@@ -364,14 +374,16 @@ static long cp_new_stat64(struct inode * asmlinkage long sys_stat64(char * filename, struct stat64 * statbuf, long flags) { struct nameidata nd; @@ -1550,7 +1553,7 @@ Index: linux-2.4.21/fs/stat.c path_release(&nd); } if (error == -ESTALE && !errcnt) { -@@ -385,14 +397,16 @@ +@@ -385,14 +397,16 @@ again: asmlinkage long sys_lstat64(char * filename, struct stat64 * statbuf, long flags) { struct nameidata nd; @@ -1569,7 +1572,7 @@ Index: linux-2.4.21/fs/stat.c path_release(&nd); } if (error == -ESTALE && !errcnt) { -@@ -412,7 +426,7 @@ +@@ -412,7 +426,7 @@ asmlinkage long sys_fstat64(unsigned lon if (f) { struct dentry * dentry = f->f_dentry; @@ -1578,10 +1581,9 @@ Index: linux-2.4.21/fs/stat.c if (!err) err = cp_new_stat64(dentry->d_inode, statbuf); fput(f); -Index: linux-2.4.21/include/linux/dcache.h -=================================================================== ---- linux-2.4.21.orig/include/linux/dcache.h 2005-06-01 22:52:05.000000000 -0400 -+++ linux-2.4.21/include/linux/dcache.h 2005-06-01 22:58:09.051062920 -0400 +diff -X dontdiff -urp kern_oldest/include/linux/dcache.h kern_new/include/linux/dcache.h +--- kern_oldest/include/linux/dcache.h 2006-05-01 11:55:39.000000000 -0700 ++++ kern_new/include/linux/dcache.h 2006-05-02 20:21:49.000000000 -0700 @@ -6,6 +6,51 @@ #include #include @@ -1634,7 +1636,7 @@ Index: linux-2.4.21/include/linux/dcache.h /* * linux/include/linux/dcache.h -@@ -96,8 +141,22 @@ +@@ -96,8 +141,22 @@ struct dentry_operations { int (*d_delete)(struct dentry *); void (*d_release)(struct dentry *); void (*d_iput)(struct dentry *, struct inode *); @@ -1657,7 +1659,7 @@ Index: linux-2.4.21/include/linux/dcache.h /* the dentry parameter passed to d_hash and d_compare is the parent * directory of the entries to be compared. It is used in case these * functions need any directory specific information for determining -@@ -129,6 +188,7 @@ +@@ -129,6 +188,7 @@ d_iput: no no yes * s_nfsd_free_path semaphore will be down */ #define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */ @@ -1665,11 +1667,10 @@ Index: linux-2.4.21/include/linux/dcache.h extern spinlock_t dcache_lock; -Index: linux-2.4.21/include/linux/fs.h -=================================================================== ---- linux-2.4.21.orig/include/linux/fs.h 2005-06-01 22:57:59.887456000 -0400 -+++ linux-2.4.21/include/linux/fs.h 2005-06-01 22:58:09.053062616 -0400 -@@ -73,6 +73,7 @@ +diff -X dontdiff -urp kern_oldest/include/linux/fs.h kern_new/include/linux/fs.h +--- kern_oldest/include/linux/fs.h 2006-05-01 12:04:33.000000000 -0700 ++++ kern_new/include/linux/fs.h 2006-05-02 20:21:49.000000000 -0700 +@@ -73,6 +73,7 @@ extern int leases_enable, dir_notify_ena #define FMODE_READ 1 #define FMODE_WRITE 2 @@ -1677,7 +1678,7 @@ Index: linux-2.4.21/include/linux/fs.h #define READ 0 #define WRITE 1 -@@ -365,6 +366,9 @@ +@@ -365,6 +366,9 @@ extern void set_bh_page(struct buffer_he #define ATTR_MTIME_SET 256 #define ATTR_FORCE 512 /* Not a change, but a change it */ #define ATTR_ATTR_FLAG 1024 @@ -1687,7 +1688,7 @@ Index: linux-2.4.21/include/linux/fs.h /* * This is the Inode Attributes structure, used for notify_change(). It -@@ -502,6 +506,7 @@ +@@ -502,6 +506,7 @@ struct inode { struct pipe_inode_info *i_pipe; struct block_device *i_bdev; struct char_device *i_cdev; @@ -1695,7 +1696,7 @@ Index: linux-2.4.21/include/linux/fs.h unsigned long i_dnotify_mask; /* Directory notify events */ struct dnotify_struct *i_dnotify; /* for directory notifications */ -@@ -604,6 +609,7 @@ +@@ -604,6 +609,7 @@ struct file { /* needed for tty driver, and maybe others */ void *private_data; @@ -1703,7 +1704,7 @@ Index: linux-2.4.21/include/linux/fs.h /* preallocated helper kiobuf to speedup O_DIRECT */ struct kiobuf *f_iobuf; -@@ -736,6 +742,7 @@ +@@ -736,6 +742,7 @@ struct nameidata { struct qstr last; unsigned int flags; int last_type; @@ -1711,7 +1712,7 @@ Index: linux-2.4.21/include/linux/fs.h }; /* -@@ -856,7 +863,8 @@ +@@ -856,7 +863,8 @@ extern int vfs_symlink(struct inode *, s extern int vfs_link(struct dentry *, struct inode *, struct dentry *); extern int vfs_rmdir(struct inode *, struct dentry *); extern int vfs_unlink(struct inode *, struct dentry *); @@ -1721,7 +1722,7 @@ Index: linux-2.4.21/include/linux/fs.h /* * File types -@@ -935,21 +943,32 @@ +@@ -935,21 +943,32 @@ struct file_operations_ext { struct inode_operations { int (*create) (struct inode *,struct dentry *,int); @@ -1754,7 +1755,7 @@ Index: linux-2.4.21/include/linux/fs.h int (*getattr) (struct dentry *, struct iattr *); int (*setxattr) (struct dentry *, const char *, const void *, size_t, int); ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t); -@@ -1151,10 +1170,14 @@ +@@ -1151,10 +1170,14 @@ static inline int get_lease(struct inode asmlinkage long sys_open(const char *, int, int); asmlinkage long sys_close(unsigned int); /* yes, it's really unsigned */ @@ -1770,7 +1771,7 @@ Index: linux-2.4.21/include/linux/fs.h extern int filp_close(struct file *, fl_owner_t id); extern char * getname(const char *); -@@ -1446,6 +1469,7 @@ +@@ -1446,6 +1469,7 @@ typedef int (*read_actor_t)(read_descrip extern loff_t default_llseek(struct file *file, loff_t offset, int origin); extern int FASTCALL(__user_walk(const char *, unsigned, struct nameidata *)); @@ -1778,7 +1779,7 @@ Index: linux-2.4.21/include/linux/fs.h extern int FASTCALL(path_init(const char *, unsigned, struct nameidata *)); extern int FASTCALL(path_walk(const char *, struct nameidata *)); extern int FASTCALL(path_lookup(const char *, unsigned, struct nameidata *)); -@@ -1457,6 +1481,8 @@ +@@ -1457,6 +1481,8 @@ extern struct dentry * lookup_one_len(co extern struct dentry * lookup_hash(struct qstr *, struct dentry *); #define user_path_walk(name,nd) __user_walk(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, nd) #define user_path_walk_link(name,nd) __user_walk(name, LOOKUP_POSITIVE, nd) @@ -1787,7 +1788,7 @@ Index: linux-2.4.21/include/linux/fs.h extern void inode_init_once(struct inode *); extern void iput(struct inode *); -@@ -1625,6 +1651,8 @@ +@@ -1625,6 +1651,8 @@ extern struct file_operations generic_ro extern int vfs_readlink(struct dentry *, char *, int, const char *); extern int vfs_follow_link(struct nameidata *, const char *); @@ -1796,11 +1797,10 @@ Index: linux-2.4.21/include/linux/fs.h extern int page_readlink(struct dentry *, char *, int); extern int page_follow_link(struct dentry *, struct nameidata *); extern struct inode_operations page_symlink_inode_operations; -Index: linux-2.4.21/include/linux/fs_struct.h -=================================================================== ---- linux-2.4.21.orig/include/linux/fs_struct.h 2005-06-01 22:51:40.000000000 -0400 -+++ linux-2.4.21/include/linux/fs_struct.h 2005-06-01 22:58:09.054062464 -0400 -@@ -37,10 +37,12 @@ +diff -X dontdiff -urp kern_oldest/include/linux/fs_struct.h kern_new/include/linux/fs_struct.h +--- kern_oldest/include/linux/fs_struct.h 2006-05-01 11:55:40.000000000 -0700 ++++ kern_new/include/linux/fs_struct.h 2006-05-02 20:21:49.000000000 -0700 +@@ -37,10 +37,12 @@ static inline void set_fs_root(struct fs write_lock(&fs->lock); old_root = fs->root; old_rootmnt = fs->rootmnt; @@ -1813,7 +1813,7 @@ Index: linux-2.4.21/include/linux/fs_struct.h dput(old_root); mntput(old_rootmnt); } -@@ -60,10 +62,12 @@ +@@ -60,10 +62,12 @@ static inline void set_fs_pwd(struct fs_ write_lock(&fs->lock); old_pwd = fs->pwd; old_pwdmnt = fs->pwdmnt; @@ -1826,11 +1826,10 @@ Index: linux-2.4.21/include/linux/fs_struct.h dput(old_pwd); mntput(old_pwdmnt); } -Index: linux-2.4.21/kernel/exit.c -=================================================================== ---- linux-2.4.21.orig/kernel/exit.c 2005-06-01 22:52:04.000000000 -0400 -+++ linux-2.4.21/kernel/exit.c 2005-06-01 22:58:09.055062312 -0400 -@@ -367,11 +367,14 @@ +diff -X dontdiff -urp kern_oldest/kernel/exit.c kern_new/kernel/exit.c +--- kern_oldest/kernel/exit.c 2006-05-01 11:55:39.000000000 -0700 ++++ kern_new/kernel/exit.c 2006-05-02 20:21:49.000000000 -0700 +@@ -367,11 +367,14 @@ static inline void __put_fs_struct(struc { /* No need to hold fs->lock if we are killing it */ if (atomic_dec_and_test(&fs->count)) { @@ -1845,11 +1844,10 @@ Index: linux-2.4.21/kernel/exit.c dput(fs->altroot); mntput(fs->altrootmnt); } -Index: linux-2.4.21/kernel/fork.c -=================================================================== ---- linux-2.4.21.orig/kernel/fork.c 2005-06-01 22:52:05.000000000 -0400 -+++ linux-2.4.21/kernel/fork.c 2005-06-01 22:58:09.055062312 -0400 -@@ -473,10 +473,13 @@ +diff -X dontdiff -urp kern_oldest/kernel/fork.c kern_new/kernel/fork.c +--- kern_oldest/kernel/fork.c 2006-05-01 11:55:39.000000000 -0700 ++++ kern_new/kernel/fork.c 2006-05-02 20:21:49.000000000 -0700 +@@ -473,10 +473,13 @@ static inline struct fs_struct *__copy_f fs->umask = old->umask; read_lock(&old->lock); fs->rootmnt = mntget(old->rootmnt); @@ -1863,11 +1861,10 @@ Index: linux-2.4.21/kernel/fork.c fs->altrootmnt = mntget(old->altrootmnt); fs->altroot = dget(old->altroot); } else { -Index: linux-2.4.21/kernel/ksyms.c -=================================================================== ---- linux-2.4.21.orig/kernel/ksyms.c 2005-06-01 22:57:59.891455392 -0400 -+++ linux-2.4.21/kernel/ksyms.c 2005-06-01 22:58:09.056062160 -0400 -@@ -318,6 +318,7 @@ +diff -X dontdiff -urp kern_oldest/kernel/ksyms.c kern_new/kernel/ksyms.c +--- kern_oldest/kernel/ksyms.c 2006-05-01 12:04:33.000000000 -0700 ++++ kern_new/kernel/ksyms.c 2006-05-02 20:21:49.000000000 -0700 +@@ -319,6 +319,7 @@ EXPORT_SYMBOL(read_cache_page); EXPORT_SYMBOL(set_page_dirty); EXPORT_SYMBOL(vfs_readlink); EXPORT_SYMBOL(vfs_follow_link); @@ -1875,3 +1872,4 @@ Index: linux-2.4.21/kernel/ksyms.c EXPORT_SYMBOL(page_readlink); EXPORT_SYMBOL(page_follow_link); EXPORT_SYMBOL(page_symlink_inode_operations); +Only in kern_new: kern_oldest diff --git a/lustre/kernel_patches/series/2.6-rhel4-titech.series b/lustre/kernel_patches/series/2.6-rhel4-titech.series new file mode 100644 index 0000000..4d881fe --- /dev/null +++ b/lustre/kernel_patches/series/2.6-rhel4-titech.series @@ -0,0 +1,30 @@ +lustre_version.patch +vfs_intent-2.6-rhel4.patch +vfs_nointent-2.6-rhel4.patch +vfs_races-2.6-rhel4.patch +ext3-wantedi-misc-2.6-suse.patch +nfs-cifs-intent-2.6-rhel4.patch +iopen-misc-2.6-suse.patch +export-truncate-2.6-suse.patch +export_symbols-2.6-rhel4.patch +dev_read_only-2.6-suse.patch +export-log-2.6-rhel4.patch +lookup_bdev_init_intent.patch +remove-suid-2.6-suse.patch +export-show_task-2.6-vanilla.patch +sd_iostats-2.6-rhel4.patch +fsprivate-2.6.patch +export_symbol_numa.patch +qsnet-rhel4-2.6.patch +linux-2.6-binutils-2.16.patch +compile-fixes-2.6.9-rhel4-22.patch +vm-tunables-rhel4.patch +tcp-zero-copy-2.6.9-rhel4.patch +iallocsem_consistency.patch +raid5-stats.patch +raid5-configurable-cachesize.patch +raid5-large-io.patch +raid5-stripe-by-stripe-handling.patch +raid5-optimize-memcpy.patch +raid5-merge-ios.patch +raid5-serialize-ovelapping-reqs.patch diff --git a/lustre/kernel_patches/series/2.6-rhel4.series b/lustre/kernel_patches/series/2.6-rhel4.series index 5c48af2..b81bf63 100644 --- a/lustre/kernel_patches/series/2.6-rhel4.series +++ b/lustre/kernel_patches/series/2.6-rhel4.series @@ -21,3 +21,9 @@ compile-fixes-2.6.9-rhel4-22.patch vm-tunables-rhel4.patch tcp-zero-copy-2.6.9-rhel4.patch iallocsem_consistency.patch +raid5-stats.patch +raid5-configurable-cachesize.patch +raid5-large-io.patch +raid5-stripe-by-stripe-handling.patch +raid5-merge-ios.patch +raid5-serialize-ovelapping-reqs.patch diff --git a/lustre/kernel_patches/targets/2.6-rhel4.target.in b/lustre/kernel_patches/targets/2.6-rhel4.target.in index b89f5a8..7878a52 100644 --- a/lustre/kernel_patches/targets/2.6-rhel4.target.in +++ b/lustre/kernel_patches/targets/2.6-rhel4.target.in @@ -1,5 +1,5 @@ lnxmaj="2.6.9" -lnxrel="34.EL" +lnxrel="34.0.1.EL" KERNEL=linux-${lnxmaj}-${lnxrel}.tar.bz2 SERIES=2.6-rhel4.series diff --git a/lustre/kernel_patches/targets/2.6-suse.target.in b/lustre/kernel_patches/targets/2.6-suse.target.in index 5e34152..8ff4b67 100644 --- a/lustre/kernel_patches/targets/2.6-suse.target.in +++ b/lustre/kernel_patches/targets/2.6-suse.target.in @@ -1,5 +1,5 @@ lnxmaj="2.6.5" -lnxrel="7.252" +lnxrel="7.257" KERNEL=linux-$lnxmaj-$lnxrel.tar.bz2 # they include our patches diff --git a/lustre/kernel_patches/targets/rhel-2.4.target.in b/lustre/kernel_patches/targets/rhel-2.4.target.in index 7af0f35..48d8eea 100644 --- a/lustre/kernel_patches/targets/rhel-2.4.target.in +++ b/lustre/kernel_patches/targets/rhel-2.4.target.in @@ -1,5 +1,5 @@ lnxmaj="2.4.21" -lnxrel="37.EL" +lnxrel="40.EL" KERNEL=linux-${lnxmaj}-${lnxrel}.tar.bz2 SERIES=rhel-2.4.21 diff --git a/lustre/ldlm/ldlm_flock.c b/lustre/ldlm/ldlm_flock.c index 2f837f2..9bf73d4 100644 --- a/lustre/ldlm/ldlm_flock.c +++ b/lustre/ldlm/ldlm_flock.c @@ -451,7 +451,6 @@ ldlm_flock_completion_ast(struct ldlm_lock *lock, int flags, void *data) struct ldlm_namespace *ns; cfs_flock_t *getlk = lock->l_ast_data; struct ldlm_flock_wait_data fwd; - unsigned long irqflags; struct obd_device *obd; struct obd_import *imp = NULL; ldlm_error_t err; @@ -479,9 +478,9 @@ ldlm_flock_completion_ast(struct ldlm_lock *lock, int flags, void *data) imp = obd->u.cli.cl_import; if (imp != NULL) { - spin_lock_irqsave(&imp->imp_lock, irqflags); + spin_lock(&imp->imp_lock); fwd.fwd_generation = imp->imp_generation; - spin_unlock_irqrestore(&imp->imp_lock, irqflags); + spin_unlock(&imp->imp_lock); } lwi = LWI_TIMEOUT_INTR(0, NULL, ldlm_flock_interrupted_wait, &fwd); diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index bd07b57..a00f95c 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -523,7 +523,6 @@ int target_handle_connect(struct ptlrpc_request *req, svc_handler_t handler) struct list_head *p; char *str, *tmp; int rc = 0, abort_recovery; - unsigned long flags; struct obd_connect_data *data; int size[2] = { sizeof(struct ptlrpc_body), sizeof(*data) }; ENTRY; @@ -742,18 +741,18 @@ int target_handle_connect(struct ptlrpc_request *req, svc_handler_t handler) req->rq_export = export; - spin_lock_irqsave(&export->exp_lock, flags); + spin_lock(&export->exp_lock); if (export->exp_conn_cnt >= lustre_msg_get_conn_cnt(req->rq_reqmsg)) { CERROR("%s: %s already connected at higher conn_cnt: %d > %d\n", cluuid.uuid, libcfs_nid2str(req->rq_peer.nid), export->exp_conn_cnt, lustre_msg_get_conn_cnt(req->rq_reqmsg)); - spin_unlock_irqrestore(&export->exp_lock, flags); + spin_unlock(&export->exp_lock); GOTO(out, rc = -EALREADY); } export->exp_conn_cnt = lustre_msg_get_conn_cnt(req->rq_reqmsg); - spin_unlock_irqrestore(&export->exp_lock, flags); + spin_unlock(&export->exp_lock); /* request from liblustre? Don't evict it for not pinging. */ if (lustre_msg_get_op_flags(req->rq_reqmsg) & MSG_CONNECT_LIBCLIENT) { @@ -1325,7 +1324,6 @@ void target_send_reply(struct ptlrpc_request *req, int rc, int fail_id) { int netrc; - unsigned long flags; struct ptlrpc_reply_state *rs; struct obd_device *obd; struct obd_export *exp; @@ -1363,7 +1361,7 @@ target_send_reply(struct ptlrpc_request *req, int rc, int fail_id) rs->rs_transno = req->rq_transno; rs->rs_export = exp; - spin_lock_irqsave (&obd->obd_uncommitted_replies_lock, flags); + spin_lock(&obd->obd_uncommitted_replies_lock); if (rs->rs_transno > obd->obd_last_committed) { /* not committed already */ @@ -1376,11 +1374,11 @@ target_send_reply(struct ptlrpc_request *req, int rc, int fail_id) list_add_tail (&rs->rs_exp_list, &exp->exp_outstanding_replies); - spin_unlock_irqrestore (&exp->exp_lock, flags); + spin_unlock(&exp->exp_lock); netrc = target_send_reply_msg (req, rc, fail_id); - spin_lock_irqsave (&svc->srv_lock, flags); + spin_lock(&svc->srv_lock); svc->srv_n_difficult_replies++; @@ -1405,7 +1403,7 @@ target_send_reply(struct ptlrpc_request *req, int rc, int fail_id) rs->rs_scheduled = 0; /* allow notifier to schedule */ } - spin_unlock_irqrestore (&svc->srv_lock, flags); + spin_unlock(&svc->srv_lock); } int target_handle_ping(struct ptlrpc_request *req) diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index c07d3f4..7ad18b4 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -69,7 +69,7 @@ static inline unsigned int ldlm_get_rq_timeout(unsigned int ldlm_timeout, #ifdef __KERNEL__ /* w_l_spinlock protects both waiting_locks_list and expired_lock_thread */ -static spinlock_t waiting_locks_spinlock; +static spinlock_t waiting_locks_spinlock; /* BH lock (timer) */ static struct list_head waiting_locks_list; static cfs_timer_t waiting_locks_timer; diff --git a/lustre/ldlm/ldlm_request.c b/lustre/ldlm/ldlm_request.c index 2cbd590..fdc9399 100644 --- a/lustre/ldlm/ldlm_request.c +++ b/lustre/ldlm/ldlm_request.c @@ -84,7 +84,6 @@ int ldlm_completion_ast(struct ldlm_lock *lock, int flags, void *data) { /* XXX ALLOCATE - 160 bytes */ struct lock_wait_data lwd; - unsigned long irqflags; struct obd_device *obd; struct obd_import *imp = NULL; struct l_wait_info lwi; @@ -127,9 +126,9 @@ noreproc: } if (imp != NULL) { - spin_lock_irqsave(&imp->imp_lock, irqflags); + spin_lock(&imp->imp_lock); lwd.lwd_conn_cnt = imp->imp_conn_cnt; - spin_unlock_irqrestore(&imp->imp_lock, irqflags); + spin_unlock(&imp->imp_lock); } /* Go to sleep until the lock is granted or cancelled. */ diff --git a/lustre/liblustre/file.c b/lustre/liblustre/file.c index 1cf9841..c73f7af 100644 --- a/lustre/liblustre/file.c +++ b/lustre/liblustre/file.c @@ -78,10 +78,15 @@ void llu_prepare_mdc_op_data(struct mdc_op_data *data, int namelen, int mode) { - LASSERT(i1); - - ll_i2gids(data->suppgids, i1, i2); - ll_inode2fid(&data->fid1, i1); + LASSERT(i1 != NULL || i2 != NULL); + + if (i1) { + ll_i2gids(data->suppgids, i1, i2); + ll_inode2fid(&data->fid1, i1); + }else { + ll_i2gids(data->suppgids, i2, i1); + ll_inode2fid(&data->fid1, i2); + } if (i2) ll_inode2fid(&data->fid2, i2); @@ -109,10 +114,13 @@ void obdo_refresh_inode(struct inode *dst, if (valid & OBD_MD_FLATIME && src->o_atime > LTIME_S(st->st_atime)) LTIME_S(st->st_atime) = src->o_atime; - if (valid & OBD_MD_FLMTIME && src->o_mtime > LTIME_S(st->st_mtime)) - LTIME_S(st->st_mtime) = src->o_mtime; - if (valid & OBD_MD_FLCTIME && src->o_ctime > LTIME_S(st->st_ctime)) + if (valid & OBD_MD_FLCTIME && src->o_ctime > LTIME_S(st->st_ctime)) { LTIME_S(st->st_ctime) = src->o_ctime; + + /* mtime is always updated with ctime, but can be set in past */ + if (valid & OBD_MD_FLMTIME) + LTIME_S(st->st_mtime) = src->o_mtime; + } if (valid & OBD_MD_FLSIZE && src->o_size > st->st_size) st->st_size = src->o_size; /* optimum IO size */ @@ -123,7 +131,7 @@ void obdo_refresh_inode(struct inode *dst, st->st_blocks = src->o_blocks; } -static int llu_local_open(struct llu_inode_info *lli, struct lookup_intent *it) +int llu_local_open(struct llu_inode_info *lli, struct lookup_intent *it) { struct ptlrpc_request *req = it->d.lustre.it_data; struct ll_file_data *fd; @@ -355,7 +363,7 @@ int llu_mdc_close(struct obd_export *mdc_exp, struct inode *inode) RETURN(rc); } -static int llu_file_release(struct inode *inode) +int llu_file_release(struct inode *inode) { struct ll_file_data *fd; struct llu_sb_info *sbi = llu_i2sbi(inode); diff --git a/lustre/liblustre/namei.c b/lustre/liblustre/namei.c index a8c5418..f01f448 100644 --- a/lustre/liblustre/namei.c +++ b/lustre/liblustre/namei.c @@ -47,7 +47,7 @@ #include "llite_lib.h" -static void ll_intent_drop_lock(struct lookup_intent *it) +void ll_intent_drop_lock(struct lookup_intent *it) { struct lustre_handle *handle; @@ -63,7 +63,7 @@ static void ll_intent_drop_lock(struct lookup_intent *it) } } -static void ll_intent_release(struct lookup_intent *it) +void ll_intent_release(struct lookup_intent *it) { ENTRY; diff --git a/lustre/liblustre/super.c b/lustre/liblustre/super.c index 7b5ee32..40fe5db 100644 --- a/lustre/liblustre/super.c +++ b/lustre/liblustre/super.c @@ -148,15 +148,16 @@ void llu_update_inode(struct inode *inode, struct mds_body *body, if (body->valid & OBD_MD_FLID) st->st_ino = body->ino; - if (body->valid & OBD_MD_FLMTIME && - body->mtime > LTIME_S(st->st_mtime)) - LTIME_S(st->st_mtime) = body->mtime; if (body->valid & OBD_MD_FLATIME && body->atime > LTIME_S(st->st_atime)) LTIME_S(st->st_atime) = body->atime; if (body->valid & OBD_MD_FLCTIME && - body->ctime > LTIME_S(st->st_ctime)) + body->ctime > LTIME_S(st->st_ctime)) { LTIME_S(st->st_ctime) = body->ctime; + /* mtime is always changed with ctime, but can be set in past */ + if (body->valid & OBD_MD_FLMTIME) + LTIME_S(st->st_mtime) = body->mtime; + } if (body->valid & OBD_MD_FLMODE) st->st_mode = (st->st_mode & S_IFMT)|(body->mode & ~S_IFMT); if (body->valid & OBD_MD_FLTYPE) @@ -665,6 +666,16 @@ int llu_setattr_raw(struct inode *inode, struct iattr *attr) attr->ia_mtime = CURRENT_TIME; attr->ia_valid |= ATTR_MTIME_SET; } + if ((attr->ia_valid & ATTR_CTIME) && !(attr->ia_valid & ATTR_MTIME)) { + /* To avoid stale mtime on mds, obtain it from ost and send + to mds. */ + rc = llu_glimpse_size(inode); + if (rc) + RETURN(rc); + + attr->ia_valid |= ATTR_MTIME_SET | ATTR_MTIME; + attr->ia_mtime = inode->i_stbuf.st_mtime; + } if (attr->ia_valid & (ATTR_MTIME | ATTR_CTIME)) CDEBUG(D_INODE, "setting mtime %lu, ctime %lu, now = %lu\n", @@ -1589,6 +1600,170 @@ static int llu_put_grouplock(struct inode *inode, unsigned long arg) RETURN(0); } +static int llu_lov_dir_setstripe(struct inode *ino, unsigned long arg) +{ + struct llu_sb_info *sbi = llu_i2sbi(ino); + struct ptlrpc_request *request = NULL; + struct mdc_op_data op_data; + struct iattr attr = { 0 }; + struct lov_user_md lum, *lump = (struct lov_user_md *)arg; + int rc = 0; + + llu_prepare_mdc_op_data(&op_data, ino, NULL, NULL, 0, 0); + + LASSERT(sizeof(lum) == sizeof(*lump)); + LASSERT(sizeof(lum.lmm_objects[0]) == + sizeof(lump->lmm_objects[0])); + rc = copy_from_user(&lum, lump, sizeof(lum)); + if (rc) + return(-EFAULT); + + if (lum.lmm_magic != LOV_USER_MAGIC) + RETURN(-EINVAL); + + if (lum.lmm_magic != cpu_to_le32(LOV_USER_MAGIC)) + lustre_swab_lov_user_md(&lum); + + /* swabbing is done in lov_setstripe() on server side */ + rc = mdc_setattr(sbi->ll_mdc_exp, &op_data, + &attr, &lum, sizeof(lum), NULL, 0, &request); + if (rc) { + ptlrpc_req_finished(request); + if (rc != -EPERM && rc != -EACCES) + CERROR("mdc_setattr fails: rc = %d\n", rc); + return rc; + } + ptlrpc_req_finished(request); + + return rc; +} + +static int llu_lov_setstripe_ea_info(struct inode *ino, int flags, + struct lov_user_md *lum, int lum_size) +{ + struct llu_sb_info *sbi = llu_i2sbi(ino); + struct obd_export *exp = llu_i2obdexp(ino); + struct llu_inode_info *lli = llu_i2info(ino); + struct llu_inode_info *lli2 = NULL; + struct lov_stripe_md *lsm; + struct lookup_intent oit = {.it_op = IT_OPEN, .it_flags = flags}; + struct ptlrpc_request *req = NULL; + struct lustre_md md; + struct mdc_op_data data; + struct lustre_handle lockh; + struct ldlm_lock *lock = NULL; + int rc = 0; + ENTRY; + + lsm = lli->lli_smd; + if (lsm) { + CDEBUG(D_IOCTL, "stripe already exists for ino %llu\n", + lli->lli_fid.id); + return -EEXIST; + } + + OBD_ALLOC(lli2, sizeof(struct llu_inode_info)); + if (!lli2) + return -ENOMEM; + + memcpy(lli2, lli, sizeof(struct llu_inode_info)); + lli2->lli_open_count = 0; + lli2->lli_it = NULL; + lli2->lli_file_data = NULL; + lli2->lli_smd = NULL; + lli2->lli_symlink_name = NULL; + ino->i_private = lli2; + + llu_prepare_mdc_op_data(&data, NULL, ino, NULL, 0, O_RDWR); + + rc = mdc_enqueue(sbi->ll_mdc_exp, LDLM_IBITS, &oit, LCK_CR, &data, + &lockh, lum, lum_size, ldlm_completion_ast, + llu_mdc_blocking_ast, NULL, LDLM_FL_INTENT_ONLY); + if (rc) + GOTO(out, rc); + + req = oit.d.lustre.it_data; + rc = it_open_error(DISP_IT_EXECD, &oit); + if (rc) { + req->rq_replay = 0; + GOTO(out, rc); + } + + rc = it_open_error(DISP_OPEN_OPEN, &oit); + if (rc) { + req->rq_replay = 0; + GOTO(out, rc); + } + + rc = mdc_req2lustre_md(req, 1, exp, &md); + if (rc) + GOTO(out, rc); + + llu_update_inode(ino, md.body, md.lsm); + lli->lli_smd = lli2->lli_smd; + lli2->lli_smd = NULL; + + llu_local_open(lli2, &oit); + + /* release intent */ + lock = __ldlm_handle2lock(&lockh, 0); + if (lock) { + lock->l_flags |= LDLM_FL_LOCAL_ONLY; + ldlm_lock_decref_internal(lock, LCK_CR); + LDLM_LOCK_PUT(lock); + } + ptlrpc_req_finished(req); + req = NULL; + + rc = llu_file_release(ino); + out: + ino->i_private = lli; + if (lli2) + OBD_FREE(lli2, sizeof(struct llu_inode_info)); + if (req != NULL) + ptlrpc_req_finished(req); + RETURN(rc); +} + +static int llu_lov_file_setstripe(struct inode *ino, unsigned long arg) +{ + struct lov_user_md lum, *lump = (struct lov_user_md *)arg; + int rc; + int flags = FMODE_WRITE; + ENTRY; + + LASSERT(sizeof(lum) == sizeof(*lump)); + LASSERT(sizeof(lum.lmm_objects[0]) == sizeof(lump->lmm_objects[0])); + rc = copy_from_user(&lum, lump, sizeof(lum)); + if (rc) + RETURN(-EFAULT); + + rc = llu_lov_setstripe_ea_info(ino, flags, &lum, sizeof(lum)); + RETURN(rc); +} + +static int llu_lov_setstripe(struct inode *ino, unsigned long arg) +{ + struct intnl_stat *st = llu_i2stat(ino); + if (S_ISREG(st->st_mode)) + return llu_lov_file_setstripe(ino, arg); + if (S_ISDIR(st->st_mode)) + return llu_lov_dir_setstripe(ino, arg); + + return -EINVAL; +} + +static int llu_lov_getstripe(struct inode *ino, unsigned long arg) +{ + struct lov_stripe_md *lsm = llu_i2info(ino)->lli_smd; + + if (!lsm) + RETURN(-ENODATA); + + return obd_iocontrol(LL_IOC_LOV_GETSTRIPE, llu_i2obdexp(ino), 0, lsm, + (void *)arg); +} + static int llu_iop_ioctl(struct inode *ino, unsigned long int request, va_list ap) { @@ -1606,6 +1781,14 @@ static int llu_iop_ioctl(struct inode *ino, unsigned long int request, arg = va_arg(ap, unsigned long); rc = llu_put_grouplock(ino, arg); break; + case LL_IOC_LOV_SETSTRIPE: + arg = va_arg(ap, unsigned long); + rc = llu_lov_setstripe(ino, arg); + break; + case LL_IOC_LOV_GETSTRIPE: + arg = va_arg(ap, unsigned long); + rc = llu_lov_getstripe(ino, arg); + break; default: CERROR("did not support ioctl cmd %lx\n", request); rc = -ENOSYS; diff --git a/lustre/liblustre/tests/Makefile.am b/lustre/liblustre/tests/Makefile.am index 650cd96..9ed59aa 100644 --- a/lustre/liblustre/tests/Makefile.am +++ b/lustre/liblustre/tests/Makefile.am @@ -4,7 +4,7 @@ AM_CPPFLAGS = -I$(SYSIO)/include -I/opt/lam/include $(LLCPPFLAGS) -I$(top_srcdir AM_CFLAGS = $(LLCFLAGS) AM_LIBS = $(LIBEFENCE) $(LIBREADLINE) -LLIB_EXEC= $(top_builddir)/lustre/liblustre/liblustre.a $(CAP_LIBS) $(PTHREAD_LIBS) +LLIB_EXEC = $(top_builddir)/lustre/utils/liblustreapi.a $(top_builddir)/lustre/liblustre/liblustre.a $(CAP_LIBS) $(PTHREAD_LIBS) if LIBLUSTRE noinst_LIBRARIES = libtestcommon.a diff --git a/lustre/liblustre/tests/sanity.c b/lustre/liblustre/tests/sanity.c index 4c41ede..5c918ad 100644 --- a/lustre/liblustre/tests/sanity.c +++ b/lustre/liblustre/tests/sanity.c @@ -40,6 +40,8 @@ #include #include "test_common.h" +#include +#include #ifndef PAGE_SIZE #define PAGE_SIZE getpagesize() @@ -1156,6 +1158,170 @@ int t54(char *name) LEAVE(); } +/* for O_DIRECTORY */ +#define _GNU_SOURCE + +#define STRIPE_SIZE (2048 * 2048) +#define STRIPE_OFFSET 0 +#define STRIPE_COUNT 1 +int t55(char *name) +{ + char path[MAX_PATH_LENGTH] = ""; + char file[MAX_PATH_LENGTH] = ""; + struct lov_user_md *lum = NULL; + struct lov_user_ost_data *lo = NULL; + int index, fd, buflen, rc; + + ENTRY("setstripe/getstripe"); + snprintf(path, MAX_PATH_LENGTH, "%s/test_t55", lustre_path); + snprintf(file, MAX_PATH_LENGTH, "%s/test_t55/file_t55", lustre_path); + + buflen = sizeof(struct lov_user_md); + buflen += STRIPE_COUNT * sizeof(struct lov_user_ost_data); + lum = (struct lov_user_md *)malloc(buflen); + if (!lum) { + printf("out of memory!\n"); + return -1; + } + memset(lum, 0, buflen); + + t_mkdir(path); + rc = llapi_file_create(path, STRIPE_SIZE, STRIPE_OFFSET, + STRIPE_COUNT, LOV_PATTERN_RAID0); + if (rc) { + printf("llapi_file_create failed: rc = %d (%s) \n", + rc, strerror(-rc)); + t_rmdir(path); + free(lum); + return -1; + } + + fd = open(file, O_CREAT | O_RDWR, 0644); + if (fd < 0) { + printf("open file(%s) failed: rc = %d (%s) \n)", + file, fd, strerror(errno)); + t_rmdir(path); + free(lum); + return -1; + } + + lum->lmm_magic = LOV_USER_MAGIC; + lum->lmm_stripe_count = STRIPE_COUNT; + rc = ioctl(fd, LL_IOC_LOV_GETSTRIPE, lum); + if (rc) { + printf("dir:ioctl(LL_IOC_LOV_GETSTRIPE) failed: rc = %d(%s)\n", + rc, strerror(errno)); + close(fd); + t_unlink(file); + t_rmdir(path); + free(lum); + return -1; + } + + close(fd); + + if (opt_verbose) { + printf("lmm_magic: 0x%08X\n", lum->lmm_magic); + printf("lmm_object_id: "LPX64"\n", lum->lmm_object_id); + printf("lmm_object_gr: "LPX64"\n", lum->lmm_object_gr); + printf("lmm_stripe_count: %u\n", (int)lum->lmm_stripe_count); + printf("lmm_stripe_size: %u\n", lum->lmm_stripe_size); + printf("lmm_stripe_pattern: %x\n", lum->lmm_pattern); + + for (index = 0; index < lum->lmm_stripe_count; index++) { + lo = lum->lmm_objects + index; + printf("object %d:\n", index); + printf("\tobject_gr: "LPX64"\n", lo->l_object_gr); + printf("\tobject_id: "LPX64"\n", lo->l_object_id); + printf("\tost_gen: "LPX64"\n", lo->l_ost_gen); + printf("\tost_idx: %u\n", lo->l_ost_idx); + } + } + + if (lum->lmm_magic != LOV_USER_MAGIC || + lum->lmm_pattern != LOV_PATTERN_RAID0 || + lum->lmm_stripe_size != STRIPE_SIZE || + lum->lmm_objects[0].l_ost_idx != STRIPE_OFFSET || + lum->lmm_stripe_count != STRIPE_COUNT) { + printf("incorrect striping information!\n"); + t_unlink(file); + t_rmdir(path); + free(lum); + return -1; + } + t_unlink(file); + + /* setstripe on regular file */ + rc = llapi_file_create(file, STRIPE_SIZE, STRIPE_OFFSET, + STRIPE_COUNT, LOV_PATTERN_RAID0); + if (rc) { + printf("llapi_file_create failed: rc = %d (%s) \n", + rc, strerror(-rc)); + t_unlink(file); + t_rmdir(path); + free(lum); + return -1; + } + fd = open(file, O_RDWR, 0644); + if (fd < 0) { + printf("failed to open(%s): rc = %d (%s)\n", + file, fd, strerror(errno)); + t_unlink(file); + t_rmdir(path); + free(lum); + return -1; + } + + lum->lmm_magic = LOV_USER_MAGIC; + lum->lmm_stripe_count = STRIPE_COUNT; + rc = ioctl(fd, LL_IOC_LOV_GETSTRIPE, lum); + if (rc) { + printf("file:ioctl(LL_IOC_LOV_GETSTRIPE) failed: rc = %d(%s)\n", + rc, strerror(errno)); + close(fd); + t_unlink(file); + t_rmdir(path); + free(lum); + return -1; + } + close(fd); + + if (opt_verbose) { + printf("lmm_magic: 0x%08X\n", lum->lmm_magic); + printf("lmm_object_id: "LPX64"\n", lum->lmm_object_id); + printf("lmm_object_gr: "LPX64"\n", lum->lmm_object_gr); + printf("lmm_stripe_count: %u\n", (int)lum->lmm_stripe_count); + printf("lmm_stripe_size: %u\n", lum->lmm_stripe_size); + printf("lmm_stripe_pattern: %x\n", lum->lmm_pattern); + + for (index = 0; index < lum->lmm_stripe_count; index++) { + lo = lum->lmm_objects + index; + printf("object %d:\n", index); + printf("\tobject_gr: "LPX64"\n", lo->l_object_gr); + printf("\tobject_id: "LPX64"\n", lo->l_object_id); + printf("\tost_gen: "LPX64"\n", lo->l_ost_gen); + printf("\tost_idx: %u\n", lo->l_ost_idx); + } + } + + if (lum->lmm_magic != LOV_USER_MAGIC || + lum->lmm_pattern != LOV_PATTERN_RAID0 || + lum->lmm_stripe_size != STRIPE_SIZE || + lum->lmm_objects[0].l_ost_idx != STRIPE_OFFSET || + lum->lmm_stripe_count != STRIPE_COUNT) { + printf("incorrect striping information!\n"); + t_unlink(file); + t_rmdir(path); + free(lum); + return -1; + } + + t_unlink(file); + t_rmdir(path); + free(lum); + LEAVE(); +} + extern void __liblustre_setup_(void); extern void __liblustre_cleanup_(void); @@ -1202,6 +1368,7 @@ struct testlist { { t51, "51" }, { t53, "53" }, { t54, "54" }, + { t55, "55" }, { NULL, NULL } }; diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index fa33fce..723db1f 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -1169,6 +1169,16 @@ int ll_setattr_raw(struct inode *inode, struct iattr *attr) attr->ia_mtime = CURRENT_TIME; attr->ia_valid |= ATTR_MTIME_SET; } + if ((attr->ia_valid & ATTR_CTIME) && !(attr->ia_valid & ATTR_MTIME)) { + /* To avoid stale mtime on mds, obtain it from ost and send + to mds. */ + rc = ll_glimpse_size(inode, 0); + if (rc) + RETURN(rc); + + attr->ia_valid |= ATTR_MTIME_SET | ATTR_MTIME; + attr->ia_mtime = inode->i_mtime; + } if (attr->ia_valid & (ATTR_MTIME | ATTR_CTIME)) CDEBUG(D_INODE, "setting mtime %lu, ctime %lu, now = %lu\n", @@ -1533,15 +1543,17 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md) if (body->valid & OBD_MD_FLATIME && body->atime > LTIME_S(inode->i_atime)) LTIME_S(inode->i_atime) = body->atime; - if (body->valid & OBD_MD_FLMTIME && - body->mtime > LTIME_S(inode->i_mtime)) { - CDEBUG(D_INODE, "setting ino %lu mtime from %lu to "LPU64"\n", - inode->i_ino, LTIME_S(inode->i_mtime), body->mtime); - LTIME_S(inode->i_mtime) = body->mtime; - } if (body->valid & OBD_MD_FLCTIME && - body->ctime > LTIME_S(inode->i_ctime)) + body->ctime > LTIME_S(inode->i_ctime)) { LTIME_S(inode->i_ctime) = body->ctime; + /* mtime is always updated with ctime, but can be set in past */ + if (body->valid & OBD_MD_FLMTIME) { + CDEBUG(D_INODE, "setting ino %lu mtime " + "from %lu to "LPU64"\n", inode->i_ino, + LTIME_S(inode->i_mtime), body->mtime); + LTIME_S(inode->i_mtime) = body->mtime; + } + } if (body->valid & OBD_MD_FLMODE) inode->i_mode = (inode->i_mode & S_IFMT)|(body->mode & ~S_IFMT); if (body->valid & OBD_MD_FLTYPE) diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index 26a71df..fbe44f3 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -766,15 +766,18 @@ static void ll_update_times(struct ptlrpc_request *request, int offset, sizeof(*body)); LASSERT(body); - if (body->valid & OBD_MD_FLMTIME && - body->mtime > LTIME_S(inode->i_mtime)) { - CDEBUG(D_INODE, "setting ino %lu mtime from %lu to "LPU64"\n", - inode->i_ino, LTIME_S(inode->i_mtime), body->mtime); - LTIME_S(inode->i_mtime) = body->mtime; - } if (body->valid & OBD_MD_FLCTIME && - body->ctime > LTIME_S(inode->i_ctime)) + body->ctime > LTIME_S(inode->i_ctime)) { LTIME_S(inode->i_ctime) = body->ctime; + + /* mtime is always updated with ctime, but can be set in past */ + if (body->valid & OBD_MD_FLMTIME) { + CDEBUG(D_INODE, "setting ino %lu mtime from %lu " + "to "LPU64"\n", inode->i_ino, + LTIME_S(inode->i_mtime), body->mtime); + LTIME_S(inode->i_mtime) = body->mtime; + } + } } static int ll_mknod_generic(struct inode *dir, struct qstr *name, int mode, diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index 3582dbf..c3ba989 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -1405,7 +1405,6 @@ int ll_readpage(struct file *filp, struct page *page) ll_truncate_complete_page(page); clear_page(page); SetPageUptodate(page); - unlock_page(page); RETURN(0); } diff --git a/lustre/lov/lov_merge.c b/lustre/lov/lov_merge.c index d73e231..1dbc6c6 100644 --- a/lustre/lov/lov_merge.c +++ b/lustre/lov/lov_merge.c @@ -76,12 +76,14 @@ int lov_merge_lvb(struct obd_export *exp, struct lov_stripe_md *lsm, size = lov_size; /* merge blocks, mtime, atime */ blocks += loi->loi_lvb.lvb_blocks; - if (loi->loi_lvb.lvb_mtime > current_mtime) - current_mtime = loi->loi_lvb.lvb_mtime; if (loi->loi_lvb.lvb_atime > current_atime) current_atime = loi->loi_lvb.lvb_atime; - if (loi->loi_lvb.lvb_ctime > current_ctime) + if (loi->loi_lvb.lvb_ctime > current_ctime) { current_ctime = loi->loi_lvb.lvb_ctime; + /* mtime is always updated with ctime, but can be set + in past. */ + current_mtime = loi->loi_lvb.lvb_mtime; + } } lvb->lvb_size = size; @@ -151,10 +153,14 @@ void lov_merge_attrs(struct obdo *tgt, struct obdo *src, obd_flag valid, tgt->o_blocks += src->o_blocks; if (valid & OBD_MD_FLBLKSZ) tgt->o_blksize += src->o_blksize; - if (valid & OBD_MD_FLCTIME && tgt->o_ctime < src->o_ctime) + if (valid & OBD_MD_FLCTIME && tgt->o_ctime < src->o_ctime) { tgt->o_ctime = src->o_ctime; - if (valid & OBD_MD_FLMTIME && tgt->o_mtime < src->o_mtime) - tgt->o_mtime = src->o_mtime; + + /* mtime is always updated with ctime, but can be set + in past. */ + if (valid & OBD_MD_FLMTIME) + tgt->o_mtime = src->o_mtime; + } } else { memcpy(tgt, src, sizeof(*tgt)); tgt->o_id = lsm->lsm_object_id; diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index 6c6da21..c93618c 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -2237,15 +2237,18 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len, RETURN(err); } else if (err) { if (lov->tgts[i].ltd_active) { - CERROR("error: iocontrol OSC %s on OST " + CDEBUG(err == -ENOTTY ? + D_IOCTL : D_WARNING, + "iocontrol OSC %s on OST " "idx %d cmd %x: err = %d\n", obd_uuid2str(&lov->tgts[i].ltd_uuid), i, cmd, err); if (!rc) rc = err; } - } else + } else { set = 1; + } } if (!set && !rc) rc = -EIO; @@ -2519,7 +2522,6 @@ int lov_complete_many(struct obd_export *exp, struct lov_stripe_md *lsm, i++, loi++, lov_lockhp++) { struct ldlm_lock *lock; struct obd_device *obd; - unsigned long irqflags; lock = ldlm_handle2lock(lov_lockhp); if (lock == NULL) { @@ -2537,9 +2539,9 @@ int lov_complete_many(struct obd_export *exp, struct lov_stripe_md *lsm, if (obd != NULL) imp = obd->u.cli.cl_import; if (imp != NULL) { - spin_lock_irqsave(&imp->imp_lock, irqflags); + spin_lock(&imp->imp_lock); queues[i].generation = imp->imp_generation; - spin_unlock_irqrestore(&imp->imp_lock, irqflags); + spin_unlock(&imp->imp_lock); } } diff --git a/lustre/mdc/mdc_lib.c b/lustre/mdc/mdc_lib.c index acfb08d..2c4217e 100644 --- a/lustre/mdc/mdc_lib.c +++ b/lustre/mdc/mdc_lib.c @@ -166,6 +166,10 @@ void mdc_open_pack(struct ptlrpc_request *req, int offset, if (lmm) { rec->cr_flags |= MDS_OPEN_HAS_EA; +#ifndef __KERNEL__ + /*XXX a hack for liblustre to set EA (LL_IOC_LOV_SETSTRIPE) */ + rec->cr_replayfid = op_data->fid2; +#endif tmp = lustre_msg_buf(req->rq_reqmsg, offset + 2, lmmlen); memcpy (tmp, lmm, lmmlen); } diff --git a/lustre/mdc/mdc_locks.c b/lustre/mdc/mdc_locks.c index 3f40342..165b434 100644 --- a/lustre/mdc/mdc_locks.c +++ b/lustre/mdc/mdc_locks.c @@ -163,10 +163,9 @@ static inline void mdc_clear_replay_flag(struct ptlrpc_request *req, int rc) { /* Don't hold error requests for replay. */ if (req->rq_replay) { - unsigned long irqflags; - spin_lock_irqsave(&req->rq_lock, irqflags); + spin_lock(&req->rq_lock); req->rq_replay = 0; - spin_unlock_irqrestore(&req->rq_lock, irqflags); + spin_unlock(&req->rq_lock); } if (rc && req->rq_transno != 0) { DEBUG_REQ(D_ERROR, req, "transno returned on error rc %d", rc); @@ -209,7 +208,6 @@ static void mdc_realloc_openmsg(struct ptlrpc_request *req, OBD_ALLOC(new_msg, new_size); if (new_msg != NULL) { struct lustre_msg *old_msg = req->rq_reqmsg; - unsigned long irqflags; DEBUG_REQ(D_INFO, req, "replace reqmsg for larger EA %u\n", body->eadatasize); @@ -217,10 +215,10 @@ static void mdc_realloc_openmsg(struct ptlrpc_request *req, lustre_msg_set_buflen(new_msg, DLM_INTENT_REC_OFF + 2, body->eadatasize); - spin_lock_irqsave(&req->rq_lock, irqflags); + spin_lock(&req->rq_lock); req->rq_reqmsg = new_msg; req->rq_reqlen = new_size; - spin_unlock_irqrestore(&req->rq_lock, irqflags); + spin_unlock(&req->rq_lock); OBD_FREE(old_msg, old_size); } else { @@ -262,7 +260,6 @@ int mdc_enqueue(struct obd_export *exp, int flags = extra_lock_flags | LDLM_FL_HAS_INTENT; int repbufcnt = 4, rc; void *eadata; - unsigned long irqflags; ENTRY; LASSERTF(lock_type == LDLM_IBITS, "lock type %d\n", lock_type); @@ -315,9 +312,9 @@ int mdc_enqueue(struct obd_export *exp, if (!req) RETURN(-ENOMEM); - spin_lock_irqsave (&req->rq_lock, irqflags); + spin_lock(&req->rq_lock); req->rq_replay = 1; - spin_unlock_irqrestore (&req->rq_lock, irqflags); + spin_unlock(&req->rq_lock); /* pack the intent */ lit = lustre_msg_buf(req->rq_reqmsg, DLM_INTENT_IT_OFF, diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index b19582c..d075c58 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -436,7 +436,6 @@ static int mds_destroy_export(struct obd_export *export) static int mds_disconnect(struct obd_export *exp) { - unsigned long irqflags; int rc; ENTRY; @@ -448,7 +447,7 @@ static int mds_disconnect(struct obd_export *exp) ldlm_cancel_locks_for_export(exp); /* complete all outstanding replies */ - spin_lock_irqsave(&exp->exp_lock, irqflags); + spin_lock(&exp->exp_lock); while (!list_empty(&exp->exp_outstanding_replies)) { struct ptlrpc_reply_state *rs = list_entry(exp->exp_outstanding_replies.next, @@ -460,7 +459,7 @@ static int mds_disconnect(struct obd_export *exp) ptlrpc_schedule_difficult_reply(rs); spin_unlock(&svc->srv_lock); } - spin_unlock_irqrestore(&exp->exp_lock, irqflags); + spin_unlock(&exp->exp_lock); class_export_put(exp); RETURN(rc); diff --git a/lustre/mds/mds_join.c b/lustre/mds/mds_join.c index a566a5d..d0bb7f2 100644 --- a/lustre/mds/mds_join.c +++ b/lustre/mds/mds_join.c @@ -387,8 +387,8 @@ int mds_join_file(struct mds_update_record *rec, struct ptlrpc_request *req, if (rc < 0) GOTO(cleanup, rc); - LASSERTF(le32_to_cpu(head_lmm->lmm_magic) == LOV_MAGIC_JOIN || - le32_to_cpu(head_lmm->lmm_magic) == LOV_MAGIC); + LASSERT(le32_to_cpu(head_lmm->lmm_magic) == LOV_MAGIC_JOIN || + le32_to_cpu(head_lmm->lmm_magic) == LOV_MAGIC); push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); ctxt = llog_get_context(obd, LLOG_LOVEA_ORIG_CTXT); diff --git a/lustre/mds/mds_open.c b/lustre/mds/mds_open.c index c9be921..8aef1c0 100644 --- a/lustre/mds/mds_open.c +++ b/lustre/mds/mds_open.c @@ -903,8 +903,10 @@ int mds_open(struct mds_update_record *rec, int offset, /* Step 0: If we are passed a fid, then we assume the client already * opened this file and is only replaying the RPC, so we open the * inode by fid (at some large expense in security). */ - if (lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY && - !(rec->ur_flags & MDS_OPEN_JOIN_FILE)) { + /*XXX liblustre use mds_open_by_fid to implement LL_IOC_LOV_SETSTRIPE */ + if ((lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY || + (req->rq_export->exp_libclient && rec->ur_flags & MDS_OPEN_HAS_EA)) + && !(rec->ur_flags & MDS_OPEN_JOIN_FILE)) { if (rec->ur_fid2->id == 0) { struct ldlm_lock *lock = ldlm_handle2lock(child_lockh); if (lock) { diff --git a/lustre/mds/mds_reint.c b/lustre/mds/mds_reint.c index 48e9d2b..0c43666 100644 --- a/lustre/mds/mds_reint.c +++ b/lustre/mds/mds_reint.c @@ -316,11 +316,10 @@ void mds_steal_ack_locks(struct ptlrpc_request *req) struct list_head *tmp; struct ptlrpc_reply_state *oldrep; struct ptlrpc_service *svc; - unsigned long flags; int i; /* CAVEAT EMPTOR: spinlock order */ - spin_lock_irqsave (&exp->exp_lock, flags); + spin_lock(&exp->exp_lock); list_for_each (tmp, &exp->exp_outstanding_replies) { oldrep = list_entry(tmp, struct ptlrpc_reply_state,rs_exp_list); @@ -358,7 +357,7 @@ void mds_steal_ack_locks(struct ptlrpc_request *req) spin_unlock (&svc->srv_lock); break; } - spin_unlock_irqrestore (&exp->exp_lock, flags); + spin_unlock(&exp->exp_lock); } void mds_req_from_mcd(struct ptlrpc_request *req, struct mds_client_data *mcd) @@ -444,10 +443,9 @@ int mds_osc_setattr_async(struct obd_device *obd, struct inode *inode, } /* then fill oa */ + obdo_from_inode(oinfo.oi_oa, inode, OBD_MD_FLUID | OBD_MD_FLGID); + oinfo.oi_oa->o_valid |= OBD_MD_FLID; oinfo.oi_oa->o_id = oinfo.oi_md->lsm_object_id; - oinfo.oi_oa->o_uid = inode->i_uid; - oinfo.oi_oa->o_gid = inode->i_gid; - oinfo.oi_oa->o_valid = OBD_MD_FLID | OBD_MD_FLUID | OBD_MD_FLGID; if (logcookies) { oinfo.oi_oa->o_valid |= OBD_MD_FLCOOKIE; oti.oti_logcookies = logcookies; diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index f58f817..dd0a39d 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -970,13 +970,12 @@ EXPORT_SYMBOL(oig_release); void oig_add_one(struct obd_io_group *oig, struct oig_callback_context *occ) { - unsigned long flags; CDEBUG(D_CACHE, "oig %p ready to roll\n", oig); - spin_lock_irqsave(&oig->oig_lock, flags); + spin_lock(&oig->oig_lock); oig->oig_pending++; if (occ != NULL) list_add_tail(&occ->occ_oig_item, &oig->oig_occ_list); - spin_unlock_irqrestore(&oig->oig_lock, flags); + spin_unlock(&oig->oig_lock); oig_grab(oig); } EXPORT_SYMBOL(oig_add_one); @@ -984,11 +983,10 @@ EXPORT_SYMBOL(oig_add_one); void oig_complete_one(struct obd_io_group *oig, struct oig_callback_context *occ, int rc) { - unsigned long flags; cfs_waitq_t *wake = NULL; int old_rc; - spin_lock_irqsave(&oig->oig_lock, flags); + spin_lock(&oig->oig_lock); if (occ != NULL) list_del_init(&occ->occ_oig_item); @@ -1000,7 +998,7 @@ void oig_complete_one(struct obd_io_group *oig, if (--oig->oig_pending <= 0) wake = &oig->oig_waitq; - spin_unlock_irqrestore(&oig->oig_lock, flags); + spin_unlock(&oig->oig_lock); CDEBUG(D_CACHE, "oig %p completed, rc %d -> %d via %d, %d now " "pending (racey)\n", oig, old_rc, oig->oig_rc, rc, @@ -1013,12 +1011,11 @@ EXPORT_SYMBOL(oig_complete_one); static int oig_done(struct obd_io_group *oig) { - unsigned long flags; int rc = 0; - spin_lock_irqsave(&oig->oig_lock, flags); + spin_lock(&oig->oig_lock); if (oig->oig_pending <= 0) rc = 1; - spin_unlock_irqrestore(&oig->oig_lock, flags); + spin_unlock(&oig->oig_lock); return rc; } @@ -1026,9 +1023,8 @@ static void interrupted_oig(void *data) { struct obd_io_group *oig = data; struct oig_callback_context *occ; - unsigned long flags; - spin_lock_irqsave(&oig->oig_lock, flags); + spin_lock(&oig->oig_lock); /* We need to restart the processing each time we drop the lock, as * it is possible other threads called oig_complete_one() to remove * an entry elsewhere in the list while we dropped lock. We need to @@ -1039,12 +1035,12 @@ restart: if (occ->interrupted) continue; occ->interrupted = 1; - spin_unlock_irqrestore(&oig->oig_lock, flags); + spin_unlock(&oig->oig_lock); occ->occ_interrupted(occ); - spin_lock_irqsave(&oig->oig_lock, flags); + spin_lock(&oig->oig_lock); goto restart; } - spin_unlock_irqrestore(&oig->oig_lock, flags); + spin_unlock(&oig->oig_lock); } int oig_wait(struct obd_io_group *oig) @@ -1075,12 +1071,11 @@ EXPORT_SYMBOL(oig_wait); void class_fail_export(struct obd_export *exp) { int rc, already_failed; - unsigned long flags; - spin_lock_irqsave(&exp->exp_lock, flags); + spin_lock(&exp->exp_lock); already_failed = exp->exp_failed; exp->exp_failed = 1; - spin_unlock_irqrestore(&exp->exp_lock, flags); + spin_unlock(&exp->exp_lock); if (already_failed) { CDEBUG(D_HA, "disconnecting dead export %p/%s; skipping\n", diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index 1ed08ae..5256ae7 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -911,14 +911,12 @@ EXPORT_SYMBOL(lprocfs_obd_seq_create); void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value) { - unsigned long flags; - if (value >= OBD_HIST_MAX) value = OBD_HIST_MAX - 1; - spin_lock_irqsave(&oh->oh_lock, flags); + spin_lock(&oh->oh_lock); oh->oh_buckets[value]++; - spin_unlock_irqrestore(&oh->oh_lock, flags); + spin_unlock(&oh->oh_lock); } EXPORT_SYMBOL(lprocfs_oh_tally); @@ -946,10 +944,9 @@ EXPORT_SYMBOL(lprocfs_oh_sum); void lprocfs_oh_clear(struct obd_histogram *oh) { - unsigned long flags; - spin_lock_irqsave(&oh->oh_lock, flags); + spin_lock(&oh->oh_lock); memset(oh->oh_buckets, 0, sizeof(oh->oh_buckets)); - spin_unlock_irqrestore(&oh->oh_lock, flags); + spin_unlock(&oh->oh_lock); } EXPORT_SYMBOL(lprocfs_oh_clear); diff --git a/lustre/obdecho/echo.c b/lustre/obdecho/echo.c index a4367a8..3ccac82 100644 --- a/lustre/obdecho/echo.c +++ b/lustre/obdecho/echo.c @@ -58,14 +58,12 @@ static int echo_connect(struct lustre_handle *conn, struct obd_device *obd, static int echo_disconnect(struct obd_export *exp) { - unsigned long irqflags; - LASSERT (exp != NULL); ldlm_cancel_locks_for_export(exp); /* complete all outstanding replies */ - spin_lock_irqsave(&exp->exp_lock, irqflags); + spin_lock(&exp->exp_lock); while (!list_empty(&exp->exp_outstanding_replies)) { struct ptlrpc_reply_state *rs = list_entry(exp->exp_outstanding_replies.next, @@ -77,7 +75,7 @@ static int echo_disconnect(struct obd_export *exp) ptlrpc_schedule_difficult_reply(rs); spin_unlock(&svc->srv_lock); } - spin_unlock_irqrestore(&exp->exp_lock, irqflags); + spin_unlock(&exp->exp_lock); return class_disconnect(exp); } diff --git a/lustre/obdecho/echo_client.c b/lustre/obdecho/echo_client.c index 159a459..001bc46 100644 --- a/lustre/obdecho/echo_client.c +++ b/lustre/obdecho/echo_client.c @@ -682,12 +682,12 @@ struct echo_async_state { static int eas_should_wake(struct echo_async_state *eas) { - unsigned long flags; int rc = 0; - spin_lock_irqsave(&eas->eas_lock, flags); + + spin_lock(&eas->eas_lock); if (eas->eas_rc == 0 && !list_empty(&eas->eas_avail)) rc = 1; - spin_unlock_irqrestore(&eas->eas_lock, flags); + spin_unlock(&eas->eas_lock); return rc; }; @@ -714,7 +714,6 @@ static int ec_ap_completion(void *data, int cmd, struct obdo *oa, int rc) { struct echo_async_page *eap = EAP_FROM_COOKIE(data); struct echo_async_state *eas; - unsigned long flags; eas = eap->eap_eas; @@ -726,13 +725,13 @@ static int ec_ap_completion(void *data, int cmd, struct obdo *oa, int rc) eas->eas_oa.o_id, eap->eap_off, CFS_PAGE_SIZE); - spin_lock_irqsave(&eas->eas_lock, flags); + spin_lock(&eas->eas_lock); if (rc && !eas->eas_rc) eas->eas_rc = rc; eas->eas_in_flight--; list_add(&eap->eap_item, &eas->eas_avail); cfs_waitq_signal(&eas->eas_waitq); - spin_unlock_irqrestore(&eas->eas_lock, flags); + spin_unlock(&eas->eas_lock); return 0; } @@ -752,7 +751,6 @@ static int echo_client_async_page(struct obd_export *exp, int rw, struct echo_async_page *eap; struct echo_async_state eas; int rc = 0; - unsigned long flags; struct echo_async_page **aps = NULL; ENTRY; @@ -813,15 +811,15 @@ static int echo_client_async_page(struct obd_export *exp, int rw, } /* first we spin queueing io and being woken by its completion */ - spin_lock_irqsave(&eas.eas_lock, flags); + spin_lock(&eas.eas_lock); for(;;) { int rc; /* sleep until we have a page to send */ - spin_unlock_irqrestore(&eas.eas_lock, flags); + spin_unlock(&eas.eas_lock); rc = wait_event_interruptible(eas.eas_waitq, eas_should_wake(&eas)); - spin_lock_irqsave(&eas.eas_lock, flags); + spin_lock(&eas.eas_lock); if (rc && !eas.eas_rc) eas.eas_rc = rc; if (eas.eas_rc) @@ -831,7 +829,7 @@ static int echo_client_async_page(struct obd_export *exp, int rw, eap = list_entry(eas.eas_avail.next, struct echo_async_page, eap_item); list_del(&eap->eap_item); - spin_unlock_irqrestore(&eas.eas_lock, flags); + spin_unlock(&eas.eas_lock); /* unbind the eap from its old page offset */ if (eap->eap_cookie != NULL) { @@ -847,7 +845,7 @@ static int echo_client_async_page(struct obd_export *exp, int rw, eap->eap_off, &ec_async_page_ops, eap, &eap->eap_cookie); if (rc) { - spin_lock_irqsave(&eas.eas_lock, flags); + spin_lock(&eas.eas_lock); eas.eas_rc = rc; break; } @@ -864,7 +862,7 @@ static int echo_client_async_page(struct obd_export *exp, int rw, rw, 0, CFS_PAGE_SIZE, 0, ASYNC_READY | ASYNC_URGENT | ASYNC_COUNT_STABLE); - spin_lock_irqsave(&eas.eas_lock, flags); + spin_lock(&eas.eas_lock); if (rc && !eas.eas_rc) { eas.eas_rc = rc; break; @@ -878,12 +876,12 @@ static int echo_client_async_page(struct obd_export *exp, int rw, /* now we just spin waiting for all the rpcs to complete */ while(eas.eas_in_flight) { - spin_unlock_irqrestore(&eas.eas_lock, flags); + spin_unlock(&eas.eas_lock); wait_event_interruptible(eas.eas_waitq, eas.eas_in_flight == 0); - spin_lock_irqsave(&eas.eas_lock, flags); + spin_lock(&eas.eas_lock); } - spin_unlock_irqrestore(&eas.eas_lock, flags); + spin_unlock(&eas.eas_lock); out: if (aps != NULL) { diff --git a/lustre/obdfilter/filter_io_26.c b/lustre/obdfilter/filter_io_26.c index 22d1f1b..e3aa1ca 100644 --- a/lustre/obdfilter/filter_io_26.c +++ b/lustre/obdfilter/filter_io_26.c @@ -59,7 +59,6 @@ struct filter_iobuf { static void record_start_io(struct filter_iobuf *iobuf, int rw, int size) { struct filter_obd *filter = iobuf->dr_filter; - unsigned long flags; atomic_inc(&iobuf->dr_numreqs); @@ -72,26 +71,26 @@ static void record_start_io(struct filter_iobuf *iobuf, int rw, int size) filter->fo_w_in_flight); lprocfs_oh_tally_log2(&filter->fo_w_disk_iosize, size); } - spin_lock_irqsave(&filter->fo_stats_lock, flags); + spin_lock(&filter->fo_stats_lock); if (rw == OBD_BRW_READ) filter->fo_r_in_flight++; else filter->fo_w_in_flight++; - spin_unlock_irqrestore(&filter->fo_stats_lock, flags); + spin_unlock(&filter->fo_stats_lock); iobuf->dr_start_time = jiffies; } static void record_finish_io(struct filter_iobuf *iobuf, int rw, int rc) { struct filter_obd *filter = iobuf->dr_filter; - unsigned long flags, stop_time = jiffies; + unsigned long stop_time = jiffies; - spin_lock_irqsave(&filter->fo_stats_lock, flags); + spin_lock(&filter->fo_stats_lock); if (rw == OBD_BRW_READ) filter->fo_r_in_flight--; else filter->fo_w_in_flight--; - spin_unlock_irqrestore(&filter->fo_stats_lock, flags); + spin_unlock(&filter->fo_stats_lock); if (atomic_dec_and_test(&iobuf->dr_numreqs)) wake_up(&iobuf->dr_wait); @@ -111,7 +110,6 @@ static void record_finish_io(struct filter_iobuf *iobuf, int rw, int rc) static int dio_complete_routine(struct bio *bio, unsigned int done, int error) { struct filter_iobuf *iobuf = bio->bi_private; - unsigned long flags; if (bio->bi_size) { CWARN("gets called against non-complete bio 0x%p: %d/%d/%d\n", @@ -137,10 +135,10 @@ static int dio_complete_routine(struct bio *bio, unsigned int done, int error) return 0; } - spin_lock_irqsave(&iobuf->dr_lock, flags); + spin_lock(&iobuf->dr_lock); if (iobuf->dr_error == 0) iobuf->dr_error = error; - spin_unlock_irqrestore(&iobuf->dr_lock, flags); + spin_unlock(&iobuf->dr_lock); record_finish_io(iobuf, test_bit(BIO_RW, &bio->bi_rw) ? OBD_BRW_WRITE : OBD_BRW_READ, error); diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index 230d065..d636621 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -471,12 +471,11 @@ void ptlrpc_set_add_req(struct ptlrpc_request_set *set, void ptlrpc_set_add_new_req(struct ptlrpc_request_set *set, struct ptlrpc_request *req) { - unsigned long flags; - spin_lock_irqsave(&set->set_new_req_lock, flags); + spin_lock(&set->set_new_req_lock); /* The set takes over the caller's request reference */ list_add_tail(&req->rq_set_chain, &set->set_new_requests); req->rq_set = set; - spin_unlock_irqrestore(&set->set_new_req_lock, flags); + spin_unlock(&set->set_new_req_lock); } /* @@ -530,12 +529,11 @@ static int ptlrpc_import_delay_req(struct obd_import *imp, static int ptlrpc_check_reply(struct ptlrpc_request *req) { - unsigned long flags; int rc = 0; ENTRY; /* serialise with network callback */ - spin_lock_irqsave(&req->rq_lock, flags); + spin_lock(&req->rq_lock); if (req->rq_replied) { DEBUG_REQ(D_NET, req, "REPLIED:"); @@ -543,9 +541,9 @@ static int ptlrpc_check_reply(struct ptlrpc_request *req) } if (req->rq_net_err && !req->rq_timedout) { - spin_unlock_irqrestore (&req->rq_lock, flags); + spin_unlock(&req->rq_lock); rc = ptlrpc_expire_one_request(req); - spin_lock_irqsave (&req->rq_lock, flags); + spin_lock(&req->rq_lock); GOTO(out, rc); } @@ -565,7 +563,7 @@ static int ptlrpc_check_reply(struct ptlrpc_request *req) } EXIT; out: - spin_unlock_irqrestore(&req->rq_lock, flags); + spin_unlock(&req->rq_lock); DEBUG_REQ(D_NET, req, "rc = %d for", rc); return rc; } @@ -594,7 +592,6 @@ static int ptlrpc_check_status(struct ptlrpc_request *req) static int after_reply(struct ptlrpc_request *req) { - unsigned long flags; struct obd_import *imp = req->rq_import; int rc; ENTRY; @@ -649,13 +646,13 @@ static int after_reply(struct ptlrpc_request *req) lustre_msg_set_transno(req->rq_reqmsg, req->rq_transno); if (req->rq_import->imp_replayable) { - spin_lock_irqsave(&imp->imp_lock, flags); + spin_lock(&imp->imp_lock); if (req->rq_transno != 0) ptlrpc_retain_replayable_request(req, imp); else if (req->rq_commit_cb != NULL) { - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); req->rq_commit_cb(req); - spin_lock_irqsave(&imp->imp_lock, flags); + spin_lock(&imp->imp_lock); } /* Replay-enabled imports return commit-status information. */ @@ -663,7 +660,7 @@ static int after_reply(struct ptlrpc_request *req) imp->imp_peer_committed_transno = lustre_msg_get_last_committed(req->rq_repmsg); ptlrpc_free_committed(imp); - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); } RETURN(rc); @@ -672,7 +669,6 @@ static int after_reply(struct ptlrpc_request *req) static int ptlrpc_send_new_req(struct ptlrpc_request *req) { struct obd_import *imp; - unsigned long flags; int rc; ENTRY; @@ -680,7 +676,7 @@ static int ptlrpc_send_new_req(struct ptlrpc_request *req) req->rq_phase = RQ_PHASE_RPC; imp = req->rq_import; - spin_lock_irqsave(&imp->imp_lock, flags); + spin_lock(&imp->imp_lock); req->rq_import_generation = imp->imp_generation; @@ -697,12 +693,12 @@ static int ptlrpc_send_new_req(struct ptlrpc_request *req) LASSERT(list_empty (&req->rq_list)); list_add_tail(&req->rq_list, &imp->imp_delayed_list); - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); RETURN(0); } if (rc != 0) { - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); req->rq_status = rc; req->rq_phase = RQ_PHASE_INTERPRET; RETURN(rc); @@ -711,7 +707,7 @@ static int ptlrpc_send_new_req(struct ptlrpc_request *req) /* XXX this is the same as ptlrpc_queue_wait */ LASSERT(list_empty(&req->rq_list)); list_add_tail(&req->rq_list, &imp->imp_sending_list); - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); lustre_msg_set_status(req->rq_reqmsg, cfs_curproc_pid()); CDEBUG(D_RPCTRACE, "Sending RPC pname:cluuid:pid:xid:nid:opc" @@ -733,7 +729,6 @@ static int ptlrpc_send_new_req(struct ptlrpc_request *req) /* this sends any unsent RPCs in @set and returns TRUE if all are sent */ int ptlrpc_check_set(struct ptlrpc_request_set *set) { - unsigned long flags; struct list_head *tmp; int force_timer_recalc = 0; ENTRY; @@ -775,9 +770,9 @@ int ptlrpc_check_set(struct ptlrpc_request_set *set) req->rq_status = -EIO; req->rq_phase = RQ_PHASE_INTERPRET; - spin_lock_irqsave(&imp->imp_lock, flags); + spin_lock(&imp->imp_lock); list_del_init(&req->rq_list); - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); GOTO(interpret, req->rq_status); } @@ -793,9 +788,9 @@ int ptlrpc_check_set(struct ptlrpc_request_set *set) req->rq_status = -EINTR; req->rq_phase = RQ_PHASE_INTERPRET; - spin_lock_irqsave(&imp->imp_lock, flags); + spin_lock(&imp->imp_lock); list_del_init(&req->rq_list); - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); GOTO(interpret, req->rq_status); } @@ -806,11 +801,10 @@ int ptlrpc_check_set(struct ptlrpc_request_set *set) ptlrpc_unregister_reply(req); - spin_lock_irqsave(&imp->imp_lock, flags); + spin_lock(&imp->imp_lock); if (ptlrpc_import_delay_req(imp, req, &status)){ - spin_unlock_irqrestore(&imp->imp_lock, - flags); + spin_unlock(&imp->imp_lock); continue; } @@ -818,21 +812,19 @@ int ptlrpc_check_set(struct ptlrpc_request_set *set) if (status != 0) { req->rq_status = status; req->rq_phase = RQ_PHASE_INTERPRET; - spin_unlock_irqrestore(&imp->imp_lock, - flags); + spin_unlock(&imp->imp_lock); GOTO(interpret, req->rq_status); } if (req->rq_no_resend) { req->rq_status = -ENOTCONN; req->rq_phase = RQ_PHASE_INTERPRET; - spin_unlock_irqrestore(&imp->imp_lock, - flags); + spin_unlock(&imp->imp_lock); GOTO(interpret, req->rq_status); } list_add_tail(&req->rq_list, &imp->imp_sending_list); - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); req->rq_waiting = 0; if (req->rq_resend) { @@ -871,19 +863,19 @@ int ptlrpc_check_set(struct ptlrpc_request_set *set) if (!ptlrpc_client_replied(req)) continue; - spin_lock_irqsave(&imp->imp_lock, flags); + spin_lock(&imp->imp_lock); list_del_init(&req->rq_list); - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); req->rq_status = after_reply(req); if (req->rq_resend) { /* Add this req to the delayed list so it can be errored if the import is evicted after recovery. */ - spin_lock_irqsave (&req->rq_lock, flags); + spin_lock(&req->rq_lock); list_add_tail(&req->rq_list, &imp->imp_delayed_list); - spin_unlock_irqrestore(&req->rq_lock, flags); + spin_unlock(&req->rq_lock); continue; } @@ -951,16 +943,15 @@ int ptlrpc_check_set(struct ptlrpc_request_set *set) int ptlrpc_expire_one_request(struct ptlrpc_request *req) { - unsigned long flags; struct obd_import *imp = req->rq_import; ENTRY; DEBUG_REQ(D_ERROR, req, "timeout (sent at %lu, %lus ago)", (long)req->rq_sent, CURRENT_SECONDS - req->rq_sent); - spin_lock_irqsave (&req->rq_lock, flags); + spin_lock(&req->rq_lock); req->rq_timedout = 1; - spin_unlock_irqrestore (&req->rq_lock, flags); + spin_unlock(&req->rq_lock); ptlrpc_unregister_reply (req); @@ -983,10 +974,10 @@ int ptlrpc_expire_one_request(struct ptlrpc_request *req) * then error it out here. */ if (req->rq_send_state != LUSTRE_IMP_FULL || imp->imp_obd->obd_no_recov) { - spin_lock_irqsave (&req->rq_lock, flags); + spin_lock(&req->rq_lock); req->rq_status = -ETIMEDOUT; req->rq_err = 1; - spin_unlock_irqrestore (&req->rq_lock, flags); + spin_unlock(&req->rq_lock); RETURN(1); } @@ -1032,10 +1023,9 @@ int ptlrpc_expired_set(void *data) void ptlrpc_mark_interrupted(struct ptlrpc_request *req) { - unsigned long flags; - spin_lock_irqsave(&req->rq_lock, flags); + spin_lock(&req->rq_lock); req->rq_intr = 1; - spin_unlock_irqrestore(&req->rq_lock, flags); + spin_unlock(&req->rq_lock); } void ptlrpc_interrupted_set(void *data) @@ -1173,13 +1163,11 @@ static void __ptlrpc_free_req(struct ptlrpc_request *request, int locked) /* We must take it off the imp_replay_list first. Otherwise, we'll set * request->rq_reqmsg to NULL while osc_close is dereferencing it. */ if (request->rq_import != NULL) { - unsigned long flags = 0; if (!locked) - spin_lock_irqsave(&request->rq_import->imp_lock, flags); + spin_lock(&request->rq_import->imp_lock); list_del_init(&request->rq_replay_list); if (!locked) - spin_unlock_irqrestore(&request->rq_import->imp_lock, - flags); + spin_unlock(&request->rq_import->imp_lock); } LASSERTF(list_empty(&request->rq_replay_list), "req %p\n", request); @@ -1373,13 +1361,11 @@ void ptlrpc_cleanup_client(struct obd_import *imp) void ptlrpc_resend_req(struct ptlrpc_request *req) { - unsigned long flags; - DEBUG_REQ(D_HA, req, "going to resend"); lustre_msg_set_handle(req->rq_reqmsg, &(struct lustre_handle){ 0 }); req->rq_status = -EAGAIN; - spin_lock_irqsave (&req->rq_lock, flags); + spin_lock(&req->rq_lock); req->rq_resend = 1; req->rq_net_err = 0; req->rq_timedout = 0; @@ -1392,22 +1378,20 @@ void ptlrpc_resend_req(struct ptlrpc_request *req) old_xid, req->rq_xid); } ptlrpc_wake_client_req(req); - spin_unlock_irqrestore (&req->rq_lock, flags); + spin_unlock(&req->rq_lock); } /* XXX: this function and rq_status are currently unused */ void ptlrpc_restart_req(struct ptlrpc_request *req) { - unsigned long flags; - DEBUG_REQ(D_HA, req, "restarting (possibly-)completed request"); req->rq_status = -ERESTARTSYS; - spin_lock_irqsave (&req->rq_lock, flags); + spin_lock(&req->rq_lock); req->rq_restart = 1; req->rq_timedout = 0; ptlrpc_wake_client_req(req); - spin_unlock_irqrestore (&req->rq_lock, flags); + spin_unlock(&req->rq_lock); } static int expired_request(void *data) @@ -1420,13 +1404,11 @@ static int expired_request(void *data) static void interrupted_request(void *data) { - unsigned long flags; - struct ptlrpc_request *req = data; DEBUG_REQ(D_HA, req, "request interrupted"); - spin_lock_irqsave (&req->rq_lock, flags); + spin_lock(&req->rq_lock); req->rq_intr = 1; - spin_unlock_irqrestore (&req->rq_lock, flags); + spin_unlock(&req->rq_lock); } struct ptlrpc_request *ptlrpc_request_addref(struct ptlrpc_request *req) @@ -1488,7 +1470,6 @@ int ptlrpc_queue_wait(struct ptlrpc_request *req) int brc; struct l_wait_info lwi; struct obd_import *imp = req->rq_import; - unsigned long flags; cfs_duration_t timeout = 0; ENTRY; @@ -1509,14 +1490,14 @@ int ptlrpc_queue_wait(struct ptlrpc_request *req) /* Mark phase here for a little debug help */ req->rq_phase = RQ_PHASE_RPC; - spin_lock_irqsave(&imp->imp_lock, flags); + spin_lock(&imp->imp_lock); req->rq_import_generation = imp->imp_generation; restart: if (ptlrpc_import_delay_req(imp, req, &rc)) { list_del(&req->rq_list); list_add_tail(&req->rq_list, &imp->imp_delayed_list); - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); DEBUG_REQ(D_HA, req, "\"%s\" waiting for recovery: (%s != %s)", cfs_curproc_comm(), @@ -1533,7 +1514,7 @@ restart: ptlrpc_import_state_name(req->rq_send_state), req->rq_err, req->rq_intr); - spin_lock_irqsave(&imp->imp_lock, flags); + spin_lock(&imp->imp_lock); list_del_init(&req->rq_list); if (req->rq_err) { @@ -1543,7 +1524,7 @@ restart: rc = -EINTR; } else if (req->rq_no_resend) { - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); GOTO(out, rc = -ETIMEDOUT); } else { @@ -1553,7 +1534,7 @@ restart: if (rc != 0) { list_del_init(&req->rq_list); - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); req->rq_status = rc; // XXX this ok? GOTO(out, rc); } @@ -1580,7 +1561,7 @@ restart: /* XXX this is the same as ptlrpc_set_wait */ LASSERT(list_empty(&req->rq_list)); list_add_tail(&req->rq_list, &imp->imp_sending_list); - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); rc = ptl_send_rpc(req, 0); if (rc) { @@ -1603,9 +1584,9 @@ restart: libcfs_nid2str(imp->imp_connection->c_peer.nid), lustre_msg_get_opc(req->rq_reqmsg)); - spin_lock_irqsave(&imp->imp_lock, flags); + spin_lock(&imp->imp_lock); list_del_init(&req->rq_list); - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); /* If the reply was received normally, this just grabs the spinlock * (ensuring the reply callback has returned), sees that @@ -1620,7 +1601,7 @@ restart: /* ...unless we were specifically told otherwise. */ if (req->rq_no_resend) GOTO(out, rc = -ETIMEDOUT); - spin_lock_irqsave(&imp->imp_lock, flags); + spin_lock(&imp->imp_lock); goto restart; } @@ -1646,7 +1627,7 @@ restart: rc = after_reply(req); /* NB may return +ve success rc */ if (req->rq_resend) { - spin_lock_irqsave(&imp->imp_lock, flags); + spin_lock(&imp->imp_lock); goto restart; } @@ -1694,7 +1675,6 @@ static int ptlrpc_replay_interpret(struct ptlrpc_request *req, { struct ptlrpc_replay_async_args *aa = data; struct obd_import *imp = req->rq_import; - unsigned long flags; ENTRY; atomic_dec(&imp->imp_replay_inflight); @@ -1728,9 +1708,9 @@ static int ptlrpc_replay_interpret(struct ptlrpc_request *req, lustre_msg_set_status(req->rq_repmsg, aa->praa_old_status); } - spin_lock_irqsave(&imp->imp_lock, flags); + spin_lock(&imp->imp_lock); imp->imp_last_replay_transno = req->rq_transno; - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); /* continue with recovery */ rc = ptlrpc_import_recovery_state_machine(imp); @@ -1778,7 +1758,6 @@ int ptlrpc_replay_req(struct ptlrpc_request *req) void ptlrpc_abort_inflight(struct obd_import *imp) { - unsigned long flags; struct list_head *tmp, *n; ENTRY; @@ -1786,7 +1765,7 @@ void ptlrpc_abort_inflight(struct obd_import *imp) * ptlrpc_{queue,set}_wait must (and does) hold imp_lock while testing * this flag and then putting requests on sending_list or delayed_list. */ - spin_lock_irqsave(&imp->imp_lock, flags); + spin_lock(&imp->imp_lock); /* XXX locking? Maybe we should remove each request with the list * locked? Also, how do we know if the requests on the list are @@ -1825,7 +1804,7 @@ void ptlrpc_abort_inflight(struct obd_import *imp) if (imp->imp_replayable) ptlrpc_free_committed(imp); - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); EXIT; } diff --git a/lustre/ptlrpc/events.c b/lustre/ptlrpc/events.c index cb657df..7db4343 100644 --- a/lustre/ptlrpc/events.c +++ b/lustre/ptlrpc/events.c @@ -41,7 +41,6 @@ void request_out_callback(lnet_event_t *ev) { struct ptlrpc_cb_id *cbid = ev->md.user_ptr; struct ptlrpc_request *req = cbid->cbid_arg; - unsigned long flags; ENTRY; LASSERT (ev->type == LNET_EVENT_SEND || @@ -56,9 +55,9 @@ void request_out_callback(lnet_event_t *ev) /* Failed send: make it seem like the reply timed out, just * like failing sends in client.c does currently... */ - spin_lock_irqsave(&req->rq_lock, flags); + spin_lock(&req->rq_lock); req->rq_net_err = 1; - spin_unlock_irqrestore(&req->rq_lock, flags); + spin_unlock(&req->rq_lock); ptlrpc_wake_client_req(req); } @@ -77,7 +76,6 @@ void reply_in_callback(lnet_event_t *ev) { struct ptlrpc_cb_id *cbid = ev->md.user_ptr; struct ptlrpc_request *req = cbid->cbid_arg; - unsigned long flags; ENTRY; LASSERT (ev->type == LNET_EVENT_PUT || @@ -90,7 +88,7 @@ void reply_in_callback(lnet_event_t *ev) DEBUG_REQ((ev->status == 0) ? D_NET : D_ERROR, req, "type %d, status %d", ev->type, ev->status); - spin_lock_irqsave (&req->rq_lock, flags); + spin_lock(&req->rq_lock); LASSERT (req->rq_receiving_reply); req->rq_receiving_reply = 0; @@ -104,7 +102,7 @@ void reply_in_callback(lnet_event_t *ev) * since we don't have our own ref */ ptlrpc_wake_client_req(req); - spin_unlock_irqrestore (&req->rq_lock, flags); + spin_unlock(&req->rq_lock); EXIT; } @@ -115,7 +113,6 @@ void client_bulk_callback (lnet_event_t *ev) { struct ptlrpc_cb_id *cbid = ev->md.user_ptr; struct ptlrpc_bulk_desc *desc = cbid->cbid_arg; - unsigned long flags; ENTRY; LASSERT ((desc->bd_type == BULK_PUT_SINK && @@ -129,7 +126,7 @@ void client_bulk_callback (lnet_event_t *ev) "event type %d, status %d, desc %p\n", ev->type, ev->status, desc); - spin_lock_irqsave (&desc->bd_lock, flags); + spin_lock(&desc->bd_lock); LASSERT(desc->bd_network_rw); desc->bd_network_rw = 0; @@ -143,7 +140,7 @@ void client_bulk_callback (lnet_event_t *ev) * otherwise */ ptlrpc_wake_client_req(desc->bd_req); - spin_unlock_irqrestore (&desc->bd_lock, flags); + spin_unlock(&desc->bd_lock); EXIT; } @@ -156,7 +153,6 @@ void request_in_callback(lnet_event_t *ev) struct ptlrpc_request_buffer_desc *rqbd = cbid->cbid_arg; struct ptlrpc_service *service = rqbd->rqbd_service; struct ptlrpc_request *req; - unsigned long flags; ENTRY; LASSERT (ev->type == LNET_EVENT_PUT || @@ -209,7 +205,7 @@ void request_in_callback(lnet_event_t *ev) req->rq_uid = ev->uid; #endif - spin_lock_irqsave (&service->srv_lock, flags); + spin_lock(&service->srv_lock); req->rq_history_seq = service->srv_request_seq++; list_add_tail(&req->rq_history_list, &service->srv_request_history); @@ -239,7 +235,7 @@ void request_in_callback(lnet_event_t *ev) * has been queued and we unlock, so do the wake now... */ cfs_waitq_signal(&service->srv_waitq); - spin_unlock_irqrestore(&service->srv_lock, flags); + spin_unlock(&service->srv_lock); EXIT; } @@ -251,7 +247,6 @@ void reply_out_callback(lnet_event_t *ev) struct ptlrpc_cb_id *cbid = ev->md.user_ptr; struct ptlrpc_reply_state *rs = cbid->cbid_arg; struct ptlrpc_service *svc = rs->rs_service; - unsigned long flags; ENTRY; LASSERT (ev->type == LNET_EVENT_SEND || @@ -273,10 +268,10 @@ void reply_out_callback(lnet_event_t *ev) if (ev->unlinked) { /* Last network callback. The net's ref on 'rs' stays put * until ptlrpc_server_handle_reply() is done with it */ - spin_lock_irqsave (&svc->srv_lock, flags); + spin_lock(&svc->srv_lock); rs->rs_on_net = 0; ptlrpc_schedule_difficult_reply (rs); - spin_unlock_irqrestore (&svc->srv_lock, flags); + spin_unlock(&svc->srv_lock); } EXIT; @@ -289,7 +284,6 @@ void server_bulk_callback (lnet_event_t *ev) { struct ptlrpc_cb_id *cbid = ev->md.user_ptr; struct ptlrpc_bulk_desc *desc = cbid->cbid_arg; - unsigned long flags; ENTRY; LASSERT (ev->type == LNET_EVENT_SEND || @@ -303,7 +297,7 @@ void server_bulk_callback (lnet_event_t *ev) "event type %d, status %d, desc %p\n", ev->type, ev->status, desc); - spin_lock_irqsave (&desc->bd_lock, flags); + spin_lock(&desc->bd_lock); if ((ev->type == LNET_EVENT_ACK || ev->type == LNET_EVENT_REPLY) && @@ -321,7 +315,7 @@ void server_bulk_callback (lnet_event_t *ev) cfs_waitq_signal(&desc->bd_waitq); } - spin_unlock_irqrestore (&desc->bd_lock, flags); + spin_unlock(&desc->bd_lock); EXIT; } diff --git a/lustre/ptlrpc/import.c b/lustre/ptlrpc/import.c index 61f8823..b896381 100644 --- a/lustre/ptlrpc/import.c +++ b/lustre/ptlrpc/import.c @@ -56,13 +56,11 @@ do { \ } \ } while(0) -#define IMPORT_SET_STATE(imp, state) \ -do { \ - unsigned long flags; \ - \ - spin_lock_irqsave(&imp->imp_lock, flags); \ - IMPORT_SET_STATE_NOLOCK(imp, state); \ - spin_unlock_irqrestore(&imp->imp_lock, flags); \ +#define IMPORT_SET_STATE(imp, state) \ +do { \ + spin_lock(&imp->imp_lock); \ + IMPORT_SET_STATE_NOLOCK(imp, state); \ + spin_unlock(&imp->imp_lock); \ } while(0) @@ -77,14 +75,12 @@ int ptlrpc_import_recovery_state_machine(struct obd_import *imp); * though. */ int ptlrpc_init_import(struct obd_import *imp) { - unsigned long flags; - - spin_lock_irqsave(&imp->imp_lock, flags); + spin_lock(&imp->imp_lock); imp->imp_generation++; imp->imp_state = LUSTRE_IMP_NEW; - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); return 0; } @@ -119,10 +115,9 @@ static void deuuidify(char *uuid, const char *prefix, char **uuid_start, */ int ptlrpc_set_import_discon(struct obd_import *imp, __u32 conn_cnt) { - unsigned long flags; int rc = 0; - spin_lock_irqsave(&imp->imp_lock, flags); + spin_lock(&imp->imp_lock); if (imp->imp_state == LUSTRE_IMP_FULL && (conn_cnt == 0 || conn_cnt == imp->imp_conn_cnt)) { @@ -141,7 +136,7 @@ int ptlrpc_set_import_discon(struct obd_import *imp, __u32 conn_cnt) "wait for recovery to complete" : "fail"); IMPORT_SET_STATE_NOLOCK(imp, LUSTRE_IMP_DISCON); - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); if (obd_dump_on_timeout) libcfs_debug_dumplog(); @@ -149,7 +144,7 @@ int ptlrpc_set_import_discon(struct obd_import *imp, __u32 conn_cnt) obd_import_event(imp->imp_obd, imp, IMP_EVENT_DISCON); rc = 1; } else { - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); CDEBUG(D_HA, "%s: import %p already %s (conn %u, was %u): %s\n", imp->imp_client->cli_name, imp, (imp->imp_state == LUSTRE_IMP_FULL && @@ -167,14 +162,13 @@ int ptlrpc_set_import_discon(struct obd_import *imp, __u32 conn_cnt) */ void ptlrpc_deactivate_import(struct obd_import *imp) { - unsigned long flags; ENTRY; - spin_lock_irqsave(&imp->imp_lock, flags); + spin_lock(&imp->imp_lock); CDEBUG(D_HA, "setting import %s INVALID\n", obd2cli_tgt(imp->imp_obd)); imp->imp_invalid = 1; imp->imp_generation++; - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); ptlrpc_abort_inflight(imp); obd_import_event(imp->imp_obd, imp, IMP_EVENT_INACTIVE); @@ -215,11 +209,10 @@ void ptlrpc_invalidate_import(struct obd_import *imp) void ptlrpc_activate_import(struct obd_import *imp) { struct obd_device *obd = imp->imp_obd; - unsigned long flags; - spin_lock_irqsave(&imp->imp_lock, flags); + spin_lock(&imp->imp_lock); imp->imp_invalid = 0; - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); obd_import_event(obd, imp, IMP_EVENT_ACTIVE); } @@ -231,8 +224,6 @@ void ptlrpc_fail_import(struct obd_import *imp, __u32 conn_cnt) LASSERT(!imp->imp_dlm_fake); if (ptlrpc_set_import_discon(imp, conn_cnt)) { - unsigned long flags; - if (!imp->imp_replayable) { CDEBUG(D_HA, "import %s@%s for %s not replayable, " "auto-deactivating\n", @@ -245,9 +236,9 @@ void ptlrpc_fail_import(struct obd_import *imp, __u32 conn_cnt) CDEBUG(D_HA, "%s: waking up pinger\n", obd2cli_tgt(imp->imp_obd)); - spin_lock_irqsave(&imp->imp_lock, flags); + spin_lock(&imp->imp_lock); imp->imp_force_verify = 1; - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); ptlrpc_pinger_wake_up(); } @@ -354,20 +345,19 @@ int ptlrpc_connect_import(struct obd_import *imp, char *new_uuid) (char *)&imp->imp_dlm_handle, (char *)&imp->imp_connect_data }; struct ptlrpc_connect_async_args *aa; - unsigned long flags; ENTRY; - spin_lock_irqsave(&imp->imp_lock, flags); + spin_lock(&imp->imp_lock); if (imp->imp_state == LUSTRE_IMP_CLOSED) { - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); CERROR("can't connect to a closed import\n"); RETURN(-EINVAL); } else if (imp->imp_state == LUSTRE_IMP_FULL) { - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); CERROR("already connected\n"); RETURN(0); } else if (imp->imp_state == LUSTRE_IMP_CONNECTING) { - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); CERROR("already connecting\n"); RETURN(-EALREADY); } @@ -382,7 +372,7 @@ int ptlrpc_connect_import(struct obd_import *imp, char *new_uuid) else committed_before_reconnect = imp->imp_peer_committed_transno; - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); if (new_uuid) { struct obd_uuid uuid; @@ -470,12 +460,11 @@ EXPORT_SYMBOL(ptlrpc_connect_import); static void ptlrpc_maybe_ping_import_soon(struct obd_import *imp) { struct obd_import_conn *imp_conn; - unsigned long flags; int wake_pinger = 0; ENTRY; - spin_lock_irqsave(&imp->imp_lock, flags); + spin_lock(&imp->imp_lock); if (list_empty(&imp->imp_conn_list)) GOTO(unlock, 0); @@ -489,7 +478,7 @@ static void ptlrpc_maybe_ping_import_soon(struct obd_import *imp) } unlock: - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); if (wake_pinger) ptlrpc_pinger_wake_up(); @@ -503,16 +492,15 @@ static int ptlrpc_connect_interpret(struct ptlrpc_request *request, struct ptlrpc_connect_async_args *aa = data; struct obd_import *imp = request->rq_import; struct lustre_handle old_hdl; - unsigned long flags; int msg_flags; ENTRY; - spin_lock_irqsave(&imp->imp_lock, flags); + spin_lock(&imp->imp_lock); if (imp->imp_state == LUSTRE_IMP_CLOSED) { - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); RETURN(0); } - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); if (rc) GOTO(out, rc); @@ -643,14 +631,14 @@ finish: ocd = lustre_swab_repbuf(request, REPLY_REC_OFF, sizeof(*ocd), lustre_swab_connect); - spin_lock_irqsave(&imp->imp_lock, flags); + spin_lock(&imp->imp_lock); list_del(&imp->imp_conn_current->oic_item); list_add(&imp->imp_conn_current->oic_item, &imp->imp_conn_list); imp->imp_last_success_conn = imp->imp_conn_current->oic_last_attempt; if (ocd == NULL) { - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); CERROR("Wrong connect data from server\n"); rc = -EPROTO; GOTO(out, rc); @@ -659,7 +647,7 @@ finish: imp->imp_connect_data = *ocd; exp = class_conn2export(&imp->imp_dlm_handle); - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); /* check that server granted subset of flags we asked for. */ LASSERTF((ocd->ocd_connect_flags & @@ -670,7 +658,7 @@ finish: if (!exp) { /* This could happen if export is cleaned during the connect attempt */ - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); CERROR("Missing export for %s\n", imp->imp_obd->obd_name); GOTO(out, rc = -ENODEV); @@ -922,7 +910,6 @@ int ptlrpc_disconnect_import(struct obd_import *imp) { struct ptlrpc_request *req; int rq_opc, rc = 0; - unsigned long flags; ENTRY; switch (imp->imp_connect_op) { @@ -946,11 +933,11 @@ int ptlrpc_disconnect_import(struct obd_import *imp) } - spin_lock_irqsave(&imp->imp_lock, flags); + spin_lock(&imp->imp_lock); if (imp->imp_state != LUSTRE_IMP_FULL) GOTO(out, 0); - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); req = ptlrpc_prep_req(imp, LUSTRE_OBD_VERSION, rq_opc, 1, NULL, NULL); if (req) { @@ -966,11 +953,11 @@ int ptlrpc_disconnect_import(struct obd_import *imp) ptlrpc_req_finished(req); } - spin_lock_irqsave(&imp->imp_lock, flags); + spin_lock(&imp->imp_lock); out: IMPORT_SET_STATE_NOLOCK(imp, LUSTRE_IMP_CLOSED); memset(&imp->imp_remote_handle, 0, sizeof(imp->imp_remote_handle)); - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); RETURN(rc); } diff --git a/lustre/ptlrpc/lproc_ptlrpc.c b/lustre/ptlrpc/lproc_ptlrpc.c index 40c6d78..738cf39 100644 --- a/lustre/ptlrpc/lproc_ptlrpc.c +++ b/lustre/ptlrpc/lproc_ptlrpc.c @@ -181,7 +181,6 @@ ptlrpc_lprocfs_write_req_history_max(struct file *file, const char *buffer, { struct ptlrpc_service *svc = data; int bufpages; - unsigned long flags; int val; int rc = lprocfs_write_helper(buffer, count, &val); @@ -198,9 +197,9 @@ ptlrpc_lprocfs_write_req_history_max(struct file *file, const char *buffer, if (val > num_physpages/(2*bufpages)) return -ERANGE; - spin_lock_irqsave(&svc->srv_lock, flags); + spin_lock(&svc->srv_lock); svc->srv_max_history_rqbds = val; - spin_unlock_irqrestore(&svc->srv_lock, flags); + spin_unlock(&svc->srv_lock); return count; } @@ -254,7 +253,6 @@ ptlrpc_lprocfs_svc_req_history_start(struct seq_file *s, loff_t *pos) { struct ptlrpc_service *svc = s->private; struct ptlrpc_srh_iterator *srhi; - unsigned long flags; int rc; OBD_ALLOC(srhi, sizeof(*srhi)); @@ -264,9 +262,9 @@ ptlrpc_lprocfs_svc_req_history_start(struct seq_file *s, loff_t *pos) srhi->srhi_seq = 0; srhi->srhi_req = NULL; - spin_lock_irqsave(&svc->srv_lock, flags); + spin_lock(&svc->srv_lock); rc = ptlrpc_lprocfs_svc_req_history_seek(svc, srhi, *pos); - spin_unlock_irqrestore(&svc->srv_lock, flags); + spin_unlock(&svc->srv_lock); if (rc == 0) { *pos = srhi->srhi_seq; @@ -292,12 +290,11 @@ ptlrpc_lprocfs_svc_req_history_next(struct seq_file *s, { struct ptlrpc_service *svc = s->private; struct ptlrpc_srh_iterator *srhi = iter; - unsigned long flags; int rc; - spin_lock_irqsave(&svc->srv_lock, flags); + spin_lock(&svc->srv_lock); rc = ptlrpc_lprocfs_svc_req_history_seek(svc, srhi, *pos + 1); - spin_unlock_irqrestore(&svc->srv_lock, flags); + spin_unlock(&svc->srv_lock); if (rc != 0) { OBD_FREE(srhi, sizeof(*srhi)); @@ -313,10 +310,9 @@ static int ptlrpc_lprocfs_svc_req_history_show(struct seq_file *s, void *iter) struct ptlrpc_service *svc = s->private; struct ptlrpc_srh_iterator *srhi = iter; struct ptlrpc_request *req; - unsigned long flags; int rc; - spin_lock_irqsave(&svc->srv_lock, flags); + spin_lock(&svc->srv_lock); rc = ptlrpc_lprocfs_svc_req_history_seek(svc, srhi, srhi->srhi_seq); @@ -340,7 +336,7 @@ static int ptlrpc_lprocfs_svc_req_history_show(struct seq_file *s, void *iter) svc->srv_request_history_print_fn(s, srhi->srhi_req); } - spin_unlock_irqrestore(&svc->srv_lock, flags); + spin_unlock(&svc->srv_lock); return rc; } diff --git a/lustre/ptlrpc/niobuf.c b/lustre/ptlrpc/niobuf.c index 040854c..53fac91 100644 --- a/lustre/ptlrpc/niobuf.c +++ b/lustre/ptlrpc/niobuf.c @@ -390,7 +390,6 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) int rc; int rc2; struct ptlrpc_connection *connection; - unsigned long flags; lnet_handle_me_t reply_me_h; lnet_md_t reply_md; ENTRY; @@ -443,7 +442,7 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) } } - spin_lock_irqsave (&request->rq_lock, flags); + spin_lock(&request->rq_lock); /* If the MD attach succeeds, there _will_ be a reply_in callback */ request->rq_receiving_reply = !noreply; /* Clear any flags that may be present from previous sends. */ @@ -453,7 +452,7 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) request->rq_net_err = 0; request->rq_resend = 0; request->rq_restart = 0; - spin_unlock_irqrestore (&request->rq_lock, flags); + spin_unlock(&request->rq_lock); if (!noreply) { reply_md.start = request->rq_repmsg; @@ -468,10 +467,10 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) if (rc != 0) { CERROR("LNetMDAttach failed: %d\n", rc); LASSERT (rc == -ENOMEM); - spin_lock_irqsave (&request->rq_lock, flags); + spin_lock(&request->rq_lock); /* ...but the MD attach didn't succeed... */ request->rq_receiving_reply = 0; - spin_unlock_irqrestore (&request->rq_lock, flags); + spin_unlock(&request->rq_lock); GOTO(cleanup_me, rc -ENOMEM); } diff --git a/lustre/ptlrpc/pack_generic.c b/lustre/ptlrpc/pack_generic.c index 7a4f0d3..7dcf2b0 100644 --- a/lustre/ptlrpc/pack_generic.c +++ b/lustre/ptlrpc/pack_generic.c @@ -279,20 +279,16 @@ spinlock_t ptlrpc_rs_debug_lock; #define PTLRPC_RS_DEBUG_LRU_ADD(rs) \ do { \ - unsigned long __flags; \ - \ - spin_lock_irqsave(&ptlrpc_rs_debug_lock, __flags); \ + spin_lock(&ptlrpc_rs_debug_lock); \ list_add_tail(&(rs)->rs_debug_list, &ptlrpc_rs_debug_lru); \ - spin_unlock_irqrestore(&ptlrpc_rs_debug_lock, __flags); \ + spin_unlock(&ptlrpc_rs_debug_lock); \ } while (0) -#define PTLRPC_RS_DEBUG_LRU_DEL(rs) \ -do { \ - unsigned long __flags; \ - \ - spin_lock_irqsave(&ptlrpc_rs_debug_lock, __flags); \ - list_del(&(rs)->rs_debug_list); \ - spin_unlock_irqrestore(&ptlrpc_rs_debug_lock, __flags); \ +#define PTLRPC_RS_DEBUG_LRU_DEL(rs) \ +do { \ + spin_lock(&ptlrpc_rs_debug_lock); \ + list_del(&(rs)->rs_debug_list); \ + spin_unlock(&ptlrpc_rs_debug_lock); \ } while (0) #else # define PTLRPC_RS_DEBUG_LRU_ADD(rs) do {} while(0) @@ -302,15 +298,14 @@ do { \ static struct ptlrpc_reply_state *lustre_get_emerg_rs(struct ptlrpc_service *svc, int size) { - unsigned long flags; struct ptlrpc_reply_state *rs = NULL; - spin_lock_irqsave(&svc->srv_lock, flags); + spin_lock(&svc->srv_lock); /* See if we have anything in a pool, and wait if nothing */ while (list_empty(&svc->srv_free_rs_list)) { struct l_wait_info lwi; int rc; - spin_unlock_irqrestore(&svc->srv_lock, flags); + spin_unlock(&svc->srv_lock); /* If we cannot get anything for some long time, we better bail out instead of waiting infinitely */ lwi = LWI_TIMEOUT(cfs_time_seconds(10), NULL, NULL); @@ -318,13 +313,13 @@ static struct ptlrpc_reply_state *lustre_get_emerg_rs(struct ptlrpc_service *svc !list_empty(&svc->srv_free_rs_list), &lwi); if (rc) goto out; - spin_lock_irqsave(&svc->srv_lock, flags); + spin_lock(&svc->srv_lock); } rs = list_entry(svc->srv_free_rs_list.next, struct ptlrpc_reply_state, rs_list); list_del(&rs->rs_list); - spin_unlock_irqrestore(&svc->srv_lock, flags); + spin_unlock(&svc->srv_lock); LASSERT(rs); LASSERTF(svc->srv_max_reply_size > size, "Want %d, prealloc %d\n", size, svc->srv_max_reply_size); @@ -633,13 +628,12 @@ void lustre_free_reply_state(struct ptlrpc_reply_state *rs) LASSERT (list_empty(&rs->rs_obd_list)); if (unlikely(rs->rs_prealloc)) { - unsigned long flags; struct ptlrpc_service *svc = rs->rs_service; - spin_lock_irqsave(&svc->srv_lock, flags); + spin_lock(&svc->srv_lock); list_add(&rs->rs_list, &svc->srv_free_rs_list); - spin_unlock_irqrestore(&svc->srv_lock, flags); + spin_unlock(&svc->srv_lock); cfs_waitq_signal(&svc->srv_free_rs_waitq); } else { OBD_FREE(rs, rs->rs_size); diff --git a/lustre/ptlrpc/pinger.c b/lustre/ptlrpc/pinger.c index 2f595d5..5095e7d 100644 --- a/lustre/ptlrpc/pinger.c +++ b/lustre/ptlrpc/pinger.c @@ -101,13 +101,12 @@ static int ptlrpc_pinger_main(void *arg) list_entry(iter, struct obd_import, imp_pinger_chain); int force, level; - unsigned long flags; - spin_lock_irqsave(&imp->imp_lock, flags); + spin_lock(&imp->imp_lock); level = imp->imp_state; force = imp->imp_force_verify; imp->imp_force_verify = 0; - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); CDEBUG(level == LUSTRE_IMP_FULL ? D_INFO : D_HA, "level %s/%u force %u deactive %u pingable %u\n", @@ -491,15 +490,14 @@ static int pinger_check_rpcs(void *arg) struct obd_import *imp = list_entry(iter, struct obd_import, imp_pinger_chain); int generation, level; - unsigned long flags; if (cfs_time_aftereq(pd->pd_this_ping, imp->imp_next_ping - 5 * CFS_TICK)) { /* Add a ping. */ - spin_lock_irqsave(&imp->imp_lock, flags); + spin_lock(&imp->imp_lock); generation = imp->imp_generation; level = imp->imp_state; - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); if (level != LUSTRE_IMP_FULL) { CDEBUG(D_HA, diff --git a/lustre/ptlrpc/ptlrpcd.c b/lustre/ptlrpc/ptlrpcd.c index fa315eb..9dce7f7 100644 --- a/lustre/ptlrpc/ptlrpcd.c +++ b/lustre/ptlrpc/ptlrpcd.c @@ -92,21 +92,20 @@ static int ptlrpcd_check(struct ptlrpcd_ctl *pc) { struct list_head *tmp, *pos; struct ptlrpc_request *req; - unsigned long flags; int rc = 0; ENTRY; if (test_bit(LIOD_STOP, &pc->pc_flags)) RETURN(1); - spin_lock_irqsave(&pc->pc_set->set_new_req_lock, flags); + spin_lock(&pc->pc_set->set_new_req_lock); list_for_each_safe(pos, tmp, &pc->pc_set->set_new_requests) { req = list_entry(pos, struct ptlrpc_request, rq_set_chain); list_del_init(&req->rq_set_chain); ptlrpc_set_add_req(pc->pc_set, req); rc = 1; /* need to calculate its timeout */ } - spin_unlock_irqrestore(&pc->pc_set->set_new_req_lock, flags); + spin_unlock(&pc->pc_set->set_new_req_lock); if (pc->pc_set->set_remaining) { rc = rc | ptlrpc_check_set(pc->pc_set); @@ -127,9 +126,9 @@ static int ptlrpcd_check(struct ptlrpcd_ctl *pc) if (rc == 0) { /* If new requests have been added, make sure to wake up */ - spin_lock_irqsave(&pc->pc_set->set_new_req_lock, flags); + spin_lock(&pc->pc_set->set_new_req_lock); rc = !list_empty(&pc->pc_set->set_new_requests); - spin_unlock_irqrestore(&pc->pc_set->set_new_req_lock, flags); + spin_unlock(&pc->pc_set->set_new_req_lock); } RETURN(rc); diff --git a/lustre/ptlrpc/recover.c b/lustre/ptlrpc/recover.c index d43128d..1ca9a20 100644 --- a/lustre/ptlrpc/recover.c +++ b/lustre/ptlrpc/recover.c @@ -78,19 +78,18 @@ void ptlrpc_run_recovery_over_upcall(struct obd_device *obd) void ptlrpc_run_failed_import_upcall(struct obd_import* imp) { #ifdef __KERNEL__ - unsigned long flags; char *argv[7]; char *envp[3]; int rc; ENTRY; - spin_lock_irqsave(&imp->imp_lock, flags); + spin_lock(&imp->imp_lock); if (imp->imp_state == LUSTRE_IMP_CLOSED) { - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); EXIT; return; } - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); argv[0] = obd_lustre_upcall; argv[1] = "FAILED_IMPORT"; @@ -151,7 +150,6 @@ int ptlrpc_replay_next(struct obd_import *imp, int *inflight) int rc = 0; struct list_head *tmp, *pos; struct ptlrpc_request *req = NULL; - unsigned long flags; __u64 last_transno; ENTRY; @@ -160,11 +158,11 @@ int ptlrpc_replay_next(struct obd_import *imp, int *inflight) /* It might have committed some after we last spoke, so make sure we * get rid of them now. */ - spin_lock_irqsave(&imp->imp_lock, flags); + spin_lock(&imp->imp_lock); imp->imp_last_transno_checked = 0; ptlrpc_free_committed(imp); last_transno = imp->imp_last_replay_transno; - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); CDEBUG(D_HA, "import %p from %s committed "LPU64" last "LPU64"\n", imp, obd2cli_tgt(imp->imp_obd), @@ -224,7 +222,6 @@ int ptlrpc_replay_next(struct obd_import *imp, int *inflight) int ptlrpc_resend(struct obd_import *imp) { struct ptlrpc_request *req, *next; - unsigned long flags; ENTRY; @@ -234,12 +231,12 @@ int ptlrpc_resend(struct obd_import *imp) */ /* Well... what if lctl recover is called twice at the same time? */ - spin_lock_irqsave(&imp->imp_lock, flags); + spin_lock(&imp->imp_lock); if (imp->imp_state != LUSTRE_IMP_RECOVER) { - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); RETURN(-1); } - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); list_for_each_entry_safe(req, next, &imp->imp_sending_list, rq_list) { LASSERTF((long)req > PAGE_SIZE && req != LP_POISON, @@ -253,24 +250,22 @@ int ptlrpc_resend(struct obd_import *imp) void ptlrpc_wake_delayed(struct obd_import *imp) { - unsigned long flags; struct list_head *tmp, *pos; struct ptlrpc_request *req; - spin_lock_irqsave(&imp->imp_lock, flags); + spin_lock(&imp->imp_lock); list_for_each_safe(tmp, pos, &imp->imp_delayed_list) { req = list_entry(tmp, struct ptlrpc_request, rq_list); DEBUG_REQ(D_HA, req, "waking (set %p):", req->rq_set); ptlrpc_wake_client_req(req); } - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); } void ptlrpc_request_handle_notconn(struct ptlrpc_request *failed_req) { struct obd_import *imp = failed_req->rq_import; - unsigned long flags; ENTRY; CDEBUG(D_HA, "import %s of %s@%s abruptly disconnected: reconnecting\n", @@ -294,10 +289,10 @@ void ptlrpc_request_handle_notconn(struct ptlrpc_request *failed_req) /* Wait for recovery to complete and resend. If evicted, then this request will be errored out later.*/ - spin_lock_irqsave(&failed_req->rq_lock, flags); + spin_lock(&failed_req->rq_lock); if (!failed_req->rq_no_resend) failed_req->rq_resend = 1; - spin_unlock_irqrestore(&failed_req->rq_lock, flags); + spin_unlock(&failed_req->rq_lock); EXIT; } @@ -353,14 +348,13 @@ int ptlrpc_recover_import(struct obd_import *imp, char *new_uuid) int ptlrpc_import_in_recovery(struct obd_import *imp) { - unsigned long flags; int in_recovery = 1; - spin_lock_irqsave(&imp->imp_lock, flags); + spin_lock(&imp->imp_lock); if (imp->imp_state == LUSTRE_IMP_FULL || imp->imp_state == LUSTRE_IMP_CLOSED || imp->imp_state == LUSTRE_IMP_DISCON) in_recovery = 0; - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); return in_recovery; } @@ -368,17 +362,16 @@ static int ptlrpc_recover_import_no_retry(struct obd_import *imp, char *new_uuid) { int rc; - unsigned long flags; int in_recovery = 0; struct l_wait_info lwi; ENTRY; - spin_lock_irqsave(&imp->imp_lock, flags); /* Check if reconnect is already in progress */ + spin_lock(&imp->imp_lock); if (imp->imp_state != LUSTRE_IMP_DISCON) { in_recovery = 1; } - spin_unlock_irqrestore(&imp->imp_lock, flags); + spin_unlock(&imp->imp_lock); if (in_recovery == 1) RETURN(-EALREADY); diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index 0652bbc..edfdcce 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -65,7 +65,6 @@ ptlrpc_free_request_buffer (char *ptr, int size) struct ptlrpc_request_buffer_desc * ptlrpc_alloc_rqbd (struct ptlrpc_service *svc) { - unsigned long flags; struct ptlrpc_request_buffer_desc *rqbd; OBD_ALLOC(rqbd, sizeof (*rqbd)); @@ -84,10 +83,10 @@ ptlrpc_alloc_rqbd (struct ptlrpc_service *svc) return (NULL); } - spin_lock_irqsave (&svc->srv_lock, flags); + spin_lock(&svc->srv_lock); list_add(&rqbd->rqbd_list, &svc->srv_idle_rqbds); svc->srv_nbufs++; - spin_unlock_irqrestore (&svc->srv_lock, flags); + spin_unlock(&svc->srv_lock); return (rqbd); } @@ -96,15 +95,14 @@ void ptlrpc_free_rqbd (struct ptlrpc_request_buffer_desc *rqbd) { struct ptlrpc_service *svc = rqbd->rqbd_service; - unsigned long flags; LASSERT (rqbd->rqbd_refcount == 0); LASSERT (list_empty(&rqbd->rqbd_reqs)); - spin_lock_irqsave(&svc->srv_lock, flags); + spin_lock(&svc->srv_lock); list_del(&rqbd->rqbd_list); svc->srv_nbufs--; - spin_unlock_irqrestore(&svc->srv_lock, flags); + spin_unlock(&svc->srv_lock); ptlrpc_free_request_buffer (rqbd->rqbd_buffer, svc->srv_buf_size); OBD_FREE (rqbd, sizeof (*rqbd)); @@ -176,13 +174,12 @@ ptlrpc_commit_replies (struct obd_device *obd) { struct list_head *tmp; struct list_head *nxt; - unsigned long flags; /* Find any replies that have been committed and get their service * to attend to complete them. */ /* CAVEAT EMPTOR: spinlock ordering!!! */ - spin_lock_irqsave (&obd->obd_uncommitted_replies_lock, flags); + spin_lock(&obd->obd_uncommitted_replies_lock); list_for_each_safe (tmp, nxt, &obd->obd_uncommitted_replies) { struct ptlrpc_reply_state *rs = @@ -200,22 +197,21 @@ ptlrpc_commit_replies (struct obd_device *obd) } } - spin_unlock_irqrestore (&obd->obd_uncommitted_replies_lock, flags); + spin_unlock(&obd->obd_uncommitted_replies_lock); } static int ptlrpc_server_post_idle_rqbds (struct ptlrpc_service *svc) { struct ptlrpc_request_buffer_desc *rqbd; - unsigned long flags; int rc; int posted = 0; for (;;) { - spin_lock_irqsave(&svc->srv_lock, flags); + spin_lock(&svc->srv_lock); if (list_empty (&svc->srv_idle_rqbds)) { - spin_unlock_irqrestore(&svc->srv_lock, flags); + spin_unlock(&svc->srv_lock); return (posted); } @@ -228,7 +224,7 @@ ptlrpc_server_post_idle_rqbds (struct ptlrpc_service *svc) svc->srv_nrqbd_receiving++; list_add (&rqbd->rqbd_list, &svc->srv_active_rqbds); - spin_unlock_irqrestore(&svc->srv_lock, flags); + spin_unlock(&svc->srv_lock); rc = ptlrpc_register_rqbd(rqbd); if (rc != 0) @@ -237,7 +233,7 @@ ptlrpc_server_post_idle_rqbds (struct ptlrpc_service *svc) posted = 1; } - spin_lock_irqsave(&svc->srv_lock, flags); + spin_lock(&svc->srv_lock); svc->srv_nrqbd_receiving--; list_del(&rqbd->rqbd_list); @@ -251,7 +247,7 @@ ptlrpc_server_post_idle_rqbds (struct ptlrpc_service *svc) CERROR("All %s request buffers busy\n", svc->srv_name); } - spin_unlock_irqrestore (&svc->srv_lock, flags); + spin_unlock(&svc->srv_lock); return (-1); } @@ -356,12 +352,11 @@ ptlrpc_server_free_request(struct ptlrpc_request *req) { struct ptlrpc_request_buffer_desc *rqbd = req->rq_rqbd; struct ptlrpc_service *svc = rqbd->rqbd_service; - unsigned long flags; int refcount; struct list_head *tmp; struct list_head *nxt; - spin_lock_irqsave(&svc->srv_lock, flags); + spin_lock(&svc->srv_lock); svc->srv_n_active_reqs--; list_add(&req->rq_list, &rqbd->rqbd_reqs); @@ -396,7 +391,7 @@ ptlrpc_server_free_request(struct ptlrpc_request *req) list_del(&req->rq_history_list); } - spin_unlock_irqrestore(&svc->srv_lock, flags); + spin_unlock(&svc->srv_lock); list_for_each_safe(tmp, nxt, &rqbd->rqbd_reqs) { req = list_entry(rqbd->rqbd_reqs.next, @@ -405,7 +400,7 @@ ptlrpc_server_free_request(struct ptlrpc_request *req) __ptlrpc_server_free_request(req); } - spin_lock_irqsave(&svc->srv_lock, flags); + spin_lock(&svc->srv_lock); /* schedule request buffer for re-use. * NB I can only do this after I've disposed of their @@ -419,7 +414,7 @@ ptlrpc_server_free_request(struct ptlrpc_request *req) __ptlrpc_server_free_request(req); } - spin_unlock_irqrestore(&svc->srv_lock, flags); + spin_unlock(&svc->srv_lock); } @@ -507,7 +502,6 @@ ptlrpc_server_handle_request(struct ptlrpc_service *svc, struct ptlrpc_thread *thread) { struct ptlrpc_request *request; - unsigned long flags; struct timeval work_start; struct timeval work_end; long timediff; @@ -516,14 +510,14 @@ ptlrpc_server_handle_request(struct ptlrpc_service *svc, LASSERT(svc); - spin_lock_irqsave (&svc->srv_lock, flags); + spin_lock(&svc->srv_lock); if (list_empty (&svc->srv_request_queue) || (svc->srv_n_difficult_replies != 0 && svc->srv_n_active_reqs >= (svc->srv_nthreads - 1))) { /* If all the other threads are handling requests, I must * remain free to handle any 'difficult' reply that might * block them */ - spin_unlock_irqrestore (&svc->srv_lock, flags); + spin_unlock(&svc->srv_lock); RETURN(0); } @@ -533,7 +527,7 @@ ptlrpc_server_handle_request(struct ptlrpc_service *svc, svc->srv_n_queued_reqs--; svc->srv_n_active_reqs++; - spin_unlock_irqrestore (&svc->srv_lock, flags); + spin_unlock(&svc->srv_lock); do_gettimeofday(&work_start); timediff = cfs_timeval_sub(&work_start, &request->rq_arrival_time,NULL); @@ -694,16 +688,15 @@ static int ptlrpc_server_handle_reply (struct ptlrpc_service *svc) { struct ptlrpc_reply_state *rs; - unsigned long flags; struct obd_export *exp; struct obd_device *obd; int nlocks; int been_handled; ENTRY; - spin_lock_irqsave (&svc->srv_lock, flags); + spin_lock(&svc->srv_lock); if (list_empty (&svc->srv_reply_queue)) { - spin_unlock_irqrestore (&svc->srv_lock, flags); + spin_unlock(&svc->srv_lock); RETURN(0); } @@ -751,7 +744,7 @@ ptlrpc_server_handle_reply (struct ptlrpc_service *svc) } if ((!been_handled && rs->rs_on_net) || nlocks > 0) { - spin_unlock_irqrestore(&svc->srv_lock, flags); + spin_unlock(&svc->srv_lock); if (!been_handled && rs->rs_on_net) { LNetMDUnlink(rs->rs_md_h); @@ -763,7 +756,7 @@ ptlrpc_server_handle_reply (struct ptlrpc_service *svc) ldlm_lock_decref(&rs->rs_locks[nlocks], rs->rs_modes[nlocks]); - spin_lock_irqsave(&svc->srv_lock, flags); + spin_lock(&svc->srv_lock); } rs->rs_scheduled = 0; @@ -771,7 +764,7 @@ ptlrpc_server_handle_reply (struct ptlrpc_service *svc) if (!rs->rs_on_net) { /* Off the net */ svc->srv_n_difficult_replies--; - spin_unlock_irqrestore(&svc->srv_lock, flags); + spin_unlock(&svc->srv_lock); class_export_put (exp); rs->rs_export = NULL; @@ -781,7 +774,7 @@ ptlrpc_server_handle_reply (struct ptlrpc_service *svc) } /* still on the net; callback will schedule */ - spin_unlock_irqrestore (&svc->srv_lock, flags); + spin_unlock(&svc->srv_lock); RETURN(1); } @@ -876,7 +869,6 @@ static int ptlrpc_main(void *arg) struct ptlrpc_thread *thread = data->thread; struct ptlrpc_reply_state *rs; struct lc_watchdog *watchdog; - unsigned long flags; #ifdef WITH_GROUP_INFO struct group_info *ginfo = NULL; #endif @@ -934,13 +926,12 @@ static int ptlrpc_main(void *arg) */ cfs_waitq_signal(&thread->t_ctl_waitq); - watchdog = lc_watchdog_add(svc->srv_watchdog_timeout, - LC_WATCHDOG_DEFAULT_CB, NULL); + watchdog = lc_watchdog_add(svc->srv_watchdog_timeout, NULL, NULL); - spin_lock_irqsave(&svc->srv_lock, flags); + spin_lock(&svc->srv_lock); svc->srv_nthreads++; list_add(&rs->rs_list, &svc->srv_free_rs_list); - spin_unlock_irqrestore(&svc->srv_lock, flags); + spin_unlock(&svc->srv_lock); cfs_waitq_signal(&svc->srv_free_rs_waitq); CDEBUG(D_NET, "service thread %d started\n", thread->t_id); @@ -1003,13 +994,13 @@ out_srv_init: out: CDEBUG(D_NET, "service thread %d exiting: rc %d\n", thread->t_id, rc); - spin_lock_irqsave(&svc->srv_lock, flags); + spin_lock(&svc->srv_lock); svc->srv_nthreads--; /* must know immediately */ thread->t_id = rc; thread->t_flags = SVC_STOPPED; cfs_waitq_signal(&thread->t_ctl_waitq); - spin_unlock_irqrestore(&svc->srv_lock, flags); + spin_unlock(&svc->srv_lock); return rc; } @@ -1018,39 +1009,37 @@ static void ptlrpc_stop_thread(struct ptlrpc_service *svc, struct ptlrpc_thread *thread) { struct l_wait_info lwi = { 0 }; - unsigned long flags; - spin_lock_irqsave(&svc->srv_lock, flags); + spin_lock(&svc->srv_lock); thread->t_flags = SVC_STOPPING; - spin_unlock_irqrestore(&svc->srv_lock, flags); + spin_unlock(&svc->srv_lock); cfs_waitq_broadcast(&svc->srv_waitq); l_wait_event(thread->t_ctl_waitq, (thread->t_flags & SVC_STOPPED), &lwi); - spin_lock_irqsave(&svc->srv_lock, flags); + spin_lock(&svc->srv_lock); list_del(&thread->t_link); - spin_unlock_irqrestore(&svc->srv_lock, flags); + spin_unlock(&svc->srv_lock); OBD_FREE(thread, sizeof(*thread)); } void ptlrpc_stop_all_threads(struct ptlrpc_service *svc) { - unsigned long flags; struct ptlrpc_thread *thread; - spin_lock_irqsave(&svc->srv_lock, flags); + spin_lock(&svc->srv_lock); while (!list_empty(&svc->srv_threads)) { thread = list_entry(svc->srv_threads.next, struct ptlrpc_thread, t_link); - spin_unlock_irqrestore(&svc->srv_lock, flags); + spin_unlock(&svc->srv_lock); ptlrpc_stop_thread(svc, thread); - spin_lock_irqsave(&svc->srv_lock, flags); + spin_lock(&svc->srv_lock); } - spin_unlock_irqrestore(&svc->srv_lock, flags); + spin_unlock(&svc->srv_lock); } /* @base_name should be 11 characters or less - 3 will be added on */ @@ -1080,7 +1069,6 @@ int ptlrpc_start_thread(struct obd_device *dev, struct ptlrpc_service *svc, struct l_wait_info lwi = { 0 }; struct ptlrpc_svc_data d; struct ptlrpc_thread *thread; - unsigned long flags; int rc; ENTRY; @@ -1090,9 +1078,9 @@ int ptlrpc_start_thread(struct obd_device *dev, struct ptlrpc_service *svc, cfs_waitq_init(&thread->t_ctl_waitq); thread->t_id = id; - spin_lock_irqsave(&svc->srv_lock, flags); + spin_lock(&svc->srv_lock); list_add(&thread->t_link, &svc->srv_threads); - spin_unlock_irqrestore(&svc->srv_lock, flags); + spin_unlock(&svc->srv_lock); d.dev = dev; d.svc = svc; @@ -1106,9 +1094,9 @@ int ptlrpc_start_thread(struct obd_device *dev, struct ptlrpc_service *svc, if (rc < 0) { CERROR("cannot start thread '%s': rc %d\n", name, rc); - spin_lock_irqsave(&svc->srv_lock, flags); + spin_lock(&svc->srv_lock); list_del(&thread->t_link); - spin_unlock_irqrestore(&svc->srv_lock, flags); + spin_unlock(&svc->srv_lock); OBD_FREE(thread, sizeof(*thread)); RETURN(rc); @@ -1124,7 +1112,6 @@ int ptlrpc_start_thread(struct obd_device *dev, struct ptlrpc_service *svc, int ptlrpc_unregister_service(struct ptlrpc_service *service) { int rc; - unsigned long flags; struct l_wait_info lwi; struct list_head *tmp; struct ptlrpc_reply_state *rs, *t; @@ -1158,9 +1145,9 @@ int ptlrpc_unregister_service(struct ptlrpc_service *service) /* Wait for the network to release any buffers it's currently * filling */ for (;;) { - spin_lock_irqsave(&service->srv_lock, flags); + spin_lock(&service->srv_lock); rc = service->srv_nrqbd_receiving; - spin_unlock_irqrestore(&service->srv_lock, flags); + spin_unlock(&service->srv_lock); if (rc == 0) break; @@ -1177,14 +1164,14 @@ int ptlrpc_unregister_service(struct ptlrpc_service *service) } /* schedule all outstanding replies to terminate them */ - spin_lock_irqsave(&service->srv_lock, flags); + spin_lock(&service->srv_lock); while (!list_empty(&service->srv_active_replies)) { struct ptlrpc_reply_state *rs = list_entry(service->srv_active_replies.next, struct ptlrpc_reply_state, rs_list); ptlrpc_schedule_difficult_reply(rs); } - spin_unlock_irqrestore(&service->srv_lock, flags); + spin_unlock(&service->srv_lock); /* purge the request queue. NB No new replies (rqbds all unlinked) * and no service threads, so I'm the only thread noodling the @@ -1252,13 +1239,12 @@ int ptlrpc_service_health_check(struct ptlrpc_service *svc) struct ptlrpc_request *request; struct timeval right_now; long timediff, cutoff; - unsigned long flags; int rc = 0; if (svc == NULL) return 0; - spin_lock_irqsave(&svc->srv_lock, flags); + spin_lock(&svc->srv_lock); if (list_empty(&svc->srv_request_queue)) goto out; @@ -1277,6 +1263,6 @@ int ptlrpc_service_health_check(struct ptlrpc_service *svc) } out: - spin_unlock_irqrestore(&svc->srv_lock, flags); + spin_unlock(&svc->srv_lock); return rc; } diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index 55de474..a23acf1 100644 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -21,6 +21,7 @@ ALWAYS_EXCEPT=" $CONF_SANITY_EXCEPT $MOUNTCONFSKIP 23" SRCDIR=`dirname $0` PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH +PTLDEBUG=${PTLDEBUG:-1} LUSTRE=${LUSTRE:-`dirname $0`/..} RLUSTRE=${RLUSTRE:-$LUSTRE} MOUNTLUSTRE=${MOUNTLUSTRE:-/sbin/mount.lustre} diff --git a/lustre/tests/recovery-small.sh b/lustre/tests/recovery-small.sh index 9c70893..fed8e0f 100755 --- a/lustre/tests/recovery-small.sh +++ b/lustre/tests/recovery-small.sh @@ -2,9 +2,10 @@ set -e -# bug 2986 5494 7288 -ALWAYS_EXCEPT="20b 24 27 $RECOVERY_SMALL_EXCEPT" +# bug 5494 7288 +ALWAYS_EXCEPT="24 27 $RECOVERY_SMALL_EXCEPT" +PTLDEBUG=${PTLDEBUG:-1} LUSTRE=${LUSTRE:-`dirname $0`/..} . $LUSTRE/tests/test-framework.sh init_test_env $@ diff --git a/lustre/tests/replay-dual.sh b/lustre/tests/replay-dual.sh index d91f2f9..ea56524 100755 --- a/lustre/tests/replay-dual.sh +++ b/lustre/tests/replay-dual.sh @@ -5,6 +5,7 @@ set -e # bug number: 6088 10124 ALWAYS_EXCEPT="8 15c $REPLAY_DUAL_EXCEPT" +PTLDEBUG=${PTLDEBUG:-1} LUSTRE=${LUSTRE:-`dirname $0`/..} . $LUSTRE/tests/test-framework.sh diff --git a/lustre/tests/replay-ost-single.sh b/lustre/tests/replay-ost-single.sh index 989ce2a..acabe21 100755 --- a/lustre/tests/replay-ost-single.sh +++ b/lustre/tests/replay-ost-single.sh @@ -2,6 +2,7 @@ set -e +PTLDEBUG=${PTLDEBUG:-1} LUSTRE=${LUSTRE:-`dirname $0`/..} . $LUSTRE/tests/test-framework.sh init_test_env $@ @@ -11,8 +12,8 @@ ostfailover_HOST=${ostfailover_HOST:-$ost_HOST} #failover= must be defined in OST_MKFS_OPTIONS if ostfailover_HOST != ost_HOST # Skip these tests -# BUG NUMBER: 2766? -ALWAYS_EXCEPT="5 $REPLAY_OST_SINGLE_EXCEPT" +# BUG NUMBER: +ALWAYS_EXCEPT="$REPLAY_OST_SINGLE_EXCEPT" # It is replay-ost-single, after all OSTCOUNT=1 @@ -26,7 +27,6 @@ cleanup() { } if [ "$ONLY" == "cleanup" ]; then - sysctl -w lnet.debug=0 cleanup exit fi @@ -112,6 +112,7 @@ test_4() { run_test 4 "Fail OST during read, with verification" test_5() { + [ -z "`which iozone 2> /dev/null`" ] && log "iozone missing" && return FREE=`df -P -h $DIR | tail -n 1 | awk '{ print $3 }'` case $FREE in *T|*G) FREE=1G;; @@ -142,6 +143,7 @@ test_6() { do_facet mds "sysctl -w lustre.fail_loc=0x80000119" sync sleep 1 # ensure we have a fresh statfs + sync after_dd=`kbytesfree` log "before: $before after_dd: $after_dd" (( $before > $after_dd )) || return 1 diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 4887f1d..2657540 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -11,7 +11,7 @@ ONLY=${ONLY:-"$*"} ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-"42a 42b 42c 42d 45 68"} # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT! -[ "$SLOW" = "no" ] && EXCEPT="$EXCEPT 24o 27m 51b 51c 63 64b 71 77 101" +[ "$SLOW" = "no" ] && EXCEPT="$EXCEPT 24o 27m 36g 51b 51c 63 64b 71 77 101" # Tests that fail on uml, maybe elsewhere, FIXME CPU=`awk '/model/ {print $4}' /proc/cpuinfo` @@ -53,18 +53,18 @@ ACCEPTOR_PORT=${ACCEPTOR_PORT:-988} UMOUNT=${UMOUNT:-"umount -d"} if [ $UID -ne 0 ]; then - echo "Warning: running as non-root uid $UID" + echo "Warning: running as non-root uid $UID" RUNAS_ID="$UID" RUNAS="" else RUNAS_ID=${RUNAS_ID:-500} RUNAS=${RUNAS:-"runas -u $RUNAS_ID"} - # $RUNAS_ID may get set incorrectly somewhere else - if [ $RUNAS_ID -eq 0 ]; then - echo "Error: \$RUNAS_ID set to 0, but \$UID is also 0!" - exit 1 - fi + # $RUNAS_ID may get set incorrectly somewhere else + if [ $RUNAS_ID -eq 0 ]; then + echo "Error: \$RUNAS_ID set to 0, but \$UID is also 0!" + exit 1 + fi fi SANITYLOG=${SANITYLOG:-/tmp/sanity.log} @@ -1276,32 +1276,27 @@ test_32f() { run_test 32f "open d32f/symlink->tmp/symlink->lustre-subdir ====" test_32g() { - [ -e $DIR/d32g ] && rm -fr $DIR/d32g - [ -e $DIR/test_dir ] && rm -fr $DIR/test_dir - mkdir -p $DIR/test_dir - mkdir -p $DIR/d32g/tmp - TMP_DIR=$DIR/d32g/tmp - ln -s $DIR/test_dir $TMP_DIR/symlink12 + TMP_DIR=$DIR/$tdir/tmp + mkdir -p $TMP_DIR $DIR/${tdir}2 + ln -s $DIR/${tdir}2 $TMP_DIR/symlink12 ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02 - $CHECKSTAT -t link $DIR/d32g/tmp/symlink12 || error - $CHECKSTAT -t link $DIR/d32g/symlink02 || error - $CHECKSTAT -t dir -f $DIR/d32g/tmp/symlink12 || error - $CHECKSTAT -t dir -f $DIR/d32g/symlink02 || error + $CHECKSTAT -t link $TMP_DIR/symlink12 || error + $CHECKSTAT -t link $DIR/$tdir/symlink02 || error + $CHECKSTAT -t dir -f $TMP_DIR/symlink12 || error + $CHECKSTAT -t dir -f $DIR/$tdir/symlink02 || error } -run_test 32g "stat d32g/symlink->tmp/symlink->lustre-subdir/test_dir" +run_test 32g "stat d32g/symlink->tmp/symlink->lustre-subdir/${tdir}2" test_32h() { - [ -e $DIR/d32h ] && rm -fr $DIR/d32h - [ -e $DIR/test_dir ] && rm -fr $DIR/test_dir - mkdir -p $DIR/test_dir - mkdir -p $DIR/d32h/tmp - TMP_DIR=$DIR/d32h/tmp - ln -s $DIR/test_dir $TMP_DIR/symlink12 + rm -fr $DIR/$tdir $DIR/${tdir}2 + TMP_DIR=$DIR/$tdir/tmp + mkdir -p $TMP_DIR $DIR/${tdir}2 + ln -s $DIR/${tdir}2 $TMP_DIR/symlink12 ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02 - ls $DIR/d32h/tmp/symlink12 || error - ls $DIR/d32h/symlink02 || error + ls $TMP_DIR/symlink12 || error + ls $DIR/$tdir/symlink02 || error } -run_test 32h "open d32h/symlink->tmp/symlink->lustre-subdir/test_dir" +run_test 32h "open d32h/symlink->tmp/symlink->lustre-subdir/${tdir}2" test_32i() { [ -e $DIR/d32i ] && rm -fr $DIR/d32i @@ -1368,33 +1363,32 @@ test_32n() { run_test 32n "open d32n/symlink->tmp/symlink->lustre-root ======" test_32o() { - rm -fr $DIR/d32o - rm -f $DIR/test_file - touch $DIR/test_file + rm -fr $DIR/d32o $DIR/$tfile + touch $DIR/$tfile mkdir -p $DIR/d32o/tmp TMP_DIR=$DIR/d32o/tmp - ln -s $DIR/test_file $TMP_DIR/symlink12 + ln -s $DIR/$tfile $TMP_DIR/symlink12 ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02 $CHECKSTAT -t link $DIR/d32o/tmp/symlink12 || error $CHECKSTAT -t link $DIR/d32o/symlink02 || error $CHECKSTAT -t file -f $DIR/d32o/tmp/symlink12 || error $CHECKSTAT -t file -f $DIR/d32o/symlink02 || error } -run_test 32o "stat d32o/symlink->tmp/symlink->lustre-root/test_file" +run_test 32o "stat d32o/symlink->tmp/symlink->lustre-root/$tfile" test_32p() { log 32p_1 rm -fr $DIR/d32p log 32p_2 - rm -f $DIR/test_file + rm -f $DIR/$tfile log 32p_3 - touch $DIR/test_file + touch $DIR/$tfile log 32p_4 mkdir -p $DIR/d32p/tmp log 32p_5 TMP_DIR=$DIR/d32p/tmp log 32p_6 - ln -s $DIR/test_file $TMP_DIR/symlink12 + ln -s $DIR/$tfile $TMP_DIR/symlink12 log 32p_7 ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02 log 32p_8 @@ -1403,7 +1397,7 @@ test_32p() { cat $DIR/d32p/symlink02 || error log 32p_10 } -run_test 32p "open d32p/symlink->tmp/symlink->lustre-root/test_file" +run_test 32p "open d32p/symlink->tmp/symlink->lustre-root/$tfile" test_32q() { [ -e $DIR/d32q ] && rm -fr $DIR/d32q @@ -1551,14 +1545,6 @@ test_36e() { } run_test 36e "utime on non-owned file (should return error) ====" -export TIMEOUT_OLD=`sysctl -n lustre.timeout` -export TIMEOUT_NEW=16 -sysctl -w lustre.timeout=$TIMEOUT_NEW - -export FMD_MAX_AGE=`cat $LPROC/obdfilter/*/client_cache_seconds | head -n 1` -for F in $LPROC/obdfilter/*/client_cache_seconds; do - echo 12 > $F -done test_36f() { export LANG=C LC_LANG=C # for date language @@ -1583,21 +1569,22 @@ test_36f() { } run_test 36f "utime on file racing with OST BRW write ==========" +if [ -d $LPROC/obdfilter ]; then +export FMD_MAX_AGE=`cat $LPROC/obdfilter/*/client_cache_seconds | head -n 1` + test_36g() { FMD_BEFORE="`awk '/ll_fmd_cache/ { print $2 }' /proc/slabinfo`" touch $DIR/d36/$tfile - sleep $((TIMEOUT_NEW + 10)) + sleep $((FMD_MAX_AGE + 12)) FMD_AFTER="`awk '/ll_fmd_cache/ { print $2 }' /proc/slabinfo`" [ "$FMD_AFTER" -gt "$FMD_BEFORE" ] && \ echo "AFTER : $FMD_AFTER > BEFORE $FMD_BEFORE" && \ error "fmd didn't expire after ping" || true } run_test 36g "filter mod data cache expiry =====================" - -sysctl -w lustre.timeout=$TIMEOUT_OLD -for F in $LPROC/obdfilter/*/client_cache_seconds; do - echo $FMD_MAX_AGE > $F -done +else + log "skipping test_36g because of non-local OST" +fi # [ -d $LPROC/obdfilter ] test_37() { mkdir -p $DIR/dextra @@ -1610,7 +1597,7 @@ test_37() { run_test 37 "ls a mounted file system to check old content =====" test_38() { - o_directory $DIR/test38 + o_directory $DIR/$tfile } run_test 38 "open a regular file with O_DIRECTORY ==============" diff --git a/lustre/tests/sanityN.sh b/lustre/tests/sanityN.sh index 8a05713..c84d6d7 100644 --- a/lustre/tests/sanityN.sh +++ b/lustre/tests/sanityN.sh @@ -600,6 +600,28 @@ test_25() { } run_test 25 "change ACL on one mountpoint be seen on another ===" +test_26a() { + rm -f $DIR1/f26a + utime $DIR1/f26a -s $DIR2/f26a || error +} +run_test 26a "allow mtime to get older" + +test_26b() { + rm -f $DIR1/f26b + touch $DIR1/f26b + sleep 1 + echo "aaa" >> $DIR1/f26b + sleep 1 + chmod a+x $DIR2/f26b + mt1=`stat $DIR1/f26b | sed 's/\./ /g' | awk ' /Modify/ { print $5 }'` + mt2=`stat $DIR2/f26b | sed 's/\./ /g' | awk ' /Modify/ { print $5 }'` + + if [ x"$mt1" != x"$mt2" ]; then + error "not equal mtime, client1: "$mt1", client2: "$mt2"." + fi +} +run_test 26b "sync mtime between ost and mds" + log "cleanup: ======================================================" rm -rf $DIR1/[df][0-9]* $DIR1/lnk || true if [ "$I_MOUNTED" = "yes" ]; then diff --git a/lustre/tests/utime.c b/lustre/tests/utime.c index 5b9c2dd..8d8cd08 100644 --- a/lustre/tests/utime.c +++ b/lustre/tests/utime.c @@ -14,7 +14,7 @@ void usage(char *prog) { - fprintf(stderr, "usage: %s \n", prog); + fprintf(stderr, "usage: %s [-s ]\n", prog); exit(1); } @@ -22,15 +22,26 @@ int main(int argc, char *argv[]) { long before_mknod, after_mknod; const char *prog = argv[0]; - const char *filename = argv[1]; + const char *filename = argv[1]; + char *secname = NULL; struct utimbuf utb; - struct stat st; + struct stat st, st2; int rc; + int c; - utb.actime = 0x47114711; - utb.modtime = 0x11471147; + utb.actime = 200000; + utb.modtime = 100000; - if (argc != 2) + while ((c = getopt(argc, argv, "s:")) != -1) { + switch(c) { + case 's': + secname = optarg; + break; + default: + usage(argv[0]); + } + } + if (optind + 1 > argc) usage(argv[0]); /* Adjust the before time back one second, because the kernel's @@ -62,10 +73,33 @@ int main(int argc, char *argv[]) return 4; } - printf("%s: good mknod times %lu%s <= %lu <= %lu\n", + printf("%s: good mknod times %lu%s <= %lu <= %lu for %s\n", prog, before_mknod, before_mknod == st.st_mtime ? "*":"", - st.st_mtime, after_mknod); + st.st_mtime, after_mknod, filename); + if (secname) { + sleep(1); + rc = stat(secname, &st2); + if (rc) { + fprintf(stderr, "%s: stat(%s) failed: rc %d: " + "%s\n", prog, secname, errno, + strerror(errno)); + return 5; + } + + if (st2.st_mtime < before_mknod || + st2.st_mtime > after_mknod) { + fprintf(stderr, "%s: bad mknod times %lu <= %lu" + " <= %lu false\n", prog, before_mknod, + st2.st_mtime, after_mknod); + return 6; + } + + printf("%s: good mknod times %lu%s <= %lu <= %lu " + "for %s\n", prog, before_mknod, + before_mknod == st.st_mtime ? "*":"", + st2.st_mtime, after_mknod, secname); + } } /* See above */ @@ -73,30 +107,55 @@ int main(int argc, char *argv[]) if (rc) { fprintf(stderr, "%s: utime(%s) failed: rc %d: %s\n", prog, filename, errno, strerror(errno)); - return 5; + return 7; } - + rc = stat(filename, &st); if (rc) { fprintf(stderr, "%s: second stat(%s) failed: rc %d: %s\n", prog, filename, errno, strerror(errno)); - return 6; + return 8; } if (st.st_mtime != utb.modtime ) { fprintf(stderr, "%s: bad utime mtime %lu should be %lu\n", prog, st.st_mtime, utb.modtime); - return 7; + return 9; } if (st.st_atime != utb.actime ) { fprintf(stderr, "%s: bad utime atime %lu should be %lu\n", prog, st.st_atime, utb.actime); - return 7; + return 10; } printf("%s: good utime mtimes %lu, atime %lu\n", prog, utb.modtime, utb.actime); + if (secname == NULL) + return 0; + + /* Checking that times in past get updated on another client. */ + rc = stat(secname, &st2); + if (rc) { + fprintf(stderr, "%s: second stat(%s) failed: rc %d: %s\n", + prog, secname, errno, strerror(errno)); + return 12; + } + + if (st2.st_mtime != st.st_mtime) { + fprintf(stderr, "%s: not synced mtime between clients: %lu " + "should be %lu\n", prog, st2.st_mtime, st.st_mtime); + return 13; + } + + if (st2.st_ctime != st.st_ctime) { + fprintf(stderr, "%s: not synced ctime between clients: %lu " + " should be %lu\n", prog, st2.st_ctime, st.st_ctime); + return 14; + } + + printf("%s: updated times for %s\n", prog, secname); + return 0; } diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index d64a920..742ce9d 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -257,7 +257,7 @@ static int setup_obd_uuids(DIR *dir, char *dname, struct find_param *param) return rc; } - if (!param->obduuid && !param->quiet) + if (!param->obduuid && !param->quiet && !param->obds_printed) printf("OBDS:\n"); while (fgets(buf, sizeof(buf), fp) != NULL) { @@ -270,15 +270,16 @@ static int setup_obd_uuids(DIR *dir, char *dname, struct find_param *param) param->obdindex = index; break; } - } else if (!param->quiet) { + } else if (!param->quiet && !param->obds_printed) { /* Print everything */ printf("%s", buf); } } + param->obds_printed = 1; fclose(fp); - if (!param->quiet && param->obduuid && + if (!param->quiet && param->obduuid && (param->obdindex == OBD_NOT_FOUND)) { fprintf(stderr, "error: %s: unknown obduuid: %s\n", __FUNCTION__, param->obduuid->uuid); @@ -406,7 +407,7 @@ void lov_dump_user_lmm_join(struct lov_user_md_v1 *lum, char *path, } } -void llapi_lov_dump_user_lmm(struct find_param *param, +void llapi_lov_dump_user_lmm(struct find_param *param, char *path, int is_dir) { switch(*(__u32 *)¶m->lmd->lmd_lmm) { /* lum->lmm_magic */ @@ -519,11 +520,11 @@ static DIR *opendir_parent(char *path) DIR *parent; char *fname; char c; - + fname = strrchr(path, '/'); if (fname == NULL) return opendir("."); - + c = fname[1]; fname[1] = '\0'; parent = opendir(path); @@ -537,15 +538,14 @@ static int llapi_semantic_traverse(char *path, DIR *parent, { struct dirent64 *dent; int len, ret; - DIR *d, *p; - + DIR *d, *p = NULL; + ret = 0; - p = NULL; len = strlen(path); d = opendir(path); if (!d && errno != ENOTDIR) { - fprintf(stderr, "%s: Failed to open '%s': %s.", + fprintf(stderr, "%s: Failed to open '%s': %s.", __FUNCTION__, path, strerror(errno)); return -EINVAL; } else if (!d && !parent) { @@ -564,7 +564,7 @@ static int llapi_semantic_traverse(char *path, DIR *parent, while((dent = readdir64(d)) != NULL) { if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..")) continue; - + path[len] = 0; strcat(path, "/"); strcat(path, dent->d_name); @@ -601,11 +601,11 @@ static int llapi_semantic_traverse(char *path, DIR *parent, out: path[len] = 0; - + if (sem_fini) sem_fini(path, parent, d, data); err: - if (d) + if (d) closedir(d); if (p) closedir(p); @@ -614,9 +614,9 @@ err: /* Check if the file time matches 1 of the given criteria (e.g. --atime +/-N). * @mds indicates if this is MDS timestamps and there are attributes on OSTs. - * + * * The result is -1 if it does not match, 0 if not yet clear, 1 if matches. - * The table bolow gives the answers for the specified parameters (time and + * The table bolow gives the answers for the specified parameters (time and * sign), 1st column is the answer for the MDS time, the 2nd is for the OST: * -------------------------------------- * 1 | file > limit; sign > 0 | -1 / -1 | @@ -629,7 +629,7 @@ err: * 8 | file = limit; sign < 0 | ? / -1 | * 9 | file < limit; sign < 0 | ? / -1 | * -------------------------------------- - * Note: 5th actually means that the file time stamp is within the interval + * Note: 5th actually means that the file time stamp is within the interval * (limit - 24hours, limit]. */ static int find_time_cmp(time_t file, time_t limit, int sign, int mds) { if (sign > 0) { @@ -656,10 +656,10 @@ static int find_time_cmp(time_t file, time_t limit, int sign, int mds) { /* Check if the file time matches all the given criteria (e.g. --atime +/-N). * Return -1 or 1 if file timestamp does not or does match the given criteria - * correspondingly. Return 0 if the MDS time is being checked and there are + * correspondingly. Return 0 if the MDS time is being checked and there are * attributes on OSTs and it is not yet clear if the timespamp matches. - * - * If 0 is returned, we need to do another RPC to the OSTs to obtain the + * + * If 0 is returned, we need to do another RPC to the OSTs to obtain the * updated timestamps. */ static int find_time_check(lstat_t *st, struct find_param *param, int mds) { @@ -668,15 +668,15 @@ static int find_time_check(lstat_t *st, struct find_param *param, int mds) /* Check if file is accepted. */ if (param->atime) { - ret = find_time_cmp(st->st_atime, param->atime, + ret = find_time_cmp(st->st_atime, param->atime, param->asign, mds); if (ret < 0) return ret; rc = ret; } - + if (param->mtime) { - ret = find_time_cmp(st->st_mtime, param->mtime, + ret = find_time_cmp(st->st_mtime, param->mtime, param->msign, mds); if (ret < 0) return ret; @@ -686,13 +686,13 @@ static int find_time_check(lstat_t *st, struct find_param *param, int mds) if (rc == 1) rc = ret; } - + if (param->ctime) { ret = find_time_cmp(st->st_ctime, param->ctime, param->csign, mds); if (ret < 0) return ret; - + /* If the previous check matches, but this one is not yet clear, * we should return 0 to do an RPC on OSTs. */ if (rc == 1) @@ -711,7 +711,7 @@ static int cb_find_init(char *path, DIR *parent, DIR *dir, void *data) int ret = 0; LASSERT(parent != NULL || dir != NULL); - + param->lmd->lmd_lmm.lmm_stripe_count = 0; /* If a time or OST should be checked, the decision is not taken yet. */ @@ -721,17 +721,17 @@ static int cb_find_init(char *path, DIR *parent, DIR *dir, void *data) /* Request MDS for the stat info. */ if (!decision && dir) { /* retrieve needed file info */ - ret = ioctl(dirfd(dir), LL_IOC_MDC_GETINFO, + ret = ioctl(dirfd(dir), LL_IOC_MDC_GETINFO, (void *)param->lmd); } else if (!decision && parent) { char *fname = strrchr(path, '/') + 1; - + /* retrieve needed file info */ strncpy((char *)param->lmd, fname, param->lumlen); - ret = ioctl(dirfd(parent), IOC_MDC_GETFILEINFO, + ret = ioctl(dirfd(parent), IOC_MDC_GETFILEINFO, (void *)param->lmd); } - + if (ret) { if (errno == ENOTTY) { /* ioctl is not supported, it is not a lustre fs. @@ -745,7 +745,7 @@ static int cb_find_init(char *path, DIR *parent, DIR *dir, void *data) } } else { err_msg("error: %s: %s failed for %s", __FUNCTION__, - dir ? "LL_IOC_MDC_GETINFO" : + dir ? "LL_IOC_MDC_GETINFO" : "IOC_MDC_GETFILEINFO", path); return ret; } @@ -753,13 +753,14 @@ static int cb_find_init(char *path, DIR *parent, DIR *dir, void *data) /* Prepare odb. */ if (param->obduuid) { - if (lustre_fs && param->got_uuids && + if (lustre_fs && param->got_uuids && param->st_dev != st->st_dev) { /* A lustre/lustre mount point is crossed. */ param->got_uuids = 0; + param->obds_printed = 0; param->obdindex = OBD_NOT_FOUND; } - + if (lustre_fs && !param->got_uuids) { ret = setup_obd_uuids(dir ? dir : parent, path, param); if (ret) @@ -778,44 +779,43 @@ static int cb_find_init(char *path, DIR *parent, DIR *dir, void *data) /* If a OST UUID is given, and some OST matches, check it here. */ if (decision != -1 && param->obdindex != OBD_NOT_FOUND) { - /* Only those files should be accepted, which have a strip on + /* Only those files should be accepted, which have a strip on * the specified OST. */ if (!param->lmd->lmd_lmm.lmm_stripe_count) { decision = -1; } else { int i; - for (i = 0; - i < param->lmd->lmd_lmm.lmm_stripe_count; - i++) { - if (param->obdindex == - param->lmd->lmd_lmm.lmm_objects[i].l_ost_idx) + for (i = 0; + i < param->lmd->lmd_lmm.lmm_stripe_count; i++) { + if (param->obdindex == + param->lmd->lmd_lmm.lmm_objects[i].l_ost_idx) break; } - + if (i == param->lmd->lmd_lmm.lmm_stripe_count) decision = -1; } } - + /* Check the time on mds. */ if (!decision) { int for_mds; - + for_mds = lustre_fs ? param->lmd->lmd_lmm.lmm_stripe_count : 0; decision = find_time_check(st, param, for_mds); } - + /* If file still fits the request, ask osd for updated info. - The regulat stat is almost of the same speed as some new + The regulat stat is almost of the same speed as some new 'glimpse-size-ioctl'. */ if (!decision && param->lmd->lmd_lmm.lmm_stripe_count) { if (dir) { ret = ioctl(dirfd(dir), IOC_LOV_GETINFO, (void *)param->lmd); } else if (parent) { - ret = ioctl(dirfd(parent), IOC_LOV_GETINFO, + ret = ioctl(dirfd(parent), IOC_LOV_GETINFO, (void *)param->lmd); - } + } if (ret) { fprintf(stderr, "%s: IOC_LOV_GETINFO on %s failed: " @@ -832,7 +832,7 @@ static int cb_find_init(char *path, DIR *parent, DIR *dir, void *data) printf("%s", path); if (param->zeroend) printf("%c", '\0'); - else + else printf("\n"); } @@ -855,7 +855,7 @@ int llapi_find(char *path, struct find_param *param) { char buf[PATH_MAX + 1]; int ret; - + ret = common_param_init(param); if (ret) return ret; @@ -863,8 +863,8 @@ int llapi_find(char *path, struct find_param *param) param->depth = 0; strncpy(buf, path, strlen(path)); buf[strlen(path)] = '\0'; - - ret = llapi_semantic_traverse(buf, NULL, cb_find_init, + + ret = llapi_semantic_traverse(buf, NULL, cb_find_init, cb_common_fini, param); find_param_fini(param); @@ -877,37 +877,36 @@ static int cb_getstripe(char *path, DIR *parent, DIR *d, void *data) int ret = 0; LASSERT(parent != NULL || d != NULL); - + /* Prepare odb. */ if (!param->got_uuids) { ret = setup_obd_uuids(d ? d : parent, path, param); if (ret) return ret; } - + if (d) { - ret = ioctl(dirfd(d), LL_IOC_LOV_GETSTRIPE, + ret = ioctl(dirfd(d), LL_IOC_LOV_GETSTRIPE, (void *)¶m->lmd->lmd_lmm); } else if (parent) { char *fname = strrchr(path, '/') + 1; - + strncpy((char *)¶m->lmd->lmd_lmm, fname, param->lumlen); ret = ioctl(dirfd(parent), IOC_MDC_GETFILESTRIPE, (void *)¶m->lmd->lmd_lmm); - } + } if (ret) { if (errno == ENODATA) { if (!param->obduuid && !param->quiet) - printf("%s has no stripe info\n", - path); + printf("%s has no stripe info\n", path); goto out; } else if (errno == ENOTTY) { fprintf(stderr, "%s: '%s' not on a Lustre fs?\n", __FUNCTION__, path); } else { err_msg("error: %s: %s failed for %s", __FUNCTION__, - d ? "LL_IOC_LOV_GETSTRIPE" : + d ? "LL_IOC_LOV_GETSTRIPE" : "IOC_MDC_GETFILESTRIPE", path); } @@ -933,7 +932,7 @@ int llapi_getstripe(char *path, struct find_param *param) return ret; param->depth = 0; - ret = llapi_semantic_traverse(path, NULL, cb_getstripe, + ret = llapi_semantic_traverse(path, NULL, cb_getstripe, cb_common_fini, param); find_param_fini(param); return ret < 0 ? ret : 0; @@ -1187,17 +1186,17 @@ static int cb_quotachown(char *path, DIR *parent, DIR *d, void *data) struct find_param *param = (struct find_param *)data; lstat_t *st; int rc; - + LASSERT(parent != NULL || d != NULL); if (d) { - rc = ioctl(dirfd(d), LL_IOC_MDC_GETINFO, + rc = ioctl(dirfd(d), LL_IOC_MDC_GETINFO, (void *)param->lmd); } else if (parent) { char *fname = strrchr(path, '/') + 1; strncpy((char *)param->lmd, fname, param->lumlen); - rc = ioctl(dirfd(parent), IOC_MDC_GETFILEINFO, + rc = ioctl(dirfd(parent), IOC_MDC_GETFILEINFO, (void *)param->lmd); } else { return 0; @@ -1211,7 +1210,7 @@ static int cb_quotachown(char *path, DIR *parent, DIR *d, void *data) rc = 0; } else if (errno != EISDIR) { err_msg("%s ioctl failed for %s.", - d ? "LL_IOC_MDC_GETINFO" : + d ? "LL_IOC_MDC_GETINFO" : "IOC_MDC_GETFILEINFO", path); rc = errno; } diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index d4219f3..82d0c3b 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -130,8 +130,7 @@ check_ptlrpc_body(void) CHECK_MEMBER(ptlrpc_body, pb_paddings[3]); } -static void -check_obd_connect(void) +static void check_obd_connect_data(void) { BLANK_LINE(); CHECK_STRUCT(obd_connect_data); @@ -139,9 +138,32 @@ check_obd_connect(void) CHECK_MEMBER(obd_connect_data, ocd_version); CHECK_MEMBER(obd_connect_data, ocd_grant); CHECK_MEMBER(obd_connect_data, ocd_index); + CHECK_MEMBER(obd_connect_data, ocd_unused); CHECK_MEMBER(obd_connect_data, ocd_ibits_known); CHECK_MEMBER(obd_connect_data, ocd_nllu); CHECK_MEMBER(obd_connect_data, ocd_nllg); + CHECK_MEMBER(obd_connect_data, padding1); + CHECK_MEMBER(obd_connect_data, padding2); + CHECK_MEMBER(obd_connect_data, padding3); + CHECK_MEMBER(obd_connect_data, padding4); + + CHECK_CDEFINE(OBD_CONNECT_RDONLY); + CHECK_CDEFINE(OBD_CONNECT_INDEX); + CHECK_CDEFINE(OBD_CONNECT_GRANT); + CHECK_CDEFINE(OBD_CONNECT_SRVLOCK); + CHECK_CDEFINE(OBD_CONNECT_VERSION); + CHECK_CDEFINE(OBD_CONNECT_REQPORTAL); + CHECK_CDEFINE(OBD_CONNECT_ACL); + CHECK_CDEFINE(OBD_CONNECT_XATTR); + CHECK_CDEFINE(OBD_CONNECT_CROW); + CHECK_CDEFINE(OBD_CONNECT_TRUNCLOCK); + CHECK_CDEFINE(OBD_CONNECT_TRANSNO); + CHECK_CDEFINE(OBD_CONNECT_IBITS); + CHECK_CDEFINE(OBD_CONNECT_JOIN); + CHECK_CDEFINE(OBD_CONNECT_ATTRFID); + CHECK_CDEFINE(OBD_CONNECT_NODEVOH); + CHECK_CDEFINE(OBD_CONNECT_LCL_CLIENT); + CHECK_CDEFINE(OBD_CONNECT_RMT_CLIENT); } static void @@ -427,6 +449,15 @@ check_mds_body(void) CHECK_CDEFINE(MDS_OPEN_HAS_EA); CHECK_CDEFINE(MDS_OPEN_HAS_OBJS); + /* these should be identical to their EXT3_*_FL counterparts, and + * are redefined only to avoid dragging in ext3_fs.h */ + CHECK_CDEFINE(MDS_SYNC_FL); + CHECK_CDEFINE(MDS_IMMUTABLE_FL); + CHECK_CDEFINE(MDS_APPEND_FL); + CHECK_CDEFINE(MDS_NOATIME_FL); + CHECK_CDEFINE(MDS_DIRSYNC_FL); + CHECK_CDEFINE(MDS_BFLAG_EXT_FLAGS); + CHECK_CDEFINE(MDS_INODELOCK_LOOKUP); CHECK_CDEFINE(MDS_INODELOCK_UPDATE); CHECK_CDEFINE(MDS_INODELOCK_OPEN); @@ -1116,24 +1147,6 @@ main(int argc, char **argv) CHECK_VALUE(MGS_TARGET_REG); CHECK_VALUE(MGS_TARGET_DEL); - CHECK_CDEFINE(OBD_CONNECT_RDONLY); - CHECK_CDEFINE(OBD_CONNECT_INDEX); - CHECK_CDEFINE(OBD_CONNECT_GRANT); - CHECK_CDEFINE(OBD_CONNECT_SRVLOCK); - CHECK_CDEFINE(OBD_CONNECT_VERSION); - CHECK_CDEFINE(OBD_CONNECT_REQPORTAL); - CHECK_CDEFINE(OBD_CONNECT_ACL); - CHECK_CDEFINE(OBD_CONNECT_XATTR); - CHECK_CDEFINE(OBD_CONNECT_CROW); - CHECK_CDEFINE(OBD_CONNECT_TRUNCLOCK); - CHECK_CDEFINE(OBD_CONNECT_TRANSNO); - CHECK_CDEFINE(OBD_CONNECT_IBITS); - CHECK_CDEFINE(OBD_CONNECT_JOIN); - CHECK_CDEFINE(OBD_CONNECT_ATTRFID); - CHECK_CDEFINE(OBD_CONNECT_NODEVOH); - CHECK_CDEFINE(OBD_CONNECT_LCL_CLIENT); - CHECK_CDEFINE(OBD_CONNECT_RMT_CLIENT); - COMMENT("Sizes and Offsets"); BLANK_LINE(); CHECK_STRUCT(obd_uuid); @@ -1143,7 +1156,7 @@ main(int argc, char **argv) printf(" LASSERT(offsetof(struct lustre_msg_v1, lm_magic) == " "offsetof(struct lustre_msg_v2, lm_magic));\n"); check_ptlrpc_body(); - check_obd_connect(); + check_obd_connect_data(); check_obdo(); check_lov_mds_md_v1(); check_lov_mds_md_join(); -- 1.8.3.1