Message ID | 20210401021927.343727-6-ming.lei@redhat.com (mailing list archive) |
---|---|
State | Superseded, archived |
Delegated to: | Mike Snitzer |
Headers | show |
Series | block: support bio based io polling | expand |
I don't like where this is going. I think the model of storing the polling cookie in the bio is useful, but: (1) I think having this in the iter is a mess. Can you measure if just marking bvec_iter __packed will generate much worse code at all anymore? If not we can just move this into the bio If it really generates much worse code I think you need to pick a different name as as that i really confusing vs the bio field of the same name that is used entirely differenly. Similarly the bio_get_private_data and bio_set_private_data helpers are entirely misnamed, as the names suggest they deal with the bi_private field in struct bio. I actually suspect not having these helpers would be much preferable (2) once we do have the cookie in the bio we need to take advantage of that properly. That is stop returning the cookie up the stack as we do right now but just rely on the bio, which will clean up tons of crap. -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel
On Mon, Apr 12, 2021 at 10:26:53AM +0100, Christoph Hellwig wrote: > I don't like where this is going. > > I think the model of storing the polling cookie in the bio is useful, > but: > > (1) I think having this in the iter is a mess. Can you measure if > just marking bvec_iter __packed will generate much worse code > at all anymore? If not we can just move this into the bio Just test with packed 'struct bvec_iter' by running io_uring/libaio over nvme/null_blk with different bs size, not see obvious difference compared with unpacked bvec_iter. So will switch to packed bvec_iter in next version. > If it really generates much worse code I think you need to pick > a different name as as that i really confusing vs the bio field > of the same name that is used entirely differenly. Similarly > the bio_get_private_data and bio_set_private_data helpers are > entirely misnamed, as the names suggest they deal with the > bi_private field in struct bio. I actually suspect not having > these helpers would be much preferable OK, how about naming it as .bi_poll_data? Thanks, Ming -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel
diff --git a/block/blk.h b/block/blk.h index 35901cee709d..c1d8456656df 100644 --- a/block/blk.h +++ b/block/blk.h @@ -395,4 +395,14 @@ static inline void blk_create_io_poll_context(struct request_queue *q) bio_poll_ctx_alloc(ioc); } +static inline unsigned int bio_get_private_data(struct bio *bio) +{ + return bio->bi_iter.bi_private_data; +} + +static inline void bio_set_private_data(struct bio *bio, unsigned int data) +{ + bio->bi_iter.bi_private_data = data; +} + #endif /* BLK_INTERNAL_H */ diff --git a/include/linux/bvec.h b/include/linux/bvec.h index ff832e698efb..547ad7526960 100644 --- a/include/linux/bvec.h +++ b/include/linux/bvec.h @@ -43,6 +43,14 @@ struct bvec_iter { unsigned int bi_bvec_done; /* number of bytes completed in current bvec */ + + /* + * There is a hole at the end of bvec_iter, add one new field to hold + * something which isn't related with 'bvec_iter', so that we can + * avoid extending bio. So far this new field is used for bio based + * polling, we will store returning value of submit_bio() here. + */ + unsigned int bi_private_data; }; struct bvec_iter_all {