public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jay Lan <jlan@engr.sgi.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: lse-tech <lse-tech@lists.sourceforge.net>,
	CSA-ML <csa@oss.sgi.com>, Andrew Morton <akpm@osdl.org>,
	Guillaume Thouvenin <guillaume.thouvenin@bull.net>,
	Tim Schmielau <tim@physik3.uni-rostock.de>,
	Arthur Corliss <corliss@digitalmages.com>
Subject: Re: [PATCH 2.6.9-rc2 1/2] enhanced I/O accounting data collection
Date: Mon, 27 Sep 2004 15:44:00 -0700	[thread overview]
Message-ID: <415897B0.3060008@engr.sgi.com> (raw)
In-Reply-To: <4158956F.3030706@engr.sgi.com>

[-- Attachment #1: Type: text/plain, Size: 95 bytes --]

1/2: acct_io

Enhanced I/O accounting data collection.

Signed-off-by: Jay Lan <jlan@sgi.com>


[-- Attachment #2: acct_io --]
[-- Type: text/plain, Size: 2404 bytes --]

Index: linux/drivers/block/ll_rw_blk.c
===================================================================
--- linux.orig/drivers/block/ll_rw_blk.c	2004-09-12 22:31:31.000000000 -0700
+++ linux/drivers/block/ll_rw_blk.c	2004-09-27 12:37:04.374234677 -0700
@@ -1741,6 +1741,7 @@
 {
 	DEFINE_WAIT(wait);
 	struct request *rq;
+	unsigned long start_wait = jiffies;
 
 	generic_unplug_device(q);
 	do {
@@ -1769,6 +1770,7 @@
 		finish_wait(&rl->wait[rw], &wait);
 	} while (!rq);
 
+	current->bwtime += (unsigned long) jiffies - start_wait;
 	return rq;
 }
 
Index: linux/fs/read_write.c
===================================================================
--- linux.orig/fs/read_write.c	2004-09-12 22:32:55.000000000 -0700
+++ linux/fs/read_write.c	2004-09-27 12:37:04.381070659 -0700
@@ -216,8 +216,11 @@
 				ret = file->f_op->read(file, buf, count, pos);
 			else
 				ret = do_sync_read(file, buf, count, pos);
-			if (ret > 0)
+			if (ret > 0) {
 				dnotify_parent(file->f_dentry, DN_ACCESS);
+				current->rchar += ret;
+			}
+			current->syscr++;
 		}
 	}
 
@@ -260,8 +263,11 @@
 				ret = file->f_op->write(file, buf, count, pos);
 			else
 				ret = do_sync_write(file, buf, count, pos);
-			if (ret > 0)
+			if (ret > 0) {
 				dnotify_parent(file->f_dentry, DN_MODIFY);
+				current->wchar += ret;
+			}
+			current->syscw++;
 		}
 	}
 
@@ -540,6 +546,10 @@
 		fput_light(file, fput_needed);
 	}
 
+	if (ret > 0) {
+		current->rchar += ret;
+	}
+	current->syscr++;
 	return ret;
 }
 
@@ -558,6 +568,10 @@
 		fput_light(file, fput_needed);
 	}
 
+	if (ret > 0) {
+		current->wchar += ret;
+	}
+	current->syscw++;
 	return ret;
 }
 
@@ -636,6 +650,13 @@
 
 	retval = in_file->f_op->sendfile(in_file, ppos, count, file_send_actor, out_file);
 
+	if (retval > 0) {
+		current->rchar += retval;
+		current->wchar += retval;
+	}
+	current->syscr++;
+	current->syscw++;
+
 	if (*ppos > max)
 		retval = -EOVERFLOW;
 
Index: linux/include/linux/sched.h
===================================================================
--- linux.orig/include/linux/sched.h	2004-09-27 11:57:40.220967100 -0700
+++ linux/include/linux/sched.h	2004-09-27 12:52:51.305237393 -0700
@@ -591,6 +591,9 @@
 	struct rw_semaphore pagg_sem;
 #endif
 
+/* i/o counters(bytes read/written, #syscalls, waittime */
+	unsigned long rchar, wchar, syscr, syscw, bwtime;
+
 };
 
 static inline pid_t process_group(struct task_struct *tsk)

  reply	other threads:[~2004-09-27 22:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-27 22:34 [PATCH 2.6.9-rc2 0/2] enhanced accounting data collection Jay Lan
2004-09-27 22:44 ` Jay Lan [this message]
2004-09-27 22:50 ` [PATCH 2.6.9-rc2 2/2] enhanced MM " Jay Lan
2004-09-28  9:33   ` Paul Jackson
2004-09-28 11:38     ` Robin Holt
2004-09-28 13:29       ` Paul Jackson
2004-09-28 14:34         ` Robin Holt
2004-10-02  0:38     ` [Lse-tech] " Jay Lan
  -- strict thread matches above, loose matches on Subject: below --
2004-09-28 15:21 [PATCH 2.6.9-rc2 1/2] enhanced I/O " Jens Axboe
2004-09-29 23:01 ` Jay Lan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=415897B0.3060008@engr.sgi.com \
    --to=jlan@engr.sgi.com \
    --cc=akpm@osdl.org \
    --cc=corliss@digitalmages.com \
    --cc=csa@oss.sgi.com \
    --cc=guillaume.thouvenin@bull.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lse-tech@lists.sourceforge.net \
    --cc=tim@physik3.uni-rostock.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox