Bart Van Assche
d625fecd8a
block/kyber: Use the new blk_opf_t type
...
Use the new blk_opf_t type for arguments that represent a bitwise
combination of a request operation and request flags. Rename those
arguments from 'op' into 'opf'.
This patch does not change any functionality.
Cc: Omar Sandoval <osandov@fb.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Link: https://lore.kernel.org/r/20220714180729.1065367-10-bvanassche@acm.org
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-07-14 12:14:30 -06:00
Bart Van Assche
f8359efe47
block/mq-deadline: Use the new blk_opf_t type
...
Use the new blk_opf_t type for an argument that represents a bitwise
combination of a request operation and request flags. Rename that
argument from 'op' into 'opf'.
This patch does not change any functionality.
Cc: Damien Le Moal <damien.lemoal@wdc.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Link: https://lore.kernel.org/r/20220714180729.1065367-9-bvanassche@acm.org
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-07-14 12:14:30 -06:00
Bart Van Assche
dc469ba2e7
block/bfq: Use the new blk_opf_t type
...
Use the new blk_opf_t type for arguments and variables that represent
request flags or a bitwise combination of a request operation and
request flags. Rename those variables from 'op' into 'opf'.
This patch does not change any functionality.
Cc: Jan Kara <jack@suse.cz >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Link: https://lore.kernel.org/r/20220714180729.1065367-8-bvanassche@acm.org
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-07-14 12:14:30 -06:00
Bart Van Assche
16458cf3bd
block: Use the new blk_opf_t type
...
Use the new blk_opf_t type for arguments and variables that represent
request flags or a bitwise combination of a request operation and
request flags. Rename the function arguments and also a structure member
that hold a request operation and flags from 'rw' into 'opf'.
This patch does not change any functionality.
Cc: Christoph Hellwig <hch@lst.de >
Cc: Ming Lei <ming.lei@redhat.com >
Cc: Hannes Reinecke <hare@suse.de >
Cc: Damien Le Moal <damien.lemoal@wdc.com >
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Link: https://lore.kernel.org/r/20220714180729.1065367-7-bvanassche@acm.org
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-07-14 12:14:30 -06:00
Bart Van Assche
2d9b02be73
block: Change the type of req_op() and bio_op() into enum req_op
...
Improve static type checking by changing the type of the value returned by
req_op() and bio_op() from unsigned int into enum req_op. Insert
'default: break;' in switch statements on the enum req_op type to prevent
that the compiler warns about these switch statements.
Cc: Christoph Hellwig <hch@lst.de >
Cc: Ming Lei <ming.lei@redhat.com >
Cc: Hannes Reinecke <hare@suse.de >
Cc: Damien Le Moal <damien.lemoal@wdc.com >
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Cc: Tim Waugh <tim@cyberelk.net >
Cc: Alasdair Kergon <agk@redhat.com >
Cc: Mike Snitzer <snitzer@kernel.org >
Cc: Mikulas Patocka <mpatocka@redhat.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Link: https://lore.kernel.org/r/20220714180729.1065367-5-bvanassche@acm.org
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-07-14 12:14:30 -06:00
Bart Van Assche
77e7ffd7ad
block: Use enum req_op where appropriate
...
Change the type of the arguments that are used to pass a REQ_OP_* value
from int or unsigned int into enum req_op to improve static type
checking.
Cc: Christoph Hellwig <hch@lst.de >
Cc: Ming Lei <ming.lei@redhat.com >
Cc: Hannes Reinecke <hare@suse.de >
Cc: Damien Le Moal <damien.lemoal@wdc.com >
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Link: https://lore.kernel.org/r/20220714180729.1065367-3-bvanassche@acm.org
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-07-14 12:14:30 -06:00
Bart Van Assche
ff07a02e9e
treewide: Rename enum req_opf into enum req_op
...
The type name enum req_opf is misleading since it suggests that values of
this type include both an operation type and flags. Since values of this
type represent an operation only, change the type name into enum req_op.
Convert the enum req_op documentation into kernel-doc format. Move a few
definitions such that the enum req_op documentation occurs just above
the enum req_op definition.
The name "req_opf" was introduced by commit ef295ecf09 ("block: better op
and flags encoding").
Cc: Christoph Hellwig <hch@lst.de >
Cc: Ming Lei <ming.lei@redhat.com >
Cc: Hannes Reinecke <hare@suse.de >
Cc: Damien Le Moal <damien.lemoal@wdc.com >
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Link: https://lore.kernel.org/r/20220714180729.1065367-2-bvanassche@acm.org
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-07-14 12:14:30 -06:00
Muchun Song
957a2b345c
block: fix missing blkcg_bio_issue_init
...
The commit 513616843d ("block: remove superfluous calls to
blkcg_bio_issue_init") has removed blkcg_bio_issue_init from
__bio_clone since submit_bio will override ->bi_issue.
However, __blk_queue_split is called after blkcg_bio_issue_init
(see blk_mq_submit_bio) in submit_bio. In this case, the
->bi_issue is 0. Fix it.
Fixes: 513616843d ("block: remove superfluous calls to blkcg_bio_issue_init")
Signed-off-by: Muchun Song <songmuchun@bytedance.com >
Link: https://lore.kernel.org/r/20220713140226.68135-1-songmuchun@bytedance.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-07-14 10:54:49 -06:00
Christoph Hellwig
900d156bac
block: remove bdevname
...
Replace the remaining calls of bdevname with snprintf using the %pg
format specifier.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Jan Kara <jack@suse.cz >
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com >
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Link: https://lore.kernel.org/r/20220713055317.1888500-10-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-07-14 10:27:56 -06:00
Christoph Hellwig
02ff3dd20f
block: stop using bdevname in __blkdev_issue_discard
...
Just use the %pg format specifier instead.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Jan Kara <jack@suse.cz >
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com >
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Link: https://lore.kernel.org/r/20220713055317.1888500-3-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-07-14 10:27:56 -06:00
Christoph Hellwig
5bf83e9a14
block: stop using bdevname in bdev_write_inode
...
Just use the %pg format specifier instead. Also reformat the
printk statement to be more readable.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Jan Kara <jack@suse.cz >
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com >
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Link: https://lore.kernel.org/r/20220713055317.1888500-2-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-07-14 10:27:56 -06:00
Uros Bizjak
96388f57d2
blk-cgroup: Use atomic{,64}_try_cmpxchg
...
Use atomic_try_cmpxchg instead of atomic_cmpxchg (*ptr, old, new) == old
in blkcg_unuse_delay, blkcg_set_delay and blkcg_clear_delay and
atomic64_try_cmpxchg in blkcg_scale_delay. x86 CMPXCHG instruction
returns success in ZF flag, so this change saves a compare after cmpxchg
(and related move instruction in front of cmpxchg).
Also, atomic_try_cmpxchg implicitly assigns old *ptr value to "old" when
cmpxchg fails, enabling further code simplifications.
No functional change intended.
Signed-off-by: Uros Bizjak <ubizjak@gmail.com >
Cc: Jens Axboe <axboe@kernel.dk >
Link: https://lore.kernel.org/r/20220712154455.66868-1-ubizjak@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-07-12 15:46:03 -06:00
Uros Bizjak
aee8960c2e
blk-iolatency: Use atomic{,64}_try_cmpxchg
...
Use atomic_try_cmpxchg instead of atomic_cmpxchg (*ptr, old, new) == old
in check_scale_change and atomic64_try_cmpxchg in blkcg_iolatency_done_bio.
x86 CMPXCHG instruction returns success in ZF flag, so this change saves a
compare after cmpxchg (and related move instruction in front of cmpxchg).
No functional change intended.
Signed-off-by: Uros Bizjak <ubizjak@gmail.com >
Cc: Jens Axboe <axboe@kernel.dk >
Link: https://lore.kernel.org/r/20220712151947.6783-1-ubizjak@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-07-12 15:45:31 -06:00
Uros Bizjak
939f9dd040
block: Use try_cmpxchg in update_io_ticks
...
Use try_cmpxchg instead of cmpxchg (*ptr, old, new) == old in
update_io_ticks. x86 CMPXCHG instruction returns success in ZF flag,
so this change saves a compare after cmpxchg (and related
move instruction in front of cmpxchg).
No functional change intended.
Signed-off-by: Uros Bizjak <ubizjak@gmail.com >
Cc: Jens Axboe <axboe@kernel.dk >
Link: https://lore.kernel.org/r/20220712152741.7324-1-ubizjak@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-07-12 14:39:06 -06:00
Uros Bizjak
f4b1e27db4
block/rq_qos: Use atomic_try_cmpxchg in atomic_inc_below
...
Use atomic_try_cmpxchg instead of atomic_cmpxchg (*ptr, old, new) == old in
atomic_inc_below. x86 CMPXCHG instruction returns success in ZF flag,
so this change saves a compare after cmpxchg (and related move instruction
in front of cmpxchg).
Also, atomic_try_cmpxchg implicitly assigns old *ptr value to "old" when
cmpxchg fails, enabling further code simplifications.
No functional change intended.
Signed-off-by: Uros Bizjak <ubizjak@gmail.com >
Cc: Jens Axboe <axboe@kernel.dk >
Link: https://lore.kernel.org/r/20220712150547.5786-1-ubizjak@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-07-12 14:38:52 -06:00
Ming Lei
f3ec5d1155
blk-mq: don't create hctx debugfs dir until q->debugfs_dir is created
...
blk_mq_debugfs_register_hctx() can be called by blk_mq_update_nr_hw_queues
when gendisk isn't added yet, such as nvme tcp.
Fixes the warning of 'debugfs: Directory 'hctx0' with parent '/' already present!'
which can be observed reliably when running blktests nvme/005.
Fixes: 6cfc0081b0 ("blk-mq: no need to check return value of debugfs_create functions")
Reported-by: Yi Zhang <yi.zhang@redhat.com >
Signed-off-by: Ming Lei <ming.lei@redhat.com >
Tested-by: Yi Zhang <yi.zhang@redhat.com >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Link: https://lore.kernel.org/r/20220711090808.259682-1-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-07-12 06:52:27 -06:00
Christoph Hellwig
d86e716aa4
block: move zone related fields to struct gendisk
...
Move the zone related fields that are currently stored in
struct request_queue to struct gendisk as these are part of the highlevel
block layer API and are only used for non-passthrough I/O that requires
the gendisk.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com >
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Link: https://lore.kernel.org/r/20220706070350.1703384-17-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-07-06 06:46:26 -06:00
Christoph Hellwig
375c140c19
block: use bdev based helpers in blkdev_zone_mgmt{,all}
...
Use the bdev based helpers instead of the queue based ones to clean up
the code a bit and prepare for storing all zone related fields in
struct gendisk.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com >
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Link: https://lore.kernel.org/r/20220706070350.1703384-13-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-07-06 06:46:26 -06:00
Christoph Hellwig
b623e34732
block: replace blkdev_nr_zones with bdev_nr_zones
...
Pass a block_device instead of a request_queue as that is what most
callers have at hand.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com >
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Acked-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Link: https://lore.kernel.org/r/20220706070350.1703384-12-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-07-06 06:46:26 -06:00
Christoph Hellwig
1dc0172027
block: remove queue_max_open_zones and queue_max_active_zones
...
Always use the bdev based helpers instead.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com >
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Link: https://lore.kernel.org/r/20220706070350.1703384-10-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-07-06 06:46:26 -06:00
Christoph Hellwig
5d40066567
block: pass a gendisk to blk_queue_free_zone_bitmaps
...
Switch to a gendisk based API in preparation for moving all zone related
fields from the request_queue to the gendisk.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com >
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Link: https://lore.kernel.org/r/20220706070350.1703384-9-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-07-06 06:46:26 -06:00
Christoph Hellwig
b3c72f8138
block: pass a gendisk to blk_queue_clear_zone_settings
...
Switch to a gendisk based API in preparation for moving all zone related
fields from the request_queue to the gendisk.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com >
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Link: https://lore.kernel.org/r/20220706070350.1703384-8-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-07-06 06:46:26 -06:00
Christoph Hellwig
6b2bd27474
block: pass a gendisk to blk_queue_set_zoned
...
Prepare for storing the zone related field in struct gendisk instead
of struct request_queue.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com >
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Link: https://lore.kernel.org/r/20220706070350.1703384-7-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-07-06 06:46:26 -06:00
Christoph Hellwig
052e545c92
block: simplify blk_check_zone_append
...
Use the bdev based helpers instead of open coding them.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com >
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Link: https://lore.kernel.org/r/20220706070350.1703384-6-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-07-06 06:46:25 -06:00
Christoph Hellwig
6deacb3bfa
block: simplify blk_mq_plug
...
Drop the unused q argument, and invert the check to move the exception
into a branch and the regular path as the normal return.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com >
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Link: https://lore.kernel.org/r/20220706070350.1703384-5-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-07-06 06:46:25 -06:00
Christoph Hellwig
edd1dbc83b
block: use bdev_is_zoned instead of open coding it
...
Use bdev_is_zoned in all places where a block_device is available instead
of open coding it.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com >
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Link: https://lore.kernel.org/r/20220706070350.1703384-4-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-07-06 06:46:25 -06:00
Christoph Hellwig
6cc37a672a
block: call blk_queue_free_zone_bitmaps from disk_release
...
The zone bitmaps are only used for non-passthrough I/O, so free them as
soon as the disk is released.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com >
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Link: https://lore.kernel.org/r/20220706070350.1703384-3-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-07-06 06:46:25 -06:00
John Garry
4cf6e6c010
blk-mq: Drop local variable for reserved tag
...
The local variable is now only referenced once so drop it.
Signed-off-by: John Garry <john.garry@huawei.com >
Reviewed-by: Bart Van Assche <bvanassche@acm.org >
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com >
Link: https://lore.kernel.org/r/1657109034-206040-7-git-send-email-john.garry@huawei.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-07-06 06:33:53 -06:00
John Garry
2dd6532e95
blk-mq: Drop 'reserved' arg of busy_tag_iter_fn
...
We no longer use the 'reserved' arg in busy_tag_iter_fn for any iter
function so it may be dropped.
Signed-off-by: John Garry <john.garry@huawei.com >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com >
Reviewed-by: Sagi Grimberg <sagi@grimberg.me > #nvme
Reviewed-by: Bart Van Assche <bvanassche@acm.org >
Link: https://lore.kernel.org/r/1657109034-206040-6-git-send-email-john.garry@huawei.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-07-06 06:33:53 -06:00
John Garry
9bdb4833dd
blk-mq: Drop blk_mq_ops.timeout 'reserved' arg
...
With new API blk_mq_is_reserved_rq() we can tell if a request is from
the reserved pool, so stop passing 'reserved' arg. There is actually
only a single user of that arg for all the callback implementations, which
can use blk_mq_is_reserved_rq() instead.
This will also allow us to stop passing the same 'reserved' around the
blk-mq iter functions next.
Signed-off-by: John Garry <john.garry@huawei.com >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Bart Van Assche <bvanassche@acm.org >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Acked-by: Ulf Hansson <ulf.hansson@linaro.org > # For MMC
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com >
Link: https://lore.kernel.org/r/1657109034-206040-4-git-send-email-john.garry@huawei.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-07-06 06:33:53 -06:00
John Garry
99e48cd685
blk-mq: Add a flag for reserved requests
...
Add a flag for reserved requests so that drivers may know this for any
special handling.
Signed-off-by: John Garry <john.garry@huawei.com >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Bart Van Assche <bvanassche@acm.org >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com >
Link: https://lore.kernel.org/r/1657109034-206040-3-git-send-email-john.garry@huawei.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-07-06 06:33:53 -06:00
Jason Yan
e55cf79814
blk-cgroup: factor out blkcg_free_all_cpd()
...
To reduce some duplicated code, factor out blkcg_free_all_cpd(). No
functional change.
Signed-off-by: Jason Yan <yanaijie@huawei.com >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Link: https://lore.kernel.org/r/20220629070917.3113016-3-yanaijie@huawei.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-06-29 11:09:53 -06:00
Jason Yan
362b8c16f8
blk-cgroup: factor out blkcg_iostat_update()
...
To reduce some duplicated code, factor out blkcg_iostat_update(). No
functional change.
Signed-off-by: Jason Yan <yanaijie@huawei.com >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Link: https://lore.kernel.org/r/20220629070917.3113016-2-yanaijie@huawei.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-06-29 11:09:53 -06:00
Christoph Hellwig
22d0c4080f
block: simplify disk_set_independent_access_ranges
...
Lift setting disk->ia_ranges from disk_register_independent_access_ranges
into disk_set_independent_access_ranges, and make the behavior the same
for the registered vs non-registered queue cases.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Tested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Link: https://lore.kernel.org/r/20220629062013.1331068-3-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-06-29 08:36:46 -06:00
Christoph Hellwig
6a27d28c81
block: move ->ia_ranges from the request_queue to the gendisk
...
Independent access ranges only matter for file system I/O and are only
valid with a registered gendisk, so move them there.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Tested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Link: https://lore.kernel.org/r/20220629062013.1331068-2-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-06-29 08:36:46 -06:00
Ying Sun
b9a1c179bd
block: remove "select BLK_RQ_IO_DATA_LEN" from BLK_CGROUP_IOCOST dependency
...
The configuration item BLK_RQ_IO_DATA_LEN is not declared in the kernel.
Select BLK_RQ_IO_DATA_LEN is meaningless which could be removed.
Signed-off-by: Ying Sun <sunying@nj.iscas.ac.cn >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Link: https://lore.kernel.org/r/20220629062409.19458-1-sunying@nj.iscas.ac.cn
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-06-29 08:35:57 -06:00
Matthew Wilcox (Oracle)
0e00fa5f83
block: Remove check of PageError
...
If read_mapping_page() sees a page with PageError set, it returns a
PTR_ERR(). Checking PageError again is simply dead code.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org >
2022-06-29 08:51:06 -04:00
Christoph Hellwig
8682b92e5a
blk-mq: cleanup disk sysfs registration
...
Pass a gendisk to the sysfs register/unregister functions and give
them descriptive names. Also move the unregistration helper next
to the one doing the registration.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Bart Van Assche <bvanassche@acm.org >
Link: https://lore.kernel.org/r/20220628171850.1313069-7-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-06-28 11:32:42 -06:00
Christoph Hellwig
eaa870f975
blk-mq: rename blk_mq_sysfs_{,un}register
...
Add a _hctx postfix to better describe what the functions do, match
the debugfs equivalents and release the old names for functions that
should be using them.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Bart Van Assche <bvanassche@acm.org >
Link: https://lore.kernel.org/r/20220628171850.1313069-6-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-06-28 11:32:42 -06:00
Christoph Hellwig
81f0c2ef41
block: remove the extra gendisk reference in __blk_mq_register_dev
...
kobject_add already grabs a reference to the parent, no need to have
another one.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Bart Van Assche <bvanassche@acm.org >
Link: https://lore.kernel.org/r/20220628171850.1313069-5-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-06-28 11:32:42 -06:00
Christoph Hellwig
4a8d14bba4
block: use default groups to register the queue attributes
...
Set up the default_groups for blk_queue_ktype instead of manually calling
sysfs_create_group.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Bart Van Assche <bvanassche@acm.org >
Link: https://lore.kernel.org/r/20220628171850.1313069-4-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-06-28 11:32:42 -06:00
Christoph Hellwig
060f131e9c
block: remove a superflous queue kobject reference
...
kobject_add already adds a reference to the parent that is dropped
on deletion, so don't bother grabbing another one.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Bart Van Assche <bvanassche@acm.org >
Link: https://lore.kernel.org/r/20220628171850.1313069-3-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-06-28 11:32:42 -06:00
Christoph Hellwig
cc5c516df0
block: simplify blktrace sysfs attribute creation
...
Add the trace attributes to the default gendisk attributes, just like
we already do for partitions.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Bart Van Assche <bvanassche@acm.org >
Link: https://lore.kernel.org/r/20220628171850.1313069-2-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-06-28 11:32:42 -06:00
Christoph Hellwig
8b9ab62662
block: remove blk_cleanup_disk
...
blk_cleanup_disk is nothing but a trivial wrapper for put_disk now,
so remove it.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Link: https://lore.kernel.org/r/20220619060552.1850436-7-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-06-28 06:33:15 -06:00
Christoph Hellwig
6f8191fdf4
block: simplify disk shutdown
...
Set the queue dying flag and call blk_mq_exit_queue from del_gendisk for
all disks that do not have separately allocated queues, and thus remove
the need to call blk_cleanup_queue for them.
Rename blk_cleanup_disk to blk_mq_destroy_queue to make it clear that
this function is intended only for separately allocated blk-mq queues.
This saves an extra queue freeze for devices without a separately
allocated queue.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Link: https://lore.kernel.org/r/20220619060552.1850436-6-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-06-28 06:30:26 -06:00
Christoph Hellwig
0e3534022f
block: stop setting the nomerges flags in blk_cleanup_queue
...
These flags only apply to file system I/O, and all file system I/O is
already drained by del_gendisk and thus can't be in progress when
blk_cleanup_queue is called.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Link: https://lore.kernel.org/r/20220619060552.1850436-5-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-06-28 06:30:26 -06:00
Christoph Hellwig
1f90307e5f
block: remove QUEUE_FLAG_DEAD
...
Disallow setting the blk-mq state on any queue that is already dying as
setting the state even then is a bad idea, and remove the now unused
QUEUE_FLAG_DEAD flag.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Link: https://lore.kernel.org/r/20220619060552.1850436-4-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-06-28 06:30:26 -06:00
Liu Song
ee78ec1077
blk-mq: blk_mq_tag_busy is no need to return a value
...
Currently "blk_mq_tag_busy" return value has no effect, so adjust it.
Some code implementations have also been adjusted to enhance
readability.
Signed-off-by: Liu Song <liusong@linux.alibaba.com >
Link: https://lore.kernel.org/r/1656170121-1619-1-git-send-email-liusong@linux.alibaba.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-06-27 06:29:12 -06:00
Jan Kara
a78418e6a0
block: Always initialize bio IO priority on submit
...
Currently, IO priority set in task's IO context is not reflected in the
bio->bi_ioprio for most IO (only io_uring and direct IO set it). This
results in odd results where process is submitting some bios with one
priority and other bios with a different (unset) priority and due to
differing priorities bios cannot be merged. Make sure bio->bi_ioprio is
always set on bio submission.
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Tested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Signed-off-by: Jan Kara <jack@suse.cz >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Link: https://lore.kernel.org/r/20220623074840.5960-9-jack@suse.cz
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-06-27 06:29:12 -06:00
Jan Kara
9c6227e043
block: Initialize bio priority earlier
...
Bio's IO priority needs to be initialized before we try to merge the bio
with other bios. Otherwise we could merge bios which would otherwise
receive different IO priorities leading to possible QoS issues.
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Tested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Signed-off-by: Jan Kara <jack@suse.cz >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Link: https://lore.kernel.org/r/20220623074840.5960-8-jack@suse.cz
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2022-06-27 06:29:12 -06:00