Skip to content

Commit d358e52

Browse files
committed
Merge tag 'for-6.19/dm-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm
Pull device mapper updates from Mikulas Patocka: - convert crypto_shash users to direct crypto library use with simpler and faster code and reduced stack usage (Eric Biggers): - the dm-verity SHA-256 conversion also teaches it to do two-way interleaved hashing for added performance - dm-crypt MD5 conversion (used for Loop-AES compatibility) - added document for for takeover/reshape raid1 -> raid5 examples (Heinz Mauelshagen) - fix dm-vdo kerneldoc warnings (Matthew Sakai) - various random fixes and cleanups * tag 'for-6.19/dm-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm: (29 commits) dm pcache: fix segment info indexing dm pcache: fix cache info indexing dm-pcache: advance slot index before writing slot dm raid: add documentation for takeover/reshape raid1 -> raid5 table line examples dm log-writes: Add missing set_freezable() for freezable kthread dm-raid: fix possible NULL dereference with undefined raid type dm-snapshot: fix 'scheduling while atomic' on real-time kernels dm: ignore discard return value MAINTAINERS: add Benjamin Marzinski as a device mapper maintainer dm-mpath: Simplify the setup_scsi_dh code dm vdo: fix kerneldoc warnings dm-bufio: align write boundary on physical block size dm-crypt: enable DM_TARGET_ATOMIC_WRITES dm: test for REQ_ATOMIC in dm_accept_partial_bio() dm-verity: remove useless mempool dm-verity: disable recursive forward error correction dm-ebs: Mark full buffer dirty even on partial write dm mpath: enable DM_TARGET_ATOMIC_WRITES dm verity fec: Expose corrected block count via status dm: Don't warn if IMA_DISABLE_HTABLE is not enabled ...
2 parents 8c8081c + 13ea55e commit d358e52

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+761
-484
lines changed

Documentation/admin-guide/device-mapper/dm-raid.rst

Lines changed: 73 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ The target is named "raid" and it accepts the following parameters::
2020
raid0 RAID0 striping (no resilience)
2121
raid1 RAID1 mirroring
2222
raid4 RAID4 with dedicated last parity disk
23-
raid5_n RAID5 with dedicated last parity disk supporting takeover
23+
raid5_n RAID5 with dedicated last parity disk supporting takeover from/to raid1
2424
Same as raid4
2525

26-
- Transitory layout
26+
- Transitory layout for takeover from/to raid1
2727
raid5_la RAID5 left asymmetric
2828

2929
- rotating parity 0 with data continuation
@@ -48,8 +48,8 @@ The target is named "raid" and it accepts the following parameters::
4848
raid6_n_6 RAID6 with dedicate parity disks
4949

5050
- parity and Q-syndrome on the last 2 disks;
51-
layout for takeover from/to raid4/raid5_n
52-
raid6_la_6 Same as "raid_la" plus dedicated last Q-syndrome disk
51+
layout for takeover from/to raid0/raid4/raid5_n
52+
raid6_la_6 Same as "raid_la" plus dedicated last Q-syndrome disk supporting takeover from/to raid5
5353

5454
- layout for takeover from raid5_la from/to raid6
5555
raid6_ra_6 Same as "raid5_ra" dedicated last Q-syndrome disk
@@ -173,9 +173,9 @@ The target is named "raid" and it accepts the following parameters::
173173
The delta_disks option value (-251 < N < +251) triggers
174174
device removal (negative value) or device addition (positive
175175
value) to any reshape supporting raid levels 4/5/6 and 10.
176-
RAID levels 4/5/6 allow for addition of devices (metadata
177-
and data device tuple), raid10_near and raid10_offset only
178-
allow for device addition. raid10_far does not support any
176+
RAID levels 4/5/6 allow for addition and removal of devices
177+
(metadata and data device tuple), raid10_near and raid10_offset
178+
only allow for device addition. raid10_far does not support any
179179
reshaping at all.
180180
A minimum of devices have to be kept to enforce resilience,
181181
which is 3 devices for raid4/5 and 4 devices for raid6.
@@ -372,6 +372,72 @@ to safely enable discard support for RAID 4/5/6:
372372
'devices_handle_discards_safely'
373373

374374

