I'm writing a file system and I'm having a bit of trouble understanding what I need to do to get my FS to write a file to the disk. >From what I gather, when I try to copy a file to my FS the sequence of events that occurs is this: 1. lookup() called to ensure the file I'm creating doesnt already exist. 2. create() is called to create a new inode with given name. 3. create() indirectly calls alloc_inode() to make a new inode for the new file. 4. prepare_write() is called. I think I've done lookup, create, and alloc_inode somewhat correctly. What I do not understand is prepare_write() What is it supposed to do? Also, what is get_block() supposed to do? for reference: int bfs_get_block(struct inode * inode, sector_t block, struct buffer_head * bh_result, int create) Taking a look at bfs_get_block, and reading some information I found on the web, I gather that I am supposed to be looking for a specific block in a specific file. I should be looking for the nth block in the file where n is given by the variable 'block'. I also gather that if 'create' is non-zero and I do not find the given block because it is at the end of the file, I should extend the file so that it includes the request block?? I wrote prepare_write by following BFS's code and it just calls block_prepare_write and passes get_block as the last parameter. So get_block gets called. When get_block gets called via prepare_write, since my inode (for some reason) does not seem to exist on the disk yet, I cannot step through my on-disk inode list and find the inode given by the 'inode' argument to the get_block function. Should my new inode exist on the disk yet? In the situation above, what am I supposed to do in get_block?? Should I allocate a block for this file and initialize the bh_result argument to get_block? Thanks for taking the time to read all this. Sorry if its incoherent. :-/ -- Jason J. Herne <hernejj@xxxxxxxxxxxx> -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/