dm.c (7bf7eac8d648057519adb6fce1e31458c902212c) | dm.c (51b86f9a8d1c4bb4e3862ee4b4c5f46072f7520d) |
---|---|
1/* 2 * Copyright (C) 2001, 2002 Sistina Software (UK) Limited. 3 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. 4 * 5 * This file is released under the GPL. 6 */ 7 8#include "dm-core.h" --- 1093 unchanged lines hidden (view full) --- 1102 ret = ti->type->direct_access(ti, pgoff, nr_pages, kaddr, pfn); 1103 1104 out: 1105 dm_put_live_table(md, srcu_idx); 1106 1107 return ret; 1108} 1109 | 1/* 2 * Copyright (C) 2001, 2002 Sistina Software (UK) Limited. 3 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. 4 * 5 * This file is released under the GPL. 6 */ 7 8#include "dm-core.h" --- 1093 unchanged lines hidden (view full) --- 1102 ret = ti->type->direct_access(ti, pgoff, nr_pages, kaddr, pfn); 1103 1104 out: 1105 dm_put_live_table(md, srcu_idx); 1106 1107 return ret; 1108} 1109 |
1110static bool dm_dax_supported(struct dax_device *dax_dev, struct block_device *bdev, 1111 int blocksize, sector_t start, sector_t len) 1112{ 1113 struct mapped_device *md = dax_get_private(dax_dev); 1114 struct dm_table *map; 1115 int srcu_idx; 1116 bool ret; 1117 1118 map = dm_get_live_table(md, &srcu_idx); 1119 if (!map) 1120 return false; 1121 1122 ret = dm_table_supports_dax(map, blocksize); 1123 1124 dm_put_live_table(md, srcu_idx); 1125 1126 return ret; 1127} 1128 | |
1129static size_t dm_dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff, 1130 void *addr, size_t bytes, struct iov_iter *i) 1131{ 1132 struct mapped_device *md = dax_get_private(dax_dev); 1133 sector_t sector = pgoff * PAGE_SECTORS; 1134 struct dm_target *ti; 1135 long ret = 0; 1136 int srcu_idx; --- 346 unchanged lines hidden (view full) --- 1483static unsigned get_num_write_zeroes_bios(struct dm_target *ti) 1484{ 1485 return ti->num_write_zeroes_bios; 1486} 1487 1488static int __send_changing_extent_only(struct clone_info *ci, struct dm_target *ti, 1489 unsigned num_bios) 1490{ | 1110static size_t dm_dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff, 1111 void *addr, size_t bytes, struct iov_iter *i) 1112{ 1113 struct mapped_device *md = dax_get_private(dax_dev); 1114 sector_t sector = pgoff * PAGE_SECTORS; 1115 struct dm_target *ti; 1116 long ret = 0; 1117 int srcu_idx; --- 346 unchanged lines hidden (view full) --- 1464static unsigned get_num_write_zeroes_bios(struct dm_target *ti) 1465{ 1466 return ti->num_write_zeroes_bios; 1467} 1468 1469static int __send_changing_extent_only(struct clone_info *ci, struct dm_target *ti, 1470 unsigned num_bios) 1471{ |
1491 unsigned len = ci->sector_count; | 1472 unsigned len; |
1492 1493 /* 1494 * Even though the device advertised support for this type of 1495 * request, that does not mean every target supports it, and 1496 * reconfiguration might also have changed that since the 1497 * check was performed. 1498 */ 1499 if (!num_bios) 1500 return -EOPNOTSUPP; 1501 | 1473 1474 /* 1475 * Even though the device advertised support for this type of 1476 * request, that does not mean every target supports it, and 1477 * reconfiguration might also have changed that since the 1478 * check was performed. 1479 */ 1480 if (!num_bios) 1481 return -EOPNOTSUPP; 1482 |
1483 len = min((sector_t)ci->sector_count, max_io_len_target_boundary(ci->sector, ti)); 1484 |
|
1502 __send_duplicate_bios(ci, ti, num_bios, &len); 1503 1504 ci->sector += len; 1505 ci->sector_count -= len; 1506 1507 return 0; 1508} 1509 --- 1696 unchanged lines hidden (view full) --- 3206 .getgeo = dm_blk_getgeo, 3207 .report_zones = dm_blk_report_zones, 3208 .pr_ops = &dm_pr_ops, 3209 .owner = THIS_MODULE 3210}; 3211 3212static const struct dax_operations dm_dax_ops = { 3213 .direct_access = dm_dax_direct_access, | 1485 __send_duplicate_bios(ci, ti, num_bios, &len); 1486 1487 ci->sector += len; 1488 ci->sector_count -= len; 1489 1490 return 0; 1491} 1492 --- 1696 unchanged lines hidden (view full) --- 3189 .getgeo = dm_blk_getgeo, 3190 .report_zones = dm_blk_report_zones, 3191 .pr_ops = &dm_pr_ops, 3192 .owner = THIS_MODULE 3193}; 3194 3195static const struct dax_operations dm_dax_ops = { 3196 .direct_access = dm_dax_direct_access, |
3214 .dax_supported = dm_dax_supported, | |
3215 .copy_from_iter = dm_dax_copy_from_iter, 3216 .copy_to_iter = dm_dax_copy_to_iter, 3217}; 3218 3219/* 3220 * module hooks 3221 */ 3222module_init(dm_init); --- 14 unchanged lines hidden --- | 3197 .copy_from_iter = dm_dax_copy_from_iter, 3198 .copy_to_iter = dm_dax_copy_to_iter, 3199}; 3200 3201/* 3202 * module hooks 3203 */ 3204module_init(dm_init); --- 14 unchanged lines hidden --- |