Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GIT PULL] block device inode syncing improvements #7

Merged
merged 158 commits into from
Nov 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
158 commits
Select commit Hold shift + click to select a range
3c08b09
blk-cgroup: blk_cgroup_bio_start() should use irq-safe operations on …
htejun Oct 14, 2021
348332e
mm: don't include <linux/blk-cgroup.h> in <linux/writeback.h>
Sep 20, 2021
e41d12f
mm: don't include <linux/blk-cgroup.h> in <linux/backing-dev.h>
Sep 20, 2021
ccdf774
mm: don't include <linux/blkdev.h> in <linux/backing-dev.h>
Sep 20, 2021
518d550
mm: remove spurious blkdev.h includes
Sep 20, 2021
dcbfa22
arch: remove spurious blkdev.h includes
Sep 20, 2021
545c664
kernel: remove spurious blkdev.h includes
Sep 20, 2021
6a5850d
sched: move the <linux/blkdev.h> include out of kernel/sched/sched.h
Sep 20, 2021
1d9433c
block: remove the unused rq_end_sector macro
Sep 20, 2021
9013823
block: remove the unused blk_queue_state enum
Sep 20, 2021
713e4e1
block: remove the cmd_size field from struct request_queue
Sep 20, 2021
9778ac7
block: remove the struct blk_queue_ctx forward declaration
Sep 20, 2021
2e9bc34
block: move elevator.h to block/
Sep 20, 2021
3ab0bc7
block: drop unused includes in <linux/blkdev.h>
Sep 20, 2021
b81e0c2
block: drop unused includes in <linux/genhd.h>
Sep 20, 2021
badf7f6
block: move a few merge helpers out of <linux/blkdev.h>
Sep 20, 2021
fe45e63
block: move integrity handling out of <linux/blkdev.h>
Sep 20, 2021
24b83de
block: move struct request to blk-mq.h
Sep 20, 2021
e2c7275
block/mq-deadline: Improve request accounting further
bvanassche Sep 27, 2021
32f64ca
block/mq-deadline: Add an invariant check
bvanassche Sep 27, 2021
bce0363
block/mq-deadline: Stop using per-CPU counters
bvanassche Sep 27, 2021
322cff7
block/mq-deadline: Prioritize high-priority requests
bvanassche Sep 27, 2021
8a3ee67
block: print the current process in handle_bad_sector
Sep 28, 2021
65de57b
blk-mq: Change rqs check in blk_mq_free_rqs()
Oct 5, 2021
d2a2796
block: Rename BLKDEV_MAX_RQ -> BLKDEV_DEFAULT_RQ
Oct 5, 2021
8fa0446
blk-mq: Relocate shared sbitmap resize in blk_mq_update_nr_requests()
Oct 5, 2021
f6adcef
blk-mq: Invert check in blk_mq_update_nr_requests()
Oct 5, 2021
d99a6bb
blk-mq-sched: Rename blk_mq_sched_alloc_{tags -> map_and_rqs}()
Oct 5, 2021
1820f4f
blk-mq-sched: Rename blk_mq_sched_free_{requests -> rqs}()
Oct 5, 2021
f32e4ea
blk-mq: Pass driver tags to blk_mq_clear_rq_mapping()
Oct 5, 2021
4f245d5
blk-mq: Don't clear driver tags own mapping
Oct 5, 2021
a7e7388
blk-mq: Add blk_mq_tag_update_sched_shared_sbitmap()
Oct 5, 2021
63064be
blk-mq: Add blk_mq_alloc_map_and_rqs()
Oct 5, 2021
645db34
blk-mq: Refactor and rename blk_mq_free_map_and_{requests->rqs}()
Oct 5, 2021
e155b0c
blk-mq: Use shared tags for shared sbitmap support
Oct 5, 2021
ae0f1a7
blk-mq: Stop using pointers for blk_mq_tags bitmap tags
Oct 5, 2021
079a2e3
blk-mq: Change shared sbitmap naming to shared tags
Oct 5, 2021
a7b36ee
block: move blk-throtl fast path inline
axboe Oct 5, 2021
0006707
block: inherit request start time from bio for BLK_CGROUP
axboe Oct 5, 2021
ba0ffdd
block: bump max plugged deferred size from 16 to 32
axboe Oct 6, 2021
47c122e
block: pre-allocate requests if plug is started and is a batch
axboe Oct 6, 2021
b90cfae
blk-mq: cleanup and rename __blk_mq_alloc_request
Oct 12, 2021
0f38d76
blk-mq: cleanup blk_mq_submit_bio
Oct 12, 2021
4a60f36
block: don't dereference request after flush insertion
axboe Oct 16, 2021
fea349b
block: unexport blkdev_ioctl
Oct 12, 2021
84b8514
block: move the *blkdev_ioctl declarations out of blkdev.h
Oct 12, 2021
8a70951
block: merge block_ioctl into blkdev_ioctl
Oct 12, 2021
be6bfe3
block: inline hot paths of blk_account_io_*()
isilence Oct 9, 2021
e9ea159
blk-mq: inline hot part of __blk_mq_sched_restart
isilence Oct 9, 2021
9e8c0d0
block: remove BIO_BUG_ON
Oct 12, 2021
11d9cab
block: don't include <linux/ioprio.h> in <linux/bio.h>
Oct 12, 2021
8addffd
block: move bio_mergeable out of bio.h
Oct 12, 2021
b6559d8
block: fold bio_cur_bytes into blk_rq_cur_bytes
Oct 12, 2021
9a6083b
block: move bio_full out of bio.h
Oct 12, 2021
9774b39
block: mark __bio_try_merge_page static
Oct 12, 2021
ff18d77
block: move bio_get_{first,last}_bvec out of bio.h
Oct 12, 2021
4f7ab09
block: mark bio_truncate static
Oct 12, 2021
8971a3b
blk-mq: optimise *end_request non-stat path
isilence Oct 13, 2021
9672b0d
sbitmap: add __sbitmap_queue_get_batch()
axboe Oct 9, 2021
349302d
block: improve batched tag allocation
axboe Oct 9, 2021
df252bd
block: remove redundant =y from BLK_CGROUP dependency
masahir0y Sep 27, 2021
c50fca5
block: simplify Kconfig files
masahir0y Sep 27, 2021
b8b98a6
block: move menu "Partition type" to block/partitions/Kconfig
masahir0y Sep 27, 2021
4c92890
block: move CONFIG_BLOCK guard to top Makefile
masahir0y Sep 27, 2021
d38a9c0
block: only check previous entry for plug merge attempt
axboe Oct 14, 2021
94c2ed5
direct-io: remove blk_poll support
Oct 12, 2021
71fc3f5
block: don't try to poll multi-bio I/Os in __blkdev_direct_IO
Oct 12, 2021
f79d474
iomap: don't try to poll multi-bio I/Os in __iomap_dio_rw
Oct 12, 2021
30da1b4
io_uring: fix a layering violation in io_iopoll_req_issued
Oct 12, 2021
f70299f
blk-mq: factor out a blk_qc_to_hctx helper
Oct 12, 2021
c6699d6
blk-mq: factor out a "classic" poll helper
Oct 12, 2021
efbabbe
blk-mq: remove blk_qc_t_to_tag and blk_qc_t_is_internal
Oct 12, 2021
28a1ae6
blk-mq: remove blk_qc_t_valid
Oct 12, 2021
ef99b2d
block: replace the spin argument to blk_iopoll with a flags argument
Oct 12, 2021
d729cf9
io_uring: don't sleep when polling for I/O
Oct 12, 2021
6ce913f
block: rename REQ_HIPRI to REQ_POLLED
Oct 12, 2021
1a7e76e
block: use SLAB_TYPESAFE_BY_RCU for the bio slab
Oct 12, 2021
1941612
block: define 'struct bvec_iter' as packed
Oct 12, 2021
3e08773
block: switch polling to be bio based
Oct 12, 2021
a614dd2
block: don't allow writing to the poll queue attribute
Oct 12, 2021
c712dcc
nvme-multipath: enable polled I/O
Oct 12, 2021
fac7c6d
block: cache bdev in struct file for raw bdev IO
isilence Oct 13, 2021
09ce874
block: use flags instead of bit fields for blkdev_dio
axboe Oct 14, 2021
abd45c1
block: handle fast path of bio splitting inline
axboe Oct 13, 2021
17220ca
block: cache request queue in bdev
isilence Oct 14, 2021
025a386
block: use bdev_get_queue() in bdev.c
isilence Oct 14, 2021
3caee46
block: use bdev_get_queue() in bio.c
isilence Oct 14, 2021
eab4e02
block: use bdev_get_queue() in blk-core.c
isilence Oct 14, 2021
ed6cdde
block: convert the rest of block to bdev_get_queue
isilence Oct 14, 2021
d4aa57a
block: don't bother iter advancing a fully done bio
axboe Oct 13, 2021
c477b79
block: remove useless caller argument to print_req_error()
axboe Oct 14, 2021
9be3e06
block: move update request helpers into blk-mq.c
axboe Oct 14, 2021
b608762
block: improve layout of struct request
axboe Oct 15, 2021
90b8faa
block: only mark bio as tracked if it really is tracked
axboe Oct 16, 2021
2ff0682
block: store elevator state in request
axboe Oct 15, 2021
4f266f2
block: skip elevator fields init for non-elv queue
isilence Oct 18, 2021
605f784
block: blk_mq_rq_ctx_init cache ctx/q/hctx
isilence Oct 18, 2021
1284590
block: cache rq_flags inside blk_mq_rq_ctx_init()
isilence Oct 18, 2021
9a14d6c
block: remove debugfs blk_mq_ctx dispatched/merged/completed attributes
axboe Oct 16, 2021
afd7de0
block: remove some blk_mq_hw_ctx debugfs entries
axboe Oct 18, 2021
013a7f9
block: provide helpers for rq_list manipulation
axboe Oct 13, 2021
5a72e89
block: add a struct io_comp_batch argument to fops->iopoll()
axboe Oct 12, 2021
1aec5e4
sbitmap: add helper to clear a batch of tags
axboe Oct 8, 2021
f794f33
block: add support for blk_mq_end_request_batch()
axboe Oct 8, 2021
c234a65
nvme: add support for batched completion of polled IO
axboe Oct 8, 2021
b688f11
io_uring: utilize the io batching infrastructure for more efficient p…
axboe Oct 12, 2021
4f50224
nvme: wire up completion batching for the IRQ path
axboe Oct 18, 2021
e0d78af
block: fix too broad elevator check in blk_mq_free_request()
axboe Oct 19, 2021
db9a02b
block: move bdev_read_only() into the header
axboe Oct 6, 2021
8a7d267
block: don't call blk_status_to_errno in blk_update_request
Oct 18, 2021
87c037d
block: return whether or not to unplug through boolean
axboe Oct 18, 2021
df87eb0
block: get rid of plug list sorting
axboe Oct 18, 2021
e028f16
block: move blk_mq_tag_to_rq() inline
axboe Oct 16, 2021
6155631
block: align blkdev_dio inlined bio to a cacheline
axboe Oct 15, 2021
480d42d
blk-wbt: prevent NULL pointer dereference in wb_timer_fn
Oct 19, 2021
bc490f8
block: change plugging to use a singly linked list
axboe Oct 18, 2021
dc5fc36
block: attempt direct issue of plug list
axboe Oct 19, 2021
d92ca9d
blk-mq: don't handle non-flush requests in blk_insert_flush
Oct 19, 2021
a808a9d
block: inline fast path of driver tag allocation
axboe Oct 13, 2021
2fc428f
block, bfq: fix UAF problem in bfqg_stats_init()
z00448126 Oct 18, 2021
a277654
nvme: add APIs for stopping/starting admin queue
Oct 14, 2021
6ca1d90
nvme: apply nvme API to quiesce/unquiesce admin queue
Oct 14, 2021
ebc9b95
nvme: prepare for pairing quiescing and unquiescing
Oct 14, 2021
9e6a6b1
nvme: paring quiesce/unquiesce
Oct 14, 2021
1d35d51
nvme: loop: clear NVME_CTRL_ADMIN_Q_STOPPED after admin queue is real…
Oct 14, 2021
e70feb8
blk-mq: support concurrent queue quiesce/unquiesce
Oct 14, 2021
cf6d623
block: turn macro helpers into inline functions
isilence Oct 19, 2021
859897c
block: convert leftovers to bdev_get_queue
isilence Oct 19, 2021
478eb72
block: optimise req_bio_endio()
isilence Oct 19, 2021
1497a51
block: don't bloat enter_queue with percpu_ref
isilence Oct 19, 2021
c809084
block: inline a part of bio_release_pages()
isilence Oct 19, 2021
037057a
block: remove inaccurate requeue check
axboe Oct 20, 2021
a214b94
blk-mq: only flush requests from the plug in blk_mq_submit_bio
Oct 20, 2021
dbb6f76
blk-mq: move blk_mq_flush_plug_list to block/blk-mq.h
Oct 20, 2021
b600455
block: optimise blk_flush_plug_list
isilence Oct 20, 2021
008f75a
block: cleanup the flush plug helpers
Oct 20, 2021
0994c64
blk-mq: Fix blk_mq_tagset_busy_iter() for shared tags
Oct 18, 2021
057178c
fs: bdev: fix conflicting comment from lookup_bdev
JackieLiu1 Oct 21, 2021
6450fe1
block: optimise boundary blkdev_read_iter's checks
isilence Oct 20, 2021
179ae84
block: clean up blk_mq_submit_bio() merging
isilence Oct 20, 2021
6549a87
block: convert fops.c magic constants to SHIFT_SECTOR
isilence Oct 20, 2021
3b13c16
percpu_ref: percpu_ref_tryget_live() version holding RCU
isilence Oct 21, 2021
e94f685
block: kill extra rcu lock/unlock in queue enter
isilence Oct 21, 2021
f059a1d
block: Add invalidate_disk() helper to invalidate the gendisk
YongjiXie Sep 22, 2021
e515be8
loop: Use invalidate_disk() helper to invalidate gendisk
YongjiXie Sep 22, 2021
19f553d
loop: Remove the unnecessary bdev checks and unused bdev variable
YongjiXie Sep 22, 2021
435c2ac
nbd: Use invalidate_disk() helper on disconnect
YongjiXie Sep 22, 2021
eebcafa
blk-crypto-fallback: properly prefix function and struct names
ebiggers Oct 18, 2021
1e8d44b
blk-crypto: rename keyslot-manager files to blk-crypto-profile
ebiggers Oct 18, 2021
cb77cb5
blk-crypto: rename blk_keyslot_manager to blk_crypto_profile
ebiggers Oct 18, 2021
8e9f666
blk-crypto: update inline encryption documentation
ebiggers Oct 18, 2021
9a208ba
fs: remove __sync_filesystem
Oct 19, 2021
70164eb
block: remove __sync_blockdev
Oct 19, 2021
d39b0a2
xen-blkback: use sync_blockdev
Oct 19, 2021
1226dff
btrfs: use sync_blockdev
Oct 19, 2021
cb9568e
fat: use sync_blockdev_nowait
Oct 19, 2021
680e667
ntfs3: use sync_blockdev_nowait
Oct 19, 2021
1e03a36
block: simplify the block device syncing code
Oct 19, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
451 changes: 245 additions & 206 deletions Documentation/block/inline-encryption.rst

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,8 @@ export MODORDER := $(extmod_prefix)modules.order
export MODULES_NSDEPS := $(extmod_prefix)modules.nsdeps

