Skip to contentSkip to conversation

another IDE cleanup: kill duplicated code

PATCH Pavel Machek 11 participants 53 messages Feb 12, 2002 – Feb 14, 2002

Subsystems (12)
lore
Share & tools
lore
#0 lore raw

Hi!

This is slightly longer but also simple cleanup. It kills code duplication and removes unneccessary assignments/casts. Please apply,

Pavel

drivers/ide/ide-disk.c +19 -27
@@ -172,6 +167,16 @@
 		return WIN_NOP;
 }
 
+static void fill_args (ide_task_t *args, struct hd_drive_task_hdr *taskfile, struct hd_drive_hob_hdr *hobfile)
+{
+	memcpy(args->tfRegister, taskfile, sizeof(struct hd_drive_task_hdr));
+	memcpy(args->hobRegister, hobfile, sizeof(struct hd_drive_hob_hdr));
+	args->command_type	= ide_cmd_type_parser(args);
+	args->prehandler	= ide_pre_handler_parser(taskfile, hobfile);
+	args->handler		= ide_handler_parser(taskfile, hobfile);
+	args->posthandler	= NULL;
+}
+
 static ide_startstop_t chs_rw_disk (ide_drive_t *drive, struct request *rq, unsigned long block)
 {
 	struct hd_drive_task_hdr	taskfile;
@@ -210,16 +215,10 @@
 	printk("buffer=0x%08lx\n", (unsigned long) rq->buffer);
 #endif
 
-	memcpy(args.tfRegister, &taskfile, sizeof(struct hd_drive_task_hdr));
-	memcpy(args.hobRegister, &hobfile, sizeof(struct hd_drive_hob_hdr));
-	args.command_type	= ide_cmd_type_parser(&args);
-	args.prehandler		= ide_pre_handler_parser(&taskfile, &hobfile);
-	args.handler		= ide_handler_parser(&taskfile, &hobfile);
-	args.posthandler	= NULL;
-	args.rq			= (struct request *) rq;
+	fill_args(&args, &taskfile, &hobfile);
+	args.rq			= rq;
 	args.block		= block;
-	rq->special		= NULL;
-	rq->special		= (ide_task_t *)&args;
+	rq->special		= &args;
 
 	return do_rw_taskfile(drive, &args);
 }
@@ -257,16 +255,10 @@
 	printk("buffer=0x%08lx\n", (unsigned long) rq->buffer);
 #endif
 
-	memcpy(args.tfRegister, &taskfile, sizeof(struct hd_drive_task_hdr));
-	memcpy(args.hobRegister, &hobfile, sizeof(struct hd_drive_hob_hdr));
-	args.command_type	= ide_cmd_type_parser(&args);
-	args.prehandler		= ide_pre_handler_parser(&taskfile, &hobfile);
-	args.handler		= ide_handler_parser(&taskfile, &hobfile);
-	args.posthandler	= NULL;
-	args.rq			= (struct request *) rq;
+	fill_args(&args, &taskfile, &hobfile);
+	args.rq			= rq;
 	args.block		= block;
-	rq->special		= NULL;
-	rq->special		= (ide_task_t *)&args;
+	rq->special		= &args;
 
 	return do_rw_taskfile(drive, &args);
 }
@@ -321,16 +313,10 @@
 	printk("buffer=0x%08lx\n", (unsigned long) rq->buffer);
 #endif
 
-	memcpy(args.tfRegister, &taskfile, sizeof(struct hd_drive_task_hdr));
-	memcpy(args.hobRegister, &hobfile, sizeof(struct hd_drive_hob_hdr));
-	args.command_type	= ide_cmd_type_parser(&args);
-	args.prehandler		= ide_pre_handler_parser(&taskfile, &hobfile);
-	args.handler		= ide_handler_parser(&taskfile, &hobfile);
-	args.posthandler	= NULL;
-	args.rq			= (struct request *) rq;
+	fill_args(&args, &taskfile, &hobfile);
+	args.rq			= rq;
 	args.block		= block;
-	rq->special		= NULL;
-	rq->special		= (ide_task_t *)&args;
+	rq->special		= &args;
 
 	return do_rw_taskfile(drive, &args);
 }
Signature · 2 lines
(about SSSCA) "I don't say this lightly.  However, I really think that the U.S.
no longer is classifiable as a democracy, but rather as a plutocracy." --hpa
#1 lore raw
Quoted 6 lines · Pavel Machek

Hi!

This is slightly longer but also simple cleanup. It kills code duplication and removes unneccessary assignments/casts. Please apply,

If you are already at it, I would like to ask to you consider seriously the removal of the following entries in the ide drivers /proc control files:

ide_add_setting(drive, "breada_readahead", ... 1,
2, &read_ahead[major], NULL);
ide_add_setting(drive, "file_readahead", ...
&max_readahead[major][minor], NULL);

Those calls can be found in ide-cd.c, ide-disk,c and ide-floppy.c

The first does control an array of values, which doesn't make sense in first place. I.e. changing it doesn't change ANY behaviour of the kernel.

The second of them is trying to control a file-system level constant inside the actual block device driver. This is a blatant violation of the layering principle in software design, and should go as soon as possible.

BTW.> The wole IDE /proc stuff found there makes me vommit...
Both in terms of interface and in terms of coding style.
Apparently Andre Hendrick doesn't know what ioctrl are about and is missing the windows registry greatly.

#2 lore raw
In reply to Pavel Machek
Quoted 12 lines · Martin Dalecki
Quoted 2 lines

This is slightly longer but also simple cleanup. It kills code duplication and removes unneccessary assignments/casts. Please apply,

If you are already at it, I would like to ask to you consider seriously the removal of the
following entries in the ide drivers /proc control files:

ide_add_setting(drive, "breada_readahead", ... 1,
2, &read_ahead[major], NULL);
ide_add_setting(drive, "file_readahead", ...
&max_readahead[major][minor], NULL);

Quoted 5 lines

Those calls can be found in ide-cd.c, ide-disk,c and ide-floppy.c

The first does control an array of values, which doesn't make sense in first place. I.e. changing it doesn't
change ANY behaviour of the kernel.

Actually HFS uses it ...

Quoted 4 lines

The second of them is trying to control a file-system level constant inside the actual block device driver. This is a blatant violation of the layering principle in software design, and should go as soon as possible.

Yes. But still block device drivers allocate the array ...

Patch attached.

Signature · 2 lines
Vojtech Pavlik
SuSE Labs
drivers/ide/ide-cd.c +0 -2
diff -urN linux-2.5.4/drivers/ide/ide-cd.c linux-2.5.4-ideclean/drivers/ide/ide-cd.c
@@ -2662,8 +2662,6 @@
 	int major = HWIF(drive)->major;
 	int minor = drive->select.b.unit << PARTN_BITS;
 
-	ide_add_setting(drive,	"breada_readahead",	SETTING_RW, BLKRAGET, BLKRASET, TYPE_INT, 0, 255, 1, 2, &read_ahead[major], NULL);
-	ide_add_setting(drive,	"file_readahead",	SETTING_RW, BLKFRAGET, BLKFRASET, TYPE_INTA, 0, INT_MAX, 1, 1024, &max_readahead[major][minor],	NULL);
 	ide_add_setting(drive,	"dsc_overlap",		SETTING_RW, -1, -1, TYPE_BYTE, 0, 1, 1,	1, &drive->dsc_overlap, NULL);
 }
 
drivers/ide/ide-disk.c +0 -2
diff -urN linux-2.5.4/drivers/ide/ide-disk.c linux-2.5.4-ideclean/drivers/ide/ide-disk.c
@@ -916,8 +916,6 @@
 	ide_add_setting(drive,	"bswap",		SETTING_READ,					-1,			-1,			TYPE_BYTE,	0,	1,				1,	1,	&drive->bswap,			NULL);
 	ide_add_setting(drive,	"multcount",		id ? SETTING_RW : SETTING_READ,			HDIO_GET_MULTCOUNT,	HDIO_SET_MULTCOUNT,	TYPE_BYTE,	0,	id ? id->max_multsect : 0,	1,	1,	&drive->mult_count,		set_multcount);
 	ide_add_setting(drive,	"nowerr",		SETTING_RW,					HDIO_GET_NOWERR,	HDIO_SET_NOWERR,	TYPE_BYTE,	0,	1,				1,	1,	&drive->nowerr,			set_nowerr);
-	ide_add_setting(drive,	"breada_readahead",	SETTING_RW,					BLKRAGET,		BLKRASET,		TYPE_INT,	0,	255,				1,	1,	&read_ahead[major],		NULL);
-	ide_add_setting(drive,	"file_readahead",	SETTING_RW,					BLKFRAGET,		BLKFRASET,		TYPE_INTA,	0,	4096,			PAGE_SIZE,	1024,	&max_readahead[major][minor],	NULL);
 	ide_add_setting(drive,	"lun",			SETTING_RW,					-1,			-1,			TYPE_INT,	0,	7,				1,	1,	&drive->lun,			NULL);
 	ide_add_setting(drive,	"wcache",		SETTING_RW,					HDIO_GET_WCACHE,	HDIO_SET_WCACHE,	TYPE_BYTE,	0,	1,				1,	1,	&drive->wcache,			write_cache);
 	ide_add_setting(drive,	"acoustic",		SETTING_RW,					HDIO_GET_ACOUSTIC,	HDIO_SET_ACOUSTIC,	TYPE_BYTE,	0,	254,				1,	1,	&drive->acoustic,		set_acoustic);
drivers/ide/ide-floppy.c +0 -2
diff -urN linux-2.5.4/drivers/ide/ide-floppy.c linux-2.5.4-ideclean/drivers/ide/ide-floppy.c
@@ -1968,8 +1968,6 @@
 	ide_add_setting(drive,	"bios_cyl",		SETTING_RW,					-1,			-1,			TYPE_INT,	0,	1023,				1,	1,	&drive->bios_cyl,		NULL);
 	ide_add_setting(drive,	"bios_head",		SETTING_RW,					-1,			-1,			TYPE_BYTE,	0,	255,				1,	1,	&drive->bios_head,		NULL);
 	ide_add_setting(drive,	"bios_sect",		SETTING_RW,					-1,			-1,			TYPE_BYTE,	0,	63,				1,	1,	&drive->bios_sect,		NULL);
-	ide_add_setting(drive,	"breada_readahead",	SETTING_RW,					BLKRAGET,		BLKRASET,		TYPE_INT,	0,	255,				1,	2,	&read_ahead[major],		NULL);
-	ide_add_setting(drive,	"file_readahead",	SETTING_RW,					BLKFRAGET,		BLKFRASET,		TYPE_INTA,	0,	INT_MAX,			1,	1024,	&max_readahead[major][minor],	NULL);
 
 }
 
#3 lore raw
Quoted 4 lines · Martin Dalecki

ide-cdrom stuff, becouse it was always annoying to me that the default distribution setup is using the ide interface to my CD-recorder and every single recorder aplication out there is using the scsi interface instead.

This will soon be a thing of the past, note that the block interface is capable of passing cdb's around now. So ide-scsi will die, and ATAPI will no longer be a special case for burning etc.

Signature · 1 line
Jens Axboe
#4 lore raw
In reply to Vojtech Pavlik
Quoted 12 lines · Martin Dalecki
Quoted 9 lines · Andreas Dilger
Quoted 1 line · Martin Dalecki
Quoted 1 line

The first lv_read_ahead (in lv_t) removed. And references to it as well.

... this struct is passed between the kernel
and user space you can't just delete it, or everyone using LVM has a broken system and may not even be able to boot if they have root on LVM. Feel free to delete the code which actually uses this field, but don't remove it from the struct unless you are willing to fix the user space code also.

Quoted 5 lines

Please note that there are two structs there: One of them is tagged /* core */ and another of them is tagged as beeing /* disk */. The driver does only touch the core version, which is supposedly only to be used by the driver itself. This is what I was complaining about in first
place: Why is the driver's internal struct exposed there at all

Well, then you have no idea about how the current LVM code works. The way it does everything is to read the data from disk, convert endianness and such, and then pass it to the kernel via IOCTL. I have no comment on whether this is a good or bad way to do it. The point is that the struct marked "core" which you are deleting this unused field from is filled in from user-space, so you can't just change it when you want.

Rather than spending a lot of time breaking the kernel/user interface and forcing everyone using LVM to update their user tools, just leave this field in the struct. Feel free to remove the actual code that does the read-ahead if you want, but leave the lv_read_ahead field in this struct alone. The entire LVM code is going to be replaced by either LVM2 (just entered beta) or EVMS (in beta for a while now).

Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/

#5 lore raw
In reply to Vojtech Pavlik
Quoted 7 lines · Andreas Dilger

Well, then you have no idea about how the current LVM code works. The way it does everything is to read the data from disk, convert endianness and such, and then pass it to the kernel via IOCTL. I have no comment on whether this is a good or bad way to do it. The point is that the struct marked "core" which you are deleting this unused field from is filled in from user-space, so you can't just change it when you want.

Quoted 5 lines

Rather than spending a lot of time breaking the kernel/user interface and forcing everyone using LVM to update their user tools, just leave this field in the struct. Feel free to remove the actual code that does the read-ahead if you want, but leave the lv_read_ahead field

Please note that there is *no* code doing any read-ahead there, which could be removed. There is just setting and passing around of the lv_read_ahead field, without actually any *results*. OK?

Quoted 3 lines

in this struct alone. The entire LVM code is going to be replaced by either LVM2 (just entered beta) or EVMS (in beta for a while now).

Thank you for explaining this issue. It appears then that the comments there are a bit missguiding. I didn't look into the lvm user land code indeed. And the isn't even #ifdef __KERNEL__ stuff in lvm.h. Of course you are right, that one just should remove the code and leave the layout of the structure alone.

#6 lore raw
In reply to Pavel Machek
Quoted 6 lines · Vojtech Pavlik
Quoted 3 lines

The first does control an array of values, which doesn't make sense in first place. I.e. changing it doesn't change ANY behaviour of the kernel.

Actually HFS uses it ...

Please note that the use in HFS is inappriopriate. It's supposed to optimize the read throughput there, which is something that shouldn't be done at the fs setup layer at all. The usage of read_ahead there can be just removed and everything should be fine (modulo the fact that in current state the HFS filesystem code is just non-working obsolete code garbage anyway ;-).

Quoted 8 lines
Quoted 5 lines

The second of them is trying to control a file-system level constant inside the actual block device driver. This is a blatant violation of the layering principle in software design, and should go as soon as possible.

Yes. But still block device drivers allocate the array ...

Well if we do:

find ./ -name "*.c" -exec grep max_readahead /dev/null {} \;

One can already easly see that apart from ide, md, and acorn drivers this has been already abstracted away one level up at the block device handling as well. My suspiction is that there is now already *double* initialization of the sub-slices of this array there. Anyway ide should be adapted here to the same way as it's done now for scsi.

Will you look after this or should me? (I can't until afternoon, becouse I'm at my "true live" job now and have other things to do...)

#7 lore raw
In reply to Pavel Machek

drivers/ide/ide-cd.c line 2665

Quoted 10 lines · Vojtech Pavlik

------------------------------------------------------------------------

diff -urN linux-2.5.4/drivers/ide/ide-cd.c linux-2.5.4-ideclean/drivers/ide/ide-cd.c

drivers/ide/ide-cd.c +0 -0
@@ -2662,8 +2662,6 @@
 	int major = HWIF(drive)->major;
 	int minor = drive->select.b.unit << PARTN_BITS;
 
 

Please note that the two line above can be killed then as well. More recent gcc version report this now as unused.

#8 lore raw
In reply to Pavel Machek
Quoted 4 lines · Martin Dalecki
Quoted 3 lines
Quoted 3 lines

The first does control an array of values, which doesn't make sense in first place. I.e. changing it doesn't
change ANY behaviour of the kernel.

Quoted 8 lines
Quoted 1 line

Actually HFS uses it ...

Please note that the use in HFS is inappriopriate. It's supposed to optimize the read throughput there, which is something that shouldn't be done at the fs setup layer at all. The usage of read_ahead there can be just removed and everything should be fine (modulo the fact that in current state the HFS filesystem code is just non-working obsolete code garbage anyway ;-).

Yes; I just commented on that it does change some behavior of the kernel.

Quoted 11 lines
Quoted 6 lines
Quoted 4 lines

The second of them is trying to control a file-system level constant inside the actual block device driver. This is a blatant violation of the layering principle in software design, and should go as soon as possible.

Yes. But still block device drivers allocate the array ...

Well if we do:

find ./ -name "*.c" -exec grep max_readahead /dev/null {} \;

Quoted 8 lines

One can already easly see that apart from ide, md, and acorn drivers this has been already abstracted away one level up at the block device handling as well. My suspiction is that there is now already *double* initialization of the sub-slices of this array there. Anyway ide should be adapted here to the same way as it's done now for scsi.

Will you look after this or should me? (I can't until afternoon, becouse I'm at my "true live" job now and have other things to do...)

Am I understanding you correctly that we can just remove the max_readahead references in IDE (and possibly also md and acorn)?

Signature · 2 lines
Vojtech Pavlik
SuSE Labs
#9 lore raw
In reply to Pavel Machek
Quoted 39 lines · Vojtech Pavlik
Quoted 7 lines · Martin Dalecki
Quoted 6 lines
Quoted 3 lines

The first does control an array of values, which doesn't make sense in first place. I.e. changing it doesn't change ANY behaviour of the kernel.

Actually HFS uses it ...

Quoted 7 lines

Please note that the use in HFS is inappriopriate. It's supposed to optimize the read throughput there, which is something that shouldn't be done at the fs setup layer at all. The usage of read_ahead there can be just removed and everything should be fine (modulo the fact that in current state the HFS filesystem code is just non-working obsolete code garbage anyway ;-).

Yes; I just commented on that it does change some behavior of the kernel.

Quoted 19 lines
Quoted 8 lines
Quoted 5 lines

The second of them is trying to control a file-system level constant inside the actual block device driver. This is a blatant violation of the layering principle in software design, and should go as soon as possible.

Yes. But still block device drivers allocate the array ...

Well if we do:

find ./ -name "*.c" -exec grep max_readahead /dev/null {} \;

One can already easly see that apart from ide, md, and acorn drivers this has been already abstracted away one level up at the block device handling as well. My suspiction is that there is now already *double* initialization of the sub-slices of this array there. Anyway ide should be adapted here to the same way as it's done now for scsi.

Quoted 7 lines
Quoted 3 lines

Will you look after this or should me? (I can't until afternoon, becouse I'm at my "true live" job now and have other things to do...)

Am I understanding you correctly that we can just remove the max_readahead references in IDE (and possibly also md and acorn)?

Yes they can certailny be killed there. However please note that I'm not quite sure whatever some other adjustments may be needed. I suggest to double check with the way the scsi driver middle layer deals with them.

OK. I can't resist. Let's have a closer look together:

~/tmp/trans/linux-2.5.4# find ./ -name "*.[ch]" -exec grep max_readahead /dev/null {} \;
./drivers/acorn/block/mfmhd.c: max_readahead[major][minor] = arg;
./drivers/acorn/block/mfmhd.c: return put_user(max_readahead[major][minor], (long *) arg);

1. ^^^^ Here apparently no additional allocation is needed.

./drivers/block/blkpg.c: if (!(iptr = max_readahead[major(dev)]))
./drivers/block/blkpg.c: if (!(iptr = max_readahead[major(dev)]))

2. ^^^^ This is just read out to the user space through ioctl()..

./drivers/block/ll_rw_blk.c:int * max_readahead[MAX_BLKDEV];
./drivers/block/ll_rw_blk.c: memset(max_readahead, 0, sizeof(max_readahead));

3. ^^^^ This is just initialisation.

./drivers/ide/ide-probe.c:      max_readahead[hwif->major] = max_ra;
./drivers/ide/ide-disk.c:       ide_add_setting(drive,  "fi ....      1024,   &max_readahead[major][minor],   NULL);
./drivers/ide/ide-floppy.c:     ide_add_setting(drive,  "....,   &max_readahead[major][minor],   NULL);

./drivers/ide/ide-cd.c: ide_add_setting(drive, "file_readahead",. ... , &max_readahead[major][minor], NULL);
./drivers/ide/ide.c: kfree(max_readahead[hwif->major]);
./drivers/ide/ataraid.c: max_readahead[ATAMAJOR] = NULL;

4. ^^^^ Still just initialization.

./drivers/md/md.c: max_readahead[MAJOR_NR] = md_maxreadahead;
./include/linux/blkdev.h:extern int * max_readahead[MAX_BLKDEV];
./include/linux/blkdev.h: max_readahead[major] = NULL;

5. Still no true usage.

./mm/filemap.c:static inline int get_max_readahead(struct inode * inode) ./mm/filemap.c: if (kdev_none(inode->i_dev) || !max_readahead[major(inode->i_dev)]) ./mm/filemap.c: return max_readahead[major(inode->i_dev)][minor(inode->i_dev)]; ./mm/filemap.c: int max_readahead = get_max_readahead(inode);
./mm/filemap.c: if (filp->f_ramax > max_readahead)
./mm/filemap.c: filp->f_ramax = max_readahead;
./mm/filemap.c: int max_readahead = get_max_readahead(inode);
./mm/filemap.c: if (filp->f_ramax > max_readahead)
./mm/filemap.c: filp->f_ramax = max_readahead;
./mm/filemap.c: ra_window = get_max_readahead(vma->vm_file->f_dentry->d_inode);

6. Hmm I wonder how the above is working in case somebody didn't care about this array.

Let's have a closer look at it there (mm/filemap.c).

If max_readahead array is not set at all, the filemap code just assumes a constant MAX_READAHEAD value. max_readahead is an upper bound value for the number for consecutive file sectors read at once.

static inline int get_max_readahead(struct inode * inode)
{
if (kdev_none(inode->i_dev) || !max_readahead[major(inode->i_dev)])

       return MAX_READAHEAD;

return max_readahead[major(inode->i_dev)][minor(inode->i_dev)];
}

Other then this we have the following code in nopage_sequention_readahead:

   ra_window = get_max_readahead(vma->vm_file->f_dentry->d_inode);
   ra_window = CLUSTER_OFFSET(ra_window + CLUSTER_PAGES - 1);

Obviously the first file of the two can be just killed without any harm.

So the conclusions is that not just the read_ahead array is bogous now. The max_readahead array can be killed entierly from the kernel as well ;-).

The answer is: I'm now confident that you can just remove all the max_readahead initialization from the ide code.

#10 lore raw
In reply to Pavel Machek
Quoted 5 lines · Martin Dalecki

So the conclusions is that not just the read_ahead array is bogous now. The max_readahead array can be killed entierly from the kernel as well ;-).

The answer is: I'm now confident that you can just remove all the max_readahead initialization from the ide code.

Since I've come to the same conclusion, here is the patch. It removes read_ahead, max_readahead, BLKRAGET, BLKRASET, BLKFRAGET and BLKFRASET completely.

Comments, Jens?

Signature · 2 lines
Vojtech Pavlik
SuSE Labs
Documentation/cdrom/sbpcd +2 -8
diff -urN linux-2.5.4/Documentation/cdrom/sbpcd linux-2.5.4-readahead/Documentation/cdrom/sbpcd
@@ -613,8 +613,8 @@
 	printf("READ          d      READ RAW     w       READ AUDIO   A\n");
 	printf("MS-INFO       M      TOC          T       START        S\n");
 	printf("SET EJECTSW   X      DEVICE       D       DEBUG        Y\n");
-	printf("AUDIO_BUFSIZ  Z      RESET        R       BLKRASET     B\n");
-	printf("SET VOLUME    v      GET VOLUME   V\n");
+	printf("AUDIO_BUFSIZ  Z      RESET        R       SET VOLUME   v\n");
+	printf("GET VOLUME    V\n");
 }
 
 /*
@@ -881,12 +881,6 @@
 		case 'R':
 			rc=ioctl(drive,CDROMRESET);
 			if (rc<0) printf("CDROMRESET: rc=%d.\n",rc);
-			break;
-		case 'B': /* set the driver's (?) read ahead value */
-			printf("enter read-ahead size: ? ");
-			scanf("%d",&i);
-			rc=ioctl(drive,BLKRASET,i);
-			if (rc<0) printf("BLKRASET: rc=%d.\n",rc);
 			break;
 #ifdef AZT_PRIVATE_IOCTLS /*not supported by every CDROM driver*/
 		case 'd':
arch/mips64/kernel/ioctl32.c +0 -4
diff -urN linux-2.5.4/arch/mips64/kernel/ioctl32.c linux-2.5.4-readahead/arch/mips64/kernel/ioctl32.c
@@ -760,10 +760,6 @@
 	IOCTL32_HANDLER(BLKGETSIZE, w_long),
 
 	IOCTL32_DEFAULT(BLKFLSBUF),
-	IOCTL32_DEFAULT(BLKRASET),
-	IOCTL32_HANDLER(BLKRAGET, w_long),
-	IOCTL32_DEFAULT(BLKFRASET),
-	IOCTL32_HANDLER(BLKFRAGET, w_long),
 	IOCTL32_DEFAULT(BLKSECTSET),
 	IOCTL32_HANDLER(BLKSECTGET, w_long),
 	IOCTL32_DEFAULT(BLKSSZGET),
arch/sparc64/kernel/ioctl32.c +0 -4
diff -urN linux-2.5.4/arch/sparc64/kernel/ioctl32.c linux-2.5.4-readahead/arch/sparc64/kernel/ioctl32.c
@@ -3997,8 +3997,6 @@
 COMPATIBLE_IOCTL(BLKROGET)
 COMPATIBLE_IOCTL(BLKRRPART)
 COMPATIBLE_IOCTL(BLKFLSBUF)
-COMPATIBLE_IOCTL(BLKRASET)
-COMPATIBLE_IOCTL(BLKFRASET)
 COMPATIBLE_IOCTL(BLKSECTSET)
 COMPATIBLE_IOCTL(BLKSSZGET)
 COMPATIBLE_IOCTL(BLKBSZGET)
@@ -4626,10 +4624,8 @@
 HANDLE_IOCTL(SIOCRTMSG, ret_einval)
 HANDLE_IOCTL(SIOCGSTAMP, do_siocgstamp)
 HANDLE_IOCTL(HDIO_GETGEO, hdio_getgeo)
-HANDLE_IOCTL(BLKRAGET, w_long)
 HANDLE_IOCTL(BLKGETSIZE, w_long)
 HANDLE_IOCTL(0x1260, broken_blkgetsize)
-HANDLE_IOCTL(BLKFRAGET, w_long)
 HANDLE_IOCTL(BLKSECTGET, w_long)
 HANDLE_IOCTL(BLKPG, blkpg_ioctl_trans)
 HANDLE_IOCTL(FBIOPUTCMAP32, fbiogetputcmap)
drivers/acorn/block/mfmhd.c +0 -12
diff -urN linux-2.5.4/drivers/acorn/block/mfmhd.c linux-2.5.4-readahead/drivers/acorn/block/mfmhd.c
@@ -1208,15 +1208,6 @@
 			return -EFAULT;
 		return 0;
 
-	case BLKFRASET:
-		if (!capable(CAP_SYS_ADMIN))
-			return -EACCES;
-		max_readahead[major][minor] = arg;
-		return 0;
-
-	case BLKFRAGET:
-		return put_user(max_readahead[major][minor], (long *) arg);
-
 	case BLKSECTGET:
 		return put_user(max_sectors[major][minor], (long *) arg);
 
@@ -1230,8 +1221,6 @@
 	case BLKFLSBUF:
 	case BLKROSET:
 	case BLKROGET:
-	case BLKRASET:
-	case BLKRAGET:
 	case BLKPG:
 		return blk_ioctl(dev, cmd, arg);
 
@@ -1442,7 +1431,6 @@
 	hdc63463_irqpollmask	= irqmask;
 
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST);
-	read_ahead[MAJOR_NR] = 8;	/* 8 sector (4kB?) read ahread */
 
 	add_gendisk(&mfm_gendisk);
 
drivers/block/DAC960.c +0 -6
diff -urN linux-2.5.4/drivers/block/DAC960.c linux-2.5.4-readahead/drivers/block/DAC960.c
@@ -1964,10 +1964,6 @@
   Controller->GenericDiskInfo.sizes = Controller->PartitionSizes;
   blksize_size[MajorNumber] = Controller->BlockSizes;
   /*
-    Initialize Read Ahead to 128 sectors.
-  */
-  read_ahead[MajorNumber] = 128;
-  /*
     Complete initialization of the Generic Disk Information structure.
   */
   Controller->GenericDiskInfo.major = MajorNumber;
@@ -5399,8 +5395,6 @@
 			   sizeof(DiskGeometry_T)) ? -EFAULT : 0);
     case BLKGETSIZE:
     case BLKGETSIZE64:
-    case BLKRAGET:
-    case BLKRASET:
     case BLKFLSBUF:
     case BLKBSZGET:
     case BLKBSZSET:
drivers/block/acsi.c +0 -1
diff -urN linux-2.5.4/drivers/block/acsi.c linux-2.5.4-readahead/drivers/block/acsi.c
@@ -1785,7 +1785,6 @@
 	STramMask = ATARIHW_PRESENT(EXTD_DMA) ? 0x00000000 : 0xff000000;
 	
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &acsi_lock);
-	read_ahead[MAJOR_NR] = 8;		/* 8 sector (4kB) read-ahead */
 	add_gendisk(&acsi_gendisk);
 
 #ifdef CONFIG_ATARI_SLM
drivers/block/ataflop.c +0 -2
diff -urN linux-2.5.4/drivers/block/ataflop.c linux-2.5.4-readahead/drivers/block/ataflop.c
@@ -1573,8 +1573,6 @@
 	switch (cmd) {
 		case BLKROSET:
 		case BLKROGET:
-		case BLKRASET:
-		case BLKRAGET:
 		case BLKFLSBUF:
 			return blk_ioctl(device, cmd, param);
 	}
drivers/block/blkpg.c +1 -26
diff -urN linux-2.5.4/drivers/block/blkpg.c linux-2.5.4-readahead/drivers/block/blkpg.c
@@ -29,7 +29,7 @@
  */
 
 #include <linux/errno.h>
-#include <linux/fs.h>			/* for BLKRASET, ... */
+#include <linux/fs.h>			/* for BLKROSET, ... */
 #include <linux/sched.h>		/* for capable() */
 #include <linux/blk.h>			/* for set_device_ro() */
 #include <linux/blkpg.h>
@@ -226,31 +226,6 @@
 		case BLKROGET:
 			intval = (is_read_only(dev) != 0);
 			return put_user(intval, (int *)(arg));
-
-		case BLKRASET:
-			if(!capable(CAP_SYS_ADMIN))
-				return -EACCES;
-			if(arg > 0xff)
-				return -EINVAL;
-			read_ahead[major(dev)] = arg;
-			return 0;
-		case BLKRAGET:
-			if (!arg)
-				return -EINVAL;
-			return put_user(read_ahead[major(dev)], (long *) arg);
-
-		case BLKFRASET:
-			if (!capable(CAP_SYS_ADMIN))
-				return -EACCES;
-			if (!(iptr = max_readahead[major(dev)]))
-				return -EINVAL;
-			iptr[minor(dev)] = arg;
-			return 0;
-
-		case BLKFRAGET:
-			if (!(iptr = max_readahead[major(dev)]))
-				return -EINVAL;
-			return put_user(iptr[minor(dev)], (long *) arg);
 
 		case BLKSECTGET:
 			if ((q = blk_get_queue(dev)) == NULL)
drivers/block/cciss.c +0 -3
diff -urN linux-2.5.4/drivers/block/cciss.c linux-2.5.4-readahead/drivers/block/cciss.c
@@ -471,8 +471,6 @@
 	case BLKBSZGET:
 	case BLKROSET:
 	case BLKROGET:
-	case BLKRASET:
-	case BLKRAGET:
 	case BLKPG:
 		return blk_ioctl(inode->i_rdev, cmd, arg);
 	case CCISS_GETPCIINFO:
@@ -2542,7 +2540,6 @@
 
 	/* fill in the other Kernel structs */
 	blksize_size[MAJOR_NR+i] = hba[i]->blocksizes;
-        read_ahead[MAJOR_NR+i] = READ_AHEAD;
 
 	/* Fill in the gendisk data */ 	
 	hba[i]->gendisk.major = MAJOR_NR + i;
drivers/block/cpqarray.c +0 -3
diff -urN linux-2.5.4/drivers/block/cpqarray.c linux-2.5.4-readahead/drivers/block/cpqarray.c
@@ -481,7 +481,6 @@
 		blk_queue_max_phys_segments(q, SG_MAX);
 
 		blksize_size[MAJOR_NR+i] = ida_blocksizes + (i*256);
-		read_ahead[MAJOR_NR+i] = READ_AHEAD;
 
 		ida_gendisk[i].major = MAJOR_NR + i;
 		ida_gendisk[i].major_name = "ida";
@@ -1181,8 +1180,6 @@
 	case BLKBSZGET:
 	case BLKROSET:
 	case BLKROGET:
-	case BLKRASET:
-	case BLKRAGET:
 	case BLKPG:
 		return blk_ioctl(inode->i_rdev, cmd, arg);
 
drivers/block/floppy.c +0 -2
diff -urN linux-2.5.4/drivers/block/floppy.c linux-2.5.4-readahead/drivers/block/floppy.c
@@ -3448,8 +3448,6 @@
 	switch (cmd) {
 		case BLKROSET:
 		case BLKROGET:
-		case BLKRASET:
-		case BLKRAGET:
 		case BLKFLSBUF:
 			return blk_ioctl(device, cmd, param);
 	}
drivers/block/ll_rw_blk.c +0 -8
diff -urN linux-2.5.4/drivers/block/ll_rw_blk.c linux-2.5.4-readahead/drivers/block/ll_rw_blk.c
@@ -56,8 +56,6 @@
 
 /* This specifies how many sectors to read ahead on the disk. */
 
-int read_ahead[MAX_BLKDEV];
-
 /* blk_dev_struct is:
  *	request_queue
  *	*queue
@@ -84,11 +82,6 @@
 int * blksize_size[MAX_BLKDEV];
 
 /*
- * The following tunes the read-ahead algorithm in mm/filemap.c
- */
-int * max_readahead[MAX_BLKDEV];
-
-/*
  * How many reqeusts do we allocate per queue,
  * and how many do we "batch" on freeing them?
  */
@@ -1689,7 +1682,6 @@
 		dev->queue = NULL;
 
 	memset(ro_bits,0,sizeof(ro_bits));
-	memset(max_readahead, 0, sizeof(max_readahead));
 
 	total_ram = nr_free_pages() << (PAGE_SHIFT - 10);
 
drivers/block/paride/pcd.c +0 -1
diff -urN linux-2.5.4/drivers/block/paride/pcd.c linux-2.5.4-readahead/drivers/block/paride/pcd.c
@@ -358,7 +358,6 @@
 	}
 
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &pcd_lock);
-	read_ahead[MAJOR_NR] = 8;	/* 8 sector (4kB) read ahead */
 
 	for (i=0;i<PCD_UNITS;i++) pcd_blocksizes[i] = 1024;
         blksize_size[MAJOR_NR] = pcd_blocksizes;
drivers/block/paride/pd.c +0 -3
diff -urN linux-2.5.4/drivers/block/paride/pd.c linux-2.5.4-readahead/drivers/block/paride/pd.c
@@ -397,7 +397,6 @@
 	q = BLK_DEFAULT_QUEUE(MAJOR_NR);
 	blk_init_queue(q, DEVICE_REQUEST, &pd_lock);
 	blk_queue_max_sectors(q, cluster);
-        read_ahead[MAJOR_NR] = 8;       /* 8 sector (4kB) read ahead */
         
 	pd_gendisk.major = major;
 	pd_gendisk.major_name = name;
@@ -480,8 +479,6 @@
 	    case BLKGETSIZE64:
 	    case BLKROSET:
 	    case BLKROGET:
-	    case BLKRASET:
-	    case BLKRAGET:
 	    case BLKFLSBUF:
 	    case BLKPG:
 		return blk_ioctl(inode->i_rdev, cmd, arg);
drivers/block/paride/pf.c +0 -3
diff -urN linux-2.5.4/drivers/block/paride/pf.c linux-2.5.4-readahead/drivers/block/paride/pf.c
@@ -363,7 +363,6 @@
 	blk_init_queue(q, DEVICE_REQUEST, &pf_spin_lock);
 	blk_queue_max_phys_segments(q, cluster);
 	blk_queue_max_hw_segments(q, cluster);
-        read_ahead[MAJOR_NR] = 8;       /* 8 sector (4kB) read ahead */
         
 	for (i=0;i<PF_UNITS;i++) pf_blocksizes[i] = 1024;
 	blksize_size[MAJOR_NR] = pf_blocksizes;
