summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--block/blk-barrier.c7
-rw-r--r--include/linux/blkdev.h9
2 files changed, 9 insertions, 7 deletions
diff --git a/block/blk-barrier.c b/block/blk-barrier.c
index 988b63479b2f..5c99ff8d2db8 100644
--- a/block/blk-barrier.c
+++ b/block/blk-barrier.c
@@ -332,12 +332,13 @@ static void blkdev_discard_end_io(struct bio *bio, int err)
* @bdev: blockdev to issue discard for
* @sector: start sector
* @nr_sects: number of sectors to discard
+ * @gfp_mask: memory allocation flags (for bio_alloc)
*
* Description:
* Issue a discard request for the sectors in question. Does not wait.
*/
-int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
- unsigned nr_sects)
+int blkdev_issue_discard(struct block_device *bdev,
+ sector_t sector, sector_t nr_sects, gfp_t gfp_mask)
{
struct request_queue *q;
struct bio *bio;
@@ -354,7 +355,7 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
return -EOPNOTSUPP;
while (nr_sects && !ret) {
- bio = bio_alloc(GFP_KERNEL, 0);
+ bio = bio_alloc(gfp_mask, 0);
if (!bio)
return -ENOMEM;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 37781d6fe045..b47767c72ce3 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -16,6 +16,7 @@
#include <linux/bio.h>
#include <linux/module.h>
#include <linux/stringify.h>
+#include <linux/gfp.h>
#include <linux/bsg.h>
#include <linux/smp.h>
@@ -873,15 +874,15 @@ static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt,
}
extern int blkdev_issue_flush(struct block_device *, sector_t *);
-extern int blkdev_issue_discard(struct block_device *, sector_t sector,
- unsigned nr_sects);
+extern int blkdev_issue_discard(struct block_device *,
+ sector_t sector, sector_t nr_sects, gfp_t);
static inline int sb_issue_discard(struct super_block *sb,
- sector_t block, unsigned nr_blocks)
+ sector_t block, sector_t nr_blocks)
{
block <<= (sb->s_blocksize_bits - 9);
nr_blocks <<= (sb->s_blocksize_bits - 9);
- return blkdev_issue_discard(sb->s_bdev, block, nr_blocks);
+ return blkdev_issue_discard(sb->s_bdev, block, nr_blocks, GFP_KERNEL);
}
/*