ifeq ($(KBUILD_EXTMOD),)
core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/
core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/
core-$(CONFIG_BLOCK) += block/

vmlinux-dirs := $(patsubst %/,%,$(filter %/, \
$(core-y) $(core-m) $(drivers-y) $(drivers-m) \
Expand Down
3 changes: 1 addition & 2 deletions arch/m68k/emu/nfblock.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct nfhd_device {
struct gendisk *disk;
};

static blk_qc_t nfhd_submit_bio(struct bio *bio)
static void nfhd_submit_bio(struct bio *bio)
{
struct nfhd_device *dev = bio->bi_bdev->bd_disk->private_data;
struct bio_vec bvec;
Expand All @@ -76,7 +76,6 @@ static blk_qc_t nfhd_submit_bio(struct bio *bio)
sec += len;
}
bio_endio(bio);
return BLK_QC_T_NONE;
}

static int nfhd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
Expand Down
1 change: 0 additions & 1 deletion arch/mips/rb532/prom.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <linux/console.h>
#include <linux/memblock.h>
#include <linux/ioport.h>
#include <linux/blkdev.h>

#include <asm/bootinfo.h>
#include <asm/mach-rc32434/ddr.h>
Expand Down
1 change: 0 additions & 1 deletion arch/mips/sibyte/common/cfe.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <linux/kernel.h>
#include <linux/linkage.h>
#include <linux/mm.h>
#include <linux/blkdev.h>
#include <linux/memblock.h>
#include <linux/pm.h>
#include <linux/smp.h>
Expand Down
1 change: 0 additions & 1 deletion arch/mips/sibyte/swarm/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <linux/spinlock.h>
#include <linux/mm.h>
#include <linux/memblock.h>
#include <linux/blkdev.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/screen_info.h>
Expand Down
1 change: 0 additions & 1 deletion arch/openrisc/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <linux/memblock.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/blkdev.h> /* for initrd_* */
#include <linux/pagemap.h>

#include <asm/pgalloc.h>
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/platforms/cell/spufs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <linux/namei.h>
#include <linux/pagemap.h>
#include <linux/poll.h>
#include <linux/seq_file.h>
#include <linux/slab.h>

#include <asm/prom.h>
Expand Down
1 change: 1 addition & 0 deletions arch/um/drivers/ubd_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <linux/blk-mq.h>
#include <linux/ata.h>
#include <linux/hdreg.h>
#include <linux/major.h>
#include <linux/cdrom.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
Expand Down
3 changes: 1 addition & 2 deletions arch/xtensa/platforms/iss/simdisk.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ static void simdisk_transfer(struct simdisk *dev, unsigned long sector,
spin_unlock(&dev->lock);
}

static blk_qc_t simdisk_submit_bio(struct bio *bio)
static void simdisk_submit_bio(struct bio *bio)
{
struct simdisk *dev = bio->bi_bdev->bd_disk->private_data;
struct bio_vec bvec;
Expand All @@ -118,7 +118,6 @@ static blk_qc_t simdisk_submit_bio(struct bio *bio)
}

bio_endio(bio);
return BLK_QC_T_NONE;
}

