提交 16acea82 编写于 作者: J Joseph Qi 提交者: Caspar Zhang

block: introduce bvec_nth_page()

Cherry-pick from upstream commit 4d633062c1c0794a6b3836b7b55afba4599736e8.

Single-page bvec can often be seen in small BS workloads, so
introduce bvec_nth_page() for avoiding to call nth_page() unnecessarily,
which looks not cheap.
Signed-off-by: NMing Lei <ming.lei@redhat.com>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
Signed-off-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
Reviewed-by: NJeffle Xu <jefflexu@linux.alibaba.com>
Acked-by: NCaspar Zhang <caspar@linux.alibaba.com>
上级 bbf3f13e
......@@ -23,6 +23,7 @@
#include <linux/kernel.h>
#include <linux/bug.h>
#include <linux/errno.h>
#include <linux/mm.h>
/*
* was unsigned short, but we might as well be ready for > 64kB I/O pages
......@@ -46,6 +47,11 @@ struct bvec_iter {
current bvec */
};
static inline struct page *bvec_nth_page(struct page *page, int idx)
{
return idx == 0 ? page : nth_page(page, idx);
}
/*
* various member access, note that bio_data should of course not be used
* on highmem page vectors
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册