From patchwork Thu Nov 10 10:34:47 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zheng Liu X-Patchwork-Id: 124845 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 D5DDC1007D1 for ; Thu, 10 Nov 2011 21:33:49 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752556Ab1KJKdr (ORCPT ); Thu, 10 Nov 2011 05:33:47 -0500 Received: from mail-yx0-f174.google.com ([209.85.213.174]:52220 "EHLO mail-yx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752512Ab1KJKdq (ORCPT ); Thu, 10 Nov 2011 05:33:46 -0500 Received: by yenr9 with SMTP id r9so1732105yen.19 for ; Thu, 10 Nov 2011 02:33:46 -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=5NqssgMvGtQD/6Jf6Qy5S98rbOg6PjY5yKuITwgMUQg=; b=u/8p9CCF5JjJgt1zJzwGdsxBFf/yTr3PxZcHZgfHopG+UFw2lZ6LicmJXThE4eu0FE /7994GedVucp6D2ks/S7GTqMiizBuADJWnWNiw7kFYhQ4oKmk3XrOJUV0WEL1/AlhRLr RxxT9kfvTeDKU4AvGTWADdQRwpbT/OdusryBM= Received: by 10.50.197.227 with SMTP id ix3mr7249325igc.51.1320921226082; Thu, 10 Nov 2011 02:33:46 -0800 (PST) Received: from localhost.localdomain ([182.92.247.2]) by mx.google.com with ESMTPS id fu10sm6077720igc.6.2011.11.10.02.33.43 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 10 Nov 2011 02:33:45 -0800 (PST) From: Zheng Liu To: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: Zheng Liu , Wang Shaoyan Subject: [PATCH v2 1/8] vfs: Add a new flag and related functions in buffer to count io types Date: Thu, 10 Nov 2011 18:34:47 +0800 Message-Id: <1320921294-30321-2-git-send-email-wenqing.lz@taobao.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1320921294-30321-1-git-send-email-wenqing.lz@taobao.com> References: <1320921294-30321-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 'Issue' flag is added into buffer_head to indicate that a request is issued to the disk. When an io doesn't hit page cache, 'Issue' flag will be set in submit_bh(). Filesystem can understand request is sent to the disk according to whether or not this flag is set. This flag will be cleared after filesystem tests it. If filesystem doesn't want to count the io type, it can ignore this flag. Signed-off-by: Zheng Liu Signed-off-by: Wang Shaoyan --- fs/buffer.c | 3 +++ include/linux/buffer_head.h | 5 +++++ 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index 70a1974..f681caa 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -2920,6 +2920,9 @@ int submit_bh(int rw, struct buffer_head * bh) BUG_ON(buffer_delay(bh)); BUG_ON(buffer_unwritten(bh)); + /* set issue flag for indicating a request is issued to the disk */ + set_buffer_issue(bh); + /* * Only clear out a write error when rewriting */ diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index 458f497..2bccdb4 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -38,6 +38,10 @@ enum bh_state_bits { BH_PrivateStart,/* not a state bit, but the first bit available * for private allocation by other entities */ + + BH_Issue, /* Issue a request to the disk when this request + * doesn't hit cache + */ }; #define MAX_BUF_PER_PAGE (PAGE_CACHE_SIZE / 512) @@ -124,6 +128,7 @@ BUFFER_FNS(Delay, delay) BUFFER_FNS(Boundary, boundary) BUFFER_FNS(Write_EIO, write_io_error) BUFFER_FNS(Unwritten, unwritten) +BUFFER_FNS(Issue, issue) #define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK) #define touch_buffer(bh) mark_page_accessed(bh->b_page)