how to write get_block?

Mikulas Patocka (mikulas@artax.karlin.mff.cuni.cz)
Sat, 2 Oct 1999 23:14:04 +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?

Using bread/mark_buffer_dirty/brelse is bad idea - when the block is
read to page cache later, there are two buffers pointing to the same block
=> data corruption.

Calling page cache functions to create buffers? get_block is called from
page cache layer, thus calling anything from there makes possible deadlock
condition.

Modifying page cache directly ... black magic.

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)

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/