Re: Re: block allocation in ext2fs

From: animesh_singh@bbv.satyam.com
Date: Tue May 09 2000 - 00:31:11 EST


hi
        very true i missed out a few more details , the buffer block after
being marked uptodate is also required to wake up any process sleeping on
its wait queue this is done by execution of b_end_io function in the
buffer head (ll_rw_blk) but this is all done only when the buffer block
has been flushed by bdflush or sync command line(this generates request
for the under laying disk driver by make_request) and successfully written
on the disk.
        a very simple solution for your problem can be one of these
1. you don't allow your buffer block to be ever processed by ll_rw_blk
function hence always mark it uptodate , wake up all waiting process and
not dirty
2. you trap the request call at disk driver level(this is fairly easy) and
don't allow the block to be written but call end_request(1)(this does
everything for you) without executing the real request function of the
disk driver thus data is never written

regards Animesh

 
On Mon, 8 May 2000, BenHanokh Gabriel wrote:

> hi
>
> i'm not sure that what you wrote answer my question.
> what i'm trying to do is ask ext2fs to allocate blocks for me( using
> ext2_getblk() ), but ignore the zeros it filled the buffer cache, by
> simply disposing the returned buffer head.
>
> i don't won't this buffer head ever writen to the disk, and i wont to
> clear this buffer head as not to trash all other processes cache( i'm
> alloacting very big files ).
>
> as far as i understand
> the call mark_buffer_uptodate( bh ), just used to say that buffer
> content is the most recent.
> and the release( bh ) is used to get the buffer free, and for this it
> will first WRITE its content to the disk.
>
> i think a better soultion will be this sequance of calls
>
> ---------------- BEGIN -------------------------
> /*
> * alloacte the block, and get a buffer_head mapped to this block
> filled with zeros
> bh = ext2_getblk(...);
>
> /*
> * now the buffer should never be written to disk
> */
> mark_buffer_clean( bh );
>
> /*
> * release the buffer, and append it to the free list
> */
> bforget( bh )
>
> ------------------ END ----------------------------------
>
> please tell me what you think of this code, did i undersand the buffer
> cache mechanism or that i'm making a big mess of it.
>
> please let me know if there is any book or paper covering the buffer
> cache issue in linux
>
> THX
> /gaby
>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon May 15 2000 - 21:00:12 EST