This file is indexed.

/usr/src/kernel-patches/lustre/patches/debian-2.6.26.diff is in linux-patch-lustre 1.8.5+dfsg-3ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
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)