@@ -40,7 +40,7 @@
*/
int blk_rq_count_integrity_sg(struct request_queue *q, struct bio *bio)
{
- struct bio_vec iv, ivprv = { NULL };
+ struct bio_vec iv, ivprv = {};
unsigned int segments = 0;
unsigned int seg_size = 0;
struct bvec_iter iter;
@@ -86,7 +86,7 @@ EXPORT_SYMBOL(blk_rq_count_integrity_sg);
int blk_rq_map_integrity_sg(struct request_queue *q, struct bio *bio,
struct scatterlist *sglist)
{
- struct bio_vec iv, ivprv = { NULL };
+ struct bio_vec iv, ivprv = {};
struct scatterlist *sg = NULL;
unsigned int segments = 0;
struct bvec_iter iter;
@@ -245,7 +245,7 @@ static unsigned int __blk_recalc_rq_segments(struct request_queue *q,
struct bio *bio,
bool no_sg_merge)
{
- struct bio_vec bv, bvprv = { NULL };
+ struct bio_vec bv, bvprv = {};
int cluster, prev = 0;
unsigned int seg_size, nr_phys_segs;
struct bio *fbio, *bbio;
@@ -347,7 +347,7 @@ EXPORT_SYMBOL(blk_recount_segments);
static int blk_phys_contig_segment(struct request_queue *q, struct bio *bio,
struct bio *nxt)
{
- struct bio_vec end_bv = { NULL }, nxt_bv;
+ struct bio_vec end_bv = {}, nxt_bv;
if (!blk_queue_cluster(q))
return 0;
@@ -430,7 +430,7 @@ static int __blk_bios_map_sg(struct request_queue *q, struct bio *bio,
struct scatterlist *sglist,
struct scatterlist **sg)
{
- struct bio_vec bvec, bvprv = { NULL };
+ struct bio_vec bvec, bvprv = {};
struct bvec_iter iter;
int cluster = blk_queue_cluster(q), nsegs = 0;
@@ -22,12 +22,13 @@
#include <linux/kernel.h>
#include <linux/bug.h>
+#include <linux/pfn_t.h>
/*
* was unsigned short, but we might as well be ready for > 64kB I/O pages
*/
struct bio_vec {
- struct page *bv_page;
+ pfn_t bv_pfn;
unsigned int bv_len;
unsigned int bv_offset;
};
@@ -45,12 +46,13 @@ struct bvec_iter {
static inline struct page *bvec_page(const struct bio_vec *bvec)
{
- return bvec->bv_page;
+ BUG_ON(!pfn_t_is_always_mappable(bvec->bv_pfn));
+ return pfn_t_to_page(bvec->bv_pfn);
}
static inline void bvec_set_page(struct bio_vec *bvec, struct page *page)
{
- bvec->bv_page = page;
+ bvec->bv_pfn = page_to_pfn_t(page);
}
/*
@@ -59,6 +61,9 @@ static inline void bvec_set_page(struct bio_vec *bvec, struct page *page)
*/
#define __bvec_iter_bvec(bvec, iter) (&(bvec)[(iter).bi_idx])
+#define bvec_iter_pfn_t(bvec, iter) \
+ (__bvec_iter_bvec((bvec), (iter))->bv_pfn)
+
#define bvec_iter_page(bvec, iter) \
(bvec_page(__bvec_iter_bvec((bvec), (iter))))
@@ -71,7 +76,7 @@ static inline void bvec_set_page(struct bio_vec *bvec, struct page *page)
#define bvec_iter_bvec(bvec, iter) \
((struct bio_vec) { \
- .bv_page = bvec_iter_page((bvec), (iter)), \
+ .bv_pfn = bvec_iter_pfn_t((bvec), (iter)), \
.bv_len = bvec_iter_len((bvec), (iter)), \
.bv_offset = bvec_iter_offset((bvec), (iter)), \
})