@@ -433,8 +432,6 @@
                 return put_user((u64)PF.capacity << 9,(u64 *)arg);
 	    case BLKROSET:
 	    case BLKROGET:
-	    case BLKRASET:
-	    case BLKRAGET:
 	    case BLKFLSBUF:
 		return blk_ioctl(inode->i_rdev, cmd, arg);
             default:
drivers/block/ps2esdi.c +0 -3
diff -urN linux-2.5.4/drivers/block/ps2esdi.c linux-2.5.4-readahead/drivers/block/ps2esdi.c
@@ -177,7 +177,6 @@
 	}
 	/* set up some global information - indicating device specific info */
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &ps2esdi_lock);
-	read_ahead[MAJOR_NR] = 8;	/* 8 sector (4kB) read ahead */
 
 	/* some minor housekeeping - setup the global gendisk structure */
 	add_gendisk(&ps2esdi_gendisk);
@@ -1108,8 +1107,6 @@
 		case BLKGETSIZE64:
 		case BLKROSET:
 		case BLKROGET:
-		case BLKRASET:
-		case BLKRAGET:
 		case BLKFLSBUF:
 		case BLKBSZGET:
 		case BLKBSZSET:
drivers/block/xd.c +0 -3
diff -urN linux-2.5.4/drivers/block/xd.c linux-2.5.4-readahead/drivers/block/xd.c
@@ -171,7 +171,6 @@
 	}
 	devfs_handle = devfs_mk_dir (NULL, xd_gendisk.major_name, NULL);
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &xd_lock);
-	read_ahead[MAJOR_NR] = 8;	/* 8 sector (4kB) read ahead */
 	add_gendisk(&xd_gendisk);
 	xd_geninit();
 
@@ -355,8 +354,6 @@
 		case BLKFLSBUF:
 		case BLKROSET:
 		case BLKROGET:
-		case BLKRASET:
-		case BLKRAGET:
 		case BLKPG:
 			return blk_ioctl(inode->i_rdev, cmd, arg);
 
drivers/cdrom/aztcd.c +0 -1
diff -urN linux-2.5.4/drivers/cdrom/aztcd.c linux-2.5.4-readahead/drivers/cdrom/aztcd.c
@@ -1927,7 +1927,6 @@
 	}
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &aztSpin);
 	blksize_size[MAJOR_NR] = aztcd_blocksizes;
-	read_ahead[MAJOR_NR] = 4;
 	register_disk(NULL, mk_kdev(MAJOR_NR, 0), 1, &azt_fops, 0);
 
 	if ((azt_port == 0x1f0) || (azt_port == 0x170))
drivers/cdrom/cdu31a.c +0 -1
diff -urN linux-2.5.4/drivers/cdrom/cdu31a.c linux-2.5.4-readahead/drivers/cdrom/cdu31a.c
@@ -3442,7 +3442,6 @@
 		blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR),
 			       DEVICE_REQUEST,
 			       &cdu31a_lock);
-		read_ahead[MAJOR_NR] = CDU31A_READAHEAD;
 		cdu31a_block_size = 1024;	/* 1kB default block size */
 		/* use 'mount -o block=2048' */
 		blksize_size[MAJOR_NR] = &cdu31a_block_size;
drivers/cdrom/cm206.c +0 -1
diff -urN linux-2.5.4/drivers/cdrom/cm206.c linux-2.5.4-readahead/drivers/cdrom/cm206.c
@@ -1503,7 +1503,6 @@
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST,
 		       &cm206_lock);
 	blksize_size[MAJOR_NR] = cm206_blocksizes;
-	read_ahead[MAJOR_NR] = 16;	/* reads ahead what? */
 	init_bh(CM206_BH, cm206_bh);
 
 	memset(cd, 0, sizeof(*cd));	/* give'm some reasonable value */
drivers/cdrom/gscd.c +0 -1
diff -urN linux-2.5.4/drivers/cdrom/gscd.c linux-2.5.4-readahead/drivers/cdrom/gscd.c
@@ -1022,7 +1022,6 @@
 
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &gscd_lock);
 	blksize_size[MAJOR_NR] = gscd_blocksizes;
-	read_ahead[MAJOR_NR] = 4;
 
 	disk_state = 0;
 	gscdPresent = 1;
drivers/cdrom/mcd.c +0 -1
diff -urN linux-2.5.4/drivers/cdrom/mcd.c linux-2.5.4-readahead/drivers/cdrom/mcd.c
@@ -1075,7 +1075,6 @@
 	blksize_size[MAJOR_NR] = mcd_blocksizes;
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST,
 		       &mcd_spinlock);
-	read_ahead[MAJOR_NR] = 4;
 
 	/* check for card */
 
drivers/cdrom/mcdx.c +0 -1
diff -urN linux-2.5.4/drivers/cdrom/mcdx.c linux-2.5.4-readahead/drivers/cdrom/mcdx.c
@@ -1184,7 +1184,6 @@
 
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST,
 		       &mcdx_lock);
-	read_ahead[MAJOR_NR] = READ_AHEAD;
 	blksize_size[MAJOR_NR] = mcdx_blocksizes;
 
 	xtrace(INIT, "init() subscribe irq and i/o\n");
drivers/cdrom/optcd.c +0 -1
diff -urN linux-2.5.4/drivers/cdrom/optcd.c linux-2.5.4-readahead/drivers/cdrom/optcd.c
@@ -2062,7 +2062,6 @@
 	blksize_size[MAJOR_NR] = &blksize;
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST,
 		       &optcd_lock);
-	read_ahead[MAJOR_NR] = 4;
 	request_region(optcd_port, 4, "optcd");
 	register_disk(NULL, mk_kdev(MAJOR_NR,0), 1, &opt_fops, 0);
 
drivers/cdrom/sbpcd.c +0 -6
diff -urN linux-2.5.4/drivers/cdrom/sbpcd.c linux-2.5.4-readahead/drivers/cdrom/sbpcd.c
@@ -4531,12 +4531,6 @@
 		RETURN_UP(0);
 	} /* end of CDROMREADAUDIO */
 		
-	case BLKRASET:
-		if(!capable(CAP_SYS_ADMIN)) RETURN_UP(-EACCES);
-		if(kdev_none(cdi->dev)) RETURN_UP(-EINVAL);
-		if(arg > 0xff) RETURN_UP(-EINVAL);
-		read_ahead[major(cdi->dev)] = arg;
-		RETURN_UP(0);
 	default:
 		msg(DBG_IOC,"ioctl: unknown function request %04X\n", cmd);
 		RETURN_UP(-EINVAL);
drivers/cdrom/sjcd.c +0 -1
diff -urN linux-2.5.4/drivers/cdrom/sjcd.c linux-2.5.4-readahead/drivers/cdrom/sjcd.c
@@ -1695,7 +1695,6 @@
 	}
 
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST,&sjcd_lock);
-	read_ahead[MAJOR_NR] = 4;
 	register_disk(NULL, mk_kdev(MAJOR_NR, 0), 1, &sjcd_fops, 0);
 
 	if (check_region(sjcd_base, 4)) {
drivers/cdrom/sonycd535.c +0 -1
diff -urN linux-2.5.4/drivers/cdrom/sonycd535.c linux-2.5.4-readahead/drivers/cdrom/sonycd535.c
@@ -1598,7 +1598,6 @@
 				}
 				blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &sonycd535_lock);
 				blksize_size[MAJOR_NR] = &sonycd535_block_size;
-				read_ahead[MAJOR_NR] = 8;	/* 8 sector (4kB) read-ahead */
 
 				sony_toc = (struct s535_sony_toc *)
 					kmalloc(sizeof *sony_toc, GFP_KERNEL);
drivers/ide/ataraid.c +0 -1
diff -urN linux-2.5.4/drivers/ide/ataraid.c linux-2.5.4-readahead/drivers/ide/ataraid.c
@@ -289,7 +289,6 @@
 	hardsect_size[ATAMAJOR] = NULL;
 	blk_size[ATAMAJOR] = NULL;
 	blksize_size[ATAMAJOR] = NULL;                       
-	max_readahead[ATAMAJOR] = NULL;
 
 	del_gendisk(&ataraid_gendisk);
         
drivers/ide/hd.c +0 -3
diff -urN linux-2.5.4/drivers/ide/hd.c linux-2.5.4-readahead/drivers/ide/hd.c
@@ -652,8 +652,6 @@
 		case BLKGETSIZE64:
 		case BLKROSET:
 		case BLKROGET:
-		case BLKRASET:
-		case BLKRAGET:
 		case BLKFLSBUF:
 		case BLKPG:
 			return blk_ioctl(inode->i_rdev, cmd, arg);
@@ -837,7 +835,6 @@
 	}
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &hd_lock);
 	blk_queue_max_sectors(BLK_DEFAULT_QUEUE(MAJOR_NR), 255);
-	read_ahead[MAJOR_NR] = 8;		/* 8 sector (4kB) read-ahead */
 	add_gendisk(&hd_gendisk);
 	init_timer(&device_timer);
 	device_timer.function = hd_times_out;
drivers/ide/ide-cd.c +0 -5
diff -urN linux-2.5.4/drivers/ide/ide-cd.c linux-2.5.4-readahead/drivers/ide/ide-cd.c
@@ -2659,11 +2659,6 @@
 
 static void ide_cdrom_add_settings(ide_drive_t *drive)
 {
-	int major = HWIF(drive)->major;
-	int minor = drive->select.b.unit << PARTN_BITS;
-
-	ide_add_setting(drive,	"breada_readahead",	SETTING_RW, BLKRAGET, BLKRASET, TYPE_INT, 0, 255, 1, 2, &read_ahead[major], NULL);
-	ide_add_setting(drive,	"file_readahead",	SETTING_RW, BLKFRAGET, BLKFRASET, TYPE_INTA, 0, INT_MAX, 1, 1024, &max_readahead[major][minor],	NULL);
 	ide_add_setting(drive,	"dsc_overlap",		SETTING_RW, -1, -1, TYPE_BYTE, 0, 1, 1,	1, &drive->dsc_overlap, NULL);
 }
 
drivers/ide/ide-disk.c +0 -2
diff -urN linux-2.5.4/drivers/ide/ide-disk.c linux-2.5.4-readahead/drivers/ide/ide-disk.c
@@ -916,8 +916,6 @@
 	ide_add_setting(drive,	"bswap",		SETTING_READ,					-1,			-1,			TYPE_BYTE,	0,	1,				1,	1,	&drive->bswap,			NULL);
 	ide_add_setting(drive,	"multcount",		id ? SETTING_RW : SETTING_READ,			HDIO_GET_MULTCOUNT,	HDIO_SET_MULTCOUNT,	TYPE_BYTE,	0,	id ? id->max_multsect : 0,	1,	1,	&drive->mult_count,		set_multcount);
 	ide_add_setting(drive,	"nowerr",		SETTING_RW,					HDIO_GET_NOWERR,	HDIO_SET_NOWERR,	TYPE_BYTE,	0,	1,				1,	1,	&drive->nowerr,			set_nowerr);
-	ide_add_setting(drive,	"breada_readahead",	SETTING_RW,					BLKRAGET,		BLKRASET,		TYPE_INT,	0,	255,				1,	1,	&read_ahead[major],		NULL);
-	ide_add_setting(drive,	"file_readahead",	SETTING_RW,					BLKFRAGET,		BLKFRASET,		TYPE_INTA,	0,	4096,			PAGE_SIZE,	1024,	&max_readahead[major][minor],	NULL);
 	ide_add_setting(drive,	"lun",			SETTING_RW,					-1,			-1,			TYPE_INT,	0,	7,				1,	1,	&drive->lun,			NULL);
 	ide_add_setting(drive,	"wcache",		SETTING_RW,					HDIO_GET_WCACHE,	HDIO_SET_WCACHE,	TYPE_BYTE,	0,	1,				1,	1,	&drive->wcache,			write_cache);
 	ide_add_setting(drive,	"acoustic",		SETTING_RW,					HDIO_GET_ACOUSTIC,	HDIO_SET_ACOUSTIC,	TYPE_BYTE,	0,	254,				1,	1,	&drive->acoustic,		set_acoustic);
drivers/ide/ide-floppy.c +0 -2
diff -urN linux-2.5.4/drivers/ide/ide-floppy.c linux-2.5.4-readahead/drivers/ide/ide-floppy.c
@@ -1968,8 +1968,6 @@
 	ide_add_setting(drive,	"bios_cyl",		SETTING_RW,					-1,			-1,			TYPE_INT,	0,	1023,				1,	1,	&drive->bios_cyl,		NULL);
 	ide_add_setting(drive,	"bios_head",		SETTING_RW,					-1,			-1,			TYPE_BYTE,	0,	255,				1,	1,	&drive->bios_head,		NULL);
 	ide_add_setting(drive,	"bios_sect",		SETTING_RW,					-1,			-1,			TYPE_BYTE,	0,	63,				1,	1,	&drive->bios_sect,		NULL);
-	ide_add_setting(drive,	"breada_readahead",	SETTING_RW,					BLKRAGET,		BLKRASET,		TYPE_INT,	0,	255,				1,	2,	&read_ahead[major],		NULL);
-	ide_add_setting(drive,	"file_readahead",	SETTING_RW,					BLKFRAGET,		BLKFRASET,		TYPE_INTA,	0,	INT_MAX,			1,	1024,	&max_readahead[major][minor],	NULL);
 
 }
 
drivers/ide/ide-probe.c +9 -20
diff -urN linux-2.5.4/drivers/ide/ide-probe.c linux-2.5.4-readahead/drivers/ide/ide-probe.c
@@ -802,35 +802,27 @@
 	}
 #endif
 
-	minors    = units * (1<<PARTN_BITS);
-	gd        = kmalloc (sizeof(struct gendisk), GFP_KERNEL);
+	minors = units * (1<<PARTN_BITS);
+
+	gd = kmalloc (sizeof(struct gendisk), GFP_KERNEL);
 	if (!gd)
 		goto err_kmalloc_gd;
 	gd->sizes = kmalloc (minors * sizeof(int), GFP_KERNEL);
 	if (!gd->sizes)
 		goto err_kmalloc_gd_sizes;
-	gd->part  = kmalloc (minors * sizeof(struct hd_struct), GFP_KERNEL);
+	gd->part = kmalloc (minors * sizeof(struct hd_struct), GFP_KERNEL);
 	if (!gd->part)
 		goto err_kmalloc_gd_part;
-	bs        = kmalloc (minors*sizeof(int), GFP_KERNEL);
-	if (!bs)
+	blksize_size[hwif->major] = kmalloc (minors*sizeof(int), GFP_KERNEL);
+	if (!blksize_size[hwif->major])
 		goto err_kmalloc_bs;
-	max_ra    = kmalloc (minors*sizeof(int), GFP_KERNEL);
-	if (!max_ra)
-		goto err_kmalloc_max_ra;
 
 	memset(gd->part, 0, minors * sizeof(struct hd_struct));
 
-	/* cdroms and msdos f/s are examples of non-1024 blocksizes */
-	blksize_size[hwif->major] = bs;
-	max_readahead[hwif->major] = max_ra;
-	for (unit = 0; unit < minors; ++unit) {
-		*bs++ = BLOCK_SIZE;
-		*max_ra++ = MAX_READAHEAD;
-	}
-
-	for (unit = 0; unit < units; ++unit)
+	for (unit = 0; unit < minors; unit++) {
+		blksize_size[hwif->major][unit] = BLOCK_SIZE;
 		hwif->drives[unit].part = &gd->part[unit << PARTN_BITS];
+	}
 
 	gd->major	= hwif->major;		/* our major device number */
 	gd->major_name	= IDE_MAJOR_NAME;	/* treated special in genhd.c */
@@ -875,8 +867,6 @@
 	}
 	return;
 
-err_kmalloc_max_ra:
-	kfree(bs);
 err_kmalloc_bs:
 	kfree(gd->part);
 err_kmalloc_gd_part:
@@ -937,7 +927,6 @@
 	init_gendisk(hwif);
 	blk_dev[hwif->major].data = hwif;
 	blk_dev[hwif->major].queue = ide_get_queue;
-	read_ahead[hwif->major] = 8;	/* (4kB) */
 	hwif->present = 1;	/* success */
 
 	return hwif->present;
drivers/ide/ide.c +0 -1
diff -urN linux-2.5.4/drivers/ide/ide.c linux-2.5.4-readahead/drivers/ide/ide.c
@@ -2126,7 +2126,6 @@
 	 */
 	unregister_blkdev(hwif->major, hwif->name);
 	kfree(blksize_size[hwif->major]);
-	kfree(max_readahead[hwif->major]);
 	blk_dev[hwif->major].data = NULL;
 	blk_dev[hwif->major].queue = NULL;
 	blk_clear(hwif->major);
drivers/md/lvm.c +0 -23
diff -urN linux-2.5.4/drivers/md/lvm.c linux-2.5.4-readahead/drivers/md/lvm.c
@@ -883,29 +883,6 @@
 		invalidate_buffers(inode->i_rdev);
 		break;
 
-
-	case BLKRASET:
-		/* set read ahead for block device */
-		if (!capable(CAP_SYS_ADMIN)) return -EACCES;
-
-		P_IOCTL("BLKRASET: %ld sectors for %s\n",
-			(long) arg, kdevname(inode->i_rdev));
-
-		if ((long) arg < LVM_MIN_READ_AHEAD ||
-		    (long) arg > LVM_MAX_READ_AHEAD)
-			return -EINVAL;
-		lv_ptr->lv_read_ahead = (long) arg;
-		break;
-
-
-	case BLKRAGET:
-		/* get current read ahead setting */
-		P_IOCTL("BLKRAGET %d\n", lv_ptr->lv_read_ahead);
-		if (put_user(lv_ptr->lv_read_ahead, (long *)arg))
-			return -EFAULT;
-		break;
-
-
 	case HDIO_GETGEO:
 		/* get disk geometry */
 		P_IOCTL("%s -- lvm_blk_ioctl -- HDIO_GETGEO\n", lvm_name);
drivers/md/md.c +0 -14
diff -urN linux-2.5.4/drivers/md/md.c linux-2.5.4-readahead/drivers/md/md.c
@@ -1737,7 +1737,6 @@
 	register_disk(&md_gendisk, mk_kdev(MAJOR_NR,mdidx(mddev)),
 			1, &md_fops, md_size[mdidx(mddev)]<<1);
 
-	read_ahead[MD_MAJOR] = 1024;
 	return (0);
 }
 
@@ -2622,8 +2621,6 @@
 						(u64 *) arg);
 			goto done;
 
-		case BLKRAGET:
-		case BLKRASET:
 		case BLKFLSBUF:
 		case BLKBSZGET:
 		case BLKBSZSET:
@@ -3176,13 +3173,6 @@
 
 	sz += sprintf(page+sz, "\n");
 
-
-	sz += sprintf(page+sz, "read_ahead ");
-	if (read_ahead[MD_MAJOR] == INT_MAX)
-		sz += sprintf(page+sz, "not set\n");
-	else
-		sz += sprintf(page+sz, "%d sectors\n", read_ahead[MD_MAJOR]);
-
 	ITERATE_MDDEV(mddev,tmp) {
 		sz += sprintf(page + sz, "md%d : %sactive", mdidx(mddev),
 						mddev->pers ? "" : "in");
@@ -3622,7 +3612,6 @@
 	}
 	blksize_size[MAJOR_NR] = md_blocksizes;
 	blk_size[MAJOR_NR] = md_size;
-	max_readahead[MAJOR_NR] = md_maxreadahead;
 
 	dprintk("md: sizeof(mdp_super_t) = %d\n", (int)sizeof(mdp_super_t));
 
@@ -3657,9 +3646,6 @@
 
 	/* forward all md request to md_make_request */
 	blk_queue_make_request(BLK_DEFAULT_QUEUE(MAJOR_NR), md_make_request);
-
-
-	read_ahead[MAJOR_NR] = INT_MAX;
 
 	add_gendisk(&md_gendisk);
 
drivers/message/i2o/i2o_block.c +0 -2
diff -urN linux-2.5.4/drivers/message/i2o/i2o_block.c linux-2.5.4-readahead/drivers/message/i2o/i2o_block.c
@@ -1104,8 +1104,6 @@
 		case BLKFLSBUF:
 		case BLKROSET:
 		case BLKROGET:
-		case BLKRASET:
-		case BLKRAGET:
 		case BLKPG:
 			return blk_ioctl(inode->i_rdev, cmd, arg);
 			
drivers/s390/block/dasd.c +0 -2
diff -urN linux-2.5.4/drivers/s390/block/dasd.c linux-2.5.4-readahead/drivers/s390/block/dasd.c
@@ -2489,8 +2489,6 @@
 	case BLKSSZGET:
 	case BLKROSET:
 	case BLKROGET:
-	case BLKRASET:
-	case BLKRAGET:
 	case BLKFLSBUF:
 	case BLKPG:
 	case BLKELVGET:
drivers/s390/block/xpram.c +0 -19
diff -urN linux-2.5.4/drivers/s390/block/xpram.c linux-2.5.4-readahead/drivers/s390/block/xpram.c
@@ -659,26 +659,9 @@
 		if ( capable(CAP_SYS_ADMIN) )invalidate_buffers(inode->i_rdev);
 		return 0;
 
-	case BLKRAGET: /* return the readahead value, 0x1263 */
-		if (!arg)  return -EINVAL;
-		err = 0; /* verify_area_20(VERIFY_WRITE, (long *) arg, sizeof(long));
-		          * if (err) return err;
-                          */
-		put_user(read_ahead[MAJOR(inode->i_rdev)], (long *)arg);
-
-		return 0;
-
-	case BLKRASET: /* set the readahead value, 0x1262 */
-		if (!capable(CAP_SYS_ADMIN)) return -EACCES;
-		if (arg > 0xff) return -EINVAL; /* limit it */
-		read_ahead[MAJOR(inode->i_rdev)] = arg;
-                atomic_eieio();
-		return 0;
-
 	case BLKRRPART: /* re-read partition table: can't do it, 0x1259 */
 		return -EINVAL;
 
-
 #if (XPRAM_VERSION == 22)
 		RO_IOCTLS(inode->i_rdev, arg); /* the default RO operations 
                                                 * BLKROSET
@@ -1042,7 +1025,6 @@
 	q = BLK_DEFAULT_QUEUE (major);
 	blk_init_queue (q, xpram_request);
 #endif /* V22/V24 */
-	read_ahead[major] = xpram_rahead;
 
 	/* we want to have XPRAM_UNUSED blocks security buffer between devices */
 	mem_usable=xpram_mem_avail-(XPRAM_UNUSED*(xpram_devs-1));
@@ -1181,7 +1163,6 @@
 	kfree(xpram_hardsects);
 	hardsect_size[major] = NULL;
  fail_malloc:
-	read_ahead[major] = 0;
 #if (XPRAM_VERSION == 22)
 	blk_dev[major].request_fn = NULL;
 #endif /* V22 */
drivers/s390/char/tapeblock.c +0 -1
diff -urN linux-2.5.4/drivers/s390/char/tapeblock.c linux-2.5.4-readahead/drivers/s390/char/tapeblock.c
@@ -101,7 +101,6 @@
     }
     if (tapeblock_major == 0) tapeblock_major = result;   /* accept dynamic major number*/
     INIT_BLK_DEV(tapeblock_major,tape_request_fn,tapeblock_getqueue,NULL);
-    read_ahead[tapeblock_major]=TAPEBLOCK_READAHEAD;
     PRINT_WARN(KERN_ERR " tape gets major %d for block device\n", result);
     blk_size[tapeblock_major] = (int*) kmalloc (256*sizeof(int),GFP_ATOMIC);
     memset(blk_size[tapeblock_major],0,256*sizeof(int));
drivers/scsi/sd.c +0 -14
diff -urN linux-2.5.4/drivers/scsi/sd.c linux-2.5.4-readahead/drivers/scsi/sd.c
@@ -228,8 +228,6 @@
 		case BLKGETSIZE64:
 		case BLKROSET:
 		case BLKROGET:
-		case BLKRASET:
-		case BLKRAGET:
 		case BLKFLSBUF:
 		case BLKSSZGET:
 		case BLKPG:
@@ -1190,18 +1188,6 @@
 				rscsi_disks[i].has_part_table = 1;
 			}
 		}
-	/* If our host adapter is capable of scatter-gather, then we increase
-	 * the read-ahead to 60 blocks (120 sectors).  If not, we use
-	 * a two block (4 sector) read ahead. We can only respect this with the
-	 * granularity of every 16 disks (one device major).
-	 */
-	for (i = 0; i < N_USED_SD_MAJORS; i++) {
-		read_ahead[SD_MAJOR(i)] =
-		    (rscsi_disks[i * SCSI_DISKS_PER_MAJOR].device
-		     && rscsi_disks[i * SCSI_DISKS_PER_MAJOR].device->host->sg_tablesize)
-		    ? 120	/* 120 sector read-ahead */
-		    : 4;	/* 4 sector read-ahead */
-	}
 
 	return;
 }
drivers/scsi/sr.c +0 -11
diff -urN linux-2.5.4/drivers/scsi/sr.c linux-2.5.4-readahead/drivers/scsi/sr.c
@@ -785,16 +785,6 @@
                                     &sr_bdops, NULL);
 		register_cdrom(&scsi_CDs[i].cdi);
 	}
-
-
-	/* If our host adapter is capable of scatter-gather, then we increase
-	 * the read-ahead to 16 blocks (32 sectors).  If not, we use
-	 * a two block (4 sector) read ahead. */
-	if (scsi_CDs[0].device && scsi_CDs[0].device->host->sg_tablesize)
-		read_ahead[MAJOR_NR] = 32;	/* 32 sector read-ahead.  Always removable. */
-	else
-		read_ahead[MAJOR_NR] = 4;	/* 4 sector read-ahead */
-
 }
 
 static void sr_detach(Scsi_Device * SDp)
@@ -846,7 +836,6 @@
 		kfree(sr_blocksizes);
 		sr_blocksizes = NULL;
 	}
-	read_ahead[MAJOR_NR] = 0;
 	blk_clear(MAJOR_NR);
 
 	sr_template.dev_max = 0;
drivers/scsi/sr_ioctl.c +0 -2
diff -urN linux-2.5.4/drivers/scsi/sr_ioctl.c linux-2.5.4-readahead/drivers/scsi/sr_ioctl.c
@@ -550,8 +550,6 @@
 		return put_user((u64)scsi_CDs[target].capacity << 9, (u64 *)arg);
 	case BLKROSET:
 	case BLKROGET:
-	case BLKRASET:
-	case BLKRAGET:
 	case BLKFLSBUF:
 	case BLKSSZGET:
 		return blk_ioctl(cdi->dev, cmd, arg);
fs/hfs/file.c +2 -11
diff -urN linux-2.5.4/fs/hfs/file.c linux-2.5.4-readahead/fs/hfs/file.c
@@ -163,8 +163,7 @@
 	if (left <= 0) {
 		return 0;
 	}
-	if ((read = hfs_do_read(inode, HFS_I(inode)->fork, pos,
-				buf, left, filp->f_reada != 0)) > 0) {
+	if ((read = hfs_do_read(inode, HFS_I(inode)->fork, pos, buf, left)) > 0) {
 	        *ppos += read;
 		filp->f_reada = 1;
 	}
@@ -288,7 +287,7 @@
  * It has been changed to take into account that HFS files have no holes.
  */
 hfs_s32 hfs_do_read(struct inode *inode, struct hfs_fork * fork, hfs_u32 pos,
-		    char * buf, hfs_u32 count, int reada)
+		    char * buf, hfs_u32 count)
 {
 	kdev_t dev = inode->i_dev;
 	hfs_s32 size, chars, offset, block, blocks, read = 0;
@@ -309,14 +308,6 @@
 	blocks = (count+offset+HFS_SECTOR_SIZE-1) >> HFS_SECTOR_SIZE_BITS;
 
 	bhb = bhe = buflist;
-	if (reada) {
-		if (blocks < read_ahead[major(dev)] / (HFS_SECTOR_SIZE>>9)) {
-			blocks = read_ahead[major(dev)] / (HFS_SECTOR_SIZE>>9);
-		}
-		if (block + blocks > size) {
-			blocks = size - block;
-		}
-	}
 
 	/* We do this in a two stage process.  We first try and
 	   request as many blocks as we can, then we wait for the
include/linux/blkdev.h +0 -5
diff -urN linux-2.5.4/include/linux/blkdev.h linux-2.5.4-readahead/include/linux/blkdev.h
@@ -314,11 +314,8 @@
 extern void generic_unplug_device(void *);
 
 extern int * blk_size[MAX_BLKDEV];
-
 extern int * blksize_size[MAX_BLKDEV];
 
-extern int * max_readahead[MAX_BLKDEV];
-
 #define MAX_PHYS_SEGMENTS 128
 #define MAX_HW_SEGMENTS 128
 #define MAX_SECTORS 255
@@ -340,8 +337,6 @@
 	blk_size_in_bytes[major] = NULL;
 #endif
 	blksize_size[major] = NULL;
-	max_readahead[major] = NULL;
-	read_ahead[major] = 0;
 }
 
 extern inline int get_hardsect_size(kdev_t dev)
include/linux/fs.h +0 -6
diff -urN linux-2.5.4/include/linux/fs.h linux-2.5.4-readahead/include/linux/fs.h
@@ -173,10 +173,6 @@
 #define BLKRRPART  _IO(0x12,95)	/* re-read partition table */
 #define BLKGETSIZE _IO(0x12,96)	/* return device size /512 (long *arg) */
 #define BLKFLSBUF  _IO(0x12,97)	/* flush buffer cache */
-#define BLKRASET   _IO(0x12,98)	/* Set read ahead for block device */
-#define BLKRAGET   _IO(0x12,99)	/* get current read ahead setting */
-#define BLKFRASET  _IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
-#define BLKFRAGET  _IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */
 #define BLKSECTSET _IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */
 #define BLKSECTGET _IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
 #define BLKSSZGET  _IO(0x12,104)/* get block device sector size */
@@ -1490,8 +1486,6 @@
 
 extern ssize_t char_read(struct file *, char *, size_t, loff_t *);
 extern ssize_t block_read(struct file *, char *, size_t, loff_t *);
-extern int read_ahead[];
-
 extern ssize_t char_write(struct file *, const char *, size_t, loff_t *);
 extern ssize_t block_write(struct file *, const char *, size_t, loff_t *);
 
kernel/ksyms.c +0 -2
diff -urN linux-2.5.4/kernel/ksyms.c linux-2.5.4-readahead/kernel/ksyms.c
@@ -321,7 +321,6 @@
 EXPORT_SYMBOL(tq_disk);
 EXPORT_SYMBOL(init_buffer);
 EXPORT_SYMBOL(refile_buffer);
-EXPORT_SYMBOL(max_readahead);
 EXPORT_SYMBOL(wipe_partitions);
 
 /* tty routines */
@@ -521,7 +520,6 @@
 EXPORT_SYMBOL(clear_inode);
 EXPORT_SYMBOL(___strtok);
 EXPORT_SYMBOL(init_special_inode);
-EXPORT_SYMBOL(read_ahead);
 EXPORT_SYMBOL(__get_hash_table);
 EXPORT_SYMBOL(new_inode);
 EXPORT_SYMBOL(insert_inode_hash);
mm/filemap.c +3 -10
diff -urN linux-2.5.4/mm/filemap.c linux-2.5.4-readahead/mm/filemap.c
@@ -1131,13 +1131,6 @@
  *   64k if defined (4K page size assumed).
  */
 
-static inline int get_max_readahead(struct inode * inode)
-{
-	if (kdev_none(inode->i_dev) || !max_readahead[major(inode->i_dev)])
-		return MAX_READAHEAD;
-	return max_readahead[major(inode->i_dev)][minor(inode->i_dev)];
-}
-
 static void generic_file_readahead(int reada_ok,
 	struct file * filp, struct inode * inode,
 	struct page * page)
@@ -1146,7 +1139,7 @@
 	unsigned long index = page->index;
 	unsigned long max_ahead, ahead;
 	unsigned long raend;
-	int max_readahead = get_max_readahead(inode);
+	int max_readahead = MAX_READAHEAD;
 
 	end_index = inode->i_size >> PAGE_CACHE_SHIFT;
 
@@ -1278,7 +1271,7 @@
 	struct page *cached_page;
 	int reada_ok;
 	int error;
-	int max_readahead = get_max_readahead(inode);
+	int max_readahead = MAX_READAHEAD;
 
 	cached_page = NULL;
 	index = *ppos >> PAGE_CACHE_SHIFT;
@@ -1808,7 +1801,7 @@
 {
 	unsigned long ra_window;
 
-	ra_window = get_max_readahead(vma->vm_file->f_dentry->d_inode);
+	ra_window = MAX_READAHEAD;
 	ra_window = CLUSTER_OFFSET(ra_window + CLUSTER_PAGES - 1);
 
 	/* vm_raend is zero if we haven't read ahead in this area yet.  */
#11 lore raw
In reply to Pavel Machek
Quoted 5 lines · Vojtech Pavlik
Quoted 3 lines · Martin Dalecki

So the conclusions is that not just the read_ahead array is bogous now. The max_readahead array can be killed entierly from the kernel as well ;-).

Quoted 8 lines
Quoted 3 lines

The answer is: I'm now confident that you can just remove all the max_readahead initialization from the ide code.

Since I've come to the same conclusion, here is the patch. It removes read_ahead, max_readahead, BLKRAGET, BLKRASET, BLKFRAGET and BLKFRASET completely.

Welcome the the "Write Only Variable" haters club ;-).

Please note that the lvm code is playing mental with himself on the lv_read_ahead struct member as well. This member get's set saved preserved, but it's never used nowhere there:

./include/linux/lvm.h: uint lv_read_ahead; ./include/linux/lvm.h: uint32_t lv_read_ahead; /* HM */

drivers/block/ll_rw_blk.c line 59

Quoted 10 lines

diff -urN linux-2.5.4/drivers/block/ll_rw_blk.c linux-2.5.4-readahead/drivers/block/ll_rw_blk.c

drivers/block/ll_rw_blk.c +0 -2
@@ -56,8 +56,6 @@
 
 /* This specifies how many sectors to read ahead on the disk. */
 
-int read_ahead[MAX_BLKDEV];
-
 

You did miss the comment by shooting above!

Quoted 15 lines

diff -urN linux-2.5.4/include/linux/fs.h linux-2.5.4-readahead/include/linux/fs.h

include/linux/fs.h +0 -4
@@ -173,10 +173,6 @@
 #define BLKRRPART  _IO(0x12,95)	/* re-read partition table */
 #define BLKGETSIZE _IO(0x12,96)	/* return device size /512 (long *arg) */
 #define BLKFLSBUF  _IO(0x12,97)	/* flush buffer cache */
-#define BLKRASET   _IO(0x12,98)	/* Set read ahead for block device */
-#define BLKRAGET   _IO(0x12,99)	/* get current read ahead setting */
-#define BLKFRASET  _IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
-#define BLKFRAGET  _IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */
 #define BLKSECTSET _IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */
 #define BLKSECTGET _IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
 #define BLKSSZGET  _IO(0x12,104)/* get block device sector size */

include/linux/fs.h line 1486

Quoted 1 line
include/linux/fs.h +0 -0
@@ -1490,8 +1486,6 @@
 

I would rather suggest to to #if 0 ... #endif instead with a note about those values beeing no longer used.

Quoted 18 lines

diff -urN linux-2.5.4/mm/filemap.c linux-2.5.4-readahead/mm/filemap.c

mm/filemap.c +0 -7
@@ -1131,13 +1131,6 @@
 *   64k if defined (4K page size assumed).
 */
 
-static inline int get_max_readahead(struct inode * inode)
-{
-	if (kdev_none(inode->i_dev) || !max_readahead[major(inode->i_dev)])
-		return MAX_READAHEAD;
-	return max_readahead[major(inode->i_dev)][minor(inode->i_dev)];
-}
-
 static void generic_file_readahead(int reada_ok,
 	struct file * filp, struct inode * inode,
 	struct page * page)

mm/filemap.c line 1143

Quoted 6 lines
mm/filemap.c +1 -1
@@ -1146,7 +1139,7 @@
 	unsigned long index = page->index;
 	unsigned long max_ahead, ahead;
 	unsigned long raend;
-	int max_readahead = get_max_readahead(inode);
+	int max_readahead = MAX_READAHEAD;
 

This wonders me a bit, why you didn't just propagate the constant deeper.

#12 lore raw
In reply to Pavel Machek
Quoted 8 lines · Martin Dalecki

Welcome the the "Write Only Variable" haters club ;-).

