[PATCH 3/5] fs: add ki_bio_cache pointer to struct kiocb

Jens Axboe
2021-08-10T16:37:44Z

This allows an issuer (and owner of a kiocb) to pass in a bio allocation
cache that can be used to improve the efficiency of the churn of repeated
bio allocations and frees.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
include/linux/fs.h | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 640574294216..5f17d10ddc2d 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -291,6 +291,7 @@ struct page;
struct address_space;
struct writeback_control;
struct readahead_control;
+struct bio_alloc_cache;

/*
* Write life time hint values.
@@ -319,6 +320,8 @@ enum rw_hint {
/* iocb->ki_waitq is valid */
#define IOCB_WAITQ (1 << 19)
#define IOCB_NOIO (1 << 20)
+/* iocb->ki_bio_cache is valid */
+#define IOCB_ALLOC_CACHE (1 << 21)

struct kiocb {
struct file *ki_filp;
@@ -337,6 +340,14 @@ struct kiocb {
struct wait_page_queue *ki_waitq; /* for async buffered IO */
};

+ /*
+ * If set, owner of iov_iter can pass in a fast-cache for bio
+ * allocations.
+ */
+#ifdef CONFIG_BLOCK
+ struct bio_alloc_cache *ki_bio_cache;
+#endif
+
randomized_struct_fields_end
};

--
2.32.0