When did MINIX3 write back a block? - Minix

This is a discussion on When did MINIX3 write back a block? - Minix ; I read the OSDI book. One paragraph is about when the block is put back, whether the data is written back to the disk. It says there is a macro ROBUST, defining whethe inode and directory block will be written ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: When did MINIX3 write back a block?

  1. When did MINIX3 write back a block?

    I read the OSDI book. One paragraph is about when the block is put
    back, whether the data is written
    back to the disk. It says there is a macro ROBUST, defining whethe
    inode and directory block will be
    written back immediately. But I didn't see in the source code I get,
    which is 3.1.1.

    And I read the code.

    cache.c line 179

    /* Some blocks are so important (e.g., inodes, indirect blocks) that
    they
    * should be written to the disk immediately to avoid messing up the
    file
    * system in the event of a crash.
    */
    if ((block_type & WRITE_IMMED) && bp->b_dirt==DIRTY && bp->b_dev !=
    NO_DEV) {
    rw_block(bp, WRITING);
    }


    WRITE_IMMED has value 0100, but none of the block_type will give TRUE
    after
    ANDing it. But as the comment say, it write back the block immediatley.
    Which is
    causing my confusion.

    Is there anyone can explain to me?

    Or I should read the most updated source code?

    Kun


  2. Re: When did MINIX3 write back a block?

    I just found the answer in the OSDI book.

    "...the test for WRITE_IMMED is a vestige of an abandoned experiment;
    currently no blocks are marked for immediate writing."




  3. Re: When did MINIX3 write back a block?

    kun.hong.china@gmail.com wrote:
    > I read the OSDI book. One paragraph is about when the block is put
    > back, whether the data is written
    > back to the disk. It says there is a macro ROBUST, defining whethe
    > inode and directory block will be
    > written back immediately. But I didn't see in the source code I get,
    > which is 3.1.1.
    >
    > And I read the code.
    >
    > cache.c line 179
    >
    > /* Some blocks are so important (e.g., inodes, indirect blocks) that
    > they
    > * should be written to the disk immediately to avoid messing up the
    > file
    > * system in the event of a crash.
    > */
    > if ((block_type & WRITE_IMMED) && bp->b_dirt==DIRTY && bp->b_dev !=
    > NO_DEV) {
    > rw_block(bp, WRITING);
    > }
    >
    >
    > WRITE_IMMED has value 0100, but none of the block_type will give TRUE
    > after
    > ANDing it. But as the comment say, it write back the block immediatley.
    > Which is
    > causing my confusion.
    >
    > Is there anyone can explain to me?
    >
    > Or I should read the most updated source code?


    Maybe you should read old sources.
    From Minix 2.0.4 /usr/src/fs/buf.h

    /* When a block is released, the type of usage is passed to put_block(). */
    #define WRITE_IMMED 0100 /* block should be written to disk now */
    #define ONE_SHOT 0200 /* set if block not likely to be needed soon */

    #define INODE_BLOCK 0 /* inode block */
    #define DIRECTORY_BLOCK 1 /* directory block */
    #define INDIRECT_BLOCK 2 /* pointer block */
    #define MAP_BLOCK 3 /* bit map */
    #define ZUPER_BLOCK (4 + WRITE_IMMED + ONE_SHOT) /* super block */
    #define FULL_DATA_BLOCK 5 /* data, fully used */
    #define PARTIAL_DATA_BLOCK 6 /* data, partly used*/

    The definition of ZUPER_BLOCK disappeared from the sources of 3.1.x. so
    the sub expression (block_type & WRITE_IMMED) must be a leftover from
    old code.

    Ciao
    Giovanni
    --
    A computer is like an air conditioner,
    it stops working when you open Windows.
    Registered Linux user #337974 < http://giovanni.homelinux.net/ >

+ Reply to Thread