Skip to contentSkip to conversation

dm-era over mdadm raid5 loses discard support

dm-devel [email protected] 1 participant 3 messages Nov 19, 2021 Device mapper

lore
Share & tools
lore
#0 lore raw

Hi!

A dm-era device created over a RAID5 array loses discard support.

Test script is attached.

If you run it on SSD you'll see something like:

loop0 4096
loop1 4096
loop2 4096
loop3 4096
md55 1048576
loop_test_era 0

I.e. mdadm device supports discard, but dm-era device started over it doesn't.

If you create a dm-era device over a normal block device without mdadm RAID5 or even over mdadm RAID1 - it will preserve discard support.

Why? How can it be fixed?

Signature · 2 lines
With best regards,
  Vitaliy Filippov

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel

#1 lore raw

Even worse, dm-linear has the same problem.

dm-linear over mdadm RAID5 doesn't support discard while mdadm device itself supports it.

Quoted 15 lines

Hi!

A dm-era device created over a RAID5 array loses discard support.

Test script is attached.

If you run it on SSD you'll see something like:

loop0 4096
loop1 4096
loop2 4096
loop3 4096
md55 1048576
loop_test_era 0

Quoted 15 lines

I.e. mdadm device supports discard, but dm-era device started over it doesn't.

If you create a dm-era device over a normal block device without mdadm RAID5 or even over mdadm RAID1 - it will preserve discard support.

Why? How can it be fixed?

Signature · 7 lines
With best regards,
Vitaliy Filippov

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel

#2 lore raw

Hi

Just to note, the problem is solved by setting raid456.devices_handle_discard_safely=Y in kernel command line.

It seems that dm-table.c checks for blk_queue_discard() of underlying devices and RAID5 device has the QUEUE_FLAG_DISCARD unset and at the same time discard_granularity != 0. So discards actually work even without raid456.devices_handle_discard_safely=Y, but aren't passed via the DM device.

Quoted 35 lines

Even worse, dm-linear has the same problem.

dm-linear over mdadm RAID5 doesn't support discard while mdadm device itself supports it.

Quoted 22 lines

Hi!

A dm-era device created over a RAID5 array loses discard support.

Test script is attached.

If you run it on SSD you'll see something like:

loop0 4096
loop1 4096
loop2 4096
loop3 4096
md55 1048576
loop_test_era 0

I.e. mdadm device supports discard, but dm-era device started over it doesn't.

If you create a dm-era device over a normal block device without mdadm RAID5 or even over mdadm RAID1 - it will preserve discard support.

Why? How can it be fixed?

Quoted 8 lines

--
With best regards,
Vitaliy Filippov

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel

Quoted 4 lines

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel