[Linux-cachefs] Re: Cachefs + FUSE (Was: [PATCH] [Request for inclusion] Filesystem in Userspace)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > It sounds like I've missed part of this conversation, but you can
> > always write to FS-Cache and downcall to userspace simultaneously.
> 
> So is this what a normal netfs would do?  Do it's own writeback over
> the network together with the cache operation, and throw away the page
> when both have finished.  Or is there an alternative strategy?

That is what I envisioned, but it is entirely up to the netfs. The page
mustn't be thrown away until the fscache calls the callback. fscache/cachefs
probably won't take it upon itself to arbitrarily update the cache from the
cached pages, but you never can tell; whatever, if it does, it will be
transparent to the netfs.

> The question is rather, if cachefs can pin the data, so it won't go
> away until the userspace is ready to do the writeback?  If this is
> available, then the netfs can relinquish the page even if it can't
> write it back immediately, and pull it back from the cache later.

My plan is (when I get time) to make the writeback journal work. An entry
recorded in this will be allowed to pin a cachefs data file on disc. A netfs
will be able to ask for an enumeration of the wbj entries that belong to it,
and will be notified upon the attachment of a cookie to a pinned data file.

The netfs would then be permitted to ask fscache to record or remove a
writeback mark against a file.

> An unrelated question: why doesn't cachefs use the swap as backing?
> This would be _much_ easier to use for most people than a separate
> partition.

Did you look at:

	Documentation/filesystems/caching/cachefs.txt

One thing cachefs gives you is data consistency. It uses a journal to ensure
that the cache can be restored to a good state in the event of a power loss or
a reboot. This would be hard to do with swap as a swapspace's contents are
effectively destroyed by swapon.

On the other hand, you could write another caching backend that uses swap
instead of a blockdev that gives you temporary caching. You'd probably have to
keep all your metadata in RAM though, unless you wanted to change the way swap
files are structured.

Actually, the reverse approach might be easier - allowing the swapper to make
use of slack space in cachefs.

David


[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]
  Powered by Linux