Re: how to write get_block?

Mikulas Patocka (mikulas@artax.karlin.mff.cuni.cz)
Fri, 8 Oct 1999 15:17:36 +0200 (CEST)


> > Hi.
> >
> > I'm porting my HPFS driver to 2.3.18 and I don't know how to write
> > get_block properly. When user does lseek(far beyond file end) and
> > write(), get_block must allocate a lot of sectors and clear them (HPFS
> > doesn't support holes). The question is: what call should I use to
> > clear these sectors?
>
> Use the (fixed) variant of FAT code. I.e block_write_cont_page() +
> equivalent of fat_write_partial_page().

The only thing this function needs from fat filesystem is i_realsize. What
about to replace i_realsize with i_size (I guess they have identical
values at the beginning) and move it to /fs/buffer.c to let other
filesystems use it?

> > What should I do with it? Is there any function that I didn't notice? Of
> > course I could write routines to directly touch page cache and attach
> > buffer there, but I think it's dirty. Especially when other filesystem
> > also need to do the same (fat currently crashes when writing beyond file
> > end, other filesystems aren't ported yet)
>
> FAT should be OK now.

How do you manage freeing buffers on rmdir? I don't see any bforget there.
If you don't free buffers pointing to deallocated space, it can cause data
corruption.

Mikulas Patocka

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