linux/block
Vasily Tarasov f772b3d9ca block: blk_max_pfn is somtimes wrong
There is a small problem in handling page bounce.

At the moment blk_max_pfn equals max_pfn, which is in fact not maximum
possible _number_ of a page frame, but the _amount_ of page frames.  For
example for the 32bit x86 node with 4Gb RAM, max_pfn = 0x100000, but not
0xFFFF.

request_queue structure has a member q->bounce_pfn and queue needs bounce
pages for the pages _above_ this limit.  This routine is handled by
blk_queue_bounce(), where the following check is produced:

	if (q->bounce_pfn >= blk_max_pfn)
		return;

Assume, that a driver has set q->bounce_pfn to 0xFFFF, but blk_max_pfn
equals 0x10000.  In such situation the check above fails and for each bio
we always fall down for iterating over pages tied to the bio.

I want to notice, that for quite a big range of device drivers (ide, md,
...) such problem doesn't happen because they use BLK_BOUNCE_ANY for
bounce_pfn.  BLK_BOUNCE_ANY is defined as blk_max_pfn << PAGE_SHIFT, and
then the check above doesn't fail.  But for other drivers, which obtain
reuired value from drivers, it fails.  For example sata_nv uses
ATA_DMA_MASK or dev->dma_mask.

I propose to use (max_pfn - 1) for blk_max_pfn.  And the same for
blk_max_low_pfn.  The patch also cleanses some checks related with
bounce_pfn.

Signed-off-by: Vasily Tarasov <vtaras@openvz.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2007-03-27 08:52:47 +02:00
..
as-iosched.c [PATCH] Allow as-iosched to be unloaded 2006-12-13 13:25:18 +01:00
blktrace.c [PATCH] mark struct file_operations const 3 2007-02-12 09:48:45 -08:00
cfq-iosched.c cfq-iosched: improve continue or break logic in cfq_dispatch 2007-02-11 23:14:45 +01:00
deadline-iosched.c [BLOCK] Cleanup unused variable passing 2006-12-01 10:42:33 +01:00
elevator.c elevator: don't sort reads between writes 2007-02-11 23:14:44 +01:00
genhd.c [PATCH] rework reserved major handling 2007-02-20 17:10:13 -08:00
ioctl.c [PATCH] lockdep: annotate BLKPG_DEL_PARTITION 2007-02-20 17:10:16 -08:00
Kconfig [PATCH] Centralise definitions of sector_t and blkcnt_t 2006-12-04 19:41:15 -08:00
Kconfig.iosched update I/O sched Kconfig help texts - CFQ is now default, not AS. 2007-02-17 20:08:22 +01:00
ll_rw_blk.c block: blk_max_pfn is somtimes wrong 2007-03-27 08:52:47 +02:00
Makefile [PATCH] BLOCK: Make it possible to disable the block layer [try #6] 2006-09-30 20:52:31 +02:00
noop-iosched.c [BLOCK] Cleanup unused variable passing 2006-12-01 10:42:33 +01:00
scsi_ioctl.c [PATCH] Fix SG_IO timeout jiffy conversion 2007-01-29 20:32:03 -08:00