Bug#648367: device-mapper devices such as dm-crypt always have rotational=1; should inherit "rotational" setting from underlying devices
Quoted 16 lines · Josh Triplett
Source: linux-2.6
Version: 3.1.0-1~experimental.1
Severity: normalI use dm-crypt on my system, and I have an SSD. The underlying disk device, sda, has rotational=0:
~$ cat
/sys/block/sda/queue/rotational
0However, the device-mapper devices have rotational=1:
~$ head
/sys/block/dm-*/queue/rotational
==>/sys/block/dm-0/queue/rotational<==
1
Quoted 8 lines
==>
/sys/block/dm-1/queue/rotational<==
1==>
/sys/block/dm-2/queue/rotational<==
1The device-mapper devices should inherit the setting for "rotational" from their underlying devices.
I'm not sure that's true. Since their queues should feed into the queues for the underlying devices, it may be that they shouldn't themselves be scheduled as if they are rotating media.
I do wonder whether rotational should still be the default - almost all real disks are handled by a small number of drivers like sd, while there is a wide variety of networked, stacked and virtual disk drivers in use.
Ben.
Signature · 2 lines
Ben Hutchings The world is coming to an end. Please log off.
Quoted 23 lines · Ben Hutchings
Quoted 22 lines · Josh Triplett
Source: linux-2.6
Version: 3.1.0-1~experimental.1
Severity: normalI use dm-crypt on my system, and I have an SSD. The underlying disk device, sda, has rotational=0:
~$ cat
/sys/block/sda/queue/rotational
0However, the device-mapper devices have rotational=1:
~$ head
/sys/block/dm-*/queue/rotational
==>/sys/block/dm-0/queue/rotational<==
1==>
/sys/block/dm-1/queue/rotational<==
1==>
/sys/block/dm-2/queue/rotational<==
1
Quoted 6 lines
Quoted 2 lines
The device-mapper devices should inherit the setting for "rotational" from their underlying devices.
I'm not sure that's true. Since their queues should feed into the queues for the underlying devices, it may be that they shouldn't themselves be scheduled as if they are rotating media.
OK, I suppose I don't actually care what rotational shows for a device-mapper device backed by rotating media. The case I care about:
when the underlying media has rotational=0, the dm device definitely shouldn't have rotational=1.
- Josh Triplett
Quoted 4 lines · Josh Triplett
OK, I suppose I don't actually care what rotational shows for a device-mapper device backed by rotating media. The case I care about:
when the underlying media has rotational=0, the dm device definitely shouldn't have rotational=1.
Rotational flag is inherited in DM core, nothing dm-crypt specific. And it works (for several kernel releases already):
create test scsi disk (also with discards)
# modprobe scsi_debug dev_size_mb=16 sector_size=512 num_tgts=1 lbpu=1 # grep scsi_debug /sys/block/*/device/model /sys/block/sdj/device/model:scsi_debug
Map some crypt device over it
# echo "password" | cryptsetup create sdj_crypt /dev/sdj
And now see inherited ROTA flag (it is /sys rotational)
# lsblk -t /dev/sdj NAME ALIGNMENT MIN-IO OPT-IO PHY-SEC LOG-SEC ROTA SCHED RQ-SIZE sdj 0 512 32768 512 512 0 cfq 128 `-sdj_crypt (dm-0) 0 512 32768 512 512 0 128
Please paste lsblk -t output tree if you think there is a bug, do not blindly check all dm-X devices queues.
Milan
Bug#648367: [dm-devel] Bug#648367: device-mapper devices such as dm-crypt always have rotational=1; should inherit "rotational" setting from underlying devices
Quoted 20 lines · Milan Broz
Quoted 4 lines · Josh Triplett
OK, I suppose I don't actually care what rotational shows for a device-mapper device backed by rotating media. The case I care about:
when the underlying media has rotational=0, the dm device definitely shouldn't have rotational=1.Rotational flag is inherited in DM core, nothing dm-crypt specific. And it works (for several kernel releases already):
create test scsi disk (also with discards)
# modprobe scsi_debug dev_size_mb=16 sector_size=512 num_tgts=1 lbpu=1 # grep scsi_debug /sys/block/*/device/model /sys/block/sdj/device/model:scsi_debugMap some crypt device over it
# echo "password" | cryptsetup create sdj_crypt /dev/sdjAnd now see inherited ROTA flag (it is /sys rotational)
Quoted 8 lines
# lsblk -t /dev/sdj NAME ALIGNMENT MIN-IO OPT-IO PHY-SEC LOG-SEC ROTA SCHED RQ-SIZE sdj 0 512 32768 512 512 0 cfq 128 `-sdj_crypt (dm-0) 0 512 32768 512 512 0 128Please paste lsblk -t output tree if you think there is a bug, do not blindly check all dm-X devices queues.
I didn't know about that command; very nice, thanks! lsblk confirms that on my system, the physical disk has rotational=0 but the dm-crypt and LVM devices have rotational=1:
NAME ALIGNMENT MIN-IO OPT-IO PHY-SEC LOG-SEC ROTA SCHED
sda 0 512 0 512 512 0 cfq
├─sda1 0 512 0 512 512 0 cfq
└─sda2 0 512 0 512 512 0 cfq
└─sda2_crypt (dm-0) 0 512 0 512 512 1
├─leaf-swap (dm-1) 0 512 0 512 512 1
└─leaf-root (dm-2) 0 512 0 512 512 1 Does that help?
- Josh Triplett
Bug#648367: [dm-devel] Bug#648367: device-mapper devices such as dm-crypt always have rotational=1; should inherit "rotational" setting from underlying devices
Quoted 6 lines · Josh Triplett
I didn't know about that command; very nice, thanks! lsblk confirms that on my system, the physical disk has rotational=0 but the dm-crypt and LVM devices have rotational=1:
NAME ALIGNMENT MIN-IO OPT-IO PHY-SEC LOG-SEC ROTA SCHED
sda 0 512 0 512 512 0 cfq
Quoted 7 lines
├─sda1 0 512 0 512 512 0 cfq └─sda2 0 512 0 512 512 0 cfq └─sda2_crypt (dm-0) 0 512 0 512 512 1 ├─leaf-swap (dm-1) 0 512 0 512 512 1 └─leaf-root (dm-2) 0 512 0 512 512 1Does that help?
Thanks.
As noted on that bug earlier, it is already fixed in 3.2-rc1
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=4693c9668fdcec229825b3763876b4744f9e6d5e
(I thought it is fixed long time ago!)
There is no problem in DM layer with this (dmcrypt does not have own io scheduler) but perhaps FS can use this flag for some optimization tuning, dunno.
Milan