summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorJérôme Glisse <jglisse@redhat.com>2019-04-10 16:09:07 -0400
committerJérôme Glisse <jglisse@redhat.com>2019-04-15 14:55:06 -0400
commitc211430fb96314974868b48b91f417d83a55e0e4 (patch)
tree3a80c9238bd2a06bf44b4a624f5f68b8c153b4e9 /include/linux
parent6b134c77f9e9b7fee16b1e9ef3e5e14f59f40c86 (diff)
block: add gup flag to bio_add_page()/bio_add_pc_page()/__bio_add_page()
We want to keep track of how we got a reference on page added to bio_vec ie wether the page was reference through GUP (get_user_page*) or not. So add a flag to bio_add_page()/bio_add_pc_page()/__bio_add_page() to that effect. This is done using a coccinelle patch and running it with: spatch --sp-file spfile --in-place --include-headers --dir . with spfile: %<--------------------------------------------------------------------- @@ identifier I1, I2, I3, I4; @@ void __bio_add_page(struct bio *I1, struct page *I2, unsigned I3, unsigned I4 +, bool is_gup ) {...} @@ identifier I1, I2, I3, I4; @@ void __bio_add_page(struct bio *I1, struct page *I2, unsigned I3, unsigned I4 +, bool is_gup ); @@ identifier I1, I2, I3, I4; @@ int bio_add_page(struct bio *I1, struct page *I2, unsigned I3, unsigned I4 +, bool is_gup ) {...} @@ @@ int bio_add_page(struct bio *, struct page *, unsigned, unsigned +, bool is_gup ); @@ identifier I1, I2, I3, I4, I5; @@ int bio_add_pc_page(struct request_queue *I1, struct bio *I2, struct page *I3, unsigned I4, unsigned I5 +, bool is_gup ) {...} @@ @@ int bio_add_pc_page(struct request_queue *, struct bio *, struct page *, unsigned, unsigned +, bool is_gup ); @@ expression E1, E2, E3, E4; @@ __bio_add_page(E1, E2, E3, E4 +, false ) @@ expression E1, E2, E3, E4; @@ bio_add_page(E1, E2, E3, E4 +, false ) @@ expression E1, E2, E3, E4, E5; @@ bio_add_pc_page(E1, E2, E3, E4, E5 +, false ) --------------------------------------------------------------------->% Signed-off-by: Jérôme Glisse <jglisse@redhat.com> Cc: linux-fsdevel@vger.kernel.org Cc: linux-block@vger.kernel.org Cc: linux-mm@kvack.org Cc: John Hubbard <jhubbard@nvidia.com> Cc: Jan Kara <jack@suse.cz> Cc: Dan Williams <dan.j.williams@intel.com> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Johannes Thumshirn <jthumshirn@suse.de> Cc: Christoph Hellwig <hch@lst.de> Cc: Jens Axboe <axboe@kernel.dk> Cc: Ming Lei <ming.lei@redhat.com> Cc: Dave Chinner <david@fromorbit.com> Cc: Jason Gunthorpe <jgg@ziepe.ca> Cc: Matthew Wilcox <willy@infradead.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/bio.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 6ac4f6b192e6..05fcc5227d0e 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -429,13 +429,14 @@ extern void bio_uninit(struct bio *);
extern void bio_reset(struct bio *);
void bio_chain(struct bio *, struct bio *);
-extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int);
+extern int bio_add_page(struct bio *, struct page *, unsigned int,
+ unsigned int, bool is_gup);
extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *,
- unsigned int, unsigned int);
+ unsigned int, unsigned int, bool is_gup);
bool __bio_try_merge_page(struct bio *bio, struct page *page,
unsigned int len, unsigned int off, bool same_page);
void __bio_add_page(struct bio *bio, struct page *page,
- unsigned int len, unsigned int off);
+ unsigned int len, unsigned int off, bool is_gup);
int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter);
struct rq_map_data;
extern struct bio *bio_map_user_iov(struct request_queue *,