Please note that the lvm code is playing mental with himself on the lv_read_ahead struct member as well.
This member get's set saved preserved, but it's never used nowhere there:

./include/linux/lvm.h: uint lv_read_ahead; ./include/linux/lvm.h: uint32_t lv_read_ahead; /* HM */

The later (lv_disk_t) struct isn't used anywhere in the kernel - probably defined for userspace only? That's weird! And also many other structs in lvm.h are nowhere to be found used. Guess we could swipe them out as well.

The first lv_read_ahead (in lv_t) removed. And references to it as well.

Quoted 7 lines

Review

Quoted 5 lines

/* This specifies how many sectors to read ahead on the disk. */

(quoted diff) +0 -2
-int read_ahead[MAX_BLKDEV];
-

You did miss the comment by shooting above!

Second shot right on target!

Quoted 10 lines

include/linux/fs.h

Quoted 7 lines

diff -urN linux-2.5.4/include/linux/fs.h linux-2.5.4-readahead/include/linux/fs.h

include/linux/fs.h +0 -4
-#define BLKRASET   _IO(0x12,98)	/* Set read ahead for block device */
-#define BLKRAGET   _IO(0x12,99)	/* get current read ahead setting */
-#define BLKFRASET  _IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
-#define BLKFRAGET  _IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */

I would rather suggest to to #if 0 ... #endif instead with a note about those values beeing no longer used.

Ok, makes sense.

Quoted 5 lines

include/linux/fs.h

Quoted 3 lines
include/linux/fs.h +1 -1
-	int max_readahead = get_max_readahead(inode);
+	int max_readahead = MAX_READAHEAD;

This wonders me a bit, why you didn't just propagate the constant deeper.

I was too hasty probably. Done now.

Patch v3 attached.

Signature · 2 lines
Vojtech Pavlik
SuSE Labs
Documentation/cdrom/sbpcd +2 -8
diff -urN linux-2.5.4/Documentation/cdrom/sbpcd linux-2.5.4-readahead/Documentation/cdrom/sbpcd
@@ -613,8 +613,8 @@
 	printf("READ          d      READ RAW     w       READ AUDIO   A\n");
 	printf("MS-INFO       M      TOC          T       START        S\n");
 	printf("SET EJECTSW   X      DEVICE       D       DEBUG        Y\n");
-	printf("AUDIO_BUFSIZ  Z      RESET        R       BLKRASET     B\n");
-	printf("SET VOLUME    v      GET VOLUME   V\n");
+	printf("AUDIO_BUFSIZ  Z      RESET        R       SET VOLUME   v\n");
+	printf("GET VOLUME    V\n");
 }
 
 /*
@@ -881,12 +881,6 @@
 		case 'R':
 			rc=ioctl(drive,CDROMRESET);
 			if (rc<0) printf("CDROMRESET: rc=%d.\n",rc);
-			break;
-		case 'B': /* set the driver's (?) read ahead value */
-			printf("enter read-ahead size: ? ");
-			scanf("%d",&i);
-			rc=ioctl(drive,BLKRASET,i);
-			if (rc<0) printf("BLKRASET: rc=%d.\n",rc);
 			break;
 #ifdef AZT_PRIVATE_IOCTLS /*not supported by every CDROM driver*/
 		case 'd':
arch/mips64/kernel/ioctl32.c +0 -4
diff -urN linux-2.5.4/arch/mips64/kernel/ioctl32.c linux-2.5.4-readahead/arch/mips64/kernel/ioctl32.c
@@ -760,10 +760,6 @@
 	IOCTL32_HANDLER(BLKGETSIZE, w_long),
 
 	IOCTL32_DEFAULT(BLKFLSBUF),
-	IOCTL32_DEFAULT(BLKRASET),
-	IOCTL32_HANDLER(BLKRAGET, w_long),
-	IOCTL32_DEFAULT(BLKFRASET),
-	IOCTL32_HANDLER(BLKFRAGET, w_long),
 	IOCTL32_DEFAULT(BLKSECTSET),
 	IOCTL32_HANDLER(BLKSECTGET, w_long),
 	IOCTL32_DEFAULT(BLKSSZGET),
arch/sparc64/kernel/ioctl32.c +0 -4
diff -urN linux-2.5.4/arch/sparc64/kernel/ioctl32.c linux-2.5.4-readahead/arch/sparc64/kernel/ioctl32.c
@@ -3997,8 +3997,6 @@
 COMPATIBLE_IOCTL(BLKROGET)
 COMPATIBLE_IOCTL(BLKRRPART)
 COMPATIBLE_IOCTL(BLKFLSBUF)
-COMPATIBLE_IOCTL(BLKRASET)
-COMPATIBLE_IOCTL(BLKFRASET)
 COMPATIBLE_IOCTL(BLKSECTSET)
 COMPATIBLE_IOCTL(BLKSSZGET)
 COMPATIBLE_IOCTL(BLKBSZGET)
@@ -4626,10 +4624,8 @@
 HANDLE_IOCTL(SIOCRTMSG, ret_einval)
 HANDLE_IOCTL(SIOCGSTAMP, do_siocgstamp)
 HANDLE_IOCTL(HDIO_GETGEO, hdio_getgeo)
-HANDLE_IOCTL(BLKRAGET, w_long)
 HANDLE_IOCTL(BLKGETSIZE, w_long)
 HANDLE_IOCTL(0x1260, broken_blkgetsize)
-HANDLE_IOCTL(BLKFRAGET, w_long)
 HANDLE_IOCTL(BLKSECTGET, w_long)
 HANDLE_IOCTL(BLKPG, blkpg_ioctl_trans)
 HANDLE_IOCTL(FBIOPUTCMAP32, fbiogetputcmap)
drivers/acorn/block/mfmhd.c +0 -12
diff -urN linux-2.5.4/drivers/acorn/block/mfmhd.c linux-2.5.4-readahead/drivers/acorn/block/mfmhd.c
@@ -1208,15 +1208,6 @@
 			return -EFAULT;
 		return 0;
 
-	case BLKFRASET:
-		if (!capable(CAP_SYS_ADMIN))
-			return -EACCES;
-		max_readahead[major][minor] = arg;
-		return 0;
-
-	case BLKFRAGET:
-		return put_user(max_readahead[major][minor], (long *) arg);
-
 	case BLKSECTGET:
 		return put_user(max_sectors[major][minor], (long *) arg);
 
@@ -1230,8 +1221,6 @@
 	case BLKFLSBUF:
 	case BLKROSET:
 	case BLKROGET:
-	case BLKRASET:
-	case BLKRAGET:
 	case BLKPG:
 		return blk_ioctl(dev, cmd, arg);
 
@@ -1442,7 +1431,6 @@
 	hdc63463_irqpollmask	= irqmask;
 
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST);
-	read_ahead[MAJOR_NR] = 8;	/* 8 sector (4kB?) read ahread */
 
 	add_gendisk(&mfm_gendisk);
 
drivers/block/DAC960.c +0 -6
diff -urN linux-2.5.4/drivers/block/DAC960.c linux-2.5.4-readahead/drivers/block/DAC960.c
@@ -1964,10 +1964,6 @@
   Controller->GenericDiskInfo.sizes = Controller->PartitionSizes;
   blksize_size[MajorNumber] = Controller->BlockSizes;
   /*
-    Initialize Read Ahead to 128 sectors.
-  */
-  read_ahead[MajorNumber] = 128;
-  /*
     Complete initialization of the Generic Disk Information structure.
   */
   Controller->GenericDiskInfo.major = MajorNumber;
@@ -5399,8 +5395,6 @@
 			   sizeof(DiskGeometry_T)) ? -EFAULT : 0);
     case BLKGETSIZE:
     case BLKGETSIZE64:
-    case BLKRAGET:
-    case BLKRASET:
     case BLKFLSBUF:
     case BLKBSZGET:
     case BLKBSZSET:
drivers/block/acsi.c +0 -1
diff -urN linux-2.5.4/drivers/block/acsi.c linux-2.5.4-readahead/drivers/block/acsi.c
@@ -1785,7 +1785,6 @@
 	STramMask = ATARIHW_PRESENT(EXTD_DMA) ? 0x00000000 : 0xff000000;
 	
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &acsi_lock);
-	read_ahead[MAJOR_NR] = 8;		/* 8 sector (4kB) read-ahead */
 	add_gendisk(&acsi_gendisk);
 
 #ifdef CONFIG_ATARI_SLM
drivers/block/ataflop.c +0 -2
diff -urN linux-2.5.4/drivers/block/ataflop.c linux-2.5.4-readahead/drivers/block/ataflop.c
@@ -1573,8 +1573,6 @@
 	switch (cmd) {
 		case BLKROSET:
 		case BLKROGET:
-		case BLKRASET:
-		case BLKRAGET:
 		case BLKFLSBUF:
 			return blk_ioctl(device, cmd, param);
 	}
drivers/block/blkpg.c +1 -26
diff -urN linux-2.5.4/drivers/block/blkpg.c linux-2.5.4-readahead/drivers/block/blkpg.c
@@ -29,7 +29,7 @@
  */
 
 #include <linux/errno.h>
-#include <linux/fs.h>			/* for BLKRASET, ... */
+#include <linux/fs.h>			/* for BLKROSET, ... */
 #include <linux/sched.h>		/* for capable() */
 #include <linux/blk.h>			/* for set_device_ro() */
 #include <linux/blkpg.h>
@@ -226,31 +226,6 @@
 		case BLKROGET:
 			intval = (is_read_only(dev) != 0);
 			return put_user(intval, (int *)(arg));
-
-		case BLKRASET:
-			if(!capable(CAP_SYS_ADMIN))
-				return -EACCES;
-			if(arg > 0xff)
-				return -EINVAL;
-			read_ahead[major(dev)] = arg;
-			return 0;
-		case BLKRAGET:
-			if (!arg)
-				return -EINVAL;
-			return put_user(read_ahead[major(dev)], (long *) arg);
-
-		case BLKFRASET:
-			if (!capable(CAP_SYS_ADMIN))
-				return -EACCES;
-			if (!(iptr = max_readahead[major(dev)]))
-				return -EINVAL;
-			iptr[minor(dev)] = arg;
-			return 0;
-
-		case BLKFRAGET:
-			if (!(iptr = max_readahead[major(dev)]))
-				return -EINVAL;
-			return put_user(iptr[minor(dev)], (long *) arg);
 
 		case BLKSECTGET:
 			if ((q = blk_get_queue(dev)) == NULL)
drivers/block/cciss.c +0 -3
diff -urN linux-2.5.4/drivers/block/cciss.c linux-2.5.4-readahead/drivers/block/cciss.c
@@ -471,8 +471,6 @@
 	case BLKBSZGET:
 	case BLKROSET:
 	case BLKROGET:
-	case BLKRASET:
-	case BLKRAGET:
 	case BLKPG:
 		return blk_ioctl(inode->i_rdev, cmd, arg);
 	case CCISS_GETPCIINFO:
@@ -2542,7 +2540,6 @@
 
 	/* fill in the other Kernel structs */
 	blksize_size[MAJOR_NR+i] = hba[i]->blocksizes;
-        read_ahead[MAJOR_NR+i] = READ_AHEAD;
 
 	/* Fill in the gendisk data */ 	
 	hba[i]->gendisk.major = MAJOR_NR + i;
drivers/block/cpqarray.c +0 -3
diff -urN linux-2.5.4/drivers/block/cpqarray.c linux-2.5.4-readahead/drivers/block/cpqarray.c
@@ -481,7 +481,6 @@
 		blk_queue_max_phys_segments(q, SG_MAX);
 
 		blksize_size[MAJOR_NR+i] = ida_blocksizes + (i*256);
-		read_ahead[MAJOR_NR+i] = READ_AHEAD;
 
 		ida_gendisk[i].major = MAJOR_NR + i;
 		ida_gendisk[i].major_name = "ida";
@@ -1181,8 +1180,6 @@
 	case BLKBSZGET:
 	case BLKROSET:
 	case BLKROGET:
-	case BLKRASET:
-	case BLKRAGET:
 	case BLKPG:
 		return blk_ioctl(inode->i_rdev, cmd, arg);
 
drivers/block/floppy.c +0 -2
diff -urN linux-2.5.4/drivers/block/floppy.c linux-2.5.4-readahead/drivers/block/floppy.c
@@ -3448,8 +3448,6 @@
 	switch (cmd) {
 		case BLKROSET:
 		case BLKROGET:
-		case BLKRASET:
-		case BLKRAGET:
 		case BLKFLSBUF:
 			return blk_ioctl(device, cmd, param);
 	}
drivers/block/ll_rw_blk.c +0 -10
diff -urN linux-2.5.4/drivers/block/ll_rw_blk.c linux-2.5.4-readahead/drivers/block/ll_rw_blk.c
@@ -54,10 +54,6 @@
  */
 DECLARE_TASK_QUEUE(tq_disk);
 
-/* This specifies how many sectors to read ahead on the disk. */
-
-int read_ahead[MAX_BLKDEV];
-
 /* blk_dev_struct is:
  *	request_queue
  *	*queue
@@ -84,11 +80,6 @@
 int * blksize_size[MAX_BLKDEV];
 
 /*
- * The following tunes the read-ahead algorithm in mm/filemap.c
- */
-int * max_readahead[MAX_BLKDEV];
-
-/*
  * How many reqeusts do we allocate per queue,
  * and how many do we "batch" on freeing them?
  */
@@ -1689,7 +1680,6 @@
 		dev->queue = NULL;
 
 	memset(ro_bits,0,sizeof(ro_bits));
-	memset(max_readahead, 0, sizeof(max_readahead));
 
 	total_ram = nr_free_pages() << (PAGE_SHIFT - 10);
 
drivers/block/paride/pcd.c +0 -1
diff -urN linux-2.5.4/drivers/block/paride/pcd.c linux-2.5.4-readahead/drivers/block/paride/pcd.c
@@ -358,7 +358,6 @@
 	}
 
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &pcd_lock);
-	read_ahead[MAJOR_NR] = 8;	/* 8 sector (4kB) read ahead */
 
 	for (i=0;i<PCD_UNITS;i++) pcd_blocksizes[i] = 1024;
         blksize_size[MAJOR_NR] = pcd_blocksizes;
drivers/block/paride/pd.c +0 -3
diff -urN linux-2.5.4/drivers/block/paride/pd.c linux-2.5.4-readahead/drivers/block/paride/pd.c
@@ -397,7 +397,6 @@
 	q = BLK_DEFAULT_QUEUE(MAJOR_NR);
 	blk_init_queue(q, DEVICE_REQUEST, &pd_lock);
 	blk_queue_max_sectors(q, cluster);
-        read_ahead[MAJOR_NR] = 8;       /* 8 sector (4kB) read ahead */
         
 	pd_gendisk.major = major;
 	pd_gendisk.major_name = name;
@@ -480,8 +479,6 @@
 	    case BLKGETSIZE64:
 	    case BLKROSET:
 	    case BLKROGET:
-	    case BLKRASET:
-	    case BLKRAGET:
 	    case BLKFLSBUF:
 	    case BLKPG:
 		return blk_ioctl(inode->i_rdev, cmd, arg);
drivers/block/paride/pf.c +0 -3
diff -urN linux-2.5.4/drivers/block/paride/pf.c linux-2.5.4-readahead/drivers/block/paride/pf.c
@@ -363,7 +363,6 @@
 	blk_init_queue(q, DEVICE_REQUEST, &pf_spin_lock);
 	blk_queue_max_phys_segments(q, cluster);
 	blk_queue_max_hw_segments(q, cluster);
-        read_ahead[MAJOR_NR] = 8;       /* 8 sector (4kB) read ahead */
         
 	for (i=0;i<PF_UNITS;i++) pf_blocksizes[i] = 1024;
 	blksize_size[MAJOR_NR] = pf_blocksizes;
@@ -433,8 +432,6 @@
                 return put_user((u64)PF.capacity << 9,(u64 *)arg);
 	    case BLKROSET:
 	    case BLKROGET:
-	    case BLKRASET:
-	    case BLKRAGET:
 	    case BLKFLSBUF:
 		return blk_ioctl(inode->i_rdev, cmd, arg);
             default:
drivers/block/ps2esdi.c +0 -3
diff -urN linux-2.5.4/drivers/block/ps2esdi.c linux-2.5.4-readahead/drivers/block/ps2esdi.c
@@ -177,7 +177,6 @@
 	}
 	/* set up some global information - indicating device specific info */
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &ps2esdi_lock);
-	read_ahead[MAJOR_NR] = 8;	/* 8 sector (4kB) read ahead */
 
 	/* some minor housekeeping - setup the global gendisk structure */
 	add_gendisk(&ps2esdi_gendisk);
@@ -1108,8 +1107,6 @@
 		case BLKGETSIZE64:
 		case BLKROSET:
 		case BLKROGET:
-		case BLKRASET:
-		case BLKRAGET:
 		case BLKFLSBUF:
 		case BLKBSZGET:
 		case BLKBSZSET:
drivers/block/xd.c +0 -3
diff -urN linux-2.5.4/drivers/block/xd.c linux-2.5.4-readahead/drivers/block/xd.c
@@ -171,7 +171,6 @@
 	}
 	devfs_handle = devfs_mk_dir (NULL, xd_gendisk.major_name, NULL);
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &xd_lock);
-	read_ahead[MAJOR_NR] = 8;	/* 8 sector (4kB) read ahead */
 	add_gendisk(&xd_gendisk);
 	xd_geninit();
 
@@ -355,8 +354,6 @@
 		case BLKFLSBUF:
 		case BLKROSET:
 		case BLKROGET:
-		case BLKRASET:
-		case BLKRAGET:
 		case BLKPG:
 			return blk_ioctl(inode->i_rdev, cmd, arg);
 
drivers/cdrom/aztcd.c +0 -1
diff -urN linux-2.5.4/drivers/cdrom/aztcd.c linux-2.5.4-readahead/drivers/cdrom/aztcd.c
@@ -1927,7 +1927,6 @@
 	}
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &aztSpin);
 	blksize_size[MAJOR_NR] = aztcd_blocksizes;
-	read_ahead[MAJOR_NR] = 4;
 	register_disk(NULL, mk_kdev(MAJOR_NR, 0), 1, &azt_fops, 0);
 
 	if ((azt_port == 0x1f0) || (azt_port == 0x170))
drivers/cdrom/cdu31a.c +0 -1
diff -urN linux-2.5.4/drivers/cdrom/cdu31a.c linux-2.5.4-readahead/drivers/cdrom/cdu31a.c
@@ -3442,7 +3442,6 @@
 		blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR),
 			       DEVICE_REQUEST,
 			       &cdu31a_lock);
-		read_ahead[MAJOR_NR] = CDU31A_READAHEAD;
 		cdu31a_block_size = 1024;	/* 1kB default block size */
 		/* use 'mount -o block=2048' */
 		blksize_size[MAJOR_NR] = &cdu31a_block_size;
drivers/cdrom/cm206.c +0 -1
diff -urN linux-2.5.4/drivers/cdrom/cm206.c linux-2.5.4-readahead/drivers/cdrom/cm206.c
@@ -1503,7 +1503,6 @@
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST,
 		       &cm206_lock);
 	blksize_size[MAJOR_NR] = cm206_blocksizes;
-	read_ahead[MAJOR_NR] = 16;	/* reads ahead what? */
 	init_bh(CM206_BH, cm206_bh);
 
 	memset(cd, 0, sizeof(*cd));	/* give'm some reasonable value */
drivers/cdrom/gscd.c +0 -1
diff -urN linux-2.5.4/drivers/cdrom/gscd.c linux-2.5.4-readahead/drivers/cdrom/gscd.c
@@ -1022,7 +1022,6 @@
 
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &gscd_lock);
 	blksize_size[MAJOR_NR] = gscd_blocksizes;
-	read_ahead[MAJOR_NR] = 4;
 
 	disk_state = 0;
 	gscdPresent = 1;
drivers/cdrom/mcd.c +0 -1
diff -urN linux-2.5.4/drivers/cdrom/mcd.c linux-2.5.4-readahead/drivers/cdrom/mcd.c
@@ -1075,7 +1075,6 @@
 	blksize_size[MAJOR_NR] = mcd_blocksizes;
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST,
 		       &mcd_spinlock);
-	read_ahead[MAJOR_NR] = 4;
 
 	/* check for card */
 
drivers/cdrom/mcdx.c +0 -1
diff -urN linux-2.5.4/drivers/cdrom/mcdx.c linux-2.5.4-readahead/drivers/cdrom/mcdx.c
@@ -1184,7 +1184,6 @@
 
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST,
 		       &mcdx_lock);
-	read_ahead[MAJOR_NR] = READ_AHEAD;
 	blksize_size[MAJOR_NR] = mcdx_blocksizes;
 
 	xtrace(INIT, "init() subscribe irq and i/o\n");
drivers/cdrom/optcd.c +0 -1
diff -urN linux-2.5.4/drivers/cdrom/optcd.c linux-2.5.4-readahead/drivers/cdrom/optcd.c
@@ -2062,7 +2062,6 @@
 	blksize_size[MAJOR_NR] = &blksize;
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST,
 		       &optcd_lock);
-	read_ahead[MAJOR_NR] = 4;
 	request_region(optcd_port, 4, "optcd");
 	register_disk(NULL, mk_kdev(MAJOR_NR,0), 1, &opt_fops, 0);
 
drivers/cdrom/sbpcd.c +0 -6
diff -urN linux-2.5.4/drivers/cdrom/sbpcd.c linux-2.5.4-readahead/drivers/cdrom/sbpcd.c
@@ -4531,12 +4531,6 @@
 		RETURN_UP(0);
 	} /* end of CDROMREADAUDIO */
 		
-	case BLKRASET:
-		if(!capable(CAP_SYS_ADMIN)) RETURN_UP(-EACCES);
-		if(kdev_none(cdi->dev)) RETURN_UP(-EINVAL);
-		if(arg > 0xff) RETURN_UP(-EINVAL);
-		read_ahead[major(cdi->dev)] = arg;
-		RETURN_UP(0);
 	default:
 		msg(DBG_IOC,"ioctl: unknown function request %04X\n", cmd);
 		RETURN_UP(-EINVAL);
drivers/cdrom/sjcd.c +0 -1
diff -urN linux-2.5.4/drivers/cdrom/sjcd.c linux-2.5.4-readahead/drivers/cdrom/sjcd.c
@@ -1695,7 +1695,6 @@
 	}
 
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST,&sjcd_lock);
-	read_ahead[MAJOR_NR] = 4;
 	register_disk(NULL, mk_kdev(MAJOR_NR, 0), 1, &sjcd_fops, 0);
 
 	if (check_region(sjcd_base, 4)) {
drivers/cdrom/sonycd535.c +0 -1
diff -urN linux-2.5.4/drivers/cdrom/sonycd535.c linux-2.5.4-readahead/drivers/cdrom/sonycd535.c
@@ -1598,7 +1598,6 @@
 				}
 				blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &sonycd535_lock);
 				blksize_size[MAJOR_NR] = &sonycd535_block_size;
-				read_ahead[MAJOR_NR] = 8;	/* 8 sector (4kB) read-ahead */
 
 				sony_toc = (struct s535_sony_toc *)
 					kmalloc(sizeof *sony_toc, GFP_KERNEL);
drivers/ide/ataraid.c +0 -1
diff -urN linux-2.5.4/drivers/ide/ataraid.c linux-2.5.4-readahead/drivers/ide/ataraid.c
@@ -289,7 +289,6 @@
 	hardsect_size[ATAMAJOR] = NULL;
 	blk_size[ATAMAJOR] = NULL;
 	blksize_size[ATAMAJOR] = NULL;                       
-	max_readahead[ATAMAJOR] = NULL;
 
 	del_gendisk(&ataraid_gendisk);
         
drivers/ide/hd.c +0 -3
diff -urN linux-2.5.4/drivers/ide/hd.c linux-2.5.4-readahead/drivers/ide/hd.c
@@ -652,8 +652,6 @@
 		case BLKGETSIZE64:
 		case BLKROSET:
 		case BLKROGET:
-		case BLKRASET:
-		case BLKRAGET:
 		case BLKFLSBUF:
 		case BLKPG:
 			return blk_ioctl(inode->i_rdev, cmd, arg);
@@ -837,7 +835,6 @@
 	}
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &hd_lock);
 	blk_queue_max_sectors(BLK_DEFAULT_QUEUE(MAJOR_NR), 255);
-	read_ahead[MAJOR_NR] = 8;		/* 8 sector (4kB) read-ahead */
 	add_gendisk(&hd_gendisk);
 	init_timer(&device_timer);
 	device_timer.function = hd_times_out;
drivers/ide/ide-cd.c +0 -5
diff -urN linux-2.5.4/drivers/ide/ide-cd.c linux-2.5.4-readahead/drivers/ide/ide-cd.c
@@ -2659,11 +2659,6 @@
 
 static void ide_cdrom_add_settings(ide_drive_t *drive)
 {
-	int major = HWIF(drive)->major;
-	int minor = drive->select.b.unit << PARTN_BITS;
-
-	ide_add_setting(drive,	"breada_readahead",	SETTING_RW, BLKRAGET, BLKRASET, TYPE_INT, 0, 255, 1, 2, &read_ahead[major], NULL);
-	ide_add_setting(drive,	"file_readahead",	SETTING_RW, BLKFRAGET, BLKFRASET, TYPE_INTA, 0, INT_MAX, 1, 1024, &max_readahead[major][minor],	NULL);
 	ide_add_setting(drive,	"dsc_overlap",		SETTING_RW, -1, -1, TYPE_BYTE, 0, 1, 1,	1, &drive->dsc_overlap, NULL);
 }
 
drivers/ide/ide-disk.c +0 -2
diff -urN linux-2.5.4/drivers/ide/ide-disk.c linux-2.5.4-readahead/drivers/ide/ide-disk.c
@@ -916,8 +916,6 @@
 	ide_add_setting(drive,	"bswap",		SETTING_READ,					-1,			-1,			TYPE_BYTE,	0,	1,				1,	1,	&drive->bswap,			NULL);
 	ide_add_setting(drive,	"multcount",		id ? SETTING_RW : SETTING_READ,			HDIO_GET_MULTCOUNT,	HDIO_SET_MULTCOUNT,	TYPE_BYTE,	0,	id ? id->max_multsect : 0,	1,	1,	&drive->mult_count,		set_multcount);
 	ide_add_setting(drive,	"nowerr",		SETTING_RW,					HDIO_GET_NOWERR,	HDIO_SET_NOWERR,	TYPE_BYTE,	0,	1,				1,	1,	&drive->nowerr,			set_nowerr);
-	ide_add_setting(drive,	"breada_readahead",	SETTING_RW,					BLKRAGET,		BLKRASET,		TYPE_INT,	0,	255,				1,	1,	&read_ahead[major],		NULL);
-	ide_add_setting(drive,	"file_readahead",	SETTING_RW,					BLKFRAGET,		BLKFRASET,		TYPE_INTA,	0,	4096,			PAGE_SIZE,	1024,	&max_readahead[major][minor],	NULL);
 	ide_add_setting(drive,	"lun",			SETTING_RW,					-1,			-1,			TYPE_INT,	0,	7,				1,	1,	&drive->lun,			NULL);
 	ide_add_setting(drive,	"wcache",		SETTING_RW,					HDIO_GET_WCACHE,	HDIO_SET_WCACHE,	TYPE_BYTE,	0,	1,				1,	1,	&drive->wcache,			write_cache);
 	ide_add_setting(drive,	"acoustic",		SETTING_RW,					HDIO_GET_ACOUSTIC,	HDIO_SET_ACOUSTIC,	TYPE_BYTE,	0,	254,				1,	1,	&drive->acoustic,		set_acoustic);
drivers/ide/ide-floppy.c +0 -2
diff -urN linux-2.5.4/drivers/ide/ide-floppy.c linux-2.5.4-readahead/drivers/ide/ide-floppy.c
@@ -1968,8 +1968,6 @@
 	ide_add_setting(drive,	"bios_cyl",		SETTING_RW,					-1,			-1,			TYPE_INT,	0,	1023,				1,	1,	&drive->bios_cyl,		NULL);
 	ide_add_setting(drive,	"bios_head",		SETTING_RW,					-1,			-1,			TYPE_BYTE,	0,	255,				1,	1,	&drive->bios_head,		NULL);
 	ide_add_setting(drive,	"bios_sect",		SETTING_RW,					-1,			-1,			TYPE_BYTE,	0,	63,				1,	1,	&drive->bios_sect,		NULL);
-	ide_add_setting(drive,	"breada_readahead",	SETTING_RW,					BLKRAGET,		BLKRASET,		TYPE_INT,	0,	255,				1,	2,	&read_ahead[major],		NULL);
-	ide_add_setting(drive,	"file_readahead",	SETTING_RW,					BLKFRAGET,		BLKFRASET,		TYPE_INTA,	0,	INT_MAX,			1,	1024,	&max_readahead[major][minor],	NULL);
 
 }
 
drivers/ide/ide-probe.c +9 -20
diff -urN linux-2.5.4/drivers/ide/ide-probe.c linux-2.5.4-readahead/drivers/ide/ide-probe.c
@@ -802,35 +802,27 @@
 	}
 #endif
 
-	minors    = units * (1<<PARTN_BITS);
-	gd        = kmalloc (sizeof(struct gendisk), GFP_KERNEL);
+	minors = units * (1<<PARTN_BITS);
+
+	gd = kmalloc (sizeof(struct gendisk), GFP_KERNEL);
 	if (!gd)
 		goto err_kmalloc_gd;
 	gd->sizes = kmalloc (minors * sizeof(int), GFP_KERNEL);
 	if (!gd->sizes)
 		goto err_kmalloc_gd_sizes;
-	gd->part  = kmalloc (minors * sizeof(struct hd_struct), GFP_KERNEL);
+	gd->part = kmalloc (minors * sizeof(struct hd_struct), GFP_KERNEL);
 	if (!gd->part)
 		goto err_kmalloc_gd_part;
-	bs        = kmalloc (minors*sizeof(int), GFP_KERNEL);
-	if (!bs)
+	blksize_size[hwif->major] = kmalloc (minors*sizeof(int), GFP_KERNEL);
+	if (!blksize_size[hwif->major])
 		goto err_kmalloc_bs;
-	max_ra    = kmalloc (minors*sizeof(int), GFP_KERNEL);
-	if (!max_ra)
-		goto err_kmalloc_max_ra;
 
 	memset(gd->part, 0, minors * sizeof(struct hd_struct));
 
-	/* cdroms and msdos f/s are examples of non-1024 blocksizes */
-	blksize_size[hwif->major] = bs;
-	max_readahead[hwif->major] = max_ra;
-	for (unit = 0; unit < minors; ++unit) {
-		*bs++ = BLOCK_SIZE;
-		*max_ra++ = MAX_READAHEAD;
-	}
-
-	for (unit = 0; unit < units; ++unit)
+	for (unit = 0; unit < minors; unit++) {
+		blksize_size[hwif->major][unit] = BLOCK_SIZE;
 		hwif->drives[unit].part = &gd->part[unit << PARTN_BITS];
+	}
 
 	gd->major	= hwif->major;		/* our major device number */
 	gd->major_name	= IDE_MAJOR_NAME;	/* treated special in genhd.c */
@@ -875,8 +867,6 @@
 	}
 	return;
 
-err_kmalloc_max_ra:
-	kfree(bs);
 err_kmalloc_bs:
 	kfree(gd->part);
 err_kmalloc_gd_part:
@@ -937,7 +927,6 @@
 	init_gendisk(hwif);
 	blk_dev[hwif->major].data = hwif;
 	blk_dev[hwif->major].queue = ide_get_queue;
-	read_ahead[hwif->major] = 8;	/* (4kB) */
 	hwif->present = 1;	/* success */
 
 	return hwif->present;
drivers/ide/ide.c +0 -1
diff -urN linux-2.5.4/drivers/ide/ide.c linux-2.5.4-readahead/drivers/ide/ide.c
@@ -2126,7 +2126,6 @@
 	 */
 	unregister_blkdev(hwif->major, hwif->name);
 	kfree(blksize_size[hwif->major]);
-	kfree(max_readahead[hwif->major]);
 	blk_dev[hwif->major].data = NULL;
 	blk_dev[hwif->major].queue = NULL;
 	blk_clear(hwif->major);
drivers/md/lvm.c +0 -28
diff -urN linux-2.5.4/drivers/md/lvm.c linux-2.5.4-readahead/drivers/md/lvm.c
@@ -226,10 +226,6 @@
 
 #include "lvm-internal.h"
 
-#define	LVM_CORRECT_READ_AHEAD( a) \
-   if      ( a < LVM_MIN_READ_AHEAD || \
-             a > LVM_MAX_READ_AHEAD) a = LVM_MAX_READ_AHEAD;
-
 #ifndef WRITEA
 #  define WRITEA WRITE
 #endif
@@ -883,29 +879,6 @@
 		invalidate_buffers(inode->i_rdev);
 		break;
 
-
-	case BLKRASET:
-		/* set read ahead for block device */
-		if (!capable(CAP_SYS_ADMIN)) return -EACCES;
-
-		P_IOCTL("BLKRASET: %ld sectors for %s\n",
-			(long) arg, kdevname(inode->i_rdev));
-
-		if ((long) arg < LVM_MIN_READ_AHEAD ||
-		    (long) arg > LVM_MAX_READ_AHEAD)
-			return -EINVAL;
-		lv_ptr->lv_read_ahead = (long) arg;
-		break;
-
-
-	case BLKRAGET:
-		/* get current read ahead setting */
-		P_IOCTL("BLKRAGET %d\n", lv_ptr->lv_read_ahead);
-		if (put_user(lv_ptr->lv_read_ahead, (long *)arg))
-			return -EFAULT;
-		break;
-
-
 	case HDIO_GETGEO:
 		/* get disk geometry */
 		P_IOCTL("%s -- lvm_blk_ioctl -- HDIO_GETGEO\n", lvm_name);
@@ -2035,7 +2008,6 @@
 	lvm_size[minor(lv_ptr->lv_dev)] = lv_ptr->lv_size >> 1;
 	vg_lv_map[minor(lv_ptr->lv_dev)].vg_number = vg_ptr->vg_number;
 	vg_lv_map[minor(lv_ptr->lv_dev)].lv_number = lv_ptr->lv_number;
-	LVM_CORRECT_READ_AHEAD(lv_ptr->lv_read_ahead);
 	vg_ptr->lv_cur++;
 	lv_ptr->lv_status = lv_status_save;
 
drivers/md/md.c +0 -14
diff -urN linux-2.5.4/drivers/md/md.c linux-2.5.4-readahead/drivers/md/md.c
@@ -1737,7 +1737,6 @@
 	register_disk(&md_gendisk, mk_kdev(MAJOR_NR,mdidx(mddev)),
 			1, &md_fops, md_size[mdidx(mddev)]<<1);
 
-	read_ahead[MD_MAJOR] = 1024;
 	return (0);
 }
 
@@ -2622,8 +2621,6 @@
 						(u64 *) arg);
 			goto done;
 
-		case BLKRAGET:
-		case BLKRASET:
 		case BLKFLSBUF:
 		case BLKBSZGET:
 		case BLKBSZSET:
@@ -3176,13 +3173,6 @@
 
 	sz += sprintf(page+sz, "\n");
 
-
-	sz += sprintf(page+sz, "read_ahead ");
-	if (read_ahead[MD_MAJOR] == INT_MAX)
-		sz += sprintf(page+sz, "not set\n");
-	else
-		sz += sprintf(page+sz, "%d sectors\n", read_ahead[MD_MAJOR]);
-
 	ITERATE_MDDEV(mddev,tmp) {
 		sz += sprintf(page + sz, "md%d : %sactive", mdidx(mddev),
 						mddev->pers ? "" : "in");
@@ -3622,7 +3612,6 @@
 	}
 	blksize_size[MAJOR_NR] = md_blocksizes;
 	blk_size[MAJOR_NR] = md_size;
-	max_readahead[MAJOR_NR] = md_maxreadahead;
 
 	dprintk("md: sizeof(mdp_super_t) = %d\n", (int)sizeof(mdp_super_t));
 
@@ -3657,9 +3646,6 @@
 
 	/* forward all md request to md_make_request */
 	blk_queue_make_request(BLK_DEFAULT_QUEUE(MAJOR_NR), md_make_request);
-
-
-	read_ahead[MAJOR_NR] = INT_MAX;
 
 	add_gendisk(&md_gendisk);
 
drivers/message/i2o/i2o_block.c +0 -2
diff -urN linux-2.5.4/drivers/message/i2o/i2o_block.c linux-2.5.4-readahead/drivers/message/i2o/i2o_block.c
@@ -1104,8 +1104,6 @@
 		case BLKFLSBUF:
 		case BLKROSET:
 		case BLKROGET:
