diff options
author | Damien Le Moal <damien.lemoal@wdc.com> | 2019-07-01 01:09:16 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2019-07-11 22:04:37 -0400 |
commit | bd976e52725965ddcceb9abecbcc7ca46863665c (patch) | |
tree | 920d0b976f212f1a4af42c67f271ff8c18406589 /drivers/md/dm-zoned-metadata.c | |
parent | b4c5875d36178e8df409bdce232f270cac89fafe (diff) |
block: Kill gfp_t argument of blkdev_report_zones()
Only GFP_KERNEL and GFP_NOIO are used with blkdev_report_zones(). In
preparation of using vmalloc() for large report buffer and zone array
allocations used by this function, remove its "gfp_t gfp_mask" argument
and rely on the caller context to use memalloc_noio_save/restore() where
necessary (block layer zone revalidation and dm-zoned I/O error path).
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/md/dm-zoned-metadata.c')
-rw-r--r-- | drivers/md/dm-zoned-metadata.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/md/dm-zoned-metadata.c b/drivers/md/dm-zoned-metadata.c index d8334cd45d7c..9faf3e49c7af 100644 --- a/drivers/md/dm-zoned-metadata.c +++ b/drivers/md/dm-zoned-metadata.c | |||
@@ -8,6 +8,7 @@ | |||
8 | 8 | ||
9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
10 | #include <linux/crc32.h> | 10 | #include <linux/crc32.h> |
11 | #include <linux/sched/mm.h> | ||
11 | 12 | ||
12 | #define DM_MSG_PREFIX "zoned metadata" | 13 | #define DM_MSG_PREFIX "zoned metadata" |
13 | 14 | ||
@@ -1162,8 +1163,7 @@ static int dmz_init_zones(struct dmz_metadata *zmd) | |||
1162 | while (sector < dev->capacity) { | 1163 | while (sector < dev->capacity) { |
1163 | /* Get zone information */ | 1164 | /* Get zone information */ |
1164 | nr_blkz = DMZ_REPORT_NR_ZONES; | 1165 | nr_blkz = DMZ_REPORT_NR_ZONES; |
1165 | ret = blkdev_report_zones(dev->bdev, sector, blkz, | 1166 | ret = blkdev_report_zones(dev->bdev, sector, blkz, &nr_blkz); |
1166 | &nr_blkz, GFP_KERNEL); | ||
1167 | if (ret) { | 1167 | if (ret) { |
1168 | dmz_dev_err(dev, "Report zones failed %d", ret); | 1168 | dmz_dev_err(dev, "Report zones failed %d", ret); |
1169 | goto out; | 1169 | goto out; |
@@ -1201,12 +1201,20 @@ out: | |||
1201 | static int dmz_update_zone(struct dmz_metadata *zmd, struct dm_zone *zone) | 1201 | static int dmz_update_zone(struct dmz_metadata *zmd, struct dm_zone *zone) |
1202 | { | 1202 | { |
1203 | unsigned int nr_blkz = 1; | 1203 | unsigned int nr_blkz = 1; |
1204 | unsigned int noio_flag; | ||
1204 | struct blk_zone blkz; | 1205 | struct blk_zone blkz; |
1205 | int ret; | 1206 | int ret; |
1206 | 1207 | ||
1207 | /* Get zone information from disk */ | 1208 | /* |
1209 | * Get zone information from disk. Since blkdev_report_zones() uses | ||
1210 | * GFP_KERNEL by default for memory allocations, set the per-task | ||
1211 | * PF_MEMALLOC_NOIO flag so that all allocations are done as if | ||
1212 | * GFP_NOIO was specified. | ||
1213 | */ | ||
1214 | noio_flag = memalloc_noio_save(); | ||
1208 | ret = blkdev_report_zones(zmd->dev->bdev, dmz_start_sect(zmd, zone), | 1215 | ret = blkdev_report_zones(zmd->dev->bdev, dmz_start_sect(zmd, zone), |
1209 | &blkz, &nr_blkz, GFP_NOIO); | 1216 | &blkz, &nr_blkz); |
1217 | memalloc_noio_restore(noio_flag); | ||
1210 | if (!nr_blkz) | 1218 | if (!nr_blkz) |
1211 | ret = -EIO; | 1219 | ret = -EIO; |
1212 | if (ret) { | 1220 | if (ret) { |