mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
dm table: fix DAX iterate_devices based device capability checks
commit5b0fab5089upstream. Fix dm_table_supports_dax() and invert logic of both iterate_devices_callout_fn so that all devices' DAX capabilities are properly checked. Fixes:545ed20e6d("dm: add infrastructure for DAX support") Cc: stable@vger.kernel.org Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com> [jeffle: no dax synchronous] Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
adbe8d9d3d
commit
16ee4c4957
@@ -891,10 +891,10 @@ void dm_table_set_type(struct dm_table *t, enum dm_queue_mode type)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dm_table_set_type);
|
||||
|
||||
static int device_supports_dax(struct dm_target *ti, struct dm_dev *dev,
|
||||
static int device_not_dax_capable(struct dm_target *ti, struct dm_dev *dev,
|
||||
sector_t start, sector_t len, void *data)
|
||||
{
|
||||
return bdev_dax_supported(dev->bdev, PAGE_SIZE);
|
||||
return !bdev_dax_supported(dev->bdev, PAGE_SIZE);
|
||||
}
|
||||
|
||||
static bool dm_table_supports_dax(struct dm_table *t)
|
||||
@@ -910,7 +910,7 @@ static bool dm_table_supports_dax(struct dm_table *t)
|
||||
return false;
|
||||
|
||||
if (!ti->type->iterate_devices ||
|
||||
!ti->type->iterate_devices(ti, device_supports_dax, NULL))
|
||||
ti->type->iterate_devices(ti, device_not_dax_capable, NULL))
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1731,23 +1731,6 @@ static int device_dax_write_cache_enabled(struct dm_target *ti,
|
||||
return false;
|
||||
}
|
||||
|
||||
static int dm_table_supports_dax_write_cache(struct dm_table *t)
|
||||
{
|
||||
struct dm_target *ti;
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < dm_table_get_num_targets(t); i++) {
|
||||
ti = dm_table_get_target(t, i);
|
||||
|
||||
if (ti->type->iterate_devices &&
|
||||
ti->type->iterate_devices(ti,
|
||||
device_dax_write_cache_enabled, NULL))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static int device_is_rotational(struct dm_target *ti, struct dm_dev *dev,
|
||||
sector_t start, sector_t len, void *data)
|
||||
{
|
||||
@@ -1946,7 +1929,7 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
|
||||
else
|
||||
blk_queue_flag_clear(QUEUE_FLAG_DAX, q);
|
||||
|
||||
if (dm_table_supports_dax_write_cache(t))
|
||||
if (dm_table_any_dev_attr(t, device_dax_write_cache_enabled))
|
||||
dax_write_cache(t->md->dax_dev, true);
|
||||
|
||||
/* Ensure that all underlying devices are non-rotational. */
|
||||
|
||||
Reference in New Issue
Block a user