-		case BLKRASET:
-		case BLKRAGET:
 		case BLKPG:
 			return blk_ioctl(inode->i_rdev, cmd, arg);
 			
drivers/s390/block/dasd.c +0 -2
diff -urN linux-2.5.4/drivers/s390/block/dasd.c linux-2.5.4-readahead/drivers/s390/block/dasd.c
@@ -2489,8 +2489,6 @@
 	case BLKSSZGET:
 	case BLKROSET:
 	case BLKROGET:
-	case BLKRASET:
-	case BLKRAGET:
 	case BLKFLSBUF:
 	case BLKPG:
 	case BLKELVGET:
drivers/s390/block/xpram.c +0 -19
diff -urN linux-2.5.4/drivers/s390/block/xpram.c linux-2.5.4-readahead/drivers/s390/block/xpram.c
@@ -659,26 +659,9 @@
 		if ( capable(CAP_SYS_ADMIN) )invalidate_buffers(inode->i_rdev);
 		return 0;
 
-	case BLKRAGET: /* return the readahead value, 0x1263 */
-		if (!arg)  return -EINVAL;
-		err = 0; /* verify_area_20(VERIFY_WRITE, (long *) arg, sizeof(long));
-		          * if (err) return err;
-                          */
-		put_user(read_ahead[MAJOR(inode->i_rdev)], (long *)arg);
-
-		return 0;
-
-	case BLKRASET: /* set the readahead value, 0x1262 */
-		if (!capable(CAP_SYS_ADMIN)) return -EACCES;
-		if (arg > 0xff) return -EINVAL; /* limit it */
-		read_ahead[MAJOR(inode->i_rdev)] = arg;
-                atomic_eieio();
-		return 0;
-
 	case BLKRRPART: /* re-read partition table: can't do it, 0x1259 */
 		return -EINVAL;
 
-
 #if (XPRAM_VERSION == 22)
 		RO_IOCTLS(inode->i_rdev, arg); /* the default RO operations 
                                                 * BLKROSET
@@ -1042,7 +1025,6 @@
 	q = BLK_DEFAULT_QUEUE (major);
 	blk_init_queue (q, xpram_request);
 #endif /* V22/V24 */
-	read_ahead[major] = xpram_rahead;
 
 	/* we want to have XPRAM_UNUSED blocks security buffer between devices */
 	mem_usable=xpram_mem_avail-(XPRAM_UNUSED*(xpram_devs-1));
@@ -1181,7 +1163,6 @@
 	kfree(xpram_hardsects);
 	hardsect_size[major] = NULL;
  fail_malloc:
-	read_ahead[major] = 0;
 #if (XPRAM_VERSION == 22)
 	blk_dev[major].request_fn = NULL;
 #endif /* V22 */
drivers/s390/char/tapeblock.c +0 -1
diff -urN linux-2.5.4/drivers/s390/char/tapeblock.c linux-2.5.4-readahead/drivers/s390/char/tapeblock.c
@@ -101,7 +101,6 @@
     }
     if (tapeblock_major == 0) tapeblock_major = result;   /* accept dynamic major number*/
     INIT_BLK_DEV(tapeblock_major,tape_request_fn,tapeblock_getqueue,NULL);
-    read_ahead[tapeblock_major]=TAPEBLOCK_READAHEAD;
     PRINT_WARN(KERN_ERR " tape gets major %d for block device\n", result);
     blk_size[tapeblock_major] = (int*) kmalloc (256*sizeof(int),GFP_ATOMIC);
     memset(blk_size[tapeblock_major],0,256*sizeof(int));
drivers/scsi/sd.c +0 -14
diff -urN linux-2.5.4/drivers/scsi/sd.c linux-2.5.4-readahead/drivers/scsi/sd.c
@@ -228,8 +228,6 @@
 		case BLKGETSIZE64:
 		case BLKROSET:
 		case BLKROGET:
-		case BLKRASET:
-		case BLKRAGET:
 		case BLKFLSBUF:
 		case BLKSSZGET:
 		case BLKPG:
@@ -1190,18 +1188,6 @@
 				rscsi_disks[i].has_part_table = 1;
 			}
 		}
-	/* If our host adapter is capable of scatter-gather, then we increase
-	 * the read-ahead to 60 blocks (120 sectors).  If not, we use
-	 * a two block (4 sector) read ahead. We can only respect this with the
-	 * granularity of every 16 disks (one device major).
-	 */
-	for (i = 0; i < N_USED_SD_MAJORS; i++) {
-		read_ahead[SD_MAJOR(i)] =
-		    (rscsi_disks[i * SCSI_DISKS_PER_MAJOR].device
-		     && rscsi_disks[i * SCSI_DISKS_PER_MAJOR].device->host->sg_tablesize)
-		    ? 120	/* 120 sector read-ahead */
-		    : 4;	/* 4 sector read-ahead */
-	}
 
 	return;
 }
drivers/scsi/sr.c +0 -11
diff -urN linux-2.5.4/drivers/scsi/sr.c linux-2.5.4-readahead/drivers/scsi/sr.c
@@ -785,16 +785,6 @@
                                     &sr_bdops, NULL);
 		register_cdrom(&scsi_CDs[i].cdi);
 	}
-
-
-	/* If our host adapter is capable of scatter-gather, then we increase
-	 * the read-ahead to 16 blocks (32 sectors).  If not, we use
-	 * a two block (4 sector) read ahead. */
-	if (scsi_CDs[0].device && scsi_CDs[0].device->host->sg_tablesize)
-		read_ahead[MAJOR_NR] = 32;	/* 32 sector read-ahead.  Always removable. */
-	else
-		read_ahead[MAJOR_NR] = 4;	/* 4 sector read-ahead */
-
 }
 
 static void sr_detach(Scsi_Device * SDp)
@@ -846,7 +836,6 @@
 		kfree(sr_blocksizes);
 		sr_blocksizes = NULL;
 	}
-	read_ahead[MAJOR_NR] = 0;
 	blk_clear(MAJOR_NR);
 
 	sr_template.dev_max = 0;
drivers/scsi/sr_ioctl.c +0 -2
diff -urN linux-2.5.4/drivers/scsi/sr_ioctl.c linux-2.5.4-readahead/drivers/scsi/sr_ioctl.c
@@ -550,8 +550,6 @@
 		return put_user((u64)scsi_CDs[target].capacity << 9, (u64 *)arg);
 	case BLKROSET:
 	case BLKROGET:
-	case BLKRASET:
-	case BLKRAGET:
 	case BLKFLSBUF:
 	case BLKSSZGET:
 		return blk_ioctl(cdi->dev, cmd, arg);
fs/hfs/file.c +2 -11
diff -urN linux-2.5.4/fs/hfs/file.c linux-2.5.4-readahead/fs/hfs/file.c
@@ -163,8 +163,7 @@
 	if (left <= 0) {
 		return 0;
 	}
-	if ((read = hfs_do_read(inode, HFS_I(inode)->fork, pos,
-				buf, left, filp->f_reada != 0)) > 0) {
+	if ((read = hfs_do_read(inode, HFS_I(inode)->fork, pos, buf, left)) > 0) {
 	        *ppos += read;
 		filp->f_reada = 1;
 	}
@@ -288,7 +287,7 @@
  * It has been changed to take into account that HFS files have no holes.
  */
 hfs_s32 hfs_do_read(struct inode *inode, struct hfs_fork * fork, hfs_u32 pos,
-		    char * buf, hfs_u32 count, int reada)
+		    char * buf, hfs_u32 count)
 {
 	kdev_t dev = inode->i_dev;
 	hfs_s32 size, chars, offset, block, blocks, read = 0;
@@ -309,14 +308,6 @@
 	blocks = (count+offset+HFS_SECTOR_SIZE-1) >> HFS_SECTOR_SIZE_BITS;
 
 	bhb = bhe = buflist;
-	if (reada) {
-		if (blocks < read_ahead[major(dev)] / (HFS_SECTOR_SIZE>>9)) {
-			blocks = read_ahead[major(dev)] / (HFS_SECTOR_SIZE>>9);
-		}
-		if (block + blocks > size) {
-			blocks = size - block;
-		}
-	}
 
 	/* We do this in a two stage process.  We first try and
 	   request as many blocks as we can, then we wait for the
include/linux/blkdev.h +0 -5
diff -urN linux-2.5.4/include/linux/blkdev.h linux-2.5.4-readahead/include/linux/blkdev.h
@@ -314,11 +314,8 @@
 extern void generic_unplug_device(void *);
 
 extern int * blk_size[MAX_BLKDEV];
-
 extern int * blksize_size[MAX_BLKDEV];
 
-extern int * max_readahead[MAX_BLKDEV];
-
 #define MAX_PHYS_SEGMENTS 128
 #define MAX_HW_SEGMENTS 128
 #define MAX_SECTORS 255
@@ -340,8 +337,6 @@
 	blk_size_in_bytes[major] = NULL;
 #endif
 	blksize_size[major] = NULL;
-	max_readahead[major] = NULL;
-	read_ahead[major] = 0;
 }
 
 extern inline int get_hardsect_size(kdev_t dev)
include/linux/fs.h +3 -3
diff -urN linux-2.5.4/include/linux/fs.h linux-2.5.4-readahead/include/linux/fs.h
@@ -173,10 +173,12 @@
 #define BLKRRPART  _IO(0x12,95)	/* re-read partition table */
 #define BLKGETSIZE _IO(0x12,96)	/* return device size /512 (long *arg) */
 #define BLKFLSBUF  _IO(0x12,97)	/* flush buffer cache */
-#define BLKRASET   _IO(0x12,98)	/* Set read ahead for block device */
+#if 0				/* Obsolete, these don't do anything. */
+#define BLKRASET   _IO(0x12,98)	/* set read ahead for block device */
 #define BLKRAGET   _IO(0x12,99)	/* get current read ahead setting */
 #define BLKFRASET  _IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
 #define BLKFRAGET  _IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */
+#endif
 #define BLKSECTSET _IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */
 #define BLKSECTGET _IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
 #define BLKSSZGET  _IO(0x12,104)/* get block device sector size */
@@ -1490,8 +1492,6 @@
 
 extern ssize_t char_read(struct file *, char *, size_t, loff_t *);
 extern ssize_t block_read(struct file *, char *, size_t, loff_t *);
-extern int read_ahead[];
-
 extern ssize_t char_write(struct file *, const char *, size_t, loff_t *);
 extern ssize_t block_write(struct file *, const char *, size_t, loff_t *);
 
include/linux/lvm.h +0 -1
diff -urN linux-2.5.4/include/linux/lvm.h linux-2.5.4-readahead/include/linux/lvm.h
@@ -498,7 +498,6 @@
 	uint lv_badblock;	/* for future use */
 	uint lv_allocation;
 	uint lv_io_timeout;	/* for future use */
-	uint lv_read_ahead;
 
 	/* delta to version 1 starts here */
        struct lv_v5 *lv_snapshot_org;
kernel/ksyms.c +0 -2
diff -urN linux-2.5.4/kernel/ksyms.c linux-2.5.4-readahead/kernel/ksyms.c
@@ -321,7 +321,6 @@
 EXPORT_SYMBOL(tq_disk);
 EXPORT_SYMBOL(init_buffer);
 EXPORT_SYMBOL(refile_buffer);
-EXPORT_SYMBOL(max_readahead);
 EXPORT_SYMBOL(wipe_partitions);
 
 /* tty routines */
@@ -521,7 +520,6 @@
 EXPORT_SYMBOL(clear_inode);
 EXPORT_SYMBOL(___strtok);
 EXPORT_SYMBOL(init_special_inode);
-EXPORT_SYMBOL(read_ahead);
 EXPORT_SYMBOL(__get_hash_table);
 EXPORT_SYMBOL(new_inode);
 EXPORT_SYMBOL(insert_inode_hash);
mm/filemap.c +6 -15
diff -urN linux-2.5.4/mm/filemap.c linux-2.5.4-readahead/mm/filemap.c
@@ -1131,13 +1131,6 @@
  *   64k if defined (4K page size assumed).
  */
 
-static inline int get_max_readahead(struct inode * inode)
-{
-	if (kdev_none(inode->i_dev) || !max_readahead[major(inode->i_dev)])
-		return MAX_READAHEAD;
-	return max_readahead[major(inode->i_dev)][minor(inode->i_dev)];
-}
-
 static void generic_file_readahead(int reada_ok,
 	struct file * filp, struct inode * inode,
 	struct page * page)
@@ -1146,7 +1139,6 @@
 	unsigned long index = page->index;
 	unsigned long max_ahead, ahead;
 	unsigned long raend;
-	int max_readahead = get_max_readahead(inode);
 
 	end_index = inode->i_size >> PAGE_CACHE_SHIFT;
 
@@ -1231,8 +1223,8 @@
 
 		filp->f_ramax += filp->f_ramax;
 
-		if (filp->f_ramax > max_readahead)
-			filp->f_ramax = max_readahead;
+		if (filp->f_ramax > MAX_READAHEAD)
+			filp->f_ramax = MAX_READAHEAD;
 
 #ifdef PROFILE_READAHEAD
 		profile_readahead((reada_ok == 2), filp);
@@ -1278,7 +1270,6 @@
 	struct page *cached_page;
 	int reada_ok;
 	int error;
-	int max_readahead = get_max_readahead(inode);
 
 	cached_page = NULL;
 	index = *ppos >> PAGE_CACHE_SHIFT;
@@ -1318,9 +1309,9 @@
 			filp->f_ramax = needed;
 
 		if (reada_ok && filp->f_ramax < MIN_READAHEAD)
-				filp->f_ramax = MIN_READAHEAD;
-		if (filp->f_ramax > max_readahead)
-			filp->f_ramax = max_readahead;
+			filp->f_ramax = MIN_READAHEAD;
+		if (filp->f_ramax > MAX_READAHEAD)
+			filp->f_ramax = MAX_READAHEAD;
 	}
 
 	for (;;) {
@@ -1808,7 +1799,7 @@
 {
 	unsigned long ra_window;
 
-	ra_window = get_max_readahead(vma->vm_file->f_dentry->d_inode);
+	ra_window = MAX_READAHEAD;
 	ra_window = CLUSTER_OFFSET(ra_window + CLUSTER_PAGES - 1);
 
 	/* vm_raend is zero if we haven't read ahead in this area yet.  */
#13 lore raw
In reply to Pavel Machek
Quoted 7 lines · Vojtech Pavlik

The later (lv_disk_t) struct isn't used anywhere in the kernel - probably defined for userspace only? That's weird! And also many other structs in lvm.h are nowhere to be found used. Guess we could swipe them out as well.

The first lv_read_ahead (in lv_t) removed. And references to it as well.

Yes I know the lvm coders where too deaf to separate user level structure layout properly from on disk and kernel space by using just different header files for different purposes. And then they tryed apparently to embarce anything they could think off, without really thinking hard about what should be there and what shouldn't. It was too hard for them to have a sneak view on for example Solaris to recognize what's really needed.

But they promise perpetually once in a while that the next version will be "coming real soon" and be wonderfull... Perhaps someone should just stump over them and clean this mess up, with the disrespect those pseudo maintainers do deserve....

Anyway, you apparently still missed to kill:

int *bs, max_ra; in ide-probe.c

as well as:
xpram_rahead and friends in s390 code

The attached patch is fixing this.

BTW.> Since there is no longer any difference about the request head handling between IDE and SCSI, what about the idea of moving the whole ide interface stuff under the umbrella of SCSI host adapter? This would be a true cleanup and make
the whole ide-scsi and ide-atapi mess go away. IDE is moving fast toward SCSI on the logical level anyway and it would make the hwif macro/lookup crap in the ide code go magically way! At least this generic device handler search stuff should be merged between them (I'm trully tempted to give it a shoot this afternoon.)
The only thing it could result in, which would maybe surprise some would be the fact that the major of his root device could just go suddenly away... But hey! What's the heck - we are in odd kernel series anyway ;-).

Documentation/cdrom/sbpcd +2 -8
diff -ur linux-2.5.4/Documentation/cdrom/sbpcd linux/Documentation/cdrom/sbpcd
@@ -613,8 +613,8 @@
 	printf("READ          d      READ RAW     w       READ AUDIO   A\n");
 	printf("MS-INFO       M      TOC          T       START        S\n");
 	printf("SET EJECTSW   X      DEVICE       D       DEBUG        Y\n");
-	printf("AUDIO_BUFSIZ  Z      RESET        R       BLKRASET     B\n");
-	printf("SET VOLUME    v      GET VOLUME   V\n");
+	printf("AUDIO_BUFSIZ  Z      RESET        R       SET VOLUME   v\n");
+	printf("GET VOLUME    V\n");
 }
 
 /*
@@ -882,12 +882,6 @@
 			rc=ioctl(drive,CDROMRESET);
 			if (rc<0) printf("CDROMRESET: rc=%d.\n",rc);
 			break;
-		case 'B': /* set the driver's (?) read ahead value */
-			printf("enter read-ahead size: ? ");
-			scanf("%d",&i);
-			rc=ioctl(drive,BLKRASET,i);
-			if (rc<0) printf("BLKRASET: rc=%d.\n",rc);
-			break;
 #ifdef AZT_PRIVATE_IOCTLS /*not supported by every CDROM driver*/
 		case 'd':
 			printf("Address (min:sec:frm)  ");
arch/mips64/kernel/ioctl32.c +0 -4
diff -ur linux-2.5.4/arch/mips64/kernel/ioctl32.c linux/arch/mips64/kernel/ioctl32.c
@@ -760,10 +760,6 @@
 	IOCTL32_HANDLER(BLKGETSIZE, w_long),
 
 	IOCTL32_DEFAULT(BLKFLSBUF),
-	IOCTL32_DEFAULT(BLKRASET),
-	IOCTL32_HANDLER(BLKRAGET, w_long),
-	IOCTL32_DEFAULT(BLKFRASET),
-	IOCTL32_HANDLER(BLKFRAGET, w_long),
 	IOCTL32_DEFAULT(BLKSECTSET),
 	IOCTL32_HANDLER(BLKSECTGET, w_long),
 	IOCTL32_DEFAULT(BLKSSZGET),
arch/sparc64/kernel/ioctl32.c +0 -4
diff -ur linux-2.5.4/arch/sparc64/kernel/ioctl32.c linux/arch/sparc64/kernel/ioctl32.c
@@ -3997,8 +3997,6 @@
 COMPATIBLE_IOCTL(BLKROGET)
 COMPATIBLE_IOCTL(BLKRRPART)
 COMPATIBLE_IOCTL(BLKFLSBUF)
-COMPATIBLE_IOCTL(BLKRASET)
-COMPATIBLE_IOCTL(BLKFRASET)
 COMPATIBLE_IOCTL(BLKSECTSET)
 COMPATIBLE_IOCTL(BLKSSZGET)
 COMPATIBLE_IOCTL(BLKBSZGET)
@@ -4626,10 +4624,8 @@
 HANDLE_IOCTL(SIOCRTMSG, ret_einval)
 HANDLE_IOCTL(SIOCGSTAMP, do_siocgstamp)
 HANDLE_IOCTL(HDIO_GETGEO, hdio_getgeo)
-HANDLE_IOCTL(BLKRAGET, w_long)
 HANDLE_IOCTL(BLKGETSIZE, w_long)
 HANDLE_IOCTL(0x1260, broken_blkgetsize)
-HANDLE_IOCTL(BLKFRAGET, w_long)
 HANDLE_IOCTL(BLKSECTGET, w_long)
 HANDLE_IOCTL(BLKPG, blkpg_ioctl_trans)
 HANDLE_IOCTL(FBIOPUTCMAP32, fbiogetputcmap)
drivers/acorn/block/mfmhd.c +0 -12
diff -ur linux-2.5.4/drivers/acorn/block/mfmhd.c linux/drivers/acorn/block/mfmhd.c
@@ -1208,15 +1208,6 @@
 			return -EFAULT;
 		return 0;
 
-	case BLKFRASET:
-		if (!capable(CAP_SYS_ADMIN))
-			return -EACCES;
-		max_readahead[major][minor] = arg;
-		return 0;
-
-	case BLKFRAGET:
-		return put_user(max_readahead[major][minor], (long *) arg);
-
 	case BLKSECTGET:
 		return put_user(max_sectors[major][minor], (long *) arg);
 
@@ -1230,8 +1221,6 @@
 	case BLKFLSBUF:
 	case BLKROSET:
 	case BLKROGET:
-	case BLKRASET:
-	case BLKRAGET:
 	case BLKPG:
 		return blk_ioctl(dev, cmd, arg);
 
@@ -1442,7 +1431,6 @@
 	hdc63463_irqpollmask	= irqmask;
 
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST);
-	read_ahead[MAJOR_NR] = 8;	/* 8 sector (4kB?) read ahread */
 
 	add_gendisk(&mfm_gendisk);
 
drivers/block/DAC960.c +0 -6
diff -ur linux-2.5.4/drivers/block/DAC960.c linux/drivers/block/DAC960.c
@@ -1964,10 +1964,6 @@
   Controller->GenericDiskInfo.sizes = Controller->PartitionSizes;
   blksize_size[MajorNumber] = Controller->BlockSizes;
   /*
-    Initialize Read Ahead to 128 sectors.
-  */
-  read_ahead[MajorNumber] = 128;
-  /*
     Complete initialization of the Generic Disk Information structure.
   */
   Controller->GenericDiskInfo.major = MajorNumber;
@@ -5399,8 +5395,6 @@
 			   sizeof(DiskGeometry_T)) ? -EFAULT : 0);
     case BLKGETSIZE:
     case BLKGETSIZE64:
-    case BLKRAGET:
-    case BLKRASET:
     case BLKFLSBUF:
     case BLKBSZGET:
     case BLKBSZSET:
drivers/block/acsi.c +0 -1
diff -ur linux-2.5.4/drivers/block/acsi.c linux/drivers/block/acsi.c
@@ -1785,7 +1785,6 @@
 	STramMask = ATARIHW_PRESENT(EXTD_DMA) ? 0x00000000 : 0xff000000;
 	
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &acsi_lock);
-	read_ahead[MAJOR_NR] = 8;		/* 8 sector (4kB) read-ahead */
 	add_gendisk(&acsi_gendisk);
 
 #ifdef CONFIG_ATARI_SLM
drivers/block/ataflop.c +0 -2
diff -ur linux-2.5.4/drivers/block/ataflop.c linux/drivers/block/ataflop.c
@@ -1573,8 +1573,6 @@
 	switch (cmd) {
 		case BLKROSET:
 		case BLKROGET:
-		case BLKRASET:
-		case BLKRAGET:
 		case BLKFLSBUF:
 			return blk_ioctl(device, cmd, param);
 	}
drivers/block/blkpg.c +1 -26
diff -ur linux-2.5.4/drivers/block/blkpg.c linux/drivers/block/blkpg.c
@@ -29,7 +29,7 @@
  */
 
 #include <linux/errno.h>
-#include <linux/fs.h>			/* for BLKRASET, ... */
+#include <linux/fs.h>			/* for BLKROSET, ... */
 #include <linux/sched.h>		/* for capable() */
 #include <linux/blk.h>			/* for set_device_ro() */
 #include <linux/blkpg.h>
@@ -227,31 +227,6 @@
 			intval = (is_read_only(dev) != 0);
 			return put_user(intval, (int *)(arg));
 
-		case BLKRASET:
-			if(!capable(CAP_SYS_ADMIN))
-				return -EACCES;
-			if(arg > 0xff)
-				return -EINVAL;
-			read_ahead[major(dev)] = arg;
-			return 0;
-		case BLKRAGET:
-			if (!arg)
-				return -EINVAL;
-			return put_user(read_ahead[major(dev)], (long *) arg);
-
-		case BLKFRASET:
-			if (!capable(CAP_SYS_ADMIN))
-				return -EACCES;
-			if (!(iptr = max_readahead[major(dev)]))
-				return -EINVAL;
-			iptr[minor(dev)] = arg;
-			return 0;
-
-		case BLKFRAGET:
-			if (!(iptr = max_readahead[major(dev)]))
-				return -EINVAL;
-			return put_user(iptr[minor(dev)], (long *) arg);
-
 		case BLKSECTGET:
 			if ((q = blk_get_queue(dev)) == NULL)
 				return -EINVAL;
drivers/block/cciss.c +0 -3
diff -ur linux-2.5.4/drivers/block/cciss.c linux/drivers/block/cciss.c
@@ -471,8 +471,6 @@
 	case BLKBSZGET:
 	case BLKROSET:
 	case BLKROGET:
-	case BLKRASET:
-	case BLKRAGET:
 	case BLKPG:
 		return blk_ioctl(inode->i_rdev, cmd, arg);
 	case CCISS_GETPCIINFO:
@@ -2542,7 +2540,6 @@
 
 	/* fill in the other Kernel structs */
 	blksize_size[MAJOR_NR+i] = hba[i]->blocksizes;
-        read_ahead[MAJOR_NR+i] = READ_AHEAD;
 
 	/* Fill in the gendisk data */ 	
 	hba[i]->gendisk.major = MAJOR_NR + i;
drivers/block/cpqarray.c +0 -3
diff -ur linux-2.5.4/drivers/block/cpqarray.c linux/drivers/block/cpqarray.c
@@ -481,7 +481,6 @@
 		blk_queue_max_phys_segments(q, SG_MAX);
 
 		blksize_size[MAJOR_NR+i] = ida_blocksizes + (i*256);
-		read_ahead[MAJOR_NR+i] = READ_AHEAD;
 
 		ida_gendisk[i].major = MAJOR_NR + i;
 		ida_gendisk[i].major_name = "ida";
@@ -1181,8 +1180,6 @@
 	case BLKBSZGET:
 	case BLKROSET:
 	case BLKROGET:
-	case BLKRASET:
-	case BLKRAGET:
 	case BLKPG:
 		return blk_ioctl(inode->i_rdev, cmd, arg);
 
drivers/block/floppy.c +0 -2
diff -ur linux-2.5.4/drivers/block/floppy.c linux/drivers/block/floppy.c
@@ -3448,8 +3448,6 @@
 	switch (cmd) {
 		case BLKROSET:
 		case BLKROGET:
-		case BLKRASET:
-		case BLKRAGET:
 		case BLKFLSBUF:
 			return blk_ioctl(device, cmd, param);
 	}
drivers/block/ll_rw_blk.c +0 -10
diff -ur linux-2.5.4/drivers/block/ll_rw_blk.c linux/drivers/block/ll_rw_blk.c
@@ -54,10 +54,6 @@
  */
 DECLARE_TASK_QUEUE(tq_disk);
 
-/* This specifies how many sectors to read ahead on the disk. */
-
-int read_ahead[MAX_BLKDEV];
-
 /* blk_dev_struct is:
  *	request_queue
  *	*queue
@@ -84,11 +80,6 @@
 int * blksize_size[MAX_BLKDEV];
 
 /*
- * The following tunes the read-ahead algorithm in mm/filemap.c
- */
-int * max_readahead[MAX_BLKDEV];
-
-/*
  * How many reqeusts do we allocate per queue,
  * and how many do we "batch" on freeing them?
  */
@@ -1689,7 +1680,6 @@
 		dev->queue = NULL;
 
 	memset(ro_bits,0,sizeof(ro_bits));
-	memset(max_readahead, 0, sizeof(max_readahead));
 
 	total_ram = nr_free_pages() << (PAGE_SHIFT - 10);
 
drivers/block/paride/pcd.c +0 -1
diff -ur linux-2.5.4/drivers/block/paride/pcd.c linux/drivers/block/paride/pcd.c
@@ -358,7 +358,6 @@
 	}
 
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &pcd_lock);
-	read_ahead[MAJOR_NR] = 8;	/* 8 sector (4kB) read ahead */
 
 	for (i=0;i<PCD_UNITS;i++) pcd_blocksizes[i] = 1024;
         blksize_size[MAJOR_NR] = pcd_blocksizes;
drivers/block/paride/pd.c +0 -3
diff -ur linux-2.5.4/drivers/block/paride/pd.c linux/drivers/block/paride/pd.c
@@ -397,7 +397,6 @@
 	q = BLK_DEFAULT_QUEUE(MAJOR_NR);
 	blk_init_queue(q, DEVICE_REQUEST, &pd_lock);
 	blk_queue_max_sectors(q, cluster);
-        read_ahead[MAJOR_NR] = 8;       /* 8 sector (4kB) read ahead */
         
 	pd_gendisk.major = major;
 	pd_gendisk.major_name = name;
@@ -480,8 +479,6 @@
 	    case BLKGETSIZE64:
 	    case BLKROSET:
 	    case BLKROGET:
-	    case BLKRASET:
-	    case BLKRAGET:
 	    case BLKFLSBUF:
 	    case BLKPG:
 		return blk_ioctl(inode->i_rdev, cmd, arg);
drivers/block/paride/pf.c +0 -3
diff -ur linux-2.5.4/drivers/block/paride/pf.c linux/drivers/block/paride/pf.c
@@ -363,7 +363,6 @@
 	blk_init_queue(q, DEVICE_REQUEST, &pf_spin_lock);
 	blk_queue_max_phys_segments(q, cluster);
 	blk_queue_max_hw_segments(q, cluster);
-        read_ahead[MAJOR_NR] = 8;       /* 8 sector (4kB) read ahead */
         
 	for (i=0;i<PF_UNITS;i++) pf_blocksizes[i] = 1024;
 	blksize_size[MAJOR_NR] = pf_blocksizes;
@@ -433,8 +432,6 @@
                 return put_user((u64)PF.capacity << 9,(u64 *)arg);
 	    case BLKROSET:
 	    case BLKROGET:
-	    case BLKRASET:
-	    case BLKRAGET:
 	    case BLKFLSBUF:
 		return blk_ioctl(inode->i_rdev, cmd, arg);
             default:
drivers/block/ps2esdi.c +0 -3
diff -ur linux-2.5.4/drivers/block/ps2esdi.c linux/drivers/block/ps2esdi.c
@@ -177,7 +177,6 @@
 	}
 	/* set up some global information - indicating device specific info */
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &ps2esdi_lock);
-	read_ahead[MAJOR_NR] = 8;	/* 8 sector (4kB) read ahead */
 
 	/* some minor housekeeping - setup the global gendisk structure */
 	add_gendisk(&ps2esdi_gendisk);
@@ -1108,8 +1107,6 @@
 		case BLKGETSIZE64:
 		case BLKROSET:
 		case BLKROGET:
-		case BLKRASET:
-		case BLKRAGET:
 		case BLKFLSBUF:
 		case BLKBSZGET:
 		case BLKBSZSET:
drivers/block/xd.c +0 -3
diff -ur linux-2.5.4/drivers/block/xd.c linux/drivers/block/xd.c
@@ -171,7 +171,6 @@
 	}
 	devfs_handle = devfs_mk_dir (NULL, xd_gendisk.major_name, NULL);
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &xd_lock);
-	read_ahead[MAJOR_NR] = 8;	/* 8 sector (4kB) read ahead */
 	add_gendisk(&xd_gendisk);
 	xd_geninit();
 
@@ -355,8 +354,6 @@
 		case BLKFLSBUF:
 		case BLKROSET:
 		case BLKROGET:
-		case BLKRASET:
-		case BLKRAGET:
 		case BLKPG:
 			return blk_ioctl(inode->i_rdev, cmd, arg);
 
drivers/cdrom/aztcd.c +0 -1
diff -ur linux-2.5.4/drivers/cdrom/aztcd.c linux/drivers/cdrom/aztcd.c
@@ -1927,7 +1927,6 @@
 	}
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &aztSpin);
 	blksize_size[MAJOR_NR] = aztcd_blocksizes;
-	read_ahead[MAJOR_NR] = 4;
 	register_disk(NULL, mk_kdev(MAJOR_NR, 0), 1, &azt_fops, 0);
 
 	if ((azt_port == 0x1f0) || (azt_port == 0x170))
drivers/cdrom/cdu31a.c +0 -1
diff -ur linux-2.5.4/drivers/cdrom/cdu31a.c linux/drivers/cdrom/cdu31a.c
@@ -3442,7 +3442,6 @@
 		blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR),
 			       DEVICE_REQUEST,
 			       &cdu31a_lock);
-		read_ahead[MAJOR_NR] = CDU31A_READAHEAD;
 		cdu31a_block_size = 1024;	/* 1kB default block size */
 		/* use 'mount -o block=2048' */
 		blksize_size[MAJOR_NR] = &cdu31a_block_size;
drivers/cdrom/cm206.c +0 -1
diff -ur linux-2.5.4/drivers/cdrom/cm206.c linux/drivers/cdrom/cm206.c
@@ -1503,7 +1503,6 @@
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST,
 		       &cm206_lock);
 	blksize_size[MAJOR_NR] = cm206_blocksizes;
-	read_ahead[MAJOR_NR] = 16;	/* reads ahead what? */
 	init_bh(CM206_BH, cm206_bh);
 
 	memset(cd, 0, sizeof(*cd));	/* give'm some reasonable value */
drivers/cdrom/gscd.c +0 -1
diff -ur linux-2.5.4/drivers/cdrom/gscd.c linux/drivers/cdrom/gscd.c
@@ -1022,7 +1022,6 @@
 
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &gscd_lock);
 	blksize_size[MAJOR_NR] = gscd_blocksizes;
-	read_ahead[MAJOR_NR] = 4;
 
 	disk_state = 0;
 	gscdPresent = 1;
drivers/cdrom/mcd.c +0 -1
diff -ur linux-2.5.4/drivers/cdrom/mcd.c linux/drivers/cdrom/mcd.c
@@ -1075,7 +1075,6 @@
 	blksize_size[MAJOR_NR] = mcd_blocksizes;
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST,
 		       &mcd_spinlock);
-	read_ahead[MAJOR_NR] = 4;
 
 	/* check for card */
 
drivers/cdrom/mcdx.c +0 -1
diff -ur linux-2.5.4/drivers/cdrom/mcdx.c linux/drivers/cdrom/mcdx.c
@@ -1184,7 +1184,6 @@
 
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST,
 		       &mcdx_lock);
-	read_ahead[MAJOR_NR] = READ_AHEAD;
 	blksize_size[MAJOR_NR] = mcdx_blocksizes;
 
 	xtrace(INIT, "init() subscribe irq and i/o\n");
drivers/cdrom/optcd.c +0 -1
diff -ur linux-2.5.4/drivers/cdrom/optcd.c linux/drivers/cdrom/optcd.c
@@ -2062,7 +2062,6 @@
 	blksize_size[MAJOR_NR] = &blksize;
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST,
 		       &optcd_lock);
-	read_ahead[MAJOR_NR] = 4;
 	request_region(optcd_port, 4, "optcd");
 	register_disk(NULL, mk_kdev(MAJOR_NR,0), 1, &opt_fops, 0);
 
drivers/cdrom/sbpcd.c +0 -6
diff -ur linux-2.5.4/drivers/cdrom/sbpcd.c linux/drivers/cdrom/sbpcd.c
@@ -4531,12 +4531,6 @@
 		RETURN_UP(0);
 	} /* end of CDROMREADAUDIO */
 		
-	case BLKRASET:
-		if(!capable(CAP_SYS_ADMIN)) RETURN_UP(-EACCES);
-		if(kdev_none(cdi->dev)) RETURN_UP(-EINVAL);
-		if(arg > 0xff) RETURN_UP(-EINVAL);
-		read_ahead[major(cdi->dev)] = arg;
-		RETURN_UP(0);
 	default:
 		msg(DBG_IOC,"ioctl: unknown function request %04X\n", cmd);
 		RETURN_UP(-EINVAL);
drivers/cdrom/sjcd.c +0 -1
diff -ur linux-2.5.4/drivers/cdrom/sjcd.c linux/drivers/cdrom/sjcd.c
@@ -1695,7 +1695,6 @@
 	}
 
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST,&sjcd_lock);
-	read_ahead[MAJOR_NR] = 4;
 	register_disk(NULL, mk_kdev(MAJOR_NR, 0), 1, &sjcd_fops, 0);
 
 	if (check_region(sjcd_base, 4)) {
drivers/cdrom/sonycd535.c +0 -1
diff -ur linux-2.5.4/drivers/cdrom/sonycd535.c linux/drivers/cdrom/sonycd535.c
@@ -1598,7 +1598,6 @@
 				}
 				blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &sonycd535_lock);
 				blksize_size[MAJOR_NR] = &sonycd535_block_size;
-				read_ahead[MAJOR_NR] = 8;	/* 8 sector (4kB) read-ahead */
 
 				sony_toc = (struct s535_sony_toc *)
 					kmalloc(sizeof *sony_toc, GFP_KERNEL);

