aboutsummaryrefslogtreecommitdiff
path: root/drivers/block/ub.c
AgeCommit message (Collapse)Author
2009-01-22MERGE-via-pending-tracking-hist-MERGE-via-stable-tracking-MERGE-via-mokopatc ↵merge
hes-tracking-fix-stray-endmenu-patch-1232632040-1232632141 pending-tracking-hist top was MERGE-via-stable-tracking-MERGE-via-mokopatches-tracking-fix-stray-endmenu-patch-1232632040-1232632141 / fdf777a63bcb59e0dfd78bfe2c6242e01f6d4eb9 ... parent commitmessage: From: merge <null@invalid> MERGE-via-stable-tracking-hist-MERGE-via-mokopatches-tracking-fix-stray-endmenu-patch-1232632040 stable-tracking-hist top was MERGE-via-mokopatches-tracking-fix-stray-endmenu-patch-1232632040 / 90463bfd2d5a3c8b52f6e6d71024a00e052b0ced ... parent commitmessage: From: merge <null@invalid> MERGE-via-mokopatches-tracking-hist-fix-stray-endmenu-patch mokopatches-tracking-hist top was fix-stray-endmenu-patch / 3630e0be570de8057e7f8d2fe501ed353cdf34e6 ... parent commitmessage: From: Andy Green <andy@openmoko.com> fix-stray-endmenu.patch Signed-off-by: Andy Green <andy@openmoko.com>
2008-10-21[PATCH] switch ubAl Viro
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2008-10-21[PATCH] beginning of methods conversionAl Viro
To keep the size of changesets sane we split the switch by drivers; to keep the damn thing bisectable we do the following: 1) rename the affected methods, add ones with correct prototypes, make (few) callers handle both. That's this changeset. 2) for each driver convert to new methods. *ALL* drivers are converted in this series. 3) kill the old (renamed) methods. Note that it _is_ a flagday; all in-tree drivers are converted and by the end of this series no trace of old methods remain. The only reason why we do that this way is to keep the damn thing bisectable and allow per-driver debugging if anything goes wrong. New methods: open(bdev, mode) release(disk, mode) ioctl(bdev, mode, cmd, arg) /* Called without BKL */ compat_ioctl(bdev, mode, cmd, arg) locked_ioctl(bdev, mode, cmd, arg) /* Called with BKL, legacy */ Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2008-10-21[PATCH] switch scsi_cmd_ioctl() to passing fmode_tAl Viro
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2008-10-21[PATCH] eliminate use of ->f_flags in block methodsAl Viro
store needed information in f_mode Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2008-10-17ub: remove sg_statPete Zaitcev
Remove forgotten code related to sg_stat[]. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-05-02ub: CosmeticsPete Zaitcev
Fix a few comments and printk statements. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-05-02ub: Ignore bad residuePete Zaitcev
I hoped to continue to ignore this problem or use libusual, but these days it's simpler to work around than to deal with it. Let's attempt to use bad residue devices and hope that upper level integrity checks catch any problems (e.g. please use sha1sum on your backups). Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-05-02ub: Tune retriesPete Zaitcev
Make ub to fail faster in hopeless cases. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-05-02ub: Fix timeoutsPete Zaitcev
The wodim says: "close track/session scsi sendcmd: cmd timeout after 5.000 (480) s" This happened because we ignored the supplied timeout and used 5s. It's not completely correct to apply a timeout meant for the complete command to any single URB, but we don't have many URBs per command, so this is simple and works. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-04-29block: make queue flags non-atomicNick Piggin
We can save some atomic ops in the IO path, if we clearly define the rules of how to modify the queue flags. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2008-04-08ub: remove BUG() after __blk_end_request and fix the condition causing itPete Zaitcev
When __blk_end_request returns nonzero, it means that the request was not completely processed and some BIOs are still attached. Since we have dequeued it by that time, it means leaking requests and hanging processes, which is why BUG() was in there. In ub this happens if a packet request ends normally, but with residue (e.g. when scsi_id issues INQUIRY). The fix is to make sure that arguments passed to __blk_end_request are correct: the full request length and not just transferred length. The transferred length is indicated to applications by adjusting rq->data_len with old, unchanged code outside of this patch. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Cc: Kiyoshi Ueda <k-ueda@ct.jp.nec.com> Cc: Greg KH <greg@kroah.com> Cc: Boaz Harrosh <bharrosh@panasas.com> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-09ub: fix up the conversion to sg_init_table()Pete Zaitcev
Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Cc: "Oliver Pinter" <oliver.pntr@gmail.com> Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: Greg KH <greg@kroah.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-01USB: Remove unnecessary zeroing from ubPete Zaitcev
These zeroings were taken from usb-storage long time ago. I examined the submission paths and usb_fill_bulk_urb and found them unnecessary. Signed-off-by: Pete Zaitcev <zaitcev@yahoo.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-01-28blk_end_request: changing ub (take 4)Kiyoshi Ueda
This patch converts ub to use blk_end_request interfaces. Related 'uptodate' arguments are converted to 'error'. Cc: Pete Zaitcev <zaitcev@redhat.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>
2007-10-25ub: add sg_init_table for sense and read capacity commandsFUJITA Tomonori
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2007-10-24SG: Change sg_set_page() to take length and offset argumentJens Axboe
Most drivers need to set length and offset as well, so may as well fold those three lines into one. Add sg_assign_page() for those two locations that only needed to set the page, where the offset/length is set outside of the function context. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2007-10-22[SG] Update drivers to use sg helpersJens Axboe
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2007-07-24[BLOCK] Get rid of request_queue_t typedefJens Axboe
Some of the code has been gradually transitioned to using the proper struct request_queue, but there's lots left. So do a full sweet of the kernel and get rid of this typedef and replace its uses with the proper type. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2007-07-16bsg: add a request_queue argument to scsi_cmd_ioctl()FUJITA Tomonori
bsg uses scsi_cmd_ioctl() for some SCSI/sg ioctl commands. scsi_cmd_ioctl() gets a request queue from a gendisk arguement. This prevents bsg being bound to SCSI devices that don't have a gendisk (like OSD). This adds a request_queue argument to scsi_cmd_ioctl(). The SCSI/sg ioctl commands doesn't use a gendisk so it's safe for any SCSI devices to use scsi_cmd_ioctl(). Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2007-07-12USB: drivers/block/ub.c: use list_for_each_entry()Matthias Kaehlcke
Low performance USB storage driver: Use list_for_each_entry() instead of list_for_each() Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com> Cc: Pete Zaitcev <zaitcev@redhat.com> Cc: Jens Axboe <jens.axboe@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-04-27ub: Bind to first endpoint, not to lastPete Zaitcev
The usb-storage switched to binding to first endpoint recently. Apparently, there are devices out there with extra endpoints. It is perfectly legal. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-11-22WorkStruct: make allyesconfigDavid Howells
Fix up for make allyesconfig. Signed-Off-By: David Howells <dhowells@redhat.com>
2006-10-05IRQ: Maintain regs pointer globally rather than passing to IRQ handlersDavid Howells
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead of passing regs around manually through all ~1800 interrupt handlers in the Linux kernel. The regs pointer is used in few places, but it potentially costs both stack space and code to pass it around. On the FRV arch, removing the regs parameter from all the genirq function results in a 20% speed up of the IRQ exit path (ie: from leaving timer_interrupt() to leaving do_IRQ()). Where appropriate, an arch may override the generic storage facility and do something different with the variable. On FRV, for instance, the address is maintained in GR28 at all times inside the kernel as part of general exception handling. Having looked over the code, it appears that the parameter may be handed down through up to twenty or so layers of functions. Consider a USB character device attached to a USB hub, attached to a USB controller that posts its interrupts through a cascaded auxiliary interrupt controller. A character device driver may want to pass regs to the sysrq handler through the input layer which adds another few layers of parameter passing. I've build this code with allyesconfig for x86_64 and i386. I've runtested the main part of the code on FRV and i386, though I can't test most of the drivers. I've also done partial conversion for powerpc and MIPS - these at least compile with minimal configurations. This will affect all archs. Mostly the changes should be relatively easy. Take do_IRQ(), store the regs pointer at the beginning, saving the old one: struct pt_regs *old_regs = set_irq_regs(regs); And put the old one back at the end: set_irq_regs(old_regs); Don't pass regs through to generic_handle_irq() or __do_IRQ(). In timer_interrupt(), this sort of change will be necessary: - update_process_times(user_mode(regs)); - profile_tick(CPU_PROFILING, regs); + update_process_times(user_mode(get_irq_regs())); + profile_tick(CPU_PROFILING); I'd like to move update_process_times()'s use of get_irq_regs() into itself, except that i386, alone of the archs, uses something other than user_mode(). Some notes on the interrupt handling in the drivers: (*) input_dev() is now gone entirely. The regs pointer is no longer stored in the input_dev struct. (*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does something different depending on whether it's been supplied with a regs pointer or not. (*) Various IRQ handler function pointers have been moved to type irq_handler_t. Signed-Off-By: David Howells <dhowells@redhat.com> (cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-09-27USB: UB: Let cdrecord to see a device with media absentPete Zaitcev
The command "cdrecord dev=/dev/uba x.iso" prints nasty garbage if a blank is not in the drive. This happens because drivers have to set req->errors separately from just returning zero uptodate with end_that_request_first, end_that_request_last. These functions only set error in BIO, but sg_io() ignores it. Since we're on it, let cdrecord access a device when ->changed is set. It's useful if someone wants to know device capabilities without burning anything. Signed-Off-By: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-26[PATCH] devfs: Remove the gendisk devfs_name field as it's no longer neededGreg Kroah-Hartman
And remove the now unneeded number field. Also fixes all drivers that set these fields. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-26[PATCH] devfs: Remove the devfs_fs_kernel.h file from the treeGreg Kroah-Hartman
Also fixes up all files that #include it. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-26[PATCH] devfs: Remove devfs_remove() function from the kernel treeGreg Kroah-Hartman
Removes the devfs_remove() function and all callers of it. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-26[PATCH] devfs: Remove devfs_mk_dir() function from the kernel treeGreg Kroah-Hartman
Removes the devfs_mk_dir() function and all callers of it. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-21[PATCH] ub: random cleanupsPete Zaitcev
Remove some silly messages and cast in stone "temporary" messages which we keep around. Also, I am hesitant to remove the initialization retries without having the hardware to test (anyone who was at KS04 has a spare?) Signed-off-by: Pete Zaitcev <zaitcev@yahoo.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-21[PATCH] ub: atomic add_diskPete Zaitcev
<zaitcev> I am taling about this: "if (disk->flags & GENHD_FL_UP) del_gendisk(disk);" <zaitcev> If del_gendisk() undoes add_disk() like viro just said, why is it conditional? <viro> huh? <viro> add_disk() sets the damn flag <zaitcev> So, I should not need to check ever <viro> so the above is "if I've called add_disk(), call gendisk()" <viro> which might be what you want, of course <viro> but usually you know if you'd done add_disk() on that puppy anyway In ub, nobody upstream should ever see half-constructed disks before they were passed to add_disk. To that end, only add the struct lun to the list on the path of no return. With that fix in place, we do not need to test GENHD_FL_UP. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-21[PATCH] USB: clean out an unnecessary NULL check from ubPete Zaitcev
Remove the check for NULL which makes no sense. Suggested by Al. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-05-08[PATCH] USB: ub oops in block_ueventPete Zaitcev
In kernel 2.6.16, if a mounted storage device is removed, an oops happens because ub supplies an interface device (and kobject) to the block layer, but neglects to pin it. And apparently, the block layer expects its users to pin device structures. The code in ub was broken this way for years. But the bug was exposed only by 2.6.16 when it started to call block_uevent on close, which traverses device structures (kobjects actually). Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-03-20[PATCH] USB: ub 03 drop stall clearingPete Zaitcev
Matt mentioned that a very old ZIP-100 actually does need this, but I am yet to see anyone who actually has one still working and uses ub with it. He/she must be a retrocomputing geek, who can easily bias it to usb-storage with libusual, if needed. Meanwhile, common folks have trouble with poorly designed USB keys and some el-cheapo European music players. I think we better drop this for now. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-03-20[PATCH] USB: ub 02 remove diagPete Zaitcev
Remove the "diag" file from the sysfs. The usbmon is good enough these days so I do not need this feature anymore. Also, sysfs is a pain. Al Viro caught a race in this, which I thought too bothersome to fix. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-03-20[PATCH] USB: ub 01 remove first_openPete Zaitcev
The first_open was long overdue for removal, but I wanted to keep this separate for other changes in case of regressions. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-03-20[PATCH] ub: use kzallocPete Zaitcev
Switch from kmalloc+memset to kzalloc. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-31[PATCH] USB: ub 05 Bulk resetPete Zaitcev
For crying out loud, they have devices which do not like port resets. So, do what usb-storage does and try both bulk and port resets. We start with a port reset (which usb-storage does at the end of transport), then do a Bulk reset, then a port reset again. This seems to work for me. The code is getting dirtier and dirtier here, but I swear that I'll do something about it (see those two new XXX). Honest. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-31[PATCH] USB: ub 04 Loss of timer and a hangPete Zaitcev
If SCSI commands are submitted while other commands are still processed, the dispatch loop turns, and we stop the work_timer. Then, if URB fails to complete, ub hangs until the device is unplugged. This does not happen often, becase we only allow one SCSI command per block device, but does happen (on multi-LUN devices, for example). The fix is to stop timer only when we actually going to change the state. The nicest code would be to have the timer stopped in URB callback, but this is impossible, because it can be called from inside a timer, through the urb_unlink. Then we get BUG in timer.c:cascade(). So, we do it a little dirtier. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-31[PATCH] USB: ub 03 Oops with CFQPete Zaitcev
The blk_cleanup_queue does not necesserily destroy the queue. When we destroy the corresponding ub_dev, it may leave the queue spinlock pointer dangling. This patch moves spinlocks from ub_dev to static memory. The locking scheme is not changed. These spinlocks are still separate from the ub_lock. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-06[BLOCK] add @uptodate to end_that_request_last() and @error to rq_end_io_fn()Tejun Heo
add @uptodate argument to end_that_request_last() and @error to rq_end_io_fn(). there's no generic way to pass error code to request completion function, making generic error handling of non-fs request difficult (rq->errors is driver-specific and each driver uses it differently). this patch adds @uptodate to end_that_request_last() and @error to rq_end_io_fn(). for fs requests, this doesn't really matter, so just using the same uptodate argument used in the last call to end_that_request_first() should suffice. imho, this can also help the generic command-carrying request jens is working on. Signed-off-by: tejun heo <htejun@gmail.com> Signed-Off-By: Jens Axboe <axboe@suse.de>
2006-01-04[PATCH] USB: ub 02 Removed unused variableDaniel Marjamaki
Removed an unused variable Signed-off-by: Daniel Marjamaki <daniel.marjamaki@comhem.se> Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-04[PATCH] USB: ub 01 renamePete Zaitcev
Rename misleading UB_MINORS_PER_MAJOR into UB_PARTS_PER_LUN. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-04[PATCH] USB: ub 00 implement retries and resetsPete Zaitcev
Implement command retries and resets in ub. It is advantageous for users to know if their devices are getting bad. However, failing every I/O is not practical if you have a external USB enclosure with a hard drive. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-04[PATCH] USB: remove .owner field from struct usb_driverGreg Kroah-Hartman
It is no longer needed, so let's remove it, saving a bit of memory. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-04[PATCH] USB: drivers/usb/storage/libusualPete Zaitcev
This patch adds a shim driver libusual, which routes devices between usb-storage and ub according to the common table, based on unusual_devs.h. The help and example syntax is in Kconfig. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-10-28[PATCH] ub: suppress gcc warnings for pointer castsPete Zaitcev
When building on a 64-bit platform, gcc produces a warning "cast of a pointer to an integer of a different size". The scatterlist.offset on the LHS is unsigned int, so I used that originally. Signed-off-by: Pete Zaitcev <zaitcev@yahoo.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> drivers/block/ub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
2005-09-22[PATCH] ub: Comment out unconditional stall clearPete Zaitcev
This code appears to be more trouble than it's worth, considering that no normal users reload drivers. So, we comment it for now. It is not removed outright for the benefit of hackers (that is, myself). Signed-off-by: Pete Zaitcev <zaitcev@yahoo.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-22[PATCH] ub: fix burning cdsPete Zaitcev
This patch fixes a few problems with ub and cleans up a couple of things: - Bump UB_MAX_REQ_SG, this allows to burn CDs - Drop initialization of urb.transfer_flags, now that URB_UNLINK_ASYNC is gone - Add forgotten processing of stalls at GetMaxLUN - Remove a few more P3-tagged printks whose time has come - Correct comment about ZIP-100 Signed-off-by: Pete Zaitcev <zaitcev@yahoo.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Linus Torvalds <torvalds@osdl.org> drivers/block/ub.c | 53 +++++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 26 deletions(-)
2005-09-08[PATCH] USB: URB_ASYNC_UNLINK flag removed from the kernelAlan Stern
29 July 2005, Cambridge, MA: This afternoon Alan Stern submitted a patch to remove the URB_ASYNC_UNLINK flag from the Linux kernel. Mr. Stern explained, "This flag is a relic from an earlier, less-well-designed system. For over a year it hasn't been used for anything other than printing warning messages." An anonymous spokesman for the Linux kernel development community commented, "This is exactly the sort of thing we see happening all the time. As the kernel evolves, support for old techniques and old code can be jettisoned and replaced by newer, better approaches. Proprietary operating systems do not have the freedom or flexibility to change so quickly." Mr. Stern, a staff member at Harvard University's Rowland Institute who works on Linux only as a hobby, noted that the patch (labelled as548) did not update two files, keyspan.c and option.c, in the USB drivers' "serial" subdirectory. "Those files need more extensive changes," he remarked. "They examine the status field of several URBs at times when they're not supposed to. That will need to be fixed before the URB_ASYNC_UNLINK flag is removed." Greg Kroah-Hartman, the kernel maintainer responsible for overseeing all of Linux's USB drivers, did not respond to our inquiries or return our calls. His only comment was "Applied, thanks." Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>