diff options
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-lib.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/block/blk-lib.c b/block/blk-lib.c index c392029a104e..fe2e6ed0f510 100644 --- a/block/blk-lib.c +++ b/block/blk-lib.c | |||
@@ -39,8 +39,7 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector, | |||
39 | { | 39 | { |
40 | DECLARE_COMPLETION_ONSTACK(wait); | 40 | DECLARE_COMPLETION_ONSTACK(wait); |
41 | struct request_queue *q = bdev_get_queue(bdev); | 41 | struct request_queue *q = bdev_get_queue(bdev); |
42 | int type = flags & BLKDEV_IFL_BARRIER ? | 42 | int type = REQ_WRITE | REQ_DISCARD; |
43 | DISCARD_BARRIER : DISCARD_NOBARRIER; | ||
44 | unsigned int max_discard_sectors; | 43 | unsigned int max_discard_sectors; |
45 | struct bio *bio; | 44 | struct bio *bio; |
46 | int ret = 0; | 45 | int ret = 0; |
@@ -65,7 +64,7 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector, | |||
65 | if (flags & BLKDEV_IFL_SECURE) { | 64 | if (flags & BLKDEV_IFL_SECURE) { |
66 | if (!blk_queue_secdiscard(q)) | 65 | if (!blk_queue_secdiscard(q)) |
67 | return -EOPNOTSUPP; | 66 | return -EOPNOTSUPP; |
68 | type |= DISCARD_SECURE; | 67 | type |= REQ_SECURE; |
69 | } | 68 | } |
70 | 69 | ||
71 | while (nr_sects && !ret) { | 70 | while (nr_sects && !ret) { |
@@ -162,12 +161,6 @@ int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector, | |||
162 | bb.wait = &wait; | 161 | bb.wait = &wait; |
163 | bb.end_io = NULL; | 162 | bb.end_io = NULL; |
164 | 163 | ||
165 | if (flags & BLKDEV_IFL_BARRIER) { | ||
166 | /* issue async barrier before the data */ | ||
167 | ret = blkdev_issue_flush(bdev, gfp_mask, NULL, 0); | ||
168 | if (ret) | ||
169 | return ret; | ||
170 | } | ||
171 | submit: | 164 | submit: |
172 | ret = 0; | 165 | ret = 0; |
173 | while (nr_sects != 0) { | 166 | while (nr_sects != 0) { |
@@ -199,13 +192,6 @@ submit: | |||
199 | issued++; | 192 | issued++; |
200 | submit_bio(WRITE, bio); | 193 | submit_bio(WRITE, bio); |
201 | } | 194 | } |
202 | /* | ||
203 | * When all data bios are in flight. Send final barrier if requeted. | ||
204 | */ | ||
205 | if (nr_sects == 0 && flags & BLKDEV_IFL_BARRIER) | ||
206 | ret = blkdev_issue_flush(bdev, gfp_mask, NULL, | ||
207 | flags & BLKDEV_IFL_WAIT); | ||
208 | |||
209 | 195 | ||
210 | if (flags & BLKDEV_IFL_WAIT) | 196 | if (flags & BLKDEV_IFL_WAIT) |
211 | /* Wait for bios in-flight */ | 197 | /* Wait for bios in-flight */ |