Only in linux/drivers/ide: .ide-probe.c.swp

drivers/ide/ataraid.c +0 -1
diff -ur linux-2.5.4/drivers/ide/ataraid.c linux/drivers/ide/ataraid.c
@@ -289,7 +289,6 @@
 	hardsect_size[ATAMAJOR] = NULL;
 	blk_size[ATAMAJOR] = NULL;
 	blksize_size[ATAMAJOR] = NULL;                       
-	max_readahead[ATAMAJOR] = NULL;
 
 	del_gendisk(&ataraid_gendisk);
         
drivers/ide/hd.c +0 -3
diff -ur linux-2.5.4/drivers/ide/hd.c linux/drivers/ide/hd.c
@@ -652,8 +652,6 @@
 		case BLKGETSIZE64:
 		case BLKROSET:
 		case BLKROGET:
-		case BLKRASET:
-		case BLKRAGET:
 		case BLKFLSBUF:
 		case BLKPG:
 			return blk_ioctl(inode->i_rdev, cmd, arg);
@@ -837,7 +835,6 @@
 	}
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &hd_lock);
 	blk_queue_max_sectors(BLK_DEFAULT_QUEUE(MAJOR_NR), 255);
-	read_ahead[MAJOR_NR] = 8;		/* 8 sector (4kB) read-ahead */
 	add_gendisk(&hd_gendisk);
 	init_timer(&device_timer);
 	device_timer.function = hd_times_out;
drivers/ide/ide-cd.c +0 -5
diff -ur linux-2.5.4/drivers/ide/ide-cd.c linux/drivers/ide/ide-cd.c
@@ -2659,11 +2659,6 @@
 
 static void ide_cdrom_add_settings(ide_drive_t *drive)
 {
-	int major = HWIF(drive)->major;
-	int minor = drive->select.b.unit << PARTN_BITS;
-
-	ide_add_setting(drive,	"breada_readahead",	SETTING_RW, BLKRAGET, BLKRASET, TYPE_INT, 0, 255, 1, 2, &read_ahead[major], NULL);
-	ide_add_setting(drive,	"file_readahead",	SETTING_RW, BLKFRAGET, BLKFRASET, TYPE_INTA, 0, INT_MAX, 1, 1024, &max_readahead[major][minor],	NULL);
 	ide_add_setting(drive,	"dsc_overlap",		SETTING_RW, -1, -1, TYPE_BYTE, 0, 1, 1,	1, &drive->dsc_overlap, NULL);
 }
 
drivers/ide/ide-disk.c +0 -2
diff -ur linux-2.5.4/drivers/ide/ide-disk.c linux/drivers/ide/ide-disk.c
@@ -916,8 +916,6 @@
 	ide_add_setting(drive,	"bswap",		SETTING_READ,					-1,			-1,			TYPE_BYTE,	0,	1,				1,	1,	&drive->bswap,			NULL);
 	ide_add_setting(drive,	"multcount",		id ? SETTING_RW : SETTING_READ,			HDIO_GET_MULTCOUNT,	HDIO_SET_MULTCOUNT,	TYPE_BYTE,	0,	id ? id->max_multsect : 0,	1,	1,	&drive->mult_count,		set_multcount);
 	ide_add_setting(drive,	"nowerr",		SETTING_RW,					HDIO_GET_NOWERR,	HDIO_SET_NOWERR,	TYPE_BYTE,	0,	1,				1,	1,	&drive->nowerr,			set_nowerr);
-	ide_add_setting(drive,	"breada_readahead",	SETTING_RW,					BLKRAGET,		BLKRASET,		TYPE_INT,	0,	255,				1,	1,	&read_ahead[major],		NULL);
-	ide_add_setting(drive,	"file_readahead",	SETTING_RW,					BLKFRAGET,		BLKFRASET,		TYPE_INTA,	0,	4096,			PAGE_SIZE,	1024,	&max_readahead[major][minor],	NULL);
 	ide_add_setting(drive,	"lun",			SETTING_RW,					-1,			-1,			TYPE_INT,	0,	7,				1,	1,	&drive->lun,			NULL);
 	ide_add_setting(drive,	"wcache",		SETTING_RW,					HDIO_GET_WCACHE,	HDIO_SET_WCACHE,	TYPE_BYTE,	0,	1,				1,	1,	&drive->wcache,			write_cache);
 	ide_add_setting(drive,	"acoustic",		SETTING_RW,					HDIO_GET_ACOUSTIC,	HDIO_SET_ACOUSTIC,	TYPE_BYTE,	0,	254,				1,	1,	&drive->acoustic,		set_acoustic);
drivers/ide/ide-floppy.c +0 -2
diff -ur linux-2.5.4/drivers/ide/ide-floppy.c linux/drivers/ide/ide-floppy.c
@@ -1968,8 +1968,6 @@
 	ide_add_setting(drive,	"bios_cyl",		SETTING_RW,					-1,			-1,			TYPE_INT,	0,	1023,				1,	1,	&drive->bios_cyl,		NULL);
 	ide_add_setting(drive,	"bios_head",		SETTING_RW,					-1,			-1,			TYPE_BYTE,	0,	255,				1,	1,	&drive->bios_head,		NULL);
 	ide_add_setting(drive,	"bios_sect",		SETTING_RW,					-1,			-1,			TYPE_BYTE,	0,	63,				1,	1,	&drive->bios_sect,		NULL);
-	ide_add_setting(drive,	"breada_readahead",	SETTING_RW,					BLKRAGET,		BLKRASET,		TYPE_INT,	0,	255,				1,	2,	&read_ahead[major],		NULL);
-	ide_add_setting(drive,	"file_readahead",	SETTING_RW,					BLKFRAGET,		BLKFRASET,		TYPE_INTA,	0,	INT_MAX,			1,	1024,	&max_readahead[major][minor],	NULL);
 
 }
 
drivers/ide/ide-probe.c +9 -21
diff -ur linux-2.5.4/drivers/ide/ide-probe.c linux/drivers/ide/ide-probe.c
@@ -789,7 +789,6 @@
 {
 	struct gendisk *gd;
 	unsigned int unit, units, minors;
-	int *bs, *max_ra;
 	extern devfs_handle_t ide_devfs_handle;
 
 #if 1
@@ -802,35 +801,27 @@
 	}
 #endif
 
-	minors    = units * (1<<PARTN_BITS);
-	gd        = kmalloc (sizeof(struct gendisk), GFP_KERNEL);
+	minors = units * (1<<PARTN_BITS);
+
+	gd = kmalloc (sizeof(struct gendisk), GFP_KERNEL);
 	if (!gd)
 		goto err_kmalloc_gd;
 	gd->sizes = kmalloc (minors * sizeof(int), GFP_KERNEL);
 	if (!gd->sizes)
 		goto err_kmalloc_gd_sizes;
-	gd->part  = kmalloc (minors * sizeof(struct hd_struct), GFP_KERNEL);
+	gd->part = kmalloc (minors * sizeof(struct hd_struct), GFP_KERNEL);
 	if (!gd->part)
 		goto err_kmalloc_gd_part;
-	bs        = kmalloc (minors*sizeof(int), GFP_KERNEL);
-	if (!bs)
+	blksize_size[hwif->major] = kmalloc (minors*sizeof(int), GFP_KERNEL);
+	if (!blksize_size[hwif->major])
 		goto err_kmalloc_bs;
-	max_ra    = kmalloc (minors*sizeof(int), GFP_KERNEL);
-	if (!max_ra)
-		goto err_kmalloc_max_ra;
 
 	memset(gd->part, 0, minors * sizeof(struct hd_struct));
 
-	/* cdroms and msdos f/s are examples of non-1024 blocksizes */
-	blksize_size[hwif->major] = bs;
-	max_readahead[hwif->major] = max_ra;
-	for (unit = 0; unit < minors; ++unit) {
-		*bs++ = BLOCK_SIZE;
-		*max_ra++ = MAX_READAHEAD;
-	}
-
-	for (unit = 0; unit < units; ++unit)
+	for (unit = 0; unit < minors; unit++) {
+		blksize_size[hwif->major][unit] = BLOCK_SIZE;
 		hwif->drives[unit].part = &gd->part[unit << PARTN_BITS];
+	}
 
 	gd->major	= hwif->major;		/* our major device number */
 	gd->major_name	= IDE_MAJOR_NAME;	/* treated special in genhd.c */
@@ -875,8 +866,6 @@
 	}
 	return;
 
-err_kmalloc_max_ra:
-	kfree(bs);
 err_kmalloc_bs:
 	kfree(gd->part);
 err_kmalloc_gd_part:
@@ -937,7 +926,6 @@
 	init_gendisk(hwif);
 	blk_dev[hwif->major].data = hwif;
 	blk_dev[hwif->major].queue = ide_get_queue;
-	read_ahead[hwif->major] = 8;	/* (4kB) */
 	hwif->present = 1;	/* success */
 
 	return hwif->present;
drivers/ide/ide.c +0 -1
diff -ur linux-2.5.4/drivers/ide/ide.c linux/drivers/ide/ide.c
@@ -2126,7 +2126,6 @@
 	 */
 	unregister_blkdev(hwif->major, hwif->name);
 	kfree(blksize_size[hwif->major]);
-	kfree(max_readahead[hwif->major]);
 	blk_dev[hwif->major].data = NULL;
 	blk_dev[hwif->major].queue = NULL;
 	blk_clear(hwif->major);
drivers/md/lvm.c +0 -28
diff -ur linux-2.5.4/drivers/md/lvm.c linux/drivers/md/lvm.c
@@ -226,10 +226,6 @@
 
 #include "lvm-internal.h"
 
-#define	LVM_CORRECT_READ_AHEAD( a) \
-   if      ( a < LVM_MIN_READ_AHEAD || \
-             a > LVM_MAX_READ_AHEAD) a = LVM_MAX_READ_AHEAD;
-
 #ifndef WRITEA
 #  define WRITEA WRITE
 #endif
@@ -883,29 +879,6 @@
 		invalidate_buffers(inode->i_rdev);
 		break;
 
-
-	case BLKRASET:
-		/* set read ahead for block device */
-		if (!capable(CAP_SYS_ADMIN)) return -EACCES;
-
-		P_IOCTL("BLKRASET: %ld sectors for %s\n",
-			(long) arg, kdevname(inode->i_rdev));
-
-		if ((long) arg < LVM_MIN_READ_AHEAD ||
-		    (long) arg > LVM_MAX_READ_AHEAD)
-			return -EINVAL;
-		lv_ptr->lv_read_ahead = (long) arg;
-		break;
-
-
-	case BLKRAGET:
-		/* get current read ahead setting */
-		P_IOCTL("BLKRAGET %d\n", lv_ptr->lv_read_ahead);
-		if (put_user(lv_ptr->lv_read_ahead, (long *)arg))
-			return -EFAULT;
-		break;
-
-
 	case HDIO_GETGEO:
 		/* get disk geometry */
 		P_IOCTL("%s -- lvm_blk_ioctl -- HDIO_GETGEO\n", lvm_name);
@@ -2035,7 +2008,6 @@
 	lvm_size[minor(lv_ptr->lv_dev)] = lv_ptr->lv_size >> 1;
 	vg_lv_map[minor(lv_ptr->lv_dev)].vg_number = vg_ptr->vg_number;
 	vg_lv_map[minor(lv_ptr->lv_dev)].lv_number = lv_ptr->lv_number;
-	LVM_CORRECT_READ_AHEAD(lv_ptr->lv_read_ahead);
 	vg_ptr->lv_cur++;
 	lv_ptr->lv_status = lv_status_save;
 
drivers/md/md.c +0 -14
diff -ur linux-2.5.4/drivers/md/md.c linux/drivers/md/md.c
@@ -1737,7 +1737,6 @@
 	register_disk(&md_gendisk, mk_kdev(MAJOR_NR,mdidx(mddev)),
 			1, &md_fops, md_size[mdidx(mddev)]<<1);
 
-	read_ahead[MD_MAJOR] = 1024;
 	return (0);
 }
 
@@ -2622,8 +2621,6 @@
 						(u64 *) arg);
 			goto done;
 
-		case BLKRAGET:
-		case BLKRASET:
 		case BLKFLSBUF:
 		case BLKBSZGET:
 		case BLKBSZSET:
@@ -3176,13 +3173,6 @@
 
 	sz += sprintf(page+sz, "\n");
 
-
-	sz += sprintf(page+sz, "read_ahead ");
-	if (read_ahead[MD_MAJOR] == INT_MAX)
-		sz += sprintf(page+sz, "not set\n");
-	else
-		sz += sprintf(page+sz, "%d sectors\n", read_ahead[MD_MAJOR]);
-
 	ITERATE_MDDEV(mddev,tmp) {
 		sz += sprintf(page + sz, "md%d : %sactive", mdidx(mddev),
 						mddev->pers ? "" : "in");
@@ -3622,7 +3612,6 @@
 	}
 	blksize_size[MAJOR_NR] = md_blocksizes;
 	blk_size[MAJOR_NR] = md_size;
-	max_readahead[MAJOR_NR] = md_maxreadahead;
 
 	dprintk("md: sizeof(mdp_super_t) = %d\n", (int)sizeof(mdp_super_t));
 
@@ -3658,9 +3647,6 @@
 	/* forward all md request to md_make_request */
 	blk_queue_make_request(BLK_DEFAULT_QUEUE(MAJOR_NR), md_make_request);
 
-
-	read_ahead[MAJOR_NR] = INT_MAX;
-
 	add_gendisk(&md_gendisk);
 
 	md_recovery_thread = md_register_thread(md_do_recovery, NULL, name);
drivers/message/i2o/i2o_block.c +0 -2
diff -ur linux-2.5.4/drivers/message/i2o/i2o_block.c linux/drivers/message/i2o/i2o_block.c
@@ -1104,8 +1104,6 @@
 		case BLKFLSBUF:
 		case BLKROSET:
 		case BLKROGET:
-		case BLKRASET:
-		case BLKRAGET:
 		case BLKPG:
 			return blk_ioctl(inode->i_rdev, cmd, arg);
 			
drivers/s390/block/dasd.c +0 -2
diff -ur linux-2.5.4/drivers/s390/block/dasd.c linux/drivers/s390/block/dasd.c
@@ -2489,8 +2489,6 @@
 	case BLKSSZGET:
 	case BLKROSET:
 	case BLKROGET:
-	case BLKRASET:
-	case BLKRAGET:
 	case BLKFLSBUF:
 	case BLKPG:
 	case BLKELVGET:
drivers/s390/block/xpram.c +2 -23
diff -ur linux-2.5.4/drivers/s390/block/xpram.c linux/drivers/s390/block/xpram.c
@@ -163,12 +163,11 @@
 
 static int major    = XPRAM_MAJOR;
 static int devs     = XPRAM_DEVS;
-static int rahead   = XPRAM_RAHEAD;
 static int sizes[XPRAM_MAX_DEVS] = { 0, };
 static int blksize  = XPRAM_BLKSIZE;
 static int hardsect = XPRAM_HARDSECT;
 
-int xpram_devs, xpram_rahead;
+int xpram_devs;
 int xpram_blksize, xpram_hardsect;
 int xpram_mem_avail = 0;
 unsigned long xpram_sizes[XPRAM_MAX_DEVS];
@@ -659,26 +658,9 @@
 		if ( capable(CAP_SYS_ADMIN) )invalidate_buffers(inode->i_rdev);
 		return 0;
 
-	case BLKRAGET: /* return the readahead value, 0x1263 */
-		if (!arg)  return -EINVAL;
-		err = 0; /* verify_area_20(VERIFY_WRITE, (long *) arg, sizeof(long));
-		          * if (err) return err;
-                          */
-		put_user(read_ahead[MAJOR(inode->i_rdev)], (long *)arg);
-
-		return 0;
-
-	case BLKRASET: /* set the readahead value, 0x1262 */
-		if (!capable(CAP_SYS_ADMIN)) return -EACCES;
-		if (arg > 0xff) return -EINVAL; /* limit it */
-		read_ahead[MAJOR(inode->i_rdev)] = arg;
-                atomic_eieio();
-		return 0;
-
 	case BLKRRPART: /* re-read partition table: can't do it, 0x1259 */
 		return -EINVAL;
 
-
 #if (XPRAM_VERSION == 22)
 		RO_IOCTLS(inode->i_rdev, arg); /* the default RO operations 
                                                 * BLKROSET
@@ -940,7 +922,6 @@
 				 * snoozing with a debugger.
 				 */
 
-	xpram_rahead   = rahead;
 	xpram_blksize  = blksize;
 	xpram_hardsect = hardsect;
 
@@ -1029,7 +1010,7 @@
 	PRINT_INFO("  %d kB expanded memory found.\n",xpram_mem_avail );
 
 	/*
-	 * Assign the other needed values: request, rahead, size, blksize,
+	 * Assign the other needed values: request, size, blksize,
 	 * hardsect. All the minor devices feature the same value.
 	 * Note that `xpram' defines all of them to allow testing non-default
 	 * values. A real device could well avoid setting values in global
@@ -1042,7 +1023,6 @@
 	q = BLK_DEFAULT_QUEUE (major);
 	blk_init_queue (q, xpram_request);
 #endif /* V22/V24 */
-	read_ahead[major] = xpram_rahead;
 
 	/* we want to have XPRAM_UNUSED blocks security buffer between devices */
 	mem_usable=xpram_mem_avail-(XPRAM_UNUSED*(xpram_devs-1));
@@ -1181,7 +1161,6 @@
 	kfree(xpram_hardsects);
 	hardsect_size[major] = NULL;
  fail_malloc:
-	read_ahead[major] = 0;
 #if (XPRAM_VERSION == 22)
 	blk_dev[major].request_fn = NULL;
 #endif /* V22 */
drivers/s390/block/xpram.h +0 -1
diff -ur linux-2.5.4/drivers/s390/block/xpram.h linux/drivers/s390/block/xpram.h
@@ -18,7 +18,6 @@
 #define XPRAM_NAME "xpram"  /* name of device/module */
 #define XPRAM_DEVICE_NAME_PREFIX "slram" /* Prefix device name for major 35 */
 #define XPRAM_DEVS 1        /* one partition */
-#define XPRAM_RAHEAD 8      /* no real read ahead */
 #define XPRAM_PGSIZE 4096   /* page size of (expanded) mememory pages
                              * according to S/390 architecture
                              */
drivers/s390/char/tapeblock.c +0 -1
diff -ur linux-2.5.4/drivers/s390/char/tapeblock.c linux/drivers/s390/char/tapeblock.c
@@ -101,7 +101,6 @@
     }
     if (tapeblock_major == 0) tapeblock_major = result;   /* accept dynamic major number*/
     INIT_BLK_DEV(tapeblock_major,tape_request_fn,tapeblock_getqueue,NULL);
-    read_ahead[tapeblock_major]=TAPEBLOCK_READAHEAD;
     PRINT_WARN(KERN_ERR " tape gets major %d for block device\n", result);
     blk_size[tapeblock_major] = (int*) kmalloc (256*sizeof(int),GFP_ATOMIC);
     memset(blk_size[tapeblock_major],0,256*sizeof(int));
drivers/scsi/sd.c +0 -14
diff -ur linux-2.5.4/drivers/scsi/sd.c linux/drivers/scsi/sd.c
@@ -228,8 +228,6 @@
 		case BLKGETSIZE64:
 		case BLKROSET:
 		case BLKROGET:
-		case BLKRASET:
-		case BLKRAGET:
 		case BLKFLSBUF:
 		case BLKSSZGET:
 		case BLKPG:
@@ -1190,18 +1188,6 @@
 				rscsi_disks[i].has_part_table = 1;
 			}
 		}
-	/* If our host adapter is capable of scatter-gather, then we increase
-	 * the read-ahead to 60 blocks (120 sectors).  If not, we use
-	 * a two block (4 sector) read ahead. We can only respect this with the
-	 * granularity of every 16 disks (one device major).
-	 */
-	for (i = 0; i < N_USED_SD_MAJORS; i++) {
-		read_ahead[SD_MAJOR(i)] =
-		    (rscsi_disks[i * SCSI_DISKS_PER_MAJOR].device
-		     && rscsi_disks[i * SCSI_DISKS_PER_MAJOR].device->host->sg_tablesize)
-		    ? 120	/* 120 sector read-ahead */
-		    : 4;	/* 4 sector read-ahead */
-	}
 
 	return;
 }
drivers/scsi/sr.c +0 -11
diff -ur linux-2.5.4/drivers/scsi/sr.c linux/drivers/scsi/sr.c
@@ -785,16 +785,6 @@
                                     &sr_bdops, NULL);
 		register_cdrom(&scsi_CDs[i].cdi);
 	}
-
-
-	/* If our host adapter is capable of scatter-gather, then we increase
-	 * the read-ahead to 16 blocks (32 sectors).  If not, we use
-	 * a two block (4 sector) read ahead. */
-	if (scsi_CDs[0].device && scsi_CDs[0].device->host->sg_tablesize)
-		read_ahead[MAJOR_NR] = 32;	/* 32 sector read-ahead.  Always removable. */
-	else
-		read_ahead[MAJOR_NR] = 4;	/* 4 sector read-ahead */
-
 }
 
 static void sr_detach(Scsi_Device * SDp)
@@ -846,7 +836,6 @@
 		kfree(sr_blocksizes);
 		sr_blocksizes = NULL;
 	}
-	read_ahead[MAJOR_NR] = 0;
 	blk_clear(MAJOR_NR);
 
 	sr_template.dev_max = 0;
drivers/scsi/sr_ioctl.c +0 -2
diff -ur linux-2.5.4/drivers/scsi/sr_ioctl.c linux/drivers/scsi/sr_ioctl.c
@@ -550,8 +550,6 @@
 		return put_user((u64)scsi_CDs[target].capacity << 9, (u64 *)arg);
 	case BLKROSET:
 	case BLKROGET:
-	case BLKRASET:
-	case BLKRAGET:
 	case BLKFLSBUF:
 	case BLKSSZGET:
 		return blk_ioctl(cdi->dev, cmd, arg);
fs/hfs/file.c +2 -11
diff -ur linux-2.5.4/fs/hfs/file.c linux/fs/hfs/file.c
@@ -163,8 +163,7 @@
 	if (left <= 0) {
 		return 0;
 	}
-	if ((read = hfs_do_read(inode, HFS_I(inode)->fork, pos,
-				buf, left, filp->f_reada != 0)) > 0) {
+	if ((read = hfs_do_read(inode, HFS_I(inode)->fork, pos, buf, left)) > 0) {
 	        *ppos += read;
 		filp->f_reada = 1;
 	}
@@ -288,7 +287,7 @@
  * It has been changed to take into account that HFS files have no holes.
  */
 hfs_s32 hfs_do_read(struct inode *inode, struct hfs_fork * fork, hfs_u32 pos,
-		    char * buf, hfs_u32 count, int reada)
+		    char * buf, hfs_u32 count)
 {
 	kdev_t dev = inode->i_dev;
 	hfs_s32 size, chars, offset, block, blocks, read = 0;
@@ -309,14 +308,6 @@
 	blocks = (count+offset+HFS_SECTOR_SIZE-1) >> HFS_SECTOR_SIZE_BITS;
 
 	bhb = bhe = buflist;
-	if (reada) {
-		if (blocks < read_ahead[major(dev)] / (HFS_SECTOR_SIZE>>9)) {
-			blocks = read_ahead[major(dev)] / (HFS_SECTOR_SIZE>>9);
-		}
-		if (block + blocks > size) {
-			blocks = size - block;
-		}
-	}
 
 	/* We do this in a two stage process.  We first try and
 	   request as many blocks as we can, then we wait for the
include/linux/blkdev.h +0 -5
diff -ur linux-2.5.4/include/linux/blkdev.h linux/include/linux/blkdev.h
@@ -314,11 +314,8 @@
 extern void generic_unplug_device(void *);
 
 extern int * blk_size[MAX_BLKDEV];
-
 extern int * blksize_size[MAX_BLKDEV];
 
-extern int * max_readahead[MAX_BLKDEV];
-
 #define MAX_PHYS_SEGMENTS 128
 #define MAX_HW_SEGMENTS 128
 #define MAX_SECTORS 255
@@ -340,8 +337,6 @@
 	blk_size_in_bytes[major] = NULL;
 #endif
 	blksize_size[major] = NULL;
-	max_readahead[major] = NULL;
-	read_ahead[major] = 0;
 }
 
 extern inline int get_hardsect_size(kdev_t dev)
include/linux/fs.h +3 -3
diff -ur linux-2.5.4/include/linux/fs.h linux/include/linux/fs.h
@@ -173,10 +173,12 @@
 #define BLKRRPART  _IO(0x12,95)	/* re-read partition table */
 #define BLKGETSIZE _IO(0x12,96)	/* return device size /512 (long *arg) */
 #define BLKFLSBUF  _IO(0x12,97)	/* flush buffer cache */
-#define BLKRASET   _IO(0x12,98)	/* Set read ahead for block device */
+#if 0				/* Obsolete, these don't do anything. */
+#define BLKRASET   _IO(0x12,98)	/* set read ahead for block device */
 #define BLKRAGET   _IO(0x12,99)	/* get current read ahead setting */
 #define BLKFRASET  _IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
 #define BLKFRAGET  _IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */
+#endif
 #define BLKSECTSET _IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */
 #define BLKSECTGET _IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
 #define BLKSSZGET  _IO(0x12,104)/* get block device sector size */
@@ -1490,8 +1492,6 @@
 
 extern ssize_t char_read(struct file *, char *, size_t, loff_t *);
 extern ssize_t block_read(struct file *, char *, size_t, loff_t *);
-extern int read_ahead[];
-
 extern ssize_t char_write(struct file *, const char *, size_t, loff_t *);
 extern ssize_t block_write(struct file *, const char *, size_t, loff_t *);
 
include/linux/lvm.h +0 -1
diff -ur linux-2.5.4/include/linux/lvm.h linux/include/linux/lvm.h
@@ -498,7 +498,6 @@
 	uint lv_badblock;	/* for future use */
 	uint lv_allocation;
 	uint lv_io_timeout;	/* for future use */
-	uint lv_read_ahead;
 
 	/* delta to version 1 starts here */
        struct lv_v5 *lv_snapshot_org;
kernel/ksyms.c +0 -2
diff -ur linux-2.5.4/kernel/ksyms.c linux/kernel/ksyms.c
@@ -321,7 +321,6 @@
 EXPORT_SYMBOL(tq_disk);
 EXPORT_SYMBOL(init_buffer);
 EXPORT_SYMBOL(refile_buffer);
-EXPORT_SYMBOL(max_readahead);
 EXPORT_SYMBOL(wipe_partitions);
 
 /* tty routines */
@@ -521,7 +520,6 @@
 EXPORT_SYMBOL(clear_inode);
 EXPORT_SYMBOL(___strtok);
 EXPORT_SYMBOL(init_special_inode);
-EXPORT_SYMBOL(read_ahead);
 EXPORT_SYMBOL(__get_hash_table);
 EXPORT_SYMBOL(new_inode);
 EXPORT_SYMBOL(insert_inode_hash);
mm/filemap.c +6 -15
diff -ur linux-2.5.4/mm/filemap.c linux/mm/filemap.c
@@ -1131,13 +1131,6 @@
  *   64k if defined (4K page size assumed).
  */
 
-static inline int get_max_readahead(struct inode * inode)
-{
-	if (kdev_none(inode->i_dev) || !max_readahead[major(inode->i_dev)])
-		return MAX_READAHEAD;
-	return max_readahead[major(inode->i_dev)][minor(inode->i_dev)];
-}
-
 static void generic_file_readahead(int reada_ok,
 	struct file * filp, struct inode * inode,
 	struct page * page)
@@ -1146,7 +1139,6 @@
 	unsigned long index = page->index;
 	unsigned long max_ahead, ahead;
 	unsigned long raend;
-	int max_readahead = get_max_readahead(inode);
 
 	end_index = inode->i_size >> PAGE_CACHE_SHIFT;
 
@@ -1231,8 +1223,8 @@
 
 		filp->f_ramax += filp->f_ramax;
 
-		if (filp->f_ramax > max_readahead)
-			filp->f_ramax = max_readahead;
+		if (filp->f_ramax > MAX_READAHEAD)
+			filp->f_ramax = MAX_READAHEAD;
 
 #ifdef PROFILE_READAHEAD
 		profile_readahead((reada_ok == 2), filp);
@@ -1278,7 +1270,6 @@
 	struct page *cached_page;
 	int reada_ok;
 	int error;
-	int max_readahead = get_max_readahead(inode);
 
 	cached_page = NULL;
 	index = *ppos >> PAGE_CACHE_SHIFT;
@@ -1318,9 +1309,9 @@
 			filp->f_ramax = needed;
 
 		if (reada_ok && filp->f_ramax < MIN_READAHEAD)
-				filp->f_ramax = MIN_READAHEAD;
-		if (filp->f_ramax > max_readahead)
-			filp->f_ramax = max_readahead;
+			filp->f_ramax = MIN_READAHEAD;
+		if (filp->f_ramax > MAX_READAHEAD)
+			filp->f_ramax = MAX_READAHEAD;
 	}
 
 	for (;;) {
@@ -1808,7 +1799,7 @@
 {
 	unsigned long ra_window;
 
-	ra_window = get_max_readahead(vma->vm_file->f_dentry->d_inode);
+	ra_window = MAX_READAHEAD;
 	ra_window = CLUSTER_OFFSET(ra_window + CLUSTER_PAGES - 1);
 
 	/* vm_raend is zero if we haven't read ahead in this area yet.  */
#14 lore raw
In reply to Pavel Machek
Quoted 7 lines · Martin Dalecki

Anyway, you apparently still missed to kill:

int *bs, max_ra; in ide-probe.c

as well as: xpram_rahead and friends in s390 code

The attached patch is fixing this.

Thanks.

Quoted 4 lines

BTW.> Since there is no longer any difference about the request head handling between IDE and SCSI, what about the idea of moving the whole ide interface stuff under the umbrella of SCSI host adapter? This would be a true cleanup and make the whole ide-scsi and ide-atapi mess

Quoted 8 lines

go away. IDE is moving fast toward SCSI on the logical level anyway and it would make the hwif macro/lookup crap in the ide code go magically way! At least this generic device handler search stuff should be merged between them (I'm trully tempted to give it a shoot this afternoon.) The only thing it could result in, which would maybe surprise some would be the fact that the major of his root device could just go suddenly away... But hey! What's the heck - we are in odd kernel series anyway ;-).

This is an idea I'm toying with for quite a long time already. And I think this is a good idea as well. I have no more time to spend coding today, so if you have the afternoon, but I'll definitely find some to read the diff if you do this change!

Signature · 2 lines
Vojtech Pavlik
SuSE Labs
#15 lore raw

Just maybe if the LOT of you would back off you may see

Uniform Storage Driver.

Just catch a clue for two seconds and see that I have packetized the ATA-Command Block IO. Since you have not a clue of why it was done, please continue with your hair brained ideas.

Ever heard of SAS or FPDMA ?

Don't screw with what you do not know about.

Quoted 25 lines · Vojtech Pavlik
Quoted 7 lines · Martin Dalecki

Anyway, you apparently still missed to kill:

int *bs, max_ra; in ide-probe.c

as well as: xpram_rahead and friends in s390 code

The attached patch is fixing this.

Thanks.

Quoted 4 lines

BTW.> Since there is no longer any difference about the request head handling between IDE and SCSI, what about the idea of moving the whole ide interface stuff under the umbrella of SCSI host adapter? This would be a true cleanup and make the whole ide-scsi and ide-atapi mess

Quoted 8 lines

go away. IDE is moving fast toward SCSI on the logical level anyway and it would make the hwif macro/lookup crap in the ide code go magically way! At least this generic device handler search stuff should be merged between them (I'm trully tempted to give it a shoot this afternoon.) The only thing it could result in, which would maybe surprise some would be the fact that the major of his root device could just go suddenly away... But hey! What's the heck - we are in odd kernel series anyway ;-).

Quoted 14 lines

This is an idea I'm toying with for quite a long time already. And I think this is a good idea as well. I have no more time to spend coding today, so if you have the afternoon, but I'll definitely find some to read the diff if you do this change!

Signature · 7 lines
Vojtech Pavlik
SuSE Labs
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Andre Hedrick
Linux Disk Certification Project Linux ATA Development

#16 lore raw
Quoted 4 lines · Andre Hedrick

Just maybe if the LOT of you would back off you may see

Uniform Storage Driver.

Quoted 8 lines

Just catch a clue for two seconds and see that I have packetized the ATA-Command Block IO. Since you have not a clue of why it was done, please continue with your hair brained ideas.

Ever heard of SAS or FPDMA ?

Don't screw with what you do not know about.

Well, after looking at yours code close engough I have one advice for you as well: LEARN C.

#17 lore raw
Quoted 10 lines · Martin Dalecki
Quoted 8 lines · Andre Hedrick

Just maybe if the LOT of you would back off you may see

Uniform Storage Driver.

Just catch a clue for two seconds and see that I have packetized the ATA-Command Block IO. Since you have not a clue of why it was done, please continue with your hair brained ideas.

Quoted 6 lines
Quoted 4 lines

Ever heard of SAS or FPDMA ?

Don't screw with what you do not know about.

Well, after looking at yours code close engough I have one advice for you as well: LEARN C.

I specialize in storage, and C is self taught.

Cheers,

Andre Hedrick
Linux Disk Certification Project Linux ATA Development

#18 lore raw
In reply to Martin Dalecki

Hi!

Quoted 4 lines
Quoted 2 lines

Well, after looking at yours code close engough I have one advice for you as well: LEARN C.

I specialize in storage, and C is self taught.

Okay, few things to keep in mind:

*) cut-copy-paste is bad. If you fix error in one copy, it is _very_ easy not to fix it in other copies.

*) void *'s and casts are bad. They hide real errors. If you have

struct foo {} bar;

and want

bar * baz;

later;

You can write it as struct foo * baz. That will make type checks actually work and save you lot of casts.

*) hungarian notation is considered evil in kernel.

struct bla_s {} bla_t;

*is* evil -- why have two types when one is enough? In kernel land, right way is to do

struct bla {};

and then use "struct bla" everywhere you'd use bla_t. It might be slightly longer, but it helps you with casts (above) and everyone can see what is going on.

Pavel

Signature · 2 lines
Casualities in World Trade Center: ~3k dead inside the building,
cryptography in U.S.A. and free speech in Czech Republic.
#19 lore raw
In reply to Martin Dalecki
Quoted 29 lines · Pavel Machek

Hi!

Quoted 4 lines
Quoted 2 lines

Well, after looking at yours code close engough I have one advice for you as well: LEARN C.

I specialize in storage, and C is self taught.

Okay, few things to keep in mind:

*) cut-copy-paste is bad. If you fix error in one copy, it is _very_ easy not to fix it in other copies.

*) void *'s and casts are bad. They hide real errors. If you have

struct foo {} bar;

and want

bar * baz;

later;

You can write it as struct foo * baz. That will make type checks actually work and save you lot of casts.

*) hungarian notation is considered evil in kernel.

struct bla_s {} bla_t;

Quoted 9 lines

*is* evil -- why have two types when one is enough? In kernel land, right way is to do

struct bla {};

and then use "struct bla" everywhere you'd use bla_t. It might be slightly longer, but it helps you with casts (above) and everyone can see what is going on.

Add the following:
Silly code like that:

