From: Matthew Wilcox <matthew@xxxxxx>...
SCSI and ATA both need to send data to the device. In order to do this,
the BIO must be allocated with room for a page to be added, and the bio
needs to be passed to the discard prep function. We also need to free
the page attached to the BIO before we free it.
init_request_from_bio() is not currently called from a context which
forbids sleeping, and to make sure it stays that way (so we don't have
to use GFP_ATOMIC), add a might_sleep() to it.
Signed-off-by: Matthew Wilcox <willy@xxxxxxxxxxxxxxx>
@@ -1118,7 +1120,7 @@ void init_request_from_bio(struct request *req, struct bio *bio)..
req->cmd_flags |= REQ_DISCARD;
if (bio_barrier(bio))
req->cmd_flags |= REQ_SOFTBARRIER;
- req->q->prepare_discard_fn(req->q, req);
+ req->q->prepare_discard_fn(req->q, req, bio);
} else if (unlikely(bio_barrier(bio)))
req->cmd_flags |= (REQ_HARDBARRIER | REQ_NOMERGE);