Return-Path: Received: from mx1.redhat.com ([209.132.183.28]:55204 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751057AbdAQQuS (ORCPT ); Tue, 17 Jan 2017 11:50:18 -0500 From: David Howells In-Reply-To: <20170113171616.GG24709@fieldses.org> References: <20170113171616.GG24709@fieldses.org> <12324.1483742446@warthog.procyon.org.uk> To: bfields@fieldses.org (J. Bruce Fields) Cc: dhowells@redhat.com, lsf-pc@lists.linux-foundation.org, linux-fsdevel@vger.kernel.org, jaltman@auristor.com Subject: Re: [LSF/MM TOPIC] Network filesystem cache management system call MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <14113.1484671351.1@warthog.procyon.org.uk> Date: Tue, 17 Jan 2017 16:42:31 +0000 Message-ID: <14114.1484671351@warthog.procyon.org.uk> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: J. Bruce Fields wrote: > > One of these is the call to manage local caching on a file or volume. > > This, however, doesn't really need to be limited to AFS, but could also be > > applicable to NFS, CIFS, etc. - and possibly even to local filesystems. > > Do you have a summary of the AFS interface to give an idea what's > needed? I have the pioctls listed here that I need to emulate: https://www.infradead.org/~dhowells/kafs/user_interface.html along with my thoughts on how to do that. For cache wangling, I was thinking of something like: fcachectl(int dirfd, const char *pathname, unsigned atflags, const char *cmd, char *result, size_t *result_len); The relevant pioctls are: (*) VIOCGETCACHEPARMS Get the size of the cache. (*) VIOCSETCACHESIZE Set the cache size. (*) VIOCFLUSH Invalidate the cached information for an object, both the inode/dentry structs and anything in the local cache. (*) VIOCFLUSHCB Invalidate any callbacks/leases outstanding on an object. This might make more sense to be done via the same mechanism as lease/lock management. (*) VIOC_FLUSHVOLUME Flush all cached state for a volume, both from RAM and local disk cache as far as possible. Files that are open aren't necessarily affected. (*) VIOC_FLUSHALL FLush all cached state for all volumes. (*) VIOCPREFETCH Prefetch a file into the cache. So, maybe: fcachectl(AT_FDCWD, "/afs/user/dhowells", 0, "flush volume", NULL, NULL); to flush an AFS volume containing my home directory. Note that doing this by fcntl() or ioctl() has potential difficulties as it would have to work on non-file objects such as device files or symlinks. Other functions that this could be used for are cache pinning and fixup/integration should we ever want disconnected operation. David