ide_add_setting(drive, "bios_cyl",
SETTING_RW,
ide_add_setting(drive, "bios_sect",
SETTING_RW,
ide_add_setting(drive, "bswap",
SETTING_READ,
ide_add_setting(drive, "multcount", id ? SETTING_RW
: SETTIN

Can be replaced with somthing along:

struct resource_record {
} rr = {
{ asjdkasdh, asdjhasjkd, asdjhjaskd }
....
{ asdjaksd, adsjaksd, asdhjasdhasd }
}

....

for (i; i < nuofmemebers(rr); ++i )
{
ide_add_setting(rr[i]);
}

to save you *a lot* of push stack call function and so on...

#20 lore raw
In reply to Martin Dalecki
Quoted 4 lines · Martin Dalecki

Silly code like that:

ide_add_setting(drive, "bios_cyl",
SETTING_RW,

Why do you call it "silly" to encapsulate all that stuff and create and change attributes (bios_cyl) through an object (drive)? I fail to see your point, looks rather like bash & flame. It's not silly because it's a different approach or style.

Signature · 4 lines
Matthias Andree

"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety."         Benjamin Franklin
#21 lore raw
In reply to Vojtech Pavlik
Quoted 7 lines · Andre Hedrick

Just maybe if the LOT of you would back off you may see

Uniform Storage Driver.

Just catch a clue for two seconds and see that I have packetized the ATA-Command Block IO. Since you have not a clue of why it was done, please continue with your hair brained ideas.

Maybe we're talking all about the same thing, can you consider that possibility?

Quoted 1 line

Ever heard of SAS or FPDMA ?

No, sorry, and I checked Google and Google has neither. Perhaps they don't exist (yet)?

Quoted 1 line

Don't screw with what you do not know about.

I don't see any SAS or FPDMA in the kernel. Thus I'm screwing only with stuff I know about.

Quoted 50 lines · Vojtech Pavlik
Quoted 26 lines · Martin Dalecki
Quoted 8 lines

Anyway, you apparently still missed to kill:

int *bs, max_ra; in ide-probe.c

as well as: xpram_rahead and friends in s390 code

The attached patch is fixing this.

Thanks.

Quoted 4 lines

BTW.> Since there is no longer any difference about the request head handling between IDE and SCSI, what about the idea of moving the whole ide interface stuff under the umbrella of SCSI host adapter? This would be a true cleanup and make the whole ide-scsi and ide-atapi mess

Quoted 8 lines

go away. IDE is moving fast toward SCSI on the logical level anyway and it would make the hwif macro/lookup crap in the ide code go magically way! At least this generic device handler search stuff should be merged between them (I'm trully tempted to give it a shoot this afternoon.) The only thing it could result in, which would maybe surprise some would be the fact that the major of his root device could just go suddenly away... But hey! What's the heck - we are in odd kernel series anyway ;-).

Quoted 14 lines

This is an idea I'm toying with for quite a long time already. And I think this is a good idea as well. I have no more time to spend coding today, so if you have the afternoon, but I'll definitely find some to read the diff if you do this change!

Signature · 7 lines
Vojtech Pavlik
SuSE Labs
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Andre Hedrick
Linux Disk Certification Project Linux ATA Development

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 2 lines
Vojtech Pavlik
SuSE Labs
#22 lore raw
In reply to Vojtech Pavlik

After checking the patch from yerstoday I have found that there is a small typo in your IDE cleanup, which is causing oop es on my computer. The attached patch 5.1 is fixing this. The attached patch 6 is combining everything and works fine for my computer.

Due to the need to debug this and to get 2.5.4 working at all, I wasn't unfortunately able to do much more then analysis of the ide code. Apparently it's clear that ide-tape, ide-cd and ide-floppy all could just be removed, if the IDE detection routines would ignore atapi devices per defualt.

drivers/ide/ide-disk.c +0 -2
diff -ur linux-2.5.4/drivers/ide/ide-disk.c linux/drivers/ide/ide-disk.c
@@ -890,8 +890,6 @@
 static void idedisk_add_settings(ide_drive_t *drive)
 {
 	struct hd_driveid *id = drive->id;
-	int major = HWIF(drive)->major;
-	int minor = drive->select.b.unit << PARTN_BITS;
 
 	ide_add_setting(drive,	"bios_cyl",		SETTING_RW,					-1,			-1,			TYPE_INT,	0,	65535,				1,	1,	&drive->bios_cyl,		NULL);
 	ide_add_setting(drive,	"bios_head",		SETTING_RW,					-1,			-1,			TYPE_BYTE,	0,	255,				1,	1,	&drive->bios_head,		NULL);
drivers/ide/ide-probe.c +4 -4
diff -ur linux-2.5.4/drivers/ide/ide-probe.c linux/drivers/ide/ide-probe.c
@@ -788,7 +788,7 @@
 static void init_gendisk (ide_hwif_t *hwif)
 {
 	struct gendisk *gd;
-	unsigned int unit, units, minors;
+	unsigned int unit, units, minors, i;
 	extern devfs_handle_t ide_devfs_handle;
 
 #if 1
@@ -818,10 +818,10 @@
 
 	memset(gd->part, 0, minors * sizeof(struct hd_struct));
 
-	for (unit = 0; unit < minors; unit++) {
-		blksize_size[hwif->major][unit] = BLOCK_SIZE;
+	for (i = 0; i < minors; ++i)
+	    blksize_size[hwif->major][i] = BLOCK_SIZE;
+	for (unit = 0; unit < units; ++unit)
 		hwif->drives[unit].part = &gd->part[unit << PARTN_BITS];
-	}
 
 	gd->major	= hwif->major;		/* our major device number */
 	gd->major_name	= IDE_MAJOR_NAME;	/* treated special in genhd.c */
mm/filemap.c +2 -3
diff -ur linux-2.5.4/mm/filemap.c linux/mm/filemap.c
@@ -1120,7 +1120,7 @@
  *
  * Asynchronous read-ahead risks:
  * ------------------------------
- * In order to maximize overlapping, we must start some asynchronous read 
+ * In order to maximize overlapping, we must start some asynchronous read
  * request from the device, as soon as possible.
  * We must be very careful about:
  * - The number of effective pending IO read requests.
@@ -1799,8 +1799,7 @@
 {
 	unsigned long ra_window;
 
-	ra_window = MAX_READAHEAD;
-	ra_window = CLUSTER_OFFSET(ra_window + CLUSTER_PAGES - 1);
+	ra_window = CLUSTER_OFFSET(MAX_READAHEAD + CLUSTER_PAGES - 1);
 
 	/* vm_raend is zero if we haven't read ahead in this area yet.  */
 	if (vma->vm_raend == 0)
Documentation/cdrom/sbpcd +2 -8
diff -ur linux-2.5.4/Documentation/cdrom/sbpcd linux/Documentation/cdrom/sbpcd
@@ -613,8 +613,8 @@
 	printf("READ          d      READ RAW     w       READ AUDIO   A\n");
 	printf("MS-INFO       M      TOC          T       START        S\n");
 	printf("SET EJECTSW   X      DEVICE       D       DEBUG        Y\n");
-	printf("AUDIO_BUFSIZ  Z      RESET        R       BLKRASET     B\n");
-	printf("SET VOLUME    v      GET VOLUME   V\n");
+	printf("AUDIO_BUFSIZ  Z      RESET        R       SET VOLUME   v\n");
+	printf("GET VOLUME    V\n");
 }
 
 /*
@@ -882,12 +882,6 @@
 			rc=ioctl(drive,CDROMRESET);
 			if (rc<0) printf("CDROMRESET: rc=%d.\n",rc);
 			break;
-		case 'B': /* set the driver's (?) read ahead value */
-			printf("enter read-ahead size: ? ");
-			scanf("%d",&i);
-			rc=ioctl(drive,BLKRASET,i);
-			if (rc<0) printf("BLKRASET: rc=%d.\n",rc);
-			break;
 #ifdef AZT_PRIVATE_IOCTLS /*not supported by every CDROM driver*/
 		case 'd':
 			printf("Address (min:sec:frm)  ");
arch/mips64/kernel/ioctl32.c +0 -4
diff -ur linux-2.5.4/arch/mips64/kernel/ioctl32.c linux/arch/mips64/kernel/ioctl32.c
@@ -760,10 +760,6 @@
 	IOCTL32_HANDLER(BLKGETSIZE, w_long),
 
 	IOCTL32_DEFAULT(BLKFLSBUF),
-	IOCTL32_DEFAULT(BLKRASET),
-	IOCTL32_HANDLER(BLKRAGET, w_long),
-	IOCTL32_DEFAULT(BLKFRASET),
-	IOCTL32_HANDLER(BLKFRAGET, w_long),
 	IOCTL32_DEFAULT(BLKSECTSET),
 	IOCTL32_HANDLER(BLKSECTGET, w_long),
 	IOCTL32_DEFAULT(BLKSSZGET),
arch/sparc64/kernel/ioctl32.c +0 -4
diff -ur linux-2.5.4/arch/sparc64/kernel/ioctl32.c linux/arch/sparc64/kernel/ioctl32.c
@@ -3997,8 +3997,6 @@
 COMPATIBLE_IOCTL(BLKROGET)
 COMPATIBLE_IOCTL(BLKRRPART)
 COMPATIBLE_IOCTL(BLKFLSBUF)
-COMPATIBLE_IOCTL(BLKRASET)
-COMPATIBLE_IOCTL(BLKFRASET)
 COMPATIBLE_IOCTL(BLKSECTSET)
 COMPATIBLE_IOCTL(BLKSSZGET)
 COMPATIBLE_IOCTL(BLKBSZGET)
@@ -4626,10 +4624,8 @@
 HANDLE_IOCTL(SIOCRTMSG, ret_einval)
 HANDLE_IOCTL(SIOCGSTAMP, do_siocgstamp)
 HANDLE_IOCTL(HDIO_GETGEO, hdio_getgeo)
-HANDLE_IOCTL(BLKRAGET, w_long)
 HANDLE_IOCTL(BLKGETSIZE, w_long)
 HANDLE_IOCTL(0x1260, broken_blkgetsize)
-HANDLE_IOCTL(BLKFRAGET, w_long)
 HANDLE_IOCTL(BLKSECTGET, w_long)
 HANDLE_IOCTL(BLKPG, blkpg_ioctl_trans)
 HANDLE_IOCTL(FBIOPUTCMAP32, fbiogetputcmap)
drivers/acorn/block/mfmhd.c +0 -12
diff -ur linux-2.5.4/drivers/acorn/block/mfmhd.c linux/drivers/acorn/block/mfmhd.c
@@ -1208,15 +1208,6 @@
 			return -EFAULT;
 		return 0;
 
-	case BLKFRASET:
-		if (!capable(CAP_SYS_ADMIN))
-			return -EACCES;
-		max_readahead[major][minor] = arg;
-		return 0;
-
-	case BLKFRAGET:
-		return put_user(max_readahead[major][minor], (long *) arg);
-
 	case BLKSECTGET:
 		return put_user(max_sectors[major][minor], (long *) arg);
 
@@ -1230,8 +1221,6 @@
 	case BLKFLSBUF:
 	case BLKROSET:
 	case BLKROGET:
-	case BLKRASET:
-	case BLKRAGET:
 	case BLKPG:
 		return blk_ioctl(dev, cmd, arg);
 
@@ -1442,7 +1431,6 @@
 	hdc63463_irqpollmask	= irqmask;
 
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST);
-	read_ahead[MAJOR_NR] = 8;	/* 8 sector (4kB?) read ahread */
 
 	add_gendisk(&mfm_gendisk);
 
drivers/block/DAC960.c +0 -6
diff -ur linux-2.5.4/drivers/block/DAC960.c linux/drivers/block/DAC960.c
@@ -1964,10 +1964,6 @@
   Controller->GenericDiskInfo.sizes = Controller->PartitionSizes;
   blksize_size[MajorNumber] = Controller->BlockSizes;
   /*
-    Initialize Read Ahead to 128 sectors.
-  */
-  read_ahead[MajorNumber] = 128;
-  /*
     Complete initialization of the Generic Disk Information structure.
   */
   Controller->GenericDiskInfo.major = MajorNumber;
@@ -5399,8 +5395,6 @@
 			   sizeof(DiskGeometry_T)) ? -EFAULT : 0);
     case BLKGETSIZE:
     case BLKGETSIZE64:
-    case BLKRAGET:
-    case BLKRASET:
     case BLKFLSBUF:
     case BLKBSZGET:
     case BLKBSZSET:
drivers/block/acsi.c +0 -1
diff -ur linux-2.5.4/drivers/block/acsi.c linux/drivers/block/acsi.c
@@ -1785,7 +1785,6 @@
 	STramMask = ATARIHW_PRESENT(EXTD_DMA) ? 0x00000000 : 0xff000000;
 	
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &acsi_lock);
-	read_ahead[MAJOR_NR] = 8;		/* 8 sector (4kB) read-ahead */
 	add_gendisk(&acsi_gendisk);
 
 #ifdef CONFIG_ATARI_SLM
drivers/block/ataflop.c +0 -2
diff -ur linux-2.5.4/drivers/block/ataflop.c linux/drivers/block/ataflop.c
@@ -1573,8 +1573,6 @@
 	switch (cmd) {
 		case BLKROSET:
 		case BLKROGET:
-		case BLKRASET:
-		case BLKRAGET:
 		case BLKFLSBUF:
 			return blk_ioctl(device, cmd, param);
 	}
drivers/block/blkpg.c +1 -26
diff -ur linux-2.5.4/drivers/block/blkpg.c linux/drivers/block/blkpg.c
@@ -29,7 +29,7 @@
  */
 
 #include <linux/errno.h>
-#include <linux/fs.h>			/* for BLKRASET, ... */
+#include <linux/fs.h>			/* for BLKROSET, ... */
 #include <linux/sched.h>		/* for capable() */
 #include <linux/blk.h>			/* for set_device_ro() */
 #include <linux/blkpg.h>
@@ -227,31 +227,6 @@
 			intval = (is_read_only(dev) != 0);
 			return put_user(intval, (int *)(arg));
 
-		case BLKRASET:
-			if(!capable(CAP_SYS_ADMIN))
-				return -EACCES;
-			if(arg > 0xff)
-				return -EINVAL;
-			read_ahead[major(dev)] = arg;
-			return 0;
-		case BLKRAGET:
-			if (!arg)
-				return -EINVAL;
-			return put_user(read_ahead[major(dev)], (long *) arg);
-
-		case BLKFRASET:
-			if (!capable(CAP_SYS_ADMIN))
-				return -EACCES;
-			if (!(iptr = max_readahead[major(dev)]))
-				return -EINVAL;
-			iptr[minor(dev)] = arg;
-			return 0;
-
-		case BLKFRAGET:
-			if (!(iptr = max_readahead[major(dev)]))
-				return -EINVAL;
-			return put_user(iptr[minor(dev)], (long *) arg);
-
 		case BLKSECTGET:
 			if ((q = blk_get_queue(dev)) == NULL)
 				return -EINVAL;
drivers/block/cciss.c +0 -3
diff -ur linux-2.5.4/drivers/block/cciss.c linux/drivers/block/cciss.c
@@ -471,8 +471,6 @@
 	case BLKBSZGET:
 	case BLKROSET:
 	case BLKROGET:
-	case BLKRASET:
-	case BLKRAGET:
 	case BLKPG:
 		return blk_ioctl(inode->i_rdev, cmd, arg);
 	case CCISS_GETPCIINFO:
@@ -2542,7 +2540,6 @@
 
 	/* fill in the other Kernel structs */
 	blksize_size[MAJOR_NR+i] = hba[i]->blocksizes;
-        read_ahead[MAJOR_NR+i] = READ_AHEAD;
 
 	/* Fill in the gendisk data */ 	
 	hba[i]->gendisk.major = MAJOR_NR + i;
drivers/block/cpqarray.c +0 -3
diff -ur linux-2.5.4/drivers/block/cpqarray.c linux/drivers/block/cpqarray.c
@@ -481,7 +481,6 @@
 		blk_queue_max_phys_segments(q, SG_MAX);
 
 		blksize_size[MAJOR_NR+i] = ida_blocksizes + (i*256);
-		read_ahead[MAJOR_NR+i] = READ_AHEAD;
 
 		ida_gendisk[i].major = MAJOR_NR + i;
 		ida_gendisk[i].major_name = "ida";
@@ -1181,8 +1180,6 @@
 	case BLKBSZGET:
 	case BLKROSET:
 	case BLKROGET:
-	case BLKRASET:
-	case BLKRAGET:
 	case BLKPG:
 		return blk_ioctl(inode->i_rdev, cmd, arg);
 
drivers/block/floppy.c +0 -2
diff -ur linux-2.5.4/drivers/block/floppy.c linux/drivers/block/floppy.c
@@ -3448,8 +3448,6 @@
 	switch (cmd) {
 		case BLKROSET:
 		case BLKROGET:
-		case BLKRASET:
-		case BLKRAGET:
 		case BLKFLSBUF:
 			return blk_ioctl(device, cmd, param);
 	}
drivers/block/ll_rw_blk.c +0 -10
diff -ur linux-2.5.4/drivers/block/ll_rw_blk.c linux/drivers/block/ll_rw_blk.c
@@ -54,10 +54,6 @@
  */
 DECLARE_TASK_QUEUE(tq_disk);
 
-/* This specifies how many sectors to read ahead on the disk. */
-
-int read_ahead[MAX_BLKDEV];
-
 /* blk_dev_struct is:
  *	request_queue
  *	*queue
@@ -84,11 +80,6 @@
 int * blksize_size[MAX_BLKDEV];
 
 /*
- * The following tunes the read-ahead algorithm in mm/filemap.c
- */
-int * max_readahead[MAX_BLKDEV];
-
-/*
  * How many reqeusts do we allocate per queue,
  * and how many do we "batch" on freeing them?
  */
@@ -1689,7 +1680,6 @@
 		dev->queue = NULL;
 
 	memset(ro_bits,0,sizeof(ro_bits));
-	memset(max_readahead, 0, sizeof(max_readahead));
 
 	total_ram = nr_free_pages() << (PAGE_SHIFT - 10);
 
drivers/block/paride/pcd.c +0 -1
diff -ur linux-2.5.4/drivers/block/paride/pcd.c linux/drivers/block/paride/pcd.c
@@ -358,7 +358,6 @@
 	}
 
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &pcd_lock);
-	read_ahead[MAJOR_NR] = 8;	/* 8 sector (4kB) read ahead */
 
 	for (i=0;i<PCD_UNITS;i++) pcd_blocksizes[i] = 1024;
         blksize_size[MAJOR_NR] = pcd_blocksizes;
drivers/block/paride/pd.c +0 -3
diff -ur linux-2.5.4/drivers/block/paride/pd.c linux/drivers/block/paride/pd.c
@@ -397,7 +397,6 @@
 	q = BLK_DEFAULT_QUEUE(MAJOR_NR);
 	blk_init_queue(q, DEVICE_REQUEST, &pd_lock);
 	blk_queue_max_sectors(q, cluster);
-        read_ahead[MAJOR_NR] = 8;       /* 8 sector (4kB) read ahead */
         
 	pd_gendisk.major = major;
 	pd_gendisk.major_name = name;
@@ -480,8 +479,6 @@
 	    case BLKGETSIZE64:
 	    case BLKROSET:
 	    case BLKROGET:
-	    case BLKRASET:
-	    case BLKRAGET:
 	    case BLKFLSBUF:
 	    case BLKPG:
 		return blk_ioctl(inode->i_rdev, cmd, arg);
drivers/block/paride/pf.c +0 -3
diff -ur linux-2.5.4/drivers/block/paride/pf.c linux/drivers/block/paride/pf.c
@@ -363,7 +363,6 @@
 	blk_init_queue(q, DEVICE_REQUEST, &pf_spin_lock);
 	blk_queue_max_phys_segments(q, cluster);
 	blk_queue_max_hw_segments(q, cluster);
-        read_ahead[MAJOR_NR] = 8;       /* 8 sector (4kB) read ahead */
         
 	for (i=0;i<PF_UNITS;i++) pf_blocksizes[i] = 1024;
 	blksize_size[MAJOR_NR] = pf_blocksizes;
@@ -433,8 +432,6 @@
                 return put_user((u64)PF.capacity << 9,(u64 *)arg);
 	    case BLKROSET:
 	    case BLKROGET:
-	    case BLKRASET:
-	    case BLKRAGET:
 	    case BLKFLSBUF:
 		return blk_ioctl(inode->i_rdev, cmd, arg);
             default:
drivers/block/ps2esdi.c +0 -3
diff -ur linux-2.5.4/drivers/block/ps2esdi.c linux/drivers/block/ps2esdi.c
@@ -177,7 +177,6 @@
 	}
 	/* set up some global information - indicating device specific info */
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &ps2esdi_lock);
-	read_ahead[MAJOR_NR] = 8;	/* 8 sector (4kB) read ahead */
 
 	/* some minor housekeeping - setup the global gendisk structure */
 	add_gendisk(&ps2esdi_gendisk);
@@ -1108,8 +1107,6 @@
 		case BLKGETSIZE64:
 		case BLKROSET:
 		case BLKROGET:
-		case BLKRASET:
-		case BLKRAGET:
 		case BLKFLSBUF:
 		case BLKBSZGET:
 		case BLKBSZSET:
drivers/block/xd.c +0 -3
diff -ur linux-2.5.4/drivers/block/xd.c linux/drivers/block/xd.c
@@ -171,7 +171,6 @@
 	}
 	devfs_handle = devfs_mk_dir (NULL, xd_gendisk.major_name, NULL);
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &xd_lock);
-	read_ahead[MAJOR_NR] = 8;	/* 8 sector (4kB) read ahead */
 	add_gendisk(&xd_gendisk);
 	xd_geninit();
 
@@ -355,8 +354,6 @@
 		case BLKFLSBUF:
 		case BLKROSET:
 		case BLKROGET:
-		case BLKRASET:
-		case BLKRAGET:
 		case BLKPG:
 			return blk_ioctl(inode->i_rdev, cmd, arg);
 
drivers/cdrom/aztcd.c +0 -1
diff -ur linux-2.5.4/drivers/cdrom/aztcd.c linux/drivers/cdrom/aztcd.c
@@ -1927,7 +1927,6 @@
 	}
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &aztSpin);
 	blksize_size[MAJOR_NR] = aztcd_blocksizes;
-	read_ahead[MAJOR_NR] = 4;
 	register_disk(NULL, mk_kdev(MAJOR_NR, 0), 1, &azt_fops, 0);
 
 	if ((azt_port == 0x1f0) || (azt_port == 0x170))
drivers/cdrom/cdu31a.c +0 -1
diff -ur linux-2.5.4/drivers/cdrom/cdu31a.c linux/drivers/cdrom/cdu31a.c
@@ -3442,7 +3442,6 @@
 		blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR),
 			       DEVICE_REQUEST,
 			       &cdu31a_lock);
-		read_ahead[MAJOR_NR] = CDU31A_READAHEAD;
 		cdu31a_block_size = 1024;	/* 1kB default block size */
 		/* use 'mount -o block=2048' */
 		blksize_size[MAJOR_NR] = &cdu31a_block_size;
drivers/cdrom/cm206.c +0 -1
diff -ur linux-2.5.4/drivers/cdrom/cm206.c linux/drivers/cdrom/cm206.c
@@ -1503,7 +1503,6 @@
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST,
 		       &cm206_lock);
 	blksize_size[MAJOR_NR] = cm206_blocksizes;
-	read_ahead[MAJOR_NR] = 16;	/* reads ahead what? */
 	init_bh(CM206_BH, cm206_bh);
 
 	memset(cd, 0, sizeof(*cd));	/* give'm some reasonable value */
drivers/cdrom/gscd.c +0 -1
diff -ur linux-2.5.4/drivers/cdrom/gscd.c linux/drivers/cdrom/gscd.c
@@ -1022,7 +1022,6 @@
 
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &gscd_lock);
 	blksize_size[MAJOR_NR] = gscd_blocksizes;
-	read_ahead[MAJOR_NR] = 4;
 
 	disk_state = 0;
 	gscdPresent = 1;
drivers/cdrom/mcd.c +0 -1
diff -ur linux-2.5.4/drivers/cdrom/mcd.c linux/drivers/cdrom/mcd.c
@@ -1075,7 +1075,6 @@
 	blksize_size[MAJOR_NR] = mcd_blocksizes;
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST,
 		       &mcd_spinlock);
-	read_ahead[MAJOR_NR] = 4;
 
 	/* check for card */
 
drivers/cdrom/mcdx.c +0 -1
diff -ur linux-2.5.4/drivers/cdrom/mcdx.c linux/drivers/cdrom/mcdx.c
@@ -1184,7 +1184,6 @@
 
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST,
 		       &mcdx_lock);
-	read_ahead[MAJOR_NR] = READ_AHEAD;
 	blksize_size[MAJOR_NR] = mcdx_blocksizes;
 
 	xtrace(INIT, "init() subscribe irq and i/o\n");
drivers/cdrom/optcd.c +0 -1
diff -ur linux-2.5.4/drivers/cdrom/optcd.c linux/drivers/cdrom/optcd.c
@@ -2062,7 +2062,6 @@
 	blksize_size[MAJOR_NR] = &blksize;
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST,
 		       &optcd_lock);
-	read_ahead[MAJOR_NR] = 4;
 	request_region(optcd_port, 4, "optcd");
 	register_disk(NULL, mk_kdev(MAJOR_NR,0), 1, &opt_fops, 0);
 
drivers/cdrom/sbpcd.c +0 -6
diff -ur linux-2.5.4/drivers/cdrom/sbpcd.c linux/drivers/cdrom/sbpcd.c
@@ -4531,12 +4531,6 @@
 		RETURN_UP(0);
 	} /* end of CDROMREADAUDIO */
 		
-	case BLKRASET:
-		if(!capable(CAP_SYS_ADMIN)) RETURN_UP(-EACCES);
-		if(kdev_none(cdi->dev)) RETURN_UP(-EINVAL);
-		if(arg > 0xff) RETURN_UP(-EINVAL);
-		read_ahead[major(cdi->dev)] = arg;
-		RETURN_UP(0);
 	default:
 		msg(DBG_IOC,"ioctl: unknown function request %04X\n", cmd);
 		RETURN_UP(-EINVAL);
drivers/cdrom/sjcd.c +0 -1
diff -ur linux-2.5.4/drivers/cdrom/sjcd.c linux/drivers/cdrom/sjcd.c
@@ -1695,7 +1695,6 @@
 	}
 
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST,&sjcd_lock);
-	read_ahead[MAJOR_NR] = 4;
 	register_disk(NULL, mk_kdev(MAJOR_NR, 0), 1, &sjcd_fops, 0);
 
 	if (check_region(sjcd_base, 4)) {
drivers/cdrom/sonycd535.c +0 -1
diff -ur linux-2.5.4/drivers/cdrom/sonycd535.c linux/drivers/cdrom/sonycd535.c
@@ -1598,7 +1598,6 @@
 				}
 				blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &sonycd535_lock);
 				blksize_size[MAJOR_NR] = &sonycd535_block_size;
-				read_ahead[MAJOR_NR] = 8;	/* 8 sector (4kB) read-ahead */
 
 				sony_toc = (struct s535_sony_toc *)
 					kmalloc(sizeof *sony_toc, GFP_KERNEL);
drivers/ide/ataraid.c +0 -1
diff -ur linux-2.5.4/drivers/ide/ataraid.c linux/drivers/ide/ataraid.c
@@ -289,7 +289,6 @@
 	hardsect_size[ATAMAJOR] = NULL;
 	blk_size[ATAMAJOR] = NULL;
 	blksize_size[ATAMAJOR] = NULL;                       
-	max_readahead[ATAMAJOR] = NULL;
 
 	del_gendisk(&ataraid_gendisk);
         
drivers/ide/hd.c +0 -3
diff -ur linux-2.5.4/drivers/ide/hd.c linux/drivers/ide/hd.c
@@ -652,8 +652,6 @@
 		case BLKGETSIZE64:
 		case BLKROSET:
 		case BLKROGET:
-		case BLKRASET:
-		case BLKRAGET:
 		case BLKFLSBUF:
 		case BLKPG:
 			return blk_ioctl(inode->i_rdev, cmd, arg);
@@ -837,7 +835,6 @@
 	}
 	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &hd_lock);
 	blk_queue_max_sectors(BLK_DEFAULT_QUEUE(MAJOR_NR), 255);
-	read_ahead[MAJOR_NR] = 8;		/* 8 sector (4kB) read-ahead */
 	add_gendisk(&hd_gendisk);
 	init_timer(&device_timer);
 	device_timer.function = hd_times_out;
drivers/ide/ide-cd.c +0 -5
diff -ur linux-2.5.4/drivers/ide/ide-cd.c linux/drivers/ide/ide-cd.c
@@ -2659,11 +2659,6 @@
 
 static void ide_cdrom_add_settings(ide_drive_t *drive)
 {
-	int major = HWIF(drive)->major;
-	int minor = drive->select.b.unit << PARTN_BITS;
-
-	ide_add_setting(drive,	"breada_readahead",	SETTING_RW, BLKRAGET, BLKRASET, TYPE_INT, 0, 255, 1, 2, &read_ahead[major], NULL);
-	ide_add_setting(drive,	"file_readahead",	SETTING_RW, BLKFRAGET, BLKFRASET, TYPE_INTA, 0, INT_MAX, 1, 1024, &max_readahead[major][minor],	NULL);
 	ide_add_setting(drive,	"dsc_overlap",		SETTING_RW, -1, -1, TYPE_BYTE, 0, 1, 1,	1, &drive->dsc_overlap, NULL);
 }
 
drivers/ide/ide-disk.c +33 -53

164 lines not on this page · raw message

drivers/ide/ide-floppy.c +0 -2
diff -ur linux-2.5.4/drivers/ide/ide-floppy.c linux/drivers/ide/ide-floppy.c
@@ -1968,8 +1968,6 @@
 	ide_add_setting(drive,	"bios_cyl",		SETTING_RW,					-1,			-1,			TYPE_INT,	0,	1023,				1,	1,	&drive->bios_cyl,		NULL);
 	ide_add_setting(drive,	"bios_head",		SETTING_RW,					-1,			-1,			TYPE_BYTE,	0,	255,				1,	1,	&drive->bios_head,		NULL);
 	ide_add_setting(drive,	"bios_sect",		SETTING_RW,					-1,			-1,			TYPE_BYTE,	0,	63,				1,	1,	&drive->bios_sect,		NULL);
-	ide_add_setting(drive,	"breada_readahead",	SETTING_RW,					BLKRAGET,		BLKRASET,		TYPE_INT,	0,	255,				1,	2,	&read_ahead[major],		NULL);
-	ide_add_setting(drive,	"file_readahead",	SETTING_RW,					BLKFRAGET,		BLKFRASET,		TYPE_INTA,	0,	INT_MAX,			1,	1024,	&max_readahead[major][minor],	NULL);
 
 }
 
drivers/ide/ide-probe.c +9 -21
diff -ur linux-2.5.4/drivers/ide/ide-probe.c linux/drivers/ide/ide-probe.c
@@ -788,8 +788,7 @@
 static void init_gendisk (ide_hwif_t *hwif)
 {
 	struct gendisk *gd;
-	unsigned int unit, units, minors;
-	int *bs, *max_ra;
+	unsigned int unit, units, minors, i;
 	extern devfs_handle_t ide_devfs_handle;
 
 #if 1
@@ -802,33 +801,25 @@
 	}
 #endif
 
-	minors    = units * (1<<PARTN_BITS);
-	gd        = kmalloc (sizeof(struct gendisk), GFP_KERNEL);
+	minors = units * (1<<PARTN_BITS);
+
+	gd = kmalloc (sizeof(struct gendisk), GFP_KERNEL);
 	if (!gd)
 		goto err_kmalloc_gd;
 	gd->sizes = kmalloc (minors * sizeof(int), GFP_KERNEL);
 	if (!gd->sizes)
 		goto err_kmalloc_gd_sizes;
-	gd->part  = kmalloc (minors * sizeof(struct hd_struct), GFP_KERNEL);
+	gd->part = kmalloc (minors * sizeof(struct hd_struct), GFP_KERNEL);
 	if (!gd->part)
 		goto err_kmalloc_gd_part;
-	bs        = kmalloc (minors*sizeof(int), GFP_KERNEL);
-	if (!bs)
+	blksize_size[hwif->major] = kmalloc (minors*sizeof(int), GFP_KERNEL);
+	if (!blksize_size[hwif->major])
 		goto err_kmalloc_bs;
-	max_ra    = kmalloc (minors*sizeof(int), GFP_KERNEL);
-	if (!max_ra)
-		goto err_kmalloc_max_ra;
 
 	memset(gd->part, 0, minors * sizeof(struct hd_struct));
 
-	/* cdroms and msdos f/s are examples of non-1024 blocksizes */
-	blksize_size[hwif->major] = bs;
-	max_readahead[hwif->major] = max_ra;
-	for (unit = 0; unit < minors; ++unit) {
-		*bs++ = BLOCK_SIZE;
-		*max_ra++ = MAX_READAHEAD;
-	}
-
+	for (i = 0; i < minors; ++i)
+	    blksize_size[hwif->major][i] = BLOCK_SIZE;
 	for (unit = 0; unit < units; ++unit)
 		hwif->drives[unit].part = &gd->part[unit << PARTN_BITS];
 
@@ -875,8 +866,6 @@
 	}
 	return;
 
-err_kmalloc_max_ra:
-	kfree(bs);
 err_kmalloc_bs:
 	kfree(gd->part);
 err_kmalloc_gd_part:
@@ -937,7 +926,6 @@
 	init_gendisk(hwif);
 	blk_dev[hwif->major].data = hwif;
 	blk_dev[hwif->major].queue = ide_get_queue;
-	read_ahead[hwif->major] = 8;	/* (4kB) */
 	hwif->present = 1;	/* success */
 
 	return hwif->present;