static int simdisk_open(struct block_device *bdev, fmode_t mode)
Expand Down
28 changes: 10 additions & 18 deletions block/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ config BLK_DEV_ZONED

config BLK_DEV_THROTTLING
bool "Block layer bio throttling support"
depends on BLK_CGROUP=y
depends on BLK_CGROUP
select BLK_CGROUP_RWSTAT
help
Block layer bio throttling support. It can be used to limit
Expand Down Expand Up @@ -112,7 +112,7 @@ config BLK_WBT_MQ

config BLK_CGROUP_IOLATENCY
bool "Enable support for latency based cgroup IO protection"
depends on BLK_CGROUP=y
depends on BLK_CGROUP
help
Enabling this option enables the .latency interface for IO throttling.
The IO controller will attempt to maintain average IO latencies below
Expand All @@ -132,7 +132,7 @@ config BLK_CGROUP_FC_APPID

config BLK_CGROUP_IOCOST
bool "Enable support for cost model based cgroup IO controller"
depends on BLK_CGROUP=y
depends on BLK_CGROUP
select BLK_RQ_IO_DATA_LEN
select BLK_RQ_ALLOC_TIME
help
Expand Down Expand Up @@ -190,39 +190,31 @@ config BLK_INLINE_ENCRYPTION_FALLBACK
by falling back to the kernel crypto API when inline
encryption hardware is not present.

