Re: [PATCH 2/3] fadvise: Add _VOLATILE,_ISVOLATILE, and _NONVOLATILEflags

From: Dave Hansen
Date: Fri Apr 27 2012 - 11:30:28 EST


On 04/26/2012 05:39 PM, Dave Chinner wrote:
> As it is, I'm still not sold on these being an fadvise() interface
> because all it really is a delayed hole punching interface whose
> functionailty is currently specific to tmpfs. The behaviour cannot
> be implemented sanely by anything else at this point.
...
> IOWs, the specification you are describing means that FADV_VOLATILE
> could be correctly implemented as an immediate hole punch by every
> filesystem that supports hole punching.

Ahhh, I think I see where you're going with this.

1. Data written to a file somehow (mmap(), write()) and is on disk
2. mmap() the data, and fault it in
3. Do a small write to it
4. set FADV_VOLATILE on it

Now we've got a dirty page which can theoretically be tossed out. But,
we've got old data on the disk and no real way to tell that it was old
if it got faulted in again. It's a much cleaner situation to just drop
that data off the disk (hole punch) than to leave it around. Is that
the concern?

But, we have other APIs that act this way, tossing out dirty data
without reflecting that on-disk (MADV_DONTNEED at least). Is it really
a stretch to define the FADV_VOLATILE to behave the same way? IOW,
Should the behavior _really_ be hole punching? That'll cost us I/O to
throw away data during memory reclaim since we have to go write the
information about the hole. Seems like a much more appropriate thing to
just toss the data out since the app can handle it.

--
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/