drivers/ide/ide-proc.c +18 -19
diff -ur linux-2.5.4/drivers/ide/ide-proc.c linux/drivers/ide/ide-proc.c
@@ -163,7 +163,7 @@
 static int proc_ide_write_config
 	(struct file *file, const char *buffer, unsigned long count, void *data)
 {
-	ide_hwif_t	*hwif = (ide_hwif_t *)data;
+	ide_hwif_t	*hwif = data;
 	int		for_real = 0;
 	unsigned long	startn = 0, n, flags;
 	const char	*start = NULL, *msg = NULL;
@@ -338,7 +338,7 @@
 	int		len;
 
 #ifdef CONFIG_BLK_DEV_IDEPCI
-	ide_hwif_t	*hwif = (ide_hwif_t *)data;
+	ide_hwif_t	*hwif = data;
 	struct pci_dev	*dev = hwif->pci_dev;
 	if (!IDE_PCI_DEVID_EQ(hwif->pci_devid, IDE_PCI_DEVID_NULL) && dev && dev->bus) {
 		int reg = 0;
@@ -394,7 +394,7 @@
 static int proc_ide_read_imodel
 	(char *page, char **start, off_t off, int count, int *eof, void *data)
 {
-	ide_hwif_t	*hwif = (ide_hwif_t *) data;
+	ide_hwif_t	*hwif = data;
 	int		len;
 	const char	*name;
 
@@ -424,7 +424,7 @@
 static int proc_ide_read_mate
 	(char *page, char **start, off_t off, int count, int *eof, void *data)
 {
-	ide_hwif_t	*hwif = (ide_hwif_t *) data;
+	ide_hwif_t	*hwif = data;
 	int		len;
 
 	if (hwif && hwif->mate && hwif->mate->present)
@@ -437,7 +437,7 @@
 static int proc_ide_read_channel
 	(char *page, char **start, off_t off, int count, int *eof, void *data)
 {
-	ide_hwif_t	*hwif = (ide_hwif_t *) data;
+	ide_hwif_t	*hwif = data;
 	int		len;
 
 	page[0] = hwif->channel ? '1' : '0';
@@ -462,7 +462,7 @@
 static int proc_ide_read_identify
 	(char *page, char **start, off_t off, int count, int *eof, void *data)
 {
-	ide_drive_t	*drive = (ide_drive_t *)data;
+	ide_drive_t	*drive = data;
 	int		len = 0, i = 0;
 
 	if (drive && !proc_ide_get_identify(drive, page)) {
@@ -483,8 +483,8 @@
 static int proc_ide_read_settings
 	(char *page, char **start, off_t off, int count, int *eof, void *data)
 {
-	ide_drive_t	*drive = (ide_drive_t *) data;
-	ide_settings_t	*setting = (ide_settings_t *) drive->settings;
+	ide_drive_t	*drive = data;
+	ide_settings_t	*setting = drive->settings;
 	char		*out = page;
 	int		len, rc, mul_factor, div_factor;
 
@@ -515,7 +515,7 @@
 static int proc_ide_write_settings
 	(struct file *file, const char *buffer, unsigned long count, void *data)
 {
-	ide_drive_t	*drive = (ide_drive_t *) data;
+	ide_drive_t	*drive = data;
 	char		name[MAX_LEN + 1];
 	int		for_real = 0, len;
 	unsigned long	n;
@@ -590,21 +590,21 @@
 int proc_ide_read_capacity
 	(char *page, char **start, off_t off, int count, int *eof, void *data)
 {
-	ide_drive_t	*drive = (ide_drive_t *) data;
-	ide_driver_t    *driver = (ide_driver_t *) drive->driver;
+	ide_drive_t	*drive = data;
+	ide_driver_t    *driver = drive->driver;
 	int		len;
 
 	if (!driver)
 		len = sprintf(page, "(none)\n");
         else
-		len = sprintf(page,"%llu\n", (unsigned long long) ((ide_driver_t *)drive->driver)->capacity(drive));
+		len = sprintf(page,"%llu\n", (unsigned long long) drive->driver->capacity(drive));
 	PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
 }
 
 int proc_ide_read_geometry
 	(char *page, char **start, off_t off, int count, int *eof, void *data)
 {
-	ide_drive_t	*drive = (ide_drive_t *) data;
+	ide_drive_t	*drive = data;
 	char		*out = page;
 	int		len;
 
@@ -617,7 +617,7 @@
 static int proc_ide_read_dmodel
 	(char *page, char **start, off_t off, int count, int *eof, void *data)
 {
-	ide_drive_t	*drive = (ide_drive_t *) data;
+	ide_drive_t	*drive = data;
 	struct hd_driveid *id = drive->id;
 	int		len;
 
@@ -628,8 +628,8 @@
 static int proc_ide_read_driver
 	(char *page, char **start, off_t off, int count, int *eof, void *data)
 {
-	ide_drive_t	*drive = (ide_drive_t *) data;
-	ide_driver_t	*driver = (ide_driver_t *) drive->driver;
+	ide_drive_t	*drive = data;
+	ide_driver_t	*driver = drive->driver;
 	int		len;
 
 	if (!driver)
@@ -642,7 +642,7 @@
 static int proc_ide_write_driver
 	(struct file *file, const char *buffer, unsigned long count, void *data)
 {
-	ide_drive_t	*drive = (ide_drive_t *) data;
+	ide_drive_t	*drive = data;
 
 	if (!capable(CAP_SYS_ADMIN))
 		return -EACCES;
@@ -654,7 +654,7 @@
 static int proc_ide_read_media
 	(char *page, char **start, off_t off, int count, int *eof, void *data)
 {
-	ide_drive_t	*drive = (ide_drive_t *) data;
+	ide_drive_t	*drive = data;
 	const char	*media;
 	int		len;
 
@@ -746,7 +746,6 @@
 	struct proc_dir_entry *ent;
 	struct proc_dir_entry *parent = hwif->proc;
 	char name[64];
-//	ide_driver_t *driver = drive->driver;
 
 	if (drive->present && !drive->proc) {
 		drive->proc = proc_mkdir(drive->name, parent);
drivers/ide/ide.c +2 -3
diff -ur linux-2.5.4/drivers/ide/ide.c linux/drivers/ide/ide.c
@@ -2126,7 +2126,6 @@
 	 */
 	unregister_blkdev(hwif->major, hwif->name);
 	kfree(blksize_size[hwif->major]);
-	kfree(max_readahead[hwif->major]);
 	blk_dev[hwif->major].data = NULL;
 	blk_dev[hwif->major].queue = NULL;
 	blk_clear(hwif->major);
@@ -2279,7 +2278,7 @@
 
 void ide_add_setting (ide_drive_t *drive, const char *name, int rw, int read_ioctl, int write_ioctl, int data_type, int min, int max, int mul_factor, int div_factor, void *data, ide_procset_t *set)
 {
-	ide_settings_t **p = (ide_settings_t **) &drive->settings, *setting = NULL;
+	ide_settings_t **p = &drive->settings, *setting = NULL;
 
 	while ((*p) && strcmp((*p)->name, name) < 0)
 		p = &((*p)->next);
@@ -2305,7 +2304,7 @@
 
 void ide_remove_setting (ide_drive_t *drive, char *name)
 {
-	ide_settings_t **p = (ide_settings_t **) &drive->settings, *setting;
+	ide_settings_t **p = &drive->settings, *setting;
 
 	while ((*p) && strcmp((*p)->name, name))
 		p = &((*p)->next);
drivers/md/lvm.c +0 -28
diff -ur linux-2.5.4/drivers/md/lvm.c linux/drivers/md/lvm.c
@@ -226,10 +226,6 @@
 
 #include "lvm-internal.h"
 
-#define	LVM_CORRECT_READ_AHEAD( a) \
-   if      ( a < LVM_MIN_READ_AHEAD || \
-             a > LVM_MAX_READ_AHEAD) a = LVM_MAX_READ_AHEAD;
-
 #ifndef WRITEA
 #  define WRITEA WRITE
 #endif
@@ -883,29 +879,6 @@
 		invalidate_buffers(inode->i_rdev);
 		break;
 
-
-	case BLKRASET:
-		/* set read ahead for block device */
-		if (!capable(CAP_SYS_ADMIN)) return -EACCES;
-
-		P_IOCTL("BLKRASET: %ld sectors for %s\n",
-			(long) arg, kdevname(inode->i_rdev));
-
-		if ((long) arg < LVM_MIN_READ_AHEAD ||
-		    (long) arg > LVM_MAX_READ_AHEAD)
-			return -EINVAL;
-		lv_ptr->lv_read_ahead = (long) arg;
-		break;
-
-
-	case BLKRAGET:
-		/* get current read ahead setting */
-		P_IOCTL("BLKRAGET %d\n", lv_ptr->lv_read_ahead);
-		if (put_user(lv_ptr->lv_read_ahead, (long *)arg))
-			return -EFAULT;
-		break;
-
-
 	case HDIO_GETGEO:
 		/* get disk geometry */
 		P_IOCTL("%s -- lvm_blk_ioctl -- HDIO_GETGEO\n", lvm_name);
@@ -2035,7 +2008,6 @@
 	lvm_size[minor(lv_ptr->lv_dev)] = lv_ptr->lv_size >> 1;
 	vg_lv_map[minor(lv_ptr->lv_dev)].vg_number = vg_ptr->vg_number;
 	vg_lv_map[minor(lv_ptr->lv_dev)].lv_number = lv_ptr->lv_number;
-	LVM_CORRECT_READ_AHEAD(lv_ptr->lv_read_ahead);
 	vg_ptr->lv_cur++;
 	lv_ptr->lv_status = lv_status_save;
 
drivers/md/md.c +0 -14
diff -ur linux-2.5.4/drivers/md/md.c linux/drivers/md/md.c
@@ -1737,7 +1737,6 @@
 	register_disk(&md_gendisk, mk_kdev(MAJOR_NR,mdidx(mddev)),
 			1, &md_fops, md_size[mdidx(mddev)]<<1);
 
-	read_ahead[MD_MAJOR] = 1024;
 	return (0);
 }
 
@@ -2622,8 +2621,6 @@
 						(u64 *) arg);
 			goto done;
 
-		case BLKRAGET:
-		case BLKRASET:
 		case BLKFLSBUF:
 		case BLKBSZGET:
 		case BLKBSZSET:
@@ -3176,13 +3173,6 @@
 
 	sz += sprintf(page+sz, "\n");
 
-
-	sz += sprintf(page+sz, "read_ahead ");
-	if (read_ahead[MD_MAJOR] == INT_MAX)
-		sz += sprintf(page+sz, "not set\n");
-	else
-		sz += sprintf(page+sz, "%d sectors\n", read_ahead[MD_MAJOR]);
-
 	ITERATE_MDDEV(mddev,tmp) {
 		sz += sprintf(page + sz, "md%d : %sactive", mdidx(mddev),
 						mddev->pers ? "" : "in");
@@ -3622,7 +3612,6 @@
 	}
 	blksize_size[MAJOR_NR] = md_blocksizes;
 	blk_size[MAJOR_NR] = md_size;
-	max_readahead[MAJOR_NR] = md_maxreadahead;
 
 	dprintk("md: sizeof(mdp_super_t) = %d\n", (int)sizeof(mdp_super_t));
 
@@ -3658,9 +3647,6 @@
 	/* forward all md request to md_make_request */
 	blk_queue_make_request(BLK_DEFAULT_QUEUE(MAJOR_NR), md_make_request);
 
-
-	read_ahead[MAJOR_NR] = INT_MAX;
-
 	add_gendisk(&md_gendisk);
 
 	md_recovery_thread = md_register_thread(md_do_recovery, NULL, name);
drivers/message/i2o/i2o_block.c +0 -2
diff -ur linux-2.5.4/drivers/message/i2o/i2o_block.c linux/drivers/message/i2o/i2o_block.c
@@ -1104,8 +1104,6 @@
 		case BLKFLSBUF:
 		case BLKROSET:
 		case BLKROGET:
-		case BLKRASET:
-		case BLKRAGET:
 		case BLKPG:
 			return blk_ioctl(inode->i_rdev, cmd, arg);
 			
drivers/s390/block/dasd.c +0 -2
diff -ur linux-2.5.4/drivers/s390/block/dasd.c linux/drivers/s390/block/dasd.c
@@ -2489,8 +2489,6 @@
 	case BLKSSZGET:
 	case BLKROSET:
 	case BLKROGET:
-	case BLKRASET:
-	case BLKRAGET:
 	case BLKFLSBUF:
 	case BLKPG:
 	case BLKELVGET:
drivers/s390/block/xpram.c +2 -23
diff -ur linux-2.5.4/drivers/s390/block/xpram.c linux/drivers/s390/block/xpram.c
@@ -163,12 +163,11 @@
 
 static int major    = XPRAM_MAJOR;
 static int devs     = XPRAM_DEVS;
-static int rahead   = XPRAM_RAHEAD;
 static int sizes[XPRAM_MAX_DEVS] = { 0, };
 static int blksize  = XPRAM_BLKSIZE;
 static int hardsect = XPRAM_HARDSECT;
 
-int xpram_devs, xpram_rahead;
+int xpram_devs;
 int xpram_blksize, xpram_hardsect;
 int xpram_mem_avail = 0;
 unsigned long xpram_sizes[XPRAM_MAX_DEVS];
@@ -659,26 +658,9 @@
 		if ( capable(CAP_SYS_ADMIN) )invalidate_buffers(inode->i_rdev);
 		return 0;
 
-	case BLKRAGET: /* return the readahead value, 0x1263 */
-		if (!arg)  return -EINVAL;
-		err = 0; /* verify_area_20(VERIFY_WRITE, (long *) arg, sizeof(long));
-		          * if (err) return err;
-                          */
-		put_user(read_ahead[MAJOR(inode->i_rdev)], (long *)arg);
-
-		return 0;
-
-	case BLKRASET: /* set the readahead value, 0x1262 */
-		if (!capable(CAP_SYS_ADMIN)) return -EACCES;
-		if (arg > 0xff) return -EINVAL; /* limit it */
-		read_ahead[MAJOR(inode->i_rdev)] = arg;
-                atomic_eieio();
-		return 0;
-
 	case BLKRRPART: /* re-read partition table: can't do it, 0x1259 */
 		return -EINVAL;
 
-
 #if (XPRAM_VERSION == 22)
 		RO_IOCTLS(inode->i_rdev, arg); /* the default RO operations 
                                                 * BLKROSET
@@ -940,7 +922,6 @@
 				 * snoozing with a debugger.
 				 */
 
-	xpram_rahead   = rahead;
 	xpram_blksize  = blksize;
 	xpram_hardsect = hardsect;
 
@@ -1029,7 +1010,7 @@
 	PRINT_INFO("  %d kB expanded memory found.\n",xpram_mem_avail );
 
 	/*
-	 * Assign the other needed values: request, rahead, size, blksize,
+	 * Assign the other needed values: request, size, blksize,
 	 * hardsect. All the minor devices feature the same value.
 	 * Note that `xpram' defines all of them to allow testing non-default
 	 * values. A real device could well avoid setting values in global
@@ -1042,7 +1023,6 @@
 	q = BLK_DEFAULT_QUEUE (major);
 	blk_init_queue (q, xpram_request);
 #endif /* V22/V24 */
-	read_ahead[major] = xpram_rahead;
 
 	/* we want to have XPRAM_UNUSED blocks security buffer between devices */
 	mem_usable=xpram_mem_avail-(XPRAM_UNUSED*(xpram_devs-1));
@@ -1181,7 +1161,6 @@
 	kfree(xpram_hardsects);
 	hardsect_size[major] = NULL;
  fail_malloc:
-	read_ahead[major] = 0;
 #if (XPRAM_VERSION == 22)
 	blk_dev[major].request_fn = NULL;
 #endif /* V22 */
drivers/s390/char/tapeblock.c +0 -1
diff -ur linux-2.5.4/drivers/s390/char/tapeblock.c linux/drivers/s390/char/tapeblock.c
@@ -101,7 +101,6 @@
     }
     if (tapeblock_major == 0) tapeblock_major = result;   /* accept dynamic major number*/
     INIT_BLK_DEV(tapeblock_major,tape_request_fn,tapeblock_getqueue,NULL);
-    read_ahead[tapeblock_major]=TAPEBLOCK_READAHEAD;
     PRINT_WARN(KERN_ERR " tape gets major %d for block device\n", result);
     blk_size[tapeblock_major] = (int*) kmalloc (256*sizeof(int),GFP_ATOMIC);
     memset(blk_size[tapeblock_major],0,256*sizeof(int));
drivers/scsi/sd.c +0 -14
diff -ur linux-2.5.4/drivers/scsi/sd.c linux/drivers/scsi/sd.c
@@ -228,8 +228,6 @@
 		case BLKGETSIZE64:
 		case BLKROSET:
 		case BLKROGET:
-		case BLKRASET:
-		case BLKRAGET:
 		case BLKFLSBUF:
 		case BLKSSZGET:
 		case BLKPG:
@@ -1190,18 +1188,6 @@
 				rscsi_disks[i].has_part_table = 1;
 			}
 		}
-	/* If our host adapter is capable of scatter-gather, then we increase
-	 * the read-ahead to 60 blocks (120 sectors).  If not, we use
-	 * a two block (4 sector) read ahead. We can only respect this with the
-	 * granularity of every 16 disks (one device major).
-	 */
-	for (i = 0; i < N_USED_SD_MAJORS; i++) {
-		read_ahead[SD_MAJOR(i)] =
-		    (rscsi_disks[i * SCSI_DISKS_PER_MAJOR].device
-		     && rscsi_disks[i * SCSI_DISKS_PER_MAJOR].device->host->sg_tablesize)
-		    ? 120	/* 120 sector read-ahead */
-		    : 4;	/* 4 sector read-ahead */
-	}
 
 	return;
 }
drivers/scsi/sr.c +0 -11
diff -ur linux-2.5.4/drivers/scsi/sr.c linux/drivers/scsi/sr.c
@@ -785,16 +785,6 @@
                                     &sr_bdops, NULL);
 		register_cdrom(&scsi_CDs[i].cdi);
 	}
-
-
-	/* If our host adapter is capable of scatter-gather, then we increase
-	 * the read-ahead to 16 blocks (32 sectors).  If not, we use
-	 * a two block (4 sector) read ahead. */
-	if (scsi_CDs[0].device && scsi_CDs[0].device->host->sg_tablesize)
-		read_ahead[MAJOR_NR] = 32;	/* 32 sector read-ahead.  Always removable. */
-	else
-		read_ahead[MAJOR_NR] = 4;	/* 4 sector read-ahead */
-
 }
 
 static void sr_detach(Scsi_Device * SDp)
@@ -846,7 +836,6 @@
 		kfree(sr_blocksizes);
 		sr_blocksizes = NULL;
 	}
-	read_ahead[MAJOR_NR] = 0;
 	blk_clear(MAJOR_NR);
 
 	sr_template.dev_max = 0;
drivers/scsi/sr_ioctl.c +0 -2
diff -ur linux-2.5.4/drivers/scsi/sr_ioctl.c linux/drivers/scsi/sr_ioctl.c
@@ -550,8 +550,6 @@
 		return put_user((u64)scsi_CDs[target].capacity << 9, (u64 *)arg);
 	case BLKROSET:
 	case BLKROGET:
-	case BLKRASET:
-	case BLKRAGET:
 	case BLKFLSBUF:
 	case BLKSSZGET:
 		return blk_ioctl(cdi->dev, cmd, arg);
fs/hfs/file.c +2 -11
diff -ur linux-2.5.4/fs/hfs/file.c linux/fs/hfs/file.c
@@ -163,8 +163,7 @@
 	if (left <= 0) {
 		return 0;
 	}
-	if ((read = hfs_do_read(inode, HFS_I(inode)->fork, pos,
-				buf, left, filp->f_reada != 0)) > 0) {
+	if ((read = hfs_do_read(inode, HFS_I(inode)->fork, pos, buf, left)) > 0) {
 	        *ppos += read;
 		filp->f_reada = 1;
 	}
@@ -288,7 +287,7 @@
  * It has been changed to take into account that HFS files have no holes.
  */
 hfs_s32 hfs_do_read(struct inode *inode, struct hfs_fork * fork, hfs_u32 pos,
-		    char * buf, hfs_u32 count, int reada)
+		    char * buf, hfs_u32 count)
 {
 	kdev_t dev = inode->i_dev;
 	hfs_s32 size, chars, offset, block, blocks, read = 0;
@@ -309,14 +308,6 @@
 	blocks = (count+offset+HFS_SECTOR_SIZE-1) >> HFS_SECTOR_SIZE_BITS;
 
 	bhb = bhe = buflist;
-	if (reada) {
-		if (blocks < read_ahead[major(dev)] / (HFS_SECTOR_SIZE>>9)) {
-			blocks = read_ahead[major(dev)] / (HFS_SECTOR_SIZE>>9);
-		}
-		if (block + blocks > size) {
-			blocks = size - block;
-		}
-	}
 
 	/* We do this in a two stage process.  We first try and
 	   request as many blocks as we can, then we wait for the
include/linux/blkdev.h +0 -5
diff -ur linux-2.5.4/include/linux/blkdev.h linux/include/linux/blkdev.h
@@ -314,11 +314,8 @@
 extern void generic_unplug_device(void *);
 
 extern int * blk_size[MAX_BLKDEV];
-
 extern int * blksize_size[MAX_BLKDEV];
 
-extern int * max_readahead[MAX_BLKDEV];
-
 #define MAX_PHYS_SEGMENTS 128
 #define MAX_HW_SEGMENTS 128
 #define MAX_SECTORS 255
@@ -340,8 +337,6 @@
 	blk_size_in_bytes[major] = NULL;
 #endif
 	blksize_size[major] = NULL;
-	max_readahead[major] = NULL;
-	read_ahead[major] = 0;
 }
 
 extern inline int get_hardsect_size(kdev_t dev)
include/linux/fs.h +3 -3
diff -ur linux-2.5.4/include/linux/fs.h linux/include/linux/fs.h
@@ -173,10 +173,12 @@
 #define BLKRRPART  _IO(0x12,95)	/* re-read partition table */
 #define BLKGETSIZE _IO(0x12,96)	/* return device size /512 (long *arg) */
 #define BLKFLSBUF  _IO(0x12,97)	/* flush buffer cache */
-#define BLKRASET   _IO(0x12,98)	/* Set read ahead for block device */
+#if 0				/* Obsolete, these don't do anything. */
+#define BLKRASET   _IO(0x12,98)	/* set read ahead for block device */
 #define BLKRAGET   _IO(0x12,99)	/* get current read ahead setting */
 #define BLKFRASET  _IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
 #define BLKFRAGET  _IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */
+#endif
 #define BLKSECTSET _IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */
 #define BLKSECTGET _IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
 #define BLKSSZGET  _IO(0x12,104)/* get block device sector size */
@@ -1490,8 +1492,6 @@
 
 extern ssize_t char_read(struct file *, char *, size_t, loff_t *);
 extern ssize_t block_read(struct file *, char *, size_t, loff_t *);
-extern int read_ahead[];
-
 extern ssize_t char_write(struct file *, const char *, size_t, loff_t *);
 extern ssize_t block_write(struct file *, const char *, size_t, loff_t *);
 
include/linux/ide.h +5 -3
diff -ur linux-2.5.4/include/linux/ide.h linux/include/linux/ide.h
@@ -367,6 +367,8 @@
 	} b;
 } special_t;
 
+struct ide_settings_s;
+
 typedef struct ide_drive_s {
 	request_queue_t		 queue;	/* request queue */
 	struct ide_drive_s 	*next;	/* circular list of hwgroup drives */
@@ -424,16 +426,16 @@
 	unsigned long	capacity;	/* total number of sectors */
 	unsigned long long capacity48;	/* total number of sectors */
 	unsigned int	drive_data;	/* for use by tuneproc/selectproc as needed */
-	void		  *hwif;	/* actually (ide_hwif_t *) */
+	struct hwif_s   *hwif;		/* actually (ide_hwif_t *) */
 	wait_queue_head_t wqueue;	/* used to wait for drive in open() */
 	struct hd_driveid *id;		/* drive model identification info */
 	struct hd_struct  *part;	/* drive partition table */
 	char		name[4];	/* drive name, such as "hda" */
-	void 		*driver;	/* (ide_driver_t *) */
+	struct ide_driver_s *driver;	/* (ide_driver_t *) */
 	void		*driver_data;	/* extra driver data */
 	devfs_handle_t	de;		/* directory for device */
 	struct proc_dir_entry *proc;	/* /proc/ide/ directory entry */
-	void		*settings;	/* /proc/ide/ drive settings */
+	struct ide_settings_s *settings;/* /proc/ide/ drive settings */
 	char		driver_req[10];	/* requests specific driver */
 	int		last_lun;	/* last logical unit */
 	int		forced_lun;	/* if hdxlun was given at boot */
include/linux/lvm.h +0 -1
diff -ur linux-2.5.4/include/linux/lvm.h linux/include/linux/lvm.h
@@ -498,7 +498,6 @@
 	uint lv_badblock;	/* for future use */
 	uint lv_allocation;
 	uint lv_io_timeout;	/* for future use */
-	uint lv_read_ahead;
 
 	/* delta to version 1 starts here */
        struct lv_v5 *lv_snapshot_org;
kernel/ksyms.c +0 -2
diff -ur linux-2.5.4/kernel/ksyms.c linux/kernel/ksyms.c
@@ -321,7 +321,6 @@
 EXPORT_SYMBOL(tq_disk);
 EXPORT_SYMBOL(init_buffer);
 EXPORT_SYMBOL(refile_buffer);
-EXPORT_SYMBOL(max_readahead);
 EXPORT_SYMBOL(wipe_partitions);
 
 /* tty routines */
@@ -521,7 +520,6 @@
 EXPORT_SYMBOL(clear_inode);
 EXPORT_SYMBOL(___strtok);
 EXPORT_SYMBOL(init_special_inode);
-EXPORT_SYMBOL(read_ahead);
 EXPORT_SYMBOL(__get_hash_table);
 EXPORT_SYMBOL(new_inode);
 EXPORT_SYMBOL(insert_inode_hash);
mm/filemap.c +7 -17
diff -ur linux-2.5.4/mm/filemap.c linux/mm/filemap.c
@@ -1120,7 +1120,7 @@
  *
  * Asynchronous read-ahead risks:
  * ------------------------------
- * In order to maximize overlapping, we must start some asynchronous read 
+ * In order to maximize overlapping, we must start some asynchronous read
  * request from the device, as soon as possible.
  * We must be very careful about:
  * - The number of effective pending IO read requests.
@@ -1131,13 +1131,6 @@
  *   64k if defined (4K page size assumed).
  */
 
-static inline int get_max_readahead(struct inode * inode)
-{
-	if (kdev_none(inode->i_dev) || !max_readahead[major(inode->i_dev)])
-		return MAX_READAHEAD;
-	return max_readahead[major(inode->i_dev)][minor(inode->i_dev)];
-}
-
 static void generic_file_readahead(int reada_ok,
 	struct file * filp, struct inode * inode,
 	struct page * page)
@@ -1146,7 +1139,6 @@
 	unsigned long index = page->index;
 	unsigned long max_ahead, ahead;
 	unsigned long raend;
-	int max_readahead = get_max_readahead(inode);
 
 	end_index = inode->i_size >> PAGE_CACHE_SHIFT;
 
@@ -1231,8 +1223,8 @@
 
 		filp->f_ramax += filp->f_ramax;
 
-		if (filp->f_ramax > max_readahead)
-			filp->f_ramax = max_readahead;
+		if (filp->f_ramax > MAX_READAHEAD)
+			filp->f_ramax = MAX_READAHEAD;
 
 #ifdef PROFILE_READAHEAD
 		profile_readahead((reada_ok == 2), filp);
@@ -1278,7 +1270,6 @@
 	struct page *cached_page;
 	int reada_ok;
 	int error;
-	int max_readahead = get_max_readahead(inode);
 
 	cached_page = NULL;
 	index = *ppos >> PAGE_CACHE_SHIFT;
@@ -1318,9 +1309,9 @@
 			filp->f_ramax = needed;
 
 		if (reada_ok && filp->f_ramax < MIN_READAHEAD)
-				filp->f_ramax = MIN_READAHEAD;
-		if (filp->f_ramax > max_readahead)
-			filp->f_ramax = max_readahead;
+			filp->f_ramax = MIN_READAHEAD;
+		if (filp->f_ramax > MAX_READAHEAD)
+			filp->f_ramax = MAX_READAHEAD;
 	}
 
 	for (;;) {
@@ -1808,8 +1799,7 @@
 {
 	unsigned long ra_window;
 
-	ra_window = get_max_readahead(vma->vm_file->f_dentry->d_inode);
-	ra_window = CLUSTER_OFFSET(ra_window + CLUSTER_PAGES - 1);
+	ra_window = CLUSTER_OFFSET(MAX_READAHEAD + CLUSTER_PAGES - 1);
 
 	/* vm_raend is zero if we haven't read ahead in this area yet.  */
 	if (vma->vm_raend == 0)
#23 lore raw
In reply to Pavel Machek
Quoted 14 lines · Vojtech Pavlik
Quoted 4 lines

BTW.> Since there is no longer any difference about the request head handling between IDE and SCSI, what about the idea of moving the whole ide interface stuff under the umbrella of SCSI host adapter? This would be a true cleanup and make the whole ide-scsi and ide-atapi mess

Quoted 9 lines

go away. IDE is moving fast toward SCSI on the logical level anyway and it would make the hwif macro/lookup crap in the ide code go magically way! At least this generic device handler search stuff should be merged between them (I'm trully tempted to give it a shoot this afternoon.) The only thing it could result in, which would maybe surprise some would be the fact that the major of his root device could just go suddenly away... But hey! What's the heck - we are in odd kernel series anyway ;-).

Quoted 5 lines

This is an idea I'm toying with for quite a long time already. And I think this is a good idea as well. I have no more time to spend coding today, so if you have the afternoon, but I'll definitely find some to read the diff if you do this change!

Well could you do me a mall favour of dumping a combined ide cleanup relative to 2.5.4 on me? In contrast to Linus I don't like scattered patches ;-). I will at least give it a deep code look today for the ide-cdrom stuff, becouse it was always annoying to me that the default distribution setup
is using the ide interface to my CD-recorder and every single recorder aplication out there is using the scsi interface instead.

#24 lore raw
In reply to Pavel Machek
Quoted 5 lines · Vojtech Pavlik
Quoted 3 lines · Martin Dalecki

So the conclusions is that not just the read_ahead array is bogous now. The max_readahead array can be killed entierly from the kernel as well ;-).

Quoted 8 lines
Quoted 2 lines

The answer is: I'm now confident that you can just remove all the max_readahead initialization from the ide code.

Since I've come to the same conclusion, here is the patch. It removes read_ahead, max_readahead, BLKRAGET, BLKRASET, BLKFRAGET and BLKFRASET completely.

Comments, Jens?

Could you battle it out, and I'll take a good look at the patch tomorrow :-). I'm all for a bit of spring cleaning here, it's needed it badly for quite a while.

Signature · 1 line
Jens Axboe
#25 lore raw
Quoted 13 lines · Jens Axboe
Quoted 12 lines · Vojtech Pavlik
Quoted 5 lines · Martin Dalecki

So the conclusions is that not just the read_ahead array is bogous now. The max_readahead array can be killed entierly from the kernel as well ;-).

The answer is: I'm now confident that you can just remove all the max_readahead initialization from the ide code.

Since I've come to the same conclusion, here is the patch. It removes read_ahead, max_readahead, BLKRAGET, BLKRASET, BLKFRAGET and BLKFRASET completely.

Quoted 5 lines
Quoted 1 line

Comments, Jens?

Could you battle it out, and I'll take a good look at the patch tomorrow :-). I'm all for a bit of spring cleaning here, it's needed it badly for quite a while.

Basically the LOT of all of you are WRONG and quit submitting patches to try and dork up the works. Since we already have added back one ratehole from 2.4 that Linus strictly forbid, I am glad to see everyone here is an expert!

I just love how the copy of a request has worked its way back into to the code-base. :-/ I recall Linus stating it was/is a horrid mess.

Regards,

Andre Hedrick
Linux Disk Certification Project Linux ATA Development

#26 lore raw
In reply to Jens Axboe
Quoted 2 lines · Andre Hedrick

I just love how the copy of a request has worked its way back into to the code-base. :-/ I recall Linus stating it was/is a horrid mess.

The copy itself is not the horrid mess, the handling of multi write is what is the horrible mess. Having a private copy to mess with is pretty much a necessity IMO if you want to handle > current_nr_sectors at the time without completing it chunk by chunk.

Signature · 1 line
Jens Axboe
#27 lore raw
Quoted 8 lines · Jens Axboe
Quoted 2 lines · Andre Hedrick

I just love how the copy of a request has worked its way back into to the code-base. :-/ I recall Linus stating it was/is a horrid mess.

The copy itself is not the horrid mess, the handling of multi write is what is the horrible mess. Having a private copy to mess with is pretty much a necessity IMO if you want to handle > current_nr_sectors at the time without completing it chunk by chunk.

Exactly, and I am about to have a valid clean solution that is short and proper. Now that I have the handler working, I need to have the one walk function to do the bio indexing. Also it is less than 30 lines.

Not the stuff you added as an interm fix :-/

You know why these changes people are pushing are wrong, because it is way to early to being the compression code process.

Cheers,

Andre Hedrick
Linux Disk Certification Project Linux ATA Development

#28 lore raw
In reply to Jens Axboe
Quoted 6 lines · Andre Hedrick
Quoted 4 lines · Jens Axboe
Quoted 2 lines · Andre Hedrick

I just love how the copy of a request has worked its way back into to the code-base. :-/ I recall Linus stating it was/is a horrid mess.

Quoted 8 lines
Quoted 4 lines

The copy itself is not the horrid mess, the handling of multi write is what is the horrible mess. Having a private copy to mess with is pretty much a necessity IMO if you want to handle > current_nr_sectors at the time without completing it chunk by chunk.

Exactly, and I am about to have a valid clean solution that is short and proper. Now that I have the handler working, I need to have the one walk function to do the bio indexing. Also it is less than 30 lines.

Those changes add yet another member to struct bio for no good reason. I'd much rather just do the private copy. So... ->

Quoted 1 line

Not the stuff you added as an interm fix :-/

I don't consider the copy an interim fix at all. But please show your working handler and we can discuss it, it's pointless to debate what fix is the better one you are sitting on yours.

Quoted 2 lines

You know why these changes people are pushing are wrong, because it is way to early to being the compression code process.

The global read-ahead change is surely not what we want. The IDE cleanups I've seen so far look good to me.

Signature · 1 line
Jens Axboe
#29 lore raw
Quoted 12 lines · Jens Axboe
Quoted 11 lines · Andre Hedrick
Quoted 8 lines · Jens Axboe
Quoted 2 lines · Andre Hedrick

I just love how the copy of a request has worked its way back into to the code-base. :-/ I recall Linus stating it was/is a horrid mess.

The copy itself is not the horrid mess, the handling of multi write is what is the horrible mess. Having a private copy to mess with is pretty much a necessity IMO if you want to handle > current_nr_sectors at the time without completing it chunk by chunk.

Quoted 6 lines
Quoted 3 lines

Exactly, and I am about to have a valid clean solution that is short and proper. Now that I have the handler working, I need to have the one walk function to do the bio indexing. Also it is less than 30 lines.

Those changes add yet another member to struct bio for no good reason. I'd much rather just do the private copy. So... ->

NO NEW STRUCT TO BIO ...
Private COPY is a given, just using it cleanly the issue.

Quoted 5 lines
Quoted 1 line

Not the stuff you added as an interm fix :-/

I don't consider the copy an interim fix at all. But please show your working handler and we can discuss it, it's pointless to debate what fix is the better one you are sitting on yours.

Yep but this time you get a clean solution that works.

Quoted 2 lines
Quoted 2 lines

You know why these changes people are pushing are wrong, because it is way to early to being the compression code process.

You if any know the original TCQ of mine would scream, much less the derivative you started off that code base. Keep that in mind, with an expanded code thread we can isolate changes and test variation.

Quoted 2 lines

The global read-ahead change is surely not what we want. The IDE cleanups I've seen so far look good to me.

The "read-ahead" is a NOP.

The fillin(blah, blah, blah) is!

Cheers,

Andre Hedrick
Linux Disk Certification Project Linux ATA Development

#30 lore raw
Quoted 7 lines · Andre Hedrick
Quoted 3 lines · Jens Axboe

I don't consider the copy an interim fix at all. But please show your working handler and we can discuss it, it's pointless to debate what fix is the better one you are sitting on yours.

Yep but this time you get a clean solution that works.

I must have missed the patch.

Arguing that your code is better is a lost cause if you don't show your code, or at least part of it ;)

cheers,

Rik

Signature · 4 lines
"Linux holds advantages over the single-vendor commercial OS"
    -- Microsoft's "Competing with Linux" document

http://www.surriel.com/		http://distro.conectiva.com/
#31 lore raw
In reply to Jens Axboe
Quoted 15 lines · Andre Hedrick
Quoted 15 lines
Quoted 14 lines · Jens Axboe
Quoted 9 lines · Andre Hedrick
Quoted 2 lines

I just love how the copy of a request has worked its way back into to the code-base. :-/ I recall Linus stating it was/is a horrid mess.

The copy itself is not the horrid mess, the handling of multi write is what is the horrible mess. Having a private copy to mess with is pretty much a necessity IMO if you want to handle > current_nr_sectors at the time without completing it chunk by chunk.

Exactly, and I am about to have a valid clean solution that is short and proper. Now that I have the handler working, I need to have the one walk function to do the bio indexing. Also it is less than 30 lines.

Quoted 5 lines
Quoted 2 lines

Those changes add yet another member to struct bio for no good reason. I'd much rather just do the private copy. So... ->

NO NEW STRUCT TO BIO ...
Private COPY is a given, just using it cleanly the issue.

Last we talked there was a new member added. But again, it's really hard to say without a reference patch...

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Not the stuff you added as an interm fix :-/

I don't consider the copy an interim fix at all. But please show your working handler and we can discuss it, it's pointless to debate what fix is the better one you are sitting on yours.

Yep but this time you get a clean solution that works.

Where? :-)

Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

You know why these changes people are pushing are wrong, because it is way to early to being the compression code process.

You if any know the original TCQ of mine would scream, much less the derivative you started off that code base. Keep that in mind, with an expanded code thread we can isolate changes and test variation.

First of all, my TCQ stuff is in no way based on your code base. It's started from scratch by me. The only patch if yours I was could not achieve any queueing above depth 1.

Quoted 1 line

The fillin(blah, blah, blah) is!

Is what?

Signature · 1 line
Jens Axboe
#32 lore raw
In reply to Jens Axboe
Quoted 3 lines · Jens Axboe

The global read-ahead change is surely not what we want. The IDE cleanups I've seen so far look good to me.

Ask Alan Cox - even he saw finally that it's just removal of dead code...

#33 lore raw
In reply to Jens Axboe
Quoted 7 lines · Martin Dalecki
Quoted 3 lines · Jens Axboe

The global read-ahead change is surely not what we want. The IDE cleanups I've seen so far look good to me.

Ask Alan Cox - even he saw finally that it's just removal of dead code...

Ok I still need to read it, the concern was just that we want to have queue level read-ahead granularity. I'm all for getting rid of the horrid arrays we have now.

Signature · 1 line
Jens Axboe
#34 lore raw
In reply to Jens Axboe
Quoted 7 lines · Jens Axboe
Quoted 6 lines · Martin Dalecki
Quoted 3 lines · Jens Axboe

The global read-ahead change is surely not what we want. The IDE cleanups I've seen so far look good to me.

Quoted 5 lines
Quoted 1 line

Ask Alan Cox - even he saw finally that it's just removal of dead code...

Ok I still need to read it, the concern was just that we want to have queue level read-ahead granularity. I'm all for getting rid of the horrid arrays we have now.

We can add that in a sane way immediately once these arrays are gone.

Signature · 2 lines
Vojtech Pavlik
SuSE Labs
#35 lore raw
In reply to Jens Axboe
Quoted 14 lines · Andre Hedrick
Quoted 14 lines · Vojtech Pavlik
Quoted 12 lines · Martin Dalecki
Quoted 6 lines

So the conclusions is that not just the read_ahead array is bogous now. The max_readahead array can be killed entierly from the kernel as well ;-).

The answer is: I'm now confident that you can just remove all the max_readahead initialization from the ide code.

Since I've come to the same conclusion, here is the patch. It removes read_ahead, max_readahead, BLKRAGET, BLKRASET, BLKFRAGET and BLKFRASET completely.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Comments, Jens?

Could you battle it out, and I'll take a good look at the patch tomorrow :-). I'm all for a bit of spring cleaning here, it's needed it badly for quite a while.

Basically the LOT of all of you are WRONG and quit submitting patches to try and dork up the works.

:) Somehow, I expected exactly this reply from you. Thanks for not disappointing me.

Quoted 4 lines

Since we already have added back one ratehole from 2.4 that Linus strictly forbid, I am glad to see everyone here is an expert! I just love how the copy of a request has worked its way back into to the code-base. :-/ I recall Linus stating it was/is a horrid mess.

Sorry, can't comment on this, the patch I did with Martin certainly doesn't *add* anything.

Signature · 2 lines
Vojtech Pavlik
SuSE Labs
#36 lore raw
In reply to Pavel Machek
Quoted 19 lines · Martin Dalecki
Quoted 6 lines

The later (lv_disk_t) struct isn't used anywhere in the kernel - probably defined for userspace only? That's weird! And also many other structs in lvm.h are nowhere to be found used. Guess we could swipe them out as well.

The first lv_read_ahead (in lv_t) removed. And references to it as well.

Yes I know the lvm coders where too deaf to separate user level structure layout properly from on disk and kernel space by using just different header files for different purposes. And then they tryed apparently to embarce anything they could think off, without really thinking hard about what should be there and what shouldn't. It was too hard for them to have a sneak view on for example Solaris to recognize what's really needed.

diff -ur linux-2.5.4/include/linux/lvm.h linux/include/linux/lvm.h

include/linux/lvm.h line 503

Quoted 7 lines
include/linux/lvm.h +0 -1
@@ -498,7 +498,6 @@
 	uint lv_badblock;	/* for future use */
 	uint lv_allocation;
 	uint lv_io_timeout;	/* for future use */
-	uint lv_read_ahead;
 
 	/* delta to version 1 starts here */
        struct lv_v5 *lv_snapshot_org;

Yes, this is true, but since this struct is passed between the kernel and user space you can't just delete it, or everyone using LVM has a broken system and may not even be able to boot if they have root on LVM. Feel free to delete the code which actually uses this field, but don't remove it from the struct unless you are willing to fix the user space code also.

Quoted 4 lines

But they promise perpetually once in a while that the next version will be "coming real soon" and be wonderfull... Perhaps someone should just stump over them and clean this mess up, with the disrespect those pseudo maintainers do deserve....

Well, I don't work on LVM anymore, but the general consensus is that the current LVM code will die a slow death and be replaced by LVM2 and/or EVMS. So until that happens, don't screw up everyone using LVM.

Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/

#37 lore raw
In reply to Pavel Machek
Quoted 11 lines · Martin Dalecki

If you are already at it, I would like to ask to you consider seriously the removal of the
following entries in the ide drivers /proc control files:

[snip]
ide_add_setting(drive, "file_readahead", ...
&max_readahead[major][minor], NULL);

Those calls can be found in ide-cd.c, ide-disk,c and ide-floppy.c

Quoted 7 lines

[snip]

The second of them is trying to control a file-system level constant inside the actual block device driver.
This is a blatant violation of the layering principle in software design, and should go as soon as
possible.

It really should go (the only one working is for ide-disk) but you need to add another way to tune readahead per disk too...

Tuning this parameter gives quite a bit improved performance when reading from several big files at a time! A diff of two big files is enough to show it: from 10MB/s to 25MB/s (2.4.17-rc1) (due to less time lost seeking)

/RogerL

Signature · 3 lines
Roger Larsson
Skellefteå
Sweden
#38 lore raw
In reply to Pavel Machek
Quoted 11 lines · Martin Dalecki

If you are already at it, I would like to ask to you consider seriously the removal of the
following entries in the ide drivers /proc control files:

ide_add_setting(drive, "breada_readahead", ... 1,
2, &read_ahead[major], NULL);
ide_add_setting(drive, "file_readahead", ...
&max_readahead[major][minor], NULL);

Those calls can be found in ide-cd.c, ide-disk,c and ide-floppy.c

I suspect that if we remove these, we'll one day end up putting them back. It is appropriate that we be able to control readahead characteristics on a per-device and per-technology basis.

Quoted 5 lines

The second of them is trying to control a file-system level constant inside the actual block device driver.
This is a blatant violation of the layering principle in software design, and should go as soon as
possible.

Well, the whole design of filesystems and the VM are a blatant layering violation: all the stuff we do at all levels to try to perform block-contiguous reads and writes, and to keep related data at related LBAs is making implicit assumptions about the underlying physical storage technology. We've been doing that for 30 years - if a constant access time storage technology takes over from rotating and seeking disks, we have a lot of stuff to toss out.

That being said, it is a horrid user interface wart that IDE readhead is controlled from /proc/ide/hda/settings:file_readhead, and that IDE ignores /proc/sys/vm/max-readahead, whereas devices which forget to set up their max_readhead entries are controlled by /proc/sys/vm/max-readhead.

My vote would be to remove both of them. Move the readhead controls into the filemap level, but implement per-device controls. Say, /proc/sys/vm/readhead/hda, /proc/sys/vm/readhead/sdc, etc.

-

#39 lore raw
In reply to Pavel Machek

HELL NO!

Quoted 96 lines · Pavel Machek

Hi!

This is slightly longer but also simple cleanup. It kills code duplication and removes unneccessary assignments/casts. Please apply,

Pavel

drivers/ide/ide-disk.c +19 -27
@@ -172,6 +167,16 @@
 		return WIN_NOP;
 }
 
+static void fill_args (ide_task_t *args, struct hd_drive_task_hdr *taskfile, struct hd_drive_hob_hdr *hobfile)
+{
+	memcpy(args->tfRegister, taskfile, sizeof(struct hd_drive_task_hdr));
+	memcpy(args->hobRegister, hobfile, sizeof(struct hd_drive_hob_hdr));
+	args->command_type	= ide_cmd_type_parser(args);
+	args->prehandler	= ide_pre_handler_parser(taskfile, hobfile);
+	args->handler		= ide_handler_parser(taskfile, hobfile);
+	args->posthandler	= NULL;
+}
+
 static ide_startstop_t chs_rw_disk (ide_drive_t *drive, struct request *rq, unsigned long block)
 {
 	struct hd_drive_task_hdr	taskfile;
@@ -210,16 +215,10 @@
 	printk("buffer=0x%08lx\n", (unsigned long) rq->buffer);
 #endif
 
-	memcpy(args.tfRegister, &taskfile, sizeof(struct hd_drive_task_hdr));
-	memcpy(args.hobRegister, &hobfile, sizeof(struct hd_drive_hob_hdr));
-	args.command_type	= ide_cmd_type_parser(&args);
-	args.prehandler		= ide_pre_handler_parser(&taskfile, &hobfile);
-	args.handler		= ide_handler_parser(&taskfile, &hobfile);
-	args.posthandler	= NULL;
-	args.rq			= (struct request *) rq;
+	fill_args(&args, &taskfile, &hobfile);
+	args.rq			= rq;
 	args.block		= block;
-	rq->special		= NULL;
-	rq->special		= (ide_task_t *)&args;
+	rq->special		= &args;
 
 	return do_rw_taskfile(drive, &args);
 }
@@ -257,16 +255,10 @@
 	printk("buffer=0x%08lx\n", (unsigned long) rq->buffer);
 #endif
 
-	memcpy(args.tfRegister, &taskfile, sizeof(struct hd_drive_task_hdr));
-	memcpy(args.hobRegister, &hobfile, sizeof(struct hd_drive_hob_hdr));
-	args.command_type	= ide_cmd_type_parser(&args);
-	args.prehandler		= ide_pre_handler_parser(&taskfile, &hobfile);
-	args.handler		= ide_handler_parser(&taskfile, &hobfile);
-	args.posthandler	= NULL;
-	args.rq			= (struct request *) rq;
+	fill_args(&args, &taskfile, &hobfile);
+	args.rq			= rq;
 	args.block		= block;
-	rq->special		= NULL;
-	rq->special		= (ide_task_t *)&args;
+	rq->special		= &args;
 
 	return do_rw_taskfile(drive, &args);
 }
@@ -321,16 +313,10 @@
 	printk("buffer=0x%08lx\n", (unsigned long) rq->buffer);
 #endif
 
-	memcpy(args.tfRegister, &taskfile, sizeof(struct hd_drive_task_hdr));
-	memcpy(args.hobRegister, &hobfile, sizeof(struct hd_drive_hob_hdr));
-	args.command_type	= ide_cmd_type_parser(&args);
-	args.prehandler		= ide_pre_handler_parser(&taskfile, &hobfile);
-	args.handler		= ide_handler_parser(&taskfile, &hobfile);
-	args.posthandler	= NULL;
-	args.rq			= (struct request *) rq;
+	fill_args(&args, &taskfile, &hobfile);
+	args.rq			= rq;
 	args.block		= block;
-	rq->special		= NULL;
-	rq->special		= (ide_task_t *)&args;
+	rq->special		= &args;
 
 	return do_rw_taskfile(drive, &args);
 }
