aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-barrier.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/blk-barrier.c')
-rw-r--r--block/blk-barrier.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/block/blk-barrier.c b/block/blk-barrier.c
index 6d88544b677f..cf14311b98fc 100644
--- a/block/blk-barrier.c
+++ b/block/blk-barrier.c
@@ -293,19 +293,22 @@ static void bio_end_empty_barrier(struct bio *bio, int err)
293/** 293/**
294 * blkdev_issue_flush - queue a flush 294 * blkdev_issue_flush - queue a flush
295 * @bdev: blockdev to issue flush for 295 * @bdev: blockdev to issue flush for
296 * @gfp_mask: memory allocation flags (for bio_alloc)
296 * @error_sector: error sector 297 * @error_sector: error sector
298 * @flags: BLKDEV_IFL_* flags to control behaviour
297 * 299 *
298 * Description: 300 * Description:
299 * Issue a flush for the block device in question. Caller can supply 301 * Issue a flush for the block device in question. Caller can supply
300 * room for storing the error offset in case of a flush error, if they 302 * room for storing the error offset in case of a flush error, if they
301 * wish to. 303 * wish to.
302 */ 304 */
303int blkdev_issue_flush(struct block_device *bdev, sector_t *error_sector) 305int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask,
306 sector_t *error_sector, unsigned long flags)
304{ 307{
305 DECLARE_COMPLETION_ONSTACK(wait); 308 DECLARE_COMPLETION_ONSTACK(wait);
306 struct request_queue *q; 309 struct request_queue *q;
307 struct bio *bio; 310 struct bio *bio;
308 int ret; 311 int ret = 0;
309 312
310 if (bdev->bd_disk == NULL) 313 if (bdev->bd_disk == NULL)
311 return -ENXIO; 314 return -ENXIO;
@@ -314,7 +317,7 @@ int blkdev_issue_flush(struct block_device *bdev, sector_t *error_sector)
314 if (!q) 317 if (!q)
315 return -ENXIO; 318 return -ENXIO;
316 319
317 bio = bio_alloc(GFP_KERNEL, 0); 320 bio = bio_alloc(gfp_mask, 0);
318 bio->bi_end_io = bio_end_empty_barrier; 321 bio->bi_end_io = bio_end_empty_barrier;
319 bio->bi_private = &wait; 322 bio->bi_private = &wait;
320 bio->bi_bdev = bdev; 323 bio->bi_bdev = bdev;
@@ -330,7 +333,6 @@ int blkdev_issue_flush(struct block_device *bdev, sector_t *error_sector)
330 if (error_sector) 333 if (error_sector)
331 *error_sector = bio->bi_sector; 334 *error_sector = bio->bi_sector;
332 335
333 ret = 0;
334 if (bio_flagged(bio, BIO_EOPNOTSUPP)) 336 if (bio_flagged(bio, BIO_EOPNOTSUPP))
335 ret = -EOPNOTSUPP; 337 ret = -EOPNOTSUPP;
336 else if (!bio_flagged(bio, BIO_UPTODATE)) 338 else if (!bio_flagged(bio, BIO_UPTODATE))
@@ -362,17 +364,17 @@ static void blkdev_discard_end_io(struct bio *bio, int err)
362 * @sector: start sector 364 * @sector: start sector
363 * @nr_sects: number of sectors to discard 365 * @nr_sects: number of sectors to discard
364 * @gfp_mask: memory allocation flags (for bio_alloc) 366 * @gfp_mask: memory allocation flags (for bio_alloc)
365 * @flags: DISCARD_FL_* flags to control behaviour 367 * @flags: BLKDEV_IFL_* flags to control behaviour
366 * 368 *
367 * Description: 369 * Description:
368 * Issue a discard request for the sectors in question. 370 * Issue a discard request for the sectors in question.
369 */ 371 */
370int blkdev_issue_discard(struct block_device *bdev, sector_t sector, 372int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
371 sector_t nr_sects, gfp_t gfp_mask, int flags) 373 sector_t nr_sects, gfp_t gfp_mask, unsigned long flags)
372{ 374{
373 DECLARE_COMPLETION_ONSTACK(wait); 375 DECLARE_COMPLETION_ONSTACK(wait);
374 struct request_queue *q = bdev_get_queue(bdev); 376 struct request_queue *q = bdev_get_queue(bdev);
375 int type = flags & DISCARD_FL_BARRIER ? 377 int type = flags & BLKDEV_IFL_BARRIER ?
376 DISCARD_BARRIER : DISCARD_NOBARRIER; 378 DISCARD_BARRIER : DISCARD_NOBARRIER;
377 struct bio *bio; 379 struct bio *bio;
378 struct page *page; 380 struct page *page;
@@ -395,7 +397,7 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
395 bio->bi_sector = sector; 397 bio->bi_sector = sector;
396 bio->bi_end_io = blkdev_discard_end_io; 398 bio->bi_end_io = blkdev_discard_end_io;
397 bio->bi_bdev = bdev; 399 bio->bi_bdev = bdev;
398 if (flags & DISCARD_FL_WAIT) 400 if (flags & BLKDEV_IFL_WAIT)
399 bio->bi_private = &wait; 401 bio->bi_private = &wait;
400 402
401 /* 403 /*
@@ -426,7 +428,7 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
426 bio_get(bio); 428 bio_get(bio);
427 submit_bio(type, bio); 429 submit_bio(type, bio);
428 430
429 if (flags & DISCARD_FL_WAIT) 431 if (flags & BLKDEV_IFL_WAIT)
430 wait_for_completion(&wait); 432 wait_for_completion(&wait);
431 433
432 if (bio_flagged(bio, BIO_EOPNOTSUPP)) 434 if (bio_flagged(bio, BIO_EOPNOTSUPP))