[lkml]   [1999]   [May]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: 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.
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
- blocknum -= 12;
+ blocknum -= DIRECT_LEN;
- if (blocknum < 256)
+ if (blocknum < INDIRECT_LEN)
access indirect

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;
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.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

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