@@ -820,24 +820,24 @@ void dm_table_set_type(struct dm_table *t, enum dm_queue_mode type)
820820EXPORT_SYMBOL_GPL (dm_table_set_type );
821821
822822/* validate the dax capability of the target device span */
823- int device_supports_dax (struct dm_target * ti , struct dm_dev * dev ,
823+ int device_not_dax_capable (struct dm_target * ti , struct dm_dev * dev ,
824824 sector_t start , sector_t len , void * data )
825825{
826826 int blocksize = * (int * ) data , id ;
827827 bool rc ;
828828
829829 id = dax_read_lock ();
830- rc = dax_supported (dev -> dax_dev , dev -> bdev , blocksize , start , len );
830+ rc = ! dax_supported (dev -> dax_dev , dev -> bdev , blocksize , start , len );
831831 dax_read_unlock (id );
832832
833833 return rc ;
834834}
835835
836836/* Check devices support synchronous DAX */
837- static int device_dax_synchronous (struct dm_target * ti , struct dm_dev * dev ,
838- sector_t start , sector_t len , void * data )
837+ static int device_not_dax_synchronous_capable (struct dm_target * ti , struct dm_dev * dev ,
838+ sector_t start , sector_t len , void * data )
839839{
840- return dev -> dax_dev && dax_synchronous (dev -> dax_dev );
840+ return ! dev -> dax_dev || ! dax_synchronous (dev -> dax_dev );
841841}
842842
843843bool dm_table_supports_dax (struct dm_table * t ,
@@ -854,7 +854,7 @@ bool dm_table_supports_dax(struct dm_table *t,
854854 return false;
855855
856856 if (!ti -> type -> iterate_devices ||
857- ! ti -> type -> iterate_devices (ti , iterate_fn , blocksize ))
857+ ti -> type -> iterate_devices (ti , iterate_fn , blocksize ))
858858 return false;
859859 }
860860
@@ -925,7 +925,7 @@ static int dm_table_determine_type(struct dm_table *t)
925925verify_bio_based :
926926 /* We must use this table as bio-based */
927927 t -> type = DM_TYPE_BIO_BASED ;
928- if (dm_table_supports_dax (t , device_supports_dax , & page_size ) ||
928+ if (dm_table_supports_dax (t , device_not_dax_capable , & page_size ) ||
929929 (list_empty (devices ) && live_md_type == DM_TYPE_DAX_BIO_BASED )) {
930930 t -> type = DM_TYPE_DAX_BIO_BASED ;
931931 }
@@ -1618,23 +1618,6 @@ static int device_dax_write_cache_enabled(struct dm_target *ti,
16181618 return false;
16191619}
16201620
1621- static int dm_table_supports_dax_write_cache (struct dm_table * t )
1622- {
1623- struct dm_target * ti ;
1624- unsigned i ;
1625-
1626- for (i = 0 ; i < dm_table_get_num_targets (t ); i ++ ) {
1627- ti = dm_table_get_target (t , i );
1628-
1629- if (ti -> type -> iterate_devices &&
1630- ti -> type -> iterate_devices (ti ,
1631- device_dax_write_cache_enabled , NULL ))
1632- return true;
1633- }
1634-
1635- return false;
1636- }
1637-
16381621static int device_is_rotational (struct dm_target * ti , struct dm_dev * dev ,
16391622 sector_t start , sector_t len , void * data )
16401623{
@@ -1839,15 +1822,15 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
18391822 }
18401823 blk_queue_write_cache (q , wc , fua );
18411824
1842- if (dm_table_supports_dax (t , device_supports_dax , & page_size )) {
1825+ if (dm_table_supports_dax (t , device_not_dax_capable , & page_size )) {
18431826 blk_queue_flag_set (QUEUE_FLAG_DAX , q );
1844- if (dm_table_supports_dax (t , device_dax_synchronous , NULL ))
1827+ if (dm_table_supports_dax (t , device_not_dax_synchronous_capable , NULL ))
18451828 set_dax_synchronous (t -> md -> dax_dev );
18461829 }
18471830 else
18481831 blk_queue_flag_clear (QUEUE_FLAG_DAX , q );
18491832
1850- if (dm_table_supports_dax_write_cache ( t ))
1833+ if (dm_table_any_dev_attr ( t , device_dax_write_cache_enabled ))
18511834 dax_write_cache (t -> md -> dax_dev , true);
18521835
18531836 /* Ensure that all underlying devices are non-rotational. */
0 commit comments