Commit 343eec3c authored by Benjamin LaHaise's avatar Benjamin LaHaise

Merge toomuch.toronto.redhat.com:/md0/linux-2.5

into toomuch.toronto.redhat.com:/md0/aio-2.5
parents f20bf018 264e7854
This diff is collapsed.
......@@ -176,29 +176,24 @@ static int aio_setup_ring(struct kioctx *ctx)
/* 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))
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;
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 AIO_EVENTS_OFFSET (AIO_EVENTS_PER_PAGE - 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; \
})
#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.
......@@ -557,7 +552,7 @@ int aio_complete(struct kiocb *iocb, long res, long res2)
iocb->ki_users--;
ret = (0 == iocb->ki_users);
spin_unlock_irq(&ctx->ctx_lock);
return 0;
return ret;
}
info = &ctx->ring_info;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment