Re: get_block after EOF

From: Josef Moellers (josef.moellers_at_fujitsu-siemens.com)
Date: 12/06/04


Date: Mon, 06 Dec 2004 16:24:02 +0100

Kasper Dupont wrote:
> I have a file system that is implemented using a
> get_block function. How should such a get_block
> function behave if given a block number outside
> the file? Right now my get_block function is
> probably going to return garbage if that happens.
>
> What is the right way to behave? I can think of a
> few different possibilities.
>
> - Return 0 without calling map_bh
> - Return -EIO
> - Print an error message to the kernel log and
> return -EIO
> - BUG
> - Panic
>

It depends ...

If this Should Not Happen, then Panic would be The Right Thing (BUG
might only kill the current thread who may or may not be responsible for
the mishap).
If this might happen, return 0, but print an error message to the log.

EIO means that some IO error has taken place. Being requested to read a
(logically) non-existent block is no IO error.

-- 
Josef Möllers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett


Relevant Pages

  • RE: XP wont boot
    ... Error Message When You Restart Your Computer or Upgrade to Windows XP ... • The file system is damaged and cannot be mounted. ... Note that a variety of issues can cause file system damage, ...
    (microsoft.public.windowsxp.general)
  • Re: system32.exe
    ... Remove remnants of KWBot.Worm from the Registry and File System ... This worm causes an error message that "CMD32.EXE" cannot be found on startup. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: Harddrive not recognized
    ... Just tried the sharing: I get an error message: 'The ... volume des not contain a recognized file system. ... >- When you boot your disk with a win98 boot disk from ...
    (microsoft.public.win2000.hardware)
  • Re: Moving Files over the network through a program
    ... MoveFilecannot move a directory to a different file system or volume. ... > LPVOID lpMsgBuf; ... > I get an error message usually saying access denied. ... > RussR ...
    (microsoft.public.windowsxp.embedded)
  • get_block after EOF
    ... I have a file system that is implemented using a ... function behave if given a block number outside ... Print an error message to the kernel log and ... Kasper Dupont ...
    (comp.os.linux.development.system)