block: Fix discard topology stacking and reporting
authorMartin K. Petersen <martin.petersen@oracle.com>
Wed, 18 May 2011 08:37:35 +0000 (10:37 +0200)
committerSteve Conklin <sconklin@canonical.com>
Fri, 15 Jul 2011 17:20:51 +0000 (12:20 -0500)
commit9335a6a2afb9512965e3f601b887fe00479d25f1
treeea90e59d7b1bafd03ffa6a0866a077694a379667
parent4282554cca2b15418db95c5e1c6e0ccfbddcde3b
block: Fix discard topology stacking and reporting

BugLink: http://bugs.launchpad.net/bugs/793702

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>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
block/blk-settings.c
block/blk-sysfs.c
include/linux/blkdev.h