From: "J. R. Okajima" <hooanon05@yahoo.co.jp>
To: Nick Piggin <npiggin@suse.de>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Al Viro <viro@ZenIV.linux.org.uk>,
Ulrich Drepper <drepper@redhat.com>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [rfc] new stat*fs-like syscall?
Date: Sat, 26 Jun 2010 14:53:32 +0900 [thread overview]
Message-ID: <7897.1277531612@jrobl> (raw)
In-Reply-To: <20100624131455.GA10441@laptop>
Nick Piggin:
> Is there anything more we should add here? Samba wants a capabilities
> field, with things like sparse files, quotas, compression, encryption,
> case preserving/sensitive.
How about the max link count?
There was a post in last December.
See <http://marc.info/?l=linux-kernel&m=126008640210762&w=2> and its
thread in detail.
J. R. Okajima
----------------------------------------------------------------------
The pathconf(_PC_LINK_MAX) cannot get the correct value, since linux
kernel doesn't provide such interface. And the current implementation in
GLibc issues statfs(2) first and then returns the predefined value
(EXT2_LINK_MAX, etc) based upoin the filesystem type. But GLibc doesn't
support all filesystem types. ie. when the target filesystem is unknown
to pathconf(3), it will return LINUX_LINK_MAX (127).
For GLibc, there is no way except implementing this poor method.
This patch makes statfs(2) return the correct value via struct
statfs.f_spare[0].
RFC:
- Can we use f_spare for this purpose?
- Does pathconf(_PC_LINK_MAX) distinguish a dir and a non-dir?
If a filesystem sets different limit for a dir as a link count from a
non-dir, then should the filesystem checks the type of the specified
dentry->d_inode->i_mode and return the different value?
This patch series doesn't distinguish them and return a single value.
- Here I tried supporting only ext[23], nfs and tmpfs. Since I can test
them by myself. I left other FSs as it is, which means if FS doesn't
support _PC_LINK_MAX by modifying its s_op->statfs(), the default
value will be returned. The default value is taken from GLibc trying
to keep the compatibility. But it may not be important.
- Some FS such as ms-dos based one which doesn't support hardlink, will
return LINK_MAX_UNSUPPORTED which is defined as 1.
- Other FS such as tmpfs which doesn't check the link count in link(2),
will return LINK_MAX_UNLIMITED which is defined as -1. This value
doesn't mean an error. The negative return value of pathconf(3) is
valid.
Even if linux kernel return a correct value via statfs(2) (or anything
else), users will not get the value at once since the support in libc is
necessary too.
J. R. Okajima (5):
vfs, support pathconf(3) with _PC_LINK_MAX
ext2, support pathconf(3) with _PC_LINK_MAX
ext3, support pathconf(3) with _PC_LINK_MAX
nfs, support pathconf(3) with _PC_LINK_MAX
tmpfs, support pathconf(3) with _PC_LINK_MAX
fs/compat.c | 5 +++--
fs/ext2/super.c | 1 +
fs/ext3/super.c | 1 +
fs/libfs.c | 1 +
fs/nfs/client.c | 10 +++++++---
fs/nfs/super.c | 1 +
fs/open.c | 9 +++++++--
include/linux/nfs_fs_sb.h | 1 +
include/linux/statfs.h | 6 ++++++
mm/shmem.c | 1 +
10 files changed, 29 insertions(+), 7 deletions(-)
next prev parent reply other threads:[~2010-06-26 5:54 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-24 13:14 [rfc] new stat*fs-like syscall? Nick Piggin
2010-06-24 14:03 ` Miklos Szeredi
2010-06-24 14:36 ` Nick Piggin
2010-06-24 14:08 ` Andy Lutomirski
2010-06-24 14:18 ` Miklos Szeredi
2010-06-24 14:37 ` Andrew Lutomirski
2010-06-24 14:48 ` Miklos Szeredi
2010-06-25 3:50 ` Nick Piggin
2010-06-24 23:06 ` Andreas Dilger
2010-06-25 6:37 ` Christoph Hellwig
2010-06-24 23:13 ` Andreas Dilger
2010-06-25 4:01 ` Nick Piggin
2010-06-25 4:33 ` Jeff Garzik
2010-06-25 17:47 ` Andreas Dilger
2010-06-25 17:52 ` Ulrich Drepper
2010-06-25 18:16 ` Christoph Hellwig
2010-06-25 18:45 ` Christoph Hellwig
2010-06-25 19:40 ` Ulrich Drepper
2010-06-26 5:53 ` J. R. Okajima [this message]
2010-06-26 9:35 ` Christoph Hellwig
2010-06-26 12:54 ` J. R. Okajima
2010-07-05 20:58 ` Brad Boyer
2010-07-05 23:31 ` J. R. Okajima
2010-07-06 0:45 ` Brad Boyer
2010-07-06 16:45 ` Linus Torvalds
2010-07-07 1:44 ` Christoph Hellwig
2010-07-07 2:28 ` Linus Torvalds
2010-06-26 14:49 ` Ulrich Drepper
2010-06-26 10:13 ` Andi Kleen
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=7897.1277531612@jrobl \
--to=hooanon05@yahoo.co.jp \
--cc=drepper@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=npiggin@suse.de \
--cc=torvalds@linux-foundation.org \
--cc=viro@ZenIV.linux.org.uk \
/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).