Commit 288dab8a35a0 ("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.
Showing the changes to include/linux (2 of 9 files). Show all
Unified · Split
| @@ -71,7 +71,8 @@ static inline bool bio_has_data(struct bio *bio) · 70 unmodified lines | |||
| 71 | { | 71 | { |
| 72 | if (bio && | 72 | if (bio && |
| 73 | bio->bi_iter.bi_size && | 73 | bio->bi_iter.bi_size && |
| 74 | bio_op(bio) != REQ_OP_DISCARD) | 74 | bio_op(bio) != REQ_OP_DISCARD && |
| 75 | bio_op(bio) != REQ_OP_SECURE_ERASE) | ||
| 75 | return true; | 76 | return true; |
| 76 | 77 | ||
| 77 | return false; | 78 | return false; |
| @@ -79,7 +80,9 @@ static inline bool bio_has_data(struct bio *bio) · 1 unmodified line | |||
| 79 | 80 | ||
| 80 | static inline bool bio_no_advance_iter(struct bio *bio) | 81 | static inline bool bio_no_advance_iter(struct bio *bio) |
| 81 | { | 82 | { |
| 82 | return bio_op(bio) == REQ_OP_DISCARD || bio_op(bio) == REQ_OP_WRITE_SAME; | 83 | return bio_op(bio) == REQ_OP_DISCARD || |
| 84 | bio_op(bio) == REQ_OP_SECURE_ERASE || | ||
| 85 | bio_op(bio) == REQ_OP_WRITE_SAME; | ||
| 83 | } | 86 | } |
| 84 | 87 | ||
| 85 | static inline bool bio_is_rw(struct bio *bio) | 88 | static inline bool bio_is_rw(struct bio *bio) |
| @@ -199,6 +202,9 @@ static inline unsigned bio_segments(struct bio *bio) · 113 unmodified lines | |||
| 199 | if (bio_op(bio) == REQ_OP_DISCARD) | 202 | if (bio_op(bio) == REQ_OP_DISCARD) |
| 200 | return 1; | 203 | return 1; |
| 201 | 204 | ||
| 205 | if (bio_op(bio) == REQ_OP_SECURE_ERASE) | ||
| 206 | return 1; | ||
| 207 | |||
| 202 | if (bio_op(bio) == REQ_OP_WRITE_SAME) | 208 | if (bio_op(bio) == REQ_OP_WRITE_SAME) |
| 203 | return 1; | 209 | return 1; |
| 204 | 210 | ||
| @@ -882,7 +882,7 @@ static inline unsigned int blk_rq_cur_sectors(const struct request *rq) · 881 unmodified lines | |||
| 882 | static inline unsigned int blk_queue_get_max_sectors(struct request_queue *q, | 882 | static inline unsigned int blk_queue_get_max_sectors(struct request_queue *q, |
| 883 | int op) | 883 | int op) |
| 884 | { | 884 | { |
| 885 | if (unlikely(op == REQ_OP_DISCARD)) | 885 | if (unlikely(op == REQ_OP_DISCARD || op == REQ_OP_SECURE_ERASE)) |
| 886 | return min(q->limits.max_discard_sectors, UINT_MAX >> 9); | 886 | return min(q->limits.max_discard_sectors, UINT_MAX >> 9); |
| 887 | 887 | ||
| 888 | if (unlikely(op == REQ_OP_WRITE_SAME)) | 888 | if (unlikely(op == REQ_OP_WRITE_SAME)) |
| @@ -913,7 +913,9 @@ static inline unsigned int blk_rq_get_max_sectors(struct request *rq, · 24 unmodified lines | |||
| 913 | if (unlikely(rq->cmd_type != REQ_TYPE_FS)) | 913 | if (unlikely(rq->cmd_type != REQ_TYPE_FS)) |
| 914 | return q->limits.max_hw_sectors; | 914 | return q->limits.max_hw_sectors; |
| 915 | 915 | ||
| 916 | if (!q->limits.chunk_sectors || (req_op(rq) == REQ_OP_DISCARD)) | 916 | if (!q->limits.chunk_sectors || |
| 917 | req_op(rq) == REQ_OP_DISCARD || | ||
| 918 | req_op(rq) == REQ_OP_SECURE_ERASE) | ||
| 917 | return blk_queue_get_max_sectors(q, req_op(rq)); | 919 | return blk_queue_get_max_sectors(q, req_op(rq)); |
| 918 | 920 | ||
| 919 | return min(blk_max_size_offset(q, offset), | 921 | return min(blk_max_size_offset(q, offset), |