375+
Takeover/Reshape Support
376+
------------------------
377+
The target natively supports these two types of MDRAID conversions:
378+
379+
o Takeover: Converts an array from one RAID level to another
380+
381+
o Reshape: Changes the internal layout while maintaining the current RAID level
382+
383+
Each operation is only valid under specific constraints imposed by the existing array's layout and configuration.
384+
385+
386+
Takeover:
387+
linear -> raid1 with N >= 2 mirrors
388+
raid0 -> raid4 (add dedicated parity device)
389+
raid0 -> raid5 (add dedicated parity device)
390+
raid0 -> raid10 with near layout and N >= 2 mirror groups (raid0 stripes have to become first member within mirror groups)
391+
raid1 -> linear
392+
raid1 -> raid5 with 2 mirrors
393+
raid4 -> raid5 w/ rotating parity
394+
raid5 with dedicated parity device -> raid4
395+
raid5 -> raid6 (with dedicated Q-syndrome)
396+
raid6 (with dedicated Q-syndrome) -> raid5
397+
raid10 with near layout and even number of disks -> raid0 (select any in-sync device from each mirror group)
398+
399+
Reshape:
400+
linear: not possible
401+
raid0: not possible
402+
raid1: change number of mirrors
403+
raid4: add and remove stripes (minimum 3), change stripesize
404+
raid5: add and remove stripes (minimum 3, special case 2 for raid1 takeover), change rotating parity algorithms, change stripesize
405+
raid6: add and remove stripes (minimum 4), change rotating syndrome algorithms, change stripesize
406+
raid10 near: add stripes (minimum 4), change stripesize, no stripe removal possible, change to offset layout
407+
raid10 offset: add stripes, change stripesize, no stripe removal possible, change to near layout
408+
raid10 far: not possible
409+
410+
Table line examples:
411+
412+
### raid1 -> raid5
413+
#
414+
# 2 devices limitation in raid1.
415+
# raid5 personality is able to just map 2 like raid1.
416+
# Reshape after takeover to change to full raid5 layout
417+
418+
0 1960886272 raid raid1 3 0 region_size 2048 2 /dev/dm-0 /dev/dm-1 /dev/dm-2 /dev/dm-3
419+
420+
# dm-0 and dm-2 are e.g. 4MiB large metadata devices, dm-1 and dm-3 have to be at least 1960886272 big.
421+
#
422+
# Table line to takeover to raid5
423+
424+
0 1960886272 raid raid5 3 0 region_size 2048 2 /dev/dm-0 /dev/dm-1 /dev/dm-2 /dev/dm-3
425+
426+
# Add required out-of-place reshape space to the beginniong of the given 2 data devices,
427+
# allocate another metadata/data device tuple with the same sizes for the parity space
428+
# and zero the first 4K of the metadata device.
429+
#
430+
# Example table of the out-of-place reshape space addition for one data device, e.g. dm-1
431+
432+
0 8192 linear 8:0 0 1960903888 # <- must be free space segment
433+
8192 1960886272 linear 8:0 0 2048 # previous data segment
434+
435+
# Mapping table for e.g. raid5_rs reshape causing the size of the raid device to double-fold once the reshape finishes.
436+
# Check the status output (e.g. "dmsetup status $RaidDev") for progess.
437+
438+
0 $((2 * 1960886272)) raid raid5 7 0 region_size 2048 data_offset 8192 delta_disk 1 2 /dev/dm-0 /dev/dm-1 /dev/dm-2 /dev/dm-3
439+
440+
375441
Version History
376442
---------------
377443

Documentation/admin-guide/device-mapper/verity.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,10 @@ is available at the cryptsetup project's wiki page
236236

237237
Status
238238
======
239-
V (for Valid) is returned if every check performed so far was valid.
240-
If any check failed, C (for Corruption) is returned.
239+
1. V (for Valid) is returned if every check performed so far was valid.
240+
If any check failed, C (for Corruption) is returned.
241+
2. Number of corrected blocks by Forward Error Correction.
242+
'-' if Forward Error Correction is not enabled.
241243

242244
Example
243245
=======

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7225,6 +7225,7 @@ DEVICE-MAPPER (LVM)
72257225
M: Alasdair Kergon <agk@redhat.com>
72267226
M: Mike Snitzer <snitzer@kernel.org>
72277227
M: Mikulas Patocka <mpatocka@redhat.com>
7228+
M: Benjamin Marzinski <bmarzins@redhat.com>
72287229
L: dm-devel@lists.linux.dev
72297230
S: Maintained
72307231
Q: http://patchwork.kernel.org/project/dm-devel/list/

drivers/md/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ config DM_CRYPT
299299
select CRYPTO
300300
select CRYPTO_CBC
301301
select CRYPTO_ESSIV
302+
select CRYPTO_LIB_MD5 # needed by lmk IV mode
302303
help
303304
This device-mapper target allows you to create a device that
304305
transparently encrypts the data on it. You'll need to activate
@@ -546,6 +547,7 @@ config DM_VERITY
546547
depends on BLK_DEV_DM
547548
select CRYPTO
548549
select CRYPTO_HASH
550+
select CRYPTO_LIB_SHA256
549551
select DM_BUFIO
550552
help
551553
This device-mapper target creates a read-only device that

drivers/md/dm-bufio.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1374,7 +1374,7 @@ static void submit_io(struct dm_buffer *b, enum req_op op, unsigned short ioprio
13741374
{
13751375
unsigned int n_sectors;
13761376
sector_t sector;
1377-
unsigned int offset, end;
1377+
unsigned int offset, end, align;
13781378

13791379
b->end_io = end_io;
13801380

@@ -1388,9 +1388,11 @@ static void submit_io(struct dm_buffer *b, enum req_op op, unsigned short ioprio
13881388
b->c->write_callback(b);
13891389
offset = b->write_start;
13901390
end = b->write_end;
1391-
offset &= -DM_BUFIO_WRITE_ALIGN;
1392-
end += DM_BUFIO_WRITE_ALIGN - 1;
1393-
end &= -DM_BUFIO_WRITE_ALIGN;
1391+
align = max(DM_BUFIO_WRITE_ALIGN,
1392+
bdev_physical_block_size(b->c->bdev));
1393+
offset &= -align;
1394+
end += align - 1;
1395+
end &= -align;
13941396
if (unlikely(end > b->c->block_size))
13951397
end = b->c->block_size;
13961398

drivers/md/dm-core.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ struct mapped_device {
139139
struct srcu_struct io_barrier;
140140

141141
#ifdef CONFIG_BLK_DEV_ZONED
142-
unsigned int nr_zones;
143142
void *zone_revalidate_map;
144143
struct task_struct *revalidate_map_task;
145144
#endif

0 commit comments

Comments
 (0)