block: Fix secure erase
Commit288dab8a35("block: add a separate operation type for secure erase") split REQ_OP_SECURE_ERASE from REQ_OP_DISCARD without considering all the places REQ_OP_DISCARD was being used to mean either. Fix those. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Fixes:288dab8a35("block: add a separate operation type for secure erase") Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
parent
f6b6a28e2d
commit
7afafc8a44
9 changed files with 50 additions and 32 deletions
|
|
@ -71,7 +71,8 @@ static inline bool bio_has_data(struct bio *bio)
|
|||
{
|
||||
if (bio &&
|
||||
bio->bi_iter.bi_size &&
|
||||
bio_op(bio) != REQ_OP_DISCARD)
|
||||
bio_op(bio) != REQ_OP_DISCARD &&
|
||||
bio_op(bio) != REQ_OP_SECURE_ERASE)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
@ -79,7 +80,9 @@ static inline bool bio_has_data(struct bio *bio)
|
|||
|
||||
static inline bool bio_no_advance_iter(struct bio *bio)
|
||||
{
|
||||
return bio_op(bio) == REQ_OP_DISCARD || bio_op(bio) == REQ_OP_WRITE_SAME;
|
||||
return bio_op(bio) == REQ_OP_DISCARD ||
|
||||
bio_op(bio) == REQ_OP_SECURE_ERASE ||
|
||||
bio_op(bio) == REQ_OP_WRITE_SAME;
|
||||
}
|
||||
|
||||
static inline bool bio_is_rw(struct bio *bio)
|
||||
|
|
@ -199,6 +202,9 @@ static inline unsigned bio_segments(struct bio *bio)
|
|||
if (bio_op(bio) == REQ_OP_DISCARD)
|
||||
return 1;
|
||||
|
||||
if (bio_op(bio) == REQ_OP_SECURE_ERASE)
|
||||
return 1;
|
||||
|
||||
if (bio_op(bio) == REQ_OP_WRITE_SAME)
|
||||
return 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -882,7 +882,7 @@ static inline unsigned int blk_rq_cur_sectors(const struct request *rq)
|
|||
static inline unsigned int blk_queue_get_max_sectors(struct request_queue *q,
|
||||
int op)
|
||||
{
|
||||
if (unlikely(op == REQ_OP_DISCARD))
|
||||
if (unlikely(op == REQ_OP_DISCARD || op == REQ_OP_SECURE_ERASE))
|
||||
return min(q->limits.max_discard_sectors, UINT_MAX >> 9);
|
||||
|
||||
if (unlikely(op == REQ_OP_WRITE_SAME))
|
||||
|
|
@ -913,7 +913,9 @@ static inline unsigned int blk_rq_get_max_sectors(struct request *rq,
|
|||
if (unlikely(rq->cmd_type != REQ_TYPE_FS))
|
||||
return q->limits.max_hw_sectors;
|
||||
|
||||
if (!q->limits.chunk_sectors || (req_op(rq) == REQ_OP_DISCARD))
|
||||
if (!q->limits.chunk_sectors ||
|
||||
req_op(rq) == REQ_OP_DISCARD ||
|
||||
req_op(rq) == REQ_OP_SECURE_ERASE)
|
||||
return blk_queue_get_max_sectors(q, req_op(rq));
|
||||
|
||||
return min(blk_max_size_offset(q, offset),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue