Re: [PATCH 5/9] writeback: introduce the pageout work

From: Artem Bityutskiy
Date: Mon Mar 12 2012 - 08:33:35 EST


On Fri, 2012-03-09 at 22:11 +0100, Jan Kara wrote:
> On Fri 09-03-12 18:10:51, Artem Bityutskiy wrote:
> > On Fri, 2012-03-09 at 10:51 +0100, Jan Kara wrote:
> > > > However I cannot find any ubifs functions to form the above loop, so
> > > > ubifs should be safe for now.
> > > Yeah, me neither but I also failed to find a place where
> > > ubifs_evict_inode() truncates inode space when deleting the inode... Artem?
> >
> > We do call 'truncate_inode_pages()':
> >
> > static void ubifs_evict_inode(struct inode *inode)
> > {
> > ...
> >
> > truncate_inode_pages(&inode->i_data, 0);
> >
> > ...
> > }
> Well, but that just removes pages from page cache. You should somewhere
> also free allocated blocks and free the inode... And I'm sure you do,
> otherwise you would pretty quickly notice that file deletion does not work
> :) Just I could not find which function does it.

ubifs_evict_inode() -> ubifs_jnl_delete_inode() ->
ubifs_tnc_remove_ino()

Basically, deletion in UBIFS is about writing a so-called "deletion
inode" to the journal and then removing all the data nodes of the
truncated inode from the TNC (in-memory cache of the FS index, which is
just a huge B-tree, like in reiser4 which inspired me long time ago, and
like in btrfs).

The second part of the overall deletion job will be when we commit - the
updated version of the FS index will be written to the flash media.

If we get a power cut before the commit, the journal reply will see the
deletion inode and will clean-up the index. The deletion inode is never
erased before the commit.

Basically, this design is dictated by the fact that we do not have a
cheap way of doing in-place updates.

This is a short version of the story. Here are some docs as well:
http://www.linux-mtd.infradead.org/doc/ubifs.html#L_documentation

--
Best Regards,
Artem Bityutskiy

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/