Weiping Zhang <zwp10758@xxxxxxxxx> 于2018年12月5日周三 下午10:49写道: > > Christoph Hellwig <hch@xxxxxxxxxxxxx> 于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 ? Shall we return -ENOTSUPP when user read/write this attribute when driver has no timeout handler ? > Do you means checking q->mq_ops->timeout is NULL or not ? > > static void blk_mq_rq_timed_out(struct request *req, bool reserved) > { > req->rq_flags |= RQF_TIMED_OUT; > If it's NULL, only re-start a timer for this request in blk_add_timer. > Is there some defect ? if show this attribute and the driver doesn't > support timeout handler ? > > if (req->q->mq_ops->timeout) { > enum blk_eh_timer_return ret; > > ret = req->q->mq_ops->timeout(req, reserved); > if (ret == BLK_EH_DONE) > return; > WARN_ON_ONCE(ret != BLK_EH_RESET_TIMER); > } > > blk_add_timer(req); > } > > > > On Wed, Dec 05, 2018 at 10:17:06PM +0800, Weiping Zhang wrote: > > > Add documentation for /sys/block/<disk>/queue/io_timeout. > > > > > > Signed-off-by: Weiping Zhang <zhangweiping@xxxxxxxxxxxxxx> > > > --- > > > Documentation/ABI/testing/sysfs-block | 10 ++++++++++ > > > Documentation/block/queue-sysfs.txt | 7 +++++++ > > > 2 files changed, 17 insertions(+) > > > > > > diff --git a/Documentation/ABI/testing/sysfs-block b/Documentation/ABI/testing/sysfs-block > > > index dea212db9df3..f254a374710a 100644 > > > --- a/Documentation/ABI/testing/sysfs-block > > > +++ b/Documentation/ABI/testing/sysfs-block > > > @@ -271,3 +271,13 @@ Description: > > > size of 512B sectors of the zones of the device, with > > > the eventual exception of the last zone of the device > > > which may be smaller. > > > + > > > +What: /sys/block/<disk>/queue/io_timeout > > > +Date: November 2018 > > > +Contact: Weiping Zhang <zhangweiping@xxxxxxxxxxxxxx> > > > +Description: > > > + io_timeout is a request’s timeouts at block layer in > > > + milliseconds. When the underlying driver starts processing > > > + a request, the generic block layer will start a timer, if > > > + this request cannot be completed in io_timeout milliseconds, > > > + a timeout event will occur. > > > diff --git a/Documentation/block/queue-sysfs.txt b/Documentation/block/queue-sysfs.txt > > > index 2c1e67058fd3..f0c9bbce73fd 100644 > > > --- a/Documentation/block/queue-sysfs.txt > > > +++ b/Documentation/block/queue-sysfs.txt > > > @@ -67,6 +67,13 @@ If set to a value larger than 0, the kernel will put the process issuing > > > IO to sleep for this amont of microseconds before entering classic > > > polling. > > > > > > +io_timeout (RW) > > > +--------------- > > > +This is a request’s timeouts at block layer in milliseconds. When the > > > +underlying driver starts processing a request, the generic block layer > > > +will start a timer, if this request cannot be completed in io_timeout > > > +milliseconds, a timeout event will occur. > > > + > > > iostats (RW) > > > ------------- > > > This file is used to control (on/off) the iostats accounting of the > > > -- > > > 2.14.1 > > > > > ---end quoted text---