Hi Linus, Here are the core block changes for this merge window. This pull request contains: - Online capacity resizing (Balbir) - Number of hardware queue change fixes (Bart) - null_blk fault injection addition (Bart) - Cleanup of queue allocation, unifying the node/no-node API (Christoph) - Cleanup of genhd, moving code to where it makes sense (Christoph) - Cleanup of the partition handling code (Christoph) - disk stat fixes/improvements (Konstantin) - BFQ improvements (Paolo) - Various fixes and improvements Note that this will throw a merge conflict in <linux/genhd.h>, due to this fix in 5.6: commit b53df2e7442c73a932fb74228147fb946e531585 (tag: block-5.6-2020-03-13) Author: Shin'ichiro Kawasaki <shinichiro.kawasaki@xxxxxxx> Date: Fri Feb 21 10:37:08 2020 +0900 block: Fix partition support for host aware zoned block devices The fixup is trivial, delete everything in the merge conflict, except disk_has_partitions(). I'm attaching my resolution, for reference. Please pull! git://git.kernel.dk/linux-block.git tags/for-5.7/block-2020-03-29 ---------------------------------------------------------------- Alexey Dobriyan (1): block, zoned: fix integer overflow with BLKRESETZONE et al Balbir Singh (5): block/genhd: Notify udev about capacity change virtio_blk.c: Convert to use set_capacity_revalidate_and_notify xen-blkfront.c: Convert to use set_capacity_revalidate_and_notify nvme: Convert to use set_capacity_revalidate_and_notify scsi: Convert to use set_capacity_revalidate_and_notify Bart Van Assche (8): blk-mq: Fix a comment in include/linux/blk-mq.h blk-mq: Keep set->nr_hw_queues and set->map[].nr_queues in sync blk-mq: Fix a recently introduced regression in blk_mq_realloc_hw_ctxs() null_blk: Suppress an UBSAN complaint triggered when setting 'memory_backed' null_blk: Fix changing the number of hardware queues null_blk: Fix the null_add_dev() error path null_blk: Handle null_add_dev() failures properly null_blk: Add support for init_hctx() fault injection Chaitanya Kulkarni (1): block: return NULL in blk_alloc_queue() on error Christoph Hellwig (37): block: fix a device invalidation regression block: remove the blk_lookup_devt export block: remove __bdevname block: move disk_name and related helpers out of partition-generic.c block: move sysfs methods shared by disks and partitions to genhd.c block: remove alloc_part_info and free_part_info scsi: simplify scsi_bios_ptable scsi: move scsicam_bios_param to the end of scsicam.c scsi: simplify scsi_partsize block: unexport read_dev_sector and put_dev_sector block: cleanup how md_autodetect_dev is called block: remove warn_no_part block: declare all partition detection routines in check.h block: remove block/partitions/karma.h block: remove block/partitions/osf.h block: remove block/partitions/sgi.h block: remove block/partitions/sun.h block: move struct partition out of genhd.h block: move the *_PARTITION enum out of genhd.h partitions/msdos: remove LINUX_SWAP_PARTITION block: move the various x86 Unix label formats out of genhd.h block: merge partition-generic.c and check.c block: mark block_depr static block: mark part_in_flight and part_in_flight_rw static block: unexport disk_get_part block: unexport disk_map_sector_rcu block: unexport get_gendisk block: move guard_bio_eod to bio.c block: move block layer internals out of include/linux/genhd.h block: move the part_stat* helpers from genhd.h to a new header block: move the ->devnode callback to struct block_device_operations block: add a blk_mq_init_queue_data helper null_blk: use blk_mq_init_queue_data bcache: pass the make_request methods to blk_queue_make_request block: simplify queue allocation Revert "blkdev: check for valid request queue before issuing flush" block: move bio_map_* to blk-map.c Guoqing Jiang (6): block: fix comment for blk_cloned_rq_check_limits block: use bio_{wouldblock,io}_error in direct_make_request block: remove redundant setting of QUEUE_FLAG_DYING block: cleanup for _blk/blk_rq_prep_clone block: remove unneeded argument from blk_alloc_flush_queue block: cleanup comment for blk_flush_complete_seq Johannes Thumshirn (1): block: factor out requeue handling from dispatch code Konstantin Khlebnikov (3): block/diskstats: more accurate approximation of io_ticks for slow disks block/diskstats: accumulate all per-cpu counters in one pass block/diskstats: replace time_in_queue with sum of request times Ming Lei (1): block: Prevent hung_check firing during long sync IO Paolo Valente (4): block, bfq: move forward the getting of an extra ref in bfq_bfqq_move block, bfq: turn put_queue into release_process_ref in __bfq_bic_change_cgroup block, bfq: make reparent_leaf_entity actually work only on leaf entities block, bfq: invoke flush_idle_tree after reparent_active_queues in pd_offline Revanth Rajashekar (1): block: sed-opal: Change the check condition for regular session validity Sahitya Tummala (1): block: Fix use-after-free issue accessing struct io_cq Stephen Kitt (1): block: Document genhd capability flags Weiping Zhang (1): blk-iocost: remove duplicated lines in comments Zhiqiang Liu (1): block, bfq: fix use-after-free in bfq_idle_slice_timer_body Documentation/admin-guide/iostats.rst | 5 +- Documentation/block/capability.rst | 16 +- Documentation/scsi/scsi_mid_low_api.txt | 21 - arch/m68k/emu/nfblock.c | 3 +- arch/xtensa/platforms/iss/simdisk.c | 3 +- block/Makefile | 3 +- block/bfq-cgroup.c | 87 ++-- block/bfq-iosched.c | 18 +- block/bfq-iosched.h | 1 + block/bio.c | 580 +++-------------------- block/blk-cgroup.c | 2 +- block/blk-core.c | 82 ++-- block/blk-flush.c | 16 +- block/blk-ioc.c | 7 + block/blk-iocost.c | 3 - block/blk-map.c | 508 ++++++++++++++++++++ block/blk-mq.c | 59 ++- block/blk-settings.c | 36 -- block/blk-zoned.c | 2 +- block/blk.h | 138 +++++- block/genhd.c | 219 +++++++-- block/ioctl.c | 1 + block/opal_proto.h | 1 + block/partitions/Makefile | 3 +- block/partitions/acorn.c | 1 - block/partitions/acorn.h | 15 - block/partitions/aix.c | 1 - block/partitions/aix.h | 2 - block/partitions/amiga.c | 11 +- block/partitions/amiga.h | 7 - block/partitions/atari.h | 1 - block/partitions/check.c | 198 -------- block/partitions/check.h | 41 +- block/partitions/cmdline.c | 1 - block/partitions/cmdline.h | 3 - block/{partition-generic.c => partitions/core.c} | 319 +++++++------ block/partitions/efi.h | 3 - block/partitions/ibm.c | 1 - block/partitions/ibm.h | 2 - block/partitions/karma.c | 3 +- block/partitions/karma.h | 9 - block/partitions/ldm.c | 6 +- block/partitions/ldm.h | 2 - block/partitions/mac.h | 1 - block/partitions/msdos.c | 172 ++++++- block/partitions/msdos.h | 9 - block/partitions/osf.c | 2 +- block/partitions/osf.h | 8 - block/partitions/sgi.c | 7 +- block/partitions/sgi.h | 9 - block/partitions/sun.c | 9 +- block/partitions/sun.h | 9 - block/partitions/sysv68.c | 1 - block/partitions/sysv68.h | 2 - block/partitions/ultrix.c | 1 - block/partitions/ultrix.h | 6 - block/sed-opal.c | 2 +- drivers/block/brd.c | 4 +- drivers/block/drbd/drbd_main.c | 3 +- drivers/block/drbd/drbd_receiver.c | 1 + drivers/block/drbd/drbd_worker.c | 1 + drivers/block/null_blk_main.c | 106 +++-- drivers/block/pktcdvd.c | 15 +- drivers/block/ps3vram.c | 3 +- drivers/block/rsxx/dev.c | 3 +- drivers/block/umem.c | 4 +- drivers/block/virtio_blk.c | 5 +- drivers/block/xen-blkfront.c | 6 +- drivers/block/zram/zram_drv.c | 5 +- drivers/lightnvm/core.c | 3 +- drivers/md/bcache/request.c | 7 +- drivers/md/bcache/request.h | 3 + drivers/md/bcache/super.c | 11 +- drivers/md/dm.c | 10 +- drivers/md/md.c | 9 +- drivers/nvdimm/blk.c | 3 +- drivers/nvdimm/btt.c | 3 +- drivers/nvdimm/pmem.c | 3 +- drivers/nvme/host/core.c | 2 +- drivers/nvme/host/multipath.c | 3 +- drivers/nvme/target/admin-cmd.c | 1 + drivers/s390/block/dcssblk.c | 4 +- drivers/s390/block/xpram.c | 4 +- drivers/scsi/BusLogic.c | 8 +- drivers/scsi/aacraid/linit.c | 7 +- drivers/scsi/aic7xxx/aic79xx_osm.c | 13 +- drivers/scsi/aic7xxx/aic7xxx_osm.c | 13 +- drivers/scsi/arcmsr/arcmsr_hba.c | 13 +- drivers/scsi/megaraid.c | 13 +- drivers/scsi/scsi_debug.c | 5 +- drivers/scsi/scsicam.c | 186 ++++---- drivers/scsi/sd.c | 3 +- fs/block_dev.c | 20 +- fs/buffer.c | 43 -- fs/ext4/super.c | 8 +- fs/ext4/sysfs.c | 1 + fs/f2fs/f2fs.h | 1 + fs/f2fs/super.c | 1 + fs/internal.h | 1 - fs/reiserfs/journal.c | 5 +- include/linux/bio.h | 15 +- include/linux/blk-mq.h | 7 +- include/linux/blkdev.h | 14 +- include/linux/fs.h | 1 - include/linux/genhd.h | 521 +++----------------- include/linux/iocontext.h | 1 + include/linux/msdos_partition.h | 50 ++ include/linux/part_stat.h | 115 +++++ include/linux/raid/detect.h | 3 + include/scsi/scsicam.h | 7 +- init/do_mounts.c | 12 +- 111 files changed, 1949 insertions(+), 2038 deletions(-) delete mode 100644 block/partitions/acorn.h delete mode 100644 block/partitions/aix.h delete mode 100644 block/partitions/amiga.h delete mode 100644 block/partitions/check.c delete mode 100644 block/partitions/cmdline.h rename block/{partition-generic.c => partitions/core.c} (72%) delete mode 100644 block/partitions/ibm.h delete mode 100644 block/partitions/karma.h delete mode 100644 block/partitions/msdos.h delete mode 100644 block/partitions/osf.h delete mode 100644 block/partitions/sgi.h delete mode 100644 block/partitions/sun.h delete mode 100644 block/partitions/sysv68.h delete mode 100644 block/partitions/ultrix.h create mode 100644 include/linux/msdos_partition.h create mode 100644 include/linux/part_stat.h create mode 100644 include/linux/raid/detect.h -- Jens Axboe
commit 31779ceddac7d04cc2bb54aaa13f00f204514697 Merge: 570203ec830d 654a3667df36 Author: Jens Axboe <axboe@xxxxxxxxx> Date: Sun Mar 29 16:51:15 2020 -0600 Merge branch 'for-5.7/block' into test * for-5.7/block: (72 commits) block: return NULL in blk_alloc_queue() on error block: move bio_map_* to blk-map.c Revert "blkdev: check for valid request queue before issuing flush" block: simplify queue allocation bcache: pass the make_request methods to blk_queue_make_request null_blk: use blk_mq_init_queue_data block: add a blk_mq_init_queue_data helper block: move the ->devnode callback to struct block_device_operations block: move the part_stat* helpers from genhd.h to a new header block: move block layer internals out of include/linux/genhd.h block: move guard_bio_eod to bio.c block: unexport get_gendisk block: unexport disk_map_sector_rcu block: unexport disk_get_part block: mark part_in_flight and part_in_flight_rw static block: mark block_depr static block: factor out requeue handling from dispatch code block/diskstats: replace time_in_queue with sum of request times block/diskstats: accumulate all per-cpu counters in one pass block/diskstats: more accurate approximation of io_ticks for slow disks ... Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> diff --cc block/genhd.c index 9c2e13ce0d19,14cf395a1479..06b642b23a07 --- a/block/genhd.c +++ b/block/genhd.c @@@ -299,44 -372,7 +372,43 @@@ struct hd_struct *disk_map_sector_rcu(s } return &disk->part0; } - EXPORT_SYMBOL_GPL(disk_map_sector_rcu); +/** + * disk_has_partitions + * @disk: gendisk of interest + * + * Walk through the partition table and check if valid partition exists. + * + * CONTEXT: + * Don't care. + * + * RETURNS: + * True if the gendisk has at least one valid non-zero size partition. + * Otherwise false. + */ +bool disk_has_partitions(struct gendisk *disk) +{ + struct disk_part_tbl *ptbl; + int i; + bool ret = false; + + rcu_read_lock(); + ptbl = rcu_dereference(disk->part_tbl); + + /* Iterate partitions skipping the whole device at index 0 */ + for (i = 1; i < ptbl->len; i++) { + if (rcu_dereference(ptbl->part[i])) { + ret = true; + break; + } + } + + rcu_read_unlock(); + + return ret; +} +EXPORT_SYMBOL_GPL(disk_has_partitions); + /* * Can be deleted altogether. Later. * diff --cc include/linux/genhd.h index 07dc91835b98,85b9e253cd39..39fc9fe709fc --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@@ -284,144 -297,6 +285,8 @@@ extern void disk_part_iter_init(struct extern struct hd_struct *disk_part_iter_next(struct disk_part_iter *piter); extern void disk_part_iter_exit(struct disk_part_iter *piter); - extern struct hd_struct *disk_map_sector_rcu(struct gendisk *disk, - sector_t sector); +bool disk_has_partitions(struct gendisk *disk); + - /* - * Macros to operate on percpu disk statistics: - * - * {disk|part|all}_stat_{add|sub|inc|dec}() modify the stat counters - * and should be called between disk_stat_lock() and - * disk_stat_unlock(). - * - * part_stat_read() can be called at any time. - * - * part_stat_{add|set_all}() and {init|free}_part_stats are for - * internal use only. - */ - #ifdef CONFIG_SMP - #define part_stat_lock() ({ rcu_read_lock(); get_cpu(); }) - #define part_stat_unlock() do { put_cpu(); rcu_read_unlock(); } while (0) - - #define part_stat_get_cpu(part, field, cpu) \ - (per_cpu_ptr((part)->dkstats, (cpu))->field) - - #define part_stat_get(part, field) \ - part_stat_get_cpu(part, field, smp_processor_id()) - - #define part_stat_read(part, field) \ - ({ \ - typeof((part)->dkstats->field) res = 0; \ - unsigned int _cpu; \ - for_each_possible_cpu(_cpu) \ - res += per_cpu_ptr((part)->dkstats, _cpu)->field; \ - res; \ - }) - - static inline void part_stat_set_all(struct hd_struct *part, int value) - { - int i; - - for_each_possible_cpu(i) - memset(per_cpu_ptr(part->dkstats, i), value, - sizeof(struct disk_stats)); - } - - static inline int init_part_stats(struct hd_struct *part) - { - part->dkstats = alloc_percpu(struct disk_stats); - if (!part->dkstats) - return 0; - return 1; - } - - static inline void free_part_stats(struct hd_struct *part) - { - free_percpu(part->dkstats); - } - - #else /* !CONFIG_SMP */ - #define part_stat_lock() ({ rcu_read_lock(); 0; }) - #define part_stat_unlock() rcu_read_unlock() - - #define part_stat_get(part, field) ((part)->dkstats.field) - #define part_stat_get_cpu(part, field, cpu) part_stat_get(part, field) - #define part_stat_read(part, field) part_stat_get(part, field) - - static inline void part_stat_set_all(struct hd_struct *part, int value) - { - memset(&part->dkstats, value, sizeof(struct disk_stats)); - } - - static inline int init_part_stats(struct hd_struct *part) - { - return 1; - } - - static inline void free_part_stats(struct hd_struct *part) - { - } - - #endif /* CONFIG_SMP */ - - #define part_stat_read_msecs(part, which) \ - div_u64(part_stat_read(part, nsecs[which]), NSEC_PER_MSEC) - - #define part_stat_read_accum(part, field) \ - (part_stat_read(part, field[STAT_READ]) + \ - part_stat_read(part, field[STAT_WRITE]) + \ - part_stat_read(part, field[STAT_DISCARD])) - - #define __part_stat_add(part, field, addnd) \ - (part_stat_get(part, field) += (addnd)) - - #define part_stat_add(part, field, addnd) do { \ - __part_stat_add((part), field, addnd); \ - if ((part)->partno) \ - __part_stat_add(&part_to_disk((part))->part0, \ - field, addnd); \ - } while (0) - - #define part_stat_dec(gendiskp, field) \ - part_stat_add(gendiskp, field, -1) - #define part_stat_inc(gendiskp, field) \ - part_stat_add(gendiskp, field, 1) - #define part_stat_sub(gendiskp, field, subnd) \ - part_stat_add(gendiskp, field, -subnd) - - #define part_stat_local_dec(gendiskp, field) \ - local_dec(&(part_stat_get(gendiskp, field))) - #define part_stat_local_inc(gendiskp, field) \ - local_inc(&(part_stat_get(gendiskp, field))) - #define part_stat_local_read(gendiskp, field) \ - local_read(&(part_stat_get(gendiskp, field))) - #define part_stat_local_read_cpu(gendiskp, field, cpu) \ - local_read(&(part_stat_get_cpu(gendiskp, field, cpu))) - - unsigned int part_in_flight(struct request_queue *q, struct hd_struct *part); - void part_in_flight_rw(struct request_queue *q, struct hd_struct *part, - unsigned int inflight[2]); - void part_dec_in_flight(struct request_queue *q, struct hd_struct *part, - int rw); - void part_inc_in_flight(struct request_queue *q, struct hd_struct *part, - int rw); - - static inline struct partition_meta_info *alloc_part_info(struct gendisk *disk) - { - if (disk) - return kzalloc_node(sizeof(struct partition_meta_info), - GFP_KERNEL, disk->node_id); - return kzalloc(sizeof(struct partition_meta_info), GFP_KERNEL); - } - - static inline void free_part_info(struct hd_struct *part) - { - kfree(part->info); - } - - void update_io_ticks(struct hd_struct *part, unsigned long now); - /* block/genhd.c */ extern void device_add_disk(struct device *parent, struct gendisk *disk, const struct attribute_group **groups);