From patchwork Mon Nov 28 12:20:27 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zheng Liu X-Patchwork-Id: 127976 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 1A647B6F94 for ; Mon, 28 Nov 2011 23:18:54 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753613Ab1K1MSw (ORCPT ); Mon, 28 Nov 2011 07:18:52 -0500 Received: from mail-gy0-f174.google.com ([209.85.160.174]:36995 "EHLO mail-gy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753611Ab1K1MSv (ORCPT ); Mon, 28 Nov 2011 07:18:51 -0500 Received: by ghrr1 with SMTP id r1so5113378ghr.19 for ; Mon, 28 Nov 2011 04:18:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=2J8UQodPURJ/YXaxwOFsk69TIl4Ou60VzaukPQU5OxI=; b=rmPVNKioFGqIifjLKs6VVzIm1M2IYXAu3WUbxhAndqP10f180k+pbZHbTrMcsWfvLI 0bLgmoHksgK/Tf7pnOlgJW0PXuTrcd0YHNqGSnSWVYzm1Do5qZG+pR2dBUHdigfE+FQk zq3qiUDQnoBKqRDIqR1cwUbdwlaNa9SBRfv68= Received: by 10.50.185.138 with SMTP id fc10mr49421182igc.33.1322482730411; Mon, 28 Nov 2011 04:18:50 -0800 (PST) Received: from localhost.localdomain ([182.92.247.2]) by mx.google.com with ESMTPS id cb15sm40036924ibb.4.2011.11.28.04.18.47 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 28 Nov 2011 04:18:49 -0800 (PST) From: Zheng Liu To: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org Cc: Jens Axboe , Steven Whitehouse , Aditya Kali , Wang Shaoyan , Zheng Liu Subject: [PATCH v3 7/8] ext4: request accouting in direct io Date: Mon, 28 Nov 2011 20:20:27 +0800 Message-Id: <1322482828-5529-7-git-send-email-wenqing.lz@taobao.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1322482828-5529-1-git-send-email-wenqing.lz@taobao.com> References: <1322482392-5346-1-git-send-email-wenqing.lz@taobao.com> <1322482828-5529-1-git-send-email-wenqing.lz@taobao.com> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Zheng Liu ext4_ios_submit_io() function is defined to be called by __blockdev_direct_IO() to count direct io. CC: Jens Axboe CC: Steven Whitehouse CC: Aditya Kali Signed-off-by: Wang Shaoyan Signed-off-by: Zheng Liu --- fs/ext4/ext4.h | 2 ++ fs/ext4/indirect.c | 9 ++++++--- fs/ext4/inode.c | 13 ++++++++++++- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 6b90493..617be9f 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -1919,6 +1919,8 @@ extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf); extern qsize_t *ext4_get_reserved_space(struct inode *inode); extern void ext4_da_update_reserve_space(struct inode *inode, int used, int quota_claim); +extern void ext4_ios_submit_io(int rw, struct bio *bio, + struct inode *inode, loff_t file_offset); /* indirect.c */ extern int ext4_ind_map_blocks(handle_t *handle, struct inode *inode, diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c index dc5046b..c3318df 100644 --- a/fs/ext4/indirect.c +++ b/fs/ext4/indirect.c @@ -821,10 +821,13 @@ retry: ret = __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov, offset, nr_segs, - ext4_get_block, NULL, NULL, 0); + ext4_get_block, NULL, ext4_ios_submit_io, 0); } else { - ret = blockdev_direct_IO(rw, iocb, inode, iov, - offset, nr_segs, ext4_get_block); + ret = __blockdev_direct_IO(rw, iocb, inode, + inode->i_sb->s_bdev, iov, + offset, nr_segs, + ext4_get_block, NULL, ext4_ios_submit_io, + DIO_LOCKING | DIO_SKIP_HOLES); if (unlikely((rw & WRITE) && ret < 0)) { loff_t isize = i_size_read(inode); diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 3cd862d..2a2fa16 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -2962,7 +2962,7 @@ static ssize_t ext4_ext_direct_IO(int rw, struct kiocb *iocb, offset, nr_segs, ext4_get_block_write, ext4_end_io_dio, - NULL, + ext4_ios_submit_io, DIO_LOCKING | DIO_SKIP_HOLES); if (iocb->private) EXT4_I(inode)->cur_aio_dio = NULL; @@ -3003,6 +3003,17 @@ static ssize_t ext4_ext_direct_IO(int rw, struct kiocb *iocb, return ext4_ind_direct_IO(rw, iocb, iov, offset, nr_segs); } +void ext4_ios_submit_io(int rw, struct bio *bio, + struct inode *inode, loff_t file_offset) +{ + int tmprw = !!rw; + + /* ext4 io type accouting */ + __ext4_io_stat(inode->i_sb, tmprw, EXT4_IOS_REGULAR_DATA, + ext4_blocks_per_page(inode)); + submit_bio(rw, bio); +} + static ssize_t ext4_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_t offset, unsigned long nr_segs)