public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] RAMFS problem
@ 2001-07-20  9:59 Richard Panton
  2001-07-25 22:44 ` Jonathan Larmour
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Panton @ 2001-07-20  9:59 UTC (permalink / raw)
  To: ecos discussion list

It seems that ramfs is failing for files bigger than 0x8800 bytes (using
the default configuration).

When the fault occurs:
	All 8 direct blocks are full.
	The indirect block points to:
		All 64 direct pointers used.
	The indirect2 block points to:
		Indirect block points to:
			All 64 direct pointers used.

When an attempt is made to write to node->indirect2->indirect[1]->data, a
data fault occurs.

I think to fix this requires a change to findbuffer_indirect1():
Index: ramfs.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/ram/current/src/ramfs.c,v
retrieving revision 1.1
diff -r1.1 ramfs.c
777c777
<     err = findbuffer_direct( bi,
---
>     err = findbuffer_direct( bi * CYGNUM_RAMFS_BLOCK_SIZE,

===================================================================

Without the multiplier, bi (used here as an offset rather than a block
number) can range from 0 to CYGNUM_RAMFS_BLOCK_SIZE - 1

This ALWAYS falls inside the first (indirect) block, so the reference
later on in the function to blocks[bi] refers to an unassigned block.

(Also, at line 726, shouldn't that be:

if ( bi >= nblocks )

rather than

if ( bi > nblocks )

?????)

There's probably a similar sort of fix required in findbuffer_indirect2(),
but my head hurts enough already after trying to trace this through....

Nick, your name's on this one...

Best Regards,
Richard

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ECOS] RAMFS problem
  2001-07-20  9:59 [ECOS] RAMFS problem Richard Panton
@ 2001-07-25 22:44 ` Jonathan Larmour
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Larmour @ 2001-07-25 22:44 UTC (permalink / raw)
  To: Richard Panton; +Cc: ecos discussion list

Richard Panton wrote:
> [ramfs problems]
> When an attempt is made to write to node->indirect2->indirect[1]->data, a
> data fault occurs.
> 
> I think to fix this requires a change to findbuffer_indirect1():
> Index: ramfs.c
> ===================================================================
> RCS file: /cvs/ecos/ecos/packages/fs/ram/current/src/ramfs.c,v
> retrieving revision 1.1
> diff -r1.1 ramfs.c
> 777c777
> <     err = findbuffer_direct( bi,
> ---
> >     err = findbuffer_direct( bi * CYGNUM_RAMFS_BLOCK_SIZE,
> 
> ===================================================================
> 
> Without the multiplier, bi (used here as an offset rather than a block
> number) can range from 0 to CYGNUM_RAMFS_BLOCK_SIZE - 1
> 
> This ALWAYS falls inside the first (indirect) block, so the reference
> later on in the function to blocks[bi] refers to an unassigned block.

It took me a while to psych myself up to look at this. And now my head
hurts too :-). But yes I agree with you - that's exactly what's required
from what I can tell.

> (Also, at line 726, shouldn't that be:
> 
> if ( bi >= nblocks )
> 
> rather than
> 
> if ( bi > nblocks )
> 
> ?????)

Yep.
 
> There's probably a similar sort of fix required in findbuffer_indirect2(),

Exactly the same I believe, i.e. * CYGNUM_RAMFS_BLOCK_SIZE.

> but my head hurts enough already after trying to trace this through....

I now know why :).
 
> Nick, your name's on this one...

Nick's on holiday. I've checked in the changes as described.

Jifl
-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine
Come to the Red Hat TechWorld open source conference in Brussels!
Keynotes, techie talks and exhibitions    http://www.redhat-techworld.com/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-07-25 22:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-20  9:59 [ECOS] RAMFS problem Richard Panton
2001-07-25 22:44 ` Jonathan Larmour

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).