In theory the VM should never call writepage unless the page must be writen
out...
But I agree with you that it would be good to be able to distinguish the
two cases. I have been thinking about this a bit in the context of NTFS TNG
but I think that it would be better to have a generic solution rather than
every fs does their own copy of the same thing. I envisage that there is a
flush daemon which just walks around writing pages to disk in the
background (there could be one per fs, or a generic one which fs register
with, at their option they could have their own of course) in order to keep
the number of dirty pages low and in order to minimize data loss on the
event of system/power failure.
This demon requires several interfaces though, with regards to journalling
fs. The daemon should have an interface where the fs can say "commit pages
in this list NOW and do not return before done", also a barrier operation
would be required in journalling context. A transactions interface would be
ideal, where the fs can submit whole transactions consisting of writing out
a list of pages and optional write barriers; e.g. write journal pages x, y,
z, barrier, write metadata, perhaps barrier, finally write data pages a, b,
c. Simple file systems could just not bother at all and rely on the flush
daemon calling the fs to write the pages.
Obviously when this daemon writes pages the pages will continue being
there. OTOH, if the VM calls write page because it needs to free memory
then writepage must write and clean the page.
So, yes, a parameter to write page would be great in this context.
Alternatively we could have ->writepage and ->flushpage (or pick your
favourite two names) one being an optional writeout and one a forced
writeout... I like the parameter to writepage idea better but in the end it
doesn't really matter that much I would suspect...
Best regards,
Anton
-- "I've not lost my mind. It's backed up on tape somewhere." - Unknown-- Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @) Linux NTFS Maintainer / WWW: http://linux-ntfs.sf.net/ ICQ: 8561279 / WWW: http://www-stu.christs.cam.ac.uk/~aia21/- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/