On Thu, Dec 06, 2018 at 08:06:16AM -0800, Bart Van Assche wrote:
> On Wed, 2018-12-05 at 22:59 +0800, Weiping Zhang wrote:
> > Weiping Zhang <zwp10...@gmail.com> 于2018年12月5日周三 下午10:49写道:
> > > Christoph Hellwig <h...@infradead.org> 于2018年12月5日周三 下午10:40写道:
> > > > Can you please also send a patch to not show this attribute for
> > > > drivers without a timeout handler?  Thanks!
> > 
> > Is there a simple way do that ?
> 
> How about checking the timeout member of struct blk_mq_ops for blk-mq and
> checking the rq_timed_out_fn member in struct request_queue for the legacy
> block layer?

Just the former given that the legacy code is gone in for-next.

> > Shall we return -ENOTSUPP when user read/write this attribute when
> > driver has no timeout handler ?
> 
> A much more elegant solution is to introduce a sysfs attribute group for the
> io_timeout attribute and to make that group visible only if a timeout handler
> has been defined. See e.g. disk_attr_group in block/genhd.c for an example.

Agreed, that is the way to go.

Reply via email to