All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-fsdevel@vger.kernel.org, xfs@oss.sgi.com
Subject: Re: [PATCH 5/6] xfs: move non-inline symlinks to the pagecache
Date: Sat, 25 Apr 2015 16:11:03 +0100	[thread overview]
Message-ID: <20150425151103.GF889@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20150425145728.GE889@ZenIV.linux.org.uk>

On Sat, Apr 25, 2015 at 03:57:28PM +0100, Al Viro wrote:
> > i_link member to the union of i_pipe, i_bdev and i_cdev.  That we
> > we can cache a link acquired by any way for direct use in the VFS.
> > 
> > This has a few use cases:  inline links can be set up directly
> > when reading the inode, and we never need to call into ->follow_link.
> > 
> > Formats like the XFS v5 symlinks can be read in once by whatever
> > way we want, and following accesses can be done RCU safe and
> > without calling into the filesystem.
> > 
> > Note that caching the symlink in a kmalloc'ed buffer might be
> > more efficient than the pagecache for most cases anyway.
> 
> Hmm...  When would you free the sucker?

FWIW, I'm not particularly opposed to doing that, but we'd better be careful
about not losing ->follow_link() itself.  Reason: we use its presence to
tell symlinks from non-symlinks.  OTOH, something like

	/* have already decided it's a symlink */
	if (inode->i_link)
		return inode->i_link;
	res = inode->i_op->follow_link(...);
with ->follow_link() instance returning ERR_PTR(-EIO) would work.  Such
sucker could live in fs/libfs.c just fine, with rule being "if you use it
for ->follow_link(), you'd better set ->i_link"...

Note, BTW, that there are symlinks where we _do_ have "traverse a string"
for semantics, and it's even kmalloc'ed, but we very much do not want it
to be cached.  Consider /proc/self, for example.  Different processes should
see different link bodies there, without any serialization between them.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

WARNING: multiple messages have this Message-ID (diff)
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Christoph Hellwig <hch@lst.de>
Cc: Dave Chinner <david@fromorbit.com>,
	xfs@oss.sgi.com, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 5/6] xfs: move non-inline symlinks to the pagecache
Date: Sat, 25 Apr 2015 16:11:03 +0100	[thread overview]
Message-ID: <20150425151103.GF889@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20150425145728.GE889@ZenIV.linux.org.uk>

On Sat, Apr 25, 2015 at 03:57:28PM +0100, Al Viro wrote:
> > i_link member to the union of i_pipe, i_bdev and i_cdev.  That we
> > we can cache a link acquired by any way for direct use in the VFS.
> > 
> > This has a few use cases:  inline links can be set up directly
> > when reading the inode, and we never need to call into ->follow_link.
> > 
> > Formats like the XFS v5 symlinks can be read in once by whatever
> > way we want, and following accesses can be done RCU safe and
> > without calling into the filesystem.
> > 
> > Note that caching the symlink in a kmalloc'ed buffer might be
> > more efficient than the pagecache for most cases anyway.
> 
> Hmm...  When would you free the sucker?

FWIW, I'm not particularly opposed to doing that, but we'd better be careful
about not losing ->follow_link() itself.  Reason: we use its presence to
tell symlinks from non-symlinks.  OTOH, something like

	/* have already decided it's a symlink */
	if (inode->i_link)
		return inode->i_link;
	res = inode->i_op->follow_link(...);
with ->follow_link() instance returning ERR_PTR(-EIO) would work.  Such
sucker could live in fs/libfs.c just fine, with rule being "if you use it
for ->follow_link(), you'd better set ->i_link"...

Note, BTW, that there are symlinks where we _do_ have "traverse a string"
for semantics, and it's even kmalloc'ed, but we very much do not want it
to be cached.  Consider /proc/self, for example.  Different processes should
see different link bodies there, without any serialization between them.

  reply	other threads:[~2015-04-25 15:11 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-23 19:07 optimize symlink handling Christoph Hellwig
2015-04-23 19:07 ` [PATCH 2/6] xfs: factor out a helper to initialize a local format inode fork Christoph Hellwig
2015-04-23 19:07 ` [PATCH 3/6] xfs: set up inode operation vectors later Christoph Hellwig
2015-04-23 19:07 ` [PATCH 4/6] xfs: use ->readlink to implement the readlink_by_handle ioctl Christoph Hellwig
2015-04-23 19:07 ` [PATCH 5/6] xfs: move non-inline symlinks to the pagecache Christoph Hellwig
2015-04-23 22:29   ` Dave Chinner
2015-04-24  8:21     ` Christoph Hellwig
2015-04-25 14:16     ` Christoph Hellwig
2015-04-25 14:16       ` Christoph Hellwig
2015-04-25 14:57       ` Al Viro
2015-04-25 14:57         ` Al Viro
2015-04-25 15:11         ` Al Viro [this message]
2015-04-25 15:11           ` Al Viro
2015-04-25 18:32         ` Christoph Hellwig
2015-04-25 18:32           ` Christoph Hellwig
2015-04-25 21:05           ` Al Viro
2015-04-25 21:05             ` Al Viro
2015-04-23 19:07 ` [PATCH 6/6] xfs: optimize inline symlinks Christoph Hellwig

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=20150425151103.GF889@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=xfs@oss.sgi.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.