summary refs log tree commit diff
path: root/block/blk.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2021-08-30 19:30:30 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2021-08-30 19:30:30 -0700
commit3b629f8d6dc04d3af94429c18fe17239d6fbe2c3 (patch)
treef67dd6ef5c662927ee4c6533450c7b2c5724f69e /block/blk.h
parentc547d89a9a445f6bb757b93247de43d312e722da (diff)
parent3d5b3fbedad65088ec079a4c4d1a2f47e11ae1e7 (diff)
downloadlinux-3b629f8d6dc04d3af94429c18fe17239d6fbe2c3.tar.gz
Merge tag 'io_uring-bio-cache.5-2021-08-30' of git://git.kernel.dk/linux-block
Pull support for struct bio recycling from Jens Axboe:
 "This adds bio recycling support for polled IO, allowing quick reuse of
  a bio for high IOPS scenarios via a percpu bio_set list.

  It's good for almost a 10% improvement in performance, bumping our
  per-core IO limit from ~3.2M IOPS to ~3.5M IOPS"

* tag 'io_uring-bio-cache.5-2021-08-30' of git://git.kernel.dk/linux-block:
  bio: improve kerneldoc documentation for bio_alloc_kiocb()
  block: provide bio_clear_hipri() helper
  block: use the percpu bio cache in __blkdev_direct_IO
  io_uring: enable use of bio alloc cache
  block: clear BIO_PERCPU_CACHE flag if polling isn't supported
  bio: add allocation cache abstraction
  fs: add kiocb alloc cache flag
  bio: optimize initialization of a bio
Diffstat (limited to 'block/blk.h')
-rw-r--r--block/blk.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/block/blk.h b/block/blk.h
index 346d184c82b0..8c96b0c90c48 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -366,4 +366,11 @@ extern struct device_attribute dev_attr_events;
 extern struct device_attribute dev_attr_events_async;
 extern struct device_attribute dev_attr_events_poll_msecs;
 
+static inline void bio_clear_hipri(struct bio *bio)
+{
+	/* can't support alloc cache if we turn off polling */
+	bio_clear_flag(bio, BIO_PERCPU_CACHE);
+	bio->bi_opf &= ~REQ_HIPRI;
+}
+
 #endif /* BLK_INTERNAL_H */