lkml.org 
[lkml]   [2003]   [Apr]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Filesystem AIO read-write patches
On Thu, Apr 24, 2003 at 10:41:03AM +0530, Suparna Bhattacharya wrote:
> -void blk_congestion_wait(int rw, long timeout)
> +int blk_congestion_wait_wq(int rw, long timeout, wait_queue_t *wait)
> {
> - DEFINE_WAIT(wait);
> wait_queue_head_t *wqh = &congestion_wqh[rw];
> + DEFINE_WAIT(local_wait);
> +
> + if (!wait)
> + wait = &local_wait;
>
> blk_run_queues();
> - prepare_to_wait(wqh, &wait, TASK_UNINTERRUPTIBLE);
> + prepare_to_wait(wqh, wait, TASK_UNINTERRUPTIBLE);
> + if (!is_sync_wait(wait))
> + return -EIOCBRETRY;
> +
> io_schedule_timeout(timeout);
> - finish_wait(wqh, &wait);
> + finish_wait(wqh, wait);
> + return 0;
> +}
> +
> +void blk_congestion_wait(int rw, long timeout)
> +{
> + blk_congestion_wait_wq(rw, timeout, NULL);
> }

I don't like this one. DEFINE_WAIT allocates stuff on the stack.
And aio seems to allocate a lot more on the stack than normal io does.
How about the following instead:

int blk_congestion_wait_wq(int rw, long timeout, wait_queue_t *wait)
{
wait_queue_head_t *wqh = &congestion_wqh[rw];

blk_run_queues();
prepare_to_wait(wqh, wait, TASK_UNINTERRUPTIBLE);
if (!is_sync_wait(wait))
return -EIOCBRETRY;

io_schedule_timeout(timeout);
finish_wait(wqh, wait);
return 0;
}

void blk_congestion_wait(int rw, long timeout)
{
DEFINE_WAIT(wait);
blk_congestion_wait_wq(rw, timeout, &wait);
}

--
"It's not Hollywood. War is real, war is primarily not about defeat or
victory, it is about death. I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:34    [W:0.109 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site