[dm-devel] [PATCH] dm table: simplify discard support processing

Milan Broz mbroz at redhat.com
Thu Jul 14 15:43:47 UTC 2011


On 07/14/2011 04:30 PM, Mike Snitzer wrote:
> Remove 'discards_supported' from the dm_table structure.  The same
> information can be easily discovered from the table's target(s) in
> dm_table_supports_discards().
> 
> Also DMWARN if a target sets 'discards_supported' override but forgets
> to set 'num_discard_requests'.

Why not BUG_ON? It is bug in code on static attribute, isn't? :-)

> @@ -1426,6 +1422,9 @@ bool dm_table_supports_discards(struct dm_table *t)
>  	while (i < dm_table_get_num_targets(t)) {
>  		ti = dm_table_get_target(t, i++);
>  
> +		if (!ti->num_discard_requests)
> +			return 0;
> +		

>  		if (ti->discards_supported)
>  			return 1;

What if next target has ti->num_discard_requests = 0 here?
Shouldn't it loop through the all targets always?

Milan




More information about the dm-devel mailing list