[linux-lvm] do not disable ext4 discards on first discard failure? [was: Re: dm snapshot: ignore discards issued to the snapshot-origin target]

Mike Snitzer snitzer at redhat.com
Mon May 2 14:58:11 UTC 2011


On Mon, May 02 2011 at 10:39am -0400,
Lukas Czerner <lczerner at redhat.com> wrote:

> On Mon, 2 May 2011, Martin K. Petersen wrote:
> 
> > >>>>> "Lukas" == Lukas Czerner <lczerner at redhat.com> writes:
> > 
> > Lukas> So I gave it a try. First of all the device composed of SSD and
> > Lukas> spinning disk does export discard_support information properly,
> > Lukas> however it also advertise discard_zeroes_data which is wrong and
> > Lukas> possibly dangerous and should be fixed!
> > 
> > I can't reproduce this here. If I mix discard and non-discard devices
> > things work correctly. discard_zeroes_data also gets cleared if I mix
> > discard-capable drives where one zeroes and one doesn't.
> > 
> > 
> 
> [root at trim ~]# hdparm -I /dev/sdb | grep -i trim
> [root at trim ~]# cat /sys/block/sdb/queue/discard_zeroes_data
> 0
> [root at trim ~]# hdparm -I /dev/sdd | grep -i trim
>            *    Data Set Management TRIM supported
>            *    Deterministic read after TRIM
> [root at trim ~]# cat /sys/block/sdd/queue/discard_zeroes_data 
> 1
> [root at trim ~]# pvcreate /dev/sdd1 
>   Physical volume "/dev/sdd1" successfully created
> [root at trim ~]# pvcreate /dev/sdb3 
>   Physical volume "/dev/sdb3" successfully created
> [root at trim ~]# vgcreate vg_test /dev/sdd1 /dev/sdb3 
>   Volume group "vg_test" successfully created
> [root at trim ~]# lvcreate -L 3500M vg_test
>   Logical volume "lvol0" created
> [root at trim ~]# ls -lah /dev/mapper/vg_test-lvol0 
> lrwxrwxrwx. 1 root root 7  2. kvě 10.30 /dev/mapper/vg_test-lvol0 -> ../dm-0
> [root at trim ~]# cat /sys/block/dm-0/queue/discard_zeroes_data 
> 1

Hmm, Strange considering DM just uses blk_stack_limits().

As Martin said, current blk_stack_limits() code is fine:
t->discard_zeroes_data &= b->discard_zeroes_data;

> So I assume it got fixes just recently ?. I'll give it a try with the
> up-to-date kernel.

Hasn't changed at all since it was introduced:
98262f2 v2.6.33-rc1 block: Allow devices to indicate whether discarded blocks are zeroed



More information about the linux-lvm mailing list