menu "Partition Types"

source "block/partitions/Kconfig"

endmenu

endif # BLOCK

config BLOCK_COMPAT
bool
depends on BLOCK && COMPAT
default y
def_bool COMPAT

config BLK_MQ_PCI
bool
depends on BLOCK && PCI
default y
def_bool PCI

config BLK_MQ_VIRTIO
bool
depends on BLOCK && VIRTIO
depends on VIRTIO
default y

config BLK_MQ_RDMA
bool
depends on BLOCK && INFINIBAND
depends on INFINIBAND
default y

config BLK_PM
def_bool BLOCK && PM
def_bool PM

# do not use in new code
config BLOCK_HOLDER_DEPRECATED
bool

source "block/Kconfig.iosched"

endif # BLOCK
4 changes: 0 additions & 4 deletions block/Kconfig.iosched
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# SPDX-License-Identifier: GPL-2.0
if BLOCK

menu "IO Schedulers"

config MQ_IOSCHED_DEADLINE
Expand Down Expand Up @@ -45,5 +43,3 @@ config BFQ_CGROUP_DEBUG
files in a cgroup which can be useful for debugging.

endmenu

endif
4 changes: 2 additions & 2 deletions block/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Makefile for the kernel block layer
#

obj-$(CONFIG_BLOCK) := bdev.o fops.o bio.o elevator.o blk-core.o blk-sysfs.o \
obj-y := bdev.o fops.o bio.o elevator.o blk-core.o blk-sysfs.o \
blk-flush.o blk-settings.o blk-ioc.o blk-map.o \
blk-exec.o blk-merge.o blk-timeout.o \
blk-lib.o blk-mq.o blk-mq-tag.o blk-stat.o \
Expand Down Expand Up @@ -36,6 +36,6 @@ obj-$(CONFIG_BLK_DEBUG_FS) += blk-mq-debugfs.o
obj-$(CONFIG_BLK_DEBUG_FS_ZONED)+= blk-mq-debugfs-zoned.o
obj-$(CONFIG_BLK_SED_OPAL) += sed-opal.o
obj-$(CONFIG_BLK_PM) += blk-pm.o
obj-$(CONFIG_BLK_INLINE_ENCRYPTION) += keyslot-manager.o blk-crypto.o
obj-$(CONFIG_BLK_INLINE_ENCRYPTION) += blk-crypto.o blk-crypto-profile.o
obj-$(CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK) += blk-crypto-fallback.o
obj-$(CONFIG_BLOCK_HOLDER_DEPRECATED) += holder.o
46 changes: 31 additions & 15 deletions block/bdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <linux/major.h>
#include <linux/device_cgroup.h>
#include <linux/blkdev.h>
#include <linux/blk-integrity.h>
#include <linux/backing-dev.h>
#include <linux/module.h>
#include <linux/blkpg.h>
Expand Down Expand Up @@ -184,22 +185,23 @@ int sb_min_blocksize(struct super_block *sb, int size)