Signature · 8 lines
-- 
(about SSSCA) "I don't say this lightly.  However, I really think that the U.S.
no longer is classifiable as a democracy, but rather as a plutocracy." --hpa
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Andre Hedrick
Linux Disk Certification Project Linux ATA Development

#40 lore raw

Am Mit, 2002-02-13 um 06.52 schrieb Andre Hedrick:

Quoted 1 line

HELL NO!

Maybe I'm dreaming something up here but why can't you either
- show your version of the code
or
- tell exactly why a microchange is bad and what you need the particular structure for
?

It would definitely make more sense to share your IDE experience sourcecodewise than to bitch about things you claim other people cannot know.

Signature · 2 lines
Servus,
       Daniel
#41 lore raw
In reply to Pavel Machek
Quoted 1 line · Andre Hedrick

HELL NO!

Hell why?

Quoted 107 lines · Pavel Machek
Quoted 97 lines

Hi!

This is slightly longer but also simple cleanup. It kills code duplication and removes unneccessary assignments/casts. Please apply,

Pavel

drivers/ide/ide-disk.c +19 -27
@@ -172,6 +167,16 @@
 		return WIN_NOP;
 }
 
+static void fill_args (ide_task_t *args, struct hd_drive_task_hdr *taskfile, struct hd_drive_hob_hdr *hobfile)
+{
+	memcpy(args->tfRegister, taskfile, sizeof(struct hd_drive_task_hdr));
+	memcpy(args->hobRegister, hobfile, sizeof(struct hd_drive_hob_hdr));
+	args->command_type	= ide_cmd_type_parser(args);
+	args->prehandler	= ide_pre_handler_parser(taskfile, hobfile);
+	args->handler		= ide_handler_parser(taskfile, hobfile);
+	args->posthandler	= NULL;
+}
+
 static ide_startstop_t chs_rw_disk (ide_drive_t *drive, struct request *rq, unsigned long block)
 {
 	struct hd_drive_task_hdr	taskfile;
@@ -210,16 +215,10 @@
 	printk("buffer=0x%08lx\n", (unsigned long) rq->buffer);
 #endif
 
-	memcpy(args.tfRegister, &taskfile, sizeof(struct hd_drive_task_hdr));
-	memcpy(args.hobRegister, &hobfile, sizeof(struct hd_drive_hob_hdr));
-	args.command_type	= ide_cmd_type_parser(&args);
-	args.prehandler		= ide_pre_handler_parser(&taskfile, &hobfile);
-	args.handler		= ide_handler_parser(&taskfile, &hobfile);
-	args.posthandler	= NULL;
-	args.rq			= (struct request *) rq;
+	fill_args(&args, &taskfile, &hobfile);
+	args.rq			= rq;
 	args.block		= block;
-	rq->special		= NULL;
-	rq->special		= (ide_task_t *)&args;
+	rq->special		= &args;
 
 	return do_rw_taskfile(drive, &args);
 }
@@ -257,16 +255,10 @@
 	printk("buffer=0x%08lx\n", (unsigned long) rq->buffer);
 #endif
 
-	memcpy(args.tfRegister, &taskfile, sizeof(struct hd_drive_task_hdr));
-	memcpy(args.hobRegister, &hobfile, sizeof(struct hd_drive_hob_hdr));
-	args.command_type	= ide_cmd_type_parser(&args);
-	args.prehandler		= ide_pre_handler_parser(&taskfile, &hobfile);
-	args.handler		= ide_handler_parser(&taskfile, &hobfile);
-	args.posthandler	= NULL;
-	args.rq			= (struct request *) rq;
+	fill_args(&args, &taskfile, &hobfile);
+	args.rq			= rq;
 	args.block		= block;
-	rq->special		= NULL;
-	rq->special		= (ide_task_t *)&args;
+	rq->special		= &args;
 
 	return do_rw_taskfile(drive, &args);
 }
@@ -321,16 +313,10 @@
 	printk("buffer=0x%08lx\n", (unsigned long) rq->buffer);
 #endif
 
-	memcpy(args.tfRegister, &taskfile, sizeof(struct hd_drive_task_hdr));
-	memcpy(args.hobRegister, &hobfile, sizeof(struct hd_drive_hob_hdr));
-	args.command_type	= ide_cmd_type_parser(&args);
-	args.prehandler		= ide_pre_handler_parser(&taskfile, &hobfile);
-	args.handler		= ide_handler_parser(&taskfile, &hobfile);
-	args.posthandler	= NULL;
-	args.rq			= (struct request *) rq;
+	fill_args(&args, &taskfile, &hobfile);
+	args.rq			= rq;
 	args.block		= block;
-	rq->special		= NULL;
-	rq->special		= (ide_task_t *)&args;
+	rq->special		= &args;
 
 	return do_rw_taskfile(drive, &args);
 }
Signature · 8 lines
-- 
(about SSSCA) "I don't say this lightly.  However, I really think that the U.S.
no longer is classifiable as a democracy, but rather as a plutocracy." --hpa
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Andre Hedrick
Linux Disk Certification Project Linux ATA Development

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 2 lines
Vojtech Pavlik
SuSE Labs
#42 lore raw
Quoted 5 lines · Vojtech Pavlik
Quoted 1 line · Andre Hedrick

HELL NO!

Hell why?

Does Virtual DMA mean anything?

Does a function struct for handling IO and MMIO help?

All you two are doing is causing more work for me to build a working model.

But it is clear you must poke and screw things up, so I will continue to undo it in my trees until I have it working.

Regards,

Quoted 102 lines
Quoted 102 lines · Pavel Machek
Quoted 97 lines

Hi!

This is slightly longer but also simple cleanup. It kills code duplication and removes unneccessary assignments/casts. Please apply,

Pavel

drivers/ide/ide-disk.c +19 -27
@@ -172,6 +167,16 @@
 		return WIN_NOP;
 }
 
+static void fill_args (ide_task_t *args, struct hd_drive_task_hdr *taskfile, struct hd_drive_hob_hdr *hobfile)
+{
+	memcpy(args->tfRegister, taskfile, sizeof(struct hd_drive_task_hdr));
+	memcpy(args->hobRegister, hobfile, sizeof(struct hd_drive_hob_hdr));
+	args->command_type	= ide_cmd_type_parser(args);
+	args->prehandler	= ide_pre_handler_parser(taskfile, hobfile);
+	args->handler		= ide_handler_parser(taskfile, hobfile);
+	args->posthandler	= NULL;
+}
+
 static ide_startstop_t chs_rw_disk (ide_drive_t *drive, struct request *rq, unsigned long block)
 {
 	struct hd_drive_task_hdr	taskfile;
@@ -210,16 +215,10 @@
 	printk("buffer=0x%08lx\n", (unsigned long) rq->buffer);
 #endif
 
-	memcpy(args.tfRegister, &taskfile, sizeof(struct hd_drive_task_hdr));
-	memcpy(args.hobRegister, &hobfile, sizeof(struct hd_drive_hob_hdr));
-	args.command_type	= ide_cmd_type_parser(&args);
-	args.prehandler		= ide_pre_handler_parser(&taskfile, &hobfile);
-	args.handler		= ide_handler_parser(&taskfile, &hobfile);
-	args.posthandler	= NULL;
-	args.rq			= (struct request *) rq;
+	fill_args(&args, &taskfile, &hobfile);
+	args.rq			= rq;
 	args.block		= block;
-	rq->special		= NULL;
-	rq->special		= (ide_task_t *)&args;
+	rq->special		= &args;
 
 	return do_rw_taskfile(drive, &args);
 }
@@ -257,16 +255,10 @@
 	printk("buffer=0x%08lx\n", (unsigned long) rq->buffer);
 #endif
 
-	memcpy(args.tfRegister, &taskfile, sizeof(struct hd_drive_task_hdr));
-	memcpy(args.hobRegister, &hobfile, sizeof(struct hd_drive_hob_hdr));
-	args.command_type	= ide_cmd_type_parser(&args);
-	args.prehandler		= ide_pre_handler_parser(&taskfile, &hobfile);
-	args.handler		= ide_handler_parser(&taskfile, &hobfile);
-	args.posthandler	= NULL;
-	args.rq			= (struct request *) rq;
+	fill_args(&args, &taskfile, &hobfile);
+	args.rq			= rq;
 	args.block		= block;
-	rq->special		= NULL;
-	rq->special		= (ide_task_t *)&args;
+	rq->special		= &args;
 
 	return do_rw_taskfile(drive, &args);
 }
@@ -321,16 +313,10 @@
 	printk("buffer=0x%08lx\n", (unsigned long) rq->buffer);
 #endif
 
-	memcpy(args.tfRegister, &taskfile, sizeof(struct hd_drive_task_hdr));
-	memcpy(args.hobRegister, &hobfile, sizeof(struct hd_drive_hob_hdr));
-	args.command_type	= ide_cmd_type_parser(&args);
-	args.prehandler		= ide_pre_handler_parser(&taskfile, &hobfile);
-	args.handler		= ide_handler_parser(&taskfile, &hobfile);
-	args.posthandler	= NULL;
-	args.rq			= (struct request *) rq;
+	fill_args(&args, &taskfile, &hobfile);
+	args.rq			= rq;
 	args.block		= block;
-	rq->special		= NULL;
-	rq->special		= (ide_task_t *)&args;
+	rq->special		= &args;
 
 	return do_rw_taskfile(drive, &args);
 }
Signature · 8 lines
-- 
(about SSSCA) "I don't say this lightly.  However, I really think that the U.S.
no longer is classifiable as a democracy, but rather as a plutocracy." --hpa
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Andre Hedrick
Linux Disk Certification Project Linux ATA Development

Quoted 10 lines
Quoted 5 lines

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 2 lines
Vojtech Pavlik
SuSE Labs

Andre Hedrick
Linux Disk Certification Project Linux ATA Development

#43 lore raw
In reply to Vojtech Pavlik
Quoted 9 lines · Andre Hedrick
Quoted 5 lines · Vojtech Pavlik
Quoted 1 line · Andre Hedrick

HELL NO!

Hell why?

Does Virtual DMA mean anything?

Sure. Virtual-Direct-Marketing-Association, then there is the VDS, Vitrual-DMA-Services, which is a DOS DMA access specification, then there is the VDMA on PCI - this is a term used for normal PCI BM DMA passing through an IOMMU-capable bridge. Then there is Virtual-DMA on floppy controllers and NE*000's - which allows feeding the data to the card via PIO when there is no ISA DMA controller available in the system.

None of this is relevant to IDE on Linux.

Perhaps you mean PIO using SG-lists to put the data into the right places. But I still don't see a problem with this and the proposed patch.

Quoted 1 line

Does a function struct for handling IO and MMIO help?

Ugh? What is "function struct"?

Quoted 2 lines

All you two are doing is causing more work for me to build a working model.

It's possible - but then that is because we have different development strategies. Ours is to start with minimum code and if something needs to be made different, then duplicate and edit that. But only when needed. Yours seems to be to duplicate everything first, make the changes and then look at what can be merged.

In theory they both give the same results.

I don't think that happen's in reality. Duplicating first never gets merged together later, as many tiny differences emerge. Believe me, I know this - this already happened many times in the kernel and is a huge amount of work to undo - keep shared code shared.

Quoted 2 lines

But it is clear you must poke and screw things up, so I will continue to undo it in my trees until I have it working.

If you think so, sure, you're free to do that.

Quoted 115 lines
Quoted 102 lines
Quoted 102 lines · Pavel Machek
Quoted 97 lines

Hi!

This is slightly longer but also simple cleanup. It kills code duplication and removes unneccessary assignments/casts. Please apply,

Pavel

drivers/ide/ide-disk.c +19 -27
@@ -172,6 +167,16 @@
 		return WIN_NOP;
 }
 
+static void fill_args (ide_task_t *args, struct hd_drive_task_hdr *taskfile, struct hd_drive_hob_hdr *hobfile)
+{
+	memcpy(args->tfRegister, taskfile, sizeof(struct hd_drive_task_hdr));
+	memcpy(args->hobRegister, hobfile, sizeof(struct hd_drive_hob_hdr));
+	args->command_type	= ide_cmd_type_parser(args);
+	args->prehandler	= ide_pre_handler_parser(taskfile, hobfile);
+	args->handler		= ide_handler_parser(taskfile, hobfile);
+	args->posthandler	= NULL;
+}
+
 static ide_startstop_t chs_rw_disk (ide_drive_t *drive, struct request *rq, unsigned long block)
 {
 	struct hd_drive_task_hdr	taskfile;
@@ -210,16 +215,10 @@
 	printk("buffer=0x%08lx\n", (unsigned long) rq->buffer);
 #endif
 
-	memcpy(args.tfRegister, &taskfile, sizeof(struct hd_drive_task_hdr));
-	memcpy(args.hobRegister, &hobfile, sizeof(struct hd_drive_hob_hdr));
-	args.command_type	= ide_cmd_type_parser(&args);
-	args.prehandler		= ide_pre_handler_parser(&taskfile, &hobfile);
-	args.handler		= ide_handler_parser(&taskfile, &hobfile);
-	args.posthandler	= NULL;
-	args.rq			= (struct request *) rq;
+	fill_args(&args, &taskfile, &hobfile);
+	args.rq			= rq;
 	args.block		= block;
-	rq->special		= NULL;
-	rq->special		= (ide_task_t *)&args;
+	rq->special		= &args;
 
 	return do_rw_taskfile(drive, &args);
 }
@@ -257,16 +255,10 @@
 	printk("buffer=0x%08lx\n", (unsigned long) rq->buffer);
 #endif
 
-	memcpy(args.tfRegister, &taskfile, sizeof(struct hd_drive_task_hdr));
-	memcpy(args.hobRegister, &hobfile, sizeof(struct hd_drive_hob_hdr));
-	args.command_type	= ide_cmd_type_parser(&args);
-	args.prehandler		= ide_pre_handler_parser(&taskfile, &hobfile);
-	args.handler		= ide_handler_parser(&taskfile, &hobfile);
-	args.posthandler	= NULL;
-	args.rq			= (struct request *) rq;
+	fill_args(&args, &taskfile, &hobfile);
+	args.rq			= rq;
 	args.block		= block;
-	rq->special		= NULL;
-	rq->special		= (ide_task_t *)&args;
+	rq->special		= &args;
 
 	return do_rw_taskfile(drive, &args);
 }
@@ -321,16 +313,10 @@
 	printk("buffer=0x%08lx\n", (unsigned long) rq->buffer);
 #endif
 
-	memcpy(args.tfRegister, &taskfile, sizeof(struct hd_drive_task_hdr));
-	memcpy(args.hobRegister, &hobfile, sizeof(struct hd_drive_hob_hdr));
-	args.command_type	= ide_cmd_type_parser(&args);
-	args.prehandler		= ide_pre_handler_parser(&taskfile, &hobfile);
-	args.handler		= ide_handler_parser(&taskfile, &hobfile);
-	args.posthandler	= NULL;
-	args.rq			= (struct request *) rq;
+	fill_args(&args, &taskfile, &hobfile);
+	args.rq			= rq;
 	args.block		= block;
-	rq->special		= NULL;
-	rq->special		= (ide_task_t *)&args;
+	rq->special		= &args;
 
 	return do_rw_taskfile(drive, &args);
 }
Signature · 8 lines
-- 
(about SSSCA) "I don't say this lightly.  However, I really think that the U.S.
no longer is classifiable as a democracy, but rather as a plutocracy." --hpa
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Andre Hedrick
Linux Disk Certification Project Linux ATA Development

Quoted 10 lines
Quoted 5 lines

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 2 lines
Vojtech Pavlik
SuSE Labs

Andre Hedrick
Linux Disk Certification Project Linux ATA Development

Signature · 2 lines
Vojtech Pavlik
SuSE Labs
#44 lore raw
Quoted 19 lines · Vojtech Pavlik
Quoted 9 lines · Andre Hedrick
Quoted 5 lines · Vojtech Pavlik
Quoted 1 line · Andre Hedrick

HELL NO!

Hell why?

Does Virtual DMA mean anything?

Sure. Virtual-Direct-Marketing-Association, then there is the VDS, Vitrual-DMA-Services, which is a DOS DMA access specification, then there is the VDMA on PCI - this is a term used for normal PCI BM DMA passing through an IOMMU-capable bridge. Then there is Virtual-DMA on floppy controllers and NE*000's - which allows feeding the data to the card via PIO when there is no ISA DMA controller available in the system.

Quoted 1 line

None of this is relevant to IDE on Linux.

Well not yet but here is a hint, all future hardware will be MMIO. Meaning all IO is performed under DMA over the ATA-Bridge. Specifically PIO operations are transacted over VDMA to the Bridge and executed as PIO by the Bridge.

Quoted 6 lines

Perhaps you mean PIO using SG-lists to put the data into the right places. But I still don't see a problem with this and the proposed patch.

Quoted 1 line

Does a function struct for handling IO and MMIO help?

Ugh? What is "function struct"?

Since the future will be a mess, and it is possible to have IO/MMIO on the same HOST it will be come more fun than you can imagine.

Quoted 8 lines
Quoted 2 lines

All you two are doing is causing more work for me to build a working model.

It's possible - but then that is because we have different development strategies. Ours is to start with minimum code and if something needs to be made different, then duplicate and edit that. But only when needed. Yours seems to be to duplicate everything first, make the changes and then look at what can be merged.

Mine is knowing the future of hardware and preparing for it to come. Why else would I packetize the ATA-Command Block?

Quoted 11 lines

In theory they both give the same results.

I don't think that happen's in reality. Duplicating first never gets merged together later, as many tiny differences emerge. Believe me, I know this - this already happened many times in the kernel and is a huge amount of work to undo - keep shared code shared.

Quoted 2 lines

But it is clear you must poke and screw things up, so I will continue to undo it in my trees until I have it working.

If you think so, sure, you're free to do that.

Well give you can not have access to hardware which doesn't exist ...

Cheers,

Andre Hedrick
Linux Disk Certification Project Linux ATA Development

#45 lore raw
In reply to Vojtech Pavlik
Quoted 21 lines · Andre Hedrick
Quoted 19 lines · Vojtech Pavlik
Quoted 9 lines · Andre Hedrick
Quoted 5 lines · Vojtech Pavlik
Quoted 1 line · Andre Hedrick

HELL NO!

Hell why?

Does Virtual DMA mean anything?

Sure. Virtual-Direct-Marketing-Association, then there is the VDS, Vitrual-DMA-Services, which is a DOS DMA access specification, then there is the VDMA on PCI - this is a term used for normal PCI BM DMA passing through an IOMMU-capable bridge. Then there is Virtual-DMA on floppy controllers and NE*000's - which allows feeding the data to the card via PIO when there is no ISA DMA controller available in the system.

Quoted 3 lines
Quoted 1 line

None of this is relevant to IDE on Linux.

Well not yet but here is a hint, all future hardware will be MMIO.

That's nice. Actually, that's the case on many archs already.

Quoted 1 line

Meaning all IO is performed under DMA over the ATA-Bridge.

Ugh? This is not the meaning of your first sentence.

Quoted 2 lines

Specifically PIO operations are transacted over VDMA to the Bridge and executed as PIO by the Bridge.

Care to explain in more detail? Hmm, I suppose not.

I suppose you mean that the IDE controller will use BM DMA w/ SG for every transaction and the PIO/DMA/UDMA mode will only be different on the IDE BUS. That's very nice, and actually will make things simpler.

I still don't see how any of the proposed patches kill the possibility to do this.

Quoted 9 lines
Quoted 6 lines

Perhaps you mean PIO using SG-lists to put the data into the right places. But I still don't see a problem with this and the proposed patch.

Quoted 1 line

Does a function struct for handling IO and MMIO help?

Ugh? What is "function struct"?

Since the future will be a mess, and it is possible to have IO/MMIO on the same HOST it will be come more fun than you can imagine.

The future (kernel point of view) will be how we make it to be. If we make a lot of messy code, the future will be a mess. This seems to be what you're doing. (Sorry.)

Quoted 30 lines
Quoted 8 lines
Quoted 2 lines

All you two are doing is causing more work for me to build a working model.

It's possible - but then that is because we have different development strategies. Ours is to start with minimum code and if something needs to be made different, then duplicate and edit that. But only when needed. Yours seems to be to duplicate everything first, make the changes and then look at what can be merged.

Mine is knowing the future of hardware and preparing for it to come. Why else would I packetize the ATA-Command Block?

Quoted 11 lines

In theory they both give the same results.

I don't think that happen's in reality. Duplicating first never gets merged together later, as many tiny differences emerge. Believe me, I know this - this already happened many times in the kernel and is a huge amount of work to undo - keep shared code shared.

Quoted 2 lines

But it is clear you must poke and screw things up, so I will continue to undo it in my trees until I have it working.

If you think so, sure, you're free to do that.

Well give you can not have access to hardware which doesn't exist ...

Cheers,

Andre Hedrick
Linux Disk Certification Project Linux ATA Development

Signature · 2 lines
Vojtech Pavlik
SuSE Labs
#46 lore raw
Quoted 5 lines · Vojtech Pavlik
Quoted 3 lines
Quoted 1 line

None of this is relevant to IDE on Linux.

Well not yet but here is a hint, all future hardware will be MMIO.

That's nice. Actually, that's the case on many archs already.

Well I am totally aware of this issue and know it needs to be addressed.

Quoted 3 lines
Quoted 1 line

Meaning all IO is performed under DMA over the ATA-Bridge.

Ugh? This is not the meaning of your first sentence.

Surprise

Quoted 17 lines
Quoted 2 lines

Specifically PIO operations are transacted over VDMA to the Bridge and executed as PIO by the Bridge.

Care to explain in more detail? Hmm, I suppose not.

I suppose you mean that the IDE controller will use BM DMA w/ SG for every transaction and the PIO/DMA/UDMA mode will only be different on the IDE BUS. That's very nice, and actually will make things simpler.

I still don't see how any of the proposed patches kill the possibility to do this.

Quoted 5 lines
Quoted 5 lines

Perhaps you mean PIO using SG-lists to put the data into the right places. But I still don't see a problem with this and the proposed patch.

Quoted 1 line

Does a function struct for handling IO and MMIO help?

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Ugh? What is "function struct"?

Since the future will be a mess, and it is possible to have IO/MMIO on the same HOST it will be come more fun than you can imagine.

The future (kernel point of view) will be how we make it to be. If we make a lot of messy code, the future will be a mess. This seems to be what you're doing. (Sorry.)

Oh I have the hardware and the newest stuff will have in a few days. The future is Q3 2002 or sooner.

regards,

Andre Hedrick
Linux Disk Certification Project Linux ATA Development

#47 lore raw
In reply to Pavel Machek
Quoted 11 lines · Andrew Morton
Quoted 9 lines · Martin Dalecki

If you are already at it, I would like to ask to you consider seriously the removal of the
following entries in the ide drivers /proc control files:

ide_add_setting(drive, "breada_readahead", ... 1,
2, &read_ahead[major], NULL);
ide_add_setting(drive, "file_readahead", ...
&max_readahead[major][minor], NULL);

Quoted 7 lines
Quoted 2 lines

Those calls can be found in ide-cd.c, ide-disk,c and ide-floppy.c

I suspect that if we remove these, we'll one day end up putting them back. It is appropriate that we be able to control readahead characteristics on a per-device and per-technology basis.

You are missing one simple thing: The removed values doen't control ANYTHING!

#48 lore raw
In reply to Pavel Machek
Quoted 21 lines · Roger Larsson
Quoted 10 lines · Martin Dalecki

If you are already at it, I would like to ask to you consider seriously the removal of the
following entries in the ide drivers /proc control files:

[snip]
ide_add_setting(drive, "file_readahead", ...
&max_readahead[major][minor], NULL);

Those calls can be found in ide-cd.c, ide-disk,c and ide-floppy.c

Quoted 8 lines

[snip]

The second of them is trying to control a file-system level constant inside the actual block device driver.
This is a blatant violation of the layering principle in software design, and should go as soon as
possible.

Quoted 8 lines

It really should go (the only one working is for ide-disk) but you need to add another way to tune readahead per disk too...

Tuning this parameter gives quite a bit improved performance when reading from several big files at a time! A diff of two big files is enough to show it: from 10MB/s to 25MB/s (2.4.17-rc1) (due to less time lost seeking)

We are talking about 2.5.xx. In 2.5.xx the removed parameters just don't change anything and are simple code garbage.

#49 lore raw
In reply to Pavel Machek
Quoted 25 lines · Andreas Dilger
Quoted 23 lines · Martin Dalecki
Quoted 7 lines

The later (lv_disk_t) struct isn't used anywhere in the kernel - probably defined for userspace only? That's weird! And also many other structs in lvm.h are nowhere to be found used. Guess we could swipe them out as well.

The first lv_read_ahead (in lv_t) removed. And references to it as well.

Yes I know the lvm coders where too deaf to separate user level structure layout properly from on disk and kernel space by using just different header files for different purposes. And then they tryed
apparently to embarce anything they could think off, without really
thinking hard about what should be there and what shouldn't. It was too hard for them to have a sneak view on for example Solaris to recognize what's really needed.

diff -ur linux-2.5.4/include/linux/lvm.h linux/include/linux/lvm.h

include/linux/lvm.h +0 -1
@@ -498,7 +498,6 @@
 	uint lv_badblock;	/* for future use */
 	uint lv_allocation;
 	uint lv_io_timeout;	/* for future use */
-	uint lv_read_ahead;
 
Quoted 11 lines

include/linux/lvm.h line 503

Quoted 3 lines
include/linux/lvm.h +0 -0
 	/* delta to version 1 starts here */
       struct lv_v5 *lv_snapshot_org;

Yes, this is true, but since this struct is passed between the kernel and user space you can't just delete it, or everyone using LVM has a broken system and may not even be able to boot if they have root on LVM. Feel free to delete the code which actually uses this field, but don't remove it from the struct unless you are willing to fix the user space code also.

Please note that there are two structs there: One of them is tagged /* core */ and another of them is tagged as beeing /* disk */. The driver does only touch the core version, which is supposedly only to be used by the driver itself. This is what I was complaining about in first
place: Why is the driver's internal struct exposed there at all

All right?

#50 lore raw
In reply to Pavel Machek
Quoted 7 lines · Martin Dalecki
Quoted 5 lines

I suspect that if we remove these, we'll one day end up putting them back. It is appropriate that we be able to control readahead characteristics on a per-device and per-technology basis.

You are missing one simple thing: The removed values doen't control ANYTHING!

The file_readahead setting works as expected and as desired. Or at least it did a few weeks ago.

-

#51 lore raw
In reply to Pavel Machek
Quoted 6 lines · Andrew Morton
Quoted 4 lines · Martin Dalecki
Quoted 4 lines

I suspect that if we remove these, we'll one day end up putting them back. It is appropriate that we be able to control readahead characteristics on a per-device and per-technology basis.

Quoted 7 lines
Quoted 3 lines

You are missing one simple thing: The removed values doen't control ANYTHING!

The file_readahead setting works as expected and as desired. Or at least it did a few weeks ago.

The few weeks ago thing matters. It doesn't any longer.

#52 lore raw
In reply to Pavel Machek
Quoted 6 lines · Martin Dalecki
Quoted 4 lines

The file_readahead setting works as expected and as desired. Or at least it did a few weeks ago.

The few weeks ago thing matters. It doesn't any longer.

Please explain, in detail, why /proc/ide/hdX/settings:file_readhead no longer controls the readhead for that device. If this is the case in thr current 2.4 kernel, or if it will become the case if/when the IDE patches are merged then that needs fixing.

Look, I agree that the current readhead controls are junk, and
do not belong in the driver layer at all. All I'm saying is
that we need per-device controls, for whatever scheme we end
up using for readhead in 2.5. We really don't want to have
the same sized readhead for CDROMs, floppies and super-duper RAID arrays.

-