@@ -293,19 +293,22 @@ static void bio_end_empty_barrier(struct bio *bio, int err)
293293/**
294294 * blkdev_issue_flush - queue a flush
295295 * @bdev: blockdev to issue flush for
296+ * @gfp_mask: memory allocation flags (for bio_alloc)
296297 * @error_sector: error sector
298+ * @flags: BLKDEV_IFL_* flags to control behaviour
297299 *
298300 * Description:
299301 * Issue a flush for the block device in question. Caller can supply
300302 * room for storing the error offset in case of a flush error, if they
301303 * wish to.
302304 */
303- int blkdev_issue_flush (struct block_device * bdev , sector_t * error_sector )
305+ int blkdev_issue_flush (struct block_device * bdev , gfp_t gfp_mask ,
306+ sector_t * error_sector , unsigned long flags )
304307{
305308 DECLARE_COMPLETION_ONSTACK (wait );
306309 struct request_queue * q ;
307310 struct bio * bio ;
308- int ret ;
311+ int ret = 0 ;
309312
310313 if (bdev -> bd_disk == NULL )
311314 return - ENXIO ;
@@ -314,7 +317,7 @@ int blkdev_issue_flush(struct block_device *bdev, sector_t *error_sector)
314317 if (!q )
315318 return - ENXIO ;
316319
317- bio = bio_alloc (GFP_KERNEL , 0 );
320+ bio = bio_alloc (gfp_mask , 0 );
318321 bio -> bi_end_io = bio_end_empty_barrier ;
319322 bio -> bi_private = & wait ;
320323 bio -> bi_bdev = bdev ;
@@ -330,7 +333,6 @@ int blkdev_issue_flush(struct block_device *bdev, sector_t *error_sector)
330333 if (error_sector )
331334 * error_sector = bio -> bi_sector ;
332335
333- ret = 0 ;
334336 if (bio_flagged (bio , BIO_EOPNOTSUPP ))
335337 ret = - EOPNOTSUPP ;
336338 else if (!bio_flagged (bio , BIO_UPTODATE ))
@@ -362,17 +364,17 @@ static void blkdev_discard_end_io(struct bio *bio, int err)
362364 * @sector: start sector
363365 * @nr_sects: number of sectors to discard
364366 * @gfp_mask: memory allocation flags (for bio_alloc)
365- * @flags: DISCARD_FL_ * flags to control behaviour
367+ * @flags: BLKDEV_IFL_ * flags to control behaviour
366368 *
367369 * Description:
368370 * Issue a discard request for the sectors in question.
369371 */
370372int 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 )
372374{
373375 DECLARE_COMPLETION_ONSTACK (wait );
374376 struct request_queue * q = bdev_get_queue (bdev );
375- int type = flags & DISCARD_FL_BARRIER ?
377+ int type = flags & BLKDEV_IFL_BARRIER ?
376378 DISCARD_BARRIER : DISCARD_NOBARRIER ;
377379 struct bio * bio ;
378380 struct page * page ;
@@ -395,7 +397,7 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
395397 bio -> bi_sector = sector ;
396398 bio -> bi_end_io = blkdev_discard_end_io ;
397399 bio -> bi_bdev = bdev ;
398- if (flags & DISCARD_FL_WAIT )
400+ if (flags & BLKDEV_IFL_WAIT )
399401 bio -> bi_private = & wait ;
400402
401403 /*
@@ -426,7 +428,7 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
426428 bio_get (bio );
427429 submit_bio (type , bio );
428430
429- if (flags & DISCARD_FL_WAIT )
431+ if (flags & BLKDEV_IFL_WAIT )
430432 wait_for_completion (& wait );
431433
432434 if (bio_flagged (bio , BIO_EOPNOTSUPP ))
0 commit comments