EXPORT_SYMBOL(sb_min_blocksize);

int __sync_blockdev(struct block_device *bdev, int wait)
int sync_blockdev_nowait(struct block_device *bdev)
{
if (!bdev)
return 0;
if (!wait)
return filemap_flush(bdev->bd_inode->i_mapping);
return filemap_write_and_wait(bdev->bd_inode->i_mapping);
return filemap_flush(bdev->bd_inode->i_mapping);
}
EXPORT_SYMBOL_GPL(sync_blockdev_nowait);

/*
* Write out and wait upon all the dirty data associated with a block
* device via its mapping. Does not take the superblock lock.
*/
int sync_blockdev(struct block_device *bdev)
{
return __sync_blockdev(bdev, 1);
if (!bdev)
return 0;
return filemap_write_and_wait(bdev->bd_inode->i_mapping);
}
EXPORT_SYMBOL(sync_blockdev);

Expand Down Expand Up @@ -326,12 +328,12 @@ int bdev_read_page(struct block_device *bdev, sector_t sector,
if (!ops->rw_page || bdev_get_integrity(bdev))
return result;

result = blk_queue_enter(bdev->bd_disk->queue, 0);
result = blk_queue_enter(bdev_get_queue(bdev), 0);
if (result)
return result;
result = ops->rw_page(bdev, sector + get_start_sect(bdev), page,
REQ_OP_READ);
blk_queue_exit(bdev->bd_disk->queue);
blk_queue_exit(bdev_get_queue(bdev));
return result;
}

Expand Down Expand Up @@ -362,7 +364,7 @@ int bdev_write_page(struct block_device *bdev, sector_t sector,

if (!ops->rw_page || bdev_get_integrity(bdev))
return -EOPNOTSUPP;
result = blk_queue_enter(bdev->bd_disk->queue, 0);
result = blk_queue_enter(bdev_get_queue(bdev), 0);
if (result)
return result;

Expand All @@ -375,7 +377,7 @@ int bdev_write_page(struct block_device *bdev, sector_t sector,
clean_page_buffers(page);
unlock_page(page);
}
blk_queue_exit(bdev->bd_disk->queue);
blk_queue_exit(bdev_get_queue(bdev));
return result;
}

Expand Down Expand Up @@ -492,6 +494,7 @@ struct block_device *bdev_alloc(struct gendisk *disk, u8 partno)
spin_lock_init(&bdev->bd_size_lock);
bdev->bd_partno = partno;
bdev->bd_inode = inode;
bdev->bd_queue = disk->queue;
bdev->bd_stats = alloc_percpu(struct disk_stats);
if (!bdev->bd_stats) {
iput(inode);
Expand Down Expand Up @@ -962,9 +965,11 @@ EXPORT_SYMBOL(blkdev_put);
* @pathname: special file representing the block device
* @dev: return value of the block device's dev_t
*
* Get a reference to the blockdevice at @pathname in the current
* namespace if possible and return it. Return ERR_PTR(error)
* otherwise.
* Lookup the block device's dev_t at @pathname in the current
* namespace if possible and return it by @dev.
*
* RETURNS:
* 0 if succeeded, errno otherwise.
*/
int lookup_bdev(const char *pathname, dev_t *dev)
{
Expand Down Expand Up @@ -1016,7 +1021,7 @@ int __invalidate_device(struct block_device *bdev, bool kill_dirty)
}
EXPORT_SYMBOL(__invalidate_device);

void iterate_bdevs(void (*func)(struct block_device *, void *), void *arg)
void sync_bdevs(bool wait)
{
struct inode *inode, *old_inode = NULL;

Expand Down Expand Up @@ -1047,8 +1052,19 @@ void iterate_bdevs(void (*func)(struct block_device *, void *), void *arg)
bdev = I_BDEV(inode);

mutex_lock(&bdev->bd_disk->open_mutex);
if (bdev->bd_openers)
func(bdev, arg);
if (!bdev->bd_openers) {
; /* skip */
} else if (wait) {
/*
* We keep the error status of individual mapping so
* that applications can catch the writeback error using
* fsync(2). See filemap_fdatawait_keep_errors() for
* details.
*/
filemap_fdatawait_keep_errors(inode->i_mapping);
} else {
filemap_fdatawrite(inode->i_mapping);
}
mutex_unlock(&bdev->bd_disk->open_mutex);

spin_lock(&blockdev_superblock->s_inode_list_lock);
Expand Down
14 changes: 8 additions & 6 deletions block/bfq-cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
#include <linux/slab.h>
#include <linux/blkdev.h>
#include <linux/cgroup.h>
#include <linux/elevator.h>
#include <linux/ktime.h>
#include <linux/rbtree.h>
#include <linux/ioprio.h>
#include <linux/sbitmap.h>
#include <linux/delay.h>

#include "elevator.h"
#include "bfq-iosched.h"

#ifdef CONFIG_BFQ_CGROUP_DEBUG
Expand Down Expand Up @@ -463,7 +463,7 @@ static int bfqg_stats_init(struct bfqg_stats *stats, gfp_t gfp)
{
if (blkg_rwstat_init(&stats->bytes, gfp) ||
blkg_rwstat_init(&stats->ios, gfp))
return -ENOMEM;
goto error;

#ifdef CONFIG_BFQ_CGROUP_DEBUG
if (blkg_rwstat_init(&stats->merged, gfp) ||
Expand All @@ -476,13 +476,15 @@ static int bfqg_stats_init(struct bfqg_stats *stats, gfp_t gfp)
bfq_stat_init(&stats->dequeue, gfp) ||
bfq_stat_init(&stats->group_wait_time, gfp) ||
bfq_stat_init(&stats->idle_time, gfp) ||
bfq_stat_init(&stats->empty_time, gfp)) {
bfqg_stats_exit(stats);
return -ENOMEM;
}
bfq_stat_init(&stats->empty_time, gfp))
goto error;
#endif

return 0;

error:
bfqg_stats_exit(stats);
return -ENOMEM;
}

static struct bfq_group_data *cpd_to_bfqgd(struct blkcg_policy_data *cpd)
Expand Down
6 changes: 3 additions & 3 deletions block/bfq-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@
#include <linux/slab.h>
#include <linux/blkdev.h>
#include <linux/cgroup.h>
#include <linux/elevator.h>
#include <linux/ktime.h>
#include <linux/rbtree.h>
#include <linux/ioprio.h>
Expand All @@ -127,6 +126,7 @@

#include <trace/events/block.h>

#include "elevator.h"
#include "blk.h"
#include "blk-mq.h"
#include "blk-mq-tag.h"
Expand Down Expand Up @@ -6884,8 +6884,8 @@ static void bfq_depth_updated(struct blk_mq_hw_ctx *hctx)
struct blk_mq_tags *tags = hctx->sched_tags;
unsigned int min_shallow;

min_shallow = bfq_update_depths(bfqd, tags->bitmap_tags);
sbitmap_queue_min_shallow_depth(tags->bitmap_tags, min_shallow);
min_shallow = bfq_update_depths(bfqd, &tags->bitmap_tags);
sbitmap_queue_min_shallow_depth(&tags->bitmap_tags, min_shallow);
}

static int bfq_init_hctx(struct blk_mq_hw_ctx *hctx, unsigned int index)
Expand Down
Loading