Linux-kernel mailing list archive 1999-20,: Re: ext2 question

# Re: ext2 question

Manfred Spraul (manfreds@colorfullife.com)
Tue, 18 May 1999 20:20:36 +0200

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Martin Lucina: "Re: Please test: New TGA Framebuffer Driver"
- Previous message: Riley Williams: "Re: A challenge to linux"
- Maybe in reply to: Manfred Spraul: "ext2 question"
- Next in thread: Manfred Spraul: "Re: ext2 question"

"Theodore Y. Ts'o" wrote:
>
> Huh? Can you give me a pointer to the Unix 95 specs which you're
> referring to?

I was talking about Windows 95.
Windows 95 has a 'large' kernel, e.g. swappable text segments for kernel
modules, many kernel data structures are allocated from pageable memory,
and the synchonization is (mostly) based on semaphores.
This means that the mmap() and swap-codepath must be able to page in/out
without using any other services.

> Now you need to somehow convert from an extent system to
> an indirect block system, which means blocking as you frantically try to
> create all of the necessary indirect and doubly indirect and triply
> indirect blocks.

No: use a mixed system:
currently: the first 12 blocks direct, then 256 blocks indirect,
then 65536 blocks indirect, etc.
you replace the constants 12, 256 with 2 variables, everything else
remains unchanged.

I though that:
You add 2 new flags to inode->i_flags:
- if 'direct is extent' set: the extents are stored in the inode.
During iget():
add the len fields; store the result as DIRECT_LEN in the memory inode.
if the flag is not set: DIRECT_LEN=12
- 'indirect is extent' set: as I explained, the number of blocks that
are stored in the indirect block in contained in the disk inode.
(INDIRECT_LEN)
otherwise: INDIRECT_LEN=256

all you have to do is make a few modification to ext2_bmap()
- if (blocknum < 12)
+ if (blocknum < DIRECT_LEN)
access direct
and
- blocknum -= 12;
+ blocknum -= DIRECT_LEN;
and
- if (blocknum < 256)
+ if (blocknum < INDIRECT_LEN)
access indirect
etc.

Overall, the required changes should be:
- every inode has third flag: 'extents possible':
(can be implemented as memory-only or stored on the disk)

- ext2_alloc_block:
if 'extents possible' & not spare:
add an extent;
otherwise:
clear 'extents possible',
start a new block group (i.e. switch from direct to
indirect or from indirect to double indirect);
use the current system.

- ext2_bmap: implement as explained above.

    --
    Manfred

    -
    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/

- Next message: Martin Lucina: "Re: Please test: New TGA Framebuffer Driver"
- Previous message: Riley Williams: "Re: A challenge to linux"
- Maybe in reply to: Manfred Spraul: "ext2 question"
- Next in thread: Manfred Spraul: "Re: ext2 question"