aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-10-18md/raid5: call roundup_pow_of_two in raid5_runGuoqing Jiang1-4/+1
Let's call roundup_pow_of_two here instead of open code. Signed-off-by: Guoqing Jiang <[email protected]> Signed-off-by: Song Liu <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2021-10-18md/raid1: use rdev in raid1_write_request directlyGuoqing Jiang1-6/+5
We already get rdev from conf->mirrors[i].rdev at the beginning of the loop, so just use it. Signed-off-by: Guoqing Jiang <[email protected]> Signed-off-by: Song Liu <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2021-10-18md/raid1: only allocate write behind bio for WriteMostly deviceGuoqing Jiang1-1/+1
Commit 6607cd319b6b91bff94e90f798a61c031650b514 ("raid1: ensure write behind bio has less than BIO_MAX_VECS sectors") tried to guarantee the size of behind bio is not bigger than BIO_MAX_VECS sectors. Unfortunately the same calltrace still could happen since an array could enable write-behind without write mostly device. To match the manpage of mdadm (which says "write-behind is only attempted on drives marked as write-mostly"), we need to check WriteMostly flag to avoid such unexpected behavior. [1]. https://bugzilla.kernel.org/show_bug.cgi?id=213181#c25 Cc: [email protected] # v5.12+ Cc: Jens Stutte <[email protected]> Reported-by: Jens Stutte <[email protected]> Signed-off-by: Guoqing Jiang <[email protected]> Signed-off-by: Song Liu <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2021-10-18md: properly unwind when failing to add the kobject in md_allocChristoph Hellwig1-20/+17
Add proper error handling to delete the gendisk when failing to add the md kobject and clean up the error unwinding in general. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Song Liu <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2021-10-18md: extend disks_mutex coverageChristoph Hellwig1-1/+1
disks_mutex is intended to serialize md_alloc. Extended it to also cover the kobject_uevent call and getting the sysfs dirent to help reducing error handling complexity. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Song Liu <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2021-10-18md: add the bitmap group to the default groups for the md kobjectChristoph Hellwig1-5/+11
Replace the deprecated default_attrs with the default_groups mechanism, and add the always visible bitmap group to the groups created add kobject_add time. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Song Liu <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2021-10-18md: add error handling support for add_disk()Luis Chamberlain1-1/+5
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. We just do the unwinding of what was not done before, and are sure to unlock prior to bailing. Signed-off-by: Luis Chamberlain <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Song Liu <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2021-10-18swim3: add missing major.h includeJens Axboe1-0/+1
swim3 got this through blkdev.h previously, but blkdev.h is not including it anymore. Include it specifically for the driver, otherwise FLOPPY_MAJOR is undefined and breaks the compile on PPC if swim3 is configured. Fixes: b81e0c2372e6 ("block: drop unused includes in <linux/genhd.h>") Reported-by: Naresh Kamboju <[email protected]> Acked-by: Randy Dunlap <[email protected]> # build-tested Signed-off-by: Jens Axboe <[email protected]>
2021-10-18sx8: fix an error code in carm_init_one()Dan Carpenter1-1/+3
Return a negative error code here on this error path instead of returning success. Fixes: 637208e74a86 ("block/sx8: add error handling support for add_disk()") Signed-off-by: Dan Carpenter <[email protected]> Link: https://lore.kernel.org/r/20211001122722.GC2283@kili Signed-off-by: Jens Axboe <[email protected]>
2021-10-18pf: fix error codes in pf_init_unit()Dan Carpenter1-6/+9
Return a negative error code instead of success on these error paths. Fixes: fb367e6baeb0 ("pf: cleanup initialization") Signed-off-by: Dan Carpenter <[email protected]> Link: https://lore.kernel.org/r/20211001122654.GB2283@kili Signed-off-by: Jens Axboe <[email protected]>
2021-10-18pcd: fix error codes in pcd_init_unit()Dan Carpenter1-5/+7
Return -ENODEV on these error paths instead of returning success. Fixes: af761f277b7f ("pcd: cleanup initialization") Signed-off-by: Dan Carpenter <[email protected]> Link: https://lore.kernel.org/r/20211001122623.GA2283@kili Signed-off-by: Jens Axboe <[email protected]>
2021-10-18xtensa/platforms/iss/simdisk: add error handling support for add_disk()Luis Chamberlain1-2/+11
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Signed-off-by: Luis Chamberlain <[email protected]> Acked-by: Max Filippov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
2021-10-18block/ataflop: add error handling support for add_disk()Luis Chamberlain1-1/+5
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Signed-off-by: Luis Chamberlain <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
2021-10-18block/ataflop: provide a helper for cleanup up an atari diskLuis Chamberlain1-15/+19
Instead of using two separate code paths for cleaning up an atari disk, use one. We take the more careful approach to check for *all* disk types, as is done on exit. The init path didn't have that check as the alternative disk types are only probed for later, they are not initialized by default. Yes, there is a shared tag for all disks. Signed-off-by: Luis Chamberlain <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
2021-10-18block/ataflop: add registration bool before calling del_gendisk()Luis Chamberlain1-2/+7
The ataflop assumes del_gendisk() is safe to call, this is only true because add_disk() does not return a failure, but that will change soon. And so, before we get to adding error handling for that case, let's make sure we keep track of which disks actually get registered. Then we use this to only call del_gendisk for them. Signed-off-by: Luis Chamberlain <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
2021-10-18block/ataflop: use the blk_cleanup_disk() helperLuis Chamberlain1-4/+2
Use the helper to replace two lines with one. Signed-off-by: Luis Chamberlain <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
2021-10-18swim: add error handling support for add_disk()Luis Chamberlain1-1/+3
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Since we have a caller to do our unwinding for the disk, and this is already dealt with safely we can re-use our existing error path goto label which already deals with the cleanup. Signed-off-by: Luis Chamberlain <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
2021-10-18swim: add a floppy registration bool which triggers del_gendisk()Luis Chamberlain1-3/+6
Instead of calling del_gendisk() on exit alone, let's add a registration bool to the floppy disk state, this way this can be done on the shared caller, swim_cleanup_floppy_disk(). This will be more useful in subsequent patches. Right now, this just shuffles functionality out to a helper in a safe way. Signed-off-by: Luis Chamberlain <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
2021-10-18swim: add helper for disk cleanupLuis Chamberlain1-8/+13
Disk cleanup can be shared between exit and bringup. Use a helper to do the work required. The only functional change at this point is we're being overly paraoid on exit to check for a null disk as well now, and this should be safe. We'll later expand on this, this change just makes subsequent changes easier to read. Signed-off-by: Luis Chamberlain <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
2021-10-18swim: simplify using blk_cleanup_disk() on swim_remove()Luis Chamberlain1-2/+1
We can simplify swim_remove() by using one call instead of two, just as other drivers do. Use that pattern. Signed-off-by: Luis Chamberlain <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
2021-10-18amiflop: add error handling support for add_disk()Luis Chamberlain1-2/+5
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. The caller for fd_alloc_disk() deals with the rest of the cleanup like the tag. Signed-off-by: Luis Chamberlain <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
2021-10-18floppy: add error handling support for add_disk()Luis Chamberlain1-2/+4
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Signed-off-by: Luis Chamberlain <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
2021-10-18floppy: fix calling platform_device_unregister() on invalid drivesLuis Chamberlain1-2/+7
platform_device_unregister() should only be called when a respective platform_device_register() is called. However the floppy driver currently allows failures when registring a drive and a bail out could easily cause an invalid call to platform_device_unregister() where it was not intended. Fix this by adding a bool to keep track of when the platform device was registered for a drive. This does not fix any known panic / bug. This issue was found through code inspection while preparing the driver to use the up and coming support for device_add_disk() error handling. From what I can tell from code inspection, chances of this ever happening should be insanely small, perhaps OOM. Signed-off-by: Luis Chamberlain <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
2021-10-18floppy: use blk_cleanup_disk()Luis Chamberlain1-5/+1
Use the blk_cleanup_queue() followed by put_disk() can be replaced with blk_cleanup_disk(). No need for two separate loops. Signed-off-by: Luis Chamberlain <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
2021-10-18floppy: fix add_disk() assumption on exit due to new developmentsLuis Chamberlain1-13/+0
After the patch titled "floppy: use blk_mq_alloc_disk and blk_cleanup_disk" the floppy driver was modified to allocate the blk_mq_alloc_disk() which allocates the disk with the queue. This is further clarified later with the patch titled "block: remove alloc_disk and alloc_disk_node". This clarifies that: Most drivers should use and have been converted to use blk_alloc_disk and blk_mq_alloc_disk. Only the scsi ULPs and dasd still allocate a disk separately from the request_queue so don't bother with convenience macros for something that should not see significant new users and remove these wrappers. And then we have the patch titled, "block: hold a request_queue reference for the lifetime of struct gendisk" which ensures that a queue is *always* present for sure during the entire lifetime of a disk. In the floppy driver's case then the disk always comes with the queue. So even if even if the queue was cleaned up on exit, putting the disk *is* still required, and likewise, blk_cleanup_queue() on a null queue should not happen now as disk->queue is valid from disk allocation time on. Automatic backport code scrapers should hopefully not cherry pick this patch as a stable fix candidate without full due dilligence to ensure all the work done on the block layer to make this happen is merged first. Signed-off-by: Luis Chamberlain <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
2021-10-18block/swim3: add error handling support for add_disk()Luis Chamberlain1-1/+3
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Signed-off-by: Luis Chamberlain <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
2021-10-18rbd: add add_disk() error handlingLuis Chamberlain1-1/+5
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Signed-off-by: Luis Chamberlain <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2021-10-18cdrom/gdrom: add error handling support for add_disk()Luis Chamberlain1-1/+6
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Signed-off-by: Luis Chamberlain <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2021-10-18pf: add error handling support for add_disk()Luis Chamberlain1-1/+3
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Signed-off-by: Luis Chamberlain <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2021-10-18block/sx8: add error handling support for add_disk()Luis Chamberlain1-4/+9
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. A completion is used to notify the initial probe what is happening and so we must defer error handling on completion. Do this by remembering the error and using the shared cleanup function. The tags are shared and so are hanlded later for the driver already. Signed-off-by: Luis Chamberlain <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2021-10-18block/rsxx: add error handling support for add_disk()Luis Chamberlain2-4/+12
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Signed-off-by: Luis Chamberlain <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2021-10-18pktcdvd: add error handling support for add_disk()Luis Chamberlain1-1/+3
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. The out_mem2 error label already does what we need so re-use that. Signed-off-by: Luis Chamberlain <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2021-10-18mtip32xx: add error handling support for add_disk()Luis Chamberlain1-1/+3
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. The read_capacity_error error label already does what we need, so just re-use that. Signed-off-by: Luis Chamberlain <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2021-10-18pd: add error handling support for add_disk()Luis Chamberlain1-1/+5
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Signed-off-by: Luis Chamberlain <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2021-10-18pcd: capture errors on cdrom_register()Luis Chamberlain1-1/+3
No errors were being captured wehen cdrom_register() fails, capture the error and return the error. Signed-off-by: Luis Chamberlain <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2021-10-18pcd: fix ordering of unregister_cdrom()Luis Chamberlain1-1/+1
We first register cdrom and then we add_disk() and so we we should likewise unregister the cdrom first and then del_gendisk(). Signed-off-by: Luis Chamberlain <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2021-10-18pcd: add error handling support for add_disk()Luis Chamberlain1-1/+5
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Signed-off-by: Luis Chamberlain <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2021-10-18pd: cleanup initializationChristoph Hellwig1-70/+70
Refactor the pf initialization to have a dedicated helper to initialize a single disk. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2021-10-18pf: cleanup initializationChristoph Hellwig1-124/+99
Refactor the pf initialization to have a dedicated helper to initialize a single disk. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2021-10-18pcd: cleanup initializationChristoph Hellwig1-159/+127
Refactor the pcd initialization to have a dedicated helper to initialize a single disk. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2021-10-18pcd: move the identify buffer into pcd_identifyChristoph Hellwig1-8/+8
No need to pass it through a bunch of functions. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2021-10-18n64cart: add error handling support for add_disk()Luis Chamberlain1-2/+10
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Signed-off-by: Luis Chamberlain <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2021-10-18drbd: add error handling support for add_disk()Luis Chamberlain1-1/+5
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Signed-off-by: Luis Chamberlain <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2021-10-18aoe: add error handling support for add_disk()Luis Chamberlain1-1/+5
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Signed-off-by: Luis Chamberlain <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2021-10-18nbd: add error handling support for add_disk()Luis Chamberlain1-1/+5
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Signed-off-by: Luis Chamberlain <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2021-10-18loop: add error handling support for add_disk()Luis Chamberlain1-1/+7
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Signed-off-by: Luis Chamberlain <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2021-10-18null_blk: poll queue supportJens Axboe2-4/+108
There's currently no way to experiment with polled IO with null_blk, which seems like an oversight. This patch adds support for polled IO. We keep a list of issued IOs on submit, and then process that list when mq_ops->poll() is invoked. A new parameter is added, poll_queues. It defaults to 1 like the submit queues, meaning we'll have 1 poll queue available. Fixes-by: Bart Van Assche <[email protected]> Fixes-by: Pavel Begunkov <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
2021-10-18nvme: wire up completion batching for the IRQ pathJens Axboe1-1/+5
Trivial to do now, just need our own io_comp_batch on the stack and pass that in to the usual command completion handling. I pondered making this dependent on how many entries we had to process, but even for a single entry there's no discernable difference in performance or latency. Running a sync workload over io_uring: t/io_uring -b512 -d1 -s1 -c1 -p0 -F1 -B1 -n2 /dev/nvme1n1 /dev/nvme2n1 yields the below performance before the patch: IOPS=254820, BW=124MiB/s, IOS/call=1/1, inflight=(1 1) IOPS=251174, BW=122MiB/s, IOS/call=1/1, inflight=(1 1) IOPS=250806, BW=122MiB/s, IOS/call=1/1, inflight=(1 1) and the following after: IOPS=255972, BW=124MiB/s, IOS/call=1/1, inflight=(1 1) IOPS=251920, BW=123MiB/s, IOS/call=1/1, inflight=(1 1) IOPS=251794, BW=122MiB/s, IOS/call=1/1, inflight=(1 1) which definitely isn't slower, about the same if you factor in a bit of variance. For peak performance workloads, benchmarking shows a 2% improvement. Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2021-10-18io_uring: utilize the io batching infrastructure for more efficient polled IOJens Axboe1-2/+6
Wire up using an io_comp_batch for f_op->iopoll(). If the lower stack supports it, we can handle high rates of polled IO more efficiently. This raises the single core efficiency on my system from ~6.1M IOPS to ~6.6M IOPS running a random read workload at depth 128 on two gen2 Optane drives. Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2021-10-18nvme: add support for batched completion of polled IOJens Axboe3-12/+51
Take advantage of struct io_comp_batch, if passed in to the nvme poll handler. If it's set, rather than complete each request individually inline, store them in the io_comp_batch list. We only do so for requests that will complete successfully, anything else will be completed inline as before. Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>