RE: [PATCH V4 4/8] Cleancache: VFS hooks for cleancache

Dan Magenheimer
2010-08-31T00:48:17Z

> > + if (s->cleancache_poolid >= 0) {
> > + int cleancache_poolid = s->cleancache_poolid;
>
> That's a lot of characters for a local in a 3-line scope.

:-) OK.

> > + s->cleancache_poolid = -1; /* avoid races */
>
> Races with what? Something else sneaking something into the pool after
> the flush? Is the filesystem dead at this stage or not?

If there are any inodes in the page cache that point to
this superblock, a cleancache_put_page may happen asynchronously
that grabs from page->...->i_sb->cleancache_poolid.
If the cleancache_flush_fs races with it and another
cleancache_init_fs happens after the cleancache_put_page
gets the poolid, the poolid could be stale.

Highly unlikely, but I thought it best to be safe.

> > + /* 99% of the time, we don't need to flush the cleancache on the
> bdev.
> > + * But, for the strange corners, lets be cautious
> > + */
>
> This comment-style is... unconventional for the kernel.

Yeah, I decided to defer to Chris Mason's wisdom and left it. :-)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: email@kvack.org