On Wed 06-10-10 10:48:20, Christoph Hellwig wrote: > Add a new helper to write out the inode using the writeback code, > that is including the correct dirty bit and list manipulation. A few > of filesystems already opencode this, and a lot of others should be > using it instead of using write_inode_now which also writes out the > data. I'm reacting late but anyways: > Index: linux-2.6/fs/fs-writeback.c > =================================================================== > --- linux-2.6.orig/fs/fs-writeback.c 2010-10-05 10:51:24.611023726 +0200 > +++ linux-2.6/fs/fs-writeback.c 2010-10-05 10:53:24.684255876 +0200 > @@ -1209,3 +1209,23 @@ int sync_inode(struct inode *inode, stru > return ret; > } > EXPORT_SYMBOL(sync_inode); > + > +/** > + * sync_inode - write an inode to disk > + * @inode: the inode to sync > + * @wait: wait for I/O to complete. > + * > + * Write an inode to disk and adjust it's dirty state after completion. > + * > + * Note: only writes the actual inode, no associated data or other metadata. > + */ > +int sync_inode_metadata(struct inode *inode, int wait) > +{ > + struct writeback_control wbc = { > + .sync_mode = wait ? WB_SYNC_ALL : WB_SYNC_NONE, > + .nr_to_write = 0, /* metadata-only */ This is a catch in write_cache_pages() code. If you call it in WB_SYNC_ALL mode, they will just ignore the .nr_to_write argument. So what actually ensures that we do not write data is that .range_start and .range_end are implicitely set to 0. In fact, write_cache_pages() will write page with index 0 in that case. So setting .range_start to 1 would be even better. Otherwise the patch looks OK. Honza -- Jan Kara <jack@xxxxxxx> SUSE Labs, CR -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html