From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Chow Subject: Re: buffer head read/write Date: Wed, 11 Dec 2002 22:31:06 +0800 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <3DF74C2A.4080604@shaolinmicro.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Cc: linux-fsdevel@vger.kernel.org, Neil Brown Return-path: To: Bryan Henderson List-Id: linux-fsdevel.vger.kernel.org OK, I think you know what I want, and you've just told me this is impossible, then the best I could do is try to execute the task as best as the CPU can. This is stolen from Neils md super block writing routing that he just gave me a few days ago and merged with wait_for_complettion. Does this code make sense? static int sync_buffer_io(kdev_t dev, unsigned long sector, int size, struct page *page, int rw) struct buffer_head bh; struct completion event; init_completion(&event); init_buffer(&bh, bh_complete, &event); bh.b_rdev = dev; bh.b_rsector = sector; bh.b_state = (1 << BH_Req) | (1 << BH_Mapped); bh.b_size = size; bh.b_page = page; bh.b_reqnext = NULL; bh.b_data = page_address(page); generic_make_request(rw, &bh); run_task_queue(&tq_disk); spin_lock_irq(even.wait.lock); if (!event.done) { DECLARE_WAITQUEUE(wait, current); wait.flags |= WQ_FLAG_EXCLUSIVE; __add_wait_queue_tail(event.wait, &wait); do { __set_current_state(TASK_UNINTERRUPTIBLE); spin_unlock_irq(event.wait.lock); run_task_queue(&tq_disk); spin_lock_irq(event.wait.lock); } while (!x->done); __remove_wait_queue(event.wait, &wait); } event.done--; spin_unlock_irq(&x->wait.lock); return test_bit(BH_Uptodate, &bh.b_state); } This is dedicate to run the task of tq_disk instead of just schedule() which doesn't know which task is going to run. Please comment. Thanks. regards, David Bryan Henderson wrote: > > > > >>I know how to make a call to general_make_request() but >>wait for the buffer to complete which is too slow. >>If I am doing a continuous sychronous read/write ..., can I put those >> >> >"dirty > > >>buffers"/"non-up-to-date buffers" in the head of the buffer queue so >>that they get written by their respective handler immediately? >> >> > >"immediately" in computer systems normally means "while I wait" rather than >"before doing anything else." That's why you got a bunch of answers that >weren't what you were looking for. > >What you want is a way to assign priority to a block I/O request, so that >a particular one gets executed first regardless of other factors, like >that it's a mile away from where the head is now or 100 other requests >came in before it. There's no way to do priority in today's block I/O >layer. > >Incidentally, this has nothing to do with the buffer cache. The queue in >question is for all I/O to a block device; it is below the buffer cache. > > -- ----------------------------------------------------------------------------- David Chow | Managing Director http://www.shaolinmicro.com ShaoLin Microsystems - Multiply Efficiency -----------------------------------------------------------------------------