diff options
author | Christoph Hellwig <hch@lst.de> | 2010-09-16 14:51:46 -0400 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2010-09-16 14:52:58 -0400 |
commit | dd3932eddf428571762596e17b65f5dc92ca361b (patch) | |
tree | 57cec5ae2f862037f78b7e993323d77955bb6463 /block/blk-lib.c | |
parent | 8786fb70ccb36c7cff64680bb80c46d3a09d44db (diff) |
block: remove BLKDEV_IFL_WAIT
All the blkdev_issue_* helpers can only sanely be used for synchronous
caller. To issue cache flushes or barriers asynchronously the caller needs
to set up a bio by itself with a completion callback to move the asynchronous
state machine ahead. So drop the BLKDEV_IFL_WAIT flag that is always
specified when calling blkdev_issue_* and also remove the now unused flags
argument to blkdev_issue_flush and blkdev_issue_zeroout. For
blkdev_issue_discard we need to keep it for the secure discard flag, which
gains a more descriptive name and loses the bitops vs flag confusion.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'block/blk-lib.c')
-rw-r--r-- | block/blk-lib.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/block/blk-lib.c b/block/blk-lib.c index fe2e6ed0f510..1a320d2406b0 100644 --- a/block/blk-lib.c +++ b/block/blk-lib.c | |||
@@ -61,7 +61,7 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector, | |||
61 | max_discard_sectors &= ~(disc_sects - 1); | 61 | max_discard_sectors &= ~(disc_sects - 1); |
62 | } | 62 | } |
63 | 63 | ||
64 | if (flags & BLKDEV_IFL_SECURE) { | 64 | if (flags & BLKDEV_DISCARD_SECURE) { |
65 | if (!blk_queue_secdiscard(q)) | 65 | if (!blk_queue_secdiscard(q)) |
66 | return -EOPNOTSUPP; | 66 | return -EOPNOTSUPP; |
67 | type |= REQ_SECURE; | 67 | type |= REQ_SECURE; |
@@ -77,8 +77,7 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector, | |||
77 | bio->bi_sector = sector; | 77 | bio->bi_sector = sector; |
78 | bio->bi_end_io = blkdev_discard_end_io; | 78 | bio->bi_end_io = blkdev_discard_end_io; |
79 | bio->bi_bdev = bdev; | 79 | bio->bi_bdev = bdev; |
80 | if (flags & BLKDEV_IFL_WAIT) | 80 | bio->bi_private = &wait; |
81 | bio->bi_private = &wait; | ||
82 | 81 | ||
83 | if (nr_sects > max_discard_sectors) { | 82 | if (nr_sects > max_discard_sectors) { |
84 | bio->bi_size = max_discard_sectors << 9; | 83 | bio->bi_size = max_discard_sectors << 9; |
@@ -92,8 +91,7 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector, | |||
92 | bio_get(bio); | 91 | bio_get(bio); |
93 | submit_bio(type, bio); | 92 | submit_bio(type, bio); |
94 | 93 | ||
95 | if (flags & BLKDEV_IFL_WAIT) | 94 | wait_for_completion(&wait); |
96 | wait_for_completion(&wait); | ||
97 | 95 | ||
98 | if (bio_flagged(bio, BIO_EOPNOTSUPP)) | 96 | if (bio_flagged(bio, BIO_EOPNOTSUPP)) |
99 | ret = -EOPNOTSUPP; | 97 | ret = -EOPNOTSUPP; |
@@ -139,7 +137,6 @@ static void bio_batch_end_io(struct bio *bio, int err) | |||
139 | * @sector: start sector | 137 | * @sector: start sector |
140 | * @nr_sects: number of sectors to write | 138 | * @nr_sects: number of sectors to write |
141 | * @gfp_mask: memory allocation flags (for bio_alloc) | 139 | * @gfp_mask: memory allocation flags (for bio_alloc) |
142 | * @flags: BLKDEV_IFL_* flags to control behaviour | ||
143 | * | 140 | * |
144 | * Description: | 141 | * Description: |
145 | * Generate and issue number of bios with zerofiled pages. | 142 | * Generate and issue number of bios with zerofiled pages. |
@@ -148,7 +145,7 @@ static void bio_batch_end_io(struct bio *bio, int err) | |||
148 | */ | 145 | */ |
149 | 146 | ||
150 | int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector, | 147 | int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector, |
151 | sector_t nr_sects, gfp_t gfp_mask, unsigned long flags) | 148 | sector_t nr_sects, gfp_t gfp_mask) |
152 | { | 149 | { |
153 | int ret; | 150 | int ret; |
154 | struct bio *bio; | 151 | struct bio *bio; |
@@ -174,8 +171,7 @@ submit: | |||
174 | bio->bi_sector = sector; | 171 | bio->bi_sector = sector; |
175 | bio->bi_bdev = bdev; | 172 | bio->bi_bdev = bdev; |
176 | bio->bi_end_io = bio_batch_end_io; | 173 | bio->bi_end_io = bio_batch_end_io; |
177 | if (flags & BLKDEV_IFL_WAIT) | 174 | bio->bi_private = &bb; |
178 | bio->bi_private = &bb; | ||
179 | 175 | ||
180 | while (nr_sects != 0) { | 176 | while (nr_sects != 0) { |
181 | sz = min((sector_t) PAGE_SIZE >> 9 , nr_sects); | 177 | sz = min((sector_t) PAGE_SIZE >> 9 , nr_sects); |
@@ -193,10 +189,9 @@ submit: | |||
193 | submit_bio(WRITE, bio); | 189 | submit_bio(WRITE, bio); |
194 | } | 190 | } |
195 | 191 | ||
196 | if (flags & BLKDEV_IFL_WAIT) | 192 | /* Wait for bios in-flight */ |
197 | /* Wait for bios in-flight */ | 193 | while (issued != atomic_read(&bb.done)) |
198 | while ( issued != atomic_read(&bb.done)) | 194 | wait_for_completion(&wait); |
199 | wait_for_completion(&wait); | ||
200 | 195 | ||
201 | if (!test_bit(BIO_UPTODATE, &bb.flags)) | 196 | if (!test_bit(BIO_UPTODATE, &bb.flags)) |
202 | /* One of bios in the batch was completed with error.*/ | 197 | /* One of bios in the batch was completed with error.*/ |