dm-linear.c (5e3cdecf7834a764b9d24f6e696adf3e03813fab) | dm-linear.c (e76239a3748c90a8b0e197f8f4544a8ce52f126e) |
---|---|
1/* 2 * Copyright (C) 2001-2003 Sistina Software (UK) Limited. 3 * 4 * This file is released under the GPL. 5 */ 6 7#include "dm.h" 8#include <linux/module.h> --- 88 unchanged lines hidden (view full) --- 97 98static int linear_map(struct dm_target *ti, struct bio *bio) 99{ 100 linear_map_bio(ti, bio); 101 102 return DM_MAPIO_REMAPPED; 103} 104 | 1/* 2 * Copyright (C) 2001-2003 Sistina Software (UK) Limited. 3 * 4 * This file is released under the GPL. 5 */ 6 7#include "dm.h" 8#include <linux/module.h> --- 88 unchanged lines hidden (view full) --- 97 98static int linear_map(struct dm_target *ti, struct bio *bio) 99{ 100 linear_map_bio(ti, bio); 101 102 return DM_MAPIO_REMAPPED; 103} 104 |
105#ifdef CONFIG_BLK_DEV_ZONED 106static int linear_end_io(struct dm_target *ti, struct bio *bio, 107 blk_status_t *error) 108{ 109 struct linear_c *lc = ti->private; 110 111 if (!*error && bio_op(bio) == REQ_OP_ZONE_REPORT) 112 dm_remap_zone_report(ti, bio, lc->start); 113 114 return DM_ENDIO_DONE; 115} 116#endif 117 | |
118static void linear_status(struct dm_target *ti, status_type_t type, 119 unsigned status_flags, char *result, unsigned maxlen) 120{ 121 struct linear_c *lc = (struct linear_c *) ti->private; 122 123 switch (type) { 124 case STATUSTYPE_INFO: 125 result[0] = '\0'; --- 17 unchanged lines hidden (view full) --- 143 * Only pass ioctls through if the device sizes match exactly. 144 */ 145 if (lc->start || 146 ti->len != i_size_read(dev->bdev->bd_inode) >> SECTOR_SHIFT) 147 return 1; 148 return 0; 149} 150 | 105static void linear_status(struct dm_target *ti, status_type_t type, 106 unsigned status_flags, char *result, unsigned maxlen) 107{ 108 struct linear_c *lc = (struct linear_c *) ti->private; 109 110 switch (type) { 111 case STATUSTYPE_INFO: 112 result[0] = '\0'; --- 17 unchanged lines hidden (view full) --- 130 * Only pass ioctls through if the device sizes match exactly. 131 */ 132 if (lc->start || 133 ti->len != i_size_read(dev->bdev->bd_inode) >> SECTOR_SHIFT) 134 return 1; 135 return 0; 136} 137 |
138#ifdef CONFIG_BLK_DEV_ZONED 139static int linear_report_zones(struct dm_target *ti, sector_t sector, 140 struct blk_zone *zones, unsigned int *nr_zones, 141 gfp_t gfp_mask) 142{ 143 struct linear_c *lc = (struct linear_c *) ti->private; 144 int ret; 145 146 /* Do report and remap it */ 147 ret = blkdev_report_zones(lc->dev->bdev, linear_map_sector(ti, sector), 148 zones, nr_zones, gfp_mask); 149 if (ret != 0) 150 return ret; 151 152 if (*nr_zones) 153 dm_remap_zone_report(ti, lc->start, zones, nr_zones); 154 return 0; 155} 156#endif 157 |
|
151static int linear_iterate_devices(struct dm_target *ti, 152 iterate_devices_callout_fn fn, void *data) 153{ 154 struct linear_c *lc = ti->private; 155 156 return fn(ti, lc->dev, lc->start, ti->len, data); 157} 158 --- 47 unchanged lines hidden (view full) --- 206#define linear_dax_copy_from_iter NULL 207#define linear_dax_copy_to_iter NULL 208#endif 209 210static struct target_type linear_target = { 211 .name = "linear", 212 .version = {1, 4, 0}, 213#ifdef CONFIG_BLK_DEV_ZONED | 158static int linear_iterate_devices(struct dm_target *ti, 159 iterate_devices_callout_fn fn, void *data) 160{ 161 struct linear_c *lc = ti->private; 162 163 return fn(ti, lc->dev, lc->start, ti->len, data); 164} 165 --- 47 unchanged lines hidden (view full) --- 213#define linear_dax_copy_from_iter NULL 214#define linear_dax_copy_to_iter NULL 215#endif 216 217static struct target_type linear_target = { 218 .name = "linear", 219 .version = {1, 4, 0}, 220#ifdef CONFIG_BLK_DEV_ZONED |
214 .end_io = linear_end_io, | |
215 .features = DM_TARGET_PASSES_INTEGRITY | DM_TARGET_ZONED_HM, | 221 .features = DM_TARGET_PASSES_INTEGRITY | DM_TARGET_ZONED_HM, |
222 .report_zones = linear_report_zones, |
|
216#else 217 .features = DM_TARGET_PASSES_INTEGRITY, 218#endif 219 .module = THIS_MODULE, 220 .ctr = linear_ctr, 221 .dtr = linear_dtr, 222 .map = linear_map, 223 .status = linear_status, --- 21 unchanged lines hidden --- | 223#else 224 .features = DM_TARGET_PASSES_INTEGRITY, 225#endif 226 .module = THIS_MODULE, 227 .ctr = linear_ctr, 228 .dtr = linear_dtr, 229 .map = linear_map, 230 .status = linear_status, --- 21 unchanged lines hidden --- |