From: Benjamin LaHaise <bcrl@redhat.com>
To: Linus Torvalds <torvalds@transmeta.com>,
Linux Kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] compile fix for fs/aio.c on non-highmem systems
Date: Mon, 26 Aug 2002 17:53:22 -0400 [thread overview]
Message-ID: <20020826175322.B6178@redhat.com> (raw)
Hello,
Patrik Mochel noticed that fs/aio.c doesn't compile on a non-highmem config.
The patch below (and in the bk tree on master.kernel.org:/home/bcrl/aio-2.5)
fixes that by making the helper functions #defines, and should also be a
bit faster.
-ben
:r ~/patches/v2.5.31-aio-nohighmem.diff
diff -urN linux-2.5/fs/aio.c linux-2.5.aio/fs/aio.c
--- linux-2.5/fs/aio.c Mon Aug 26 17:03:12 2002
+++ linux-2.5.aio/fs/aio.c Mon Aug 26 17:42:54 2002
@@ -174,29 +174,24 @@
/* 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();
*/
-static inline struct io_event *aio_ring_event(struct aio_ring_info *info, int nr, enum km_type km)
-{
- struct io_event *events;
#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)
- if (nr < AIO_EVENTS_FIRST_PAGE) {
- struct aio_ring *ring;
- ring = kmap_atomic(info->ring_pages[0], km);
- return &ring->io_events[nr];
- }
- nr -= AIO_EVENTS_FIRST_PAGE;
+#define aio_ring_event(info, nr, km) ({ \
+ unsigned pos = (nr) + AIO_EVENTS_OFFSET; \
+ struct io_event *__event; \
+ __event = kmap_atomic( \
+ (info)->ring_pages[pos / AIO_EVENTS_PER_PAGE], km); \
+ __event += pos % AIO_EVENTS_PER_PAGE; \
+ __event; \
+})
- events = kmap_atomic(info->ring_pages[1 + nr / AIO_EVENTS_PER_PAGE], km);
-
- return events + (nr % AIO_EVENTS_PER_PAGE);
-}
-
-static inline void put_aio_ring_event(struct io_event *event, enum km_type km)
-{
- void *p = (void *)((unsigned long)event & PAGE_MASK);
- kunmap_atomic(p, km);
-}
+#define put_aio_ring_event(event, km) do { \
+ struct io_event *__event = (event); \
+ (void)__event; \
+ kunmap_atomic((void *)((unsigned long)__event & PAGE_MASK), km); \
+} while(0)
/* ioctx_alloc
* Allocates and initializes an ioctx. Returns an ERR_PTR if it failed.
next reply other threads:[~2002-08-26 21:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-26 21:53 Benjamin LaHaise [this message]
2002-08-30 23:21 ` [PATCH] compile fix for fs/aio.c on non-highmem systems David S. Miller
2002-08-30 23:42 ` Linus Torvalds
2002-08-30 23:36 ` David S. Miller
2002-09-03 17:06 ` Benjamin LaHaise
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=20020826175322.B6178@redhat.com \
--to=bcrl@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.