linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/7] blk_end_request: add blk_rq_size() macros
@ 2007-08-31 22:41 Kiyoshi Ueda
  2007-09-03  7:45 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Kiyoshi Ueda @ 2007-08-31 22:41 UTC (permalink / raw)
  To: linux-kernel, linux-scsi, linux-ide, jens.axboe, mike.miller,
	grant.likely
  Cc: dm-devel

This patch adds macros to get the size of request in bytes.
They are useful because blk_end_request() takes bytes
as a completed I/O size instead of sectors.

Signed-off-by: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
---
 blkdev.h |    9 +++++++++
 1 files changed, 9 insertions(+)

diff -rupN 01-blkendreq-interface/include/linux/blkdev.h 02-sect2byte-macro/include/linux/blkdev.h
--- 01-blkendreq-interface/include/linux/blkdev.h	2007-08-23 17:22:50.000000000 -0400
+++ 02-sect2byte-macro/include/linux/blkdev.h	2007-08-23 17:25:59.000000000 -0400
@@ -737,6 +737,15 @@ extern void end_request(struct request *
 extern void blk_complete_request(struct request *);
 
 /*
+ * blk_end_request() takes bytes instead of sectors as a complete size.
+ * blk_rq_size() returns the entire size left to complete in the request.
+ * blk_rq_cur_size() returns the size left to complete in the current segment.
+ */
+#define sect2byte(nr_sectors) ((nr_sectors) << 9)
+#define blk_rq_size(rq) (sect2byte((rq)->hard_nr_sectors))
+#define blk_rq_cur_size(rq) (sect2byte((rq)->current_nr_sectors))
+
+/*
  * end_that_request_first/chunk() takes an uptodate argument. we account
  * any value <= as an io error. 0 means -EIO for compatability reasons,
  * any other < 0 value is the direct error type. An uptodate value of

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-09-03  7:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-31 22:41 [PATCH 2/7] blk_end_request: add blk_rq_size() macros Kiyoshi Ueda
2007-09-03  7:45 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).