.. | .. |
---|
62 | 62 | ti->num_secure_erase_bios = 1; |
---|
63 | 63 | ti->num_write_same_bios = 1; |
---|
64 | 64 | ti->num_write_zeroes_bios = 1; |
---|
65 | | - ti->may_passthrough_inline_crypto = true; |
---|
66 | 65 | ti->private = lc; |
---|
67 | 66 | return 0; |
---|
68 | 67 | |
---|
.. | .. |
---|
91 | 90 | struct linear_c *lc = ti->private; |
---|
92 | 91 | |
---|
93 | 92 | bio_set_dev(bio, lc->dev->bdev); |
---|
94 | | - if (bio_sectors(bio) || bio_op(bio) == REQ_OP_ZONE_RESET) |
---|
| 93 | + if (bio_sectors(bio) || op_is_zone_mgmt(bio_op(bio))) |
---|
95 | 94 | bio->bi_iter.bi_sector = |
---|
96 | 95 | linear_map_sector(ti, bio->bi_iter.bi_sector); |
---|
97 | 96 | } |
---|
.. | .. |
---|
102 | 101 | |
---|
103 | 102 | return DM_MAPIO_REMAPPED; |
---|
104 | 103 | } |
---|
105 | | - |
---|
106 | | -#ifdef CONFIG_BLK_DEV_ZONED |
---|
107 | | -static int linear_end_io(struct dm_target *ti, struct bio *bio, |
---|
108 | | - blk_status_t *error) |
---|
109 | | -{ |
---|
110 | | - struct linear_c *lc = ti->private; |
---|
111 | | - |
---|
112 | | - if (!*error && bio_op(bio) == REQ_OP_ZONE_REPORT) |
---|
113 | | - dm_remap_zone_report(ti, bio, lc->start); |
---|
114 | | - |
---|
115 | | - return DM_ENDIO_DONE; |
---|
116 | | -} |
---|
117 | | -#endif |
---|
118 | 104 | |
---|
119 | 105 | static void linear_status(struct dm_target *ti, status_type_t type, |
---|
120 | 106 | unsigned status_flags, char *result, unsigned maxlen) |
---|
.. | .. |
---|
148 | 134 | return 1; |
---|
149 | 135 | return 0; |
---|
150 | 136 | } |
---|
| 137 | + |
---|
| 138 | +#ifdef CONFIG_BLK_DEV_ZONED |
---|
| 139 | +static int linear_report_zones(struct dm_target *ti, |
---|
| 140 | + struct dm_report_zones_args *args, unsigned int nr_zones) |
---|
| 141 | +{ |
---|
| 142 | + struct linear_c *lc = ti->private; |
---|
| 143 | + sector_t sector = linear_map_sector(ti, args->next_sector); |
---|
| 144 | + |
---|
| 145 | + args->start = lc->start; |
---|
| 146 | + return blkdev_report_zones(lc->dev->bdev, sector, nr_zones, |
---|
| 147 | + dm_report_zones_cb, args); |
---|
| 148 | +} |
---|
| 149 | +#endif |
---|
151 | 150 | |
---|
152 | 151 | static int linear_iterate_devices(struct dm_target *ti, |
---|
153 | 152 | iterate_devices_callout_fn fn, void *data) |
---|
.. | .. |
---|
202 | 201 | return dax_copy_to_iter(dax_dev, pgoff, addr, bytes, i); |
---|
203 | 202 | } |
---|
204 | 203 | |
---|
| 204 | +static int linear_dax_zero_page_range(struct dm_target *ti, pgoff_t pgoff, |
---|
| 205 | + size_t nr_pages) |
---|
| 206 | +{ |
---|
| 207 | + int ret; |
---|
| 208 | + struct linear_c *lc = ti->private; |
---|
| 209 | + struct block_device *bdev = lc->dev->bdev; |
---|
| 210 | + struct dax_device *dax_dev = lc->dev->dax_dev; |
---|
| 211 | + sector_t dev_sector, sector = pgoff * PAGE_SECTORS; |
---|
| 212 | + |
---|
| 213 | + dev_sector = linear_map_sector(ti, sector); |
---|
| 214 | + ret = bdev_dax_pgoff(bdev, dev_sector, nr_pages << PAGE_SHIFT, &pgoff); |
---|
| 215 | + if (ret) |
---|
| 216 | + return ret; |
---|
| 217 | + return dax_zero_page_range(dax_dev, pgoff, nr_pages); |
---|
| 218 | +} |
---|
| 219 | + |
---|
205 | 220 | #else |
---|
206 | 221 | #define linear_dax_direct_access NULL |
---|
207 | 222 | #define linear_dax_copy_from_iter NULL |
---|
208 | 223 | #define linear_dax_copy_to_iter NULL |
---|
| 224 | +#define linear_dax_zero_page_range NULL |
---|
209 | 225 | #endif |
---|
210 | 226 | |
---|
211 | 227 | static struct target_type linear_target = { |
---|
212 | 228 | .name = "linear", |
---|
213 | 229 | .version = {1, 4, 0}, |
---|
214 | 230 | #ifdef CONFIG_BLK_DEV_ZONED |
---|
215 | | - .end_io = linear_end_io, |
---|
216 | | - .features = DM_TARGET_PASSES_INTEGRITY | DM_TARGET_ZONED_HM, |
---|
| 231 | + .features = DM_TARGET_PASSES_INTEGRITY | DM_TARGET_NOWAIT | |
---|
| 232 | + DM_TARGET_ZONED_HM | DM_TARGET_PASSES_CRYPTO, |
---|
| 233 | + .report_zones = linear_report_zones, |
---|
217 | 234 | #else |
---|
218 | | - .features = DM_TARGET_PASSES_INTEGRITY, |
---|
| 235 | + .features = DM_TARGET_PASSES_INTEGRITY | DM_TARGET_NOWAIT | |
---|
| 236 | + DM_TARGET_PASSES_CRYPTO, |
---|
219 | 237 | #endif |
---|
220 | 238 | .module = THIS_MODULE, |
---|
221 | 239 | .ctr = linear_ctr, |
---|
.. | .. |
---|
227 | 245 | .direct_access = linear_dax_direct_access, |
---|
228 | 246 | .dax_copy_from_iter = linear_dax_copy_from_iter, |
---|
229 | 247 | .dax_copy_to_iter = linear_dax_copy_to_iter, |
---|
| 248 | + .dax_zero_page_range = linear_dax_zero_page_range, |
---|
230 | 249 | }; |
---|
231 | 250 | |
---|
232 | 251 | int __init dm_linear_init(void) |
---|