Re: [PATCH 2/3] scsi: add sd_unprep_fn to free discard page

From: Christoph Hellwig
Date: Fri Jul 02 2010 - 06:48:29 EST


> sd_unprep() uses rq->buffer to free discard page allocated in
> sd_prepare_discard().

Eeek. Accessing it using the bio in both haves seems a lot cleaner than
abusing this. Especially as we don't really need a mapped page anyway
at least for WRITE SAME implementation.

> - return scsi_setup_blk_pc_cmnd(sdp, rq);
> + ret = scsi_setup_blk_pc_cmnd(sdp, rq);
> + rq->buffer = page_address(page);
> + return ret;

In addition I don't think this is quite correct. You still need to undo
the payload addition manually if scsi_setup_blk_pc_cmnd fails, as we
haven't marked the request as REQ_DONTPREP at that point - it's only
done by scsi_prep_return for the BLKPREP_OK case.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/