summaryrefslogtreecommitdiffstats
path: root/block
Commit message (Collapse)AuthorAgeFilesLines
* block: fix blkdev_issue_flush() not detecting and passing EOPNOTSUPP backJens Axboe2008-03-041-2/+7
| | | | | | | | | This is important to eg dm, that tries to decide whether to stop using barriers or not. Tested as working by Anders Henke <anders.henke@1und1.de> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* block: fix shadowed variable warning in blk-map.cHarvey Harrison2008-03-041-3/+3
| | | | | | | | | Introduced between 2.6.25-rc2 and -rc3 block/blk-map.c:154:14: warning: symbol 'bio' shadows an earlier one block/blk-map.c:110:13: originally declared here Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* block: remove extern on function definitionHarvey Harrison2008-03-041-1/+1
| | | | | | | | Intoduced between 2.6.25-rc2 and -rc3 block/blk-settings.c:319:12: warning: function 'blk_queue_dma_drain' with external linkage has definition Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* unexport blk_rq_map_user_iovAdrian Bunk2008-03-041-1/+0Star
| | | | | | | This patch removes the unused export of blk_rq_map_user_iov. Signed-off-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* unexport blk_{get,put}_queueAdrian Bunk2008-03-041-2/+0Star
| | | | | | | This patch removes the unused exports of blk_{get,put}_queue. Signed-off-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* block/genhd.c: cleanupsAdrian Bunk2008-03-041-1/+5
| | | | | | | | | This patch contains the following cleanups: - make the needlessly global struct disk_type static - #if 0 the unused genhd_media_change_notify() Signed-off-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* proper prototype for blk_dev_init()Adrian Bunk2008-03-042-2/+4
| | | | | | | This patch adds a proper prototye for blk_dev_init() in block/blk.h Signed-off-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* block/blk-tag.c should #include "blk.h"Adrian Bunk2008-03-041-0/+2
| | | | | | | | Every file should include the headers containing the externs for its global functions (in this case for __blk_queue_free_tags()). Signed-off-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* Fix DMA access of block device in 64-bit kernel on some non-x86 systems with ↵Yang Shi2008-03-041-1/+1
| | | | | | | | | | | 4GB or upper 4GB memory For some non-x86 systems with 4GB or upper 4GB memory, we need increase the range of addresses that can be used for direct DMA in 64-bit kernel. Signed-off-by: Yang Shi <yang.shi@windriver.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* block: separate out padding from alignmentTejun Heo2008-03-042-7/+30
| | | | | | | | | | | | | | | | Block layer alignment was used for two different purposes - memory alignment and padding. This causes problems in lower layers because drivers which only require memory alignment ends up with adjusted rq->data_len. Separate out padding such that padding occurs iff driver explicitly requests it. Tomo: restorethe code to update bio in blk_rq_map_user introduced by the commit 40b01b9bbdf51ae543a04744283bf2d56c4a6afa according to padding alignment. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* block: restore the meaning of rq->data_len to the true data lengthFUJITA Tomonori2008-03-045-14/+9Star
| | | | | | | | | | | | | | | | | | The meaning of rq->data_len was changed to the length of an allocated buffer from the true data length. It breaks SG_IO friends and bsg. This patch restores the meaning of rq->data_len to the true data length and adds rq->extra_len to store an extended length (due to drain buffer and padding). This patch also removes the code to update bio in blk_rq_map_user introduced by the commit 40b01b9bbdf51ae543a04744283bf2d56c4a6afa. The commit adjusts bio according to memory alignment (queue_dma_alignment). However, memory alignment is NOT padding alignment. This adjustment also breaks SG_IO friends and bsg. Padding alignment needs to be fixed in a proper way (by a separate patch). Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Jens Axboe <axboe@carl.home.kernel.dk>
* block: fix kernel-docbook parameters and filesRandy Dunlap2008-03-042-1/+2
| | | | | | | | | | kernel-doc for block/: - add missing parameters - fix one function's parameter list (remove blank line) - add 2 source files to docbook for non-exported kernel-doc functions Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* block: clear drain buffer if draining for write commandTejun Heo2008-02-191-0/+3
| | | | | | | | Clear drain buffer before chaining if the command in question is a write. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* block: implement request_queue->dma_drain_neededTejun Heo2008-02-192-3/+6
| | | | | | | | | | | Draining shouldn't be done for commands where overflow may indicate data integrity issues. Add dma_drain_needed callback to request_queue. Drain buffer is appened iff this function returns non-zero. Signed-off-by: Tejun Heo <htejun@gmail.com> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* block: add request->raw_data_lenTejun Heo2008-02-195-5/+11
| | | | | | | | | | | | | | | | | | | | | | | With padding and draining moved into it, block layer now may extend requests as directed by queue parameters, so now a request has two sizes - the original request size and the extended size which matches the size of area pointed to by bios and later by sgs. The latter size is what lower layers are primarily interested in when allocating, filling up DMA tables and setting up the controller. Both padding and draining extend the data area to accomodate controller characteristics. As any controller which speaks SCSI can handle underflows, feeding larger data area is safe. So, this patch makes the primary data length field, request->data_len, indicate the size of full data area and add a separate length field, request->raw_data_len, for the unmodified request size. The latter is used to report to higher layer (userland) and where the original request size should be fed to the controller or device. Signed-off-by: Tejun Heo <htejun@gmail.com> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* block: update bio according to DMA alignment paddingTejun Heo2008-02-191-0/+17
| | | | | | | | | | | | | | | | | DMA start address and transfer size alignment for PC requests are achieved using bio_copy_user() instead of bio_map_user(). This works because bio_copy_user() always uses full pages and block DMA alignment isn't allowed to go over PAGE_SIZE. However, the implementation didn't update the last bio of the request to make this padding visible to lower layers. This patch makes blk_rq_map_user() extend the last bio such that it includes the padding area and the size of area pointed to by the request is properly aligned. Signed-off-by: Tejun Heo <htejun@gmail.com> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* elevator: make elevator_get() attempt to load the appropriate moduleJens Axboe2008-02-191-0/+15
| | | | | | | | | | | | Currently we fail if someone requests a valid io scheduler, but it's modular and not currently loaded. That can happen from a driver init asking for a different scheduler, or online switching through sysfs as requested by a user. This patch makes elevator_get() request_module() to attempt to load the appropriate module, instead of requiring that done manually. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* cfq-iosched: add hlist for browsing parallel to the radix treeJens Axboe2008-02-192-46/+27Star
| | | | | | | | | | | It's cumbersome to browse a radix tree from start to finish, especially since we modify keys when a process exits. So add a hlist for the single purpose of browsing over all known cfq_io_contexts, used for exit, io prio change, etc. This fixes http://bugzilla.kernel.org/show_bug.cgi?id=9948 Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* block: make blk_rq_map_user() clear ->bio if it unmaps itJens Axboe2008-02-191-0/+1
| | | | | | | That way the interface is symmetric, and calling blk_rq_unmap_user() on the request wont oops. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* make blk_settings_init() staticAdrian Bunk2008-02-191-1/+1
| | | | | | | blk_settings_init() can become static. Signed-off-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: Jens Axboe <axboe@carl.home.kernel.dk>
* make blk_ioc_init() staticAdrian Bunk2008-02-191-1/+1
| | | | | | | blk_ioc_init() can become static. Signed-off-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: Jens Axboe <axboe@carl.home.kernel.dk>
* make blk-core.c:request_cachep static againAdrian Bunk2008-02-191-1/+1
| | | | | | | request_cachep needlessly became global. Signed-off-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: Jens Axboe <axboe@carl.home.kernel.dk>
* Enhanced partition statistics: remove old partition statisticsJerome Marchand2008-02-081-4/+0Star
| | | | | | | Removes the now unused old partition statistic code. Signed-off-by: Jerome Marchand <jmarchan@redhat.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* Enhanced partition statistics: procfsJerome Marchand2008-02-081-6/+22
| | | | | | Reports enhanced partition statistics in /proc/diskstats. Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
* Enhanced partition statistics: update partition statiticsJerome Marchand2008-02-082-4/+36
| | | | | | | | Updates the enhanced partition statistics in generic block layer besides the disk statistics. Signed-off-by: Jerome Marchand <jmarchan@redhat.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* block: fixup rq_init() a bitJens Axboe2008-02-081-6/+17
| | | | | | | | | Rearrange fields in cache order and initialize some fields that we didn't previously init. Remove init of ->completion_data, it's part of a union with ->hash. Luckily clearing the rb node is the same as setting it to null! Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* block: kill swap_io_context()Jens Axboe2008-02-012-23/+0Star
| | | | | | | | | | It blindly copies everything in the io_context, including the lock. That doesn't work so well for either lock ordering or lockdep. There seems zero point in swapping io contexts on a request to request merge, so the best point of action is to just remove it. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* as-iosched: fix inconsistent ioc->lock contextJens Axboe2008-02-011-4/+6
| | | | | | | | | | | Since it's acquired from irq context, all locking must be of the irq safe variant. Most are already inside the queue lock (which already disables interrupts), but the io scheduler rmmod path always has irqs enabled and the put_io_context() path may legally be called with irqs enabled (even if it isn't usually). So fixup those two. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* block: make elevator lib checkpatch compliantJens Axboe2008-02-011-27/+30
| | | | Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* cfq-iosched: make checkpatch compliantJens Axboe2008-02-011-37/+46
| | | | Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* block: make core bits checkpatch compliantJens Axboe2008-02-018-142/+117Star
| | | | Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* block: new end request handling interface should take unsigned byte countsJens Axboe2008-02-011-7/+9
| | | | | | | No point in passing signed integers as the byte count, they can never be negative. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* [SCSI] bsg: copy the cmd_type field to the subordinate request for bidiJames Bottomley2008-01-301-0/+1
| | | | | | | | | This fixes a problem in SCSI where we use the (previously uninitialised) cmd_type via blk_pc_request() to set up the transfer in scsi_init_sgtable(). Acked-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
* as-iosched: fix double locking bug in as_merged_requests()Jens Axboe2008-01-301-3/+7
| | | | | | | | | | If the two requests belong to the same io context, we will attempt to lock the same lock twice. But swapping contexts is pointless in that case, so just check for rioc == nioc before doing the double lock and copy. Tested-by: Olof Johansson <olof@lixom.net> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* block: constify function pointer tablesJan Engelhardt2008-01-291-2/+2
| | | | | Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* Expose hardware sector sizeMartin K. Petersen2008-01-291-0/+11
| | | | | | | Expose hardware sector size in sysfs queue directory. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* block: ll_rw_blk.c split, add blk-merge.cJens Axboe2008-01-294-481/+495
| | | | Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* block: remove dated (and wrong) comment in blk-core.cJens Axboe2008-01-291-5/+0Star
| | | | Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* block: get rid of unnecessary forward declarations in blk-core.cJens Axboe2008-01-291-32/+30Star
| | | | Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* block: continue ll_rw_blk.c splitupJens Axboe2008-01-298-1249/+1312
| | | | | | | Adds files for barrier handling, rq execution, io context handling, mapping data to requests, and queue settings. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* block: split tag and sysfs handling from blk-core.cJens Axboe2008-01-295-710/+735
| | | | | | Seperates the tag and sysfs handling from ll_rw_blk. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* block: first step of splitting ll_rw_blk, rename itJens Axboe2008-01-292-1/+1
| | | | | | Then we retain history in blk-core.c Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* Merge branch 'for-2.6.25' of git://git.kernel.dk/linux-2.6-blockLinus Torvalds2008-01-284-12/+92
|\ | | | | | | | | | | | | | | * 'for-2.6.25' of git://git.kernel.dk/linux-2.6-block: block: implement drain buffers __bio_clone: don't calculate hw/phys segment counts block: allow queue dma_alignment of zero blktrace: Add blktrace ioctls to SCSI generic devices
| * block: implement drain buffersJames Bottomley2008-01-282-1/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These DMA drain buffer implementations in drivers are pretty horrible to do in terms of manipulating the scatterlist. Plus they're being done at least in drivers/ide and drivers/ata, so we now have code duplication. The one use case for this, as I understand it is AHCI controllers doing PIO mode to mmc devices but translating this to DMA at the controller level. So, what about adding a callback to the block layer that permits the adding of the drain buffer for the problem devices. The idea is that you'd do this in slave_configure after you find one of these devices. The beauty of doing it in the block layer is that it quietly adds the drain buffer to the end of the sg list, so it automatically gets mapped (and unmapped) without anything unusual having to be done to the scatterlist in driver/scsi or drivers/ata and without any alteration to the transfer length. Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
| * blktrace: Add blktrace ioctls to SCSI generic devicesChristof Schmitt2008-01-282-11/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Since the SCSI layer uses the request queues from the block layer, blktrace can also be used to trace the requests to all SCSI devices (like SCSI tape drives), not only disks. The only missing part is the ioctl interface to start and stop tracing. This patch adds the SETUP, START, STOP and TEARDOWN ioctls from blktrace to the sg device files. With this change, blktrace can be used for SCSI devices like for disks, e.g.: blktrace -d /dev/sg1 -o - | blkparse -i - Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* | Merge branch 'blk-end-request' of git://git.kernel.dk/linux-2.6-blockLinus Torvalds2008-01-281-85/+213
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'blk-end-request' of git://git.kernel.dk/linux-2.6-block: (30 commits) blk_end_request: changing xsysace (take 4) blk_end_request: changing ub (take 4) blk_end_request: cleanup of request completion (take 4) blk_end_request: cleanup 'uptodate' related code (take 4) blk_end_request: remove/unexport end_that_request_* (take 4) blk_end_request: changing scsi (take 4) blk_end_request: add bidi completion interface (take 4) blk_end_request: changing ide-cd (take 4) blk_end_request: add callback feature (take 4) blk_end_request: changing ide normal caller (take 4) blk_end_request: changing cpqarray (take 4) blk_end_request: changing cciss (take 4) blk_end_request: changing ide-scsi (take 4) blk_end_request: changing s390 (take 4) blk_end_request: changing mmc (take 4) blk_end_request: changing i2o_block (take 4) blk_end_request: changing viocd (take 4) blk_end_request: changing xen-blkfront (take 4) blk_end_request: changing viodasd (take 4) blk_end_request: changing sx8 (take 4) ...
| * | blk_end_request: cleanup of request completion (take 4)Kiyoshi Ueda2008-01-281-17/+14Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch merges complete_request() into end_that_request_last() for cleanup. complete_request() was introduced by earlier part of this patch-set, not to break the existing users of end_that_request_last(). Since all users are converted to blk_end_request interfaces and end_that_request_last() is no longer exported, the code can be merged to end_that_request_last(). Cc: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: Kiyoshi Ueda <k-ueda@ct.jp.nec.com> Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
| * | blk_end_request: cleanup 'uptodate' related code (take 4)Kiyoshi Ueda2008-01-281-47/+9Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch converts 'uptodate' arguments of no longer exported interfaces, end_that_request_first/last, to 'error', and removes internal conversions for it in blk_end_request interfaces. Also, this patch removes no longer needed end_io_error(). Cc: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: Kiyoshi Ueda <k-ueda@ct.jp.nec.com> Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
| * | blk_end_request: remove/unexport end_that_request_* (take 4)Kiyoshi Ueda2008-01-281-46/+15Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes the following functions: o end_that_request_first() o end_that_request_chunk() and stops exporting the functions below: o end_that_request_last() Cc: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: Kiyoshi Ueda <k-ueda@ct.jp.nec.com> Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
| * | blk_end_request: add bidi completion interface (take 4)Kiyoshi Ueda2008-01-281-5/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a variant of the interface, blk_end_bidi_request(), which completes a bidi request. Bidi request must be completed as a whole, both rq and rq->next_rq at once. So the interface has 2 arguments for completion size. As for ->end_io, only rq->end_io is called (rq->next_rq->end_io is not called). So if special completion handling is needed, the handler must be set to rq->end_io. And the handler must take care of freeing next_rq too, since the interface doesn't care of it if rq->end_io is not NULL. Cc: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: Kiyoshi Ueda <k-ueda@ct.jp.nec.com> Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>