From: David Howells <dhowells@redhat.com>
To: torvalds@osdl.org, akpm@osdl.org, steved@redhat.com,
trond.myklebust@fys.uio.no, aviro@redhat.com
Cc: linux-fsdevel@vger.kernel.org, linux-cachefs@redhat.com,
nfsv4@linux-nfs.org, linux-kernel@vger.kernel.org
Subject: [PATCH 00/14] Permit filesystem local caching and NFS superblock sharing [try #10]
Date: Fri, 19 May 2006 16:46:40 +0100 [thread overview]
Message-ID: <20060519154640.11791.2928.stgit@warthog.cambridge.redhat.com> (raw)
These patches make it possible to share NFS superblocks between related
mounts, where "related" means on the same server and FSID. Inodes and dentries
will be shared where the NFS filehandles are the same (for example if two NFS3
files come from the same export but from different mounts, such as is not
uncommon with autofs on /home).
These patches also add local caching for network filesystems such as NFS and
AFS.
The first six patches (NFS superblock sharing) can be applied without the
remaining patches (filesystem local caching).
Changes [try #9] that have been made:
(*) [PATCH] NFS: Permit filesystem to perform statfs with a known root dentry
[*] Inclusions of linux/mount.h have been added where necessary to make
allyesconfig build successfully.
(*) [PATCH] NFS: Share NFS superblocks per-protocol per-server per-FSID
[*] The exports from fs/namespace.c and fs/namei.c are no longer required.
(*) [PATCH] FS-Cache: Release page->private in failed readahead
[*] The try_to_release_page() is called instead of calling the
releasepage() op directly.
[*] The page is locked before try_to_release_page() is called.
[*] The call to try_to_release_page() and page_cache_release() have been
abstracted out into a helper function as this bit of code occurs
twice..
Changes [try #10] that have been made:
(*) [PATCH] NFS: Permit filesystem to perform statfs with a known root dentry
[*] Pass a dentry rather than a vfsmount to the statfs() op as the key by
which to determine the filesystem.
(*) [PATCH] NFS: Share NFS superblocks per-protocol per-server per-FSID
[*] nfs4_pathname_string() needed an extra const.
(*) [PATCH] FS-Cache: Release page->private in failed readahead
[*] The comment header on the helper function is much expanded. This
states why there's a need to call the releasepage() op in the event of
an error.
[*] BUG() if the page is already locked when we try and lock it.
[*] Don't set the page mapping pointer until we've locked the page.
[*] The page is unlocked after try_to_release_page() is called.
(*) The release-page patch now comes before the fscache-afs patch as well as
the fscache-nfs patch.
---
In response to those who've asked, there are at least three reasons for
implementing superblock sharing:
(1) As I understand what I've been told, NFSv4 requires a 1:1 mapping between
server files and client files. I suspect this has to do with the
management of leases.
(2) We can reduce the resource consumption on NFSv2 and NFSv3 clients as well
as on NFSv4 clients by sharing superblocks that cover overlapping segments
of the file space.
Consider a machine that's used by a lot of people at the same time, each
of whom has an automounted NFS homedir off of the same server - and in
fact off of the same disk on the that server. Currently, with Linus's
tree, each one will get a separate superblock to represent them; with
Trond's tree, each one will still get a separate superblock unless they
share the same root filehandle; and with my patches, they'll get the same
superblock.
If two homedirs have a hard link between them (unlikely, I know, but by no
means impossible, and probably more likely with, say, data such as NFS
mounted git repositories), then you have the possibility of aliasing.
This means that you can have two or more inodes in core that refer to the
same server object, and each of these inodes can have pages that refer to
the same remote pages on the server - aliasing again. You _have_ to have
two inodes because they're covered by separate superblocks.
Aliasing is bad, generally, because you end up using more storage than
you need to (pagecache and inode cache in this case), and you have the
problem of keeping them in sync. It's also twice as hard to keep two
inodes up to date when they change on the server as to keep one up to
date.
If you can use the same superblock where possible, then you can cut out
aliasing on that client since you can share dentries that have the same
file handle (hard links or subtrees).
Part of the problem with NFSv2 and NFSv3 is that you invoke mountd to get
the filehandle to a subtree, but you may not be able to work out how two
different subtrees relate. The getsb patch permits the superblock to
have more than one root, which allows us to defer this problem until we
see the root of one subtree cropping up in another subtree - at which
point we can splice the former into the latter.
(3) In my local file caching patches (FS-Cache), I have two reasons for
wanting this:
(a) Unique keys. I need a unique key to find an object in the cache. If
we can get inode aliases, then I end up with several inodes referring
to the same cache object. This also means that I have to use a fair
bit of extra memory to keep track of the multiple cookie mappings in
FS-Cache, and have to compare keys a lot to find duplicate mappings.
If I can assume that the _netfs_ will manage the 1:1 mapping, I can
use a lot less memory and save some processing capacity also.
I don't want to invent random keys to differentiate aliased
superblocks or inodes as that destroys the persistence capabilities
of the cache across power failures and reboots.
(b) Callbacks. I want a callback that the netfs passes to FS-Cache to
permit the cache to update the metadata in the cache from netfs
metadata at convenient times. However, if there's more than one
inode alias in core, which one should the cache use?
AFS doesn't have anything like these problems because mounts are always made
from the root of a volume, and AFS was designed with local caching in mind.
The getsb and statfs patches are a consequence of NFS being permitted to mount
arbitrary subtrees from the server.
David
next reply other threads:[~2006-05-19 15:46 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-19 15:46 David Howells [this message]
2006-05-19 15:46 ` [PATCH 01/14] NFS: Permit filesystem to override root dentry on mount [try #10] David Howells
2006-05-30 10:45 ` Al Viro
2006-05-19 15:46 ` [PATCH 02/14] NFS: Permit filesystem to perform statfs with a known root dentry " David Howells
2006-05-19 15:46 ` [PATCH 03/14] NFS: Abstract out namespace initialisation " David Howells
2006-05-30 10:35 ` Al Viro
2006-05-30 10:51 ` David Howells
2006-05-19 15:46 ` [PATCH 04/14] NFS: Add dentry materialisation op " David Howells
2006-05-19 15:46 ` [PATCH 05/14] NFS: Split fs/nfs/inode.c into inode, superblock and namespace bits " David Howells
2006-05-19 15:46 ` [PATCH 06/14] NFS: Share NFS superblocks per-protocol per-server per-FSID " David Howells
2006-05-19 15:46 ` [PATCH 07/14] FS-Cache: Provide a filesystem-specific sync'able page bit " David Howells
2006-05-19 15:47 ` [PATCH 08/14] FS-Cache: Add notification of page becoming writable to VMA ops " David Howells
2006-05-19 15:47 ` [PATCH 09/14] FS-Cache: Avoid ENFILE checking for kernel-specific open files " David Howells
2006-05-19 15:47 ` [PATCH 10/14] FS-Cache: Generic filesystem caching facility " David Howells
2006-05-19 15:47 ` [PATCH 11/14] FS-Cache: Release page->private in failed readahead " David Howells
2006-05-19 15:47 ` [PATCH 12/14] FS-Cache: Make kAFS use FS-Cache " David Howells
2006-05-19 15:47 ` [PATCH 13/14] FS-Cache: CacheFiles: A cache that backs onto a mounted filesystem " David Howells
2006-05-19 15:47 ` [PATCH 14/14] NFS: Use local caching " David Howells
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060519154640.11791.2928.stgit@warthog.cambridge.redhat.com \
--to=dhowells@redhat.com \
--cc=akpm@osdl.org \
--cc=aviro@redhat.com \
--cc=linux-cachefs@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nfsv4@linux-nfs.org \
--cc=steved@redhat.com \
--cc=torvalds@osdl.org \
--cc=trond.myklebust@fys.uio.no \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).