diff options
author | Christoph Hellwig <hch@lst.de> | 2016-06-09 10:00:36 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2016-06-09 11:52:25 -0400 |
commit | 288dab8a35a0bde426a09870943c8d3ee3a50dab (patch) | |
tree | 483fd3eb60ff8f44d149fb28d3b79e5212645104 /block/blk-core.c | |
parent | 56332f02a562390a3198525ad78cb4f558805c0f (diff) |
block: add a separate operation type for secure erase
Instead of overloading the discard support with the REQ_SECURE flag.
Use the opportunity to rename the queue flag as well, and remove the
dead checks for this flag in the RAID 1 and RAID 10 drivers that don't
claim support for secure erase.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/blk-core.c')
-rw-r--r-- | block/blk-core.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index 32a283eb7274..db31a2981223 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -1977,16 +1977,21 @@ generic_make_request_checks(struct bio *bio) | |||
1977 | } | 1977 | } |
1978 | } | 1978 | } |
1979 | 1979 | ||
1980 | if ((bio_op(bio) == REQ_OP_DISCARD) && | 1980 | switch (bio_op(bio)) { |
1981 | (!blk_queue_discard(q) || | 1981 | case REQ_OP_DISCARD: |
1982 | ((bio->bi_rw & REQ_SECURE) && !blk_queue_secdiscard(q)))) { | 1982 | if (!blk_queue_discard(q)) |
1983 | err = -EOPNOTSUPP; | 1983 | goto not_supported; |
1984 | goto end_io; | 1984 | break; |
1985 | } | 1985 | case REQ_OP_SECURE_ERASE: |
1986 | 1986 | if (!blk_queue_secure_erase(q)) | |
1987 | if (bio_op(bio) == REQ_OP_WRITE_SAME && !bdev_write_same(bio->bi_bdev)) { | 1987 | goto not_supported; |
1988 | err = -EOPNOTSUPP; | 1988 | break; |
1989 | goto end_io; | 1989 | case REQ_OP_WRITE_SAME: |
1990 | if (!bdev_write_same(bio->bi_bdev)) | ||
1991 | goto not_supported; | ||
1992 | break; | ||
1993 | default: | ||
1994 | break; | ||
1990 | } | 1995 | } |
1991 | 1996 | ||
1992 | /* | 1997 | /* |
@@ -2003,6 +2008,8 @@ generic_make_request_checks(struct bio *bio) | |||
2003 | trace_block_bio_queue(q, bio); | 2008 | trace_block_bio_queue(q, bio); |
2004 | return true; | 2009 | return true; |
2005 | 2010 | ||
2011 | not_supported: | ||
2012 | err = -EOPNOTSUPP; | ||
2006 | end_io: | 2013 | end_io: |
2007 | bio->bi_error = err; | 2014 | bio->bi_error = err; |
2008 | bio_endio(bio); | 2015 | bio_endio(bio); |