public inbox for linux-integrity@vger.kernel.org
 help / color / mirror / Atom feed
* dm-integrity: 4k devices report 512b discard alignment
@ 2024-04-14  1:05 Eric Wheeler
  2024-04-14 15:43 ` Milan Broz
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Wheeler @ 2024-04-14  1:05 UTC (permalink / raw)
  To: linux-integrity

Hello all,

I'm not sure if this is a bug or a feature, so thought I'd report it.
These are all for Linux 6.6.26:

If you start with a 512-byte backing device (logical and physical):
  # blockdev --getss --getpbsz  /dev/nvme9n9
  512
  512

then format+open with 4k sectors:
  # integritysetup format -s 4096 /dev/nvme9n9
  # integritysetup open /dev/nvme9n9 integrity-nvme9n9

and find the dm-X device:
  # ls -l /dev/mapper/integrity-nvme9n9
  lrwxrwxrwx. 1 root root 9 Apr 13 17:09 /dev/mapper/integrity-nvme9n9 -> ../dm-189

then check it's discard_granularity, it shows 512:
  # tail /sys/block/dm-189/queue/discard_*
  ==> /sys/block/dm-189/queue/discard_granularity <==
  512

The sector size is 4k, so supporting unaligned discards seems at least
strange, if not invalid, and dmesg complains too:
  # blockdev --getss /dev/mapper/integrity-nvme9n9
  4096

Relatedly, should the physical size of an integrity volume "properly"
report 512 to match the backing device, or is 4k correct in this case?
Presently it reports 4k:
  # blockdev --getpbsz /dev/mapper/integrity-nvme2n1
  4096

Finally, this is what made me go investiage: when you issue `blkdiscard`
on the integrity volume:
  # blkdiscard /dev/mapper/integrity-nvme9n9

it causes dmesg spews the following:
[ 2508.364637] device-mapper: integrity: Bio not aligned on 8 sectors: 0x74ff8000, 0x7f0f
[ 2508.364856] device-mapper: integrity: Bio not aligned on 8 sectors: 0x74ffff16, 0xea
[ 2508.365070] device-mapper: integrity: Bio not aligned on 8 sectors: 0x757fff0e, 0x7
[ 2508.365973] device-mapper: integrity: Bio not aligned on 8 sectors: 0x757f8000, 0x7f0e

What do you think?


--
Eric Wheeler

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-04-15  1:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-14  1:05 dm-integrity: 4k devices report 512b discard alignment Eric Wheeler
2024-04-14 15:43 ` Milan Broz
2024-04-15  1:56   ` Eric Wheeler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox