alistair23-linux/drivers/block
Mel Gorman a3b8d92d25 block,xd: Delay allocation of DMA buffers until device is known
Loading the XD module triggers a warning like

 WARNING: at mm/page_alloc.c:1805
 __alloc_pages_nodemask+0x127/0x48f()
 Hardware name: System Product Name
 Modules linked in:
 Pid: 1, comm: swapper Not tainted 2.6.32-rc8-git5 #1
 Call Trace:
  [<c103d94b>] warn_slowpath_common+0x65/0x95
  [<c103d98d>] warn_slowpath_null+0x12/0x15
  [<c109550c>] __alloc_pages_nodemask+0x127/0x48f
  [<c10be964>] ? get_slab+0x8/0x50
  [<c10b8979>] alloc_page_interleave+0x2e/0x6e
  [<c10b8a10>] alloc_pages_current+0x57/0x99
  [<c2083a4a>] ? xd_init+0x0/0x482
  [<c1094c38>] __get_free_pages+0xd/0x1e
  [<c2083a94>] xd_init+0x4a/0x482
  [<c2082df0>] ? loop_init+0x104/0x16a
  [<c169162d>] ? loop_probe+0x0/0xaf
  [<c2083a4a>] ? xd_init+0x0/0x482
  [<c1001143>] do_one_initcall+0x51/0x13f
  [<c204a307>] kernel_init+0x10b/0x15f
  [<c204a1fc>] ? kernel_init+0x0/0x15f
  [<c1004347>] kernel_thread_helper+0x7/0x10
 ---[ end trace 686db6333ade6e7a ]---
 xd: Out of memory.

The warning is because the alloc_pages is called with an
order >= MAX_ORDER. The simplistic reason is that get_order(0) returns garbage
values when given 0 as a size. The more complex reason is that the XD driver
initialisation is broken.

It's not clear why this ever worked. XD allocates a buffer for DMA based
on the value of xd_maxsectors. This value is determined by the exact
type of controller in use but the value is determined *after* an attempt
has been made to allocate the buffer. i.e. the requested size of the DMA
buffer will always be 0.

This patch alters how XD is initialised slightly by allocating the
buffer when and if a device has actually been detected. The error paths
are updated to suit the new logic.

Signed-off-by: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2009-12-09 15:11:03 +01:00
..
aoe aoe: prevent cache aliases 2009-12-01 16:32:20 -08:00
drbd drbd: Following the hmac change to SHASH (see linux commit 8bd1209cff) 2009-12-09 15:11:03 +01:00
paride const: make block_device_operations const 2009-09-22 07:17:25 -07:00
amiflop.c const: make block_device_operations const 2009-09-22 07:17:25 -07:00
ataflop.c const: make block_device_operations const 2009-09-22 07:17:25 -07:00
brd.c const: make block_device_operations const 2009-09-22 07:17:25 -07:00
cciss.c cciss: fix scatter gather cleanup problems 2009-11-23 09:31:48 +01:00
cciss.h cciss: change Cmd_sg_list.sg_chain_dma type to dma_addr_t 2009-11-23 09:35:06 +01:00
cciss_cmd.h cciss: Add enhanced scatter-gather support. 2009-11-13 08:45:54 +01:00
cciss_scsi.c cciss: Fix weird usage of ENXIO in cciss_scsi.c 2009-11-13 08:45:54 +01:00
cciss_scsi.h cciss: Fix cciss SCSI rescan code to better notice device changes 2008-10-09 08:56:18 +02:00
cpqarray.c cpqarray: switch to seq_file 2009-10-01 21:15:40 +02:00
cpqarray.h
cryptoloop.c
DAC960.c dac960: switch to seq_file 2009-10-01 21:15:40 +02:00
DAC960.h
floppy.c const: make block_device_operations const 2009-09-22 07:17:25 -07:00
hd.c const: make block_device_operations const 2009-09-22 07:17:25 -07:00
ida_cmd.h
ida_ioctl.h
Kconfig The DRBD driver 2009-10-01 21:17:49 +02:00
loop.c loop: fix NULL dereference if mount fails 2009-10-29 07:39:27 -07:00
Makefile The DRBD driver 2009-10-01 21:17:49 +02:00
mg_disk.c const: make block_device_operations const 2009-09-22 07:17:25 -07:00
nbd.c const: make block_device_operations const 2009-09-22 07:17:25 -07:00
osdblk.c const: make block_device_operations const 2009-09-22 07:17:25 -07:00
pktcdvd.c const: make block_device_operations const 2009-09-22 07:17:25 -07:00
ps3disk.c const: make block_device_operations const 2009-09-22 07:17:25 -07:00
ps3vram.c block/ps3: fix slow VRAM IO 2009-11-04 09:09:28 +01:00
smart1,2.h
sunvdc.c const: make block_device_operations const 2009-09-22 07:17:25 -07:00
swim.c const: make block_device_operations const 2009-09-22 07:17:25 -07:00
swim3.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2009-09-22 07:51:45 -07:00
swim_asm.S m68k: mac - Add SWIM floppy support 2009-03-26 21:15:27 +01:00
sx8.c const: make block_device_operations const 2009-09-22 07:17:25 -07:00
ub.c const: make block_device_operations const 2009-09-22 07:17:25 -07:00
umem.c const: make block_device_operations const 2009-09-22 07:17:25 -07:00
umem.h
viodasd.c const: make block_device_operations const 2009-09-22 07:17:25 -07:00
virtio_blk.c virtio_blk: Revert serial number support 2009-10-22 16:39:30 +10:30
xd.c block,xd: Delay allocation of DMA buffers until device is known 2009-12-09 15:11:03 +01:00
xd.h [PATCH] switch xd 2008-10-21 07:48:11 -04:00
xen-blkfront.c const: make block_device_operations const 2009-09-22 07:17:25 -07:00
xsysace.c const: make block_device_operations const 2009-09-22 07:17:25 -07:00
z2ram.c const: make block_device_operations const 2009-09-22 07:17:25 -07:00