path: root/drivers/block
AgeCommit message (Collapse)Author
2011-12-02loop: Fix discard_alignment default settingLukas Czerner
discard_alignment is not relevant to the loop driver since it is supposed to be set as a workaround for the old sector 63 alignments. So set it to zero rather than block size. Signed-off-by: Lukas Czerner <> Reported-by: Milan Broz <> Signed-off-by: Jens Axboe <>
2011-11-28cciss: fix flush cache transfer lengthStephen M. Cameron
We weren't filling in the transfer length of the flush cache command (it transfers 4 bytes of zeroes). Firmware didn't seem to be bothered by this, but it should be fixed. Signed-off-by: Stephen M. Cameron <> Signed-off-by: Jens Axboe <>
2011-11-28cciss: Add IRQF_SHARED back in for the non-MSI(X) interrupt handlerStephen M. Cameron
IRQF_SHARED is required for older controllers that don't support MSI(X) and which may end up sharing an interrupt. Also remove deprecated IRQF_DISABLED. Signed-off-by: Stephen M. Cameron <> Signed-off-by: Jens Axboe <>
2011-11-25loop: fix loop block driver discard and encryption commentDave Young
The loop driver does not support discard if encryption is enabled, fix the comment. Signed-off-by: Dave Young <> Signed-off-by: Jens Axboe <>
2011-11-24mtip32xx: uninitialized variable in mtip_quiesce_io()Dan Carpenter
We recently introduce new continue in the loop which make gcc complain. In theory if MTIP_FLAG_SVC_THD_ACTIVE_BIT is set, we could hit continue over and over until eventually we time out of the loop. In that case "active" should be set as true, but right now it's uninitialized. Signed-off-by: Dan Carpenter <> Signed-off-by: Jens Axboe <>
2011-11-23mtip32xx: updates based on feedbackAsai Thambi S P
* queue ncq commands when a non-ncq is in progress or error handling is active * merge variables 'internal_cmd_in_progress' and 'eh_active' into new variable 'flags' * get rid of read/write semaphore 'internal_sem' * new service thread to issue queued commands * use macros from ata.h for command codes * return ENOTTY for BLKFLSBUF ioctl * style changes Signed-off-by: Asai Thambi S P <> Signed-off-by: Sam Bradshaw <> Signed-off-by: Jens Axboe <>
2011-11-18xen-blkback: convert hole punching to discard request on loop devicesLi Dongyang
As of dfaa2ef68e80c378e610e3c8c536f1c239e8d3ef, loop devices support discard request now. We could just issue a discard request, and the loop driver will punch the hole for us, so we don't need to touch the internals of loop device and punch the hole ourselves, Thanks. V0->V1: rebased on devel/for-jens-3.3 Signed-off-by: Li Dongyang <> Signed-off-by: Konrad Rzeszutek Wilk <>
2011-11-18xen/blkback: Move processing of BLKIF_OP_DISCARD from dispatch_rw_block_ioKonrad Rzeszutek Wilk
.. and move it to its own function that will deal with the discard operation. Signed-off-by: Konrad Rzeszutek Wilk <>
2011-11-18xen/blk[front|back]: Enhance discard support with secure erasing support.Konrad Rzeszutek Wilk
Part of the blkdev_issue_discard(xx) operation is that it can also issue a secure discard operation that will permanantly remove the sectors in question. We advertise that we can support that via the 'discard-secure' attribute and on the request, if the 'secure' bit is set, we will attempt to pass in REQ_DISCARD | REQ_SECURE. CC: Li Dongyang <> [v1: Used 'flag' instead of 'secure:1' bit] [v2: Use 'reserved' uint8_t instead of adding a new value] [v3: Check for nseg when mapping instead of operation] Signed-off-by: Konrad Rzeszutek Wilk <>
2011-11-18xen/blk[front|back]: Squash blkif_request_rw and blkif_request_discard togetherKonrad Rzeszutek Wilk
In a union type structure to deal with the overlapping attributes in a easier manner. Suggested-by: Ian Campbell <> Signed-off-by: Konrad Rzeszutek Wilk <>
2011-11-16paride: fix potential information leak in pg_read()Dan Carpenter
Smatch has a new check for Rosenberg type information leaks where structs are copied to the user with uninitialized stack data in them. i In this case, the pg_write_hdr struct has a hole in it. struct pg_write_hdr { char magic; /* 0 1 */ char func; /* 1 1 */ /* XXX 2 bytes hole, try to pack */ int dlen; /* 4 4 */ Signed-off-by: Dan Carpenter <> Cc: Tim Waugh <> Signed-off-by: Andrew Morton <> Signed-off-by: Jens Axboe <>
2011-11-16cciss: auto engage SCSI mid layer at driver load timeStephen M. Cameron
A long time ago, probably in 2002, one of the distros, or maybe more than one, loaded block drivers prior to loading the SCSI mid layer. This meant that the cciss driver, being a block driver, could not engage the SCSI mid layer at init time without panicking, and relied on being poked by a userland program after the system was up (and the SCSI mid layer was therefore present) to engage the SCSI mid layer. This is no longer the case, and cciss can safely rely on the SCSI mid layer being present at init time and engage the SCSI mid layer straight away. This means that users will see their tape drives and medium changers at driver load time without need for a script in /etc/rc.d that does this: for x in /proc/driver/cciss/cciss* do echo "engage scsi" > $x done However, if no tape drives or medium changers are detected, the SCSI mid layer will not be engaged. If a tape drive or medium change is later hot-added to the system it will then be necessary to use the above script or similar for the device(s) to be acceesible. Signed-off-by: Stephen M. Cameron <> Signed-off-by: Andrew Morton <> Signed-off-by: Jens Axboe <>
2011-11-16loop: cleanup set_status interfaceDmitry Monakhov
1) Anyone who has read access to loopdev has permission to call set_status and may change important parameters such as lo_offset, lo_sizelimit and so on, which contradicts to read access pattern and definitely equals to write access pattern. 2) Add lo_offset over i_size check to prevent blkdev_size overflow. ##Testcase_bagin #dd if=/dev/zero of=./file bs=1k count=1 #losetup /dev/loop0 ./file /* userspace_application */ struct loop_info64 loinf; fd = open("/dev/loop0", O_RDONLY); ioctl(fd, LOOP_GET_STATUS64, &loinf); /* Set offset to any value which is bigger than i_size, and sizelimit * to nonzero value*/ loinf.lo_offset = 4096*1024; loinf.lo_sizelimit = 1024; ioctl(fd, LOOP_SET_STATUS64, &loinf); /* After this loop device will have size similar to 0x7fffffffffxxxx */ #blockdev --getsz /dev/loop0 ##OUTPUT: 36028797018955968 ##Testcase_end [ coding-style fixes] Signed-off-by: Dmitry Monakhov <> Signed-off-by: Andrew Morton <> Signed-off-by: Jens Axboe <>
2011-11-16loop: prevent information leak after failed readDmitry Monakhov
If read was not fully successful we have to fail whole bio to prevent information leak of old pages ##Testcase_begin dd if=/dev/zero of=./file bs=1M count=1 losetup /dev/loop0 ./file -o 4096 truncate -s 0 ./file # OOps loop offset is now beyond i_size, so read will silently fail. # So bio's pages would not be cleared, may which result in information leak. hexdump -C /dev/loop0 ##testcase_end Signed-off-by: Dmitry Monakhov <> Signed-off-by: Andrew Morton <> Signed-off-by: Jens Axboe <>
2011-11-11The Windows driver .inf disables ASPM on all cciss devices. Do the same.Matthew Garrett
Signed-off-by: Matthew Garrett <> Cc: Acked-by: Mike Miller <> Signed-off-by: Jens Axboe <>
2011-11-06Merge branch 'modsplit-Oct31_2011' of ↵Linus Torvalds
git:// * 'modsplit-Oct31_2011' of git:// (230 commits) Revert "tracing: Include module.h in define_trace.h" irq: don't put module.h into irq.h for tracking irqgen modules. bluetooth: macroize two small inlines to avoid module.h ip_vs.h: fix implicit use of module_get/module_put from module.h nf_conntrack.h: fix up fallout from implicit moduleparam.h presence include: replace linux/module.h with "struct module" wherever possible include: convert various register fcns to macros to avoid include chaining crypto.h: remove unused crypto_tfm_alg_modname() inline uwb.h: fix implicit use of asm/page.h for PAGE_SIZE pm_runtime.h: explicitly requires notifier.h linux/dmaengine.h: fix implicit use of bitmap.h and asm/page.h miscdevice.h: fix up implicit use of lists and types stop_machine.h: fix implicit use of smp.h for smp_processor_id of: fix implicit use of errno.h in include/linux/of.h of_platform.h: delete needless include <linux/module.h> acpi: remove module.h include from platform/aclinux.h miscdevice.h: delete unnecessary inclusion of module.h device_cgroup.h: delete needless include <linux/module.h> net: sch_generic remove redundant use of <linux/module.h> net: inet_timewait_sock doesnt need <linux/module.h> ... Fix up trivial conflicts (other header files, and removal of the ab3550 mfd driver) in - drivers/media/dvb/frontends/dibx000_common.c - drivers/media/video/{mt9m111.c,ov6650.c} - drivers/mfd/ab3550-core.c - include/linux/dmaengine.h
2011-11-06Merge branch 'stable/vmalloc-3.2' of ↵Linus Torvalds
git:// * 'stable/vmalloc-3.2' of git:// net: xen-netback: use API provided by xenbus module to map rings block: xen-blkback: use API provided by xenbus module to map rings xen: use generic functions instead of xen_{alloc, free}_vm_area()
2011-11-05mtip32xx: update to new ->make_request() APIJens Axboe
Signed-off-by: Jens Axboe <>
2011-11-05mtip32xx: add module.h include to avoid conflict with moduleh treeJens Axboe
Signed-off-by: Jens Axboe <>
2011-11-05mtip32xx: mark a few more items staticJens Axboe
Missed two items: mtip_major, and mtip_pci_driver. Signed-off-by: Jens Axboe <>
2011-11-05mtip32xx: ensure that all local functions are staticJens Axboe
Kill the declarations in the header file and mark them as static. Reshuffle a few functions to ensure that everything is properly declared before being used. Signed-off-by: Jens Axboe <>
2011-11-05mtip32xx: cleanup compat ioctl handlingJens Axboe
Do the conversion/copy up front instead of passing in a compat flag to the ioctl handler and subsequently to the exec_drive_taskfile() function. Signed-off-by: Jens Axboe <>
2011-11-05mtip32xx: fix warnings/errors on 32-bit compilesJens Axboe
We need to clean up the compat ioctl handling, but this makes it work for now at least. Signed-off-by: Jens Axboe <>
2011-11-05block: Add driver for Micron RealSSD pcie flash cardsSam Bradshaw
This adds mtip32xx, a driver supporting Microns line of pci-express flash storage cards. Signed-off-by: Asai Thambi S P <> Signed-off-by: Sam Bradshaw <> Signed-off-by: Jens Axboe <>
2011-11-04Merge branch 'for-3.2/drivers' of git:// Torvalds
* 'for-3.2/drivers' of git:// (30 commits) virtio-blk: use ida to allocate disk index hpsa: add small delay when using PCI Power Management to reset for kump cciss: add small delay when using PCI Power Management to reset for kump xen/blkback: Fix two races in the handling of barrier requests. xen/blkback: Check for proper operation. xen/blkback: Fix the inhibition to map pages when discarding sector ranges. xen/blkback: Report VBD_WSECT (wr_sect) properly. xen/blkback: Support 'feature-barrier' aka old-style BARRIER requests. xen-blkfront: plug device number leak in xlblk_init() error path xen-blkfront: If no barrier or flush is supported, use invalid operation. xen-blkback: use kzalloc() in favor of kmalloc()+memset() xen-blkback: fixed indentation and comments xen-blkfront: fix a deadlock while handling discard response xen-blkfront: Handle discard requests. xen-blkback: Implement discard requests ('feature-discard') xen-blkfront: add BLKIF_OP_DISCARD and discard request struct drivers/block/loop.c: remove unnecessary bdev argument from loop_clr_fd() drivers/block/loop.c: emit uevent on auto release drivers/block/cpqarray.c: use pci_dev->revision loop: always allow userspace partitions and optionally support automatic scanning ... Fic up trivial header file includsion conflict in drivers/block/loop.c
2011-11-04Merge branch 'for-3.2/core' of git:// Torvalds
* 'for-3.2/core' of git:// (29 commits) block: don't call blk_drain_queue() if elevator is not up blk-throttle: use queue_is_locked() instead of lockdep_is_held() blk-throttle: Take blkcg->lock while traversing blkcg->policy_list blk-throttle: Free up policy node associated with deleted rule block: warn if tag is greater than real_max_depth. block: make gendisk hold a reference to its queue blk-flush: move the queue kick into blk-flush: fix invalid BUG_ON in blk_insert_flush block: Remove the control of complete cpu from bio. block: fix a typo in the blk-cgroup.h file block: initialize the bounce pool if high memory may be added later block: fix request_queue lifetime handling by making blk_queue_cleanup() properly shutdown block: drop @tsk from attempt_plug_merge() and explain sync rules block: make get_request[_wait]() fail if queue is dead block: reorganize throtl_get_tg() and blk_throtl_bio() block: reorganize queue draining block: drop unnecessary blk_get/put_queue() in scsi_cmd_ioctl() and blk_get_tg() block: pass around REQ_* flags instead of broken down booleans during request alloc/free block: move blk_throtl prototypes to block/blk.h block: fix genhd refcounting in blkio_policy_parse_and_set() ... Fix up trivial conflicts due to "mddev_t" -> "struct mddev" conversion and making the request functions be of type "void" instead of "int" in - drivers/md/{faulty.c,linear.c,md.c,md.h,multipath.c,raid0.c,raid1.c,raid10.c,raid5.c} - drivers/staging/zram/zram_drv.c
2011-11-04NVMe: Implement doorbell stride capabilityMatthew Wilcox
The doorbell stride allows devices to spread out their doorbells instead of packing them tightly. This feature was added as part of ECN 003. This patch also enables support for more than 512 queues :-) Signed-off-by: Matthew Wilcox <>
2011-11-04NVMe: Version 0.7Matthew Wilcox
Signed-off-by: Matthew Wilcox <>
2011-11-04NVMe: Don't probe namespace 0Matthew Wilcox
ECN 001 documented that namespace 0 is not valid. Sending an Identify with CNS of 0 and Namespace of 0 is an undefined command. Signed-off-by: Matthew Wilcox <>
2011-11-04Fix calculation of number of pages in a PRP ListNisheeth Bhat
The existing calculation underestimated the number of pages required as it did not take into account the pointer at the end of each page. The replacement calculation may overestimate the number of pages required if the last page in the PRP List is entirely full. By using ->npages as a counter as we fill in the pages, we ensure that we don't try to free a page that was never allocated. Signed-off-by: Nisheeth Bhat <> Signed-off-by: Matthew Wilcox <>
2011-11-04NVMe: Create nvme_identify and nvme_get_features functionsMatthew Wilcox
Instead of open-coding calls to nvme_submit_admin_cmd, these small wrappers are simpler to use (the patch removes 14 lines from nvme_dev_add() for example). Signed-off-by: Matthew Wilcox <>
2011-11-04NVMe: Fix memory leak in nvme_dev_add()Matthew Wilcox
The driver was allocating 8k of memory, then freeing 4k of it. Signed-off-by: Matthew Wilcox <>
2011-11-04NVMe: Fix calls to dma_unmap_sgNisheeth Bhat
dma_unmap_sg() must be called with the same 'nents' passed to dma_map_sg(), not the number returned from dma_map_sg(). Signed-off-by: Nisheeth Bhat <> Signed-off-by: Matthew Wilcox <>
2011-11-04NVMe: Correct sg list setup in nvme_map_user_pagesMatthew Wilcox
Our SG list was constructed to always fill the entire first page, even if that was more than the length of the I/O. This is probably harmless, but some IOMMUs might do something bad. Correcting the first call to sg_set_page() made it look a lot closer to the sg_set_page() in the loop, so fold the first call to sg_set_page() into the loop. Reported-by: Nisheeth Bhat <> Signed-off-by: Matthew Wilcox <>
2011-11-04Fix bug in NVME_IOCTL_SUBMIT_IOMatthew Wilcox
Missing 'break' in the switch statement meant that we'd fall through to the 'return -EINVAL' case.
2011-11-04NVMe: Rework ioctlsMatthew Wilcox
Remove the special-purpose IDENTIFY, GET_RANGE_TYPE, DOWNLOAD_FIRMWARE and ACTIVATE_FIRMWARE commands. Replace them with a generic ADMIN_CMD ioctl that can submit any admin command. Add a new ID ioctl that returns the namespace ID of the queried device. It corresponds to the SCSI Idlun ioctl. Signed-off-by: Matthew Wilcox <>
2011-11-04NVMe: Add the nvme thread to the wait queue before waking it upMatthew Wilcox
If the I/O was not completed by a single NVMe command, we add the bio to the congestion list and wake up the kthread to resubmit it. But the kthread calls remove_wait_queue() unconditionally, which will oops if it's not on the wait queue. So add the kthread to the wait queue before waking it up. Signed-off-by: Matthew Wilcox <>
2011-11-04NVMe: Return real error from nvme_create_queueMatthew Wilcox
nvme_setup_io_queues() was assuming that a NULL return from nvme_create_queue() was an out-of-memory error. That's not necessarily true; the adapter might return -EIO, for example. Change the calling convention to return an ERR_PTR on failure instead of NULL. Signed-off-by: Matthew Wilcox <>
2011-11-04NVMe: Version 0.6Matthew Wilcox
Signed-off-by: Matthew Wilcox <>
2011-11-04NVMe: Add a few calling convention notesMatthew Wilcox
For the benefit of reviewers, add comments to a few functions describing their calling context Signed-off-by: Matthew Wilcox <>
2011-11-04NVMe: Handle failures from memory allocations in nvme_setup_prpsMatthew Wilcox
If any of the memory allocations in nvme_setup_prps fail, handle it by modifying the passed-in data length to reflect the number of bytes we are actually able to send. Also allow the caller to specify the GFP flags they need; for user-initiated commands, we can use GFP_KERNEL allocations. The various callers are updated to handle this possibility; the main I/O path is already prepared for this possibility (as it may happen due to nvme_map_bio being unable to map all the segments of the I/O). The other callers return -ENOMEM instead of doing partial I/Os. Reported-by: Andi Kleen <> Signed-off-by: Matthew Wilcox <>
2011-11-04NVMe: Use an IDA to allocate minor numbersMatthew Wilcox
The current approach of using the namespace ID as the minor number doesn't work when there are multiple adapters in the machine. Rather than statically partitioning the number of namespaces between adapters, dynamically allocate minor numbers to namespaces as they are detected. Signed-off-by: Matthew Wilcox <>
2011-11-04NVMe: Add include of delay.h for msleepMatthew Wilcox
Previously it was being implicitly included through some other header file Signed-off-by: Matthew Wilcox <>
2011-11-04NVMe: Add support for timing out I/OsMatthew Wilcox
In the kthread, walk the list of outstanding I/Os and check they've not hit the timeout. Signed-off-by: Matthew Wilcox <>
2011-11-04NVMe: Rename cancel_cmdid_data to cancel_cmdidMatthew Wilcox
The trailing '_data' on the end was annoying and inconsistent. Also, make it actually return the data since this is needed for timing out commands. Signed-off-by: Matthew Wilcox <>
2011-11-04NVMe: Fix bug in error handlingMatthew Wilcox
When an I/O completed with an error, we would call bio_endio twice (once with -EIO and once with 0). Found by inspection. Signed-off-by: Matthew Wilcox <>
2011-11-04NVMe: Time out initialisation after a few secondsMatthew Wilcox
THe device reports (in its capability register) how long it will take to initialise. If that time elapses before the ready bit becomes set, conclude the device is broken and refuse to initialise it. Log a nice error message so the user knows why we did nothing. Signed-off-by: Matthew Wilcox <>
2011-11-04NVMe: Fix warning in free_irqMatthew Wilcox
We need to clear the affinity mask before calling free_irq() Reported-by: Shane Michael Matthews <> Signed-off-by: Matthew Wilcox <>
2011-11-04NVMe: Correct the Controller Configuration settingsMatthew Wilcox
The arbitration field was extended by one bit, shifting the shutdown notification bits by one. Also, the SQ/CQ entry size was made configurable for future extensions. Reported-by: Paul Luse <> Signed-off-by: Matthew Wilcox <>
2011-11-04NVMe: Version 0.5Matthew Wilcox
Signed-off-by: Matthew Wilcox <>