aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/blk-lib.c18
-rw-r--r--include/linux/blkdev.h2
-rw-r--r--include/linux/fs.h8
3 files changed, 2 insertions, 26 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 }
171submit: 164submit:
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 */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 6b305eb4a343..cfcb3a610605 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -869,11 +869,9 @@ static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt,
869} 869}
870enum{ 870enum{
871 BLKDEV_WAIT, /* wait for completion */ 871 BLKDEV_WAIT, /* wait for completion */
872 BLKDEV_BARRIER, /* issue request with barrier */
873 BLKDEV_SECURE, /* secure discard */ 872 BLKDEV_SECURE, /* secure discard */
874}; 873};
875#define BLKDEV_IFL_WAIT (1 << BLKDEV_WAIT) 874#define BLKDEV_IFL_WAIT (1 << BLKDEV_WAIT)
876#define BLKDEV_IFL_BARRIER (1 << BLKDEV_BARRIER)
877#define BLKDEV_IFL_SECURE (1 << BLKDEV_SECURE) 875#define BLKDEV_IFL_SECURE (1 << BLKDEV_SECURE)
878extern int blkdev_issue_flush(struct block_device *, gfp_t, sector_t *, 876extern int blkdev_issue_flush(struct block_device *, gfp_t, sector_t *,
879 unsigned long); 877 unsigned long);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index d6add69bc170..6b0f6e9993a3 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -163,14 +163,6 @@ struct inodes_stat_t {
163#define WRITE_FLUSH_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \ 163#define WRITE_FLUSH_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \
164 REQ_FLUSH | REQ_FUA) 164 REQ_FLUSH | REQ_FUA)
165 165
166/*
167 * These aren't really reads or writes, they pass down information about
168 * parts of device that are now unused by the file system.
169 */
170#define DISCARD_NOBARRIER (WRITE | REQ_DISCARD)
171#define DISCARD_BARRIER (WRITE | REQ_DISCARD | REQ_HARDBARRIER)
172#define DISCARD_SECURE (DISCARD_NOBARRIER | REQ_SECURE)
173
174#define SEL_IN 1 166#define SEL_IN 1
175#define SEL_OUT 2 167#define SEL_OUT 2
176#define SEL_EX 4 168#define SEL_EX 4