2005-09-09 20:04:20 +00:00
|
|
|
/*
|
|
|
|
* linux/fs/9p/vfs_super.c
|
|
|
|
*
|
|
|
|
* This file contians superblock ops for 9P2000. It is intended that
|
|
|
|
* you mount this file system on directories.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com>
|
|
|
|
* Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
2006-03-25 11:07:28 +00:00
|
|
|
* it under the terms of the GNU General Public License version 2
|
|
|
|
* as published by the Free Software Foundation.
|
2005-09-09 20:04:20 +00:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to:
|
|
|
|
* Free Software Foundation
|
|
|
|
* 51 Franklin Street, Fifth Floor
|
|
|
|
* Boston, MA 02111-1301 USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/fs.h>
|
|
|
|
#include <linux/file.h>
|
|
|
|
#include <linux/stat.h>
|
|
|
|
#include <linux/string.h>
|
|
|
|
#include <linux/inet.h>
|
|
|
|
#include <linux/pagemap.h>
|
|
|
|
#include <linux/mount.h>
|
|
|
|
#include <linux/idr.h>
|
Detach sched.h from mm.h
First thing mm.h does is including sched.h solely for can_do_mlock() inline
function which has "current" dereference inside. By dealing with can_do_mlock()
mm.h can be detached from sched.h which is good. See below, why.
This patch
a) removes unconditional inclusion of sched.h from mm.h
b) makes can_do_mlock() normal function in mm/mlock.c
c) exports can_do_mlock() to not break compilation
d) adds sched.h inclusions back to files that were getting it indirectly.
e) adds less bloated headers to some files (asm/signal.h, jiffies.h) that were
getting them indirectly
Net result is:
a) mm.h users would get less code to open, read, preprocess, parse, ... if
they don't need sched.h
b) sched.h stops being dependency for significant number of files:
on x86_64 allmodconfig touching sched.h results in recompile of 4083 files,
after patch it's only 3744 (-8.3%).
Cross-compile tested on
all arm defconfigs, all mips defconfigs, all powerpc defconfigs,
alpha alpha-up
arm
i386 i386-up i386-defconfig i386-allnoconfig
ia64 ia64-up
m68k
mips
parisc parisc-up
powerpc powerpc-up
s390 s390-up
sparc sparc-up
sparc64 sparc64-up
um-x86_64
x86_64 x86_64-up x86_64-defconfig x86_64-allnoconfig
as well as my two usual configs.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-20 21:22:52 +00:00
|
|
|
#include <linux/sched.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 08:04:11 +00:00
|
|
|
#include <linux/slab.h>
|
2010-03-25 12:45:30 +00:00
|
|
|
#include <linux/statfs.h>
|
2010-09-27 08:47:24 +00:00
|
|
|
#include <linux/magic.h>
|
2007-07-10 22:57:28 +00:00
|
|
|
#include <net/9p/9p.h>
|
|
|
|
#include <net/9p/client.h>
|
2005-09-09 20:04:20 +00:00
|
|
|
|
|
|
|
#include "v9fs.h"
|
|
|
|
#include "v9fs_vfs.h"
|
|
|
|
#include "fid.h"
|
2010-05-31 07:52:56 +00:00
|
|
|
#include "xattr.h"
|
2010-09-27 18:57:39 +00:00
|
|
|
#include "acl.h"
|
2005-09-09 20:04:20 +00:00
|
|
|
|
2010-03-25 12:41:54 +00:00
|
|
|
static const struct super_operations v9fs_super_ops, v9fs_super_ops_dotl;
|
2005-09-09 20:04:20 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* v9fs_set_super - set the superblock
|
|
|
|
* @s: super block
|
|
|
|
* @data: file system specific data
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int v9fs_set_super(struct super_block *s, void *data)
|
|
|
|
{
|
|
|
|
s->s_fs_info = data;
|
|
|
|
return set_anon_super(s, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* v9fs_fill_super - populate superblock with info
|
|
|
|
* @sb: superblock
|
|
|
|
* @v9ses: session information
|
2010-07-25 19:56:43 +00:00
|
|
|
* @flags: flags propagated from v9fs_mount()
|
2005-09-09 20:04:20 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2017-04-12 10:24:31 +00:00
|
|
|
static int
|
2005-09-09 20:04:20 +00:00
|
|
|
v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses,
|
2009-08-17 21:42:28 +00:00
|
|
|
int flags, void *data)
|
2005-09-09 20:04:20 +00:00
|
|
|
{
|
2017-04-12 10:24:31 +00:00
|
|
|
int ret;
|
|
|
|
|
2005-09-09 20:04:20 +00:00
|
|
|
sb->s_maxbytes = MAX_LFS_FILESIZE;
|
|
|
|
sb->s_blocksize_bits = fls(v9ses->maxdata - 1);
|
|
|
|
sb->s_blocksize = 1 << sb->s_blocksize_bits;
|
|
|
|
sb->s_magic = V9FS_MAGIC;
|
2010-05-31 07:52:56 +00:00
|
|
|
if (v9fs_proto_dotl(v9ses)) {
|
2010-03-25 12:41:54 +00:00
|
|
|
sb->s_op = &v9fs_super_ops_dotl;
|
2010-05-31 07:52:56 +00:00
|
|
|
sb->s_xattr = v9fs_xattr_handlers;
|
|
|
|
} else
|
2010-03-25 12:41:54 +00:00
|
|
|
sb->s_op = &v9fs_super_ops;
|
2017-04-12 10:24:31 +00:00
|
|
|
|
|
|
|
ret = super_setup_bdi(sb);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
2011-02-28 11:34:03 +00:00
|
|
|
if (v9ses->cache)
|
2019-03-12 06:28:13 +00:00
|
|
|
sb->s_bdi->ra_pages = VM_READAHEAD_PAGES;
|
2005-09-09 20:04:20 +00:00
|
|
|
|
2018-04-05 23:19:57 +00:00
|
|
|
sb->s_flags |= SB_ACTIVE | SB_DIRSYNC;
|
2011-02-28 11:33:59 +00:00
|
|
|
if (!v9ses->cache)
|
2017-11-27 21:05:09 +00:00
|
|
|
sb->s_flags |= SB_SYNCHRONOUS;
|
2009-08-17 21:42:28 +00:00
|
|
|
|
2010-09-27 18:57:39 +00:00
|
|
|
#ifdef CONFIG_9P_FS_POSIX_ACL
|
2011-01-25 23:40:54 +00:00
|
|
|
if ((v9ses->flags & V9FS_ACL_MASK) == V9FS_POSIX_ACL)
|
2017-11-27 21:05:09 +00:00
|
|
|
sb->s_flags |= SB_POSIXACL;
|
2010-09-27 18:57:39 +00:00
|
|
|
#endif
|
|
|
|
|
2017-04-12 10:24:31 +00:00
|
|
|
return 0;
|
2005-09-09 20:04:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-07-25 19:56:43 +00:00
|
|
|
* v9fs_mount - mount a superblock
|
2005-09-09 20:04:20 +00:00
|
|
|
* @fs_type: file system type
|
|
|
|
* @flags: mount flags
|
|
|
|
* @dev_name: device name that was mounted
|
|
|
|
* @data: mount options
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-07-25 19:56:43 +00:00
|
|
|
static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags,
|
|
|
|
const char *dev_name, void *data)
|
2005-09-09 20:04:20 +00:00
|
|
|
{
|
|
|
|
struct super_block *sb = NULL;
|
|
|
|
struct inode *inode = NULL;
|
|
|
|
struct dentry *root = NULL;
|
|
|
|
struct v9fs_session_info *v9ses = NULL;
|
2011-07-26 06:53:22 +00:00
|
|
|
umode_t mode = S_IRWXUGO | S_ISVTX;
|
2007-07-10 22:57:28 +00:00
|
|
|
struct p9_fid *fid;
|
2005-09-09 20:04:20 +00:00
|
|
|
int retval = 0;
|
|
|
|
|
2011-11-28 18:40:46 +00:00
|
|
|
p9_debug(P9_DEBUG_VFS, "\n");
|
2005-09-09 20:04:20 +00:00
|
|
|
|
2006-01-08 09:05:02 +00:00
|
|
|
v9ses = kzalloc(sizeof(struct v9fs_session_info), GFP_KERNEL);
|
2005-09-09 20:04:20 +00:00
|
|
|
if (!v9ses)
|
2010-07-25 19:56:43 +00:00
|
|
|
return ERR_PTR(-ENOMEM);
|
2005-09-09 20:04:20 +00:00
|
|
|
|
2007-07-10 22:57:28 +00:00
|
|
|
fid = v9fs_session_init(v9ses, dev_name, data);
|
|
|
|
if (IS_ERR(fid)) {
|
|
|
|
retval = PTR_ERR(fid);
|
2015-06-08 05:57:31 +00:00
|
|
|
goto free_session;
|
2007-07-10 22:57:28 +00:00
|
|
|
}
|
|
|
|
|
2012-06-25 11:55:37 +00:00
|
|
|
sb = sget(fs_type, NULL, v9fs_set_super, flags, v9ses);
|
[PATCH] VFS: Permit filesystem to override root dentry on mount
Extend the get_sb() filesystem operation to take an extra argument that
permits the VFS to pass in the target vfsmount that defines the mountpoint.
The filesystem is then required to manually set the superblock and root dentry
pointers. For most filesystems, this should be done with simple_set_mnt()
which will set the superblock pointer and then set the root dentry to the
superblock's s_root (as per the old default behaviour).
The get_sb() op now returns an integer as there's now no need to return the
superblock pointer.
This patch permits a superblock to be implicitly shared amongst several mount
points, such as can be done with NFS to avoid potential inode aliasing. In
such a case, simple_set_mnt() would not be called, and instead the mnt_root
and mnt_sb would be set directly.
The patch also makes the following changes:
(*) the get_sb_*() convenience functions in the core kernel now take a vfsmount
pointer argument and return an integer, so most filesystems have to change
very little.
(*) If one of the convenience function is not used, then get_sb() should
normally call simple_set_mnt() to instantiate the vfsmount. This will
always return 0, and so can be tail-called from get_sb().
(*) generic_shutdown_super() now calls shrink_dcache_sb() to clean up the
dcache upon superblock destruction rather than shrink_dcache_anon().
This is required because the superblock may now have multiple trees that
aren't actually bound to s_root, but that still need to be cleaned up. The
currently called functions assume that the whole tree is rooted at s_root,
and that anonymous dentries are not the roots of trees which results in
dentries being left unculled.
However, with the way NFS superblock sharing are currently set to be
implemented, these assumptions are violated: the root of the filesystem is
simply a dummy dentry and inode (the real inode for '/' may well be
inaccessible), and all the vfsmounts are rooted on anonymous[*] dentries
with child trees.
[*] Anonymous until discovered from another tree.
(*) The documentation has been adjusted, including the additional bit of
changing ext2_* into foo_* in the documentation.
[akpm@osdl.org: convert ipath_fs, do other stuff]
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Cc: Nathan Scott <nathans@sgi.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-23 09:02:57 +00:00
|
|
|
if (IS_ERR(sb)) {
|
|
|
|
retval = PTR_ERR(sb);
|
9p: getattr client implementation for 9P2000.L protocol.
SYNOPSIS
size[4] Tgetattr tag[2] fid[4] request_mask[8]
size[4] Rgetattr tag[2] lstat[n]
DESCRIPTION
The getattr transaction inquires about the file identified by fid.
request_mask is a bit mask that specifies which fields of the
stat structure is the client interested in.
The reply will contain a machine-independent directory entry,
laid out as follows:
st_result_mask[8]
Bit mask that indicates which fields in the stat structure
have been populated by the server
qid.type[1]
the type of the file (directory, etc.), represented as a bit
vector corresponding to the high 8 bits of the file's mode
word.
qid.vers[4]
version number for given path
qid.path[8]
the file server's unique identification for the file
st_mode[4]
Permission and flags
st_uid[4]
User id of owner
st_gid[4]
Group ID of owner
st_nlink[8]
Number of hard links
st_rdev[8]
Device ID (if special file)
st_size[8]
Size, in bytes
st_blksize[8]
Block size for file system IO
st_blocks[8]
Number of file system blocks allocated
st_atime_sec[8]
Time of last access, seconds
st_atime_nsec[8]
Time of last access, nanoseconds
st_mtime_sec[8]
Time of last modification, seconds
st_mtime_nsec[8]
Time of last modification, nanoseconds
st_ctime_sec[8]
Time of last status change, seconds
st_ctime_nsec[8]
Time of last status change, nanoseconds
st_btime_sec[8]
Time of creation (birth) of file, seconds
st_btime_nsec[8]
Time of creation (birth) of file, nanoseconds
st_gen[8]
Inode generation
st_data_version[8]
Data version number
request_mask and result_mask bit masks contain the following bits
#define P9_STATS_MODE 0x00000001ULL
#define P9_STATS_NLINK 0x00000002ULL
#define P9_STATS_UID 0x00000004ULL
#define P9_STATS_GID 0x00000008ULL
#define P9_STATS_RDEV 0x00000010ULL
#define P9_STATS_ATIME 0x00000020ULL
#define P9_STATS_MTIME 0x00000040ULL
#define P9_STATS_CTIME 0x00000080ULL
#define P9_STATS_INO 0x00000100ULL
#define P9_STATS_SIZE 0x00000200ULL
#define P9_STATS_BLOCKS 0x00000400ULL
#define P9_STATS_BTIME 0x00000800ULL
#define P9_STATS_GEN 0x00001000ULL
#define P9_STATS_DATA_VERSION 0x00002000ULL
#define P9_STATS_BASIC 0x000007ffULL
#define P9_STATS_ALL 0x00003fffULL
This patch implements the client side of getattr implementation for
9P2000.L. It introduces a new structure p9_stat_dotl for getting
Linux stat information along with QID. The data layout is similar to
stat structure in Linux user space with the following major
differences:
inode (st_ino) is not part of data. Instead qid is.
device (st_dev) is not part of data because this doesn't make sense
on the client.
All time variables are 64 bit wide on the wire. The kernel seems to use
32 bit variables for these variables. However, some of the architectures
have used 64 bit variables and glibc exposes 64 bit variables to user
space on some architectures. Hence to be on the safer side we have made
these 64 bit in the protocol. Refer to the comments in
include/asm-generic/stat.h
There are some additional fields: st_btime_sec, st_btime_nsec, st_gen,
st_data_version apart from the bitmask, st_result_mask. The bit mask
is filled by the server to indicate which stat fields have been
populated by the server. Currently there is no clean way for the
server to obtain these additional fields, so it sends back just the
basic fields.
Signed-off-by: Sripathi Kodi <sripathik@in.ibm.com>
Signed-off-by: Eric Van Hensbegren <ericvh@gmail.com>
2010-07-12 14:37:23 +00:00
|
|
|
goto clunk_fid;
|
[PATCH] VFS: Permit filesystem to override root dentry on mount
Extend the get_sb() filesystem operation to take an extra argument that
permits the VFS to pass in the target vfsmount that defines the mountpoint.
The filesystem is then required to manually set the superblock and root dentry
pointers. For most filesystems, this should be done with simple_set_mnt()
which will set the superblock pointer and then set the root dentry to the
superblock's s_root (as per the old default behaviour).
The get_sb() op now returns an integer as there's now no need to return the
superblock pointer.
This patch permits a superblock to be implicitly shared amongst several mount
points, such as can be done with NFS to avoid potential inode aliasing. In
such a case, simple_set_mnt() would not be called, and instead the mnt_root
and mnt_sb would be set directly.
The patch also makes the following changes:
(*) the get_sb_*() convenience functions in the core kernel now take a vfsmount
pointer argument and return an integer, so most filesystems have to change
very little.
(*) If one of the convenience function is not used, then get_sb() should
normally call simple_set_mnt() to instantiate the vfsmount. This will
always return 0, and so can be tail-called from get_sb().
(*) generic_shutdown_super() now calls shrink_dcache_sb() to clean up the
dcache upon superblock destruction rather than shrink_dcache_anon().
This is required because the superblock may now have multiple trees that
aren't actually bound to s_root, but that still need to be cleaned up. The
currently called functions assume that the whole tree is rooted at s_root,
and that anonymous dentries are not the roots of trees which results in
dentries being left unculled.
However, with the way NFS superblock sharing are currently set to be
implemented, these assumptions are violated: the root of the filesystem is
simply a dummy dentry and inode (the real inode for '/' may well be
inaccessible), and all the vfsmounts are rooted on anonymous[*] dentries
with child trees.
[*] Anonymous until discovered from another tree.
(*) The documentation has been adjusted, including the additional bit of
changing ext2_* into foo_* in the documentation.
[akpm@osdl.org: convert ipath_fs, do other stuff]
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Cc: Nathan Scott <nathans@sgi.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-23 09:02:57 +00:00
|
|
|
}
|
2017-04-12 10:24:31 +00:00
|
|
|
retval = v9fs_fill_super(sb, v9ses, flags, data);
|
|
|
|
if (retval)
|
|
|
|
goto release_sb;
|
2005-09-09 20:04:20 +00:00
|
|
|
|
2014-01-10 12:44:09 +00:00
|
|
|
if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE)
|
2011-01-12 22:10:55 +00:00
|
|
|
sb->s_d_op = &v9fs_cached_dentry_operations;
|
|
|
|
else
|
|
|
|
sb->s_d_op = &v9fs_dentry_operations;
|
|
|
|
|
2011-07-25 18:06:33 +00:00
|
|
|
inode = v9fs_get_inode(sb, S_IFDIR | mode, 0);
|
2005-09-09 20:04:20 +00:00
|
|
|
if (IS_ERR(inode)) {
|
|
|
|
retval = PTR_ERR(inode);
|
2008-05-09 01:26:37 +00:00
|
|
|
goto release_sb;
|
2005-09-09 20:04:20 +00:00
|
|
|
}
|
2011-03-24 15:08:35 +00:00
|
|
|
|
2012-01-09 03:15:13 +00:00
|
|
|
root = d_make_root(inode);
|
2005-09-09 20:04:20 +00:00
|
|
|
if (!root) {
|
|
|
|
retval = -ENOMEM;
|
2008-05-09 01:26:37 +00:00
|
|
|
goto release_sb;
|
2005-09-09 20:04:20 +00:00
|
|
|
}
|
|
|
|
sb->s_root = root;
|
9p: getattr client implementation for 9P2000.L protocol.
SYNOPSIS
size[4] Tgetattr tag[2] fid[4] request_mask[8]
size[4] Rgetattr tag[2] lstat[n]
DESCRIPTION
The getattr transaction inquires about the file identified by fid.
request_mask is a bit mask that specifies which fields of the
stat structure is the client interested in.
The reply will contain a machine-independent directory entry,
laid out as follows:
st_result_mask[8]
Bit mask that indicates which fields in the stat structure
have been populated by the server
qid.type[1]
the type of the file (directory, etc.), represented as a bit
vector corresponding to the high 8 bits of the file's mode
word.
qid.vers[4]
version number for given path
qid.path[8]
the file server's unique identification for the file
st_mode[4]
Permission and flags
st_uid[4]
User id of owner
st_gid[4]
Group ID of owner
st_nlink[8]
Number of hard links
st_rdev[8]
Device ID (if special file)
st_size[8]
Size, in bytes
st_blksize[8]
Block size for file system IO
st_blocks[8]
Number of file system blocks allocated
st_atime_sec[8]
Time of last access, seconds
st_atime_nsec[8]
Time of last access, nanoseconds
st_mtime_sec[8]
Time of last modification, seconds
st_mtime_nsec[8]
Time of last modification, nanoseconds
st_ctime_sec[8]
Time of last status change, seconds
st_ctime_nsec[8]
Time of last status change, nanoseconds
st_btime_sec[8]
Time of creation (birth) of file, seconds
st_btime_nsec[8]
Time of creation (birth) of file, nanoseconds
st_gen[8]
Inode generation
st_data_version[8]
Data version number
request_mask and result_mask bit masks contain the following bits
#define P9_STATS_MODE 0x00000001ULL
#define P9_STATS_NLINK 0x00000002ULL
#define P9_STATS_UID 0x00000004ULL
#define P9_STATS_GID 0x00000008ULL
#define P9_STATS_RDEV 0x00000010ULL
#define P9_STATS_ATIME 0x00000020ULL
#define P9_STATS_MTIME 0x00000040ULL
#define P9_STATS_CTIME 0x00000080ULL
#define P9_STATS_INO 0x00000100ULL
#define P9_STATS_SIZE 0x00000200ULL
#define P9_STATS_BLOCKS 0x00000400ULL
#define P9_STATS_BTIME 0x00000800ULL
#define P9_STATS_GEN 0x00001000ULL
#define P9_STATS_DATA_VERSION 0x00002000ULL
#define P9_STATS_BASIC 0x000007ffULL
#define P9_STATS_ALL 0x00003fffULL
This patch implements the client side of getattr implementation for
9P2000.L. It introduces a new structure p9_stat_dotl for getting
Linux stat information along with QID. The data layout is similar to
stat structure in Linux user space with the following major
differences:
inode (st_ino) is not part of data. Instead qid is.
device (st_dev) is not part of data because this doesn't make sense
on the client.
All time variables are 64 bit wide on the wire. The kernel seems to use
32 bit variables for these variables. However, some of the architectures
have used 64 bit variables and glibc exposes 64 bit variables to user
space on some architectures. Hence to be on the safer side we have made
these 64 bit in the protocol. Refer to the comments in
include/asm-generic/stat.h
There are some additional fields: st_btime_sec, st_btime_nsec, st_gen,
st_data_version apart from the bitmask, st_result_mask. The bit mask
is filled by the server to indicate which stat fields have been
populated by the server. Currently there is no clean way for the
server to obtain these additional fields, so it sends back just the
basic fields.
Signed-off-by: Sripathi Kodi <sripathik@in.ibm.com>
Signed-off-by: Eric Van Hensbegren <ericvh@gmail.com>
2010-07-12 14:37:23 +00:00
|
|
|
if (v9fs_proto_dotl(v9ses)) {
|
|
|
|
struct p9_stat_dotl *st = NULL;
|
|
|
|
st = p9_client_getattr_dotl(fid, P9_STATS_BASIC);
|
|
|
|
if (IS_ERR(st)) {
|
|
|
|
retval = PTR_ERR(st);
|
2010-08-24 10:30:49 +00:00
|
|
|
goto release_sb;
|
9p: getattr client implementation for 9P2000.L protocol.
SYNOPSIS
size[4] Tgetattr tag[2] fid[4] request_mask[8]
size[4] Rgetattr tag[2] lstat[n]
DESCRIPTION
The getattr transaction inquires about the file identified by fid.
request_mask is a bit mask that specifies which fields of the
stat structure is the client interested in.
The reply will contain a machine-independent directory entry,
laid out as follows:
st_result_mask[8]
Bit mask that indicates which fields in the stat structure
have been populated by the server
qid.type[1]
the type of the file (directory, etc.), represented as a bit
vector corresponding to the high 8 bits of the file's mode
word.
qid.vers[4]
version number for given path
qid.path[8]
the file server's unique identification for the file
st_mode[4]
Permission and flags
st_uid[4]
User id of owner
st_gid[4]
Group ID of owner
st_nlink[8]
Number of hard links
st_rdev[8]
Device ID (if special file)
st_size[8]
Size, in bytes
st_blksize[8]
Block size for file system IO
st_blocks[8]
Number of file system blocks allocated
st_atime_sec[8]
Time of last access, seconds
st_atime_nsec[8]
Time of last access, nanoseconds
st_mtime_sec[8]
Time of last modification, seconds
st_mtime_nsec[8]
Time of last modification, nanoseconds
st_ctime_sec[8]
Time of last status change, seconds
st_ctime_nsec[8]
Time of last status change, nanoseconds
st_btime_sec[8]
Time of creation (birth) of file, seconds
st_btime_nsec[8]
Time of creation (birth) of file, nanoseconds
st_gen[8]
Inode generation
st_data_version[8]
Data version number
request_mask and result_mask bit masks contain the following bits
#define P9_STATS_MODE 0x00000001ULL
#define P9_STATS_NLINK 0x00000002ULL
#define P9_STATS_UID 0x00000004ULL
#define P9_STATS_GID 0x00000008ULL
#define P9_STATS_RDEV 0x00000010ULL
#define P9_STATS_ATIME 0x00000020ULL
#define P9_STATS_MTIME 0x00000040ULL
#define P9_STATS_CTIME 0x00000080ULL
#define P9_STATS_INO 0x00000100ULL
#define P9_STATS_SIZE 0x00000200ULL
#define P9_STATS_BLOCKS 0x00000400ULL
#define P9_STATS_BTIME 0x00000800ULL
#define P9_STATS_GEN 0x00001000ULL
#define P9_STATS_DATA_VERSION 0x00002000ULL
#define P9_STATS_BASIC 0x000007ffULL
#define P9_STATS_ALL 0x00003fffULL
This patch implements the client side of getattr implementation for
9P2000.L. It introduces a new structure p9_stat_dotl for getting
Linux stat information along with QID. The data layout is similar to
stat structure in Linux user space with the following major
differences:
inode (st_ino) is not part of data. Instead qid is.
device (st_dev) is not part of data because this doesn't make sense
on the client.
All time variables are 64 bit wide on the wire. The kernel seems to use
32 bit variables for these variables. However, some of the architectures
have used 64 bit variables and glibc exposes 64 bit variables to user
space on some architectures. Hence to be on the safer side we have made
these 64 bit in the protocol. Refer to the comments in
include/asm-generic/stat.h
There are some additional fields: st_btime_sec, st_btime_nsec, st_gen,
st_data_version apart from the bitmask, st_result_mask. The bit mask
is filled by the server to indicate which stat fields have been
populated by the server. Currently there is no clean way for the
server to obtain these additional fields, so it sends back just the
basic fields.
Signed-off-by: Sripathi Kodi <sripathik@in.ibm.com>
Signed-off-by: Eric Van Hensbegren <ericvh@gmail.com>
2010-07-12 14:37:23 +00:00
|
|
|
}
|
2015-03-17 22:25:59 +00:00
|
|
|
d_inode(root)->i_ino = v9fs_qid2ino(&st->qid);
|
2019-01-24 06:35:13 +00:00
|
|
|
v9fs_stat2inode_dotl(st, d_inode(root), 0);
|
9p: getattr client implementation for 9P2000.L protocol.
SYNOPSIS
size[4] Tgetattr tag[2] fid[4] request_mask[8]
size[4] Rgetattr tag[2] lstat[n]
DESCRIPTION
The getattr transaction inquires about the file identified by fid.
request_mask is a bit mask that specifies which fields of the
stat structure is the client interested in.
The reply will contain a machine-independent directory entry,
laid out as follows:
st_result_mask[8]
Bit mask that indicates which fields in the stat structure
have been populated by the server
qid.type[1]
the type of the file (directory, etc.), represented as a bit
vector corresponding to the high 8 bits of the file's mode
word.
qid.vers[4]
version number for given path
qid.path[8]
the file server's unique identification for the file
st_mode[4]
Permission and flags
st_uid[4]
User id of owner
st_gid[4]
Group ID of owner
st_nlink[8]
Number of hard links
st_rdev[8]
Device ID (if special file)
st_size[8]
Size, in bytes
st_blksize[8]
Block size for file system IO
st_blocks[8]
Number of file system blocks allocated
st_atime_sec[8]
Time of last access, seconds
st_atime_nsec[8]
Time of last access, nanoseconds
st_mtime_sec[8]
Time of last modification, seconds
st_mtime_nsec[8]
Time of last modification, nanoseconds
st_ctime_sec[8]
Time of last status change, seconds
st_ctime_nsec[8]
Time of last status change, nanoseconds
st_btime_sec[8]
Time of creation (birth) of file, seconds
st_btime_nsec[8]
Time of creation (birth) of file, nanoseconds
st_gen[8]
Inode generation
st_data_version[8]
Data version number
request_mask and result_mask bit masks contain the following bits
#define P9_STATS_MODE 0x00000001ULL
#define P9_STATS_NLINK 0x00000002ULL
#define P9_STATS_UID 0x00000004ULL
#define P9_STATS_GID 0x00000008ULL
#define P9_STATS_RDEV 0x00000010ULL
#define P9_STATS_ATIME 0x00000020ULL
#define P9_STATS_MTIME 0x00000040ULL
#define P9_STATS_CTIME 0x00000080ULL
#define P9_STATS_INO 0x00000100ULL
#define P9_STATS_SIZE 0x00000200ULL
#define P9_STATS_BLOCKS 0x00000400ULL
#define P9_STATS_BTIME 0x00000800ULL
#define P9_STATS_GEN 0x00001000ULL
#define P9_STATS_DATA_VERSION 0x00002000ULL
#define P9_STATS_BASIC 0x000007ffULL
#define P9_STATS_ALL 0x00003fffULL
This patch implements the client side of getattr implementation for
9P2000.L. It introduces a new structure p9_stat_dotl for getting
Linux stat information along with QID. The data layout is similar to
stat structure in Linux user space with the following major
differences:
inode (st_ino) is not part of data. Instead qid is.
device (st_dev) is not part of data because this doesn't make sense
on the client.
All time variables are 64 bit wide on the wire. The kernel seems to use
32 bit variables for these variables. However, some of the architectures
have used 64 bit variables and glibc exposes 64 bit variables to user
space on some architectures. Hence to be on the safer side we have made
these 64 bit in the protocol. Refer to the comments in
include/asm-generic/stat.h
There are some additional fields: st_btime_sec, st_btime_nsec, st_gen,
st_data_version apart from the bitmask, st_result_mask. The bit mask
is filled by the server to indicate which stat fields have been
populated by the server. Currently there is no clean way for the
server to obtain these additional fields, so it sends back just the
basic fields.
Signed-off-by: Sripathi Kodi <sripathik@in.ibm.com>
Signed-off-by: Eric Van Hensbegren <ericvh@gmail.com>
2010-07-12 14:37:23 +00:00
|
|
|
kfree(st);
|
|
|
|
} else {
|
|
|
|
struct p9_wstat *st = NULL;
|
|
|
|
st = p9_client_stat(fid);
|
|
|
|
if (IS_ERR(st)) {
|
|
|
|
retval = PTR_ERR(st);
|
2010-08-24 10:30:49 +00:00
|
|
|
goto release_sb;
|
9p: getattr client implementation for 9P2000.L protocol.
SYNOPSIS
size[4] Tgetattr tag[2] fid[4] request_mask[8]
size[4] Rgetattr tag[2] lstat[n]
DESCRIPTION
The getattr transaction inquires about the file identified by fid.
request_mask is a bit mask that specifies which fields of the
stat structure is the client interested in.
The reply will contain a machine-independent directory entry,
laid out as follows:
st_result_mask[8]
Bit mask that indicates which fields in the stat structure
have been populated by the server
qid.type[1]
the type of the file (directory, etc.), represented as a bit
vector corresponding to the high 8 bits of the file's mode
word.
qid.vers[4]
version number for given path
qid.path[8]
the file server's unique identification for the file
st_mode[4]
Permission and flags
st_uid[4]
User id of owner
st_gid[4]
Group ID of owner
st_nlink[8]
Number of hard links
st_rdev[8]
Device ID (if special file)
st_size[8]
Size, in bytes
st_blksize[8]
Block size for file system IO
st_blocks[8]
Number of file system blocks allocated
st_atime_sec[8]
Time of last access, seconds
st_atime_nsec[8]
Time of last access, nanoseconds
st_mtime_sec[8]
Time of last modification, seconds
st_mtime_nsec[8]
Time of last modification, nanoseconds
st_ctime_sec[8]
Time of last status change, seconds
st_ctime_nsec[8]
Time of last status change, nanoseconds
st_btime_sec[8]
Time of creation (birth) of file, seconds
st_btime_nsec[8]
Time of creation (birth) of file, nanoseconds
st_gen[8]
Inode generation
st_data_version[8]
Data version number
request_mask and result_mask bit masks contain the following bits
#define P9_STATS_MODE 0x00000001ULL
#define P9_STATS_NLINK 0x00000002ULL
#define P9_STATS_UID 0x00000004ULL
#define P9_STATS_GID 0x00000008ULL
#define P9_STATS_RDEV 0x00000010ULL
#define P9_STATS_ATIME 0x00000020ULL
#define P9_STATS_MTIME 0x00000040ULL
#define P9_STATS_CTIME 0x00000080ULL
#define P9_STATS_INO 0x00000100ULL
#define P9_STATS_SIZE 0x00000200ULL
#define P9_STATS_BLOCKS 0x00000400ULL
#define P9_STATS_BTIME 0x00000800ULL
#define P9_STATS_GEN 0x00001000ULL
#define P9_STATS_DATA_VERSION 0x00002000ULL
#define P9_STATS_BASIC 0x000007ffULL
#define P9_STATS_ALL 0x00003fffULL
This patch implements the client side of getattr implementation for
9P2000.L. It introduces a new structure p9_stat_dotl for getting
Linux stat information along with QID. The data layout is similar to
stat structure in Linux user space with the following major
differences:
inode (st_ino) is not part of data. Instead qid is.
device (st_dev) is not part of data because this doesn't make sense
on the client.
All time variables are 64 bit wide on the wire. The kernel seems to use
32 bit variables for these variables. However, some of the architectures
have used 64 bit variables and glibc exposes 64 bit variables to user
space on some architectures. Hence to be on the safer side we have made
these 64 bit in the protocol. Refer to the comments in
include/asm-generic/stat.h
There are some additional fields: st_btime_sec, st_btime_nsec, st_gen,
st_data_version apart from the bitmask, st_result_mask. The bit mask
is filled by the server to indicate which stat fields have been
populated by the server. Currently there is no clean way for the
server to obtain these additional fields, so it sends back just the
basic fields.
Signed-off-by: Sripathi Kodi <sripathik@in.ibm.com>
Signed-off-by: Eric Van Hensbegren <ericvh@gmail.com>
2010-07-12 14:37:23 +00:00
|
|
|
}
|
|
|
|
|
2015-03-17 22:25:59 +00:00
|
|
|
d_inode(root)->i_ino = v9fs_qid2ino(&st->qid);
|
2019-01-24 06:35:13 +00:00
|
|
|
v9fs_stat2inode(st, d_inode(root), sb, 0);
|
9p: getattr client implementation for 9P2000.L protocol.
SYNOPSIS
size[4] Tgetattr tag[2] fid[4] request_mask[8]
size[4] Rgetattr tag[2] lstat[n]
DESCRIPTION
The getattr transaction inquires about the file identified by fid.
request_mask is a bit mask that specifies which fields of the
stat structure is the client interested in.
The reply will contain a machine-independent directory entry,
laid out as follows:
st_result_mask[8]
Bit mask that indicates which fields in the stat structure
have been populated by the server
qid.type[1]
the type of the file (directory, etc.), represented as a bit
vector corresponding to the high 8 bits of the file's mode
word.
qid.vers[4]
version number for given path
qid.path[8]
the file server's unique identification for the file
st_mode[4]
Permission and flags
st_uid[4]
User id of owner
st_gid[4]
Group ID of owner
st_nlink[8]
Number of hard links
st_rdev[8]
Device ID (if special file)
st_size[8]
Size, in bytes
st_blksize[8]
Block size for file system IO
st_blocks[8]
Number of file system blocks allocated
st_atime_sec[8]
Time of last access, seconds
st_atime_nsec[8]
Time of last access, nanoseconds
st_mtime_sec[8]
Time of last modification, seconds
st_mtime_nsec[8]
Time of last modification, nanoseconds
st_ctime_sec[8]
Time of last status change, seconds
st_ctime_nsec[8]
Time of last status change, nanoseconds
st_btime_sec[8]
Time of creation (birth) of file, seconds
st_btime_nsec[8]
Time of creation (birth) of file, nanoseconds
st_gen[8]
Inode generation
st_data_version[8]
Data version number
request_mask and result_mask bit masks contain the following bits
#define P9_STATS_MODE 0x00000001ULL
#define P9_STATS_NLINK 0x00000002ULL
#define P9_STATS_UID 0x00000004ULL
#define P9_STATS_GID 0x00000008ULL
#define P9_STATS_RDEV 0x00000010ULL
#define P9_STATS_ATIME 0x00000020ULL
#define P9_STATS_MTIME 0x00000040ULL
#define P9_STATS_CTIME 0x00000080ULL
#define P9_STATS_INO 0x00000100ULL
#define P9_STATS_SIZE 0x00000200ULL
#define P9_STATS_BLOCKS 0x00000400ULL
#define P9_STATS_BTIME 0x00000800ULL
#define P9_STATS_GEN 0x00001000ULL
#define P9_STATS_DATA_VERSION 0x00002000ULL
#define P9_STATS_BASIC 0x000007ffULL
#define P9_STATS_ALL 0x00003fffULL
This patch implements the client side of getattr implementation for
9P2000.L. It introduces a new structure p9_stat_dotl for getting
Linux stat information along with QID. The data layout is similar to
stat structure in Linux user space with the following major
differences:
inode (st_ino) is not part of data. Instead qid is.
device (st_dev) is not part of data because this doesn't make sense
on the client.
All time variables are 64 bit wide on the wire. The kernel seems to use
32 bit variables for these variables. However, some of the architectures
have used 64 bit variables and glibc exposes 64 bit variables to user
space on some architectures. Hence to be on the safer side we have made
these 64 bit in the protocol. Refer to the comments in
include/asm-generic/stat.h
There are some additional fields: st_btime_sec, st_btime_nsec, st_gen,
st_data_version apart from the bitmask, st_result_mask. The bit mask
is filled by the server to indicate which stat fields have been
populated by the server. Currently there is no clean way for the
server to obtain these additional fields, so it sends back just the
basic fields.
Signed-off-by: Sripathi Kodi <sripathik@in.ibm.com>
Signed-off-by: Eric Van Hensbegren <ericvh@gmail.com>
2010-07-12 14:37:23 +00:00
|
|
|
|
|
|
|
p9stat_free(st);
|
|
|
|
kfree(st);
|
|
|
|
}
|
2010-09-27 18:57:39 +00:00
|
|
|
retval = v9fs_get_acl(inode, fid);
|
|
|
|
if (retval)
|
|
|
|
goto release_sb;
|
2011-03-24 15:08:35 +00:00
|
|
|
v9fs_fid_add(root, fid);
|
2005-09-09 20:04:20 +00:00
|
|
|
|
2011-11-28 18:40:46 +00:00
|
|
|
p9_debug(P9_DEBUG_VFS, " simple set mount, return 0\n");
|
2010-07-25 19:56:43 +00:00
|
|
|
return dget(sb->s_root);
|
2005-09-09 20:04:20 +00:00
|
|
|
|
2008-05-09 01:26:37 +00:00
|
|
|
clunk_fid:
|
|
|
|
p9_client_clunk(fid);
|
|
|
|
v9fs_session_close(v9ses);
|
2015-06-08 05:57:31 +00:00
|
|
|
free_session:
|
2008-05-09 01:26:37 +00:00
|
|
|
kfree(v9ses);
|
2010-07-25 19:56:43 +00:00
|
|
|
return ERR_PTR(retval);
|
2011-03-24 15:08:35 +00:00
|
|
|
|
2009-07-19 19:41:52 +00:00
|
|
|
release_sb:
|
2010-08-24 10:30:49 +00:00
|
|
|
/*
|
2011-03-24 15:08:35 +00:00
|
|
|
* we will do the session_close and root dentry release
|
|
|
|
* in the below call. But we need to clunk fid, because we haven't
|
|
|
|
* attached the fid to dentry so it won't get clunked
|
|
|
|
* automatically.
|
2010-08-24 10:30:49 +00:00
|
|
|
*/
|
2011-03-24 15:08:35 +00:00
|
|
|
p9_client_clunk(fid);
|
2009-07-19 19:41:52 +00:00
|
|
|
deactivate_locked_super(sb);
|
2010-07-25 19:56:43 +00:00
|
|
|
return ERR_PTR(retval);
|
2005-09-09 20:04:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* v9fs_kill_super - Kill Superblock
|
|
|
|
* @s: superblock
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void v9fs_kill_super(struct super_block *s)
|
|
|
|
{
|
|
|
|
struct v9fs_session_info *v9ses = s->s_fs_info;
|
|
|
|
|
2011-11-28 18:40:46 +00:00
|
|
|
p9_debug(P9_DEBUG_VFS, " %p\n", s);
|
2005-09-09 20:04:20 +00:00
|
|
|
|
|
|
|
kill_anon_super(s);
|
2011-03-24 15:08:35 +00:00
|
|
|
|
2010-03-29 23:13:59 +00:00
|
|
|
v9fs_session_cancel(v9ses);
|
2005-09-09 20:04:20 +00:00
|
|
|
v9fs_session_close(v9ses);
|
|
|
|
kfree(v9ses);
|
2009-07-19 19:41:52 +00:00
|
|
|
s->s_fs_info = NULL;
|
2011-11-28 18:40:46 +00:00
|
|
|
p9_debug(P9_DEBUG_VFS, "exiting kill_super\n");
|
2005-09-09 20:04:20 +00:00
|
|
|
}
|
|
|
|
|
2005-09-09 20:04:23 +00:00
|
|
|
static void
|
2008-04-24 11:21:56 +00:00
|
|
|
v9fs_umount_begin(struct super_block *sb)
|
2005-09-09 20:04:23 +00:00
|
|
|
{
|
2009-04-24 07:06:53 +00:00
|
|
|
struct v9fs_session_info *v9ses;
|
2005-09-09 20:04:23 +00:00
|
|
|
|
2009-04-24 07:06:53 +00:00
|
|
|
v9ses = sb->s_fs_info;
|
2010-03-29 23:13:59 +00:00
|
|
|
v9fs_session_begin_cancel(v9ses);
|
2005-09-09 20:04:23 +00:00
|
|
|
}
|
|
|
|
|
2010-03-25 12:45:30 +00:00
|
|
|
static int v9fs_statfs(struct dentry *dentry, struct kstatfs *buf)
|
|
|
|
{
|
|
|
|
struct v9fs_session_info *v9ses;
|
|
|
|
struct p9_fid *fid;
|
|
|
|
struct p9_rstatfs rs;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
fid = v9fs_fid_lookup(dentry);
|
|
|
|
if (IS_ERR(fid)) {
|
|
|
|
res = PTR_ERR(fid);
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
2011-03-08 11:09:50 +00:00
|
|
|
v9ses = v9fs_dentry2v9ses(dentry);
|
2010-03-25 12:45:30 +00:00
|
|
|
if (v9fs_proto_dotl(v9ses)) {
|
|
|
|
res = p9_client_statfs(fid, &rs);
|
|
|
|
if (res == 0) {
|
2011-06-30 16:03:38 +00:00
|
|
|
buf->f_type = rs.type;
|
2010-03-25 12:45:30 +00:00
|
|
|
buf->f_bsize = rs.bsize;
|
|
|
|
buf->f_blocks = rs.blocks;
|
|
|
|
buf->f_bfree = rs.bfree;
|
|
|
|
buf->f_bavail = rs.bavail;
|
|
|
|
buf->f_files = rs.files;
|
|
|
|
buf->f_ffree = rs.ffree;
|
|
|
|
buf->f_fsid.val[0] = rs.fsid & 0xFFFFFFFFUL;
|
|
|
|
buf->f_fsid.val[1] = (rs.fsid >> 32) & 0xFFFFFFFFUL;
|
|
|
|
buf->f_namelen = rs.namelen;
|
|
|
|
}
|
|
|
|
if (res != -ENOSYS)
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
res = simple_statfs(dentry, buf);
|
|
|
|
done:
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2011-02-28 11:34:05 +00:00
|
|
|
static int v9fs_drop_inode(struct inode *inode)
|
|
|
|
{
|
|
|
|
struct v9fs_session_info *v9ses;
|
|
|
|
v9ses = v9fs_inode2v9ses(inode);
|
2014-01-10 12:44:09 +00:00
|
|
|
if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE)
|
2011-02-28 11:34:05 +00:00
|
|
|
return generic_drop_inode(inode);
|
|
|
|
/*
|
|
|
|
* in case of non cached mode always drop the
|
|
|
|
* the inode because we want the inode attribute
|
|
|
|
* to always match that on the server.
|
|
|
|
*/
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2011-03-23 09:41:27 +00:00
|
|
|
static int v9fs_write_inode(struct inode *inode,
|
|
|
|
struct writeback_control *wbc)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
struct p9_wstat wstat;
|
|
|
|
struct v9fs_inode *v9inode;
|
|
|
|
/*
|
|
|
|
* send an fsync request to server irrespective of
|
|
|
|
* wbc->sync_mode.
|
|
|
|
*/
|
2011-11-28 18:40:46 +00:00
|
|
|
p9_debug(P9_DEBUG_VFS, "%s: inode %p\n", __func__, inode);
|
2011-03-23 09:41:27 +00:00
|
|
|
v9inode = V9FS_I(inode);
|
|
|
|
if (!v9inode->writeback_fid)
|
|
|
|
return 0;
|
|
|
|
v9fs_blank_wstat(&wstat);
|
|
|
|
|
|
|
|
ret = p9_client_wstat(v9inode->writeback_fid, &wstat);
|
|
|
|
if (ret < 0) {
|
|
|
|
__mark_inode_dirty(inode, I_DIRTY_DATASYNC);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int v9fs_write_inode_dotl(struct inode *inode,
|
|
|
|
struct writeback_control *wbc)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
struct v9fs_inode *v9inode;
|
|
|
|
/*
|
|
|
|
* send an fsync request to server irrespective of
|
|
|
|
* wbc->sync_mode.
|
|
|
|
*/
|
|
|
|
v9inode = V9FS_I(inode);
|
2014-01-10 12:44:09 +00:00
|
|
|
p9_debug(P9_DEBUG_VFS, "%s: inode %p, writeback_fid %p\n",
|
|
|
|
__func__, inode, v9inode->writeback_fid);
|
2011-03-23 09:41:27 +00:00
|
|
|
if (!v9inode->writeback_fid)
|
|
|
|
return 0;
|
2014-01-10 12:44:09 +00:00
|
|
|
|
2011-03-23 09:41:27 +00:00
|
|
|
ret = p9_client_fsync(v9inode->writeback_fid, 0);
|
|
|
|
if (ret < 0) {
|
|
|
|
__mark_inode_dirty(inode, I_DIRTY_DATASYNC);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-02-12 08:55:41 +00:00
|
|
|
static const struct super_operations v9fs_super_ops = {
|
2009-09-23 18:00:27 +00:00
|
|
|
.alloc_inode = v9fs_alloc_inode,
|
|
|
|
.destroy_inode = v9fs_destroy_inode,
|
2005-09-09 20:04:20 +00:00
|
|
|
.statfs = simple_statfs,
|
2010-06-07 18:34:48 +00:00
|
|
|
.evict_inode = v9fs_evict_inode,
|
2017-07-05 15:25:37 +00:00
|
|
|
.show_options = v9fs_show_options,
|
2005-09-09 20:04:23 +00:00
|
|
|
.umount_begin = v9fs_umount_begin,
|
2011-03-23 09:41:27 +00:00
|
|
|
.write_inode = v9fs_write_inode,
|
2005-09-09 20:04:20 +00:00
|
|
|
};
|
|
|
|
|
2010-03-25 12:41:54 +00:00
|
|
|
static const struct super_operations v9fs_super_ops_dotl = {
|
|
|
|
.alloc_inode = v9fs_alloc_inode,
|
|
|
|
.destroy_inode = v9fs_destroy_inode,
|
2010-03-25 12:45:30 +00:00
|
|
|
.statfs = v9fs_statfs,
|
2011-02-28 11:34:05 +00:00
|
|
|
.drop_inode = v9fs_drop_inode,
|
2010-06-07 18:34:48 +00:00
|
|
|
.evict_inode = v9fs_evict_inode,
|
2017-07-05 15:25:37 +00:00
|
|
|
.show_options = v9fs_show_options,
|
2010-03-25 12:41:54 +00:00
|
|
|
.umount_begin = v9fs_umount_begin,
|
2011-03-23 09:41:27 +00:00
|
|
|
.write_inode = v9fs_write_inode_dotl,
|
2010-03-25 12:41:54 +00:00
|
|
|
};
|
|
|
|
|
2005-09-09 20:04:20 +00:00
|
|
|
struct file_system_type v9fs_fs_type = {
|
2006-03-25 11:07:29 +00:00
|
|
|
.name = "9p",
|
2010-07-25 19:56:43 +00:00
|
|
|
.mount = v9fs_mount,
|
2005-09-09 20:04:20 +00:00
|
|
|
.kill_sb = v9fs_kill_super,
|
|
|
|
.owner = THIS_MODULE,
|
2013-02-20 16:19:05 +00:00
|
|
|
.fs_flags = FS_RENAME_DOES_D_MOVE,
|
2005-09-09 20:04:20 +00:00
|
|
|
};
|
2013-03-03 03:39:14 +00:00
|
|
|
MODULE_ALIAS_FS("9p");
|