| .. | .. |
|---|
| 40 | 40 | * |
|---|
| 41 | 41 | * Would result in the log looking like this: |
|---|
| 42 | 42 | * |
|---|
| 43 | | - * c,a,flush,fuad,b,<other writes>,<next flush> |
|---|
| 43 | + * c,a,b,flush,fuad,<other writes>,<next flush> |
|---|
| 44 | 44 | * |
|---|
| 45 | 45 | * This is meant to help expose problems where file systems do not properly wait |
|---|
| 46 | 46 | * on data being written before invoking a FLUSH. FUA bypasses cache so once it |
|---|
| .. | .. |
|---|
| 127 | 127 | char *data; |
|---|
| 128 | 128 | u32 datalen; |
|---|
| 129 | 129 | struct list_head list; |
|---|
| 130 | | - struct bio_vec vecs[0]; |
|---|
| 130 | + struct bio_vec vecs[]; |
|---|
| 131 | 131 | }; |
|---|
| 132 | 132 | |
|---|
| 133 | 133 | struct per_bio_data { |
|---|
| .. | .. |
|---|
| 699 | 699 | if (discard_bio) |
|---|
| 700 | 700 | alloc_size = sizeof(struct pending_block); |
|---|
| 701 | 701 | else |
|---|
| 702 | | - alloc_size = sizeof(struct pending_block) + sizeof(struct bio_vec) * bio_segments(bio); |
|---|
| 702 | + alloc_size = struct_size(block, vecs, bio_segments(bio)); |
|---|
| 703 | 703 | |
|---|
| 704 | 704 | block = kzalloc(alloc_size, GFP_NOIO); |
|---|
| 705 | 705 | if (!block) { |
|---|
| .. | .. |
|---|
| 994 | 994 | return dax_copy_to_iter(lc->dev->dax_dev, pgoff, addr, bytes, i); |
|---|
| 995 | 995 | } |
|---|
| 996 | 996 | |
|---|
| 997 | +static int log_writes_dax_zero_page_range(struct dm_target *ti, pgoff_t pgoff, |
|---|
| 998 | + size_t nr_pages) |
|---|
| 999 | +{ |
|---|
| 1000 | + int ret; |
|---|
| 1001 | + struct log_writes_c *lc = ti->private; |
|---|
| 1002 | + sector_t sector = pgoff * PAGE_SECTORS; |
|---|
| 1003 | + |
|---|
| 1004 | + ret = bdev_dax_pgoff(lc->dev->bdev, sector, nr_pages << PAGE_SHIFT, |
|---|
| 1005 | + &pgoff); |
|---|
| 1006 | + if (ret) |
|---|
| 1007 | + return ret; |
|---|
| 1008 | + return dax_zero_page_range(lc->dev->dax_dev, pgoff, |
|---|
| 1009 | + nr_pages << PAGE_SHIFT); |
|---|
| 1010 | +} |
|---|
| 1011 | + |
|---|
| 997 | 1012 | #else |
|---|
| 998 | 1013 | #define log_writes_dax_direct_access NULL |
|---|
| 999 | 1014 | #define log_writes_dax_copy_from_iter NULL |
|---|
| 1000 | 1015 | #define log_writes_dax_copy_to_iter NULL |
|---|
| 1016 | +#define log_writes_dax_zero_page_range NULL |
|---|
| 1001 | 1017 | #endif |
|---|
| 1002 | 1018 | |
|---|
| 1003 | 1019 | static struct target_type log_writes_target = { |
|---|
| .. | .. |
|---|
| 1016 | 1032 | .direct_access = log_writes_dax_direct_access, |
|---|
| 1017 | 1033 | .dax_copy_from_iter = log_writes_dax_copy_from_iter, |
|---|
| 1018 | 1034 | .dax_copy_to_iter = log_writes_dax_copy_to_iter, |
|---|
| 1035 | + .dax_zero_page_range = log_writes_dax_zero_page_range, |
|---|
| 1019 | 1036 | }; |
|---|
| 1020 | 1037 | |
|---|
| 1021 | 1038 | static int __init dm_log_writes_init(void) |
|---|