All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: Document how blk_update_request() handles RQF_SPECIAL_PAYLOAD requests
@ 2018-06-27 20:09 Bart Van Assche
  2018-06-29  8:32 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Bart Van Assche @ 2018-06-27 20:09 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, Christoph Hellwig, Bart Van Assche, Ming Lei

The payload of struct request is stored in the request.bio chain if
the RQF_SPECIAL_PAYLOAD flag is not set and in request.special_vec if
RQF_SPECIAL_PAYLOAD has been set. However, blk_update_request()
iterates over req->bio whether or not RQF_SPECIAL_PAYLOAD has been
set. Additionally, the RQF_SPECIAL_PAYLOAD flag is ignored by
blk_rq_bytes() which means that the value returned by that function
is incorrect if the RQF_SPECIAL_PAYLOAD flag has been set. It is not
clear to me whether this is an oversight or whether this happened on
purpose. Anyway, document that it is known that both functions ignore
RQF_SPECIAL_PAYLOAD. See also commit f9d03f96b988 ("block: improve
handling of the magic discard payload").

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Ming Lei <ming.lei@redhat.com>
---
 block/blk-core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/block/blk-core.c b/block/blk-core.c
index 5ac03e3ab786..f1e07ed1513c 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -3098,6 +3098,10 @@ EXPORT_SYMBOL_GPL(blk_steal_bios);
  *     Passing the result of blk_rq_bytes() as @nr_bytes guarantees
  *     %false return from this function.
  *
+ * Note:
+ *	The RQF_SPECIAL_PAYLOAD flag is ignored on purpose in both
+ *	blk_rq_bytes() and in blk_update_request().
+ *
  * Return:
  *     %false - this request doesn't have any more data
  *     %true  - this request has more data
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] block: Document how blk_update_request() handles RQF_SPECIAL_PAYLOAD requests
  2018-06-27 20:09 [PATCH] block: Document how blk_update_request() handles RQF_SPECIAL_PAYLOAD requests Bart Van Assche
@ 2018-06-29  8:32 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2018-06-29  8:32 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: Jens Axboe, linux-block, Christoph Hellwig, Ming Lei

On Wed, Jun 27, 2018 at 01:09:05PM -0700, Bart Van Assche wrote:
> The payload of struct request is stored in the request.bio chain if
> the RQF_SPECIAL_PAYLOAD flag is not set and in request.special_vec if
> RQF_SPECIAL_PAYLOAD has been set. However, blk_update_request()
> iterates over req->bio whether or not RQF_SPECIAL_PAYLOAD has been
> set. Additionally, the RQF_SPECIAL_PAYLOAD flag is ignored by
> blk_rq_bytes() which means that the value returned by that function
> is incorrect if the RQF_SPECIAL_PAYLOAD flag has been set. It is not
> clear to me whether this is an oversight or whether this happened on
> purpose. Anyway, document that it is known that both functions ignore
> RQF_SPECIAL_PAYLOAD. See also commit f9d03f96b988 ("block: improve
> handling of the magic discard payload").
> 
> Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Ming Lei <ming.lei@redhat.com>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-29  8:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-27 20:09 [PATCH] block: Document how blk_update_request() handles RQF_SPECIAL_PAYLOAD requests Bart Van Assche
2018-06-29  8:32 ` Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.