mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Chen, Kenneth W" <kenneth.w.chen@intel.com>
To: "'Zach Brown'" <zach.brown@oracle.com>,
	"'Suparna Bhattacharya'" <suparna@in.ibm.com>,
	"Lahaise, Benjamin C" <benjamin.c.lahaise@intel.com>
Cc: <linux-kernel@vger.kernel.org>, "'linux-aio'" <linux-aio@kvack.org>
Subject: [patch] clarify AIO_EVENTS_OFFSET constant
Date: Thu, 12 Oct 2006 17:00:24 -0700	[thread overview]
Message-ID: <000301c6ee5a$9dfae250$db34030a@amr.corp.intel.com> (raw)

A clean up patch: I think it is a lot easier to read AIO_EVENTS_OFFSET
as an offset because of aio_ring at the beginning of a head page, instead
of doing arithmetic of (event on 2nd page - event on 1st page).


Signed-off-by: Ken Chen <kenneth.w.chen@intel.com>


diff -Nurp linux-2.6.18/fs/aio.c linux-2.6.18.ken/fs/aio.c
--- linux-2.6.18/fs/aio.c	2006-09-19 20:42:06.000000000 -0700
+++ linux-2.6.18.ken/fs/aio.c	2006-10-12 13:33:09.000000000 -0700
@@ -173,9 +173,8 @@ static int aio_setup_ring(struct kioctx 
 /* aio_ring_event: returns a pointer to the event at the given index from
  * kmap_atomic(, km).  Release the pointer with put_aio_ring_event();
  */
-#define AIO_EVENTS_PER_PAGE	(PAGE_SIZE / sizeof(struct io_event))
-#define AIO_EVENTS_FIRST_PAGE	((PAGE_SIZE - sizeof(struct aio_ring)) / sizeof(struct io_event))
-#define AIO_EVENTS_OFFSET	(AIO_EVENTS_PER_PAGE - AIO_EVENTS_FIRST_PAGE)
+#define AIO_EVENTS_PER_PAGE  (PAGE_SIZE / sizeof(struct io_event))
+#define AIO_EVENTS_OFFSET    (sizeof(struct aio_ring) / sizeof(struct io_event))
 
 #define aio_ring_event(info, nr, km) ({					\
 	unsigned pos = (nr) + AIO_EVENTS_OFFSET;			\


             reply	other threads:[~2006-10-13  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-13  0:00 Chen, Kenneth W [this message]
2006-10-13 14:22 ` Benjamin LaHaise
2006-10-13 20:38   ` Chen, Kenneth W

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='000301c6ee5a$9dfae250$db34030a@amr.corp.intel.com' \
    --to=kenneth.w.chen@intel.com \
    --cc=benjamin.c.lahaise@intel.com \
    --cc=linux-aio@kvack.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=suparna@in.ibm.com \
    --cc=zach.brown@oracle.com \
    /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

all inboxes | Powered by JetHome®