Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 548453fd authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'for-2.6.26' of git://git.kernel.dk/linux-2.6-block

* 'for-2.6.26' of git://git.kernel.dk/linux-2.6-block:
  block: fix blk_register_queue() return value
  block: fix memory hotplug and bouncing in block layer
  block: replace remaining __FUNCTION__ occurrences
  Kconfig: clean up block/Kconfig help descriptions
  cciss: fix warning oops on rmmod of driver
  cciss: Fix race between disk-adding code and interrupt handler
  block: move the padding adjustment to blk_rq_map_sg
  block: add bio_copy_user_iov support to blk_rq_map_user_iov
  block: convert bio_copy_user to bio_copy_user_iov
  loop: manage partitions in disk image
  cdrom: use kmalloced buffers instead of buffers on stack
  cdrom: make unregister_cdrom() return void
  cdrom: use list_head for cdrom_device_info list
  cdrom: protect cdrom_device_info list by mutex
  cdrom: cleanup hardcoded error-code
  cdrom: remove ifdef CONFIG_SYSCTL
parents 9fd91217 fb199746
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -777,7 +777,7 @@ Note that a driver must have one static structure, $<device>_dops$, while
it may have as many structures $<device>_info$ as there are minor devices
active. $Register_cdrom()$ builds a linked list from these. 

\subsection{$Int\ unregister_cdrom(struct\ cdrom_device_info * cdi)$}
\subsection{$Void\ unregister_cdrom(struct\ cdrom_device_info * cdi)$}

Unregistering device $cdi$ with minor number $MINOR(cdi\to dev)$ removes
the minor device from the list. If it was the last registered minor for
+42 −23
Original line number Diff line number Diff line
@@ -5,14 +5,18 @@ menuconfig BLOCK
       bool "Enable the block layer" if EMBEDDED
       default y
       help
	 This permits the block layer to be removed from the kernel if it's not
	 needed (on some embedded devices for example).  If this option is
	 disabled, then blockdev files will become unusable and some
	 filesystems (such as ext3) will become unavailable.
	 Provide block layer support for the kernel.

	 This option will also disable SCSI character devices and USB storage
	 since they make use of various block layer definitions and
	 facilities.
	 Disable this option to remove the block layer support from the
	 kernel. This may be useful for embedded devices.

	 If this option is disabled:

	   - block device files will become unusable
	   - some filesystems (such as ext3) will become unavailable.

	 Also, SCSI character devices and USB storage will be disabled since
	 they make use of various block layer definitions and facilities.

	 Say Y here unless you know you really don't want to mount disks and
	 suchlike.
@@ -23,9 +27,20 @@ config LBD
	bool "Support for Large Block Devices"
	depends on !64BIT
	help
	  Say Y here if you want to attach large (bigger than 2TB) discs to
	  your machine, or if you want to have a raid or loopback device
	  bigger than 2TB.  Otherwise say N.
	  Enable block devices of size 2TB and larger.

	  This option is required to support the full capacity of large
	  (2TB+) block devices, including RAID, disk, Network Block Device,
	  Logical Volume Manager (LVM) and loopback.

	  For example, RAID devices are frequently bigger than the capacity
	  of the largest individual hard drive.

	  This option is not required if you have individual disk drives
	  which total 2TB+ and you are not aggregating the capacity into
	  a large block device (e.g. using RAID or LVM).

	  If unsure, say N.

config BLK_DEV_IO_TRACE
	bool "Support for tracing block io actions"
@@ -33,19 +48,21 @@ config BLK_DEV_IO_TRACE
	select RELAY
	select DEBUG_FS
	help
	  Say Y here, if you want to be able to trace the block layer actions
	  Say Y here if you want to be able to trace the block layer actions
	  on a given queue. Tracing allows you to see any traffic happening
	  on a block device queue. For more information (and the userspace
	  support tools needed), fetch the blktrace app from:
	  support tools needed), fetch the blktrace tools from:

	  git://git.kernel.dk/blktrace.git

	  If unsure, say N.

config LSF
	bool "Support for Large Single Files"
	depends on !64BIT
	help
	  Say Y here if you want to be able to handle very large files (bigger
	  than 2TB), otherwise say N.
	  Say Y here if you want to be able to handle very large files (2TB
	  and larger), otherwise say N.

	  If unsure, say Y.

@@ -62,6 +79,8 @@ config BLK_DEV_BSG
	  protocols (e.g. Task Management Functions and SMP in Serial
	  Attached SCSI).

	  If unsure, say N.

endif # BLOCK

config BLOCK_COMPAT
+22 −24
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
#include <linux/module.h>
#include <linux/bio.h>
#include <linux/blkdev.h>
#include <scsi/sg.h>		/* for struct sg_iovec */

#include "blk.h"

@@ -140,25 +141,8 @@ int blk_rq_map_user(struct request_queue *q, struct request *rq,
		ubuf += ret;
	}

	/*
	 * __blk_rq_map_user() copies the buffers if starting address
	 * or length isn't aligned to dma_pad_mask.  As the copied
	 * buffer is always page aligned, we know that there's enough
	 * room for padding.  Extend the last bio and update
	 * rq->data_len accordingly.
	 *
	 * On unmap, bio_uncopy_user() will use unmodified
	 * bio_map_data pointed to by bio->bi_private.
	 */
	if (len & q->dma_pad_mask) {
		unsigned int pad_len = (q->dma_pad_mask & ~len) + 1;
		struct bio *tail = rq->biotail;

		tail->bi_io_vec[tail->bi_vcnt - 1].bv_len += pad_len;
		tail->bi_size += pad_len;

		rq->extra_len += pad_len;
	}
	if (!bio_flagged(bio, BIO_USER_MAPPED))
		rq->cmd_flags |= REQ_COPY_USER;

	rq->buffer = rq->data = NULL;
	return 0;
@@ -194,15 +178,26 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq,
			struct sg_iovec *iov, int iov_count, unsigned int len)
{
	struct bio *bio;
	int i, read = rq_data_dir(rq) == READ;
	int unaligned = 0;

	if (!iov || iov_count <= 0)
		return -EINVAL;

	/* we don't allow misaligned data like bio_map_user() does.  If the
	 * user is using sg, they're expected to know the alignment constraints
	 * and respect them accordingly */
	bio = bio_map_user_iov(q, NULL, iov, iov_count,
				rq_data_dir(rq) == READ);
	for (i = 0; i < iov_count; i++) {
		unsigned long uaddr = (unsigned long)iov[i].iov_base;

		if (uaddr & queue_dma_alignment(q)) {
			unaligned = 1;
			break;
		}
	}

	if (unaligned || (q->dma_pad_mask & len))
		bio = bio_copy_user_iov(q, iov, iov_count, read);
	else
		bio = bio_map_user_iov(q, NULL, iov, iov_count, read);

	if (IS_ERR(bio))
		return PTR_ERR(bio);

@@ -212,6 +207,9 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq,
		return -EINVAL;
	}

	if (!bio_flagged(bio, BIO_USER_MAPPED))
		rq->cmd_flags |= REQ_COPY_USER;

	bio_get(bio);
	blk_rq_bio_prep(q, rq, bio);
	rq->buffer = rq->data = NULL;
+9 −0
Original line number Diff line number Diff line
@@ -220,6 +220,15 @@ new_segment:
		bvprv = bvec;
	} /* segments in rq */


	if (unlikely(rq->cmd_flags & REQ_COPY_USER) &&
	    (rq->data_len & q->dma_pad_mask)) {
		unsigned int pad_len = (q->dma_pad_mask & ~rq->data_len) + 1;

		sg->length += pad_len;
		rq->extra_len += pad_len;
	}

	if (q->dma_drain_size && q->dma_drain_needed(rq)) {
		if (rq->cmd_flags & REQ_RW)
			memset(q->dma_drain_buffer, 0, q->dma_drain_size);
+8 −2
Original line number Diff line number Diff line
@@ -276,9 +276,12 @@ int blk_register_queue(struct gendisk *disk)

	struct request_queue *q = disk->queue;

	if (!q || !q->request_fn)
	if (WARN_ON(!q))
		return -ENXIO;

	if (!q->request_fn)
		return 0;

	ret = kobject_add(&q->kobj, kobject_get(&disk->dev.kobj),
			  "%s", "queue");
	if (ret < 0)
@@ -300,7 +303,10 @@ void blk_unregister_queue(struct gendisk *disk)
{
	struct request_queue *q = disk->queue;

	if (q && q->request_fn) {
	if (WARN_ON(!q))
		return;

	if (q->request_fn) {
		elv_unregister_queue(q);

		kobject_uevent(&q->kobj, KOBJ_REMOVE);
Loading