block: Fix discard topology stacking and reporting
commit5d8ddba27676c7f753b01ac75f90ea90be0ffcea
authorMartin K. Petersen <martin.petersen@oracle.com>
Wed, 18 May 2011 08:37:35 +0000 (18 10:37 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 3 Jun 2011 01:33:44 +0000 (3 10:33 +0900)
tree6d9470748405d37ea71ceef1c94e95e71b9b641a
parentc63356c3ed12f1242ec7fb4b14a6a28b0e0c72a2
block: Fix discard topology stacking and reporting

commit a934a00a69e940b126b9bdbf83e630ef5fe43523 upstream.

In some cases we would end up stacking discard_zeroes_data incorrectly.
Fix this by enabling the feature by default for stacking drivers and
clearing it for low-level drivers. Incorporating a device that does not
support dzd will then cause the feature to be disabled in the stacking
driver.

Also ensure that the maximum discard value does not overflow when
exported in sysfs and return 0 in the alignment and dzd fields for
devices that don't support discard.

Reported-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Acked-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
block/blk-settings.c
block/blk-sysfs.c
include/linux/blkdev.h