TencentOS-kernel/block
brookxu 82ac1bb32d block: bio_iov_iter_get_pages: pin more pages for multi-segment IOs
commit <0aa69fd32a5f766e997ca8ab4723c5a1146efa8b>
commit <17d51b10d7773e4618bcac64648f30f12d4078fb>

bio_iov_iter_get_pages() currently only adds pages for the next non-zero
segment from the iov_iter to the bio. That's suboptimal for callers,
which typically try to pin as many pages as fit into the bio. This patch
converts the current bio_iov_iter_get_pages() into a static helper, and
introduces a new helper that allocates as many pages as

 1) fit into the bio,
 2) are present in the iov_iter,
 3) and can be pinned by MM.

Error is returned only if zero pages could be pinned. Because of 3), a
zero return value doesn't necessarily mean all pages have been pinned.
Callers that have to pin every page in the iov_iter must still call this
function in a loop (this is currently the case).

This change matters most for __blkdev_direct_IO_simple(), which calls
bio_iov_iter_get_pages() only once. If it obtains less pages than
requested, it returns a "short write" or "short read", and
__generic_file_write_iter() falls back to buffered writes, which may
lead to data corruption.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
2020-05-29 10:40:50 +08:00
..
partitions Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
Kconfig Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
Kconfig.iosched Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
Makefile Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
badblocks.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
bfq-cgroup.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
bfq-iosched.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
bfq-iosched.h Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
bfq-wf2q.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
bio-integrity.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
bio.c block: bio_iov_iter_get_pages: pin more pages for multi-segment IOs 2020-05-29 10:40:50 +08:00
blk-cgroup.c blkcg: add per blkcg diskstats 2020-01-02 12:19:49 +08:00
blk-core.c cgroup: blkio: adjust block io bps limit by weight 2020-03-11 11:11:46 +08:00
blk-exec.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
blk-flush.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
blk-integrity.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
blk-ioc.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
blk-lib.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
blk-map.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
blk-merge.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
blk-mq-cpumap.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
blk-mq-debugfs.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
blk-mq-debugfs.h Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
blk-mq-pci.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
blk-mq-rdma.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
blk-mq-sched.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
blk-mq-sched.h Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
blk-mq-sysfs.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
blk-mq-tag.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
blk-mq-tag.h Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
blk-mq-virtio.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
blk-mq.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
blk-mq.h Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
blk-settings.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
blk-softirq.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
blk-stat.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
blk-stat.h Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
blk-sysfs.c cgroup: blkio: adjust block io bps limit by weight 2020-03-11 11:11:46 +08:00
blk-tag.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
blk-throttle.c cgroup: blkio: adjust block io bps limit by weight 2020-03-11 11:11:46 +08:00
blk-timeout.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
blk-wbt.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
blk-wbt.h Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
blk-zoned.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
blk.h Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
bounce.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
bsg-lib.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
bsg.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
cfq-iosched.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
cmdline-parser.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
compat_ioctl.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
deadline-iosched.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
elevator.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
genhd.c blkcg: add per blkcg diskstats 2020-01-02 12:19:49 +08:00
ioctl.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
ioprio.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
kyber-iosched.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
mq-deadline.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
noop-iosched.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
opal_proto.h Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
partition-generic.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
scsi_ioctl.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
sed-opal.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00
t10-pi.c Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces 2020-01-02 10:51:04 +08:00