Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941760AbcJSQKD (ORCPT ); Wed, 19 Oct 2016 12:10:03 -0400 Received: from g2t2352.austin.hpe.com ([15.233.44.25]:19905 "EHLO g2t2352.austin.hpe.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S938801AbcJSOVb (ORCPT ); Wed, 19 Oct 2016 10:21:31 -0400 From: Toshi Kani To: akpm@linux-foundation.org, dan.j.williams@intel.com Cc: david@fromorbit.com, viro@zeniv.linux.org.uk, ross.zwisler@linux.intel.com, linux-nvdimm@ml01.01.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Toshi Kani Subject: [PATCH v3 1/2] DAX: enable iostat for read/write Date: Wed, 19 Oct 2016 08:19:43 -0600 Message-Id: <1476886784-24644-2-git-send-email-toshi.kani@hpe.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1476886784-24644-1-git-send-email-toshi.kani@hpe.com> References: <1476886784-24644-1-git-send-email-toshi.kani@hpe.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1728 Lines: 57 DAX IO path does not support iostat, but its metadata IO path does. Therefore, iostat shows metadata IO statistics only, which has been confusing to users. Add iostat support to the DAX read/write path. Note, iostat still does not support the DAX mmap path as it allows user applications to access directly. Signed-off-by: Toshi Kani Cc: Andrew Morton Cc: Dan Williams Cc: Alexander Viro Cc: Dave Chinner Cc: Ross Zwisler --- fs/dax.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/fs/dax.c b/fs/dax.c index 014defd..2646969 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -265,9 +265,12 @@ ssize_t dax_do_io(struct kiocb *iocb, struct inode *inode, ssize_t retval = -EINVAL; loff_t pos = iocb->ki_pos; loff_t end = pos + iov_iter_count(iter); + struct gendisk *disk; + unsigned long start = 0; memset(&bh, 0, sizeof(bh)); bh.b_bdev = inode->i_sb->s_bdev; + disk = bh.b_bdev->bd_disk; if ((flags & DIO_LOCKING) && iov_iter_rw(iter) == READ) inode_lock(inode); @@ -276,8 +279,20 @@ ssize_t dax_do_io(struct kiocb *iocb, struct inode *inode, if (!(flags & DIO_SKIP_DIO_COUNT)) inode_dio_begin(inode); + if (blk_queue_io_stat(disk->queue)) { + int sec = iov_iter_count(iter) >> 9; + + start = jiffies; + generic_start_io_acct(iov_iter_rw(iter), + (!sec) ? 1 : sec, &disk->part0); + } + retval = dax_io(inode, iter, pos, end, get_block, &bh); + if (start) + generic_end_io_acct(iov_iter_rw(iter), + &disk->part0, start); + if ((flags & DIO_LOCKING) && iov_iter_rw(iter) == READ) inode_unlock(inode);