--- lustre-1.8.3.orig/lustre/kernel_patches/patches/debian-2.6.26.diff
+++ lustre-1.8.3/lustre/kernel_patches/patches/debian-2.6.26.diff
@@ -0,0 +1,1210 @@
+diff -u -r debian-2.6.26/Documentation/filesystems/ext2.txt debian-2.6.26_lustre.1.8.2/Documentation/filesystems/ext2.txt
+--- debian-2.6.26/Documentation/filesystems/ext2.txt	2008-07-13 23:51:29.000000000 +0200
++++ debian-2.6.26_lustre.1.8.2/Documentation/filesystems/ext2.txt	2010-02-12 15:11:19.000000000 +0100
+@@ -58,6 +58,22 @@
+ 
+ xip				Use execute in place (no caching) if possible
+ 
++iopen                          Makes an invisible pseudo-directory called 
++                               __iopen__ available in the root directory
++                               of the filesystem.  Allows open-by-inode-
++                               number.  i.e., inode 3145 can be accessed
++                               via /mntpt/__iopen__/3145
++
++iopen_nopriv                   This option makes the iopen directory be
++                               world-readable.  This may be safer since it
++                               allows daemons to run as an unprivileged user,
++                               however it significantly changes the security
++                               model of a Unix filesystem, since previously
++                               all files under a mode 700 directory were not
++                               generally avilable even if the
++                               permissions on the file itself is
++                               world-readable.
++
+ grpquota,noquota,quota,usrquota	Quota options are silently ignored by ext2.
+ 
+ 
+diff -u -r debian-2.6.26/block/blk-core.c debian-2.6.26_lustre.1.8.2/block/blk-core.c
+--- debian-2.6.26/block/blk-core.c	2008-07-13 23:51:29.000000000 +0200
++++ debian-2.6.26_lustre.1.8.2/block/blk-core.c	2010-02-12 15:14:32.000000000 +0100
+@@ -1270,6 +1270,8 @@
+ 
+ #endif /* CONFIG_FAIL_MAKE_REQUEST */
+ 
++int dev_check_rdonly(struct block_device *bdev);
++
+ /*
+  * Check whether this bio extends beyond the end of the device.
+  */
+@@ -1371,6 +1373,12 @@
+ 
+ 		if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags)))
+ 			goto end_io;
++                /* this is cfs's dev_rdonly check */
++                if (bio->bi_rw == WRITE &&
++                                dev_check_rdonly(bio->bi_bdev)) {
++                        bio_endio(bio, 0);
++                        break;
++                }
+ 
+ 		if (should_fail_request(bio))
+ 			goto end_io;
+@@ -2028,6 +2036,91 @@
+ }
+ EXPORT_SYMBOL(kblockd_flush_work);
+ 
++ /*
++ * Debug code for turning block devices "read-only" (will discard writes
++ * silently).  This is for filesystem crash/recovery testing.
++ */
++struct deventry {
++       dev_t dev;
++       struct deventry *next;
++};
++
++static struct deventry *devlist = NULL;
++static spinlock_t devlock = SPIN_LOCK_UNLOCKED;
++
++int dev_check_rdonly(struct block_device *bdev)
++{
++       struct deventry *cur;
++       if (!bdev) return 0;
++       spin_lock(&devlock);
++       cur = devlist;
++       while(cur) {
++               if (bdev->bd_dev == cur->dev) {
++                       spin_unlock(&devlock);
++                       return 1;
++       }
++               cur = cur->next;
++       }
++       spin_unlock(&devlock);
++       return 0;
++}
++
++void dev_set_rdonly(struct block_device *bdev)
++{
++       struct deventry *newdev, *cur;
++
++       if (!bdev)
++               return;
++       newdev = kmalloc(sizeof(struct deventry), GFP_KERNEL);
++       if (!newdev)
++               return;
++
++       spin_lock(&devlock);
++       cur = devlist;
++       while(cur) {
++               if (bdev->bd_dev == cur->dev) {
++                       spin_unlock(&devlock);
++                       kfree(newdev);
++                       return;
++               }
++               cur = cur->next;
++       }
++       newdev->dev = bdev->bd_dev;
++       newdev->next = devlist;
++       devlist = newdev;
++       spin_unlock(&devlock);
++       printk(KERN_WARNING "Turning device %s (%#x) read-only\n",
++              bdev->bd_disk ? bdev->bd_disk->disk_name : "", bdev->bd_dev);
++}
++
++void dev_clear_rdonly(struct block_device *bdev)
++{
++       struct deventry *cur, *last = NULL;
++       if (!bdev) return;
++       spin_lock(&devlock);
++       cur = devlist;
++       while(cur) {
++               if (bdev->bd_dev == cur->dev) {
++                       if (last)
++                               last->next = cur->next;
++                       else
++                               devlist = cur->next;
++                       spin_unlock(&devlock);
++                       kfree(cur);
++                       printk(KERN_WARNING "Removing read-only on %s (%#x)\n",
++                              bdev->bd_disk ? bdev->bd_disk->disk_name :
++                                              "unknown block", bdev->bd_dev);
++                       return;
++               }
++               last = cur;
++               cur = cur->next;
++       }
++       spin_unlock(&devlock);
++}
++
++EXPORT_SYMBOL(dev_set_rdonly);
++EXPORT_SYMBOL(dev_clear_rdonly);
++
+ int __init blk_dev_init(void)
+ {
+ 	int i;
+diff -u -r debian-2.6.26/drivers/md/raid5.c debian-2.6.26_lustre.1.8.2/drivers/md/raid5.c
+--- debian-2.6.26/drivers/md/raid5.c	2008-07-13 23:51:29.000000000 +0200
++++ debian-2.6.26_lustre.1.8.2/drivers/md/raid5.c	2010-02-12 15:19:25.000000000 +0100
+@@ -1817,6 +1817,8 @@
+ 		bi->bi_next = *bip;
+ 	*bip = bi;
+ 	bi->bi_phys_segments ++;
++        if (bio_sync(bi) && !forwrite)
++                clear_bit(R5_UPTODATE, &sh->dev[dd_idx].flags); /* force to read from disk. */
+ 	spin_unlock_irq(&conf->device_lock);
+ 	spin_unlock(&sh->lock);
+ 
+@@ -3699,6 +3701,8 @@
+ 			      test_bit(BIO_UPTODATE, &bi->bi_flags)
+ 			        ? 0 : -EIO);
+ 	}
++	if (bio_sync(bi))
++		raid5_unplug_device(q);
+ 	return 0;
+ }
+ 
+diff -u -r debian-2.6.26/drivers/scsi/Kconfig debian-2.6.26_lustre.1.8.2/drivers/scsi/Kconfig
+--- debian-2.6.26/drivers/scsi/Kconfig	2009-12-26 09:14:53.000000000 +0100
++++ debian-2.6.26_lustre.1.8.2/drivers/scsi/Kconfig	2010-02-12 15:20:02.000000000 +0100
+@@ -81,6 +81,14 @@
+ 	  In this case, do not compile the driver for your SCSI host adapter
+ 	  (below) as a module either.
+ 
++config SD_IOSTATS
++   bool "Enable SCSI disk I/O stats"
++   depends on BLK_DEV_SD
++   default y
++   ---help---
++     This enables SCSI disk I/O stats collection.  You must also enable
++     /proc file system support if you want this feature.
++
+ config CHR_DEV_ST
+ 	tristate "SCSI tape support"
+ 	depends on SCSI
+diff -u -r debian-2.6.26/drivers/scsi/scsi_proc.c debian-2.6.26_lustre.1.8.2/drivers/scsi/scsi_proc.c
+--- debian-2.6.26/drivers/scsi/scsi_proc.c	2008-07-13 23:51:29.000000000 +0200
++++ debian-2.6.26_lustre.1.8.2/drivers/scsi/scsi_proc.c	2010-02-12 15:22:05.000000000 +0100
+@@ -40,7 +40,8 @@
+ /* 4K page size, but our output routines, use some slack for overruns */
+ #define PROC_BLOCK_SIZE (3*1024)
+ 
+-static struct proc_dir_entry *proc_scsi;
++struct proc_dir_entry *proc_scsi;
++EXPORT_SYMBOL(proc_scsi);
+ 
+ /* Protect sht->present and sht->proc_dir */
+ static DEFINE_MUTEX(global_host_template_mutex);
+diff -u -r debian-2.6.26/drivers/scsi/sd.c debian-2.6.26_lustre.1.8.2/drivers/scsi/sd.c
+--- debian-2.6.26/drivers/scsi/sd.c	2008-07-13 23:51:29.000000000 +0200
++++ debian-2.6.26_lustre.1.8.2/drivers/scsi/sd.c	2010-02-17 14:13:32.000000000 +0100
+@@ -107,6 +107,24 @@
+  * object after last put) */
+ static DEFINE_MUTEX(sd_ref_mutex);
+ 
++#if (defined(CONFIG_SD_IOSTATS) && defined(CONFIG_PROC_FS))
++# include <linux/proc_fs.h>
++# include <linux/seq_file.h>
++struct proc_dir_entry *sd_iostats_procdir = NULL;
++char sd_iostats_procdir_name[] = "sd_iostats";
++static struct file_operations sd_iostats_proc_fops;
++
++extern void sd_iostats_init(void);
++extern void sd_iostats_fini(void);
++void sd_iostats_start_req(struct scsi_cmnd *SCpnt);
++void sd_iostats_finish_req(struct scsi_cmnd *SCpnt);
++#else
++static inline void sd_iostats_init(void) {}
++static inline void sd_iostats_fini(void) {}
++static inline void sd_iostats_start_req(struct scsi_cmnd *SCpnt) {}
++static inline void sd_iostats_finish_req(struct scsi_cmnd *SCpnt) {}
++#endif
++
+ static const char *sd_cache_types[] = {
+ 	"write through", "none", "write back",
+ 	"write back, no read (daft)"
+@@ -531,6 +549,8 @@
+ 	}
+ 	SCpnt->sdb.length = this_count * sdp->sector_size;
+ 
++	sd_iostats_start_req(SCpnt);
++
+ 	/*
+ 	 * We shouldn't disconnect in the middle of a sector, so with a dumb
+ 	 * host adapter, it's safe to assume that we can at least transfer
+@@ -667,7 +687,7 @@
+ 	int diskinfo[4];
+ 
+ 	/* default to most commonly used values */
+-        diskinfo[0] = 0x40;	/* 1 << 6 */
++	diskinfo[0] = 0x40;	/* 1 << 6 */
+        	diskinfo[1] = 0x20;	/* 1 << 5 */
+        	diskinfo[2] = sdkp->capacity >> 11;
+ 	
+@@ -1023,6 +1043,7 @@
+ 		break;
+ 	}
+  out:
++	sd_iostats_finish_req(SCpnt);
+ 	return good_bytes;
+ }
+ 
+@@ -1711,6 +1732,36 @@
+ 	gd->flags = GENHD_FL_DRIVERFS;
+ 	if (sdp->removable)
+ 		gd->flags |= GENHD_FL_REMOVABLE;
++#if (defined(CONFIG_SD_IOSTATS) && defined(CONFIG_PROC_FS))
++       sdkp->stats = kzalloc(sizeof(iostat_stats_t), GFP_KERNEL);
++       if (!sdkp->stats) {
++	       printk(KERN_WARNING "cannot allocate iostat structure for"
++	                           "%s\n", gd->disk_name);
++       } else {
++	       do_gettimeofday(&sdkp->stats->iostat_timeval);
++	       sdkp->stats->iostat_queue_stamp = jiffies;
++	       spin_lock_init(&sdkp->stats->iostat_lock);
++	       if (sd_iostats_procdir) {
++	               struct proc_dir_entry *pde;
++	               pde = create_proc_entry(gd->disk_name, S_IRUGO | S_IWUSR,
++	                                       sd_iostats_procdir);
++	               if (!pde) {
++	                       printk(KERN_WARNING "Can't create /proc/scsi/"
++	                                           "%s/%s\n",
++	                                           sd_iostats_procdir_name,
++	                                           gd->disk_name);
++	                       kfree(sdkp->stats);
++	                       sdkp->stats = NULL;
++	               } else {
++	                       pde->proc_fops = &sd_iostats_proc_fops;
++	                       pde->data = gd;
++	               }
++	       } else {
++	               kfree(sdkp->stats);
++	               sdkp->stats = NULL;
++	       }
++       }
++#endif
+ 
+ 	dev_set_drvdata(dev, sdkp);
+ 	add_disk(gd);
+@@ -1755,6 +1806,366 @@
+ 	return 0;
+ }
+ 
++#if (defined(CONFIG_SD_IOSTATS) && defined(CONFIG_PROC_FS))
++static int
++ sd_iostats_seq_show(struct seq_file *seq, void *v)
++ {
++	struct timeval     now;
++	struct gendisk *disk = seq->private;
++	iostat_stats_t    *stats;
++	unsigned long long read_len;
++	unsigned long long read_len_tot;
++	unsigned long      read_num;
++	unsigned long      read_num_tot;
++	unsigned long long write_len;
++	unsigned long long write_len_tot;
++	unsigned long      write_num;
++	unsigned long      write_num_tot;
++	int                i;
++	int                maxi;
++ 
++	stats = scsi_disk(disk)->stats;
++	if (stats == NULL) {
++	        printk(KERN_ERR "sd_iostats_seq_show: NULL stats entry\n");
++	        BUG();
++	}
++ 
++	do_gettimeofday(&now);
++	now.tv_sec -= stats->iostat_timeval.tv_sec;
++	now.tv_usec -= stats->iostat_timeval.tv_usec;
++	if (now.tv_usec < 0) {
++	        now.tv_usec += 1000000;
++	        now.tv_sec--;
++	}
++ 
++	/* this sampling races with updates */
++	seq_printf(seq, "index:        %lu   snapshot_time:         %lu.%06lu\n",
++	                (unsigned long) scsi_disk(disk)->index,
++	                now.tv_sec, now.tv_usec);
++ 
++	for (i = IOSTAT_NCOUNTERS - 1; i > 0; i--)
++	        if (stats->iostat_read_histogram[i].iostat_count != 0 ||
++	                        stats->iostat_write_histogram[i].iostat_count != 0)
++	                break;
++	maxi = i;
++ 
++	seq_printf(seq, "%8s %8s %12s %8s %12s\n", "size", 
++	                "reads", "total", "writes", "total");
++ 
++	read_len_tot = write_len_tot = 0;
++	read_num_tot = write_num_tot = 0;
++	for (i = 0; i <= maxi; i++) {
++	        read_len = stats->iostat_read_histogram[i].iostat_size;
++	        read_len_tot += read_len;
++	        read_num = stats->iostat_read_histogram[i].iostat_count;
++	        read_num_tot += read_num;
++ 
++	        write_len = stats->iostat_write_histogram[i].iostat_size;
++	        write_len_tot += write_len;
++	        write_num = stats->iostat_write_histogram[i].iostat_count;
++	        write_num_tot += write_num;
++ 
++	        seq_printf (seq, "%8d %8lu %12llu %8lu %12llu\n", 
++	                        512<<i, read_num, read_len, write_num, write_len);
++	}
++ 
++	seq_printf(seq, "%8s %8lu %12llu %8lu %12llu\n\n", "total",
++	                read_num_tot, read_len_tot, 
++	                write_num_tot, write_len_tot);
++ 
++	seq_printf(seq, "%8s %8s %8s\n", "qdepth", "ticks", "%");
++	for (i = 0; i < IOSTAT_NCOUNTERS; i++) {
++	        unsigned long long ticks, percent;
++	        ticks = stats->iostat_queue_ticks[i];
++	        if (ticks == 0)
++	                continue;
++	        percent = stats->iostat_queue_ticks[i] * 100;
++	        do_div(percent, stats->iostat_queue_ticks_sum);
++	        seq_printf(seq, "%8d %8llu %8llu\n", i, ticks, percent);
++	}
++ 
++	if (stats->iostat_reqs != 0) {
++	        unsigned long long aveseek = 0, percent = 0;
++ 
++	        if (stats->iostat_seeks) {
++	                aveseek = stats->iostat_seek_sectors;
++	                do_div(aveseek, stats->iostat_seeks);
++	                percent = stats->iostat_seeks * 100;
++	                do_div(percent, stats->iostat_reqs);
++	        }
++ 
++	        seq_printf(seq, "\n%llu sectors in %llu reqs: %llu seek(s) over "
++	                        "%llu sectors in ave, %llu%% of all reqs\n",
++	                        stats->iostat_sectors, stats->iostat_reqs,
++	                        stats->iostat_seeks, aveseek, percent);
++	}
++ 
++	seq_printf(seq, "\n%16s %8s %8s %8s %8s\n", "process time", "reads",
++	                "%%", "writes", "%%");
++	for (i = 0; i < IOSTAT_NCOUNTERS; i++) {
++	        unsigned long read_percent = 0, write_percent = 0;
++	        if (stats->iostat_wtime[i] == 0 &&
++	                        stats->iostat_rtime[i] == 0)
++	                continue;
++	        if (stats->iostat_read_reqs)
++	                read_percent = stats->iostat_rtime[i] * 100 / 
++	                        stats->iostat_read_reqs;
++	        if (stats->iostat_write_reqs)
++	                write_percent = stats->iostat_wtime[i] * 100 / 
++	                        stats->iostat_write_reqs;
++	        seq_printf(seq, "%16u %8lu %8lu %8lu %8lu\n",
++	                        jiffies_to_msecs(((1UL << i) >> 1) << 1),
++	                        stats->iostat_rtime[i], read_percent,
++	                        stats->iostat_wtime[i], write_percent);
++	}
++ 
++	seq_printf(seq, "\n%16s %8s %8s %8s %8s\n", "time in queue", "reads",
++	                "%%", "writes", "%%");
++	for (i = 0; i < IOSTAT_NCOUNTERS; i++) {
++	        unsigned long read_percent = 0, write_percent = 0;
++	        if (stats->iostat_wtime_in_queue[i] == 0 &&
++	                        stats->iostat_rtime_in_queue[i] == 0)
++	                continue;
++	        if (stats->iostat_read_reqs)
++	                read_percent = stats->iostat_rtime_in_queue[i] * 100 / 
++	                        stats->iostat_read_reqs;
++	        if (stats->iostat_write_reqs)
++	                write_percent = stats->iostat_wtime_in_queue[i] * 100 / 
++	                        stats->iostat_write_reqs;
++	        seq_printf(seq, "%16u %8lu %8lu %8lu %8lu\n",
++	                        jiffies_to_msecs(((1UL << i) >> 1) << 1),
++	                        stats->iostat_rtime_in_queue[i],
++	                        read_percent,
++	                        stats->iostat_wtime_in_queue[i],
++	                        write_percent);
++	}
++ 
++	return 0;
++ }
++ 
++ static void *
++ sd_iostats_seq_start(struct seq_file *p, loff_t *pos)
++ {
++	return (*pos == 0) ? (void *)1 : NULL;
++ }
++ 
++ static void *
++ sd_iostats_seq_next(struct seq_file *p, void *v, loff_t *pos)
++ {
++	++*pos;
++	return NULL;
++ }
++ 
++ static void
++ sd_iostats_seq_stop(struct seq_file *p, void *v)
++ {
++ }
++ 
++ static struct seq_operations sd_iostats_seqops = {
++	.start = sd_iostats_seq_start,
++	.stop  = sd_iostats_seq_stop,
++	.next  = sd_iostats_seq_next,
++	.show  = sd_iostats_seq_show,
++ };
++ 
++ static int
++ sd_iostats_seq_open (struct inode *inode, struct file *file)
++ {
++	int rc;
++ 
++	rc = seq_open(file, &sd_iostats_seqops);
++	if (rc != 0)
++	        return rc;
++ 
++	((struct seq_file *)file->private_data)->private = PDE(inode)->data;
++	return 0;
++ }
++ 
++ static ssize_t
++ sd_iostats_seq_write(struct file *file, const char *buffer,
++	             size_t len, loff_t *off)
++ {
++	struct seq_file   *seq = file->private_data;
++	struct gendisk *disk = seq->private;
++	iostat_stats_t    *stats = scsi_disk(disk)->stats;
++	unsigned long      flags;
++	unsigned long      qdepth;
++ 
++ 
++	spin_lock_irqsave (&stats->iostat_lock, flags);
++	qdepth = stats->iostat_queue_depth;
++	memset (stats, 0, offsetof(iostat_stats_t, iostat_lock));
++	do_gettimeofday(&stats->iostat_timeval);
++	stats->iostat_queue_stamp = jiffies;
++	stats->iostat_queue_depth = qdepth;
++	spin_unlock_irqrestore (&stats->iostat_lock, flags);
++ 
++	return len;
++ }
++ 
++ static struct file_operations sd_iostats_proc_fops = {
++	.owner   = THIS_MODULE,
++	.open    = sd_iostats_seq_open,
++	.read    = seq_read,
++	.write   = sd_iostats_seq_write,
++	.llseek  = seq_lseek,
++	.release = seq_release,
++ };
++ 
++ extern struct proc_dir_entry *proc_scsi;
++ 
++ void
++ sd_iostats_init(void)
++ {
++	if (proc_scsi == NULL) {
++	        printk(KERN_WARNING "No access to sd iostats: "
++	                "proc_scsi is NULL\n");
++	        return;
++	}
++ 
++	sd_iostats_procdir = create_proc_entry(sd_iostats_procdir_name,
++	                                       S_IFDIR | S_IRUGO | S_IXUGO,
++	                                        proc_scsi);
++	if (sd_iostats_procdir == NULL) {
++	        printk(KERN_WARNING "No access to sd iostats: "
++	                "can't create /proc/scsi/%s\n", sd_iostats_procdir_name);
++	        return;
++	}
++ }
++ 
++ void sd_iostats_fini(void)
++ {
++	if (proc_scsi != NULL && sd_iostats_procdir != NULL)
++	        remove_proc_entry(sd_iostats_procdir_name, proc_scsi);
++ 
++	sd_iostats_procdir = NULL;
++ }
++ 
++ void sd_iostats_finish_req(struct scsi_cmnd *SCpnt)
++ {
++	struct request          *rq = SCpnt->request;
++	iostat_stats_t          *stats;
++	unsigned long           *tcounter;
++	int                     tbucket;
++	int                     tmp;
++	unsigned long           irqflags;
++	unsigned long           i;
++ 
++	stats = scsi_disk(rq->rq_disk)->stats;
++	if (stats == NULL)
++	        return;
++ 
++	tmp = jiffies - rq->start_time;
++	for (tbucket = 0; tmp > 1; tbucket++)
++	        tmp >>= 1;
++	if (tbucket >= IOSTAT_NCOUNTERS)
++	        tbucket = IOSTAT_NCOUNTERS - 1;
++	//printk("%u ticks in D to %u\n", jiffies - rq->start_time, tbucket);
++ 
++	tcounter = rq_data_dir(rq) == WRITE ?
++	        &stats->iostat_wtime[tbucket] : &stats->iostat_rtime[tbucket];
++ 
++	spin_lock_irqsave(&stats->iostat_lock, irqflags);
++ 
++	/* update delay stats */
++	(*tcounter)++;
++ 
++	/* update queue depth stats */
++	i = stats->iostat_queue_depth;
++	if (i >= IOSTAT_NCOUNTERS)
++	        i = IOSTAT_NCOUNTERS - 1;
++	stats->iostat_queue_ticks[i] += jiffies - stats->iostat_queue_stamp;
++	stats->iostat_queue_ticks_sum += jiffies - stats->iostat_queue_stamp;
++	BUG_ON(stats->iostat_queue_depth == 0);
++	stats->iostat_queue_depth--;
++ 
++	/* update seek stats. XXX: not sure about nr_sectors */
++	stats->iostat_sectors += rq->nr_sectors;
++	stats->iostat_reqs++;
++	if (rq->sector != stats->iostat_next_sector) {
++	        stats->iostat_seek_sectors +=
++	                rq->sector > stats->iostat_next_sector ?
++	                rq->sector - stats->iostat_next_sector :
++	                stats->iostat_next_sector - rq->sector;
++	        stats->iostat_seeks++;
++	}
++	stats->iostat_next_sector = rq->sector + rq->nr_sectors;
++ 
++	stats->iostat_queue_stamp = jiffies;
++ 
++	spin_unlock_irqrestore(&stats->iostat_lock, irqflags);
++ }
++ 
++ void sd_iostats_start_req(struct scsi_cmnd *SCpnt)
++ {
++	struct request          *rq = SCpnt->request;
++	iostat_stats_t          *stats;
++	iostat_counter_t        *counter;
++	int                     bucket;
++	int                     tbucket;
++	int                     tmp;
++	unsigned long           irqflags;
++	unsigned long           i;
++	int                     nsect;
++ 
++	stats = scsi_disk(rq->rq_disk)->stats;
++	if (stats == NULL)
++	        return;
++ 
++	nsect = scsi_bufflen(SCpnt) >> 9;
++	for (bucket = 0, tmp = nsect; tmp > 1; bucket++)
++	        tmp >>= 1;
++ 
++	if (bucket >= IOSTAT_NCOUNTERS) {
++	        printk (KERN_ERR "sd_iostats_bump: nsect %d too big\n", nsect);
++	        BUG();
++	}
++ 
++	counter = rq_data_dir(rq) == WRITE ?
++	        &stats->iostat_write_histogram[bucket] :
++	        &stats->iostat_read_histogram[bucket];
++ 
++	tmp = jiffies - rq->start_time;
++	for (tbucket = 0; tmp > 1; tbucket++)
++	        tmp >>= 1;
++	if (tbucket >= IOSTAT_NCOUNTERS)
++	        tbucket = IOSTAT_NCOUNTERS - 1;
++	//printk("%u ticks in Q to %u\n", jiffies - rq->start_time, tbucket);
++ 
++	/* an ugly hack to know exact processing time. the right
++	 * solution is to add one more field to struct request
++	 * hopefully it will break nothing ... */
++	rq->start_time = jiffies;
++ 
++	spin_lock_irqsave(&stats->iostat_lock, irqflags);
++ 
++	/* update queue depth stats */
++	i = stats->iostat_queue_depth;
++	if (i >= IOSTAT_NCOUNTERS)
++	        i = IOSTAT_NCOUNTERS - 1;
++	stats->iostat_queue_ticks[i] += jiffies - stats->iostat_queue_stamp;
++	stats->iostat_queue_ticks_sum += jiffies - stats->iostat_queue_stamp;
++	stats->iostat_queue_depth++;
++ 
++	/* update delay stats */
++	if (rq_data_dir(rq) == WRITE) {
++	        stats->iostat_wtime_in_queue[tbucket]++;
++	        stats->iostat_write_reqs++;
++	} else {
++	        stats->iostat_rtime_in_queue[tbucket]++;
++	        stats->iostat_read_reqs++;
++	}
++ 
++	/* update size stats */
++	counter->iostat_size += nsect;
++	counter->iostat_count++;
++ 
++	stats->iostat_queue_stamp = jiffies;
++ 
++	spin_unlock_irqrestore(&stats->iostat_lock, irqflags);
++}
++#endif
++
+ /**
+  *	scsi_disk_release - Called to free the scsi_disk structure
+  *	@dev: pointer to embedded class device
+@@ -1773,6 +2184,13 @@
+ 	idr_remove(&sd_index_idr, sdkp->index);
+ 	spin_unlock(&sd_index_lock);
+ 
++#if (defined(CONFIG_SD_IOSTATS) && defined(CONFIG_PROC_FS))
++        if (sdkp->stats) {
++                remove_proc_entry(disk->disk_name, sd_iostats_procdir);
++                kfree(sdkp->stats);
++                sdkp->stats = NULL;
++        }
++#endif
+ 	disk->private_data = NULL;
+ 	put_disk(disk);
+ 	put_device(&sdkp->device->sdev_gendev);
+@@ -1890,6 +2308,8 @@
+ 	if (!majors)
+ 		return -ENODEV;
+ 
++	sd_iostats_init();
++
+ 	err = class_register(&sd_disk_class);
+ 	if (err)
+ 		goto err_out;
+@@ -1905,6 +2325,7 @@
+ err_out:
+ 	for (i = 0; i < SD_MAJORS; i++)
+ 		unregister_blkdev(sd_major(i), "sd");
++	sd_iostats_fini();
+ 	return err;
+ }
+ 
+diff -u -r debian-2.6.26/fs/block_dev.c debian-2.6.26_lustre.1.8.2/fs/block_dev.c
+--- debian-2.6.26/fs/block_dev.c	2008-07-13 23:51:29.000000000 +0200
++++ debian-2.6.26_lustre.1.8.2/fs/block_dev.c	2010-02-17 14:19:50.000000000 +0100
+@@ -1125,6 +1125,7 @@
+ 		if (bdev != bdev->bd_contains)
+ 			victim = bdev->bd_contains;
+ 		bdev->bd_contains = NULL;
++		dev_clear_rdonly(bdev);
+ 	}
+ 	unlock_kernel();
+ 	mutex_unlock(&bdev->bd_mutex);
+diff -u -r debian-2.6.26/fs/dcache.c debian-2.6.26_lustre.1.8.2/fs/dcache.c
+--- debian-2.6.26/fs/dcache.c	2009-12-26 09:14:56.000000000 +0100
++++ debian-2.6.26_lustre.1.8.2/fs/dcache.c	2010-02-17 14:24:24.000000000 +0100
+@@ -250,6 +250,13 @@
+ 		spin_unlock(&dcache_lock);
+ 		return 0;
+ 	}
++
++        /* network invalidation by Lustre */
++        if (dentry->d_flags & DCACHE_LUSTRE_INVALID) {
++                spin_unlock(&dcache_lock);
++                return 0;
++        }
++
+ 	/*
+ 	 * Check whether to do a partial shrink_dcache
+ 	 * to get rid of unused child entries.
+@@ -1427,14 +1434,23 @@
+  *
+  * Adds a dentry to the hash according to its name.
+  */
+- 
++
++void d_rehash_cond(struct dentry * entry, int lock)
++{
++        if (lock)
++                spin_lock(&dcache_lock);
++        spin_lock(&entry->d_lock);
++        _d_rehash(entry);
++        spin_unlock(&entry->d_lock);
++        if (lock)
++                spin_unlock(&dcache_lock);
++}
++
++EXPORT_SYMBOL(d_rehash_cond);
++
+ void d_rehash(struct dentry * entry)
+ {
+-	spin_lock(&dcache_lock);
+-	spin_lock(&entry->d_lock);
+-	_d_rehash(entry);
+-	spin_unlock(&entry->d_lock);
+-	spin_unlock(&dcache_lock);
++	d_rehash_cond(entry, 1);
+ }
+ 
+ #define do_switch(x,y) do { \
+@@ -1510,7 +1526,7 @@
+  * Update the dcache to reflect the move of a file name. Negative
+  * dcache entries should not be moved in this way.
+  */
+-static void d_move_locked(struct dentry * dentry, struct dentry * target)
++void d_move_locked(struct dentry * dentry, struct dentry * target)
+ {
+ 	struct hlist_head *list;
+ 
+@@ -1568,6 +1584,7 @@
+ 	spin_unlock(&dentry->d_lock);
+ 	write_sequnlock(&rename_lock);
+ }
++EXPORT_SYMBOL(d_move_locked);
+ 
+ /**
+  * d_move - move a dentry
+@@ -2051,6 +2068,7 @@
+ 
+ 	return result;
+ }
++EXPORT_SYMBOL(is_subdir);
+ 
+ void d_genocide(struct dentry *root)
+ {
+diff -u -r debian-2.6.26/fs/filesystems.c debian-2.6.26_lustre.1.8.2/fs/filesystems.c
+--- debian-2.6.26/fs/filesystems.c	2009-12-26 09:14:56.000000000 +0100
++++ debian-2.6.26_lustre.1.8.2/fs/filesystems.c	2010-02-17 14:26:59.000000000 +0100
+@@ -28,7 +28,9 @@
+  */
+ 
+ static struct file_system_type *file_systems;
+-static DEFINE_RWLOCK(file_systems_lock);
++DEFINE_RWLOCK(file_systems_lock);
++
++EXPORT_SYMBOL(file_systems_lock);
+ 
+ /* WARNING: This can be used only if we _already_ own a reference */
+ void get_filesystem(struct file_system_type *fs)
+diff -u -r debian-2.6.26/fs/inode.c debian-2.6.26_lustre.1.8.2/fs/inode.c
+--- debian-2.6.26/fs/inode.c	2008-07-13 23:51:29.000000000 +0200
++++ debian-2.6.26_lustre.1.8.2/fs/inode.c	2010-02-17 14:27:51.000000000 +0100
+@@ -409,7 +409,9 @@
+ 	int nr_scanned;
+ 	unsigned long reap = 0;
+ 
+-	mutex_lock(&iprune_mutex);
++	if (!mutex_trylock(&iprune_mutex))
++		return;
++
+ 	spin_lock(&inode_lock);
+ 	for (nr_scanned = 0; nr_scanned < nr_to_scan; nr_scanned++) {
+ 		struct inode *inode;
+diff -u -r debian-2.6.26/fs/jbd2/checkpoint.c debian-2.6.26_lustre.1.8.2/fs/jbd2/checkpoint.c
+--- debian-2.6.26/fs/jbd2/checkpoint.c	2008-07-13 23:51:29.000000000 +0200
++++ debian-2.6.26_lustre.1.8.2/fs/jbd2/checkpoint.c	2010-02-17 14:28:49.000000000 +0100
+@@ -696,6 +696,7 @@
+ 	J_ASSERT(transaction->t_checkpoint_list == NULL);
+ 	J_ASSERT(transaction->t_checkpoint_io_list == NULL);
+ 	J_ASSERT(transaction->t_updates == 0);
++	J_ASSERT(list_empty(&transaction->t_jcb));
+ 	J_ASSERT(journal->j_committing_transaction != transaction);
+ 	J_ASSERT(journal->j_running_transaction != transaction);
+ 
+diff -u -r debian-2.6.26/fs/jbd2/commit.c debian-2.6.26_lustre.1.8.2/fs/jbd2/commit.c
+--- debian-2.6.26/fs/jbd2/commit.c	2008-07-13 23:51:29.000000000 +0200
++++ debian-2.6.26_lustre.1.8.2/fs/jbd2/commit.c	2010-02-17 14:29:44.000000000 +0100
+@@ -874,6 +874,30 @@
+            transaction can be removed from any checkpoint list it was on
+            before. */
+ 
++        /*
++         * Call any callbacks that had been registered for handles in this
++         * transaction.  It is up to the callback to free any allocated
++         * memory.
++         *
++         * The spinlocking (t_jcb_lock) here is surely unnecessary...
++         */
++        spin_lock(&commit_transaction->t_jcb_lock);
++        if (!list_empty(&commit_transaction->t_jcb)) {
++                struct list_head *p, *n;
++                int error = is_journal_aborted(journal);
++
++                list_for_each_safe(p, n, &commit_transaction->t_jcb) {
++                        struct journal_callback *jcb;
++
++                        jcb = list_entry(p, struct journal_callback, jcb_list);
++                        list_del(p);
++                        spin_unlock(&commit_transaction->t_jcb_lock);
++                        jcb->jcb_func(jcb, error);
++                        spin_lock(&commit_transaction->t_jcb_lock);
++                }
++        }
++        spin_unlock(&commit_transaction->t_jcb_lock);
++
+ 	jbd_debug(3, "JBD: commit phase 7\n");
+ 
+ 	J_ASSERT(commit_transaction->t_sync_datalist == NULL);
+diff -u -r debian-2.6.26/fs/jbd2/journal.c debian-2.6.26_lustre.1.8.2/fs/jbd2/journal.c
+--- debian-2.6.26/fs/jbd2/journal.c	2008-07-13 23:51:29.000000000 +0200
++++ debian-2.6.26_lustre.1.8.2/fs/jbd2/journal.c	2010-02-17 14:38:15.000000000 +0100
+@@ -82,6 +82,8 @@
+ EXPORT_SYMBOL(jbd2_journal_invalidatepage);
+ EXPORT_SYMBOL(jbd2_journal_try_to_free_buffers);
+ EXPORT_SYMBOL(jbd2_journal_force_commit);
++EXPORT_SYMBOL(jbd2_journal_callback_set);
++EXPORT_SYMBOL(jbd2_journal_bmap);
+ 
+ static int journal_convert_superblock_v1(journal_t *, journal_superblock_t *);
+ static void __journal_abort_soft (journal_t *journal, int errno);
+@@ -460,6 +462,7 @@
+ 	spin_unlock(&journal->j_state_lock);
+ 	return ret;
+ }
++EXPORT_SYMBOL(jbd2_log_start_commit);
+ 
+ /*
+  * Force and wait upon a commit if the calling process is not within
+diff -u -r debian-2.6.26/fs/jbd2/transaction.c debian-2.6.26_lustre.1.8.2/fs/jbd2/transaction.c
+--- debian-2.6.26/fs/jbd2/transaction.c	2008-07-13 23:51:29.000000000 +0200
++++ debian-2.6.26_lustre.1.8.2/fs/jbd2/transaction.c	2010-02-17 14:42:20.000000000 +0100
+@@ -51,10 +51,12 @@
+ 	transaction->t_state = T_RUNNING;
+ 	transaction->t_tid = journal->j_transaction_sequence++;
+ 	transaction->t_expires = jiffies + journal->j_commit_interval;
++	INIT_LIST_HEAD(&transaction->t_jcb);
+ 	spin_lock_init(&transaction->t_handle_lock);
++	spin_lock_init(&transaction->t_jcb_lock);
+ 
+ 	/* Set up the commit timer for the new transaction. */
+-	journal->j_commit_timer.expires = round_jiffies(transaction->t_expires);
++	journal->j_commit_timer.expires = transaction->t_expires;
+ 	add_timer(&journal->j_commit_timer);
+ 
+ 	J_ASSERT(journal->j_running_transaction == NULL);
+@@ -252,6 +254,7 @@
+ 	memset(handle, 0, sizeof(*handle));
+ 	handle->h_buffer_credits = nblocks;
+ 	handle->h_ref = 1;
++	INIT_LIST_HEAD(&handle->h_jcb);
+ 
+ 	lockdep_init_map(&handle->h_lockdep_map, "jbd2_handle",
+ 						&jbd2_handle_key, 0);
+@@ -1350,6 +1353,36 @@
+ }
+ 
+ /**
++ * void jbd2_journal_callback_set() -  Register a callback function for this handle.
++ * @handle: handle to attach the callback to.
++ * @func: function to callback.
++ * @jcb:  structure with additional information required by func() , and
++ *      some space for jbd2 internal information.
++ *
++ * The function will be
++ * called when the transaction that this handle is part of has been
++ * committed to disk with the original callback data struct and the
++ * error status of the journal as parameters.  There is no guarantee of
++ * ordering between handles within a single transaction, nor between
++ * callbacks registered on the same handle.
++ *
++ * The caller is responsible for allocating the journal_callback struct.
++ * This is to allow the caller to add as much extra data to the callback
++ * as needed, but reduce the overhead of multiple allocations.  The caller
++ * allocated struct must start with a struct journal_callback at offset 0,
++ * and has the caller-specific data afterwards.
++ */
++void jbd2_journal_callback_set(handle_t *handle,
++                      void (*func)(struct journal_callback *jcb, int error),
++                      struct journal_callback *jcb)
++{
++        spin_lock(&handle->h_transaction->t_jcb_lock);
++        list_add_tail(&jcb->jcb_list, &handle->h_jcb);
++        spin_unlock(&handle->h_transaction->t_jcb_lock);
++        jcb->jcb_func = func;
++}
++
++/**
+  * int jbd2_journal_stop() - complete a transaction
+  * @handle: tranaction to complete.
+  *
+@@ -1423,6 +1456,11 @@
+ 			wake_up(&journal->j_wait_transaction_locked);
+ 	}
+ 
++        /* Move callbacks from the handle to the transaction. */
++        spin_lock(&transaction->t_jcb_lock);
++        list_splice(&handle->h_jcb, &transaction->t_jcb);
++        spin_unlock(&transaction->t_jcb_lock);
++
+ 	/*
+ 	 * If the handle is marked SYNC, we need to set another commit
+ 	 * going!  We also want to force a commit if the current
+diff -u -r debian-2.6.26/fs/namespace.c debian-2.6.26_lustre.1.8.2/fs/namespace.c
+--- debian-2.6.26/fs/namespace.c	2009-12-26 09:14:56.000000000 +0100
++++ debian-2.6.26_lustre.1.8.2/fs/namespace.c	2010-02-17 14:43:07.000000000 +0100
+@@ -1660,6 +1660,7 @@
+ 
+ 	return do_add_mount(mnt, nd, mnt_flags, NULL);
+ }
++EXPORT_SYMBOL(set_fs_pwd);
+ 
+ /*
+  * add a mount into a namespace's mount tree
+diff -u -r debian-2.6.26/include/linux/blkdev.h debian-2.6.26_lustre.1.8.2/include/linux/blkdev.h
+--- debian-2.6.26/include/linux/blkdev.h	2009-12-26 09:14:55.000000000 +0100
++++ debian-2.6.26_lustre.1.8.2/include/linux/blkdev.h	2010-02-18 07:44:31.000000000 +0100
+@@ -806,7 +806,7 @@
+ #define MAX_PHYS_SEGMENTS 128
+ #define MAX_HW_SEGMENTS 128
+ #define SAFE_MAX_SECTORS 255
+-#define BLK_DEF_MAX_SECTORS 1024
++#define BLK_DEF_MAX_SECTORS 2048
+ 
+ #define MAX_SEGMENT_SIZE	65536
+ 
+diff -u -r debian-2.6.26/include/linux/dcache.h debian-2.6.26_lustre.1.8.2/include/linux/dcache.h
+--- debian-2.6.26/include/linux/dcache.h	2008-07-13 23:51:29.000000000 +0200
++++ debian-2.6.26_lustre.1.8.2/include/linux/dcache.h	2010-02-18 07:46:08.000000000 +0100
+@@ -173,6 +173,7 @@
+ 
+ #define DCACHE_REFERENCED	0x0008  /* Recently used, don't discard. */
+ #define DCACHE_UNHASHED		0x0010	
++#define DCACHE_LUSTRE_INVALID   0x0040  /* Lustre invalidated */
+ 
+ #define DCACHE_INOTIFY_PARENT_WATCHED	0x0020 /* Parent inode is watched */
+ 
+@@ -250,6 +251,7 @@
+  * This adds the entry to the hash queues.
+  */
+ extern void d_rehash(struct dentry *);
++extern void d_rehash_cond(struct dentry *, int lock);
+ 
+ /**
+  * d_add - add dentry to hash queues
+@@ -285,6 +287,7 @@
+ 
+ /* used for rename() and baskets */
+ extern void d_move(struct dentry *, struct dentry *);
++extern void d_move_locked(struct dentry *, struct dentry *);
+ 
+ /* appendix may either be NULL or be used for transname suffixes */
+ extern struct dentry * d_lookup(struct dentry *, struct qstr *);
+diff -u -r debian-2.6.26/include/linux/fs.h debian-2.6.26_lustre.1.8.2/include/linux/fs.h
+--- debian-2.6.26/include/linux/fs.h	2008-07-13 23:51:29.000000000 +0200
++++ debian-2.6.26_lustre.1.8.2/include/linux/fs.h	2010-02-18 07:57:56.000000000 +0100
+@@ -1832,6 +1832,10 @@
+ extern void submit_bio(int, struct bio *);
+ extern int bdev_read_only(struct block_device *);
+ #endif
++#define HAVE_CLEAR_RDONLY_ON_PUT
++extern void dev_set_rdonly(struct block_device *bdev);
++extern int dev_check_rdonly(struct block_device *bdev);
++extern void dev_clear_rdonly(struct block_device *bdev);
+ extern int set_blocksize(struct block_device *, int);
+ extern int sb_set_blocksize(struct super_block *, int);
+ extern int sb_min_blocksize(struct super_block *, int);
+@@ -1930,6 +1934,7 @@
+ 
+ extern const struct file_operations generic_ro_fops;
+ 
++extern rwlock_t file_systems_lock;
+ #define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m))
+ 
+ extern int vfs_readlink(struct dentry *, char __user *, int, const char *);
+diff -u -r debian-2.6.26/include/linux/jbd2.h debian-2.6.26_lustre.1.8.2/include/linux/jbd2.h
+--- debian-2.6.26/include/linux/jbd2.h	2008-07-13 23:51:29.000000000 +0200
++++ debian-2.6.26_lustre.1.8.2/include/linux/jbd2.h	2010-02-18 08:08:30.000000000 +0100
+@@ -379,6 +379,27 @@
+ 	bit_spin_unlock(BH_JournalHead, &bh->b_state);
+ }
+ 
++#define HAVE_JOURNAL_CALLBACK_STATUS
++/**
++ *   struct journal_callback - Base structure for callback information.
++ *   @jcb_list: list information for other callbacks attached to the same handle.
++ *   @jcb_func: Function to call with this callback structure.
++ *
++ *   This struct is a 'seed' structure for a using with your own callback
++ *   structs. If you are using callbacks you must allocate one of these
++ *   or another struct of your own definition which has this struct
++ *   as it's first element and pass it to journal_callback_set().
++ *
++ *   This is used internally by jbd2 to maintain callback information.
++ *
++ *   See journal_callback_set for more information.
++ **/
++struct journal_callback {
++        struct list_head jcb_list;              /* t_jcb_lock */
++        void (*jcb_func)(struct journal_callback *jcb, int error);
++        /* user data goes here */
++};
++
+ struct jbd2_revoke_table_s;
+ 
+ /**
+@@ -387,6 +408,7 @@
+  * @h_transaction: Which compound transaction is this update a part of?
+  * @h_buffer_credits: Number of remaining buffers we are allowed to dirty.
+  * @h_ref: Reference count on this handle
++ * @h_jcb: List of application registered callbacks for this handle.
+  * @h_err: Field for caller's use to track errors through large fs operations
+  * @h_sync: flag for sync-on-close
+  * @h_jdata: flag to force data journaling
+@@ -412,6 +434,13 @@
+ 	/* operations */
+ 	int			h_err;
+ 
++        /*
++         * List of application registered callbacks for this handle. The
++         * function(s) will be called after the transaction that this handle is
++         * part of has been committed to disk. [t_jcb_lock]
++         */
++        struct list_head        h_jcb;
++
+ 	/* Flags [no locking] */
+ 	unsigned int	h_sync:		1;	/* sync-on-close */
+ 	unsigned int	h_jdata:	1;	/* force data journaling */
+@@ -467,6 +496,9 @@
+  *    j_state_lock
+  *    ->j_list_lock			(journal_unmap_buffer)
+  *
++ *    t_handle_lock
++ *    ->t_jcb_lock
++ *
+  */
+ 
+ struct transaction_s
+@@ -613,6 +645,15 @@
+ 	 */
+ 	int t_handle_count;
+ 
++        /*
++         * Protects the callback list
++         */
++        spinlock_t              t_jcb_lock;
++        /*
++         * List of registered callback functions for this transaction.
++         * Called when the transaction is committed. [t_jcb_lock]
++         */
++        struct list_head        t_jcb;
+ };
+ 
+ struct transaction_run_stats_s {
+@@ -1016,6 +1057,9 @@
+ extern int	 jbd2_journal_flush (journal_t *);
+ extern void	 jbd2_journal_lock_updates (journal_t *);
+ extern void	 jbd2_journal_unlock_updates (journal_t *);
++extern void      jbd2_journal_callback_set(handle_t *handle,
++                                      void (*fn)(struct journal_callback *,int),
++                                      struct journal_callback *jcb);
+ 
+ extern journal_t * jbd2_journal_init_dev(struct block_device *bdev,
+ 				struct block_device *fs_dev,
+diff -u -r debian-2.6.26/include/linux/mm.h debian-2.6.26_lustre.1.8.2/include/linux/mm.h
+--- debian-2.6.26/include/linux/mm.h	2009-12-26 09:14:57.000000000 +0100
++++ debian-2.6.26_lustre.1.8.2/include/linux/mm.h	2010-02-18 08:10:11.000000000 +0100
+@@ -564,6 +564,8 @@
+ {
+ 	return __va(page_to_pfn(page) << PAGE_SHIFT);
+ }
++/* truncate.c */
++extern void truncate_complete_page(struct address_space *mapping,struct page *);
+ 
+ #if defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL)
+ #define HASHED_PAGE_VIRTUAL
+diff -u -r debian-2.6.26/include/scsi/sd.h debian-2.6.26_lustre.1.8.2/include/scsi/sd.h
+--- debian-2.6.26/include/scsi/sd.h	2008-07-13 23:51:29.000000000 +0200
++++ debian-2.6.26_lustre.1.8.2/include/scsi/sd.h	2010-02-17 14:18:52.000000000 +0100
+@@ -31,6 +31,47 @@
+  */
+ #define SD_BUF_SIZE		512
+ 
++#if (defined(CONFIG_SD_IOSTATS) && defined(CONFIG_PROC_FS))
++typedef struct {
++        unsigned long long iostat_size;
++        unsigned long long iostat_count;
++} iostat_counter_t;
++
++#define IOSTAT_NCOUNTERS 16
++typedef struct {
++        iostat_counter_t        iostat_read_histogram[IOSTAT_NCOUNTERS];
++        iostat_counter_t        iostat_write_histogram[IOSTAT_NCOUNTERS];
++        struct timeval          iostat_timeval;
++
++        /* queue depth: how well the pipe is filled up */
++        unsigned long long      iostat_queue_ticks[IOSTAT_NCOUNTERS];
++        unsigned long long      iostat_queue_ticks_sum;
++        unsigned long           iostat_queue_depth;
++        unsigned long           iostat_queue_stamp;
++
++        /* seeks: how linear the traffic is */
++        unsigned long long      iostat_next_sector;
++        unsigned long long      iostat_seek_sectors;
++        unsigned long long      iostat_seeks;
++        unsigned long long      iostat_sectors;
++        unsigned long long      iostat_reqs;
++        unsigned long           iostat_read_reqs;
++        unsigned long           iostat_write_reqs;
++
++        /* process time: how long it takes to process requests */
++        unsigned long           iostat_rtime[IOSTAT_NCOUNTERS];
++        unsigned long           iostat_wtime[IOSTAT_NCOUNTERS];
++
++        /* queue time: how long process spent in elevator's queue */
++        unsigned long           iostat_rtime_in_queue[IOSTAT_NCOUNTERS];
++        unsigned long           iostat_wtime_in_queue[IOSTAT_NCOUNTERS];
++
++        /* must be the last field, as it's used to know size to be memset'ed */
++        spinlock_t              iostat_lock;
++} ____cacheline_aligned_in_smp iostat_stats_t;
++#endif
++
++
+ struct scsi_disk {
+ 	struct scsi_driver *driver;	/* always &sd_template */
+ 	struct scsi_device *device;
+@@ -45,6 +86,9 @@
+ 	unsigned	WCE : 1;	/* state of disk WCE bit */
+ 	unsigned	RCD : 1;	/* state of disk RCD bit, unused */
+ 	unsigned	DPOFUA : 1;	/* state of disk DPOFUA bit */
++#if (defined(CONFIG_SD_IOSTATS) && defined(CONFIG_PROC_FS))
++        iostat_stats_t  *stats;         /* scsi disk statistics */
++#endif
+ };
+ #define to_scsi_disk(obj) container_of(obj,struct scsi_disk,dev)
+ 
+diff -u -r debian-2.6.26/kernel/sched.c debian-2.6.26_lustre.1.8.2/kernel/sched.c
+--- debian-2.6.26/kernel/sched.c	2009-12-26 09:14:56.000000000 +0100
++++ debian-2.6.26_lustre.1.8.2/kernel/sched.c	2010-02-18 08:11:02.000000000 +0100
+@@ -5477,6 +5477,7 @@
+ 
+ 	show_stack(p, NULL);
+ }
++EXPORT_SYMBOL(sched_show_task);
+ 
+ void show_state_filter(unsigned long state_filter)
+ {
+diff -u -r debian-2.6.26/mm/truncate.c debian-2.6.26_lustre.1.8.2/mm/truncate.c
+--- debian-2.6.26/mm/truncate.c	2008-07-13 23:51:29.000000000 +0200
++++ debian-2.6.26_lustre.1.8.2/mm/truncate.c	2010-02-18 08:12:58.000000000 +0100
+@@ -92,7 +92,7 @@
+  * its lock, b) when a concurrent invalidate_mapping_pages got there first and
+  * c) when tmpfs swizzles a page between a tmpfs inode and swapper_space.
+  */
+-static void
++void
+ truncate_complete_page(struct address_space *mapping, struct page *page)
+ {
+ 	if (page->mapping != mapping)
+@@ -108,6 +108,7 @@
+ 	ClearPageMappedToDisk(page);
+ 	page_cache_release(page);	/* pagecache ref */
+ }
++EXPORT_SYMBOL_GPL(truncate_complete_page);
+ 
+ /*
+  * This is for invalidate_mapping_pages().  That function can be called at
+diff -u -r debian-2.6.26/security/security.c debian-2.6.26_lustre.1.8.2/security/security.c
+--- debian-2.6.26/security/security.c	2009-12-26 09:14:57.000000000 +0100
++++ debian-2.6.26_lustre.1.8.2/security/security.c	2010-02-18 08:13:38.000000000 +0100
+@@ -406,6 +406,7 @@
+ 		return 0;
+ 	return security_ops->inode_unlink(dir, dentry);
+ }
++EXPORT_SYMBOL(security_inode_unlink);
+ 
+ int security_inode_symlink(struct inode *dir, struct dentry *dentry,
+ 			    const char *old_name)
