Christoph Hellwig <hch@xxxxxxxxxxxxx> writes: > On Fri, Apr 14, 2023 at 01:26:38PM +0530, Ritesh Harjani wrote: >> How about this below change? Does this look good to you? >> It should cover all error types and both entry and exit. > > I don't think it is very useful. The complete tracepoint is the > end of the I/O. Having a separate end one doesn't make sense. > That's why I suggested a queued one for the asynchronous case. Ok, does this look good then? diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c index 36ab1152dbea..859efb5de1bf 100644 --- a/fs/iomap/direct-io.c +++ b/fs/iomap/direct-io.c @@ -130,6 +130,7 @@ ssize_t iomap_dio_complete(struct iomap_dio *dio) if (ret > 0) ret += dio->done_before; + trace_iomap_dio_complete(iocb, dio->error, ret); kfree(dio); return ret; @@ -650,8 +651,12 @@ __iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, */ dio->wait_for_completion = wait_for_completion; if (!atomic_dec_and_test(&dio->ref)) { - if (!wait_for_completion) - return ERR_PTR(-EIOCBQUEUED); + if (!wait_for_completion) { + ret = -EIOCBQUEUED; + trace_iomap_dio_rw_queued(iocb, iter, dio_flags, + done_before, ret); + return ERR_PTR(ret); + } for (;;) { set_current_state(TASK_UNINTERRUPTIBLE); -ritesh