Squashed and re-organized pnfs-submit tree
Subsystems (3)
cover Squashed and re-organized pnfs-submit tree
Here is the pnfs-submit tree all squashed and reorganized. The resultant tree is unchanged. The patch comments and Signed-off-by's need to be added.
We may want to split or re-order some of the patches. I left the "introduce new file" patches #6-9 unsquashed, but we probably want to squash them into the patch that uses them first.
Patches 1-4 are not pnfs patches, and should be submitted to Trond/Bruce.
Patch #50 "SQUASHME pnfs_submit: remove this unused code" should not be squashed, but removed.
Patches 47,-49 are for the post-submit trees.
-->Andy
PATCH 1/50 nfs41: prevent exchange_id from sending server-only flag
From: Fred Isaman <[email protected]>
clp->cl_exchange_flags is used both for client output and server input. This causes problems in certain recovery situations, when the server has sent back EXCHGID4_FLAG_CONFIRMED_R, causing the client to erroneously use the flag in future EXCHANGE_ID requests.
--- fs/nfs/nfs4proc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
fs/nfs/nfs4proc.c +1 -1
@@ -4573,7 +4573,7 @@ int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred)nfs4_verifier verifier;struct nfs41_exchange_id_args args = { .client = clp, - .flags = clp->cl_exchange_flags, + .flags = clp->cl_exchange_flags & ~EXCHGID4_FLAG_CONFIRMED_R , };struct nfs41_exchange_id_res res = { .client = clp,
Signature · 1 line
1.6.2.5
PATCH 2/50 sunrpc: define xdr_decode_opaque_fixed
From: Benny Halevy <[email protected]>
A helper for decoding a fixed length opaque value. Returns a pointer to the next item in the xdr stream.
--- include/linux/sunrpc/xdr.h | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
include/linux/sunrpc/xdr.h +7 -0
@@ -131,6 +131,13 @@ xdr_decode_hyper(__be32 *p, __u64 *valp)return p +2 ; } +static inline __be32 * +xdr_decode_opaque_fixed (__be32 *p,void *ptr,unsigned int len) +{ +memcpy (ptr, p, len); +return p +XDR_QUADLEN (len); +} +/* * Adjust kvec to reflect end of xdr'ed data (RPC client XDR) */
Signature · 1 line
1.6.2.5
PATCH 3/50 sunrpc: don't reset buflen twice in xdr_shrink_pagelen
From: Benny Halevy <[email protected]>
Quoted 5 lines · On Jan. 14, 2009, 2:50 +0200, [email protected] wrote:
From: Andy Adamson <[email protected]>
The buflen is reset for all cases at the end of
xdr_shrink_pagelen. The data left in the tail afterxdr_read_pagesis not processed when the buflen is incorrectly set.
Note that in this case we also lose (len - tail->iov_len) bytes from the buffered data in pages.
--- net/sunrpc/xdr.c | 14 ++++++-------- 1 files changed, 6 insertions(+), 8 deletions(-)
net/sunrpc/xdr.c +6 -8
@@ -403,16 +403,14 @@ xdr_shrink_pagelen(struct xdr_buf *buf, size_t len)/* Shift the tail first */ if (tail->iov_len !=0 ) { - p = (char *)tail->iov_base + len; -if (tail->iov_len > len) { - copy = tail->iov_len - len; -memmove (p, tail->iov_base, copy); - }else - buf->buflen -= len; -/* Copy from the inlined pages into the tail */ copy = len; -if (copy > tail->iov_len) +if (tail->iov_len > len) { + p = (char *)tail->iov_base + len; +memmove (p, tail->iov_base, tail->iov_len - len); + }else { copy = tail->iov_len; + } +/* Copy from the inlined pages into the tail */ _copy_from_pages ((char *)tail->iov_base, buf->pages, buf->page_base + pglen - len, copy);
Signature · 1 line
1.6.2.5
PATCH 4/50 nfsd: remove duplicate NFS4_STATEID_SIZE declaration
From: Andy Adamson <[email protected]>
Use NFS4_STATEID_SIZE from include/linux/nfs4
--- fs/nfsd/nfs4callback.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
fs/nfsd/nfs4callback.c +0 -1
@@ -41,7 +41,6 @@#define NFSPROC4_CB_NULL 0#define NFSPROC4_CB_COMPOUND 1 -#define NFS4_STATEID_SIZE 16/* Index of predefined Linux callback client operations */
Signature · 1 line
1.6.2.5
PATCH 5/50 pnfs_submit: pnfs and nfslayoutdriver kconfig
From: The pNFS Team <[email protected]>
--- fs/nfs/Kconfig | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-)
fs/nfs/Kconfig +11 -1
@@ -79,7 +79,17 @@ config NFS_V4_1 depends on NFS_V4 && EXPERIMENTAL help This option enables support for minor version 1 of the NFSv4 protocol - (draft-ietf-nfsv4-minorversion1) in the kernel's NFS client. + (RFC5661) including support for the parallel NFS (pNFS) features + in the kernel's NFS client. + + Unless you're an NFS developer, say N. + +config PNFS_FILE_LAYOUT + tristate "NFS client support for the pNFS nfs-files layout (DEVELOPER ONLY)" + depends on NFS_FS && NFS_V4_1 + default y + help + This option enables support for the pNFS nfs-files layout. Unless you're an NFS developer, say N.
Signature · 1 line
1.6.2.5
PATCH 6/50 pnfs_submit: introduce include/linux/nfs4_pnfs.h
From: The pNFS Team <[email protected]>
Common data structures needed by the pnfs client and pnfs layout driver.
--- include/linux/nfs4_pnfs.h | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) create mode 100644 include/linux/nfs4_pnfs.h
include/linux/nfs4_pnfs.h new file +15 -0
@@ -0,0 +1,15 @@ +/* +* include/linux/nfs4_pnfs.h +* +* Common data structures needed by the pnfs client and pnfs layout driver. +* +* Copyright (c) 2002 The Regents of the University of Michigan. +* All rights reserved. +* +* Dean Hildebrand <[email protected]> +*/ + +#ifndef LINUX_NFS4_PNFS_H +#define LINUX_NFS4_PNFS_H + +#endif /* LINUX_NFS4_PNFS_H */
Signature · 1 line
1.6.2.5
PATCH 7/50 pnfs_submit: introduce include/linux/pnfs_xdr.h
From: The pNFS Team <[email protected]>
Common xdr data structures needed by pnfs client.
exofs uses the pnfs_osd_xdr.h file, so it must be compilable even if CONFIG_PNFS is not set.
--- include/linux/pnfs_xdr.h | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) create mode 100644 include/linux/pnfs_xdr.h
include/linux/pnfs_xdr.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* include/linux/pnfs_xdr.h +* +* Common xdr data structures needed by pnfs client. +* +* Copyright (c) 2002 The Regents of the University of Michigan. +* All rights reserved. +* +* Dean Hildebrand <[email protected]> +*/ + +#ifndef LINUX_PNFS_XDR_H +#define LINUX_PNFS_XDR_H + + +#endif /* LINUX_PNFS_XDR_H */
Signature · 1 line
1.6.2.5
PATCH 8/50 pnfs_submit: introduce fs/nfs/pnfs.h
From: The pNFS Team <[email protected]>
pNFS client data structures.
--- fs/nfs/pnfs.h | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) create mode 100644 fs/nfs/pnfs.h
fs/nfs/pnfs.h new file +18 -0
@@ -0,0 +1,18 @@ +/* +* fs/nfs/pnfs.h +* +* pNFS client data structures. +* +* Copyright (c) 2002 The Regents of the University of Michigan. +* All rights reserved. +* +* Dean Hildebrand <[email protected]> +*/ + +#ifndef FS_NFS_PNFS_H +#define FS_NFS_PNFS_H + +#ifdef CONFIG_NFS_V4_1 +#endif /* CONFIG_NFS_V4_1 */ + +#endif /* FS_NFS_PNFS_H */
Signature · 1 line
1.6.2.5
PATCH 9/50 pnfs_submit: introduce fs/nfs/pnfs.c
From: The pNFS Team <[email protected]>
pNFS functions to call and manage layout drivers.
pnfs.o is compiled and linked conditionally on CONFIG_NFS_V4_1 in fs/nfs/Makefile.
--- fs/nfs/Makefile | 1 + fs/nfs/pnfs.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 0 deletions(-) create mode 100644 fs/nfs/pnfs.c
fs/nfs/Makefile +1 -0
@@ -15,5 +15,6 @@ nfs-$(CONFIG_NFS_V4) += nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o \ delegation.o idmap.o \ callback.o callback_xdr.o callback_proc.o \ nfs4namespace.o +nfs-$(CONFIG_NFS_V4_1) += pnfs.o nfs-$(CONFIG_SYSCTL) += sysctl.o nfs-$(CONFIG_NFS_FSCACHE) += fscache.o fscache-index.o
fs/nfs/pnfs.c new file +37 -0
@@ -0,0 +1,37 @@ +/* +* linux/fs/nfs/pnfs.c +* +* pNFS functions to call and manage layout drivers. +* +* Copyright (c) 2002 The Regents of the University of Michigan. +* All rights reserved. +* +* Dean Hildebrand <[email protected]> +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* 1. Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* 2. Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* 3. Neither the name of the University nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED +* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#define NFSDBG_FACILITY NFSDBG_PNFS
Signature · 1 line
1.6.2.5
PATCH 10/50 pnfs_submit: register unregister pnfs module
From: The pNFS Team <[email protected]>
--- fs/nfs/inode.c | 10 ++++ fs/nfs/pnfs.c | 113 +++++++++++++++++++++++++++++++++++++++++++++ fs/nfs/pnfs.h | 10 ++++ include/linux/nfs4_pnfs.h | 31 ++++++++++++ include/linux/nfs_fs.h | 1 + 5 files changed, 165 insertions(+), 0 deletions(-)
fs/nfs/inode.c +10 -0
@@ -48,6 +48,7 @@#include "internal.h" #include "fscache.h" #include "dns_resolve.h" +#include "pnfs.h" #define NFSDBG_FACILITY NFSDBG_VFS
@@ -1550,6 +1551,12 @@ static int __init init_nfs_fs(void)if (err) goto out0; +#ifdef CONFIG_NFS_V4_1 + err =pnfs_initialize (); +if (err) + goto out00; +#endif /* CONFIG_NFS_V4_1 */ +#ifdef CONFIG_PROC_FS rpc_proc_register (&nfs_rpcstat);#endif
@@ -1560,6 +1567,9 @@ out:#ifdef CONFIG_PROC_FS rpc_proc_unregister ("nfs" );#endif +#ifdef CONFIG_NFS_V4_1 +out00: +#endif /* CONFIG_NFS_V4_1 */ nfs_destroy_directcache (); out0:nfs_destroy_writepagecache ();
fs/nfs/pnfs.c +113 -0
117 lines not on this page · raw message
fs/nfs/pnfs.h +10 -0
@@ -12,7 +12,17 @@#ifndef FS_NFS_PNFS_H #define FS_NFS_PNFS_H +#include <linux/nfs4_pnfs.h> +#ifdef CONFIG_NFS_V4_1 + +#include <linux/nfs_page.h> +#include <linux/pnfs_xdr.h> +#include <linux/nfs_iostat.h> +#include "iostat.h" + +int pnfs_initialize (void ); +#endif /* CONFIG_NFS_V4_1 */ #endif /* FS_NFS_PNFS_H */
include/linux/nfs4_pnfs.h +31 -0
@@ -12,4 +12,35 @@#ifndef LINUX_NFS4_PNFS_H #define LINUX_NFS4_PNFS_H + +/* Per-layout driver specific registration structure */ +struct pnfs_layoutdriver_type { +const u32 id; +const char *name; +struct layoutdriver_io_operations *ld_io_ops; +struct layoutdriver_policy_operations *ld_policy_ops; +}; + +/* Layout driver I/O operations. +* Either the pagecache or non-pagecache read/write operations must be implemented +*/ +struct layoutdriver_io_operations { +}; + +struct layoutdriver_policy_operations { +}; + +/* pNFS client callback functions. +* These operations allow the layout driver to access pNFS client +* specific information or call pNFS client->server operations. +* E.g., getdeviceinfo, I/O callbacks, etc +*/ +struct pnfs_client_operations { +}; + +extern struct pnfs_client_operations pnfs_ops; + +extern struct pnfs_client_operations *pnfs_register_layoutdriver (struct pnfs_layoutdriver_type *); +extern void pnfs_unregister_layoutdriver (struct pnfs_layoutdriver_type *); +#endif /* LINUX_NFS4_PNFS_H */
include/linux/nfs_fs.h +1 -0
@@ -613,6 +613,7 @@ extern void * nfs_root_data(void);#define NFSDBG_CLIENT 0x0200#define NFSDBG_MOUNT 0x0400#define NFSDBG_FSCACHE 0x0800 +#define NFSDBG_PNFS 0x1000#define NFSDBG_ALL 0xFFFF#ifdef __KERNEL__
Signature · 1 line
1.6.2.5
PATCH 11/50 pnfs_submit: set and unset pnfs layoutdriver modules
From: The pNFS Team <[email protected]>
--- fs/nfs/client.c | 26 +++++++++++++++++++ fs/nfs/nfs4proc.c | 4 +++ fs/nfs/nfs4xdr.c | 60 +++++++++++++++++++++++++++++++++++++++++++++ fs/nfs/pnfs.c | 45 +++++++++++++++++++++++++++++++++ fs/nfs/pnfs.h | 9 ++++++ include/linux/nfs4.h | 1 + include/linux/nfs4_pnfs.h | 4 +++ include/linux/nfs_fs_sb.h | 5 +++ include/linux/nfs_xdr.h | 3 ++ 9 files changed, 157 insertions(+), 0 deletions(-)
fs/nfs/client.c +26 -0
@@ -48,6 +48,7 @@#include "iostat.h" #include "internal.h" #include "fscache.h" +#include "pnfs.h" #define NFSDBG_FACILITY NFSDBG_CLIENT
@@ -866,6 +867,28 @@ error: }/* +* Initialize the pNFS layout driver and setup pNFS related parameters +*/ +static void nfs4_init_pnfs (struct nfs_server *server,struct nfs_fsinfo *fsinfo) +{ +#if defined(CONFIG_NFS_V4_1 ) +struct nfs_client *clp = server->nfs_client; + +if (nfs4_has_session (clp) && + (clp->cl_exchange_flags &EXCHGID4_FLAG_USE_PNFS_MDS )) +set_pnfs_layoutdriver (server, fsinfo->layouttype); +#endif /* CONFIG_NFS_V4_1 */ +} + +static void nfs4_uninit_pnfs (struct nfs_server *server) +{ +#if defined(CONFIG_NFS_V4_1 ) +if (server->nfs_client &&nfs4_has_session (server->nfs_client)) +unmount_pnfs_layoutdriver (server); +#endif /* CONFIG_NFS_V4_1 */ +} + +/* * Load up the server record from information gained in an fsinfo record */ static void nfs_server_set_fsinfo (struct nfs_server *server,struct nfs_fsinfo *fsinfo)
@@ -898,6 +921,8 @@ static void nfs_server_set_fsinfo(struct nfs_server *server, struct nfs_fsinfo *if (server->wsize >NFS_MAX_FILE_IO_SIZE ) server->wsize =NFS_MAX_FILE_IO_SIZE ; server->wpages = (server->wsize +PAGE_CACHE_SIZE -1 ) >>PAGE_CACHE_SHIFT ; +nfs4_init_pnfs (server, fsinfo); + server->wtmult =nfs_block_bits (fsinfo->wtmult,NULL ); server->dtsize =nfs_block_size (fsinfo->dtpref,NULL );
@@ -1017,6 +1042,7 @@ void nfs_free_server(struct nfs_server *server) {dprintk ("--> nfs_free_server()\n" ); +nfs4_uninit_pnfs (server);spin_lock (&nfs_client_lock);list_del (&server->client_link);list_del (&server->master_link);
fs/nfs/nfs4proc.c +4 -0
@@ -129,7 +129,11 @@ const u32 nfs4_fsinfo_bitmap[2] = { FATTR4_WORD0_MAXFILESIZE | FATTR4_WORD0_MAXREAD | FATTR4_WORD0_MAXWRITE | FATTR4_WORD0_LEASE_TIME, +#ifdef CONFIG_NFS_V4_1 + FATTR4_WORD1_FS_LAYOUT_TYPES +#else /* CONFIG_NFS_V4_1 */ 0 +#endif /* CONFIG_NFS_V4_1 */ };const u32 nfs4_fs_locations_bitmap[2 ] = {
fs/nfs/nfs4xdr.c +60 -0
72 lines not on this page · raw message
fs/nfs/pnfs.c +45 -0
51 lines not on this page · raw message
fs/nfs/pnfs.h +9 -0
@@ -21,8 +21,17 @@#include <linux/nfs_iostat.h> #include "iostat.h" +/* pnfs.c */ +void set_pnfs_layoutdriver (struct nfs_server *,u32 id); +void unmount_pnfs_layoutdriver (struct nfs_server *);int pnfs_initialize (void ); +#define PNFS_EXISTS_LDIO_OP (srv, opname) ((srv)->pnfs_curr_ld && \ + (srv)->pnfs_curr_ld->ld_io_ops && \ + (srv)->pnfs_curr_ld->ld_io_ops->opname) + +#define LAYOUT_NFSV4_1_MODULE_PREFIX "nfs-layouttype4" +#endif /* CONFIG_NFS_V4_1 */ #endif /* FS_NFS_PNFS_H */
include/linux/nfs4.h +1 -0
@@ -471,6 +471,7 @@ enum lock_type4 {#define FATTR4_WORD1_TIME_MODIFY (1UL << 21)#define FATTR4_WORD1_TIME_MODIFY_SET (1UL << 22)#define FATTR4_WORD1_MOUNTED_ON_FILEID (1UL << 23) +#define FATTR4_WORD1_FS_LAYOUT_TYPES (1UL << 30)#define NFSPROC4_NULL 0#define NFSPROC4_COMPOUND 1
include/linux/nfs4_pnfs.h +4 -0
@@ -25,6 +25,10 @@ struct pnfs_layoutdriver_type {* Either the pagecache or non-pagecache read/write operations must be implemented */ struct layoutdriver_io_operations { +/* Registration information for a new mounted file system +*/ +int (*initialize_mountpoint) (struct nfs_client *); +int (*uninitialize_mountpoint) (struct nfs_server *server); };struct layoutdriver_policy_operations {
include/linux/nfs_fs_sb.h +5 -0
@@ -145,6 +145,11 @@ struct nfs_server {that are supported on this filesystem */ #endif + +#ifdef CONFIG_NFS_V4_1 +struct pnfs_layoutdriver_type *pnfs_curr_ld;/* Active layout driver */ +#endif /* CONFIG_NFS_V4_1 */ +void (*destroy)(struct nfs_server *);atomic_t active;/* Keep trace of any activity to this server */
include/linux/nfs_xdr.h +3 -0
@@ -113,6 +113,9 @@ struct nfs_fsinfo {__u32 dtpref;/* pref. readdir transfer size */ __u64 maxfilesize;__u32 lease_time;/* in seconds */ +#if defined(CONFIG_NFS_V4_1 ) +__u32 layouttype;/* supported pnfs layout driver */ +#endif };struct nfs_fsstat {
Signature · 1 line
1.6.2.5
PATCH 12/50 pnfs_submit: generic pnfs deviceid cache
From: The pNFS Team <[email protected]>
--- fs/nfs/pnfs.c | 141 +++++++++++++++++++++++++++++++++++++++++++++ include/linux/nfs4_pnfs.h | 44 ++++++++++++++ include/linux/nfs_fs_sb.h | 1 + include/linux/pnfs_xdr.h | 5 ++ 4 files changed, 191 insertions(+), 0 deletions(-)
fs/nfs/pnfs.c +141 -0
@@ -193,3 +193,144 @@ pnfs_unregister_layoutdriver(struct pnfs_layoutdriver_type *ld_type)EXPORT_SYMBOL (pnfs_unregister_layoutdriver);EXPORT_SYMBOL (pnfs_register_layoutdriver); + + +/* Device ID cache. Supports one layout type per struct nfs_client */ +int +nfs4_alloc_init_deviceid_cache (struct nfs_client *clp, +void (*free_callback)(struct kref *)) +{ +struct nfs4_deviceid_cache *c; + + c =kzalloc (sizeof (struct nfs4_deviceid_cache ),GFP_KERNEL ); +if (!c) +return -ENOMEM ; +spin_lock (&clp->cl_lock); +if (clp->cl_devid_cache !=NULL ) { +kref_get (&clp->cl_devid_cache->dc_kref); +spin_unlock (&clp->cl_lock); +dprintk ("%s [kref [%d]]\n" , __func__, +atomic_read (&clp->cl_devid_cache->dc_kref.refcount)); +kfree (c); + }else { +int i; + +spin_lock_init (&c->dc_lock); +for (i =0 ; i <NFS4_DEVICE_ID_HASH_SIZE ; i++) +INIT_HLIST_HEAD (&c->dc_deviceids[i]); +kref_init (&c->dc_kref); + c->dc_free_callback = free_callback; + clp->cl_devid_cache = c; +spin_unlock (&clp->cl_lock); +dprintk ("%s [new]\n" , __func__); + } +return 0 ; +} +EXPORT_SYMBOL (nfs4_alloc_init_deviceid_cache); + +void +nfs4_init_deviceid_node (struct nfs4_deviceid *d) +{ +INIT_HLIST_NODE (&d->de_node); +kref_init (&d->de_kref); +} +EXPORT_SYMBOL (nfs4_init_deviceid_node); + +struct nfs4_deviceid * +nfs4_find_deviceid (struct nfs4_deviceid_cache *c,struct pnfs_deviceid *id) +{ +struct nfs4_deviceid *d; +struct hlist_node *n; +long hash =nfs4_deviceid_hash (id); + +dprintk ("--> %s hash %ld\n" , __func__, hash); +rcu_read_lock (); +hlist_for_each_entry_rcu (d, n, &c->dc_deviceids[hash], de_node) { +if (!memcmp (&d->de_id, id,NFS4_PNFS_DEVICEID4_SIZE )) { +rcu_read_unlock (); +return d; + } + } +rcu_read_unlock (); +return NULL ; +} +EXPORT_SYMBOL (nfs4_find_deviceid); + +/* +* Add or kref_get a deviceid. +* GETDEVICEINFOs for same deviceid can race. If deviceid is found, discard new +*/ +struct nfs4_deviceid * +nfs4_add_deviceid (struct nfs4_deviceid_cache *c,struct nfs4_deviceid *new) +{ +struct nfs4_deviceid *d; +struct hlist_node *n; +long hash =nfs4_deviceid_hash (&new->de_id); + +dprintk ("--> %s hash %ld\n" , __func__, hash); +spin_lock (&c->dc_lock); +hlist_for_each_entry_rcu (d, n, &c->dc_deviceids[hash], de_node) { +if (!memcmp (&d->de_id, &new->de_id,NFS4_PNFS_DEVICEID4_SIZE )) { +spin_unlock (&c->dc_lock); +dprintk ("%s [discard]\n" , __func__); + c->dc_free_callback (&new->de_kref); +return d; + } + } +hlist_add_head_rcu (&new->de_node, &c->dc_deviceids[hash]); +spin_unlock (&c->dc_lock); +dprintk ("%s [new]\n" , __func__); +return new; +} +EXPORT_SYMBOL (nfs4_add_deviceid); + +static int +nfs4_remove_deviceid (struct nfs4_deviceid_cache *c,long hash) +{ +struct nfs4_deviceid *d; +struct hlist_node *n; + +dprintk ("--> %s hash %ld\n" , __func__, hash); +spin_lock (&c->dc_lock); +hlist_for_each_entry_rcu (d, n, &c->dc_deviceids[hash], de_node) { +hlist_del_rcu (&d->de_node); +spin_unlock (&c->dc_lock); +synchronize_rcu (); +dprintk ("%s [%d]\n" , __func__, +atomic_read (&d->de_kref.refcount)); +kref_put (&d->de_kref, c->dc_free_callback); +return 1 ; + } +spin_unlock (&c->dc_lock); +return 0 ; +} + +static void +nfs4_free_deviceid_cache (struct kref *kref) +{ +struct nfs4_deviceid_cache *cache = + container_of(kref, struct nfs4_deviceid_cache, dc_kref); +long i; + +for (i =0 ; i <NFS4_DEVICE_ID_HASH_SIZE ; i++) +while (nfs4_remove_deviceid (cache, i)) + ; +kfree (cache); +} + +void +nfs4_put_deviceid_cache (struct nfs_client *clp) +{ +struct nfs4_deviceid_cache *tmp = clp->cl_devid_cache; +int refcount; + +dprintk ("--> %s cl_devid_cache %p\n" , __func__, clp->cl_devid_cache); +spin_lock (&clp->cl_lock); + refcount =atomic_read (&clp->cl_devid_cache->dc_kref.refcount); +if (refcount ==1 ) + clp->cl_devid_cache =NULL ; +spin_unlock (&clp->cl_lock); +dprintk ("%s [%d]\n" , __func__, refcount); +kref_put (&tmp->dc_kref, nfs4_free_deviceid_cache); +} +EXPORT_SYMBOL (nfs4_put_deviceid_cache);
include/linux/nfs4_pnfs.h +44 -0
56 lines not on this page · raw message
include/linux/nfs_fs_sb.h +1 -0
@@ -82,6 +82,7 @@ struct nfs_client {/* The flags used for obtaining the clientid during EXCHANGE_ID */ u32 cl_exchange_flags;struct nfs4_session *cl_session;/* sharred session */ +struct nfs4_deviceid_cache *cl_devid_cache;/* pNFS deviceid cache */ #endif /* CONFIG_NFS_V4_1 */ #ifdef CONFIG_NFS_FSCACHE
include/linux/pnfs_xdr.h +5 -0
@@ -12,5 +12,10 @@#ifndef LINUX_PNFS_XDR_H #define LINUX_PNFS_XDR_H +#define NFS4_PNFS_DEVICEID4_SIZE 16 + +struct pnfs_deviceid { +char data[NFS4_PNFS_DEVICEID4_SIZE ]; +};#endif /* LINUX_PNFS_XDR_H */
Signature · 1 line
1.6.2.5
PATCH 13/50 pnfs_submit: introduce nfs4layoutdriver module
From: The pNFS Team <[email protected]>
Basic initialization and unintialization of module and mount point.
Define CONFIG_PNFS_FILE_LAYOUT for conditionally building the nfslayoutdriver.
--- fs/nfs/Makefile | 3 + fs/nfs/nfs4filelayout.c | 124 ++++++++++++++++++++++++++++++++++++++++++++ fs/nfs/nfs4filelayout.h | 19 +++++++ fs/nfs/nfs4filelayoutdev.c | 60 +++++++++++++++++++++ include/linux/nfs4.h | 4 ++ include/linux/nfs_fs.h | 1 + 6 files changed, 211 insertions(+), 0 deletions(-) create mode 100644 fs/nfs/nfs4filelayout.c create mode 100644 fs/nfs/nfs4filelayout.h create mode 100644 fs/nfs/nfs4filelayoutdev.c
fs/nfs/Makefile +3 -0
@@ -18,3 +18,6 @@ nfs-$(CONFIG_NFS_V4) += nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o \ nfs-$(CONFIG_NFS_V4_1) += pnfs.o nfs-$(CONFIG_SYSCTL) += sysctl.o nfs-$(CONFIG_NFS_FSCACHE) += fscache.o fscache-index.o + +obj-$(CONFIG_PNFS_FILE_LAYOUT) += nfs_layout_nfsv41_files.o +nfs_layout_nfsv41_files-y := nfs4filelayout.o nfs4filelayoutdev.o
fs/nfs/nfs4filelayout.c new file +124 -0
124 lines not on this page · raw message
fs/nfs/nfs4filelayout.h new file +19 -0
@@ -0,0 +1,19 @@ +/* +* pnfs_nfs4filelayout.h +* +* NFSv4 file layout driver data structures. +* +* Copyright (c) 2002 The Regents of the University of Michigan. +* All rights reserved. +* +* Dean Hildebrand <[email protected]> +*/ + +#ifndef FS_NFS_NFS4FILELAYOUT_H +#define FS_NFS_NFS4FILELAYOUT_H + +extern void nfs4_fl_free_deviceid_callback (struct kref *); + +extern struct pnfs_client_operations *pnfs_callback_ops; + +#endif /* FS_NFS_NFS4FILELAYOUT_H */
fs/nfs/nfs4filelayoutdev.c new file +60 -0
60 lines not on this page · raw message
include/linux/nfs4.h +4 -0
@@ -551,6 +551,10 @@ enum state_protect_how4 {SP4_SSV =2 }; +enum pnfs_layouttype { +LAYOUT_NFSV4_1_FILES =1 , +}; +#endif #endif
include/linux/nfs_fs.h +1 -0
@@ -614,6 +614,7 @@ extern void * nfs_root_data(void);#define NFSDBG_MOUNT 0x0400#define NFSDBG_FSCACHE 0x0800#define NFSDBG_PNFS 0x1000 +#define NFSDBG_PNFS_LD 0x2000#define NFSDBG_ALL 0xFFFF#ifdef __KERNEL__
Signature · 1 line
1.6.2.5
PATCH 14/50 pnfs_submit: filelayout data server cache
From: The pNFS Team <[email protected]>
--- fs/nfs/client.c | 1 + fs/nfs/nfs4filelayout.h | 29 ++++++++++++- fs/nfs/nfs4filelayoutdev.c | 98 +++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 126 insertions(+), 2 deletions(-)
fs/nfs/client.c +1 -0
@@ -253,6 +253,7 @@ void nfs_put_client(struct nfs_client *clp)nfs_free_client (clp); } } +EXPORT_SYMBOL (nfs_put_client);#if defined(CONFIG_IPV6 ) || defined(CONFIG_IPV6_MODULE )/*
fs/nfs/nfs4filelayout.h +28 -1
@@ -12,8 +12,35 @@#ifndef FS_NFS_NFS4FILELAYOUT_H #define FS_NFS_NFS4FILELAYOUT_H -extern void nfs4_fl_free_deviceid_callback (struct kref *); +#include <linux/kref.h> +#include <linux/nfs4_pnfs.h> +#include <linux/pnfs_xdr.h> + +#define NFS4_PNFS_DEV_HASH_BITS 5 +#define NFS4_PNFS_DEV_HASH_SIZE (1 << NFS4_PNFS_DEV_HASH_BITS) +#define NFS4_PNFS_DEV_HASH_MASK (NFS4_PNFS_DEV_HASH_SIZE - 1) + +/* Individual ip address */ +struct nfs4_pnfs_ds { +struct list_head ds_node;/* nfs4_pnfs_dev_hlist dev_dslist */ +u32 ds_ip_addr; +u32 ds_port; +struct nfs_client *ds_clp; +atomic_t ds_count; +char r_addr[29 ]; +}; + +struct nfs4_file_layout_dsaddr { +struct nfs4_deviceid deviceid; +u32 stripe_count; +u8 *stripe_indices; +u32 ds_num; +struct nfs4_pnfs_ds *ds_list[1 ]; +}; +extern struct pnfs_client_operations *pnfs_callback_ops; +extern void nfs4_fl_free_deviceid_callback (struct kref *); +extern void print_ds (struct nfs4_pnfs_ds *ds);#endif /* FS_NFS_NFS4FILELAYOUT_H */
fs/nfs/nfs4filelayoutdev.c +97 -1
107 lines not on this page · raw message
Signature · 1 line
1.6.2.5
PATCH 15/50 pnfs_submit: filelayout deviceid cache
From: The pNFS Team <[email protected]>
--- fs/nfs/nfs4filelayout.h | 3 ++ fs/nfs/nfs4filelayoutdev.c | 57 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 0 deletions(-)
fs/nfs/nfs4filelayout.h +3 -0
@@ -43,4 +43,7 @@ extern struct pnfs_client_operations *pnfs_callback_ops;extern void nfs4_fl_free_deviceid_callback (struct kref *);extern void print_ds (struct nfs4_pnfs_ds *ds); +char *deviceid_fmt (const struct pnfs_deviceid *dev_id); +extern struct nfs4_file_layout_dsaddr * +nfs4_pnfs_device_item_find (struct nfs_client *,struct pnfs_deviceid *dev_id);#endif /* FS_NFS_NFS4FILELAYOUT_H */
fs/nfs/nfs4filelayoutdev.c +57 -0
75 lines not on this page · raw message
Signature · 1 line
1.6.2.5
PATCH 16/50 pnfs_submit: generic getdeviceinfo
From: The pNFS Team <[email protected]>
--- fs/nfs/nfs4proc.c | 26 ++++++++ fs/nfs/nfs4xdr.c | 154 +++++++++++++++++++++++++++++++++++++++++++++ fs/nfs/pnfs.c | 6 ++ fs/nfs/pnfs.h | 3 + include/linux/nfs4.h | 1 + include/linux/nfs4_pnfs.h | 13 ++++ include/linux/pnfs_xdr.h | 10 +++ 7 files changed, 213 insertions(+), 0 deletions(-)
fs/nfs/nfs4proc.c +26 -0
@@ -49,12 +49,15 @@#include <linux/mount.h> #include <linux/module.h> #include <linux/sunrpc/bc_xprt.h> +#include <linux/pnfs_xdr.h> +#include <linux/nfs4_pnfs.h> #include "nfs4_fs.h" #include "delegation.h" #include "internal.h" #include "iostat.h" #include "callback.h" +#include "pnfs.h" #define NFSDBG_FACILITY NFSDBG_PROC
@@ -5353,6 +5356,29 @@ out:dprintk ("<-- %s status=%d\n" , __func__, status);return status; } + +int nfs4_pnfs_getdeviceinfo (struct nfs_server *server,struct pnfs_device *pdev) +{ +struct nfs4_pnfs_getdeviceinfo_arg args = { + .pdev = pdev, + }; +struct nfs4_pnfs_getdeviceinfo_res res = { + .pdev = pdev, + }; +struct rpc_message msg = { + .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_PNFS_GETDEVICEINFO ], + .rpc_argp = &args, + .rpc_resp = &res, + }; +int status; + +dprintk ("--> %s\n" , __func__); + status =nfs4_call_sync (server, &msg, &args, &res,0 ); +dprintk ("<-- %s status=%d\n" , __func__, status); + +return status; +} +#endif /* CONFIG_NFS_V4_1 */ struct nfs4_state_recovery_ops nfs40_reboot_recovery_ops = {
fs/nfs/nfs4xdr.c +154 -0
204 lines not on this page · raw message
fs/nfs/pnfs.c +6 -0
@@ -191,6 +191,12 @@ pnfs_unregister_layoutdriver(struct pnfs_layoutdriver_type *ld_type) } } +/* Callback operations for layout drivers. +*/ +struct pnfs_client_operations pnfs_ops = { + .nfs_getdeviceinfo = nfs4_pnfs_getdeviceinfo, +}; +EXPORT_SYMBOL (pnfs_unregister_layoutdriver);EXPORT_SYMBOL (pnfs_register_layoutdriver);
fs/nfs/pnfs.h +3 -0
@@ -21,6 +21,9 @@#include <linux/nfs_iostat.h> #include "iostat.h" +/* nfs4proc.c */ +extern int nfs4_pnfs_getdeviceinfo (struct nfs_server *server, +struct pnfs_device *dev);/* pnfs.c */ void set_pnfs_layoutdriver (struct nfs_server *,u32 id);void unmount_pnfs_layoutdriver (struct nfs_server *);
include/linux/nfs4.h +1 -0
@@ -533,6 +533,7 @@ enum {NFSPROC4_CLNT_SEQUENCE ,NFSPROC4_CLNT_GET_LEASE_TIME ,NFSPROC4_CLNT_RECLAIM_COMPLETE , + NFSPROC4_CLNT_PNFS_GETDEVICEINFO, };/* nfs41 types */
include/linux/nfs4_pnfs.h +13 -0
@@ -35,6 +35,17 @@ struct layoutdriver_io_operations {struct layoutdriver_policy_operations { }; +struct pnfs_device { +struct pnfs_deviceid dev_id; +unsigned int layout_type; +unsigned int mincount; +struct page **pages; +void *area; +unsigned int pgbase; +unsigned int pglen; +unsigned int dev_notify_types; +}; +/* * Device ID RCU cache. A device ID is unique per client ID and layout type. */
@@ -84,6 +95,8 @@ extern struct nfs4_deviceid *nfs4_add_deviceid(struct nfs4_deviceid_cache *,* E.g., getdeviceinfo, I/O callbacks, etc */ struct pnfs_client_operations { +int (*nfs_getdeviceinfo) (struct nfs_server *, +struct pnfs_device *dev); };extern struct pnfs_client_operations pnfs_ops;
include/linux/pnfs_xdr.h +10 -0
@@ -18,4 +18,14 @@ struct pnfs_deviceid { char data[NFS4_PNFS_DEVICEID4_SIZE]; }; +struct nfs4_pnfs_getdeviceinfo_arg { +struct pnfs_device *pdev; +struct nfs4_sequence_args seq_args; +}; + +struct nfs4_pnfs_getdeviceinfo_res { +struct pnfs_device *pdev; +struct nfs4_sequence_res seq_res; +}; +#endif /* LINUX_PNFS_XDR_H */
Signature · 1 line
1.6.2.5
PATCH 17/50 pnfs_submit: filelayout getdeviceinfo
From: The pNFS Team <[email protected]>
--- fs/nfs/nfs4filelayout.h | 6 + fs/nfs/nfs4filelayoutdev.c | 243 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 249 insertions(+), 0 deletions(-)
fs/nfs/nfs4filelayout.h +6 -0
@@ -20,6 +20,9 @@#define NFS4_PNFS_DEV_HASH_SIZE (1 << NFS4_PNFS_DEV_HASH_BITS)#define NFS4_PNFS_DEV_HASH_MASK (NFS4_PNFS_DEV_HASH_SIZE - 1) +#define NFS4_PNFS_MAX_STRIPE_CNT 4096 +#define NFS4_PNFS_MAX_MULTI_CNT 64/* 256 fit into a u8 stripe_index */ +/* Individual ip address */ struct nfs4_pnfs_ds {struct list_head ds_node;/* nfs4_pnfs_dev_hlist dev_dslist */
@@ -46,4 +49,7 @@ extern void print_ds(struct nfs4_pnfs_ds *ds);char *deviceid_fmt (const struct pnfs_deviceid *dev_id);extern struct nfs4_file_layout_dsaddr *nfs4_pnfs_device_item_find (struct nfs_client *,struct pnfs_deviceid *dev_id); +struct nfs4_file_layout_dsaddr * +get_device_info (struct inode *inode,struct pnfs_deviceid *dev_id); +#endif /* FS_NFS_NFS4FILELAYOUT_H */
fs/nfs/nfs4filelayoutdev.c +243 -0
249 lines not on this page · raw message
Signature · 1 line
1.6.2.5
PATCH 18/50 pnfs-submit: change stateid to be a union
From: The pNFS Team <[email protected]>
In NFSv4.1 the stateid consists of the other and seqid fields. For layout processing we need to numerically compare the seqid value of layout stateids. To do so, introduce a union to nfs4_stateid to swtich between opaque(16 bytes) and opaque(12 bytes) / __be32
--- fs/nfs/callback_proc.c | 13 +++++++------ fs/nfs/callback_xdr.c | 2 +- fs/nfs/delegation.c | 19 +++++++++++-------- fs/nfs/nfs4proc.c | 41 +++++++++++++++++++++++++---------------- fs/nfs/nfs4state.c | 4 ++-- fs/nfs/nfs4xdr.c | 28 +++++++++++++++------------- include/linux/nfs4.h | 17 +++++++++++++++-- 7 files changed, 76 insertions(+), 48 deletions(-)
fs/nfs/callback_proc.c +7 -6
@@ -105,8 +105,9 @@ out:int nfs4_validate_delegation_stateid (struct nfs_delegation *delegation,const nfs4_stateid *stateid) { -if (delegation ==NULL ||memcmp (delegation->stateid.data, stateid->data, -sizeof (delegation->stateid.data)) !=0 ) +if (delegation ==NULL ||memcmp (delegation->stateid.u.data, + stateid->u.data, +sizeof (delegation->stateid.u.data)))return 0 ;return 1 ; }
@@ -118,11 +119,11 @@ int nfs41_validate_delegation_stateid(struct nfs_delegation *delegation, const nif (delegation ==NULL )return 0 ; -/* seqid is 4-bytes long */ -if (((u32 *) &stateid->data)[0 ] !=0 ) +if (stateid->u.stateid.seqid !=0 )return 0 ; -if (memcmp (&delegation->stateid.data[4 ], &stateid->data[4 ], -sizeof (stateid->data)-4 )) +if (memcmp (&delegation->stateid.u.stateid.other, + &stateid->u.stateid.other, +NFS4_STATEID_OTHER_SIZE ))return 0 ;return 1 ;
fs/nfs/callback_xdr.c +1 -1
@@ -136,7 +136,7 @@ static __be32 decode_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid) p =read_buf (xdr,16 );if (unlikely (p ==NULL ))return htonl (NFS4ERR_RESOURCE ); -memcpy (stateid->data, p,16 ); +memcpy (stateid->u.data, p,16 );return 0 ; }
fs/nfs/delegation.c +11 -8
@@ -104,7 +104,8 @@ again:continue ;if (!test_bit (NFS_DELEGATED_STATE , &state->flags))continue ; -if (memcmp (state->stateid.data, stateid->data,sizeof (state->stateid.data)) !=0 ) +if (memcmp (state->stateid.u.data, stateid->u.data, +sizeof (state->stateid.u.data)) !=0 )continue ;get_nfs_open_context (ctx);spin_unlock (&inode->i_lock);
@@ -133,8 +134,8 @@ void nfs_inode_reclaim_delegation(struct inode *inode, struct rpc_cred *cred, stif (delegation !=NULL ) {spin_lock (&delegation->lock);if (delegation->inode !=NULL ) { -memcpy (delegation->stateid.data, res->delegation.data, -sizeof (delegation->stateid.data)); +memcpy (delegation->stateid.u.data, res->delegation.u.data, +sizeof (delegation->stateid.u.data)); delegation->type = res->delegation_type; delegation->maxsize = res->maxsize; oldcred = delegation->cred;
@@ -187,8 +188,9 @@ static struct nfs_delegation *nfs_detach_delegation_locked(struct nfs_inode *nfsif (delegation ==NULL ) goto nomatch;spin_lock (&delegation->lock); -if (stateid !=NULL &&memcmp (delegation->stateid.data, stateid->data, -sizeof (delegation->stateid.data)) !=0 ) +if (stateid !=NULL &&memcmp (delegation->stateid.u.data, + stateid->u.data, +sizeof (delegation->stateid.u.data)) !=0 ) goto nomatch_unlock;list_del_rcu (&delegation->super_list); delegation->inode =NULL ;
@@ -216,8 +218,8 @@ int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, struct delegation =kmalloc (sizeof (*delegation),GFP_NOFS );if (delegation ==NULL )return -ENOMEM ; -memcpy (delegation->stateid.data, res->delegation.data, -sizeof (delegation->stateid.data)); +memcpy (delegation->stateid.u.data, res->delegation.u.data, +sizeof (delegation->stateid.u.data)); delegation->type = res->delegation_type; delegation->maxsize = res->maxsize; delegation->change_attr = nfsi->change_attr;
@@ -560,7 +562,8 @@ int nfs4_copy_delegation_stateid(nfs4_stateid *dst, struct inode *inode)rcu_read_lock (); delegation =rcu_dereference (nfsi->delegation);if (delegation !=NULL ) { -memcpy (dst->data, delegation->stateid.data,sizeof (dst->data)); +memcpy (dst->u.data, delegation->stateid.u.data, +sizeof (dst->u.data)); ret =1 ; }rcu_read_unlock ();
fs/nfs/nfs4proc.c +25 -16
97 lines not on this page · raw message
fs/nfs/nfs4state.c +2 -2
@@ -1058,8 +1058,8 @@ restart:* Open state on this file cannot be recovered * All we can do is revert to using the zero stateid. */ -memset (state->stateid.data,0 , -sizeof (state->stateid.data)); +memset (state->stateid.u.data,0 , +sizeof (state->stateid.u.data));/* Mark the file as being 'closed' */ state->state =0 ;break ;
fs/nfs/nfs4xdr.c +15 -13
@@ -945,7 +945,7 @@ static void encode_close(struct xdr_stream *xdr, const struct nfs_closeargs *arg p =reserve_space (xdr,8 +NFS4_STATEID_SIZE ); *p++ =cpu_to_be32 (OP_CLOSE ); *p++ =cpu_to_be32 (arg->seqid->sequence->counter); -xdr_encode_opaque_fixed (p, arg->stateid->data,NFS4_STATEID_SIZE ); +xdr_encode_opaque_fixed (p, arg->stateid->u.data,NFS4_STATEID_SIZE ); hdr->nops++; hdr->replen += decode_close_maxsz; }
@@ -1101,13 +1101,14 @@ static void encode_lock(struct xdr_stream *xdr, const struct nfs_lock_args *argsif (args->new_lock_owner){ p =reserve_space (xdr,4 +NFS4_STATEID_SIZE +4 ); *p++ =cpu_to_be32 (args->open_seqid->sequence->counter); - p =xdr_encode_opaque_fixed (p, args->open_stateid->data,NFS4_STATEID_SIZE ); + p =xdr_encode_opaque_fixed (p, args->open_stateid->u.data, +NFS4_STATEID_SIZE ); *p++ =cpu_to_be32 (args->lock_seqid->sequence->counter);encode_lockowner (xdr, &args->lock_owner); }else { p =reserve_space (xdr,NFS4_STATEID_SIZE +4 ); - p =xdr_encode_opaque_fixed (p, args->lock_stateid->data,NFS4_STATEID_SIZE ); + p =xdr_encode_opaque_fixed (p, args->lock_stateid->u.data,NFS4_STATEID_SIZE ); *p =cpu_to_be32 (args->lock_seqid->sequence->counter); } hdr->nops++;
@@ -1136,7 +1137,8 @@ static void encode_locku(struct xdr_stream *xdr, const struct nfs_locku_args *ar *p++ =cpu_to_be32 (OP_LOCKU ); *p++ =cpu_to_be32 (nfs4_lock_type (args->fl,0 )); *p++ =cpu_to_be32 (args->seqid->sequence->counter); - p =xdr_encode_opaque_fixed (p, args->stateid->data,NFS4_STATEID_SIZE ); + p =xdr_encode_opaque_fixed (p, args->stateid->u.data, +NFS4_STATEID_SIZE ); p =xdr_encode_hyper (p, args->fl->fl_start);xdr_encode_hyper (p,nfs4_lock_length (args->fl)); hdr->nops++;
@@ -1297,7 +1299,7 @@ static inline void encode_claim_delegate_cur(struct xdr_stream *xdr, const struc p =reserve_space (xdr,4 +NFS4_STATEID_SIZE ); *p++ =cpu_to_be32 (NFS4_OPEN_CLAIM_DELEGATE_CUR ); -xdr_encode_opaque_fixed (p, stateid->data,NFS4_STATEID_SIZE ); +xdr_encode_opaque_fixed (p, stateid->u.data,NFS4_STATEID_SIZE );encode_string (xdr, name->len, name->name); }
@@ -1328,7 +1330,7 @@ static void encode_open_confirm(struct xdr_stream *xdr, const struct nfs_open_co p =reserve_space (xdr,4 +NFS4_STATEID_SIZE +4 ); *p++ =cpu_to_be32 (OP_OPEN_CONFIRM ); - p =xdr_encode_opaque_fixed (p, arg->stateid->data,NFS4_STATEID_SIZE ); + p =xdr_encode_opaque_fixed (p, arg->stateid->u.data,NFS4_STATEID_SIZE ); *p =cpu_to_be32 (arg->seqid->sequence->counter); hdr->nops++; hdr->replen += decode_open_confirm_maxsz;
@@ -1340,7 +1342,7 @@ static void encode_open_downgrade(struct xdr_stream *xdr, const struct nfs_close p =reserve_space (xdr,4 +NFS4_STATEID_SIZE +4 ); *p++ =cpu_to_be32 (OP_OPEN_DOWNGRADE ); - p =xdr_encode_opaque_fixed (p, arg->stateid->data,NFS4_STATEID_SIZE ); + p =xdr_encode_opaque_fixed (p, arg->stateid->u.data,NFS4_STATEID_SIZE ); *p =cpu_to_be32 (arg->seqid->sequence->counter);encode_share_access (xdr, arg->fmode); hdr->nops++;
@@ -1378,9 +1380,9 @@ static void encode_stateid(struct xdr_stream *xdr, const struct nfs_open_context p =reserve_space (xdr,NFS4_STATEID_SIZE );if (ctx->state !=NULL ) {nfs4_copy_stateid (&stateid, ctx->state, l_ctx->lockowner, l_ctx->pid); -xdr_encode_opaque_fixed (p, stateid.data,NFS4_STATEID_SIZE ); +xdr_encode_opaque_fixed (p, stateid.u.data,NFS4_STATEID_SIZE ); }else -xdr_encode_opaque_fixed (p, zero_stateid.data,NFS4_STATEID_SIZE ); +xdr_encode_opaque_fixed (p, zero_stateid.u.data,NFS4_STATEID_SIZE ); }static void encode_read (struct xdr_stream *xdr,const struct nfs_readargs *args,struct compound_hdr *hdr)
@@ -1494,7 +1496,7 @@ encode_setacl(struct xdr_stream *xdr, struct nfs_setaclargs *arg, struct compoun p =reserve_space (xdr,4 +NFS4_STATEID_SIZE ); *p++ =cpu_to_be32 (OP_SETATTR ); -xdr_encode_opaque_fixed (p, zero_stateid.data,NFS4_STATEID_SIZE ); +xdr_encode_opaque_fixed (p, zero_stateid.u.data,NFS4_STATEID_SIZE ); p =reserve_space (xdr,2 *4 ); *p++ =cpu_to_be32 (1 ); *p =cpu_to_be32 (FATTR4_WORD0_ACL );
@@ -1525,7 +1527,7 @@ static void encode_setattr(struct xdr_stream *xdr, const struct nfs_setattrargs p =reserve_space (xdr,4 +NFS4_STATEID_SIZE ); *p++ =cpu_to_be32 (OP_SETATTR ); -xdr_encode_opaque_fixed (p, arg->stateid.data,NFS4_STATEID_SIZE ); +xdr_encode_opaque_fixed (p, arg->stateid.u.data,NFS4_STATEID_SIZE ); hdr->nops++; hdr->replen += decode_setattr_maxsz;encode_attrs (xdr, arg->iap, server);
@@ -1588,7 +1590,7 @@ static void encode_delegreturn(struct xdr_stream *xdr, const nfs4_stateid *state p =reserve_space (xdr,4 +NFS4_STATEID_SIZE ); *p++ =cpu_to_be32 (OP_DELEGRETURN ); -xdr_encode_opaque_fixed (p, stateid->data,NFS4_STATEID_SIZE ); +xdr_encode_opaque_fixed (p, stateid->u.data,NFS4_STATEID_SIZE ); hdr->nops++; hdr->replen += decode_delegreturn_maxsz; }
@@ -3681,7 +3683,7 @@ static int decode_opaque_fixed(struct xdr_stream *xdr, void *buf, size_t len)static int decode_stateid (struct xdr_stream *xdr,nfs4_stateid *stateid) { -return decode_opaque_fixed (xdr, stateid->data,NFS4_STATEID_SIZE ); +return decode_opaque_fixed (xdr, stateid->u.data,NFS4_STATEID_SIZE ); }static int decode_close (struct xdr_stream *xdr,struct nfs_closeres *res)
include/linux/nfs4.h +15 -2
@@ -17,7 +17,9 @@#define NFS4_BITMAP_SIZE 2#define NFS4_VERIFIER_SIZE 8 -#define NFS4_STATEID_SIZE 16 +#define NFS4_STATEID_SEQID_SIZE 4 +#define NFS4_STATEID_OTHER_SIZE 12 +#define NFS4_STATEID_SIZE (NFS4_STATEID_SEQID_SIZE + NFS4_STATEID_OTHER_SIZE)#define NFS4_FHSIZE 128#define NFS4_MAXPATHLEN PATH_MAX#define NFS4_MAXNAMLEN NAME_MAX
@@ -167,7 +169,18 @@ struct nfs4_acl { };typedef struct {char data[NFS4_VERIFIER_SIZE ]; }nfs4_verifier ; -typedef struct {char data[NFS4_STATEID_SIZE ]; }nfs4_stateid ; + +struct nfs41_stateid { +__be32 seqid; +char other[NFS4_STATEID_OTHER_SIZE ]; +} __attribute__ ((packed)); + +typedef struct { +union { +char data[NFS4_STATEID_SIZE ]; +struct nfs41_stateid stateid; + } u; +}nfs4_stateid ;enum nfs_opnum4 {OP_ACCESS =3 ,
Signature · 1 line
1.6.2.5
PATCH 19/50 pnfs_submit: layout header alloc,reference, and destroy
From: The pNFS Team <[email protected]>
--- fs/nfs/client.c | 4 +- fs/nfs/inode.c | 8 ++- fs/nfs/nfs4state.c | 2 + fs/nfs/pnfs.c | 229 +++++++++++++++++++++++++++++++++++++++++++++ fs/nfs/pnfs.h | 22 +++++ include/linux/nfs4.h | 6 + include/linux/nfs4_pnfs.h | 51 ++++++++++ include/linux/nfs_fs.h | 25 +++++ include/linux/nfs_fs_sb.h | 1 + include/linux/pnfs_xdr.h | 8 ++ 10 files changed, 354 insertions(+), 2 deletions(-)
fs/nfs/client.c +3 -1
@@ -156,7 +156,9 @@ static struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_ cred =rpc_lookup_machine_cred ();if (!IS_ERR (cred)) clp->cl_machine_cred = cred; - +#if defined(CONFIG_NFS_V4_1 ) +INIT_LIST_HEAD (&clp->cl_layouts); +#endif nfs_fscache_get_client_cookie (clp);return clp;
fs/nfs/inode.c +7 -1
@@ -1430,7 +1430,10 @@ struct inode *nfs_alloc_inode(struct super_block *sb)void nfs_destroy_inode (struct inode *inode) { -kmem_cache_free (nfs_inode_cachep,NFS_I (inode)); +struct nfs_inode *nfsi =NFS_I (inode); + +pnfs_destroy_layout (nfsi); +kmem_cache_free (nfs_inode_cachep, nfsi); }static inline void nfs4_init_once (struct nfs_inode *nfsi)
@@ -1440,6 +1443,9 @@ static inline void nfs4_init_once(struct nfs_inode *nfsi) nfsi->delegation =NULL ; nfsi->delegation_state =0 ;init_rwsem (&nfsi->rwsem); +#ifdef CONFIG_NFS_V4_1 + nfsi->layout =NULL ; +#endif /* CONFIG_NFS_V4_1 */ #endif }
fs/nfs/nfs4state.c +2 -0
@@ -53,6 +53,7 @@#include "callback.h" #include "delegation.h" #include "internal.h" +#include "pnfs.h" #define OPENOWNER_POOL_SIZE 8
@@ -1447,6 +1448,7 @@ static void nfs4_state_manager(struct nfs_client *clp) }clear_bit (NFS4CLNT_CHECK_LEASE , &clp->cl_state);set_bit (NFS4CLNT_RECLAIM_REBOOT , &clp->cl_state); +pnfs_destroy_all_layouts (clp); }if (test_and_clear_bit (NFS4CLNT_CHECK_LEASE , &clp->cl_state)) {
fs/nfs/pnfs.c +229 -0
253 lines not on this page · raw message
fs/nfs/pnfs.h +22 -0
@@ -28,6 +28,12 @@ extern int nfs4_pnfs_getdeviceinfo(struct nfs_server *server,void set_pnfs_layoutdriver (struct nfs_server *,u32 id);void unmount_pnfs_layoutdriver (struct nfs_server *);int pnfs_initialize (void ); +void pnfs_set_layout_stateid (struct pnfs_layout_type *lo, +const nfs4_stateid *stateid); +void pnfs_destroy_layout (struct nfs_inode *); +void pnfs_destroy_all_layouts (struct nfs_client *); +void put_layout (struct inode *inode); +void pnfs_get_layout_stateid (nfs4_stateid *dst,struct pnfs_layout_type *lo);#define PNFS_EXISTS_LDIO_OP (srv, opname) ((srv)->pnfs_curr_ld && \ (srv)->pnfs_curr_ld->ld_io_ops && \
@@ -35,6 +41,22 @@ int pnfs_initialize(void);#define LAYOUT_NFSV4_1_MODULE_PREFIX "nfs-layouttype4" +/* Return true if a layout driver is being used for this mountpoint */ +static inline int pnfs_enabled_sb (struct nfs_server *nfss) +{ +return nfss->pnfs_curr_ld !=NULL ; +} + +#else /* CONFIG_NFS_V4_1 */ + +static inline void pnfs_destroy_all_layouts (struct nfs_client *clp) +{ +} + +static inline void pnfs_destroy_layout (struct nfs_inode *nfsi) +{ +} +#endif /* CONFIG_NFS_V4_1 */ #endif /* FS_NFS_PNFS_H */
include/linux/nfs4.h +6 -0
@@ -569,6 +569,12 @@ enum pnfs_layouttype { LAYOUT_NFSV4_1_FILES = 1, }; +enum pnfs_iomode { +IOMODE_READ =1 , +IOMODE_RW =2 , +IOMODE_ANY =3 , +}; +#endif #endif
include/linux/nfs4_pnfs.h +51 -0
61 lines not on this page · raw message
include/linux/nfs_fs.h +25 -0
@@ -104,6 +104,26 @@ struct nfs_delegation;struct posix_acl ; +struct pnfs_layout_type { +int refcount; +struct list_head lo_layouts;/* other client layouts */ +struct list_head segs;/* layout segments list */ +int roc_iomode;/* iomode to return on close, 0=none */ +seqlock_t seqlock;/* Protects the stateid */ +nfs4_stateid stateid; +unsigned long pnfs_layout_state; +#define NFS_INO_RO_LAYOUT_FAILED 0/* get ro layout failed stop trying */ +#define NFS_INO_RW_LAYOUT_FAILED 1/* get rw layout failed stop trying */ +#define NFS_INO_LAYOUTCOMMIT 3/* LAYOUTCOMMIT needed */ +struct rpc_cred *lo_cred;/* layoutcommit credential */ +/* DH: These vars keep track of the maximum write range +* so the values can be used for layoutcommit. +*/ +loff_t pnfs_write_begin_pos; +loff_t pnfs_write_end_pos; +struct inode *lo_inode; +}; +/* * nfs fs inode data in memory */
@@ -188,6 +208,11 @@ struct nfs_inode {struct nfs_delegation *delegation;fmode_t delegation_state;struct rw_semaphore rwsem; + +/* pNFS layout information */ +#if defined(CONFIG_NFS_V4_1 ) +struct pnfs_layout_type *layout; +#endif /* CONFIG_NFS_V4_1 */ #endif /* CONFIG_NFS_V4*/ #ifdef CONFIG_NFS_FSCACHE struct fscache_cookie *fscache;
include/linux/nfs_fs_sb.h +1 -0
@@ -82,6 +82,7 @@ struct nfs_client {/* The flags used for obtaining the clientid during EXCHANGE_ID */ u32 cl_exchange_flags;struct nfs4_session *cl_session;/* sharred session */ +struct list_head cl_layouts;struct nfs4_deviceid_cache *cl_devid_cache;/* pNFS deviceid cache */ #endif /* CONFIG_NFS_V4_1 */
include/linux/pnfs_xdr.h +8 -0
@@ -12,12 +12,20 @@ #ifndef LINUX_PNFS_XDR_H #define LINUX_PNFS_XDR_H +#define PNFS_LAYOUT_MAXSIZE 4096 #define NFS4_PNFS_DEVICEID4_SIZE 16 struct pnfs_deviceid { char data[NFS4_PNFS_DEVICEID4_SIZE]; }; + +struct nfs4_pnfs_layout_segment { + u32 iomode; + u64 offset; + u64 length; +}; + struct nfs4_pnfs_getdeviceinfo_arg { struct pnfs_device *pdev; struct nfs4_sequence_args seq_args;
Signature · 1 line
1.6.2.5
PATCH 20/50 pnfs_submit: filelayout alloc_layout and free_layout
From: The pNFS Team <[email protected]>
--- fs/nfs/nfs4filelayout.c | 24 ++++++++++++++++++++++++ fs/nfs/nfs4filelayout.h | 10 ++++++++++ 2 files changed, 34 insertions(+), 0 deletions(-)
fs/nfs/nfs4filelayout.c +24 -0
@@ -82,7 +82,31 @@ filelayout_uninitialize_mountpoint(struct nfs_server *nfss)return 0 ; } +/* +* Create a filelayout layout structure and return it. The pNFS client +* will use the pnfs_layout_type type to refer to the layout for this +* inode from now on. +*/ +static struct pnfs_layout_type * +filelayout_alloc_layout (struct inode *inode) +{ +struct nfs4_filelayout *flp; + +dprintk ("NFS_FILELAYOUT: allocating layout\n" ); + flp =kzalloc (sizeof (struct nfs4_filelayout ),GFP_KERNEL ); +return flp ? &flp->fl_layout :NULL ; +} + +/* Free a filelayout layout structure */ +static void +filelayout_free_layout (struct pnfs_layout_type *lo) +{ +dprintk ("NFS_FILELAYOUT: freeing layout\n" ); +kfree (FILE_LO (lo)); +}struct layoutdriver_io_operations filelayout_io_operations = { + .alloc_layout = filelayout_alloc_layout, + .free_layout = filelayout_free_layout, .initialize_mountpoint = filelayout_initialize_mountpoint, .uninitialize_mountpoint = filelayout_uninitialize_mountpoint, };
fs/nfs/nfs4filelayout.h +10 -0
@@ -41,6 +41,16 @@ struct nfs4_file_layout_dsaddr {struct nfs4_pnfs_ds *ds_list[1 ]; }; +struct nfs4_filelayout { +struct pnfs_layout_type fl_layout; +u32 stripe_unit; +}; + +static inline struct nfs4_filelayout * +FILE_LO (struct pnfs_layout_type *lo) +{ + return container_of(lo, struct nfs4_filelayout, fl_layout); +}extern struct pnfs_client_operations *pnfs_callback_ops;
Signature · 1 line
1.6.2.5
PATCH 21/50 pnfs_submit: layout segment alloc, reference, destroy
From: The pNFS Team <[email protected]>
--- fs/nfs/inode.c | 1 + fs/nfs/pnfs.c | 105 +++++++++++++++++++++++++++++++++++++++++++++ fs/nfs/pnfs.h | 14 ++++++ include/linux/nfs4_pnfs.h | 2 + include/linux/nfs_fs.h | 1 + include/linux/pnfs_xdr.h | 3 + 6 files changed, 126 insertions(+), 0 deletions(-)
fs/nfs/inode.c +1 -0
@@ -1444,6 +1444,7 @@ static inline void nfs4_init_once(struct nfs_inode *nfsi) nfsi->delegation_state =0 ;init_rwsem (&nfsi->rwsem);#ifdef CONFIG_NFS_V4_1 +init_waitqueue_head (&nfsi->lo_waitq); nfsi->layout =NULL ;#endif /* CONFIG_NFS_V4_1 */ #endif
fs/nfs/pnfs.c +105 -0
130 lines not on this page · raw message
fs/nfs/pnfs.h +14 -0
@@ -25,6 +25,7 @@extern int nfs4_pnfs_getdeviceinfo (struct nfs_server *server,struct pnfs_device *dev);/* pnfs.c */ +void put_lseg (struct pnfs_layout_segment *lseg);void set_pnfs_layoutdriver (struct nfs_server *,u32 id);void unmount_pnfs_layoutdriver (struct nfs_server *);int pnfs_initialize (void );
@@ -41,6 +42,11 @@ void pnfs_get_layout_stateid(nfs4_stateid *dst, struct pnfs_layout_type *lo);#define LAYOUT_NFSV4_1_MODULE_PREFIX "nfs-layouttype4" +static inline void get_lseg (struct pnfs_layout_segment *lseg) +{ +kref_get (&lseg->kref); +} +/* Return true if a layout driver is being used for this mountpoint */ static inline int pnfs_enabled_sb (struct nfs_server *nfss) {
@@ -57,6 +63,14 @@ static inline void pnfs_destroy_layout(struct nfs_inode *nfsi) { } +static inline void get_lseg (struct pnfs_layout_segment *lseg) +{ +} + +static inline void put_lseg (struct pnfs_layout_segment *lseg) +{ +} +#endif /* CONFIG_NFS_V4_1 */ #endif /* FS_NFS_PNFS_H */
include/linux/nfs4_pnfs.h +2 -0
@@ -76,6 +76,8 @@ struct layoutdriver_io_operations {* a set_layout call to set the opaque layout in the layout driver.*/ struct pnfs_layout_type * (*alloc_layout) (struct inode *inode);void (*free_layout) (struct pnfs_layout_type *); +struct pnfs_layout_segment * (*alloc_lseg) (struct pnfs_layout_type *layoutid,struct nfs4_pnfs_layoutget_res *lgr); +void (*free_lseg) (struct pnfs_layout_segment *lseg);/* Registration information for a new mounted file system */
include/linux/nfs_fs.h +1 -0
@@ -211,6 +211,7 @@ struct nfs_inode {/* pNFS layout information */ #if defined(CONFIG_NFS_V4_1 ) +wait_queue_head_t lo_waitq;struct pnfs_layout_type *layout;#endif /* CONFIG_NFS_V4_1 */ #endif /* CONFIG_NFS_V4*/
include/linux/pnfs_xdr.h +3 -0
@@ -26,6 +26,9 @@ struct nfs4_pnfs_layout_segment {u64 length; }; +struct nfs4_pnfs_layoutget_res { +}; +struct nfs4_pnfs_getdeviceinfo_arg {struct pnfs_device *pdev;struct nfs4_sequence_args seq_args;
Signature · 1 line
1.6.2.5
PATCH 22/50 pnfs_submit: layoutget
From: The pNFS Team <[email protected]>
--- fs/nfs/nfs4proc.c | 114 +++++++++++++++++++++++++++++++++ fs/nfs/nfs4xdr.c | 156 ++++++++++++++++++++++++++++++++++++++++++++++ fs/nfs/pnfs.c | 19 ++++++ fs/nfs/pnfs.h | 5 ++ include/linux/nfs4.h | 1 + include/linux/pnfs_xdr.h | 26 ++++++++ 6 files changed, 321 insertions(+), 0 deletions(-)
fs/nfs/nfs4proc.c +114 -0
@@ -5366,6 +5366,120 @@ out:return status; } +static void +nfs4_pnfs_layoutget_prepare (struct rpc_task *task,void *calldata) +{ +struct nfs4_pnfs_layoutget *lgp = calldata; +struct inode *ino = lgp->args.inode; +struct nfs_server *server =NFS_SERVER (ino); + +dprintk ("--> %s\n" , __func__); +if (nfs4_setup_sequence (server, &lgp->args.seq_args, + &lgp->res.seq_res,0 , task)) +return ; +rpc_call_start (task); +} + +static void nfs4_pnfs_layoutget_done (struct rpc_task *task,void *calldata) +{ +struct nfs4_pnfs_layoutget *lgp = calldata; +struct inode *ino = lgp->args.inode; +struct nfs_server *server =NFS_SERVER (ino); + +dprintk ("--> %s\n" , __func__); + +if (!nfs4_sequence_done (task, &lgp->res.seq_res)) +return ; + +if (RPC_ASSASSINATED (task)) +return ; + +pnfs_get_layout_done (lgp, task->tk_status); + +if (nfs4_async_handle_error (task, server,NULL ) == -EAGAIN ) +nfs_restart_rpc (task, server->nfs_client); + + lgp->status = task->tk_status; +dprintk ("<-- %s\n" , __func__); +} + +static void nfs4_pnfs_layoutget_release (void *calldata) +{ +struct nfs4_pnfs_layoutget *lgp = calldata; + +dprintk ("--> %s\n" , __func__); +pnfs_layout_release (NFS_I (lgp->args.inode)->layout,NULL ); +if (lgp->res.layout.buf !=NULL ) +free_page ((unsigned long ) lgp->res.layout.buf); +kfree (calldata); +dprintk ("<-- %s\n" , __func__); +} + +static const struct rpc_call_ops nfs4_pnfs_layoutget_call_ops = { + .rpc_call_prepare = nfs4_pnfs_layoutget_prepare, + .rpc_call_done = nfs4_pnfs_layoutget_done, + .rpc_release = nfs4_pnfs_layoutget_release, +}; + +/* FIXME: We need to call nfs4_handle_exception +* and deal with retries. +* Currently we can't since we release lgp and its contents. +*/ +static int _pnfs4_proc_layoutget (struct nfs4_pnfs_layoutget *lgp) +{ +struct nfs_server *server =NFS_SERVER (lgp->args.inode); +struct rpc_task *task; +struct rpc_message msg = { + .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_PNFS_LAYOUTGET ], + .rpc_argp = &lgp->args, + .rpc_resp = &lgp->res, + }; +struct rpc_task_setup task_setup_data = { + .rpc_client = server->client, + .rpc_message = &msg, + .callback_ops = &nfs4_pnfs_layoutget_call_ops, + .callback_data = lgp, + .flags =RPC_TASK_ASYNC , + }; +int status =0 ; + +dprintk ("--> %s\n" , __func__); + + lgp->res.layout.buf = (void *)__get_free_page (GFP_NOFS ); +if (lgp->res.layout.buf ==NULL ) { +nfs4_pnfs_layoutget_release (lgp); +return -ENOMEM ; + } + + lgp->res.seq_res.sr_slotid =NFS4_MAX_SLOT_TABLE ; + task =rpc_run_task (&task_setup_data); +if (IS_ERR (task)) +return PTR_ERR (task); + status =nfs4_wait_for_completion_rpc_task (task); +if (status !=0 ) + goto out; + status = lgp->status; +if (status !=0 ) + goto out; + status =pnfs_layout_process (lgp); +out: +rpc_put_task (task); +dprintk ("<-- %s status=%d\n" , __func__, status); +return status; +} + +int pnfs4_proc_layoutget (struct nfs4_pnfs_layoutget *lgp) +{ +struct nfs_server *server =NFS_SERVER (lgp->args.inode); +struct nfs4_exception exception = { }; +int err; +do { + err =nfs4_handle_exception (server,_pnfs4_proc_layoutget (lgp), + &exception); + }while (exception.retry); +return err; +} +int nfs4_pnfs_getdeviceinfo (struct nfs_server *server,struct pnfs_device *pdev) {struct nfs4_pnfs_getdeviceinfo_arg args = {
fs/nfs/nfs4xdr.c +156 -0
198 lines not on this page · raw message
fs/nfs/pnfs.c +19 -0
@@ -256,6 +256,12 @@ put_layout(struct inode *inode) }void +pnfs_layout_release (struct pnfs_layout_type *lo, +struct nfs4_pnfs_layout_segment *range) +{ +} + +void pnfs_destroy_layout (struct nfs_inode *nfsi) {struct pnfs_layout_type *lo;
@@ -525,6 +531,19 @@ pnfs_alloc_layout(struct inode *ino)return nfsi->layout; } +void +pnfs_get_layout_done (struct nfs4_pnfs_layoutget *lgp,int rpc_status) +{ +} + +int +pnfs_layout_process (struct nfs4_pnfs_layoutget *lgp) +{ +int status =0 ; + +return status; +} +/* Callback operations for layout drivers. */ struct pnfs_client_operations pnfs_ops = {
fs/nfs/pnfs.h +5 -0
@@ -24,11 +24,16 @@/* nfs4proc.c */ extern int nfs4_pnfs_getdeviceinfo (struct nfs_server *server,struct pnfs_device *dev); +extern int pnfs4_proc_layoutget (struct nfs4_pnfs_layoutget *lgp); +/* pnfs.c */ void put_lseg (struct pnfs_layout_segment *lseg);void set_pnfs_layoutdriver (struct nfs_server *,u32 id);void unmount_pnfs_layoutdriver (struct nfs_server *);int pnfs_initialize (void ); +void pnfs_get_layout_done (struct nfs4_pnfs_layoutget *,int rpc_status); +int pnfs_layout_process (struct nfs4_pnfs_layoutget *lgp); +void pnfs_layout_release (struct pnfs_layout_type *,struct nfs4_pnfs_layout_segment *range);void pnfs_set_layout_stateid (struct pnfs_layout_type *lo,const nfs4_stateid *stateid);void pnfs_destroy_layout (struct nfs_inode *);
include/linux/nfs4.h +1 -0
@@ -546,6 +546,7 @@ enum {NFSPROC4_CLNT_SEQUENCE ,NFSPROC4_CLNT_GET_LEASE_TIME ,NFSPROC4_CLNT_RECLAIM_COMPLETE , +NFSPROC4_CLNT_PNFS_LAYOUTGET , NFSPROC4_CLNT_PNFS_GETDEVICEINFO, };
include/linux/pnfs_xdr.h +26 -0
@@ -19,6 +19,10 @@ struct pnfs_deviceid {char data[NFS4_PNFS_DEVICEID4_SIZE ]; }; +struct nfs4_pnfs_layout { +__u32 len; +void *buf; +};struct nfs4_pnfs_layout_segment {u32 iomode;
@@ -26,7 +30,29 @@ struct nfs4_pnfs_layout_segment {u64 length; }; +struct nfs4_pnfs_layoutget_arg { +__u32 type; +struct nfs4_pnfs_layout_segment lseg; +__u64 minlength; +__u32 maxcount; +struct inode *inode; +struct nfs4_sequence_args seq_args; +}; +struct nfs4_pnfs_layoutget_res { +__u32 return_on_close; +struct nfs4_pnfs_layout_segment lseg; +__u32 type; +nfs4_stateid stateid; +struct nfs4_pnfs_layout layout; +struct nfs4_sequence_res seq_res; +}; + +struct nfs4_pnfs_layoutget { +struct nfs4_pnfs_layoutget_arg args; +struct nfs4_pnfs_layoutget_res res; +struct pnfs_layout_segment **lsegpp; +int status; };struct nfs4_pnfs_getdeviceinfo_arg {
Signature · 1 line
1.6.2.5
PATCH 23/50 pnfs_submit: layout helper functions
From: The pNFS Team <[email protected]>
--- fs/nfs/inode.c | 1 + fs/nfs/pnfs.c | 377 ++++++++++++++++++++++++++++++++++++++++++++++++ fs/nfs/pnfs.h | 34 +++++ include/linux/nfs_fs.h | 1 + 4 files changed, 413 insertions(+), 0 deletions(-)
fs/nfs/inode.c +1 -0
@@ -1445,6 +1445,7 @@ static inline void nfs4_init_once(struct nfs_inode *nfsi)init_rwsem (&nfsi->rwsem);#ifdef CONFIG_NFS_V4_1 init_waitqueue_head (&nfsi->lo_waitq); + nfsi->pnfs_layout_suspend =0 ; nfsi->layout =NULL ;#endif /* CONFIG_NFS_V4_1 */ #endif
fs/nfs/pnfs.c +377 -0
411 lines not on this page · raw message
fs/nfs/pnfs.h +34 -0
@@ -28,6 +28,10 @@ extern int pnfs4_proc_layoutget(struct nfs4_pnfs_layoutget *lgp);/* pnfs.c */ void put_lseg (struct pnfs_layout_segment *lseg); +void _pnfs_update_layout (struct inode *ino,struct nfs_open_context *ctx, +enum pnfs_iomode access_type, +struct pnfs_layout_segment **lsegpp); +void set_pnfs_layoutdriver (struct nfs_server *,u32 id);void unmount_pnfs_layoutdriver (struct nfs_server *);int pnfs_initialize (void );
@@ -47,6 +51,12 @@ void pnfs_get_layout_stateid(nfs4_stateid *dst, struct pnfs_layout_type *lo);#define LAYOUT_NFSV4_1_MODULE_PREFIX "nfs-layouttype4" +static inline int lo_fail_bit (u32 iomode) +{ +return iomode ==IOMODE_RW ? +NFS_INO_RW_LAYOUT_FAILED :NFS_INO_RO_LAYOUT_FAILED ; +} +static inline void get_lseg (struct pnfs_layout_segment *lseg) {kref_get (&lseg->kref);
@@ -58,6 +68,21 @@ static inline int pnfs_enabled_sb(struct nfs_server *nfss) return nfss->pnfs_curr_ld != NULL; } +static inline void pnfs_update_layout (struct inode *ino, +struct nfs_open_context *ctx, +enum pnfs_iomode access_type, +struct pnfs_layout_segment **lsegpp) +{ +struct nfs_server *nfss =NFS_SERVER (ino); + +if (pnfs_enabled_sb (nfss)) +_pnfs_update_layout (ino, ctx, access_type, lsegpp); +else { +if (lsegpp) + *lsegpp =NULL ; + } +} +#else /* CONFIG_NFS_V4_1 */ static inline void pnfs_destroy_all_layouts (struct nfs_client *clp)
@@ -76,6 +101,15 @@ static inline void put_lseg(struct pnfs_layout_segment *lseg) { } +static inline void +pnfs_update_layout (struct inode *ino,struct nfs_open_context *ctx, +enum pnfs_iomode access_type, +struct pnfs_layout_segment **lsegpp) +{ +if (lsegpp) + *lsegpp =NULL ; +} +#endif /* CONFIG_NFS_V4_1 */ #endif /* FS_NFS_PNFS_H */
include/linux/nfs_fs.h +1 -0
@@ -213,6 +213,7 @@ struct nfs_inode {#if defined(CONFIG_NFS_V4_1 )wait_queue_head_t lo_waitq;struct pnfs_layout_type *layout; +time_t pnfs_layout_suspend;#endif /* CONFIG_NFS_V4_1 */ #endif /* CONFIG_NFS_V4*/ #ifdef CONFIG_NFS_FSCACHE
Signature · 1 line
1.6.2.5
PATCH 24/50 pnfs_submit: filelayout layout segment alloc and free
From: The pNFS Team <[email protected]>
--- fs/nfs/nfs4filelayout.c | 201 +++++++++++++++++++++++++++++++++++++++++++++ fs/nfs/nfs4filelayout.h | 16 ++++ fs/nfs/pnfs.c | 22 +++++ include/linux/nfs4.h | 5 + include/linux/nfs4_pnfs.h | 12 +++ 5 files changed, 256 insertions(+), 0 deletions(-)
fs/nfs/nfs4filelayout.c +201 -0
@@ -46,6 +46,7 @@#include "nfs4filelayout.h" #include "nfs4_fs.h" #include "internal.h" +#include "pnfs.h" #define NFSDBG_FACILITY NFSDBG_PNFS_LD
@@ -104,9 +105,209 @@ filelayout_free_layout(struct pnfs_layout_type *lo)dprintk ("NFS_FILELAYOUT: freeing layout\n" );kfree (FILE_LO (lo)); } + +/* +* filelayout_check_layout() +* +* Make sure layout segment parameters are sane WRT the device. +* +* Notes: +* 1) current code insists that # stripe index = # data servers in ds_list +* which is wrong. +* 2) pattern_offset is ignored and must == 0 which is wrong; +* 3) the pattern_offset needs to be a mutliple of the stripe unit. +* 4) stripe unit is multiple of page size +*/ + +static int +filelayout_check_layout (struct pnfs_layout_type *lo, +struct pnfs_layout_segment *lseg) +{ +struct nfs4_filelayout_segment *fl =LSEG_LD_DATA (lseg); +struct nfs4_file_layout_dsaddr *dsaddr; +int status = -EINVAL ; +struct nfs_server *nfss =NFS_SERVER (PNFS_INODE (lo)); + +dprintk ("--> %s\n" , __func__); + dsaddr =nfs4_pnfs_device_item_find (nfss->nfs_client, &fl->dev_id); +if (dsaddr ==NULL ) { + dsaddr =get_device_info (PNFS_INODE (lo), &fl->dev_id); +if (dsaddr ==NULL ) { +dprintk ("%s NO device for dev_id %s\n" , + __func__,deviceid_fmt (&fl->dev_id)); + goto out; + } + } +if (fl->first_stripe_index <0 || + fl->first_stripe_index > dsaddr->stripe_count) { +dprintk ("%s Bad first_stripe_index %d\n" , + __func__, fl->first_stripe_index); + goto out; + } + +if (fl->pattern_offset !=0 ) { +dprintk ("%s Unsupported no-zero pattern_offset %Ld\n" , + __func__, fl->pattern_offset); + goto out; + } + +if (fl->stripe_unit %PAGE_SIZE ) { +dprintk ("%s Stripe unit (%u) not page aligned\n" , + __func__, fl->stripe_unit); + goto out; + } + +/* XXX only support SPARSE packing. Don't support use MDS open fh */ +if (!(fl->num_fh ==1 || fl->num_fh == dsaddr->ds_num)) { +dprintk ("%s num_fh %u not equal to 1 or ds_num %u\n" , + __func__, fl->num_fh, dsaddr->ds_num); + goto out; + } + +if (fl->stripe_unit % nfss->rsize || fl->stripe_unit % nfss->wsize) { +dprintk ("%s Stripe unit (%u) not aligned with rsize %u " +"wsize %u\n" , __func__, fl->stripe_unit, nfss->rsize, + nfss->wsize); + } + +/* reference the device */ +nfs4_set_layout_deviceid (lseg, &dsaddr->deviceid); + + status =0 ; +out: +dprintk ("--> %s returns %d\n" , __func__, status); +return status; +} + +static void _filelayout_free_lseg (struct pnfs_layout_segment *lseg); +static void filelayout_free_fh_array (struct nfs4_filelayout_segment *fl); + +/* Decode layout and store in layoutid. Overwrite any existing layout +* information for this file. +*/ +static int +filelayout_set_layout (struct nfs4_filelayout *flo, +struct nfs4_filelayout_segment *fl, +struct nfs4_pnfs_layoutget_res *lgr) +{ +uint32_t *p = (uint32_t *)lgr->layout.buf; +uint32_t nfl_util; +int i; + +dprintk ("%s: set_layout_map Begin\n" , __func__); + +memcpy (&fl->dev_id, p,NFS4_PNFS_DEVICEID4_SIZE ); + p +=XDR_QUADLEN (NFS4_PNFS_DEVICEID4_SIZE ); + nfl_util =be32_to_cpup (p++); +if (nfl_util &NFL4_UFLG_COMMIT_THRU_MDS ) + fl->commit_through_mds =1 ; +if (nfl_util &NFL4_UFLG_DENSE ) + fl->stripe_type =STRIPE_DENSE ; +else + fl->stripe_type =STRIPE_SPARSE ; + fl->stripe_unit = nfl_util & ~NFL4_UFLG_MASK ; + +if (!flo->stripe_unit) + flo->stripe_unit = fl->stripe_unit; +else if (flo->stripe_unit != fl->stripe_unit) { +printk (KERN_NOTICE "%s: updating strip_unit from %u to %u\n" , + __func__, flo->stripe_unit, fl->stripe_unit); + flo->stripe_unit = fl->stripe_unit; + } + + fl->first_stripe_index =be32_to_cpup (p++); + p =xdr_decode_hyper (p, &fl->pattern_offset); + fl->num_fh =be32_to_cpup (p++); + +dprintk ("%s: nfl_util 0x%X num_fh %u fsi %u po %llu dev_id %s\n" , + __func__, nfl_util, fl->num_fh, fl->first_stripe_index, + fl->pattern_offset,deviceid_fmt (&fl->dev_id)); + +if (fl->num_fh *sizeof (struct nfs_fh ) >2 *PAGE_SIZE ) { + fl->fh_array =vmalloc (fl->num_fh *sizeof (struct nfs_fh )); +if (fl->fh_array) +memset (fl->fh_array,0 , + fl->num_fh *sizeof (struct nfs_fh )); + }else { + fl->fh_array =kzalloc (fl->num_fh *sizeof (struct nfs_fh ), +GFP_KERNEL ); + } +if (!fl->fh_array) +return -ENOMEM ; + +for (i =0 ; i < fl->num_fh; i++) { +/* fh */ + fl->fh_array[i].size =be32_to_cpup (p++); +if (sizeof (struct nfs_fh ) < fl->fh_array[i].size) { +printk (KERN_ERR "Too big fh %d received %d\n" , + i, fl->fh_array[i].size); +/* Layout is now invalid, pretend it doesn't exist */ +filelayout_free_fh_array (fl); + fl->num_fh =0 ; +break ; + } +memcpy (fl->fh_array[i].data, p, fl->fh_array[i].size); + p +=XDR_QUADLEN (fl->fh_array[i].size); +dprintk ("DEBUG: %s: fh len %d\n" , __func__, + fl->fh_array[i].size); + } + +return 0 ; +} + +static struct pnfs_layout_segment * +filelayout_alloc_lseg (struct pnfs_layout_type *layoutid, +struct nfs4_pnfs_layoutget_res *lgr) +{ +struct nfs4_filelayout *flo =FILE_LO (layoutid); +struct pnfs_layout_segment *lseg; +int rc; + +dprintk ("--> %s\n" , __func__); + lseg =kzalloc (sizeof (struct pnfs_layout_segment ) + +sizeof (struct nfs4_filelayout_segment ),GFP_KERNEL ); +if (!lseg) +return NULL ; + + rc =filelayout_set_layout (flo,LSEG_LD_DATA (lseg), lgr); + +if (rc !=0 ||filelayout_check_layout (layoutid, lseg)) { +_filelayout_free_lseg (lseg); + lseg =NULL ; + } +return lseg; +} + +static void filelayout_free_fh_array (struct nfs4_filelayout_segment *fl) +{ +if (fl->num_fh *sizeof (struct nfs_fh ) >2 *PAGE_SIZE ) +vfree (fl->fh_array); +else +kfree (fl->fh_array); + + fl->fh_array =NULL ; +} + +static void +_filelayout_free_lseg (struct pnfs_layout_segment *lseg) +{ +filelayout_free_fh_array (LSEG_LD_DATA (lseg)); +kfree (lseg); +} + +static void +filelayout_free_lseg (struct pnfs_layout_segment *lseg) +{ +dprintk ("--> %s\n" , __func__); +nfs4_unset_layout_deviceid (lseg, lseg->deviceid, + nfs4_fl_free_deviceid_callback); +_filelayout_free_lseg (lseg); +}struct layoutdriver_io_operations filelayout_io_operations = { .alloc_layout = filelayout_alloc_layout, .free_layout = filelayout_free_layout, + .alloc_lseg = filelayout_alloc_lseg, + .free_lseg = filelayout_free_lseg, .initialize_mountpoint = filelayout_initialize_mountpoint, .uninitialize_mountpoint = filelayout_uninitialize_mountpoint, };
fs/nfs/nfs4filelayout.h +16 -0
@@ -23,6 +23,11 @@#define NFS4_PNFS_MAX_STRIPE_CNT 4096#define NFS4_PNFS_MAX_MULTI_CNT 64/* 256 fit into a u8 stripe_index */ +enum stripetype4 { +STRIPE_SPARSE =1 , +STRIPE_DENSE =2 +}; +/* Individual ip address */ struct nfs4_pnfs_ds {struct list_head ds_node;/* nfs4_pnfs_dev_hlist dev_dslist */
@@ -41,6 +46,17 @@ struct nfs4_file_layout_dsaddr {struct nfs4_pnfs_ds *ds_list[1 ]; }; +struct nfs4_filelayout_segment { +u32 stripe_type; +u32 commit_through_mds; +u32 stripe_unit; +u32 first_stripe_index; +u64 pattern_offset; +struct pnfs_deviceid dev_id; +unsigned int num_fh; +struct nfs_fh *fh_array; +}; +struct nfs4_filelayout {struct pnfs_layout_type fl_layout;u32 stripe_unit;
fs/nfs/pnfs.c +22 -0
@@ -972,6 +972,28 @@ nfs4_init_deviceid_node(struct nfs4_deviceid *d) }EXPORT_SYMBOL (nfs4_init_deviceid_node); +/* Called from layoutdriver_io_operations->alloc_lseg */ +void +nfs4_set_layout_deviceid (struct pnfs_layout_segment *l,struct nfs4_deviceid *d) +{ +dprintk ("%s [%d]\n" , __func__,atomic_read (&d->de_kref.refcount)); + l->deviceid = d; +kref_get (&d->de_kref); +} +EXPORT_SYMBOL (nfs4_set_layout_deviceid); + +/* Called from layoutdriver_io_operations->free_lseg */ +void +nfs4_unset_layout_deviceid (struct pnfs_layout_segment *l, +struct nfs4_deviceid *d, +void (*free_callback)(struct kref *)) +{ +dprintk ("%s [%d]\n" , __func__,atomic_read (&d->de_kref.refcount)); + l->deviceid =NULL ; +kref_put (&d->de_kref, free_callback); +} +EXPORT_SYMBOL (nfs4_unset_layout_deviceid); +struct nfs4_deviceid *nfs4_find_deviceid (struct nfs4_deviceid_cache *c,struct pnfs_deviceid *id) {
include/linux/nfs4.h +5 -0
@@ -576,6 +576,11 @@ enum pnfs_iomode { IOMODE_ANY = 3, }; +#define NFL4_UFLG_MASK 0x0000003F +#define NFL4_UFLG_DENSE 0x00000001 +#define NFL4_UFLG_COMMIT_THRU_MDS 0x00000002 +#define NFL4_UFLG_STRIPE_UNIT_SIZE_MASK 0xFFFFFFC0 +#endif #endif
include/linux/nfs4_pnfs.h +12 -0
@@ -67,6 +67,12 @@ struct pnfs_layout_segment {u8 ld_data[];/* layout driver private data */ }; +static inline void * +LSEG_LD_DATA (struct pnfs_layout_segment *lseg) +{ +return lseg->ld_data; +} +/* Layout driver I/O operations. * Either the pagecache or non-pagecache read/write operations must be implemented */
@@ -142,6 +148,12 @@ extern struct nfs4_deviceid *nfs4_find_deviceid(struct nfs4_deviceid_cache *, struct pnfs_deviceid *);extern struct nfs4_deviceid *nfs4_add_deviceid (struct nfs4_deviceid_cache *,struct nfs4_deviceid *); +extern void nfs4_set_layout_deviceid (struct pnfs_layout_segment *, +struct nfs4_deviceid *); +extern void nfs4_unset_layout_deviceid (struct pnfs_layout_segment *, +struct nfs4_deviceid *, +void (*free_callback)(struct kref *)); +/* pNFS client callback functions. * These operations allow the layout driver to access pNFS client * specific information or call pNFS client->server operations.
Signature · 1 line
1.6.2.5
PATCH 25/50 pnfs_submit: layoutcommit helper functions
From: The pNFS Team <[email protected]>
--- fs/nfs/inode.c | 4 ++ fs/nfs/pnfs.c | 119 +++++++++++++++++++++++++++++++++++++++++++++ fs/nfs/pnfs.h | 4 ++ include/linux/nfs4_pnfs.h | 13 +++++ include/linux/pnfs_xdr.h | 33 ++++++++++++ 5 files changed, 173 insertions(+), 0 deletions(-)
fs/nfs/inode.c +4 -0
@@ -1577,6 +1577,7 @@ out:#endif #ifdef CONFIG_NFS_V4_1 out00: +pnfs_uninitialize ();#endif /* CONFIG_NFS_V4_1 */ nfs_destroy_directcache (); out0:
@@ -1611,6 +1612,9 @@ static void __exit exit_nfs_fs(void)#ifdef CONFIG_PROC_FS rpc_proc_unregister ("nfs" );#endif +#ifdef CONFIG_NFS_V4_1 +pnfs_uninitialize (); +#endif unregister_nfs_fs ();nfs_fs_proc_exit ();nfsiod_stop ();
fs/nfs/pnfs.c +119 -0
147 lines not on this page · raw message
fs/nfs/pnfs.h +4 -0
@@ -35,6 +35,10 @@ void _pnfs_update_layout(struct inode *ino, struct nfs_open_context *ctx,void set_pnfs_layoutdriver (struct nfs_server *,u32 id);void unmount_pnfs_layoutdriver (struct nfs_server *);int pnfs_initialize (void ); +void pnfs_uninitialize (void ); +void pnfs_layoutcommit_free (struct pnfs_layoutcommit_data *data); +void pnfs_update_last_write (struct nfs_inode *nfsi,loff_t offset,size_t extent); +void pnfs_need_layoutcommit (struct nfs_inode *nfsi,struct nfs_open_context *ctx);void pnfs_get_layout_done (struct nfs4_pnfs_layoutget *,int rpc_status);int pnfs_layout_process (struct nfs4_pnfs_layoutget *lgp);void pnfs_layout_release (struct pnfs_layout_type *,struct nfs4_pnfs_layout_segment *range);
include/linux/nfs4_pnfs.h +13 -0
@@ -54,6 +54,19 @@ PNFS_LD_IO_OPS(struct pnfs_layout_type *lo) return PNFS_LD(lo)->ld_io_ops; } +static inline bool +has_layout (struct nfs_inode *nfsi) +{ +return nfsi->layout !=NULL ; +} + +#else /* CONFIG_NFS_V4_1 */ + +static inline bool +has_layout (struct nfs_inode *nfsi) +{ +return false; +}#endif /* CONFIG_NFS_V4_1 */
include/linux/pnfs_xdr.h +33 -0
@@ -55,6 +55,39 @@ struct nfs4_pnfs_layoutget {int status; }; +struct pnfs_layoutcommit_arg { +nfs4_stateid stateid; +__u64 lastbytewritten; +__u32 time_modify_changed; +struct timespec time_modify; +const u32 *bitmask; +struct nfs_fh *fh; +struct inode *inode; + +/* Values set by layout driver */ +struct nfs4_pnfs_layout_segment lseg; +__u32 layout_type; +void *layoutdriver_data; +struct nfs4_sequence_args seq_args; +}; + +struct pnfs_layoutcommit_res { +__u32 sizechanged; +__u64 newsize; +struct nfs_fattr *fattr; +const struct nfs_server *server; +struct nfs4_sequence_res seq_res; +}; + +struct pnfs_layoutcommit_data { +struct rpc_task task; +struct rpc_cred *cred; +struct nfs_fattr fattr; +struct pnfs_layoutcommit_arg args; +struct pnfs_layoutcommit_res res; +int status; +}; +struct nfs4_pnfs_getdeviceinfo_arg {struct pnfs_device *pdev;struct nfs4_sequence_args seq_args;
Signature · 1 line
1.6.2.5
PATCH 26/50 pnfs_submit: layoutcommit
From: The pNFS Team <[email protected]>
--- fs/nfs/nfs4proc.c | 107 ++++++++++++++++++++++++++++++++++++ fs/nfs/nfs4xdr.c | 132 +++++++++++++++++++++++++++++++++++++++++++++ fs/nfs/pnfs.c | 62 +++++++++++++++++++++ fs/nfs/pnfs.h | 8 +++ fs/nfs/write.c | 14 +++++- include/linux/nfs4.h | 1 + include/linux/nfs4_pnfs.h | 13 +++++ 7 files changed, 336 insertions(+), 1 deletions(-)
fs/nfs/nfs4proc.c +107 -0
@@ -5480,6 +5480,113 @@ int pnfs4_proc_layoutget(struct nfs4_pnfs_layoutget *lgp)return err; } +static void pnfs_layoutcommit_prepare (struct rpc_task *task,void *data) +{ +struct pnfs_layoutcommit_data *ldata = + (struct pnfs_layoutcommit_data *)data; +struct nfs_server *server =NFS_SERVER (ldata->args.inode); + +if (nfs4_setup_sequence (server, &ldata->args.seq_args, + &ldata->res.seq_res,1 , task)) +return ; +rpc_call_start (task); +} + +static void +pnfs_layoutcommit_done (struct rpc_task *task,void *calldata) +{ +struct pnfs_layoutcommit_data *data = + (struct pnfs_layoutcommit_data *)calldata; +struct nfs_server *server =NFS_SERVER (data->args.inode); + +if (!nfs4_sequence_done (task, &data->res.seq_res)) +return ; + +if (RPC_ASSASSINATED (task)) +return ; + +if (nfs4_async_handle_error (task, server,NULL ) == -EAGAIN ) +nfs_restart_rpc (task, server->nfs_client); + + data->status = task->tk_status; +} + +static void pnfs_layoutcommit_release (void *lcdata) +{ +struct pnfs_layoutcommit_data *data = + (struct pnfs_layoutcommit_data *)lcdata; + +/* Matched by get_layout in pnfs_layoutcommit_inode */ +put_layout (data->args.inode); +put_rpccred (data->cred); +pnfs_layoutcommit_free (lcdata); +} + +static const struct rpc_call_ops pnfs_layoutcommit_ops = { + .rpc_call_prepare = pnfs_layoutcommit_prepare, + .rpc_call_done = pnfs_layoutcommit_done, + .rpc_release = pnfs_layoutcommit_release, +}; + +/* Execute a layoutcommit to the server */ +static int +_pnfs4_proc_layoutcommit (struct pnfs_layoutcommit_data *data,int issync) +{ +struct rpc_message msg = { + .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_PNFS_LAYOUTCOMMIT ], + .rpc_argp = &data->args, + .rpc_resp = &data->res, + .rpc_cred = data->cred, + }; +struct rpc_task_setup task_setup_data = { + .task = &data->task, + .rpc_client =NFS_CLIENT (data->args.inode), + .rpc_message = &msg, + .callback_ops = &pnfs_layoutcommit_ops, + .callback_data = data, + .flags =RPC_TASK_ASYNC , + }; +struct rpc_task *task; +int status =0 ; + +dprintk ("NFS: %4d initiating layoutcommit call. %llu@%llu lbw: %llu " +"type: %d issync %d\n" , + data->task.tk_pid, + data->args.lseg.length, + data->args.lseg.offset, + data->args.lastbytewritten, + data->args.layout_type, issync); + + data->res.seq_res.sr_slotid =NFS4_MAX_SLOT_TABLE ; + task =rpc_run_task (&task_setup_data); +if (IS_ERR (task)) +return PTR_ERR (task); +if (!issync) + goto out; + status =nfs4_wait_for_completion_rpc_task (task); +if (status !=0 ) + goto out; + status = data->status; +out: +dprintk ("%s: status %d\n" , __func__, status); +rpc_put_task (task); +return 0 ; +} + +int pnfs4_proc_layoutcommit (struct pnfs_layoutcommit_data *data,int issync) +{ +struct nfs4_exception exception = { }; +struct nfs_server *server =NFS_SERVER (data->args.inode); +int err; + +do { + err =nfs4_handle_exception (server, +_pnfs4_proc_layoutcommit (data, issync), + &exception); + }while (exception.retry); +return err; +} +int nfs4_pnfs_getdeviceinfo (struct nfs_server *server,struct pnfs_device *pdev) {struct nfs4_pnfs_getdeviceinfo_arg args = {
fs/nfs/nfs4xdr.c +132 -0
174 lines not on this page · raw message
fs/nfs/pnfs.c +62 -0
68 lines not on this page · raw message
fs/nfs/pnfs.h +8 -0
@@ -25,6 +25,8 @@extern int nfs4_pnfs_getdeviceinfo (struct nfs_server *server,struct pnfs_device *dev);extern int pnfs4_proc_layoutget (struct nfs4_pnfs_layoutget *lgp); +extern int pnfs4_proc_layoutcommit (struct pnfs_layoutcommit_data *data, +int issync);/* pnfs.c */ void put_lseg (struct pnfs_layout_segment *lseg);
@@ -37,6 +39,7 @@ void unmount_pnfs_layoutdriver(struct nfs_server *);int pnfs_initialize (void );void pnfs_uninitialize (void );void pnfs_layoutcommit_free (struct pnfs_layoutcommit_data *data); +int pnfs_layoutcommit_inode (struct inode *inode,int sync);void pnfs_update_last_write (struct nfs_inode *nfsi,loff_t offset,size_t extent);void pnfs_need_layoutcommit (struct nfs_inode *nfsi,struct nfs_open_context *ctx);void pnfs_get_layout_done (struct nfs4_pnfs_layoutget *,int rpc_status);
@@ -114,6 +117,11 @@ pnfs_update_layout(struct inode *ino, struct nfs_open_context *ctx, *lsegpp =NULL ; } +static inline int pnfs_layoutcommit_inode (struct inode *inode,int sync) +{ +return 0 ; +} +#endif /* CONFIG_NFS_V4_1 */ #endif /* FS_NFS_PNFS_H */
fs/nfs/write.c +13 -1
@@ -28,6 +28,7 @@#include "iostat.h" #include "nfs4_fs.h" #include "fscache.h" +#include "pnfs.h" #define NFSDBG_FACILITY NFSDBG_PAGECACHE
@@ -1465,7 +1466,18 @@ static int nfs_commit_unstable_pages(struct inode *inode, struct writeback_contrint nfs_write_inode (struct inode *inode,struct writeback_control *wbc) { -return nfs_commit_unstable_pages (inode, wbc); +int ret; + ret =nfs_commit_unstable_pages (inode, wbc); +if (ret >=0 &&layoutcommit_needed (NFS_I (inode))) { +int err, sync = wbc->sync_mode; + +if (wbc->nonblocking || wbc->for_background) + sync =0 ; + err =pnfs_layoutcommit_inode (inode, sync); +if (err <0 ) + ret = err; + } +return ret; }/*
include/linux/nfs4.h +1 -0
@@ -547,6 +547,7 @@ enum {NFSPROC4_CLNT_GET_LEASE_TIME ,NFSPROC4_CLNT_RECLAIM_COMPLETE ,NFSPROC4_CLNT_PNFS_LAYOUTGET , +NFSPROC4_CLNT_PNFS_LAYOUTCOMMIT , NFSPROC4_CLNT_PNFS_GETDEVICEINFO, };
include/linux/nfs4_pnfs.h +13 -0
@@ -60,6 +60,13 @@ has_layout(struct nfs_inode *nfsi)return nfsi->layout !=NULL ; } +static inline bool +layoutcommit_needed (struct nfs_inode *nfsi) +{ +return has_layout (nfsi) && +test_bit (NFS_INO_LAYOUTCOMMIT , &nfsi->layout->pnfs_layout_state); +} +#else /* CONFIG_NFS_V4_1 */ static inline bool
@@ -68,6 +75,12 @@ has_layout(struct nfs_inode *nfsi)return false; } +static inline bool +layoutcommit_needed (struct nfs_inode *nfsi) +{ +return 0 ; +} +#endif /* CONFIG_NFS_V4_1 */ struct pnfs_layout_segment {
Signature · 1 line
1.6.2.5
PATCH 27/50 pnfs_submit: layoutreturn helper functions
From: The pNFS Team <[email protected]>
--- fs/nfs/pnfs.c | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++ include/linux/nfs4.h | 7 +++ 2 files changed, 131 insertions(+), 0 deletions(-)
fs/nfs/pnfs.c +124 -0
@@ -581,6 +581,25 @@ should_free_lseg(struct pnfs_layout_segment *lseg, lseg->range.iomode == range->iomode); } +static struct pnfs_layout_segment * +has_layout_to_return (struct pnfs_layout_type *lo, +struct nfs4_pnfs_layout_segment *range) +{ +struct pnfs_layout_segment *out =NULL , *lseg; +dprintk ("%s:Begin lo %p offset %llu length %llu iomode %d\n" , + __func__, lo, range->offset, range->length, range->iomode); + +BUG_ON_UNLOCKED_LO (lo); + list_for_each_entry (lseg, &lo->segs, fi_list) +if (should_free_lseg (lseg, range)) { + out = lseg; +break ; + } + +dprintk ("%s:Return lseg=%p\n" , __func__, out); +return out; +} +static inline bool _pnfs_can_return_lseg (struct pnfs_layout_segment *lseg) {
@@ -621,6 +640,111 @@ pnfs_free_layout(struct pnfs_layout_type *lo,dprintk ("%s:Return\n" , __func__); } +static bool +pnfs_return_layout_barrier (struct nfs_inode *nfsi, +struct nfs4_pnfs_layout_segment *range) +{ +struct pnfs_layout_segment *lseg; +bool ret = false; + +spin_lock (&nfsi->vfs_inode.i_lock); +list_for_each_entry (lseg, &nfsi->layout->segs, fi_list) { +if (!should_free_lseg (lseg, range)) +continue ; + lseg->valid = false; +if (!_pnfs_can_return_lseg (lseg)) { +dprintk ("%s: wait on lseg %p refcount %d\n" , + __func__, lseg, +atomic_read (&lseg->kref.refcount)); + ret = true; + } + } +spin_unlock (&nfsi->vfs_inode.i_lock); +dprintk ("%s:Return %d\n" , __func__, ret); +return ret; +} + +static int +return_layout (struct inode *ino,struct nfs4_pnfs_layout_segment *range, +enum pnfs_layoutreturn_type type,struct pnfs_layout_type *lo, +bool wait) +{ +return 0 ; +} + +int +_pnfs_return_layout (struct inode *ino,struct nfs4_pnfs_layout_segment *range, +const nfs4_stateid *stateid,/* optional */ +enum pnfs_layoutreturn_type type, +bool wait) +{ +struct pnfs_layout_type *lo =NULL ; +struct nfs_inode *nfsi =NFS_I (ino); +struct nfs4_pnfs_layout_segment arg; +int status =0 ; + +dprintk ("--> %s type %d\n" , __func__, type); + + + arg.iomode = range ? range->iomode :IOMODE_ANY ; + arg.offset =0 ; + arg.length =NFS4_MAX_UINT64 ; + +if (type ==RETURN_FILE ) { +spin_lock (&ino->i_lock); + lo = nfsi->layout; +if (lo && !has_layout_to_return (lo, &arg)) { + lo =NULL ; + } +if (!lo) { +spin_unlock (&ino->i_lock); +dprintk ("%s: no layout segments to return\n" , __func__); + goto out; + } + +/* Reference for layoutreturn matched in pnfs_layout_release */ +get_layout (lo); + +spin_unlock (&ino->i_lock); + +if (pnfs_return_layout_barrier (nfsi, &arg)) { +if (stateid) {/* callback */ + status = -EAGAIN ; + goto out_put; + } +dprintk ("%s: waiting\n" , __func__); +wait_event (nfsi->lo_waitq, + !pnfs_return_layout_barrier (nfsi, &arg)); + } + +if (layoutcommit_needed (nfsi)) { +if (stateid && !wait) {/* callback */ +dprintk ("%s: layoutcommit pending\n" , __func__); + status = -EAGAIN ; + goto out_put; + } + status =pnfs_layoutcommit_inode (ino, wait); +if (status) { +/* Return layout even if layoutcommit fails */ +dprintk ("%s: layoutcommit failed, status=%d. " +"Returning layout anyway\n" , + __func__, status); + } + } + +if (!stateid) + status =return_layout (ino, &arg, type, lo, wait); +else +pnfs_layout_release (lo, &arg); + } +out: +dprintk ("<-- %s status: %d\n" , __func__, status); +return status; +out_put: +put_layout (ino); + goto out; +} +/* * cmp two layout segments for sorting into layout cache */
include/linux/nfs4.h +7 -0
@@ -571,6 +571,13 @@ enum pnfs_layouttype { LAYOUT_NFSV4_1_FILES = 1, }; +/* used for both layout return and recall */ +enum pnfs_layoutreturn_type { +RETURN_FILE =1 , +RETURN_FSID =2 , +RETURN_ALL =3 +}; +enum pnfs_iomode {IOMODE_READ =1 ,IOMODE_RW =2 ,
Signature · 1 line
1.6.2.5
PATCH 28/50 pnfs_submit: layoutreturn
From: The pNFS Team <[email protected]>
--- fs/nfs/inode.c | 3 +- fs/nfs/nfs4proc.c | 106 ++++++++++++++++++++++++++++++++++++++++++++ fs/nfs/nfs4state.c | 20 ++++++++- fs/nfs/nfs4xdr.c | 109 ++++++++++++++++++++++++++++++++++++++++++++++ fs/nfs/pnfs.c | 25 ++++++++++- fs/nfs/pnfs.h | 49 +++++++++++++++++++++ include/linux/nfs4.h | 1 + include/linux/pnfs_xdr.h | 22 +++++++++ 8 files changed, 332 insertions(+), 3 deletions(-)
fs/nfs/inode.c +2 -1
@@ -1403,9 +1403,10 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)*/ void nfs4_clear_inode (struct inode *inode) { +pnfs_return_layout (inode,NULL ,NULL ,RETURN_FILE , true); +/* If we are holding a delegation, return it! */ nfs_inode_return_delegation_noreclaim (inode); -/* First call standard NFS clear_inode() code */ nfs_clear_inode (inode); }#endif
fs/nfs/nfs4proc.c +106 -0
112 lines not on this page · raw message
fs/nfs/nfs4state.c +19 -1
@@ -53,6 +53,8 @@#include "callback.h" #include "delegation.h" #include "internal.h" +#include <linux/pnfs_xdr.h> +#include <linux/nfs4_pnfs.h> #include "pnfs.h" #define OPENOWNER_POOL_SIZE 8
@@ -584,8 +586,24 @@ static void __nfs4_close(struct path *path, struct nfs4_state *state,if (!call_close) {nfs4_put_open_state (state);nfs4_put_state_owner (owner); - }else + }else { +u32 roc_iomode; +struct nfs_inode *nfsi =NFS_I (state->inode); + +if (has_layout (nfsi) && + (roc_iomode =pnfs_layout_roc_iomode (nfsi)) !=0 ) { +struct nfs4_pnfs_layout_segment range = { + .iomode = roc_iomode, + .offset =0 , + .length =NFS4_MAX_UINT64 , + }; + +pnfs_return_layout (state->inode, &range,NULL , +RETURN_FILE , wait); + } +nfs4_do_close (path, state, gfp_mask, wait); + } }void nfs4_close_state (struct path *path,struct nfs4_state *state,fmode_t fmode)
fs/nfs/nfs4xdr.c +109 -0
151 lines not on this page · raw message
fs/nfs/pnfs.c +24 -1
@@ -669,7 +669,30 @@ return_layout(struct inode *ino, struct nfs4_pnfs_layout_segment *range, enum pnfs_layoutreturn_type type, struct pnfs_layout_type *lo, bool wait) { - return 0; + struct nfs4_pnfs_layoutreturn *lrp; +struct nfs_server *server =NFS_SERVER (ino); +int status = -ENOMEM ; + +dprintk ("--> %s\n" , __func__); + +BUG_ON (type !=RETURN_FILE ); + + lrp =kzalloc (sizeof (*lrp),GFP_KERNEL ); +if (lrp ==NULL ) { +if (lo && (type ==RETURN_FILE )) +pnfs_layout_release (lo,NULL ); + goto out; + } + lrp->args.reclaim =0 ; + lrp->args.layout_type = server->pnfs_curr_ld->id; + lrp->args.return_type = type; + lrp->args.lseg = *range; + lrp->args.inode = ino; + + status =pnfs4_proc_layoutreturn (lrp, wait); +out: +dprintk ("<-- %s status: %d\n" , __func__, status); +return status; }int
fs/nfs/pnfs.h +49 -0
73 lines not on this page · raw message
include/linux/nfs4.h +1 -0
@@ -548,6 +548,7 @@ enum {NFSPROC4_CLNT_RECLAIM_COMPLETE ,NFSPROC4_CLNT_PNFS_LAYOUTGET ,NFSPROC4_CLNT_PNFS_LAYOUTCOMMIT , +NFSPROC4_CLNT_PNFS_LAYOUTRETURN , NFSPROC4_CLNT_PNFS_GETDEVICEINFO, };
include/linux/pnfs_xdr.h +22 -0
@@ -88,6 +88,28 @@ struct pnfs_layoutcommit_data {int status; }; +struct nfs4_pnfs_layoutreturn_arg { +__u32 reclaim; +__u32 layout_type; +__u32 return_type; +struct nfs4_pnfs_layout_segment lseg; +struct inode *inode; +struct nfs4_sequence_args seq_args; +}; + +struct nfs4_pnfs_layoutreturn_res { +struct nfs4_sequence_res seq_res; +u32 lrs_present; +nfs4_stateid stateid; +}; + +struct nfs4_pnfs_layoutreturn { +struct nfs4_pnfs_layoutreturn_arg args; +struct nfs4_pnfs_layoutreturn_res res; +struct rpc_cred *cred; +int rpc_status; +}; +struct nfs4_pnfs_getdeviceinfo_arg {struct pnfs_device *pdev;struct nfs4_sequence_args seq_args;
Signature · 1 line
1.6.2.5
PATCH 29/50 pnfs_submit: add data server session to nfs4_setup_sequence
From: The pNFS Team <[email protected]>
Note: original patch of same name...
Signed-off_by: Benny Halevy <[email protected]>
--- fs/nfs/nfs4_fs.h | 3 +++ fs/nfs/nfs4proc.c | 21 ++++++++++++--------- fs/nfs/read.c | 2 +- fs/nfs/unlink.c | 2 +- fs/nfs/write.c | 2 +- 5 files changed, 18 insertions(+), 12 deletions(-)
fs/nfs/nfs4_fs.h +3 -0
@@ -256,10 +256,12 @@ static inline struct nfs4_session *nfs4_get_session(const struct nfs_server *ser }extern int nfs4_setup_sequence (const struct nfs_server *server, +struct nfs4_session *ds_session,struct nfs4_sequence_args *args,struct nfs4_sequence_res *res,int cache_reply,struct rpc_task *task);extern void nfs4_destroy_session (struct nfs4_session *session);extern struct nfs4_session *nfs4_alloc_session (struct nfs_client *clp); +extern int nfs4_proc_exchange_id (struct nfs_client *,struct rpc_cred *);extern int nfs4_proc_create_session (struct nfs_client *);extern int nfs4_proc_destroy_session (struct nfs4_session *);extern int nfs4_init_session (struct nfs_server *server);
@@ -272,6 +274,7 @@ static inline struct nfs4_session *nfs4_get_session(const struct nfs_server *ser }static inline int nfs4_setup_sequence (const struct nfs_server *server, +struct nfs4_session *ds_session,struct nfs4_sequence_args *args,struct nfs4_sequence_res *res,int cache_reply,struct rpc_task *task) {
fs/nfs/nfs4proc.c +12 -9
@@ -570,6 +570,7 @@ static int nfs41_setup_sequence(struct nfs4_session *session, } int nfs4_setup_sequence(const struct nfs_server *server, + struct nfs4_session *ds_session, struct nfs4_sequence_args *args, struct nfs4_sequence_res *res, int cache_reply,
@@ -578,6 +579,8 @@ int nfs4_setup_sequence(const struct nfs_server *server,struct nfs4_session *session =nfs4_get_session (server);int ret =0 ; +if (ds_session) + session = ds_session;if (session ==NULL ) { args->sa_session =NULL ; res->sr_session =NULL ;
@@ -607,7 +610,7 @@ static void nfs41_call_sync_prepare(struct rpc_task *task, void *calldata)dprintk ("--> %s data->seq_server %p\n" , __func__, data->seq_server); -if (nfs4_setup_sequence (data->seq_server, data->seq_args, +if (nfs4_setup_sequence (data->seq_server,NULL , data->seq_args, data->seq_res, data->cache_reply, task))return ;rpc_call_start (task);
@@ -1396,7 +1399,7 @@ static void nfs4_open_prepare(struct rpc_task *task, void *calldata)nfs_copy_fh (&data->o_res.fh, data->o_arg.fh); } data->timestamp = jiffies; -if (nfs4_setup_sequence (data->o_arg.server, +if (nfs4_setup_sequence (data->o_arg.server,NULL , &data->o_arg.seq_args, &data->o_res.seq_res,1 , task))return ;
@@ -1938,7 +1941,7 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data)nfs_fattr_init (calldata->res.fattr); calldata->timestamp = jiffies; -if (nfs4_setup_sequence (NFS_SERVER (calldata->inode), +if (nfs4_setup_sequence (NFS_SERVER (calldata->inode),NULL , &calldata->arg.seq_args, &calldata->res.seq_res,1 , task))return ;
@@ -3705,7 +3708,7 @@ static void nfs4_delegreturn_prepare(struct rpc_task *task, void *data) d_data = (struct nfs4_delegreturndata *)data; -if (nfs4_setup_sequence (d_data->res.server, +if (nfs4_setup_sequence (d_data->res.server,NULL , &d_data->args.seq_args, &d_data->res.seq_res,1 , task))return ;
@@ -3961,7 +3964,7 @@ static void nfs4_locku_prepare(struct rpc_task *task, void *data)return ; } calldata->timestamp = jiffies; -if (nfs4_setup_sequence (calldata->server, +if (nfs4_setup_sequence (calldata->server,NULL , &calldata->arg.seq_args, &calldata->res.seq_res,1 , task))return ;
@@ -4116,7 +4119,7 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata) }else data->arg.new_lock_owner =0 ; data->timestamp = jiffies; -if (nfs4_setup_sequence (data->server, +if (nfs4_setup_sequence (data->server,NULL , &data->arg.seq_args, &data->res.seq_res,1 , task))return ;
@@ -5374,7 +5377,7 @@ nfs4_pnfs_layoutget_prepare(struct rpc_task *task, void *calldata)struct nfs_server *server =NFS_SERVER (ino);dprintk ("--> %s\n" , __func__); -if (nfs4_setup_sequence (server, &lgp->args.seq_args, +if (nfs4_setup_sequence (server,NULL , &lgp->args.seq_args, &lgp->res.seq_res,0 , task))return ;rpc_call_start (task);
@@ -5486,7 +5489,7 @@ static void pnfs_layoutcommit_prepare(struct rpc_task *task, void *data) (struct pnfs_layoutcommit_data *)data;struct nfs_server *server =NFS_SERVER (ldata->args.inode); -if (nfs4_setup_sequence (server, &ldata->args.seq_args, +if (nfs4_setup_sequence (server,NULL , &ldata->args.seq_args, &ldata->res.seq_res,1 , task))return ;rpc_call_start (task);
@@ -5595,7 +5598,7 @@ nfs4_pnfs_layoutreturn_prepare(struct rpc_task *task, void *calldata)struct nfs_server *server =NFS_SERVER (ino);dprintk ("--> %s\n" , __func__); -if (nfs4_setup_sequence (server, &lrp->args.seq_args, +if (nfs4_setup_sequence (server,NULL , &lrp->args.seq_args, &lrp->res.seq_res,0 , task))return ;rpc_call_start (task);
fs/nfs/read.c +1 -1
@@ -411,7 +411,7 @@ void nfs_read_prepare(struct rpc_task *task, void *calldata) {struct nfs_read_data *data = calldata; -if (nfs4_setup_sequence (NFS_SERVER (data->inode), +if (nfs4_setup_sequence (NFS_SERVER (data->inode),NULL , &data->args.seq_args, &data->res.seq_res,0 , task))return ;
fs/nfs/unlink.c +1 -1
@@ -110,7 +110,7 @@ void nfs_unlink_prepare(struct rpc_task *task, void *calldata)struct nfs_unlinkdata *data = calldata;struct nfs_server *server =NFS_SERVER (data->dir); -if (nfs4_setup_sequence (server, &data->args.seq_args, +if (nfs4_setup_sequence (server,NULL , &data->args.seq_args, &data->res.seq_res,1 , task))return ;rpc_call_start (task);
fs/nfs/write.c +1 -1
@@ -1052,7 +1052,7 @@ void nfs_write_prepare(struct rpc_task *task, void *calldata) {struct nfs_write_data *data = calldata; -if (nfs4_setup_sequence (NFS_SERVER (data->inode), +if (nfs4_setup_sequence (NFS_SERVER (data->inode),NULL , &data->args.seq_args, &data->res.seq_res,1 , task))return ;
Signature · 1 line
1.6.2.5
PATCH 30/50 pnfs_submit: update nfs4_async_handle_error for data server
From: The pNFS Team <[email protected]>
--- fs/nfs/nfs4proc.c | 39 ++++++++++++++++++++++----------------- include/linux/nfs4.h | 7 +++++++ include/linux/nfs_fs_sb.h | 10 ++++++++++ 3 files changed, 39 insertions(+), 17 deletions(-)
fs/nfs/nfs4proc.c +22 -17
@@ -70,7 +70,7 @@ struct nfs4_opendata;static int _nfs4_proc_open (struct nfs4_opendata *data);static int _nfs4_recover_proc_open (struct nfs4_opendata *data);static int nfs4_do_fsinfo (struct nfs_server *,struct nfs_fh *,struct nfs_fsinfo *); -static int nfs4_async_handle_error (struct rpc_task *,const struct nfs_server *,struct nfs4_state *); +static int nfs4_async_handle_error (struct rpc_task *,const struct nfs_server *,struct nfs4_state *,struct nfs_client *);static int _nfs4_proc_lookup (struct inode *dir,const struct qstr *name,struct nfs_fh *fhandle,struct nfs_fattr *fattr);static int _nfs4_proc_getattr (struct nfs_server *server,struct nfs_fh *fhandle,struct nfs_fattr *fattr); static int nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred,
@@ -1896,7 +1896,7 @@ static void nfs4_close_done(struct rpc_task *task, void *data)if (calldata->arg.fmode ==0 )break ;default : -if (nfs4_async_handle_error (task, server, state) == -EAGAIN ) +if (nfs4_async_handle_error (task, server, state,NULL ) == -EAGAIN )rpc_restart_call_prepare (task); }nfs_release_seqid (calldata->arg.seqid);
@@ -2688,7 +2688,7 @@ static int nfs4_proc_unlink_done(struct rpc_task *task, struct inode *dir)if (!nfs4_sequence_done (task, &res->seq_res))return 0 ; -if (nfs4_async_handle_error (task, res->server,NULL ) == -EAGAIN ) +if (nfs4_async_handle_error (task, res->server,NULL ,NULL ) == -EAGAIN )return 0 ;update_changeattr (dir, &res->cinfo);nfs_post_op_update_inode (dir, res->dir_attr);
@@ -3135,7 +3135,7 @@ static int nfs4_read_done(struct rpc_task *task, struct nfs_read_data *data)if (!nfs4_sequence_done (task, &data->res.seq_res))return -EAGAIN ; -if (nfs4_async_handle_error (task, server, data->args.context->state) == -EAGAIN ) { +if (nfs4_async_handle_error (task, server, data->args.context->state,NULL ) == -EAGAIN ) {nfs_restart_rpc (task, server->nfs_client);return -EAGAIN ; }
@@ -3159,7 +3159,7 @@ static int nfs4_write_done(struct rpc_task *task, struct nfs_write_data *data)if (!nfs4_sequence_done (task, &data->res.seq_res))return -EAGAIN ; -if (nfs4_async_handle_error (task,NFS_SERVER (inode), data->args.context->state) == -EAGAIN ) { +if (nfs4_async_handle_error (task,NFS_SERVER (inode), data->args.context->state,NULL ) == -EAGAIN ) {nfs_restart_rpc (task,NFS_SERVER (inode)->nfs_client);return -EAGAIN ; }
@@ -3188,7 +3188,7 @@ static int nfs4_commit_done(struct rpc_task *task, struct nfs_write_data *data)if (!nfs4_sequence_done (task, &data->res.seq_res))return -EAGAIN ; -if (nfs4_async_handle_error (task,NFS_SERVER (inode),NULL ) == -EAGAIN ) { +if (nfs4_async_handle_error (task,NFS_SERVER (inode),NULL ,NULL ) == -EAGAIN ) {nfs_restart_rpc (task,NFS_SERVER (inode)->nfs_client);return -EAGAIN ; }
@@ -3505,9 +3505,10 @@ static int nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t buflen }static int -nfs4_async_handle_error (struct rpc_task *task,const struct nfs_server *server,struct nfs4_state *state) +nfs4_async_handle_error (struct rpc_task *task,const struct nfs_server *server,struct nfs4_state *state,struct nfs_client *clp) { -struct nfs_client *clp = server->nfs_client; +if (!clp) + clp = server->nfs_client;if (task->tk_status >=0 )return 0 ;
@@ -3534,14 +3535,16 @@ nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server,case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION :case -NFS4ERR_SEQ_FALSE_RETRY :case -NFS4ERR_SEQ_MISORDERED : -dprintk ("%s ERROR %d, Reset session\n" , __func__, - task->tk_status); +dprintk ("%s ERROR %d, Reset session. Exchangeid " +"flags 0x%x\n" , __func__, task->tk_status, + clp->cl_exchange_flags);nfs4_schedule_state_recovery (clp); task->tk_status =0 ;return -EAGAIN ;#endif /* CONFIG_NFS_V4_1 */ case -NFS4ERR_DELAY : -nfs_inc_server_stats (server,NFSIOS_DELAY ); +if (server) +nfs_inc_server_stats (server,NFSIOS_DELAY );case -NFS4ERR_GRACE :case -EKEYEXPIRED :rpc_delay (task,NFS4_POLL_RETRY_MAX );
@@ -3554,6 +3557,8 @@ nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server, task->tk_status =nfs4_map_errors (task->tk_status);return 0 ; do_state_recovery: +if (is_ds_only_client (clp)) +return 0 ;rpc_sleep_on (&clp->cl_rpcwaitq, task,NULL );nfs4_schedule_state_recovery (clp);if (test_bit (NFS4CLNT_MANAGER_RUNNING , &clp->cl_state) ==0 )
@@ -3687,8 +3692,8 @@ static void nfs4_delegreturn_done(struct rpc_task *task, void *calldata)renew_lease (data->res.server, data->timestamp);break ;default : -if (nfs4_async_handle_error (task, data->res.server,NULL ) == - -EAGAIN ) { +if (nfs4_async_handle_error (task, data->res.server,NULL ,NULL ) + == -EAGAIN ) {nfs_restart_rpc (task, data->res.server->nfs_client);return ; }
@@ -3946,7 +3951,7 @@ static void nfs4_locku_done(struct rpc_task *task, void *data)case -NFS4ERR_EXPIRED :break ;default : -if (nfs4_async_handle_error (task, calldata->server,NULL ) == -EAGAIN ) +if (nfs4_async_handle_error (task, calldata->server,NULL ,NULL ) == -EAGAIN )nfs_restart_rpc (task, calldata->server->nfs_client); }
@@ -5399,7 +5404,7 @@ static void nfs4_pnfs_layoutget_done(struct rpc_task *task, void *calldata)pnfs_get_layout_done (lgp, task->tk_status); -if (nfs4_async_handle_error (task, server,NULL ) == -EAGAIN ) +if (nfs4_async_handle_error (task, server,NULL ,NULL ) == -EAGAIN )nfs_restart_rpc (task, server->nfs_client); lgp->status = task->tk_status;
@@ -5508,7 +5513,7 @@ pnfs_layoutcommit_done(struct rpc_task *task, void *calldata)if (RPC_ASSASSINATED (task))return ; -if (nfs4_async_handle_error (task, server,NULL ) == -EAGAIN ) +if (nfs4_async_handle_error (task, server,NULL ,NULL ) == -EAGAIN )nfs_restart_rpc (task, server->nfs_client); data->status = task->tk_status;
@@ -5618,7 +5623,7 @@ static void nfs4_pnfs_layoutreturn_done(struct rpc_task *task, void *calldata)if (RPC_ASSASSINATED (task))return ; -if (nfs4_async_handle_error (task, server,NULL ) == -EAGAIN ) +if (nfs4_async_handle_error (task, server,NULL ,NULL ) == -EAGAIN )nfs_restart_rpc (task, server->nfs_client);dprintk ("<-- %s\n" , __func__);
include/linux/nfs4.h +7 -0
@@ -121,6 +121,13 @@#define EXCHGID4_FLAG_MASK_A 0x40070003#define EXCHGID4_FLAG_MASK_R 0x80070003 +static inline bool +is_ds_only_session (u32 exchange_flags) +{ +u32 mask =EXCHGID4_FLAG_USE_PNFS_DS |EXCHGID4_FLAG_USE_PNFS_MDS ; +return (exchange_flags & mask) ==EXCHGID4_FLAG_USE_PNFS_DS ; +} +#define SEQ4_STATUS_CB_PATH_DOWN 0x00000001#define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING 0x00000002#define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED 0x00000004
include/linux/nfs_fs_sb.h +10 -0
@@ -91,6 +91,16 @@ struct nfs_client {#endif }; +static inline bool +is_ds_only_client (struct nfs_client *clp) +{ +#ifdef CONFIG_NFS_V4_1 +return is_ds_only_session (clp->cl_exchange_flags); +#else +return false; +#endif +} +/* * NFS client parameters stored in the superblock. */
Signature · 1 line
1.6.2.5
PATCH 31/50 pnfs_submit: update state renewal for data servers
From: The pNFS Team <[email protected]>
--- fs/nfs/nfs4renewd.c | 2 +- fs/nfs/nfs4state.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletions(-)
fs/nfs/nfs4renewd.c +1 -1
@@ -64,7 +64,7 @@ nfs4_renew_state(struct work_struct *work) ops = clp->cl_mvops->state_renewal_ops;dprintk ("%s: start\n" , __func__);/* Are there any active superblocks? */ -if (list_empty (&clp->cl_superblocks)) +if (list_empty (&clp->cl_superblocks) && !is_ds_only_client (clp)) goto out;spin_lock (&clp->cl_lock); lease = clp->cl_lease_time;
fs/nfs/nfs4state.c +5 -0
@@ -129,6 +129,11 @@ static int nfs41_setup_state_renewal(struct nfs_client *clp)int status;struct nfs_fsinfo fsinfo; +if (is_ds_only_client (clp)) { +nfs4_schedule_state_renewal (clp); +return 0 ; + } + status =nfs4_proc_get_lease_time (clp, &fsinfo);if (status ==0 ) {/* Update lease time and schedule renewal */
Signature · 1 line
1.6.2.5
PATCH 32/50 pnfs_submit-pageio-helpers.patch
From: Andy Adamson <[email protected]>
--- fs/nfs/pagelist.c | 11 +++++- fs/nfs/pnfs.c | 82 +++++++++++++++++++++++++++++++++++++++++++++ fs/nfs/pnfs.h | 3 ++ fs/nfs/read.c | 4 ++ fs/nfs/write.c | 4 ++ include/linux/nfs4_pnfs.h | 6 +++ include/linux/nfs_page.h | 7 ++++ 7 files changed, 115 insertions(+), 2 deletions(-)
fs/nfs/pagelist.c +9 -2
@@ -237,7 +237,8 @@ void nfs_pageio_init(struct nfs_pageio_descriptor *desc,* Return 'true' if this is the case, else return 'false'. */ static int nfs_can_coalesce_requests (struct nfs_page *prev, -struct nfs_page *req) +struct nfs_page *req, +struct nfs_pageio_descriptor *pgio) {if (req->wb_context->cred != prev->wb_context->cred)return 0 ;
@@ -251,6 +252,12 @@ static int nfs_can_coalesce_requests(struct nfs_page *prev,return 0 ;if (prev->wb_pgbase + prev->wb_bytes !=PAGE_CACHE_SIZE )return 0 ; +if (req->wb_lseg != prev->wb_lseg) +return 0 ; +#ifdef CONFIG_NFS_V4_1 +if (pgio->pg_test && !pgio->pg_test (pgio, prev, req)) +return 0 ; +#endif /* CONFIG_NFS_V4_1 */ return 1 ; }
@@ -283,7 +290,7 @@ static int nfs_pageio_do_add_request(struct nfs_pageio_descriptor *desc,if (newlen > desc->pg_bsize)return 0 ; prev =nfs_list_entry (desc->pg_list.prev); -if (!nfs_can_coalesce_requests (prev, req)) +if (!nfs_can_coalesce_requests (prev, req, desc))return 0 ; }else desc->pg_base = req->wb_pgbase;
fs/nfs/pnfs.c +82 -0
88 lines not on this page · raw message
fs/nfs/pnfs.h +3 -0
@@ -46,6 +46,9 @@ void pnfs_layoutcommit_free(struct pnfs_layoutcommit_data *data);int pnfs_layoutcommit_inode (struct inode *inode,int sync);void pnfs_update_last_write (struct nfs_inode *nfsi,loff_t offset,size_t extent);void pnfs_need_layoutcommit (struct nfs_inode *nfsi,struct nfs_open_context *ctx); +void pnfs_pageio_init_read (struct nfs_pageio_descriptor *,struct inode *, +struct nfs_open_context *,struct list_head *); +void pnfs_pageio_init_write (struct nfs_pageio_descriptor *,struct inode *);void pnfs_get_layout_done (struct nfs4_pnfs_layoutget *,int rpc_status);int pnfs_layout_process (struct nfs4_pnfs_layoutget *lgp);void pnfs_layout_release (struct pnfs_layout_type *,struct nfs4_pnfs_layout_segment *range);
fs/nfs/read.c +4 -0
@@ -20,6 +20,7 @@#include <linux/nfs_page.h> #include <asm/system.h> +#include "pnfs.h" #include "nfs4_fs.h" #include "internal.h"
@@ -625,6 +626,9 @@ int nfs_readpages(struct file *filp, struct address_space *mapping,if (ret ==0 ) goto read_complete;/* all pages were read */ +#ifdef CONFIG_NFS_V4_1 +pnfs_pageio_init_read (&pgio, inode, desc.ctx, pages); +#endif /* CONFIG_NFS_V4_1 */ if (rsize <PAGE_CACHE_SIZE )nfs_pageio_init (&pgio, inode, nfs_pagein_multi, rsize,0 );else
fs/nfs/write.c +4 -0
@@ -986,6 +986,10 @@ static void nfs_pageio_init_write(struct nfs_pageio_descriptor *pgio, {size_t wsize =NFS_SERVER (inode)->wsize; +#ifdef CONFIG_NFS_V4_1 +pnfs_pageio_init_write (pgio, inode); +#endif /* CONFIG_NFS_V4_1 */ +if (wsize <PAGE_CACHE_SIZE )nfs_pageio_init (pgio, inode, nfs_flush_multi, wsize, ioflags);else
include/linux/nfs4_pnfs.h +6 -0
@@ -13,6 +13,7 @@#define LINUX_NFS4_PNFS_H #include <linux/pnfs_xdr.h> +#include <linux/nfs_page.h> /* Per-layout driver specific registration structure */ struct pnfs_layoutdriver_type {
@@ -118,6 +119,11 @@ struct layoutdriver_io_operations { };struct layoutdriver_policy_operations { +/* The stripe size of the file system */ +ssize_t (*get_stripesize) (struct pnfs_layout_type *layoutid); + +/* test for nfs page cache coalescing */ +int (*pg_test)(struct nfs_pageio_descriptor *,struct nfs_page *,struct nfs_page *); };struct pnfs_device {
include/linux/nfs_page.h +7 -0
@@ -48,6 +48,7 @@ struct nfs_page {struct kref wb_kref;/* reference count */ unsigned long wb_flags;struct nfs_writeverf wb_verf;/* Commit cookie */ +struct pnfs_layout_segment *wb_lseg;/* Pnfs layout info */ };struct nfs_pageio_descriptor {
@@ -61,6 +62,12 @@ struct nfs_pageio_descriptor {int (*pg_doio)(struct inode *,struct list_head *,unsigned int ,size_t ,int );int pg_ioflags;int pg_error; +struct pnfs_layout_segment *pg_lseg; +#ifdef CONFIG_NFS_V4_1 +int pg_iswrite; +int pg_boundary; +int (*pg_test)(struct nfs_pageio_descriptor *,struct nfs_page *,struct nfs_page *); +#endif /* CONFIG_NFS_V4_1 */ };#define NFS_WBACK_BUSY (req) (test_bit(PG_BUSY,&(req)->wb_flags))
Signature · 1 line
1.6.2.5
PATCH 33/50 pnfs_submit: associate layout segmennt with nfs_page
From: Andy Adamson <[email protected]>
--- fs/nfs/file.c | 32 +++++++++++++++++++++++++------- fs/nfs/pagelist.c | 12 ++++++++++-- fs/nfs/pnfs.c | 10 ++++++++++ fs/nfs/read.c | 8 ++++++-- fs/nfs/write.c | 42 ++++++++++++++++++++++++++++++------------ include/linux/nfs_fs.h | 8 ++++++-- include/linux/nfs_page.h | 3 ++- 7 files changed, 89 insertions(+), 26 deletions(-)
fs/nfs/file.c +25 -7
@@ -36,6 +36,7 @@#include "internal.h" #include "iostat.h" #include "fscache.h" +#include "pnfs.h" #define NFSDBG_FACILITY NFSDBG_FILE
@@ -389,12 +390,17 @@ static int nfs_write_begin(struct file *file, struct address_space *mapping,pgoff_t index = pos >>PAGE_CACHE_SHIFT ;struct page *page;int once_thru =0 ; +struct pnfs_layout_segment *lseg;dfprintk (PAGECACHE ,"NFS: write_begin(%s/%s(%ld), %u@%lld)\n" , file->f_path.dentry->d_parent->d_name.name, file->f_path.dentry->d_name.name, mapping->host->i_ino, len, (long long ) pos); +pnfs_update_layout (mapping->host, +nfs_file_open_context (file), +IOMODE_RW , + &lseg); start:/* * Prevent starvation issues if someone is doing a consistency
@@ -403,14 +409,16 @@ start: ret =wait_on_bit (&NFS_I (mapping->host)->flags,NFS_INO_FLUSHING , nfs_wait_bit_killable,TASK_KILLABLE );if (ret) -return ret; + goto out; page =grab_cache_page_write_begin (mapping, index, flags); -if (!page) -return -ENOMEM ; +if (!page) { + ret = -ENOMEM ; + goto out; + } *pagep = page; - ret =nfs_flush_incompatible (file, page); + ret =nfs_flush_incompatible (file, page, lseg);if (ret) {unlock_page (page);page_cache_release (page);
@@ -422,6 +430,12 @@ start:if (!ret) goto start; } + *fsdata = lseg; + out: +if (ret) { +put_lseg (lseg); + *fsdata =NULL ; + }return ret; }
@@ -431,6 +445,7 @@ static int nfs_write_end(struct file *file, struct address_space *mapping, {unsigned offset = pos & (PAGE_CACHE_SIZE -1 );int status; +struct pnfs_layout_segment *lseg = fsdata; dfprintk(PAGECACHE, "NFS: write_end(%s/%s(%ld), %u@%lld)\n", file->f_path.dentry->d_parent->d_name.name,
@@ -457,10 +472,11 @@ static int nfs_write_end(struct file *file, struct address_space *mapping,zero_user_segment (page, pglen,PAGE_CACHE_SIZE ); } - status =nfs_updatepage (file, page, offset, copied); + status =nfs_updatepage (file, page, offset, copied, lseg);unlock_page (page);page_cache_release (page); +put_lseg (lseg);if (status <0 )return status;
@@ -571,6 +587,8 @@ static int nfs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)/* make sure the cache has finished storing the page */ nfs_fscache_wait_on_page_write (NFS_I (dentry->d_inode), page); +/* XXX Do we want to call pnfs_update_layout here? */ +lock_page (page); mapping = page->mapping;if (mapping != dentry->d_inode->i_mapping)
@@ -581,11 +599,11 @@ static int nfs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)if (pagelen ==0 ) goto out_unlock; - ret =nfs_flush_incompatible (filp, page); + ret =nfs_flush_incompatible (filp, page,NULL );if (ret !=0 ) goto out_unlock; - ret =nfs_updatepage (filp, page,0 , pagelen); + ret =nfs_updatepage (filp, page,0 , pagelen,NULL ); out_unlock:if (!ret)return VM_FAULT_LOCKED ;
fs/nfs/pagelist.c +10 -2
@@ -20,6 +20,7 @@#include <linux/nfs_mount.h> #include "internal.h" +#include "pnfs.h" static struct kmem_cache *nfs_page_cachep;
@@ -56,7 +57,8 @@ nfs_page_free(struct nfs_page *p)struct nfs_page *nfs_create_request (struct nfs_open_context *ctx,struct inode *inode,struct page *page, -unsigned int offset,unsigned int count) +unsigned int offset,unsigned int count, +struct pnfs_layout_segment *lseg) {struct nfs_page *req;
@@ -81,6 +83,9 @@ nfs_create_request(struct nfs_open_context *ctx, struct inode *inode, req->wb_context =get_nfs_open_context (ctx); req->wb_lock_context =nfs_get_lock_context (ctx);kref_init (&req->wb_kref); + req->wb_lseg = lseg; +if (lseg) +get_lseg (lseg);return req; }
@@ -156,9 +161,12 @@ void nfs_clear_request(struct nfs_page *req)put_nfs_open_context (ctx); req->wb_context =NULL ; } +if (req->wb_lseg !=NULL ) { +put_lseg (req->wb_lseg); + req->wb_lseg =NULL ; + } } -/** * nfs_release_request - Release the count on an NFS read/write request * @req: request to release
fs/nfs/pnfs.c +10 -0
@@ -1234,6 +1234,16 @@ pnfs_pageio_init_write(struct nfs_pageio_descriptor *pgio, struct inode *inode)pnfs_set_pg_test (inode, pgio); } +static void _pnfs_clear_lseg_from_pages (struct list_head *head) +{ +struct nfs_page *req; + +list_for_each_entry (req, head, wb_list) { +put_lseg (req->wb_lseg); + req->wb_lseg =NULL ; + } +} +/* * Set up the argument/result storage required for the RPC call. */
fs/nfs/read.c +6 -2
@@ -118,11 +118,14 @@ int nfs_readpage_async(struct nfs_open_context *ctx, struct inode *inode,LIST_HEAD (one_request);struct nfs_page *new;unsigned int len; +struct pnfs_layout_segment *lseg; len =nfs_page_length (page);if (len ==0 )return nfs_return_empty_page (page); - new =nfs_create_request (ctx, inode, page,0 , len); +pnfs_update_layout (inode, ctx,IOMODE_READ , &lseg); + new =nfs_create_request (ctx, inode, page,0 , len, lseg); +put_lseg (lseg);if (IS_ERR (new)) {unlock_page (page);return PTR_ERR (new);
@@ -570,7 +573,8 @@ readpage_async_filler(void *data, struct page *page)if (len ==0 )return nfs_return_empty_page (page); - new =nfs_create_request (desc->ctx, inode, page,0 , len); + new =nfs_create_request (desc->ctx, inode, page,0 , len, + desc->pgio->pg_lseg);if (IS_ERR (new)) goto out_error;
fs/nfs/write.c +30 -12
112 lines not on this page · raw message
include/linux/nfs_fs.h +6 -2
@@ -517,8 +517,12 @@ extern void nfs_unblock_sillyrename(struct dentry *dentry);extern int nfs_congestion_kb;extern int nfs_writepage (struct page *page,struct writeback_control *wbc);extern int nfs_writepages (struct address_space *,struct writeback_control *); -extern int nfs_flush_incompatible (struct file *file,struct page *page); -extern int nfs_updatepage (struct file *,struct page *,unsigned int ,unsigned int ); +struct pnfs_layout_segment ; +extern int nfs_flush_incompatible (struct file *file,struct page *page, +struct pnfs_layout_segment *lseg); +extern int nfs_updatepage (struct file *,struct page *, +unsigned int offset,unsigned int count, +struct pnfs_layout_segment *lseg);extern int nfs_writeback_done (struct rpc_task *,struct nfs_write_data *);/*
include/linux/nfs_page.h +2 -1
@@ -76,7 +76,8 @@ extern struct nfs_page *nfs_create_request(struct nfs_open_context *ctx,struct inode *inode, struct page *page, unsigned int offset, - unsigned int count); + unsigned int count, + struct pnfs_layout_segment *lseg);extern void nfs_clear_request (struct nfs_page *req);extern void nfs_release_request (struct nfs_page *req);
Signature · 1 line
1.6.2.5
PATCH 34/50 pnfs_submit: filelayout policy operations
From: The pNFS Team <[email protected]>
--- fs/nfs/nfs4filelayout.c | 35 +++++++++++++++++++++++++++++++++++ 1 files changed, 35 insertions(+), 0 deletions(-)
fs/nfs/nfs4filelayout.c +35 -0
@@ -303,6 +303,39 @@ filelayout_free_lseg(struct pnfs_layout_segment *lseg) nfs4_fl_free_deviceid_callback);_filelayout_free_lseg (lseg); } + +/* Return the stripesize for the specified file */ +ssize_t +filelayout_get_stripesize (struct pnfs_layout_type *layoutid) +{ +struct nfs4_filelayout *flo =FILE_LO (layoutid); + +return flo->stripe_unit; +} + +/* +* filelayout_pg_test(). Called by nfs_can_coalesce_requests() +* +* return 1 : coalesce page +* return 0 : don't coalesce page +*/ +int +filelayout_pg_test (struct nfs_pageio_descriptor *pgio,struct nfs_page *prev, +struct nfs_page *req) +{ +u64 p_stripe, r_stripe; + +if (pgio->pg_boundary ==0 ) +return 1 ; + p_stripe = (u64 )prev->wb_index <<PAGE_CACHE_SHIFT ; + r_stripe = (u64 )req->wb_index <<PAGE_CACHE_SHIFT ; + +do_div (p_stripe, pgio->pg_boundary); +do_div (r_stripe, pgio->pg_boundary); + +return (p_stripe == r_stripe); +} +struct layoutdriver_io_operations filelayout_io_operations = { .alloc_layout = filelayout_alloc_layout, .free_layout = filelayout_free_layout,
@@ -313,6 +346,8 @@ struct layoutdriver_io_operations filelayout_io_operations = { };struct layoutdriver_policy_operations filelayout_policy_operations = { + .get_stripesize = filelayout_get_stripesize, + .pg_test = filelayout_pg_test, };struct pnfs_layoutdriver_type filelayout_type = {
Signature · 1 line
1.6.2.5
PATCH 35/50 pnfs_submit: filelayout i/o helpers
From: The pNFS Team <[email protected]>
--- fs/nfs/client.c | 7 +- fs/nfs/internal.h | 12 +++ fs/nfs/nfs4filelayout.c | 42 ++++++++++- fs/nfs/nfs4filelayout.h | 10 +++ fs/nfs/nfs4filelayoutdev.c | 180 ++++++++++++++++++++++++++++++++++++++++++++ fs/nfs/nfs4proc.c | 8 +- 6 files changed, 252 insertions(+), 7 deletions(-)
fs/nfs/client.c +5 -2
@@ -348,7 +348,7 @@ static int nfs_sockaddr_match_ipaddr(const struct sockaddr *sa1,* Test if two socket addresses represent the same actual socket, * by comparing (only) relevant fields, including the port number. */ -static int nfs_sockaddr_cmp (const struct sockaddr *sa1, +int nfs_sockaddr_cmp (const struct sockaddr *sa1,const struct sockaddr *sa2) {if (sa1->sa_family != sa2->sa_family)
@@ -362,6 +362,7 @@ static int nfs_sockaddr_cmp(const struct sockaddr *sa1, }return 0 ; } +EXPORT_SYMBOL (nfs_sockaddr_cmp);/* * Find a client by IP address and protocol version
@@ -553,6 +554,7 @@ int nfs4_check_client_ready(struct nfs_client *clp)return -EPROTONOSUPPORT ;return 0 ; } +EXPORT_SYMBOL (nfs4_check_client_ready);/* * Initialise the timeout values for a connection
@@ -1250,7 +1252,7 @@ error:/* * Set up an NFS4 client */ -static int nfs4_set_client(struct nfs_server *server, +int nfs4_set_client(struct nfs_server *server, const char *hostname, const struct sockaddr *addr, const size_t addrlen,
@@ -1293,6 +1295,7 @@ error:dprintk ("<-- nfs4_set_client() = xerror %d\n" , error);return error; } +EXPORT_SYMBOL (nfs4_set_client);/*
fs/nfs/internal.h +12 -0
@@ -139,6 +139,16 @@ extern struct nfs_server *nfs_clone_server(struct nfs_server *, struct nfs_fattr *);extern void nfs_mark_client_ready (struct nfs_client *clp,int state);extern int nfs4_check_client_ready (struct nfs_client *clp); +extern int nfs_sockaddr_cmp (const struct sockaddr *sa1, +const struct sockaddr *sa2); +extern int nfs4_set_client (struct nfs_server *server, +const char *hostname, +const struct sockaddr *addr, +const size_t addrlen, +const char *ip_addr, +rpc_authflavor_t authflavour, +int proto,const struct rpc_timeout *timeparms, +u32 minorversion);#ifdef CONFIG_PROC_FS extern int __init nfs_fs_proc_init (void );extern void nfs_fs_proc_exit (void );
@@ -201,6 +211,8 @@ extern const u32 nfs41_maxwrite_overhead;extern struct rpc_procinfo nfs4_procedures[];#endif +extern int nfs4_recover_expired_lease (struct nfs_client *clp); +/* proc.c */ void nfs_close_context (struct nfs_open_context *ctx,int is_sync);
fs/nfs/nfs4filelayout.c +41 -1
56 lines not on this page · raw message
fs/nfs/nfs4filelayout.h +10 -0
@@ -23,6 +23,10 @@#define NFS4_PNFS_MAX_STRIPE_CNT 4096#define NFS4_PNFS_MAX_MULTI_CNT 64/* 256 fit into a u8 stripe_index */ +#define FILE_DSADDR (lseg) (container_of(lseg->deviceid, \ + struct nfs4_file_layout_dsaddr, \ + deviceid)) +enum stripetype4 {STRIPE_SPARSE =1 ,STRIPE_DENSE =2
@@ -62,6 +66,9 @@ struct nfs4_filelayout {u32 stripe_unit; }; +extern struct nfs_fh * +nfs4_fl_select_ds_fh (struct pnfs_layout_segment *lseg,loff_t offset); +static inline struct nfs4_filelayout *FILE_LO (struct pnfs_layout_type *lo) {
@@ -73,6 +80,9 @@ extern struct pnfs_client_operations *pnfs_callback_ops;extern void nfs4_fl_free_deviceid_callback (struct kref *);extern void print_ds (struct nfs4_pnfs_ds *ds);char *deviceid_fmt (const struct pnfs_deviceid *dev_id); +u32 nfs4_fl_calc_ds_index (struct pnfs_layout_segment *lseg,loff_t offset); +struct nfs4_pnfs_ds *nfs4_fl_prepare_ds (struct pnfs_layout_segment *lseg, +u32 ds_idx);extern struct nfs4_file_layout_dsaddr *nfs4_pnfs_device_item_find (struct nfs_client *,struct pnfs_deviceid *dev_id); struct nfs4_file_layout_dsaddr *
fs/nfs/nfs4filelayoutdev.c +180 -0
189 lines not on this page · raw message
fs/nfs/nfs4proc.c +4 -4
@@ -1576,9 +1576,8 @@ static int _nfs4_proc_open(struct nfs4_opendata *data)return 0 ; } -static int nfs4_recover_expired_lease (struct nfs_server *server) +int nfs4_recover_expired_lease (struct nfs_client *clp) { -struct nfs_client *clp = server->nfs_client;unsigned int loop;int ret;
@@ -1594,6 +1593,7 @@ static int nfs4_recover_expired_lease(struct nfs_server *server) }return ret; } +EXPORT_SYMBOL (nfs4_recover_expired_lease);/* * OPEN_EXPIRED:
@@ -1683,7 +1683,7 @@ static int _nfs4_do_open(struct inode *dir, struct path *path, fmode_t fmode, indprintk ("nfs4_do_open: nfs4_get_state_owner failed!\n" ); goto out_err; } - status =nfs4_recover_expired_lease (server); + status =nfs4_recover_expired_lease (server->nfs_client);if (status !=0 ) goto err_put_state_owner;if (path->dentry->d_inode !=NULL )
@@ -5121,7 +5121,7 @@ int nfs4_init_session(struct nfs_server *server) session->fc_attrs.max_rqst_sz = wsize + nfs41_maxwrite_overhead; session->fc_attrs.max_resp_sz = rsize + nfs41_maxread_overhead; - ret =nfs4_recover_expired_lease (server); + ret =nfs4_recover_expired_lease (server->nfs_client);if (!ret) ret =nfs4_check_client_ready (clp);return ret;
Signature · 1 line
1.6.2.5
PATCH 36/50 pnfs_submit: generic read
From: The pNFS Team <[email protected]>
--- fs/nfs/internal.h | 4 ++ fs/nfs/nfs4proc.c | 15 ++++++- fs/nfs/pnfs.c | 35 +++++++++++++++++ fs/nfs/pnfs.h | 16 ++++++++ fs/nfs/read.c | 90 ++++++++++++++++++++++++++++++------------- include/linux/nfs4_pnfs.h | 17 ++++++++ include/linux/nfs_iostat.h | 1 + include/linux/nfs_xdr.h | 21 ++++++++++ 8 files changed, 169 insertions(+), 30 deletions(-)
fs/nfs/internal.h +4 -0
@@ -261,6 +261,10 @@ extern int nfs4_get_rootfh(struct nfs_server *server, struct nfs_fh *mntfh);#endif /* read.c */ +extern int nfs_initiate_read (struct nfs_read_data *data,struct rpc_clnt *clnt, +const struct rpc_call_ops *call_ops); +extern int pnfs_initiate_read (struct nfs_read_data *data,struct rpc_clnt *clnt, +const struct rpc_call_ops *call_ops);extern void nfs_read_prepare (struct rpc_task *task,void *calldata);/* write.c */
fs/nfs/nfs4proc.c +12 -3
@@ -3129,19 +3129,28 @@ static int nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle,static int nfs4_read_done (struct rpc_task *task,struct nfs_read_data *data) {struct nfs_server *server =NFS_SERVER (data->inode); +struct nfs_client *client = server->nfs_client;dprintk ("--> %s\n" , __func__); +#ifdef CONFIG_NFS_V4_1 +/* Is this a DS session */ +if (data->fldata.ds_nfs_client) { +dprintk ("%s DS read\n" , __func__); + client = data->fldata.ds_nfs_client; + } +#endif /* CONFIG_NFS_V4_1 */ +if (!nfs4_sequence_done (task, &data->res.seq_res))return -EAGAIN ; -if (nfs4_async_handle_error (task, server, data->args.context->state,NULL ) == -EAGAIN ) { -nfs_restart_rpc (task, server->nfs_client); +if (nfs4_async_handle_error (task, server, data->args.context->state, client) == -EAGAIN ) { +nfs_restart_rpc (task, client);return -EAGAIN ; }nfs_invalidate_atime (data->inode); -if (task->tk_status >0 ) +if (task->tk_status >0 && client == server->nfs_client)renew_lease (server, data->timestamp);return 0 ; }
fs/nfs/pnfs.c +35 -0
@@ -1245,6 +1245,41 @@ static void _pnfs_clear_lseg_from_pages(struct list_head *head) }/* +* Call the appropriate parallel I/O subsystem read function. +* If no I/O device driver exists, or one does match the returned +* fstype, then return a positive status for regular NFS processing. +*/ +enum pnfs_try_status +pnfs_try_to_read_data (struct nfs_read_data *rdata, +const struct rpc_call_ops *call_ops) +{ +struct inode *inode = rdata->inode; +struct nfs_server *nfss =NFS_SERVER (inode); +struct pnfs_layout_segment *lseg = rdata->req->wb_lseg; +enum pnfs_try_status trypnfs; + + rdata->pdata.call_ops = call_ops; + +dprintk ("%s: Reading ino:%lu %u@%llu\n" , + __func__, inode->i_ino, rdata->args.count, rdata->args.offset); + +get_lseg (lseg); + + rdata->pdata.lseg = lseg; + trypnfs = nfss->pnfs_curr_ld->ld_io_ops->read_pagelist (rdata, +nfs_page_array_len (rdata->args.pgbase, rdata->args.count)); +if (trypnfs ==PNFS_NOT_ATTEMPTED ) { + rdata->pdata.lseg =NULL ; +put_lseg (lseg); +_pnfs_clear_lseg_from_pages (&rdata->pages); + }else { +nfs_inc_stats (inode,NFSIOS_PNFS_READ ); + } +dprintk ("%s End (trypnfs:%d)\n" , __func__, trypnfs); +return trypnfs; +} + +/* * Set up the argument/result storage required for the RPC call. */ static int
fs/nfs/pnfs.h +16 -0
@@ -40,6 +40,8 @@ int _pnfs_return_layout(struct inode *, struct nfs4_pnfs_layout_segment *, enum pnfs_layoutreturn_type, bool wait);void set_pnfs_layoutdriver (struct nfs_server *,u32 id);void unmount_pnfs_layoutdriver (struct nfs_server *); +enum pnfs_try_status pnfs_try_to_read_data (struct nfs_read_data *, +const struct rpc_call_ops *);int pnfs_initialize (void );void pnfs_uninitialize (void );void pnfs_layoutcommit_free (struct pnfs_layoutcommit_data *data);
@@ -148,6 +150,20 @@ pnfs_update_layout(struct inode *ino, struct nfs_open_context *ctx, *lsegpp =NULL ; } +static inline enum pnfs_try_status +pnfs_try_to_read_data (struct nfs_read_data *data, +const struct rpc_call_ops *call_ops) +{ +return PNFS_NOT_ATTEMPTED ; +} + +static inline enum pnfs_try_status +pnfs_try_to_commit (struct nfs_write_data *data, +const struct rpc_call_ops *call_ops,int how) +{ +return PNFS_NOT_ATTEMPTED ; +} +static inline int pnfs_layoutcommit_inode (struct inode *inode,int sync) {return 0 ;
fs/nfs/read.c +63 -27
158 lines not on this page · raw message
include/linux/nfs4_pnfs.h +17 -0
@@ -15,6 +15,11 @@#include <linux/pnfs_xdr.h> #include <linux/nfs_page.h> +enum pnfs_try_status { +PNFS_ATTEMPTED =0 , +PNFS_NOT_ATTEMPTED =1 , +}; +/* Per-layout driver specific registration structure */ struct pnfs_layoutdriver_type {const u32 id;
@@ -104,6 +109,18 @@ LSEG_LD_DATA(struct pnfs_layout_segment *lseg)* Either the pagecache or non-pagecache read/write operations must be implemented */ struct layoutdriver_io_operations { +/* Functions that use the pagecache. +* If use_pagecache == 1, then these functions must be implemented. +*/ +/* read and write pagelist should return just 0 (to indicate that +* the layout code has taken control) or 1 (to indicate that the +* layout code wishes to fall back to normal nfs.) If 0 is returned, +* information can be passed back through nfs_data->res and +* nfs_data->task.tk_status, and the appropriate pnfs done function +* MUST be called. +*/ +enum pnfs_try_status + (*read_pagelist) (struct nfs_read_data *nfs_data,unsigned nr_pages);/* Layout information. For each inode, alloc_layout is executed once to retrieve an * inode specific layout structure. Each subsequent layoutget operation results in * a set_layout call to set the opaque layout in the layout driver.*/
include/linux/nfs_iostat.h +1 -0
@@ -113,6 +113,7 @@ enum nfs_stat_eventcounters {NFSIOS_SHORTREAD ,NFSIOS_SHORTWRITE ,NFSIOS_DELAY , +NFSIOS_PNFS_READ , __NFSIOS_COUNTSMAX, };
include/linux/nfs_xdr.h +21 -0
@@ -972,6 +972,23 @@ struct nfs_page;#define NFS_PAGEVEC_SIZE (8U) +#if defined(CONFIG_NFS_V4_1 ) + +/* pnfs-specific data needed for read, write, and commit calls */ +struct pnfs_call_data { +struct pnfs_layout_segment *lseg; +const struct rpc_call_ops *call_ops; +u32 orig_count;/* for retry via MDS */ +u8 how;/* for FLUSH_STABLE */ +}; + +/* files layout-type specific data for read, write, and commit */ +struct pnfs_fl_call_data { +struct nfs_client *ds_nfs_client; +__u64 orig_offset; +}; +#endif /* CONFIG_NFS_V4_1 */ +struct nfs_read_data {int flags;struct rpc_task task;
@@ -987,6 +1004,10 @@ struct nfs_read_data {#ifdef CONFIG_NFS_V4 unsigned long timestamp;/* For lease renewal */ #endif +#if defined(CONFIG_NFS_V4_1 ) +struct pnfs_call_data pdata; +struct pnfs_fl_call_data fldata; +#endif /* CONFIG_NFS_V4_1 */ struct page *page_array[NFS_PAGEVEC_SIZE ]; };
Signature · 1 line
1.6.2.5
PATCH 37/50 pnfs_submit: filelayout read
From: The pNFS Team <[email protected]>
--- fs/nfs/nfs4filelayout.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 88 insertions(+), 0 deletions(-)
fs/nfs/nfs4filelayout.c +88 -0
@@ -124,6 +124,93 @@ filelayout_get_dserver_offset(struct pnfs_layout_segment *lseg, loff_t offset) }/* +* Call ops for the async read/write cases +* In the case of dense layouts, the offset needs to be reset to its +* original value. +*/ +static void filelayout_read_call_done (struct rpc_task *task,void *data) +{ +struct nfs_read_data *rdata = (struct nfs_read_data *)data; + +if (rdata->fldata.orig_offset) { +dprintk ("%s new off %llu orig offset %llu\n" , __func__, + rdata->args.offset, rdata->fldata.orig_offset); + rdata->args.offset = rdata->fldata.orig_offset; + } + +/* Note this may cause RPC to be resent */ + rdata->pdata.call_ops->rpc_call_done (task, data); +} + +static void filelayout_read_release (void *data) +{ +struct nfs_read_data *rdata = (struct nfs_read_data *)data; + +put_lseg (rdata->pdata.lseg); + rdata->pdata.lseg =NULL ; + rdata->pdata.call_ops->rpc_release (data); +} + +struct rpc_call_ops filelayout_read_call_ops = { + .rpc_call_prepare = nfs_read_prepare, + .rpc_call_done = filelayout_read_call_done, + .rpc_release = filelayout_read_release, +}; + +/* Perform sync or async reads. +* +* An optimization for the NFS file layout driver +* allows the original read/write data structs to be passed in the +* last argument. +* +* TODO: join with write_pagelist? +*/ +static enum pnfs_try_status +filelayout_read_pagelist (struct nfs_read_data *data,unsigned nr_pages) +{ +struct pnfs_layout_segment *lseg = data->pdata.lseg; +struct nfs4_pnfs_ds *ds; +loff_t offset = data->args.offset; +u32 idx; +struct nfs_fh *fh; + +dprintk ("--> %s ino %lu nr_pages %d pgbase %u req %Zu@%llu\n" , + __func__, data->inode->i_ino, nr_pages, + data->args.pgbase, (size_t )data->args.count, offset); + +/* Retrieve the correct rpc_client for the byte range */ + idx =nfs4_fl_calc_ds_index (lseg, offset); + ds =nfs4_fl_prepare_ds (lseg, idx); +if (!ds) { +printk (KERN_ERR "%s: prepare_ds failed, use MDS\n" , __func__); +return PNFS_NOT_ATTEMPTED ; + } +dprintk ("%s USE DS:ip %x %s\n" , __func__, +htonl (ds->ds_ip_addr), ds->r_addr); + +/* just try the first data server for the index..*/ + data->fldata.ds_nfs_client = ds->ds_clp; + fh =nfs4_fl_select_ds_fh (lseg, offset); +if (fh) + data->args.fh = fh; + +/* +* Now get the file offset on the dserver +* Set the read offset to this offset, and +* save the original offset in orig_offset +* In the case of aync reads, the offset will be reset in the +* call_ops->rpc_call_done() routine. +*/ + data->args.offset =filelayout_get_dserver_offset (lseg, offset); + data->fldata.orig_offset = offset; + +/* Perform an asynchronous read */ +nfs_initiate_read (data, ds->ds_clp->cl_rpcclient, + &filelayout_read_call_ops); +return PNFS_ATTEMPTED ; +} + +/* * Create a filelayout layout structure and return it. The pNFS client * will use the pnfs_layout_type type to refer to the layout for this * inode from now on.
@@ -377,6 +464,7 @@ filelayout_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev, }struct layoutdriver_io_operations filelayout_io_operations = { + .read_pagelist = filelayout_read_pagelist, .alloc_layout = filelayout_alloc_layout, .free_layout = filelayout_free_layout, .alloc_lseg = filelayout_alloc_lseg,
Signature · 1 line
1.6.2.5
PATCH 38/50 pnfs_submit: generic write
From: The pNFS Team <[email protected]>
--- fs/nfs/internal.h | 9 +++ fs/nfs/nfs4proc.c | 43 +++++++++++++-- fs/nfs/pnfs.c | 44 +++++++++++++++ fs/nfs/pnfs.h | 9 +++ fs/nfs/write.c | 125 ++++++++++++++++++++++++++++++-------------- include/linux/nfs4_pnfs.h | 4 ++ include/linux/nfs_iostat.h | 1 + include/linux/nfs_xdr.h | 4 ++ 8 files changed, 194 insertions(+), 45 deletions(-)
fs/nfs/internal.h +9 -0
@@ -268,7 +268,16 @@ extern int pnfs_initiate_read(struct nfs_read_data *data, struct rpc_clnt *clnt,extern void nfs_read_prepare (struct rpc_task *task,void *calldata);/* write.c */ +extern int nfs_initiate_write (struct nfs_write_data *data, +struct rpc_clnt *clnt, +const struct rpc_call_ops *call_ops, +int how); +extern int pnfs_initiate_write (struct nfs_write_data *data, +struct rpc_clnt *clnt, +const struct rpc_call_ops *call_ops, +int how);extern void nfs_write_prepare (struct rpc_task *task,void *calldata); +extern void nfs_mark_list_commit (struct list_head *head);#ifdef CONFIG_MIGRATION extern int nfs_migrate_page (struct address_space *,struct page *,struct page *);
fs/nfs/nfs4proc.c +38 -5
58 lines not on this page · raw message
fs/nfs/pnfs.c +44 -0
50 lines not on this page · raw message
fs/nfs/pnfs.h +9 -0
@@ -40,6 +40,8 @@ int _pnfs_return_layout(struct inode *, struct nfs4_pnfs_layout_segment *, enum pnfs_layoutreturn_type, bool wait);void set_pnfs_layoutdriver (struct nfs_server *,u32 id);void unmount_pnfs_layoutdriver (struct nfs_server *); +enum pnfs_try_status pnfs_try_to_write_data (struct nfs_write_data *, +const struct rpc_call_ops *,int );enum pnfs_try_status pnfs_try_to_read_data (struct nfs_read_data *,const struct rpc_call_ops *);int pnfs_initialize (void );
@@ -158,6 +160,13 @@ pnfs_try_to_read_data(struct nfs_read_data *data, }static inline enum pnfs_try_status +pnfs_try_to_write_data (struct nfs_write_data *data, +const struct rpc_call_ops *call_ops,int how) +{ +return PNFS_NOT_ATTEMPTED ; +} + +static inline enum pnfs_try_status pnfs_try_to_commit (struct nfs_write_data *data,const struct rpc_call_ops *call_ops,int how) {
fs/nfs/write.c +85 -40
188 lines not on this page · raw message
include/linux/nfs4_pnfs.h +4 -0
@@ -121,6 +121,10 @@ struct layoutdriver_io_operations {*/ enum pnfs_try_status (*read_pagelist) (struct nfs_read_data *nfs_data,unsigned nr_pages); +enum pnfs_try_status + (*write_pagelist) (struct nfs_write_data *nfs_data,unsigned nr_pages,int how); + +/* Layout information. For each inode, alloc_layout is executed once to retrieve an * inode specific layout structure. Each subsequent layoutget operation results in * a set_layout call to set the opaque layout in the layout driver.*/
include/linux/nfs_iostat.h +1 -0
@@ -114,6 +114,7 @@ enum nfs_stat_eventcounters {NFSIOS_SHORTWRITE ,NFSIOS_DELAY ,NFSIOS_PNFS_READ , +NFSIOS_PNFS_WRITE , __NFSIOS_COUNTSMAX, };
include/linux/nfs_xdr.h +4 -0
@@ -1027,6 +1027,10 @@ struct nfs_write_data {#ifdef CONFIG_NFS_V4 unsigned long timestamp;/* For lease renewal */ #endif +#if defined(CONFIG_NFS_V4_1 ) +struct pnfs_call_data pdata; +struct pnfs_fl_call_data fldata; +#endif /* CONFIG_NFS_V4_1 */ struct page *page_array[NFS_PAGEVEC_SIZE ]; };
Signature · 1 line
1.6.2.5
PATCH 39/50 pnfs_submit: data server write with no getattr
From: The pNFS Team <[email protected]>
--- fs/nfs/nfs4proc.c | 8 ++++++- fs/nfs/nfs4xdr.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ include/linux/nfs4.h | 1 + 3 files changed, 66 insertions(+), 1 deletions(-)
fs/nfs/nfs4proc.c +7 -1
@@ -3220,13 +3220,19 @@ static void nfs4_proc_write_setup(struct nfs_write_data *data, struct rpc_messag data->res.server = server; data->timestamp = jiffies; +#ifdef CONFIG_NFS_V4_1 +/* writes to DS use pnfs vector */ +if (data->fldata.ds_nfs_client) { + msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_PNFS_WRITE ]; +return ; + } +#endif /* CONFIG_NFS_V4_1 */ msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_WRITE ]; }static int nfs4_commit_done (struct rpc_task *task,struct nfs_write_data *data) {struct inode *inode = data->inode; -if (!nfs4_sequence_done (task, &data->res.seq_res))return -EAGAIN ;
fs/nfs/nfs4xdr.c +58 -0
82 lines not on this page · raw message
include/linux/nfs4.h +1 -0
@@ -557,6 +557,7 @@ enum {NFSPROC4_CLNT_PNFS_LAYOUTCOMMIT ,NFSPROC4_CLNT_PNFS_LAYOUTRETURN ,NFSPROC4_CLNT_PNFS_GETDEVICEINFO , + NFSPROC4_CLNT_PNFS_WRITE, };/* nfs41 types */
Signature · 1 line
1.6.2.5
PATCH 40/50 pnfs_submit: filelayout write
From: The pNFS Team <[email protected]>
--- fs/nfs/nfs4filelayout.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 71 insertions(+), 0 deletions(-)
fs/nfs/nfs4filelayout.c +71 -0
@@ -151,12 +151,41 @@ static void filelayout_read_release(void *data) rdata->pdata.call_ops->rpc_release (data); } +static void filelayout_write_call_done (struct rpc_task *task,void *data) +{ +struct nfs_write_data *wdata = (struct nfs_write_data *)data; + +if (wdata->fldata.orig_offset) { +dprintk ("%s new off %llu orig offset %llu\n" , __func__, + wdata->args.offset, wdata->fldata.orig_offset); + wdata->args.offset = wdata->fldata.orig_offset; + } + +/* Note this may cause RPC to be resent */ + wdata->pdata.call_ops->rpc_call_done (task, data); +} + +static void filelayout_write_release (void *data) +{ +struct nfs_write_data *wdata = (struct nfs_write_data *)data; + +put_lseg (wdata->pdata.lseg); + wdata->pdata.lseg =NULL ; + wdata->pdata.call_ops->rpc_release (data); +} +struct rpc_call_ops filelayout_read_call_ops = { .rpc_call_prepare = nfs_read_prepare, .rpc_call_done = filelayout_read_call_done, .rpc_release = filelayout_read_release, }; +struct rpc_call_ops filelayout_write_call_ops = { + .rpc_call_prepare = nfs_write_prepare, + .rpc_call_done = filelayout_write_call_done, + .rpc_release = filelayout_write_release, +}; +/* Perform sync or async reads. * * An optimization for the NFS file layout driver
@@ -210,6 +239,47 @@ filelayout_read_pagelist(struct nfs_read_data *data, unsigned nr_pages)return PNFS_ATTEMPTED ; } +/* Perform async writes. */ +static enum pnfs_try_status +filelayout_write_pagelist (struct nfs_write_data *data,unsigned nr_pages,int sync) +{ +struct pnfs_layout_segment *lseg = data->pdata.lseg; +struct nfs4_pnfs_ds *ds; +loff_t offset = data->args.offset; +u32 idx; +struct nfs_fh *fh; + +/* Retrieve the correct rpc_client for the byte range */ + idx =nfs4_fl_calc_ds_index (lseg, offset); + ds =nfs4_fl_prepare_ds (lseg, idx); +if (!ds) { +printk (KERN_ERR "%s: prepare_ds failed, use MDS\n" , __func__); +return PNFS_NOT_ATTEMPTED ; + } +dprintk ("%s ino %lu sync %d req %Zu@%llu DS:%x:%hu %s\n" , __func__, + data->inode->i_ino, sync, (size_t ) data->args.count, offset, +htonl (ds->ds_ip_addr),ntohs (ds->ds_port), ds->r_addr); + + data->fldata.ds_nfs_client = ds->ds_clp; + fh =nfs4_fl_select_ds_fh (lseg, offset); +if (fh) + data->args.fh = fh; +/* +* Get the file offset on the dserver. Set the write offset to +* this offset and save the original offset. +*/ + data->args.offset =filelayout_get_dserver_offset (lseg, offset); + data->fldata.orig_offset = offset; + +/* +* Perform an asynchronous write The offset will be reset in the +* call_ops->rpc_call_done() routine +*/ +nfs_initiate_write (data, ds->ds_clp->cl_rpcclient, + &filelayout_write_call_ops, sync); +return PNFS_ATTEMPTED ; +} +/* * Create a filelayout layout structure and return it. The pNFS client * will use the pnfs_layout_type type to refer to the layout for this
@@ -465,6 +535,7 @@ filelayout_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,struct layoutdriver_io_operations filelayout_io_operations = { .read_pagelist = filelayout_read_pagelist, + .write_pagelist = filelayout_write_pagelist, .alloc_layout = filelayout_alloc_layout, .free_layout = filelayout_free_layout, .alloc_lseg = filelayout_alloc_lseg,
Signature · 1 line
1.6.2.5
PATCH 41/50 pnfs_submit: signal layoutdriver commit
From: The pNFS Team <[email protected]>
--- fs/nfs/pagelist.c | 5 ++++- fs/nfs/write.c | 12 +++++++----- include/linux/nfs_page.h | 3 ++- include/linux/nfs_xdr.h | 2 ++ 4 files changed, 15 insertions(+), 7 deletions(-)
fs/nfs/pagelist.c +4 -1
@@ -387,6 +387,7 @@ void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *desc, pgoff_t index)* @idx_start: lower bound of page->index to scan * @npages: idx_start + npages sets the upper bound to scan. * @tag: tag to scan for +* @use_pnfs: will be set TRUE if commit needs to be handled by layout driver * * Moves elements from one of the inode request lists. * If the number of requests is set to 0, the entire address_space
@@ -396,7 +397,7 @@ void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *desc, pgoff_t index)*/ int nfs_scan_list (struct nfs_inode *nfsi,struct list_head *dst,pgoff_t idx_start, -unsigned int npages,int tag) +unsigned int npages,int tag,int *use_pnfs) {struct nfs_page *pgvec[NFS_SCAN_MAXENTRIES ];struct nfs_page *req;
@@ -427,6 +428,8 @@ int nfs_scan_list(struct nfs_inode *nfsi,radix_tree_tag_clear (&nfsi->nfs_page_tree, req->wb_index, tag);nfs_list_add_request (req, dst); +if (req->wb_lseg) + *use_pnfs =1 ; res++;if (res ==INT_MAX ) goto out;
fs/nfs/write.c +7 -5
@@ -546,7 +546,7 @@ nfs_need_commit(struct nfs_inode *nfsi)* The requests are *not* checked to ensure that they form a contiguous set. */ static int -nfs_scan_commit (struct inode *inode,struct list_head *dst,pgoff_t idx_start,unsigned int npages) +nfs_scan_commit (struct inode *inode,struct list_head *dst,pgoff_t idx_start,unsigned int npages,int *use_pnfs) {struct nfs_inode *nfsi =NFS_I (inode);int ret;
@@ -554,7 +554,8 @@ nfs_scan_commit(struct inode *inode, struct list_head *dst, pgoff_t idx_start, uif (!nfs_need_commit (nfsi))return 0 ; - ret =nfs_scan_list (nfsi, dst, idx_start, npages,NFS_PAGE_TAG_COMMIT ); + ret =nfs_scan_list (nfsi, dst, idx_start, npages,NFS_PAGE_TAG_COMMIT , + use_pnfs);if (ret >0 ) nfsi->ncommit -= ret;if (nfs_need_commit (NFS_I (inode)))
@@ -1466,21 +1467,22 @@ int nfs_commit_inode(struct inode *inode, int how)LIST_HEAD (head);int may_wait = how &FLUSH_SYNC ;int res =0 ; +int use_pnfs =0 ;if (!nfs_commit_set_lock (NFS_I (inode), may_wait)) goto out_mark_dirty;spin_lock (&inode->i_lock); - res =nfs_scan_commit (inode, &head,0 ,0 ); + res =nfs_scan_commit (inode, &head,0 ,0 , &use_pnfs);spin_unlock (&inode->i_lock);if (res) {int error =nfs_commit_list (inode, &head, how);if (error <0 )return error; -if (may_wait) +if (may_wait) {wait_on_bit (&NFS_I (inode)->flags,NFS_INO_COMMIT , nfs_wait_bit_killable,TASK_KILLABLE ); -else + }else goto out_mark_dirty; }else nfs_commit_clear_lock (NFS_I (inode));
include/linux/nfs_page.h +2 -1
@@ -83,7 +83,8 @@ extern void nfs_release_request(struct nfs_page *req);extern int nfs_scan_list (struct nfs_inode *nfsi,struct list_head *dst, -pgoff_t idx_start,unsigned int npages,int tag); +pgoff_t idx_start,unsigned int npages,int tag, +int *use_pnfs); extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc, struct inode *inode, int (*doio)(struct inode *, struct list_head *, unsigned int, size_t, int),
include/linux/nfs_xdr.h +2 -0
@@ -1012,6 +1012,8 @@ struct nfs_read_data { };struct nfs_write_data { +struct kref refcount;/* For pnfs commit splitting */ +struct nfs_write_data *parent;/* For pnfs commit splitting */ int flags;struct rpc_task task;struct inode *inode;
Signature · 1 line
1.6.2.5
PATCH 42/50 pnfs_submit: generic commit
From: The pNFS Team <[email protected]>
--- fs/nfs/internal.h | 8 ++++ fs/nfs/nfs4proc.c | 14 ++++++- fs/nfs/pnfs.c | 37 ++++++++++++++++ fs/nfs/pnfs.h | 3 + fs/nfs/write.c | 99 ++++++++++++++++++++++++++++++++------------ include/linux/nfs4_pnfs.h | 7 +++ include/linux/nfs_iostat.h | 1 + 7 files changed, 141 insertions(+), 28 deletions(-)
fs/nfs/internal.h +8 -0
@@ -276,6 +276,14 @@ extern int pnfs_initiate_write(struct nfs_write_data *data,struct rpc_clnt *clnt, const struct rpc_call_ops *call_ops, int how); +extern int nfs_initiate_commit (struct nfs_write_data *data, +struct rpc_clnt *clnt, +const struct rpc_call_ops *call_ops, +int how); +extern int pnfs_initiate_commit (struct nfs_write_data *data, +struct rpc_clnt *clnt, +const struct rpc_call_ops *call_ops, +int how,int pnfs);extern void nfs_write_prepare (struct rpc_task *task,void *calldata);extern void nfs_mark_list_commit (struct list_head *head);#ifdef CONFIG_MIGRATION
fs/nfs/nfs4proc.c +13 -1
@@ -3233,6 +3233,17 @@ static void nfs4_proc_write_setup(struct nfs_write_data *data, struct rpc_messagstatic int nfs4_commit_done (struct rpc_task *task,struct nfs_write_data *data) {struct inode *inode = data->inode; +struct nfs_server *server =NFS_SERVER (data->inode); +struct nfs_client *client = server->nfs_client; + +#ifdef CONFIG_NFS_V4_1 +/* Is this a DS session */ +if (data->fldata.ds_nfs_client) { +dprintk ("%s DS commit\n" , __func__); + client = data->fldata.ds_nfs_client; + } +#endif /* CONFIG_NFS_V4_1 */ +if (!nfs4_sequence_done (task, &data->res.seq_res))return -EAGAIN ;
@@ -3240,7 +3251,8 @@ static int nfs4_commit_done(struct rpc_task *task, struct nfs_write_data *data)nfs_restart_rpc (task,NFS_SERVER (inode)->nfs_client);return -EAGAIN ; } -nfs_refresh_inode (inode, data->res.fattr); +if (client == server->nfs_client) +nfs_refresh_inode (inode, data->res.fattr);return 0 ; }
fs/nfs/pnfs.c +37 -0
@@ -260,6 +260,14 @@ pnfs_register_layoutdriver(struct pnfs_layoutdriver_type *ld_type)return NULL ; } +if (!io_ops->read_pagelist || !io_ops->write_pagelist || + !io_ops->commit) { +printk (KERN_ERR "%s Layout driver must provide " +"read_pagelist, write_pagelist, and commit.\n" , + __func__); +return NULL ; + } + pnfs_mod =kmalloc (sizeof (struct pnfs_module ),GFP_KERNEL );if (pnfs_mod !=NULL ) { dprintk("%s Registering id:%u name:%s\n",
@@ -1323,6 +1331,35 @@ pnfs_try_to_read_data(struct nfs_read_data *rdata,return trypnfs; } +enum pnfs_try_status +pnfs_try_to_commit (struct nfs_write_data *data, +const struct rpc_call_ops *call_ops,int sync) +{ +struct inode *inode = data->inode; +struct nfs_server *nfss =NFS_SERVER (data->inode); +enum pnfs_try_status trypnfs; + +dprintk ("%s: Begin\n" , __func__); + +/* We need to account for possibility that +* each nfs_page can point to a different lseg (or be NULL). +* For the immediate case of whole-file-only layouts, we at +* least know there can be only a single lseg. +* We still have to account for the possibility of some being NULL. +* This will be done by passing the buck to the layout driver. +*/ + data->pdata.call_ops = call_ops; + data->pdata.how = sync; + data->pdata.lseg =NULL ; + trypnfs = nfss->pnfs_curr_ld->ld_io_ops->commit (data, sync); +if (trypnfs ==PNFS_NOT_ATTEMPTED ) +_pnfs_clear_lseg_from_pages (&data->pages); +else +nfs_inc_stats (inode,NFSIOS_PNFS_COMMIT ); +dprintk ("%s End (trypnfs:%d)\n" , __func__, trypnfs); +return trypnfs; +} +/* * Set up the argument/result storage required for the RPC call. */
fs/nfs/pnfs.h +3 -0
@@ -50,6 +50,9 @@ void pnfs_layoutcommit_free(struct pnfs_layoutcommit_data *data);int pnfs_layoutcommit_inode (struct inode *inode,int sync);void pnfs_update_last_write (struct nfs_inode *nfsi,loff_t offset,size_t extent);void pnfs_need_layoutcommit (struct nfs_inode *nfsi,struct nfs_open_context *ctx); +unsigned int pnfs_getiosize (struct nfs_server *server); +enum pnfs_try_status pnfs_try_to_commit (struct nfs_write_data *, +const struct rpc_call_ops *,int );void pnfs_pageio_init_read (struct nfs_pageio_descriptor *,struct inode *,struct nfs_open_context *,struct list_head *);void pnfs_pageio_init_write (struct nfs_pageio_descriptor *,struct inode *);
fs/nfs/write.c +72 -27
174 lines not on this page · raw message
include/linux/nfs4_pnfs.h +7 -0
@@ -124,6 +124,13 @@ struct layoutdriver_io_operations {enum pnfs_try_status (*write_pagelist) (struct nfs_write_data *nfs_data,unsigned nr_pages,int how); +/* Consistency ops */ +/* 2 problems: +* 1) the page list contains nfs_pages, NOT pages +* 2) currently the NFS code doesn't create a page array (as it does with read/write) +*/ +enum pnfs_try_status + (*commit) (struct nfs_write_data *nfs_data,int how);/* Layout information. For each inode, alloc_layout is executed once to retrieve an * inode specific layout structure. Each subsequent layoutget operation results in
include/linux/nfs_iostat.h +1 -0
@@ -115,6 +115,7 @@ enum nfs_stat_eventcounters {NFSIOS_DELAY ,NFSIOS_PNFS_READ ,NFSIOS_PNFS_WRITE , +NFSIOS_PNFS_COMMIT , __NFSIOS_COUNTSMAX, };
Signature · 1 line
1.6.2.5
PATCH 43/50 pnfs_submit: data server commit with no getattr
From: The pNFS Team <[email protected]>
--- fs/nfs/nfs4proc.c | 6 ++++++ fs/nfs/nfs4xdr.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ include/linux/nfs4.h | 1 + 3 files changed, 57 insertions(+), 0 deletions(-)
fs/nfs/nfs4proc.c +6 -0
@@ -3262,6 +3262,12 @@ static void nfs4_proc_commit_setup(struct nfs_write_data *data, struct rpc_messa data->args.bitmask = server->cache_consistency_bitmask; data->res.server = server; +#if defined(CONFIG_NFS_V4_1 ) +if (data->fldata.ds_nfs_client) { + msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_PNFS_COMMIT ]; +return ; + } +#endif /* CONFIG_NFS_V4_1 */ msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_COMMIT ]; }
fs/nfs/nfs4xdr.c +50 -0
74 lines not on this page · raw message
include/linux/nfs4.h +1 -0
@@ -558,6 +558,7 @@ enum {NFSPROC4_CLNT_PNFS_LAYOUTRETURN ,NFSPROC4_CLNT_PNFS_GETDEVICEINFO ,NFSPROC4_CLNT_PNFS_WRITE , + NFSPROC4_CLNT_PNFS_COMMIT, };/* nfs41 types */
Signature · 1 line
1.6.2.5
PATCH 44/50 pnfs_submit: filelayout commit
From: The pNFS Team <[email protected]>
--- fs/nfs/inode.c | 2 + fs/nfs/nfs4filelayout.c | 171 +++++++++++++++++++++++++++++++++++++++++++++++ fs/nfs/write.c | 30 +++++--- 3 files changed, 192 insertions(+), 11 deletions(-)
fs/nfs/inode.c +2 -0
@@ -644,6 +644,7 @@ struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx)atomic_inc (&ctx->lock_context.count);return ctx; } +EXPORT_SYMBOL (get_nfs_open_context);static void __put_nfs_open_context (struct nfs_open_context *ctx,int is_sync) {
@@ -996,6 +997,7 @@ void nfs_fattr_init(struct nfs_fattr *fattr) fattr->time_start = jiffies; fattr->gencount =nfs_inc_attr_generation_counter (); } +EXPORT_SYMBOL (nfs_fattr_init);struct nfs_fattr *nfs_alloc_fattr (void ) {
fs/nfs/nfs4filelayout.c +171 -0
183 lines not on this page · raw message
fs/nfs/write.c +19 -11
@@ -60,6 +60,7 @@ struct nfs_write_data *nfs_commitdata_alloc(void) }return p; } +EXPORT_SYMBOL (nfs_commitdata_alloc);void nfs_commit_free (struct nfs_write_data *p) {
@@ -1395,6 +1396,23 @@ static int nfs_commit_rpcsetup(struct list_head *head, how, pnfs); } +/* Handle memory error during commit */ +void nfs_mark_list_commit (struct list_head *head) +{ +struct nfs_page *req; + +while (!list_empty (head)) { + req =nfs_list_entry (head->next); +nfs_list_remove_request (req); +nfs_mark_request_commit (req); +dec_zone_page_state (req->wb_page,NR_UNSTABLE_NFS ); +dec_bdi_stat (req->wb_page->mapping->backing_dev_info, +BDI_RECLAIMABLE ); +nfs_clear_page_tag_locked (req); + } +} +EXPORT_SYMBOL (nfs_mark_list_commit); +/* * Commit dirty pages */
@@ -1402,25 +1420,15 @@ static int nfs_commit_list(struct inode *inode, struct list_head *head, int how, int pnfs) { struct nfs_write_data *data; -struct nfs_page *req; data =nfs_commitdata_alloc (); -if (!data) goto out_bad;/* Set up the argument struct */ return nfs_commit_rpcsetup (head, data, how, pnfs); out_bad: -while (!list_empty (head)) { - req =nfs_list_entry (head->next); -nfs_list_remove_request (req); -nfs_mark_request_commit (req); -dec_zone_page_state (req->wb_page,NR_UNSTABLE_NFS ); -dec_bdi_stat (req->wb_page->mapping->backing_dev_info, -BDI_RECLAIMABLE ); -nfs_clear_page_tag_locked (req); - } +nfs_mark_list_commit (head);nfs_commit_clear_lock (NFS_I (inode));return -ENOMEM ; }
Signature · 1 line
1.6.2.5
PATCH 45/50 pnfs_submit: cb_layoutrecall
From: The pNFS Team <[email protected]>
--- fs/nfs/callback.h | 25 ++++ fs/nfs/callback_proc.c | 328 +++++++++++++++++++++++++++++++++++++++++++++++- fs/nfs/callback_xdr.c | 65 +++++++++- fs/nfs/nfs4_fs.h | 1 + 4 files changed, 415 insertions(+), 4 deletions(-)
fs/nfs/callback.h +25 -0
@@ -8,6 +8,8 @@#ifndef __LINUX_FS_NFS_CALLBACK_H#define __LINUX_FS_NFS_CALLBACK_H +#include <linux/pnfs_xdr.h> +#define NFS4_CALLBACK 0x40000000#define NFS4_CALLBACK_XDRSIZE 2048#define NFS4_CALLBACK_BUFSIZE (1024 + NFS4_CALLBACK_XDRSIZE)
@@ -72,6 +74,8 @@ struct cb_recallargs { #if defined(CONFIG_NFS_V4_1) +#include <linux/pnfs_xdr.h> + struct referring_call { uint32_t rc_sequenceid; uint32_t rc_slotid;
@@ -111,6 +115,13 @@ extern int nfs41_validate_delegation_stateid(struct nfs_delegation *delegation,#define RCA4_TYPE_MASK_RDATA_DLG 0#define RCA4_TYPE_MASK_WDATA_DLG 1 +#define RCA4_TYPE_MASK_DIR_DLG 2 +#define RCA4_TYPE_MASK_FILE_LAYOUT 3 +#define RCA4_TYPE_MASK_BLK_LAYOUT 4 +#define RCA4_TYPE_MASK_OBJ_LAYOUT_MIN 8 +#define RCA4_TYPE_MASK_OBJ_LAYOUT_MAX 9 +#define RCA4_TYPE_MASK_OTHER_LAYOUT_MIN 12 +#define RCA4_TYPE_MASK_OTHER_LAYOUT_MAX 15struct cb_recallanyargs {struct sockaddr *craa_addr;
@@ -127,6 +138,20 @@ struct cb_recallslotargs {extern unsigned nfs4_callback_recallslot (struct cb_recallslotargs *args,void *dummy); +struct cb_pnfs_layoutrecallargs { +struct sockaddr *cbl_addr; +struct nfs_fh cbl_fh; +struct nfs4_pnfs_layout_segment cbl_seg; +struct nfs_fsid cbl_fsid; +uint32_t cbl_recall_type; +uint32_t cbl_layout_type; +uint32_t cbl_layoutchanged; +nfs4_stateid cbl_stateid; +}; + +extern unsigned pnfs_cb_layoutrecall (struct cb_pnfs_layoutrecallargs *args, +void *dummy); +#endif /* CONFIG_NFS_V4_1 */ extern __be32 nfs4_callback_getattr (struct cb_getattrargs *args,struct cb_getattrres *res);
fs/nfs/callback_proc.c +326 -2
371 lines not on this page · raw message
fs/nfs/callback_xdr.c +63 -2
93 lines not on this page · raw message
fs/nfs/nfs4_fs.h +1 -0
@@ -46,6 +46,7 @@ enum nfs4_client_state {NFS4CLNT_DELEGRETURN ,NFS4CLNT_SESSION_RESET ,NFS4CLNT_RECALL_SLOT , + NFS4CLNT_LAYOUT_RECALL, }; enum nfs4_session_state {
Signature · 1 line
1.6.2.5
PATCH 46/50 pnfs_submit: increase NFS_MAX_FILE_IO_SIZE
From: The pNFS Team <[email protected]>
--- include/linux/nfs_xdr.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/nfs_xdr.h +1 -1
@@ -10,7 +10,7 @@* support a megabyte or more. The default is left at 4096 bytes, which is * reasonable for NFS over UDP. */ -#define NFS_MAX_FILE_IO_SIZE (1048576U) +#define NFS_MAX_FILE_IO_SIZE (4U * 1048576U)#define NFS_DEF_FILE_IO_SIZE (4096U)#define NFS_MIN_FILE_IO_SIZE (1024U)
Signature · 1 line
1.6.2.5
PATCH 47/50 SQUASHME pnfs_post_submit: direct i/o
From: Andy Adamson <[email protected]>
--- fs/nfs/direct.c | 160 +++++++++++++++++++++++++++++++----------------------- 1 files changed, 92 insertions(+), 68 deletions(-)
fs/nfs/direct.c +92 -68
@@ -267,6 +267,38 @@ static const struct rpc_call_ops nfs_read_direct_ops = { .rpc_release = nfs_direct_read_release, }; +static long nfs_direct_read_execute (struct nfs_read_data *data, +struct rpc_task_setup *task_setup_data, +struct rpc_message *msg) +{ +struct inode *inode = data->inode; +struct rpc_task *task; + +nfs_fattr_init (&data->fattr); + msg->rpc_argp = &data->args; + msg->rpc_resp = &data->res; + + task_setup_data->task = &data->task; + task_setup_data->callback_data = data; +NFS_PROTO (inode)->read_setup (data, msg); + + task =rpc_run_task (task_setup_data); +if (IS_ERR (task)) +return PTR_ERR (task); + +rpc_put_task (task); + +dprintk ("NFS: %5u initiated direct read call " +"(req %s/%lld, %u bytes @ offset %llu)\n" , + data->task.tk_pid, + inode->i_sb->s_id, + (long long )NFS_FILEID (inode), + data->args.count, + (unsigned long long )data->args.offset); + +return 0 ; +} +/* * For each rsize'd chunk of the user's buffer, dispatch an NFS READ * operation. If nfs_readdata_alloc() or get_user_pages() fails,
@@ -283,7 +315,6 @@ static ssize_t nfs_direct_read_schedule_segment(struct nfs_direct_req *dreq,unsigned long user_addr = (unsigned long )iov->iov_base;size_t count = iov->iov_len;size_t rsize =NFS_SERVER (inode)->rsize; -struct rpc_task *task;struct rpc_message msg = { .rpc_cred = ctx->cred, };
@@ -343,26 +374,9 @@ static ssize_t nfs_direct_read_schedule_segment(struct nfs_direct_req *dreq, data->res.fattr = &data->fattr; data->res.eof =0 ; data->res.count = bytes; -nfs_fattr_init (&data->fattr); - msg.rpc_argp = &data->args; - msg.rpc_resp = &data->res; - task_setup_data.task = &data->task; - task_setup_data.callback_data = data; -NFS_PROTO (inode)->read_setup (data, &msg); - - task =rpc_run_task (&task_setup_data); -if (IS_ERR (task)) +if (nfs_direct_read_execute (data, &task_setup_data, &msg))break ; -rpc_put_task (task); - -dprintk ("NFS: %5u initiated direct read call " -"(req %s/%Ld, %zu bytes @ offset %Lu)\n" , - data->task.tk_pid, - inode->i_sb->s_id, - (long long )NFS_FILEID (inode), - bytes, - (unsigned long long )data->args.offset); started += bytes; user_addr += bytes;
@@ -448,12 +462,15 @@ static void nfs_direct_free_writedata(struct nfs_direct_req *dreq) }#if defined(CONFIG_NFS_V3 ) || defined(CONFIG_NFS_V4 ) +static long nfs_direct_write_execute (struct nfs_write_data *data, +struct rpc_task_setup *task_setup_data, +struct rpc_message *msg); +static void nfs_direct_write_reschedule (struct nfs_direct_req *dreq) {struct inode *inode = dreq->inode;struct list_head *p;struct nfs_write_data *data; -struct rpc_task *task;struct rpc_message msg = { .rpc_cred = dreq->ctx->cred, };
@@ -487,25 +504,7 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq)* Reuse data->task; data->args should not have changed * since the original request was sent. */ - task_setup_data.task = &data->task; - task_setup_data.callback_data = data; - msg.rpc_argp = &data->args; - msg.rpc_resp = &data->res; -NFS_PROTO (inode)->write_setup (data, &msg); - -/* -* We're called via an RPC callback, so BKL is already held. -*/ - task =rpc_run_task (&task_setup_data); -if (!IS_ERR (task)) -rpc_put_task (task); - -dprintk ("NFS: %5u rescheduled direct write call (req %s/%Ld, %u bytes @ offset %Lu)\n" , - data->task.tk_pid, - inode->i_sb->s_id, - (long long )NFS_FILEID (inode), - data->args.count, - (unsigned long long )data->args.offset); +nfs_direct_write_execute (data, &task_setup_data, &msg); }if (put_dreq (dreq))
@@ -548,10 +547,31 @@ static const struct rpc_call_ops nfs_commit_direct_ops = { .rpc_release = nfs_direct_commit_release, }; +static long nfs_direct_commit_execute (struct nfs_direct_req *dreq, +struct nfs_write_data *data, +struct rpc_task_setup *task_setup_data, +struct rpc_message *msg) +{ +struct rpc_task *task; + +NFS_PROTO (data->inode)->commit_setup (data, msg); + +/* Note: task.tk_ops->rpc_release will free dreq->commit_data */ + dreq->commit_data =NULL ; + +dprintk ("NFS: %5u initiated commit call\n" , data->task.tk_pid); + + task =rpc_run_task (task_setup_data); +if (IS_ERR (task)) +return PTR_ERR (task); + +rpc_put_task (task); +return 0 ; +} +static void nfs_direct_commit_schedule (struct nfs_direct_req *dreq) {struct nfs_write_data *data = dreq->commit_data; -struct rpc_task *task;struct rpc_message msg = { .rpc_argp = &data->args, .rpc_resp = &data->res,
@@ -579,16 +599,7 @@ static void nfs_direct_commit_schedule(struct nfs_direct_req *dreq) data->res.verf = &data->verf;nfs_fattr_init (&data->fattr); -NFS_PROTO (data->inode)->commit_setup (data, &msg); - -/* Note: task.tk_ops->rpc_release will free dreq->commit_data */ - dreq->commit_data =NULL ; - -dprintk ("NFS: %5u initiated commit call\n" , data->task.tk_pid); - - task =rpc_run_task (&task_setup_data); -if (!IS_ERR (task)) -rpc_put_task (task); +nfs_direct_commit_execute (dreq, data, &task_setup_data, &msg); }static void nfs_direct_write_complete (struct nfs_direct_req *dreq,struct inode *inode)
@@ -690,6 +701,36 @@ static const struct rpc_call_ops nfs_write_direct_ops = { .rpc_release = nfs_direct_write_release, }; +static long nfs_direct_write_execute (struct nfs_write_data *data, +struct rpc_task_setup *task_setup_data, +struct rpc_message *msg) +{ +struct inode *inode = data->inode; +struct rpc_task *task; + + task_setup_data->task = &data->task; + task_setup_data->callback_data = data; + msg->rpc_argp = &data->args; + msg->rpc_resp = &data->res; +NFS_PROTO (inode)->write_setup (data, msg); + + task =rpc_run_task (task_setup_data); +if (IS_ERR (task)) +return PTR_ERR (task); + +rpc_put_task (task); + +dprintk ("NFS: %5u initiated direct write call " +"(req %s/%lld, %u bytes @ offset %llu)\n" , + data->task.tk_pid, + inode->i_sb->s_id, + (long long )NFS_FILEID (inode), + data->args.count, + (unsigned long long )data->args.offset); + +return 0 ; +} +/* * For each wsize'd chunk of the user's buffer, dispatch an NFS WRITE * operation. If nfs_writedata_alloc() or get_user_pages() fails,
@@ -705,7 +746,6 @@ static ssize_t nfs_direct_write_schedule_segment(struct nfs_direct_req *dreq,struct inode *inode = ctx->path.dentry->d_inode;unsigned long user_addr = (unsigned long )iov->iov_base;size_t count = iov->iov_len; -struct rpc_task *task;struct rpc_message msg = { .rpc_cred = ctx->cred, };
@@ -771,24 +811,8 @@ static ssize_t nfs_direct_write_schedule_segment(struct nfs_direct_req *dreq, data->res.verf = &data->verf;nfs_fattr_init (&data->fattr); - task_setup_data.task = &data->task; - task_setup_data.callback_data = data; - msg.rpc_argp = &data->args; - msg.rpc_resp = &data->res; -NFS_PROTO (inode)->write_setup (data, &msg); - - task =rpc_run_task (&task_setup_data); -if (IS_ERR (task)) +if (nfs_direct_write_execute (data, &task_setup_data, &msg))break ; -rpc_put_task (task); - -dprintk ("NFS: %5u initiated direct write call " -"(req %s/%Ld, %zu bytes @ offset %Lu)\n" , - data->task.tk_pid, - inode->i_sb->s_id, - (long long )NFS_FILEID (inode), - bytes, - (unsigned long long )data->args.offset); started += bytes; user_addr += bytes;
Signature · 1 line
1.6.2.5
PATCH 48/50 SQUASHME pnfs_post_submit: layout type enum
From: Andy Adamson <[email protected]>
--- include/linux/nfs4.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
include/linux/nfs4.h +2 -0
@@ -579,6 +579,8 @@ enum state_protect_how4 {enum pnfs_layouttype {LAYOUT_NFSV4_1_FILES =1 , +LAYOUT_OSD2_OBJECTS =2 , +LAYOUT_BLOCK_VOLUME =3 , };/* used for both layout return and recall */
Signature · 1 line
1.6.2.5
PATCH 49/50 SQUASHME pnfs_post_submit: cb notify deviceid declarations
From: Andy Adamson <[email protected]>
--- fs/nfs/callback.h | 17 +++++++++++++++++ include/linux/nfs4.h | 5 +++++ 2 files changed, 22 insertions(+), 0 deletions(-)
fs/nfs/callback.h +17 -0
@@ -152,6 +152,23 @@ struct cb_pnfs_layoutrecallargs {extern unsigned pnfs_cb_layoutrecall (struct cb_pnfs_layoutrecallargs *args,void *dummy); +struct cb_pnfs_devicenotifyitem { +uint32_t cbd_notify_type; +uint32_t cbd_layout_type; +struct pnfs_deviceid cbd_dev_id; +uint32_t cbd_immediate; +}; + +/* XXX: Should be dynamic up to max compound size */ +#define NFS4_DEV_NOTIFY_MAXENTRIES 10 +struct cb_pnfs_devicenotifyargs { +struct sockaddr *addr; +int ndevs; +struct cb_pnfs_devicenotifyitem devs[NFS4_DEV_NOTIFY_MAXENTRIES ]; +}; + +extern unsigned pnfs_cb_devicenotify (struct cb_pnfs_devicenotifyargs *args, +void *dummy);#endif /* CONFIG_NFS_V4_1 */ extern __be32 nfs4_callback_getattr (struct cb_getattrargs *args,struct cb_getattrres *res);
include/linux/nfs4.h +5 -0
@@ -596,6 +596,11 @@ enum pnfs_iomode { IOMODE_ANY = 3, }; +enum pnfs_notify_deviceid_type4 { +NOTIFY_DEVICEID4_CHANGE =1 <<1 , +NOTIFY_DEVICEID4_DELETE =1 <<2 , +}; +#define NFL4_UFLG_MASK 0x0000003F#define NFL4_UFLG_DENSE 0x00000001#define NFL4_UFLG_COMMIT_THRU_MDS 0x00000002
Signature · 1 line
1.6.2.5
PATCH 50/50 SQUASHME pnfs_submit: remove this unused code
From: Andy Adamson <[email protected]>
--- fs/nfs/client.c | 1 + fs/nfs/file.c | 1 + fs/nfs/inode.c | 10 +++++++++- fs/nfs/nfs3proc.c | 1 + fs/nfs/nfs4_fs.h | 1 + fs/nfs/nfs4filelayout.c | 3 +++ fs/nfs/nfs4filelayout.h | 6 ++++++ fs/nfs/nfs4proc.c | 2 ++ fs/nfs/pnfs.h | 15 +++++++++++++++ fs/nfs/proc.c | 1 + fs/nfs/super.c | 25 +++++++++++++++++++++++++ fs/nfs/write.c | 11 +++++++++-- include/linux/nfs4.h | 9 +++++++++ include/linux/nfs4_pnfs.h | 18 ++++++++++++++++++ include/linux/nfs_xdr.h | 2 ++ include/linux/pnfs_xdr.h | 6 +++--- 16 files changed, 106 insertions(+), 6 deletions(-)
fs/nfs/client.c +1 -0
@@ -39,6 +39,7 @@#include <net/ipv6.h> #include <linux/nfs_xdr.h> #include <linux/sunrpc/bc_xprt.h> +#include <linux/nfs4_pnfs.h> #include <asm/system.h>
fs/nfs/file.c +1 -0
@@ -28,6 +28,7 @@#include <linux/aio.h> #include <linux/gfp.h> #include <linux/swap.h> +#include <linux/pnfs_xdr.h> #include <asm/uaccess.h> #include <asm/system.h>
fs/nfs/inode.c +9 -1
@@ -279,7 +279,7 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr)*/ inode->i_op =NFS_SB (sb)->nfs_client->rpc_ops->file_inode_ops;if (S_ISREG (inode->i_mode)) { - inode->i_fop = &nfs_file_operations; + inode->i_fop =NFS_SB (sb)->nfs_client->rpc_ops->file_ops; inode->i_data.a_ops = &nfs_file_aops; inode->i_data.backing_dev_info = &NFS_SB (sb)->backing_dev_info; }else if (S_ISDIR (inode->i_mode)) {
@@ -1207,6 +1207,14 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) server->fsid = fattr->fsid;/* +* file needs layout commit, server attributes may be stale +*/ +if (layoutcommit_needed (nfsi) && nfsi->change_attr >= fattr->change_attr) { +dprintk ("NFS: %s: layoutcommit is needed for file %s/%ld\n" , + __func__, inode->i_sb->s_id, inode->i_ino); +return 0 ; + } +/* * Update the read time so we don't revalidate too often. */ nfsi->read_cache_jiffies = fattr->time_start;
fs/nfs/nfs3proc.c +1 -0
@@ -833,6 +833,7 @@ const struct nfs_rpc_ops nfs_v3_clientops = { .dentry_ops = &nfs_dentry_operations, .dir_inode_ops = &nfs3_dir_inode_operations, .file_inode_ops = &nfs3_file_inode_operations, + .file_ops = &nfs_file_operations, .getroot = nfs3_proc_get_root, .getattr = nfs3_proc_getattr, .setattr = nfs3_proc_setattr,
fs/nfs/nfs4_fs.h +1 -0
@@ -334,6 +334,7 @@ extern void nfs_increment_lock_seqid(int status, struct nfs_seqid *seqid);extern void nfs_release_seqid (struct nfs_seqid *seqid);extern void nfs_free_seqid (struct nfs_seqid *seqid); +/* write.c */ extern const nfs4_stateid zero_stateid;/* nfs4xdr.c */
fs/nfs/nfs4filelayout.c +3 -0
@@ -65,6 +65,9 @@ MODULE_DESCRIPTION("The NFSv4 file layout driver");/* Callback operations to the pNFS client */ struct pnfs_client_operations *pnfs_callback_ops; +/* Forward declaration */ +struct layoutdriver_io_operations filelayout_io_operations; +int filelayout_initialize_mountpoint (struct nfs_client *clp) {
fs/nfs/nfs4filelayout.h +6 -0
@@ -22,6 +22,7 @@#define NFS4_PNFS_MAX_STRIPE_CNT 4096#define NFS4_PNFS_MAX_MULTI_CNT 64/* 256 fit into a u8 stripe_index */ +#define NFS4_PNFS_MAX_MULTI_DS 2#define FILE_DSADDR (lseg) (container_of(lseg->deviceid, \ struct nfs4_file_layout_dsaddr, \
@@ -50,6 +51,11 @@ struct nfs4_file_layout_dsaddr {struct nfs4_pnfs_ds *ds_list[1 ]; }; +struct nfs4_pnfs_dev_hlist { +rwlock_t dev_lock; +struct hlist_head dev_list[NFS4_PNFS_DEV_HASH_SIZE ]; +}; +struct nfs4_filelayout_segment {u32 stripe_type;u32 commit_through_mds;
fs/nfs/nfs4proc.c +2 -0
@@ -4711,6 +4711,7 @@ int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred)dprintk ("<-- %s status= %d\n" , __func__, status);return status; } +EXPORT_SYMBOL (nfs4_proc_exchange_id);struct nfs4_get_lease_time_data {struct nfs4_get_lease_time_args *args;
@@ -5887,6 +5888,7 @@ const struct nfs_rpc_ops nfs_v4_clientops = { .dentry_ops = &nfs4_dentry_operations, .dir_inode_ops = &nfs4_dir_inode_operations, .file_inode_ops = &nfs4_file_inode_operations, + .file_ops = &nfs_file_operations, .getroot = nfs4_proc_get_root, .getattr = nfs4_proc_getattr, .setattr = nfs4_proc_setattr,
fs/nfs/pnfs.h +15 -0
@@ -30,6 +30,8 @@ extern int pnfs4_proc_layoutcommit(struct pnfs_layoutcommit_data *data,extern int pnfs4_proc_layoutreturn (struct nfs4_pnfs_layoutreturn *lrp,bool wait);/* pnfs.c */ +extern const nfs4_stateid zero_stateid; +void put_lseg (struct pnfs_layout_segment *lseg); void _pnfs_update_layout(struct inode *ino, struct nfs_open_context *ctx, enum pnfs_iomode access_type,
@@ -69,6 +71,9 @@ void pnfs_get_layout_stateid(nfs4_stateid *dst, struct pnfs_layout_type *lo);#define PNFS_EXISTS_LDIO_OP (srv, opname) ((srv)->pnfs_curr_ld && \ (srv)->pnfs_curr_ld->ld_io_ops && \ (srv)->pnfs_curr_ld->ld_io_ops->opname) +#define PNFS_EXISTS_LDPOLICY_OP (srv, opname) ((srv)->pnfs_curr_ld && \ + (srv)->pnfs_curr_ld->ld_policy_ops && \ + (srv)->pnfs_curr_ld->ld_policy_ops->opname)#define LAYOUT_NFSV4_1_MODULE_PREFIX "nfs-layouttype4"
@@ -176,6 +181,16 @@ pnfs_try_to_commit(struct nfs_write_data *data,return PNFS_NOT_ATTEMPTED ; } +static inline int pnfs_get_write_status (struct nfs_write_data *data) +{ +return 0 ; +} + +static inline int pnfs_get_read_status (struct nfs_read_data *data) +{ +return 0 ; +} +static inline int pnfs_layoutcommit_inode (struct inode *inode,int sync) {return 0 ;
fs/nfs/proc.c +1 -0
@@ -694,6 +694,7 @@ const struct nfs_rpc_ops nfs_v2_clientops = { .dentry_ops = &nfs_dentry_operations, .dir_inode_ops = &nfs_dir_inode_operations, .file_inode_ops = &nfs_file_inode_operations, + .file_ops = &nfs_file_operations, .getroot = nfs_proc_get_root, .getattr = nfs_proc_getattr, .setattr = nfs_proc_setattr,
fs/nfs/super.c +25 -0
@@ -64,6 +64,7 @@#include "iostat.h" #include "internal.h" #include "fscache.h" +#include "pnfs.h" #define NFSDBG_FACILITY NFSDBG_VFS
@@ -669,6 +670,28 @@ static int nfs_show_options(struct seq_file *m, struct vfsmount *mnt)return 0 ; } +#ifdef CONFIG_NFS_V4_1 +void show_sessions (struct seq_file *m,struct nfs_server *server) +{ +if (nfs4_has_session (server->nfs_client)) +seq_printf (m,",sessions" ); +} +#else +void show_sessions (struct seq_file *m,struct nfs_server *server) {} +#endif + +#ifdef CONFIG_NFS_V4_1 +void show_pnfs (struct seq_file *m,struct nfs_server *server) +{ +seq_printf (m,",pnfs=" ); +if (server->pnfs_curr_ld) +seq_printf (m,"%s" , server->pnfs_curr_ld->name); +else +seq_printf (m,"not configured" ); +} +#else /* CONFIG_NFS_V4_1 */ +void show_pnfs (struct seq_file *m,struct nfs_server *server) {} +#endif /* CONFIG_NFS_V4_1 */ /* * Present statistical information for this VFS mountpoint
@@ -707,6 +730,8 @@ static int nfs_show_stats(struct seq_file *m, struct vfsmount *mnt)seq_printf (m,"bm0=0x%x" , nfss->attr_bitmask[0 ]);seq_printf (m,",bm1=0x%x" , nfss->attr_bitmask[1 ]);seq_printf (m,",acl=0x%x" , nfss->acl_bitmask); +show_sessions (m, nfss); + show_pnfs(m, nfss); }#endif
fs/nfs/write.c +9 -2
@@ -20,6 +20,7 @@#include <linux/nfs_mount.h> #include <linux/nfs_page.h> #include <linux/backing-dev.h> +#include <linux/module.h> #include <asm/uaccess.h>
@@ -68,6 +69,7 @@ void nfs_commit_free(struct nfs_write_data *p)kfree (p->pagevec);mempool_free (p, nfs_commit_mempool); } +EXPORT_SYMBOL (nfs_commit_free);struct nfs_write_data *nfs_writedata_alloc (unsigned int pagecount) {
@@ -1252,6 +1254,9 @@ int nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data)if (task->tk_status >=0 && resp->count < argp->count) {static unsigned long complain; +dprintk ("NFS: short write:" +" (resp->count %u) < (argp->count = %u)\n" , + resp->count, argp->count);nfs_inc_stats (data->inode,NFSIOS_SHORTWRITE );/* Has the server at least made some progress? */
@@ -1268,7 +1273,7 @@ int nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data)*/ argp->stable =NFS_FILE_SYNC ; } -nfs_restart_rpc (task, server->nfs_client); +nfs_restart_rpc (task, clp);return -EAGAIN ; }if (time_before (complain, jiffies)) {
@@ -1607,6 +1612,7 @@ int nfs_write_inode(struct inode *inode, struct writeback_control *wbc)*/ int nfs_wb_all (struct inode *inode) { +int ret;struct writeback_control wbc = { .sync_mode =WB_SYNC_ALL , .nr_to_write =LONG_MAX ,
@@ -1614,7 +1620,8 @@ int nfs_wb_all(struct inode *inode) .range_end = LLONG_MAX, }; -return sync_inode (inode, &wbc); + ret =sync_inode (inode, &wbc); +return ret; }int nfs_wb_page_cancel (struct inode *inode,struct page *page)
include/linux/nfs4.h +9 -0
@@ -492,6 +492,7 @@ enum lock_type4 {#define FATTR4_WORD1_TIME_MODIFY_SET (1UL << 22)#define FATTR4_WORD1_MOUNTED_ON_FILEID (1UL << 23)#define FATTR4_WORD1_FS_LAYOUT_TYPES (1UL << 30) +#define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1)#define NFSPROC4_NULL 0#define NFSPROC4_COMPOUND 1
@@ -606,6 +607,14 @@ enum pnfs_notify_deviceid_type4 {#define NFL4_UFLG_COMMIT_THRU_MDS 0x00000002#define NFL4_UFLG_STRIPE_UNIT_SIZE_MASK 0xFFFFFFC0 +/* Encoded in the loh_body field of type layouthint4 */ +enum filelayout_hint_care4 { +NFLH4_CARE_DENSE =NFL4_UFLG_DENSE , +NFLH4_CARE_COMMIT_THRU_MDS =NFL4_UFLG_COMMIT_THRU_MDS , +NFLH4_CARE_STRIPE_UNIT_SIZE =0x00000040 , +NFLH4_CARE_STRIPE_COUNT =0x00000080 +}; +#endif #endif
include/linux/nfs4_pnfs.h +18 -0
@@ -20,6 +20,8 @@ enum pnfs_try_status { PNFS_NOT_ATTEMPTED = 1, }; +#define NFS4_PNFS_GETDEVLIST_MAXNUM 16 +/* Per-layout driver specific registration structure */ struct pnfs_layoutdriver_type {const u32 id;
@@ -60,6 +62,12 @@ PNFS_LD_IO_OPS(struct pnfs_layout_type *lo)return PNFS_LD (lo)->ld_io_ops; } +static inline struct layoutdriver_policy_operations * +PNFS_LD_POLICY_OPS (struct pnfs_layout_type *lo) +{ +return PNFS_LD (lo)->ld_policy_ops; +} +static inline bool has_layout (struct nfs_inode *nfsi) {
@@ -165,6 +173,12 @@ struct pnfs_device {unsigned int dev_notify_types; }; +struct pnfs_devicelist { +unsigned int eof; +unsigned int num_devs; +struct pnfs_deviceid dev_id[NFS4_PNFS_GETDEVLIST_MAXNUM ]; +}; +/* * Device ID RCU cache. A device ID is unique per client ID and layout type. */
@@ -222,6 +236,7 @@ extern void nfs4_unset_layout_deviceid(struct pnfs_layout_segment *,struct pnfs_client_operations {int (*nfs_getdeviceinfo) (struct nfs_server *,struct pnfs_device *dev); +void (*nfs_return_layout) (struct inode *); };extern struct pnfs_client_operations pnfs_ops;
@@ -229,4 +244,7 @@ extern struct pnfs_client_operations pnfs_ops;extern struct pnfs_client_operations *pnfs_register_layoutdriver (struct pnfs_layoutdriver_type *);extern void pnfs_unregister_layoutdriver (struct pnfs_layoutdriver_type *); +#define NFS4_PNFS_MAX_LAYOUTS 4 +#define NFS4_PNFS_PRIVATE_LAYOUT 0x80000000 +#endif /* LINUX_NFS4_PNFS_H */
include/linux/nfs_xdr.h +2 -0
@@ -1046,6 +1046,7 @@ struct nfs_rpc_ops {const struct dentry_operations *dentry_ops;const struct inode_operations *dir_inode_ops;const struct inode_operations *file_inode_ops; +const struct file_operations *file_ops;int (*getroot) (struct nfs_server *,struct nfs_fh *,struct nfs_fsinfo *);
@@ -1110,6 +1111,7 @@ struct nfs_rpc_ops {extern const struct nfs_rpc_ops nfs_v2_clientops;extern const struct nfs_rpc_ops nfs_v3_clientops;extern const struct nfs_rpc_ops nfs_v4_clientops; +extern const struct nfs_rpc_ops pnfs_v4_clientops;extern struct rpc_version nfs_version2;extern struct rpc_version nfs_version3;extern struct rpc_version nfs_version4;
include/linux/pnfs_xdr.h +3 -3
@@ -89,9 +89,9 @@ struct pnfs_layoutcommit_data { };struct nfs4_pnfs_layoutreturn_arg { -__u32 reclaim; -__u32 layout_type; -__u32 return_type; +__u32 reclaim; +__u32 layout_type; +__u32 return_type;struct nfs4_pnfs_layout_segment lseg;struct inode *inode;struct nfs4_sequence_args seq_args;
Signature · 1 line
1.6.2.5
Re: [PATCH 50/50] SQUASHME pnfs_submit: remove this unused code
Andy, I'm not sure everything in this patch can be dropped. Please see comments below.
Thanks!
Quoted 64 lines · On Aug. 14, 2010, 0:32 +0300, [email protected] wrote:
From: Andy Adamson <[email protected]>
Signed-off-by Andy Adamson <[email protected]>--- fs/nfs/client.c | 1 + fs/nfs/file.c | 1 + fs/nfs/inode.c | 10 +++++++++- fs/nfs/nfs3proc.c | 1 + fs/nfs/nfs4_fs.h | 1 + fs/nfs/nfs4filelayout.c | 3 +++ fs/nfs/nfs4filelayout.h | 6 ++++++ fs/nfs/nfs4proc.c | 2 ++ fs/nfs/pnfs.h | 15 +++++++++++++++ fs/nfs/proc.c | 1 + fs/nfs/super.c | 25 +++++++++++++++++++++++++ fs/nfs/write.c | 11 +++++++++-- include/linux/nfs4.h | 9 +++++++++ include/linux/nfs4_pnfs.h | 18 ++++++++++++++++++ include/linux/nfs_xdr.h | 2 ++ include/linux/pnfs_xdr.h | 6 +++--- 16 files changed, 106 insertions(+), 6 deletions(-)fs/nfs/client.c +1
-0@@ -39,6 +39,7 @@#include <net/ipv6.h> #include <linux/nfs_xdr.h> #include <linux/sunrpc/bc_xprt.h> +#include <linux/nfs4_pnfs.h> #include <asm/system.h> fs/nfs/file.c +1
-0@@ -28,6 +28,7 @@#include <linux/aio.h> #include <linux/gfp.h> #include <linux/swap.h> +#include <linux/pnfs_xdr.h> #include <asm/uaccess.h> #include <asm/system.h> fs/nfs/inode.c +2
-1@@ -279,7 +279,7 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr)*/ inode->i_op =NFS_SB (sb)->nfs_client->rpc_ops->file_inode_ops;if (S_ISREG (inode->i_mode)) { - inode->i_fop = &nfs_file_operations; + inode->i_fop =NFS_SB (sb)->nfs_client->rpc_ops->file_ops; inode->i_data.a_ops = &nfs_file_aops; inode->i_data.backing_dev_info = &NFS_SB (sb)->backing_dev_info; }else if (S_ISDIR (inode->i_mode)) {@@ -1207,6 +1207,14 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) server->fsid = fattr->fsid;/* +* file needs layout commit, server attributes may be stale
fs/nfs/inode.c static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) · line 1220
Quoted 10 lines
fs/nfs/inode.c +7
-0+*/ +if (layoutcommit_needed (nfsi) && nfsi->change_attr >= fattr->change_attr) { +dprintk ("NFS: %s: layoutcommit is needed for file %s/%ld\n" , + __func__, inode->i_sb->s_id, inode->i_ino); +return 0 ; + } +/* * Update the read time so we don't revalidate too often. */ nfsi->read_cache_jiffies = fattr->time_start;
Why isn't this needed?
Quoted 176 lines
fs/nfs/nfs3proc.c +1
-0@@ -833,6 +833,7 @@ const struct nfs_rpc_ops nfs_v3_clientops = { .dentry_ops = &nfs_dentry_operations, .dir_inode_ops = &nfs3_dir_inode_operations, .file_inode_ops = &nfs3_file_inode_operations, + .file_ops = &nfs_file_operations, .getroot = nfs3_proc_get_root, .getattr = nfs3_proc_getattr, .setattr = nfs3_proc_setattr,fs/nfs/nfs4_fs.h +1
-0@@ -334,6 +334,7 @@ extern void nfs_increment_lock_seqid(int status, struct nfs_seqid *seqid);extern void nfs_release_seqid (struct nfs_seqid *seqid);extern void nfs_free_seqid (struct nfs_seqid *seqid); +/* write.c */ extern const nfs4_stateid zero_stateid;/* nfs4xdr.c */ fs/nfs/nfs4filelayout.c +3
-0@@ -65,6 +65,9 @@ MODULE_DESCRIPTION("The NFSv4 file layout driver");/* Callback operations to the pNFS client */ struct pnfs_client_operations *pnfs_callback_ops; +/* Forward declaration */ +struct layoutdriver_io_operations filelayout_io_operations; +int filelayout_initialize_mountpoint (struct nfs_client *clp) {fs/nfs/nfs4filelayout.h +6
-0@@ -22,6 +22,7 @@#define NFS4_PNFS_MAX_STRIPE_CNT 4096#define NFS4_PNFS_MAX_MULTI_CNT 64/* 256 fit into a u8 stripe_index */ +#define NFS4_PNFS_MAX_MULTI_DS 2#define FILE_DSADDR (lseg) (container_of(lseg->deviceid, \ struct nfs4_file_layout_dsaddr, \@@ -50,6 +51,11 @@ struct nfs4_file_layout_dsaddr {struct nfs4_pnfs_ds *ds_list[1 ]; }; +struct nfs4_pnfs_dev_hlist { +rwlock_t dev_lock; +struct hlist_head dev_list[NFS4_PNFS_DEV_HASH_SIZE ]; +}; +struct nfs4_filelayout_segment {u32 stripe_type;u32 commit_through_mds;fs/nfs/nfs4proc.c +2
-0@@ -4711,6 +4711,7 @@ int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred)dprintk ("<-- %s status= %d\n" , __func__, status);return status; } +EXPORT_SYMBOL (nfs4_proc_exchange_id);struct nfs4_get_lease_time_data {struct nfs4_get_lease_time_args *args;@@ -5887,6 +5888,7 @@ const struct nfs_rpc_ops nfs_v4_clientops = { .dentry_ops = &nfs4_dentry_operations, .dir_inode_ops = &nfs4_dir_inode_operations, .file_inode_ops = &nfs4_file_inode_operations, + .file_ops = &nfs_file_operations, .getroot = nfs4_proc_get_root, .getattr = nfs4_proc_getattr, .setattr = nfs4_proc_setattr,fs/nfs/pnfs.h +15
-0@@ -30,6 +30,8 @@ extern int pnfs4_proc_layoutcommit(struct pnfs_layoutcommit_data *data,extern int pnfs4_proc_layoutreturn (struct nfs4_pnfs_layoutreturn *lrp,bool wait);/* pnfs.c */ +extern const nfs4_stateid zero_stateid; +void put_lseg (struct pnfs_layout_segment *lseg); void _pnfs_update_layout(struct inode *ino, struct nfs_open_context *ctx, enum pnfs_iomode access_type,@@ -69,6 +71,9 @@ void pnfs_get_layout_stateid(nfs4_stateid *dst, struct pnfs_layout_type *lo);#define PNFS_EXISTS_LDIO_OP (srv, opname) ((srv)->pnfs_curr_ld && \ (srv)->pnfs_curr_ld->ld_io_ops && \ (srv)->pnfs_curr_ld->ld_io_ops->opname) +#define PNFS_EXISTS_LDPOLICY_OP (srv, opname) ((srv)->pnfs_curr_ld && \ + (srv)->pnfs_curr_ld->ld_policy_ops && \ + (srv)->pnfs_curr_ld->ld_policy_ops->opname)#define LAYOUT_NFSV4_1_MODULE_PREFIX "nfs-layouttype4"@@ -176,6 +181,16 @@ pnfs_try_to_commit(struct nfs_write_data *data,return PNFS_NOT_ATTEMPTED ; } +static inline int pnfs_get_write_status (struct nfs_write_data *data) +{ +return 0 ; +} + +static inline int pnfs_get_read_status (struct nfs_read_data *data) +{ +return 0 ; +} +static inline int pnfs_layoutcommit_inode (struct inode *inode,int sync) {return 0 ;fs/nfs/proc.c +1
-0@@ -694,6 +694,7 @@ const struct nfs_rpc_ops nfs_v2_clientops = { .dentry_ops = &nfs_dentry_operations, .dir_inode_ops = &nfs_dir_inode_operations, .file_inode_ops = &nfs_file_inode_operations, + .file_ops = &nfs_file_operations, .getroot = nfs_proc_get_root, .getattr = nfs_proc_getattr, .setattr = nfs_proc_setattr,fs/nfs/super.c +23
-0@@ -64,6 +64,7 @@#include "iostat.h" #include "internal.h" #include "fscache.h" +#include "pnfs.h" #define NFSDBG_FACILITY NFSDBG_VFS@@ -669,6 +670,28 @@ static int nfs_show_options(struct seq_file *m, struct vfsmount *mnt)return 0 ; } +#ifdef CONFIG_NFS_V4_1 +void show_sessions (struct seq_file *m,struct nfs_server *server) +{ +if (nfs4_has_session (server->nfs_client)) +seq_printf (m,",sessions" ); +} +#else +void show_sessions (struct seq_file *m,struct nfs_server *server) {} +#endif + +#ifdef CONFIG_NFS_V4_1 +void show_pnfs (struct seq_file *m,struct nfs_server *server) +{ +seq_printf (m,",pnfs=" ); +if (server->pnfs_curr_ld) +seq_printf (m,"%s" , server->pnfs_curr_ld->name); +else +seq_printf (m,"not configured" ); +} +#else /* CONFIG_NFS_V4_1 */ +void show_pnfs (struct seq_file *m,struct nfs_server *server) {} +#endif /* CONFIG_NFS_V4_1 */ /* * Present statistical information for this VFS mountpoint
fs/nfs/super.c static int nfs_show_stats(struct seq_file *m, struct vfsmount *mnt) · line 734
Quoted 5 lines
fs/nfs/super.c +2
-0@@ -707,6 +730,8 @@ static int nfs_show_stats(struct seq_file *m, struct vfsmount *mnt)seq_printf (m,"bm0=0x%x" , nfss->attr_bitmask[0 ]);seq_printf (m,",bm1=0x%x" , nfss->attr_bitmask[1 ]);seq_printf (m,",acl=0x%x" , nfss->acl_bitmask); +show_sessions (m, nfss); +show_pnfs (m, nfss);
This is part of "9121554 pnfs: client stats" sent by Bruce. why drop it?
Quoted 74 lines
fs/nfs/super.c +0
-0}#endif fs/nfs/write.c +9
-2@@ -20,6 +20,7 @@#include <linux/nfs_mount.h> #include <linux/nfs_page.h> #include <linux/backing-dev.h> +#include <linux/module.h> #include <asm/uaccess.h> @@ -68,6 +69,7 @@ void nfs_commit_free(struct nfs_write_data *p)kfree (p->pagevec);mempool_free (p, nfs_commit_mempool); } +EXPORT_SYMBOL (nfs_commit_free);struct nfs_write_data *nfs_writedata_alloc (unsigned int pagecount) {@@ -1252,6 +1254,9 @@ int nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data)if (task->tk_status >=0 && resp->count < argp->count) {static unsigned long complain; +dprintk ("NFS: short write:" +" (resp->count %u) < (argp->count = %u)\n" , + resp->count, argp->count);nfs_inc_stats (data->inode,NFSIOS_SHORTWRITE );/* Has the server at least made some progress? */ @@ -1268,7 +1273,7 @@ int nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data)*/ argp->stable =NFS_FILE_SYNC ; } -nfs_restart_rpc (task, server->nfs_client); +nfs_restart_rpc (task, clp);return -EAGAIN ; }if (time_before (complain, jiffies)) {@@ -1607,6 +1612,7 @@ int nfs_write_inode(struct inode *inode, struct writeback_control *wbc)*/ int nfs_wb_all (struct inode *inode) { +int ret;struct writeback_control wbc = { .sync_mode =WB_SYNC_ALL , .nr_to_write =LONG_MAX ,@@ -1614,7 +1620,8 @@ int nfs_wb_all(struct inode *inode) .range_end = LLONG_MAX, }; -return sync_inode (inode, &wbc); + ret =sync_inode (inode, &wbc); +return ret; }int nfs_wb_page_cancel (struct inode *inode,struct page *page)include/linux/nfs4.h +1
-0@@ -492,6 +492,7 @@ enum lock_type4 {#define FATTR4_WORD1_TIME_MODIFY_SET (1UL << 22)#define FATTR4_WORD1_MOUNTED_ON_FILEID (1UL << 23)#define FATTR4_WORD1_FS_LAYOUT_TYPES (1UL << 30) +#define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1)#define NFSPROC4_NULL 0#define NFSPROC4_COMPOUND 1@@ -606,6 +607,14 @@ enum pnfs_notify_deviceid_type4 {#define NFL4_UFLG_COMMIT_THRU_MDS 0x00000002
include/linux/nfs4.h enum pnfs_notify_deviceid_type4 { · line 617
Quoted 10 lines
include/linux/nfs4.h +8
-0#define NFL4_UFLG_STRIPE_UNIT_SIZE_MASK 0xFFFFFFC0 +/* Encoded in the loh_body field of type layouthint4 */ +enum filelayout_hint_care4 { +NFLH4_CARE_DENSE =NFL4_UFLG_DENSE , +NFLH4_CARE_COMMIT_THRU_MDS =NFL4_UFLG_COMMIT_THRU_MDS , +NFLH4_CARE_STRIPE_UNIT_SIZE =0x00000040 , +NFLH4_CARE_STRIPE_COUNT =0x00000080 +}; +
We better leave the definitions in the header as they are part of the protocol even if we don't make use of them in the patchset, for completeness (and it causes me major headache to rebase on top of the pnfsd branch which has these defs :)
Quoted 51 lines
include/linux/nfs4.h +0
-0#endif #endif include/linux/nfs4_pnfs.h +15
-0@@ -20,6 +20,8 @@ enum pnfs_try_status { PNFS_NOT_ATTEMPTED = 1, }; +#define NFS4_PNFS_GETDEVLIST_MAXNUM 16 +/* Per-layout driver specific registration structure */ struct pnfs_layoutdriver_type {const u32 id;@@ -60,6 +62,12 @@ PNFS_LD_IO_OPS(struct pnfs_layout_type *lo)return PNFS_LD (lo)->ld_io_ops; } +static inline struct layoutdriver_policy_operations * +PNFS_LD_POLICY_OPS (struct pnfs_layout_type *lo) +{ +return PNFS_LD (lo)->ld_policy_ops; +} +static inline bool has_layout (struct nfs_inode *nfsi) {@@ -165,6 +173,12 @@ struct pnfs_device {unsigned int dev_notify_types; }; +struct pnfs_devicelist { +unsigned int eof; +unsigned int num_devs; +struct pnfs_deviceid dev_id[NFS4_PNFS_GETDEVLIST_MAXNUM ]; +}; +/* * Device ID RCU cache. A device ID is unique per client ID and layout type. */ @@ -222,6 +236,7 @@ extern void nfs4_unset_layout_deviceid(struct pnfs_layout_segment *,struct pnfs_client_operations {int (*nfs_getdeviceinfo) (struct nfs_server *,struct pnfs_device *dev); +void (*nfs_return_layout) (struct inode *); };extern struct pnfs_client_operations pnfs_ops;
include/linux/nfs4_pnfs.h extern struct pnfs_client_operations pnfs_ops; · line 249
Quoted 6 lines
include/linux/nfs4_pnfs.h +3
-0@@ -229,4 +244,7 @@ extern struct pnfs_client_operations pnfs_ops;extern struct pnfs_client_operations *pnfs_register_layoutdriver (struct pnfs_layoutdriver_type *);extern void pnfs_unregister_layoutdriver (struct pnfs_layoutdriver_type *); +#define NFS4_PNFS_MAX_LAYOUTS 4 +#define NFS4_PNFS_PRIVATE_LAYOUT 0x80000000 +
we use that post submit.
[the private layout range can actually be defined in nfs4.h]
Benny
Quoted 38 lines
include/linux/nfs4_pnfs.h +0
-0#endif /* LINUX_NFS4_PNFS_H */ include/linux/nfs_xdr.h +2
-0@@ -1046,6 +1046,7 @@ struct nfs_rpc_ops {const struct dentry_operations *dentry_ops;const struct inode_operations *dir_inode_ops;const struct inode_operations *file_inode_ops; +const struct file_operations *file_ops;int (*getroot) (struct nfs_server *,struct nfs_fh *,struct nfs_fsinfo *);@@ -1110,6 +1111,7 @@ struct nfs_rpc_ops {extern const struct nfs_rpc_ops nfs_v2_clientops;extern const struct nfs_rpc_ops nfs_v3_clientops;extern const struct nfs_rpc_ops nfs_v4_clientops; +extern const struct nfs_rpc_ops pnfs_v4_clientops;extern struct rpc_version nfs_version2;extern struct rpc_version nfs_version3;extern struct rpc_version nfs_version4;include/linux/pnfs_xdr.h +3
-3@@ -89,9 +89,9 @@ struct pnfs_layoutcommit_data { };struct nfs4_pnfs_layoutreturn_arg { -__u32 reclaim; -__u32 layout_type; -__u32 return_type; +__u32 reclaim; +__u32 layout_type; +__u32 return_type;struct nfs4_pnfs_layout_segment lseg;struct inode *inode;struct nfs4_sequence_args seq_args;
Re: [PATCH 50/50] SQUASHME pnfs_submit: remove this unused code
In reply to [email protected]Quoted 91 lines · On 08/14/2010 12:32 AM, [email protected] wrote:
From: Andy Adamson <[email protected]>
Signed-off-by Andy Adamson <[email protected]>--- fs/nfs/client.c | 1 + fs/nfs/file.c | 1 + fs/nfs/inode.c | 10 +++++++++- fs/nfs/nfs3proc.c | 1 + fs/nfs/nfs4_fs.h | 1 + fs/nfs/nfs4filelayout.c | 3 +++ fs/nfs/nfs4filelayout.h | 6 ++++++ fs/nfs/nfs4proc.c | 2 ++ fs/nfs/pnfs.h | 15 +++++++++++++++ fs/nfs/proc.c | 1 + fs/nfs/super.c | 25 +++++++++++++++++++++++++ fs/nfs/write.c | 11 +++++++++-- include/linux/nfs4.h | 9 +++++++++ include/linux/nfs4_pnfs.h | 18 ++++++++++++++++++ include/linux/nfs_xdr.h | 2 ++ include/linux/pnfs_xdr.h | 6 +++--- 16 files changed, 106 insertions(+), 6 deletions(-)fs/nfs/client.c +1
-0@@ -39,6 +39,7 @@#include <net/ipv6.h> #include <linux/nfs_xdr.h> #include <linux/sunrpc/bc_xprt.h> +#include <linux/nfs4_pnfs.h> #include <asm/system.h> fs/nfs/file.c +1
-0@@ -28,6 +28,7 @@#include <linux/aio.h> #include <linux/gfp.h> #include <linux/swap.h> +#include <linux/pnfs_xdr.h> #include <asm/uaccess.h> #include <asm/system.h> fs/nfs/inode.c +9
-1@@ -279,7 +279,7 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr)*/ inode->i_op =NFS_SB (sb)->nfs_client->rpc_ops->file_inode_ops;if (S_ISREG (inode->i_mode)) { - inode->i_fop = &nfs_file_operations; + inode->i_fop =NFS_SB (sb)->nfs_client->rpc_ops->file_ops; inode->i_data.a_ops = &nfs_file_aops; inode->i_data.backing_dev_info = &NFS_SB (sb)->backing_dev_info; }else if (S_ISDIR (inode->i_mode)) {@@ -1207,6 +1207,14 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) server->fsid = fattr->fsid;/* +* file needs layout commit, server attributes may be stale +*/ +if (layoutcommit_needed (nfsi) && nfsi->change_attr >= fattr->change_attr) { +dprintk ("NFS: %s: layoutcommit is needed for file %s/%ld\n" , + __func__, inode->i_sb->s_id, inode->i_ino); +return 0 ; + } +/* * Update the read time so we don't revalidate too often. */ nfsi->read_cache_jiffies = fattr->time_start;fs/nfs/nfs3proc.c +1
-0@@ -833,6 +833,7 @@ const struct nfs_rpc_ops nfs_v3_clientops = { .dentry_ops = &nfs_dentry_operations, .dir_inode_ops = &nfs3_dir_inode_operations, .file_inode_ops = &nfs3_file_inode_operations, + .file_ops = &nfs_file_operations, .getroot = nfs3_proc_get_root, .getattr = nfs3_proc_getattr, .setattr = nfs3_proc_setattr,fs/nfs/nfs4_fs.h +0
-0
fs/nfs/nfs4_fs.h extern void nfs_increment_lock_seqid(int status, struct nfs_seqid *seqid); · line 337
Quoted 4 lines
fs/nfs/nfs4_fs.h +1
-0@@ -334,6 +334,7 @@ extern void nfs_increment_lock_seqid(int status, struct nfs_seqid *seqid);extern void nfs_release_seqid (struct nfs_seqid *seqid);extern void nfs_free_seqid (struct nfs_seqid *seqid); +/* write.c */
A comment was removed, but is needed back just by itself? What changed?
fs/nfs/nfs4filelayout.c MODULE_DESCRIPTION("The NFSv4 file layout driver"); · line 68
Quoted 12 lines
fs/nfs/nfs4_fs.h +0
-0extern const nfs4_stateid zero_stateid;/* nfs4xdr.c */ fs/nfs/nfs4filelayout.c +1
-0@@ -65,6 +65,9 @@ MODULE_DESCRIPTION("The NFSv4 file layout driver");/* Callback operations to the pNFS client */ struct pnfs_client_operations *pnfs_callback_ops; +/* Forward declaration */
I'm not sure we need the comment
fs/nfs/nfs4filelayout.c MODULE_DESCRIPTION("The NFSv4 file layout driver"); · line 70
Quoted 2 lines
fs/nfs/nfs4filelayout.c +2
-0+struct layoutdriver_io_operations filelayout_io_operations; +
Forward declaration in a .c file are we missing a "static"?
Quoted 180 lines
fs/nfs/nfs4filelayout.c +0
-0int filelayout_initialize_mountpoint (struct nfs_client *clp) {fs/nfs/nfs4filelayout.h +6
-0@@ -22,6 +22,7 @@#define NFS4_PNFS_MAX_STRIPE_CNT 4096#define NFS4_PNFS_MAX_MULTI_CNT 64/* 256 fit into a u8 stripe_index */ +#define NFS4_PNFS_MAX_MULTI_DS 2#define FILE_DSADDR (lseg) (container_of(lseg->deviceid, \ struct nfs4_file_layout_dsaddr, \@@ -50,6 +51,11 @@ struct nfs4_file_layout_dsaddr {struct nfs4_pnfs_ds *ds_list[1 ]; }; +struct nfs4_pnfs_dev_hlist { +rwlock_t dev_lock; +struct hlist_head dev_list[NFS4_PNFS_DEV_HASH_SIZE ]; +}; +struct nfs4_filelayout_segment {u32 stripe_type;u32 commit_through_mds;fs/nfs/nfs4proc.c +2
-0@@ -4711,6 +4711,7 @@ int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred)dprintk ("<-- %s status= %d\n" , __func__, status);return status; } +EXPORT_SYMBOL (nfs4_proc_exchange_id);struct nfs4_get_lease_time_data {struct nfs4_get_lease_time_args *args;@@ -5887,6 +5888,7 @@ const struct nfs_rpc_ops nfs_v4_clientops = { .dentry_ops = &nfs4_dentry_operations, .dir_inode_ops = &nfs4_dir_inode_operations, .file_inode_ops = &nfs4_file_inode_operations, + .file_ops = &nfs_file_operations, .getroot = nfs4_proc_get_root, .getattr = nfs4_proc_getattr, .setattr = nfs4_proc_setattr,fs/nfs/pnfs.h +15
-0@@ -30,6 +30,8 @@ extern int pnfs4_proc_layoutcommit(struct pnfs_layoutcommit_data *data,extern int pnfs4_proc_layoutreturn (struct nfs4_pnfs_layoutreturn *lrp,bool wait);/* pnfs.c */ +extern const nfs4_stateid zero_stateid; +void put_lseg (struct pnfs_layout_segment *lseg); void _pnfs_update_layout(struct inode *ino, struct nfs_open_context *ctx, enum pnfs_iomode access_type,@@ -69,6 +71,9 @@ void pnfs_get_layout_stateid(nfs4_stateid *dst, struct pnfs_layout_type *lo);#define PNFS_EXISTS_LDIO_OP (srv, opname) ((srv)->pnfs_curr_ld && \ (srv)->pnfs_curr_ld->ld_io_ops && \ (srv)->pnfs_curr_ld->ld_io_ops->opname) +#define PNFS_EXISTS_LDPOLICY_OP (srv, opname) ((srv)->pnfs_curr_ld && \ + (srv)->pnfs_curr_ld->ld_policy_ops && \ + (srv)->pnfs_curr_ld->ld_policy_ops->opname)#define LAYOUT_NFSV4_1_MODULE_PREFIX "nfs-layouttype4"@@ -176,6 +181,16 @@ pnfs_try_to_commit(struct nfs_write_data *data,return PNFS_NOT_ATTEMPTED ; } +static inline int pnfs_get_write_status (struct nfs_write_data *data) +{ +return 0 ; +} + +static inline int pnfs_get_read_status (struct nfs_read_data *data) +{ +return 0 ; +} +static inline int pnfs_layoutcommit_inode (struct inode *inode,int sync) {return 0 ;fs/nfs/proc.c +1
-0@@ -694,6 +694,7 @@ const struct nfs_rpc_ops nfs_v2_clientops = { .dentry_ops = &nfs_dentry_operations, .dir_inode_ops = &nfs_dir_inode_operations, .file_inode_ops = &nfs_file_inode_operations, + .file_ops = &nfs_file_operations, .getroot = nfs_proc_get_root, .getattr = nfs_proc_getattr, .setattr = nfs_proc_setattr,fs/nfs/super.c +25
-0@@ -64,6 +64,7 @@#include "iostat.h" #include "internal.h" #include "fscache.h" +#include "pnfs.h" #define NFSDBG_FACILITY NFSDBG_VFS@@ -669,6 +670,28 @@ static int nfs_show_options(struct seq_file *m, struct vfsmount *mnt)return 0 ; } +#ifdef CONFIG_NFS_V4_1 +void show_sessions (struct seq_file *m,struct nfs_server *server) +{ +if (nfs4_has_session (server->nfs_client)) +seq_printf (m,",sessions" ); +} +#else +void show_sessions (struct seq_file *m,struct nfs_server *server) {} +#endif + +#ifdef CONFIG_NFS_V4_1 +void show_pnfs (struct seq_file *m,struct nfs_server *server) +{ +seq_printf (m,",pnfs=" ); +if (server->pnfs_curr_ld) +seq_printf (m,"%s" , server->pnfs_curr_ld->name); +else +seq_printf (m,"not configured" ); +} +#else /* CONFIG_NFS_V4_1 */ +void show_pnfs (struct seq_file *m,struct nfs_server *server) {} +#endif /* CONFIG_NFS_V4_1 */ /* * Present statistical information for this VFS mountpoint @@ -707,6 +730,8 @@ static int nfs_show_stats(struct seq_file *m, struct vfsmount *mnt)seq_printf (m,"bm0=0x%x" , nfss->attr_bitmask[0 ]);seq_printf (m,",bm1=0x%x" , nfss->attr_bitmask[1 ]);seq_printf (m,",acl=0x%x" , nfss->acl_bitmask); +show_sessions (m, nfss); + show_pnfs(m, nfss); }#endif fs/nfs/write.c +5
-0@@ -20,6 +20,7 @@#include <linux/nfs_mount.h> #include <linux/nfs_page.h> #include <linux/backing-dev.h> +#include <linux/module.h> #include <asm/uaccess.h> @@ -68,6 +69,7 @@ void nfs_commit_free(struct nfs_write_data *p)kfree (p->pagevec);mempool_free (p, nfs_commit_mempool); } +EXPORT_SYMBOL (nfs_commit_free);struct nfs_write_data *nfs_writedata_alloc (unsigned int pagecount) {@@ -1252,6 +1254,9 @@ int nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data)if (task->tk_status >=0 && resp->count < argp->count) {static unsigned long complain; +dprintk ("NFS: short write:" +" (resp->count %u) < (argp->count = %u)\n" , + resp->count, argp->count);nfs_inc_stats (data->inode,NFSIOS_SHORTWRITE );/* Has the server at least made some progress? */
fs/nfs/write.c int nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data) · line 1276
Quoted 5 lines
fs/nfs/write.c +1
-1@@ -1268,7 +1273,7 @@ int nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data)*/ argp->stable =NFS_FILE_SYNC ; } -nfs_restart_rpc (task, server->nfs_client); +nfs_restart_rpc (task, clp);
OK, I admit, I don't understand what happened here?
Quoted 12 lines
fs/nfs/write.c +1
-0return -EAGAIN ; }if (time_before (complain, jiffies)) {@@ -1607,6 +1612,7 @@ int nfs_write_inode(struct inode *inode, struct writeback_control *wbc)*/ int nfs_wb_all (struct inode *inode) { +int ret;struct writeback_control wbc = { .sync_mode =WB_SYNC_ALL , .nr_to_write =LONG_MAX ,
fs/nfs/write.c int nfs_wb_all(struct inode *inode) · line 1624
Quoted 6 lines
fs/nfs/write.c +2
-1@@ -1614,7 +1620,8 @@ int nfs_wb_all(struct inode *inode) .range_end = LLONG_MAX, }; -return sync_inode (inode, &wbc); + ret =sync_inode (inode, &wbc); +return ret;
Why is this needed back in?
Quoted 20 lines
fs/nfs/write.c +0
-0}int nfs_wb_page_cancel (struct inode *inode,struct page *page)include/linux/nfs4.h +2
-0@@ -492,6 +492,7 @@ enum lock_type4 {#define FATTR4_WORD1_TIME_MODIFY_SET (1UL << 22)#define FATTR4_WORD1_MOUNTED_ON_FILEID (1UL << 23)#define FATTR4_WORD1_FS_LAYOUT_TYPES (1UL << 30) +#define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1)#define NFSPROC4_NULL 0#define NFSPROC4_COMPOUND 1@@ -606,6 +607,14 @@ enum pnfs_notify_deviceid_type4 {#define NFL4_UFLG_COMMIT_THRU_MDS 0x00000002#define NFL4_UFLG_STRIPE_UNIT_SIZE_MASK 0xFFFFFFC0 +/* Encoded in the loh_body field of type layouthint4 */
include/linux/nfs4.h enum pnfs_notify_deviceid_type4 { · line 620
Quoted 10 lines
include/linux/nfs4.h +7
-0+enum filelayout_hint_care4 { +NFLH4_CARE_DENSE =NFL4_UFLG_DENSE , +NFLH4_CARE_COMMIT_THRU_MDS =NFL4_UFLG_COMMIT_THRU_MDS , +NFLH4_CARE_STRIPE_UNIT_SIZE =0x00000040 , +NFLH4_CARE_STRIPE_COUNT =0x00000080 +}; +#endif #endif
Please, again don't split out the STD definitions. Even if not yet used I don't see the point. I do see why it's bad, it forces the developer to read the STD instead of trusting an header for been complete and accurate.
Quoted 80 lines
include/linux/nfs4_pnfs.h +18
-0@@ -20,6 +20,8 @@ enum pnfs_try_status { PNFS_NOT_ATTEMPTED = 1, }; +#define NFS4_PNFS_GETDEVLIST_MAXNUM 16 +/* Per-layout driver specific registration structure */ struct pnfs_layoutdriver_type {const u32 id;@@ -60,6 +62,12 @@ PNFS_LD_IO_OPS(struct pnfs_layout_type *lo)return PNFS_LD (lo)->ld_io_ops; } +static inline struct layoutdriver_policy_operations * +PNFS_LD_POLICY_OPS (struct pnfs_layout_type *lo) +{ +return PNFS_LD (lo)->ld_policy_ops; +} +static inline bool has_layout (struct nfs_inode *nfsi) {@@ -165,6 +173,12 @@ struct pnfs_device {unsigned int dev_notify_types; }; +struct pnfs_devicelist { +unsigned int eof; +unsigned int num_devs; +struct pnfs_deviceid dev_id[NFS4_PNFS_GETDEVLIST_MAXNUM ]; +}; +/* * Device ID RCU cache. A device ID is unique per client ID and layout type. */ @@ -222,6 +236,7 @@ extern void nfs4_unset_layout_deviceid(struct pnfs_layout_segment *,struct pnfs_client_operations {int (*nfs_getdeviceinfo) (struct nfs_server *,struct pnfs_device *dev); +void (*nfs_return_layout) (struct inode *); };extern struct pnfs_client_operations pnfs_ops;@@ -229,4 +244,7 @@ extern struct pnfs_client_operations pnfs_ops;extern struct pnfs_client_operations *pnfs_register_layoutdriver (struct pnfs_layoutdriver_type *);extern void pnfs_unregister_layoutdriver (struct pnfs_layoutdriver_type *); +#define NFS4_PNFS_MAX_LAYOUTS 4 +#define NFS4_PNFS_PRIVATE_LAYOUT 0x80000000 +#endif /* LINUX_NFS4_PNFS_H */ include/linux/nfs_xdr.h +2
-0@@ -1046,6 +1046,7 @@ struct nfs_rpc_ops {const struct dentry_operations *dentry_ops;const struct inode_operations *dir_inode_ops;const struct inode_operations *file_inode_ops; +const struct file_operations *file_ops;int (*getroot) (struct nfs_server *,struct nfs_fh *,struct nfs_fsinfo *);@@ -1110,6 +1111,7 @@ struct nfs_rpc_ops {extern const struct nfs_rpc_ops nfs_v2_clientops;extern const struct nfs_rpc_ops nfs_v3_clientops;extern const struct nfs_rpc_ops nfs_v4_clientops; +extern const struct nfs_rpc_ops pnfs_v4_clientops;extern struct rpc_version nfs_version2;extern struct rpc_version nfs_version3;extern struct rpc_version nfs_version4;include/linux/pnfs_xdr.h +0
-0
include/linux/pnfs_xdr.h struct pnfs_layoutcommit_data { · line 94
Quoted 9 lines
include/linux/pnfs_xdr.h +3
-3@@ -89,9 +89,9 @@ struct pnfs_layoutcommit_data { };struct nfs4_pnfs_layoutreturn_arg { -__u32 reclaim; -__u32 layout_type; -__u32 return_type; +__u32 reclaim; +__u32 layout_type; +__u32 return_type;
Is that a white space change of a tab to 3 spaces? could we make one big white space SQUASHME separate from other code?
include/linux/pnfs_xdr.h struct pnfs_layoutcommit_data { · line 97
Quoted 3 lines
include/linux/pnfs_xdr.h +0
-0struct nfs4_pnfs_layout_segment lseg;struct inode *inode;struct nfs4_sequence_args seq_args;
And all of Benny's comments as well for me.
Thanks
Boaz
Re: [PATCH 48/50] SQUASHME pnfs_post_submit: layout type enum
In reply to [email protected]Quoted 12 lines · On 08/14/2010 12:32 AM, [email protected] wrote:
From: Andy Adamson <[email protected]>
Signed-off-by Andy Adamson <[email protected]>--- include/linux/nfs4.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)include/linux/nfs4.h +0
-0
include/linux/nfs4.h enum state_protect_how4 { · line 585
Quoted 7 lines
include/linux/nfs4.h +2
-0@@ -579,6 +579,8 @@ enum state_protect_how4 {enum pnfs_layouttype {LAYOUT_NFSV4_1_FILES =1 , +LAYOUT_OSD2_OBJECTS =2 , +LAYOUT_BLOCK_VOLUME =3 , };
Rrr, what's the point? it's just an enum.
All STD derived types and constants should just be kept intact. Implemented or not is irrelevant.
which calls for a rename BTW.pnfs_layouttype => nfs4_layouttype (The name nfs4.h should be an hint I'd say)
Quoted 1 line
include/linux/nfs4.h +0
-0/* used for both layout return and recall */
Re: [PATCH 11/50] pnfs_submit: set and unset pnfs layoutdriver modules
In reply to [email protected]I don't think such a fine-grained splitup is reviewable at all. Anything more than a couple of patches for core nfs client changes, one patch for core pnfs support and one for the file layout driver is simply too much.
Re: [PATCH 11/50] pnfs_submit: set and unset pnfs layoutdriver modules
Quoted 5 lines · Christoph Hellwig
I don't think such a fine-grained splitup is reviewable at all. Anything more than a couple of patches for core nfs client changes, one patch for core pnfs support and one for the file layout driver is simply too much.
The whole enchilada is about 8500 lines of diff.
Don't you think that splitting it up to self contained bite-sized patches is better for reviewing it?
Benny
Re: [PATCH 11/50] pnfs_submit: set and unset pnfs layoutdriver modules
Quoted 10 lines · Benny Halevy
Quoted 5 lines · Christoph Hellwig
I don't think such a fine-grained splitup is reviewable at all. Anything more than a couple of patches for core nfs client changes, one patch for core pnfs support and one for the file layout driver is simply too much.
The whole enchilada is about 8500 lines of diff.
Don't you think that splitting it up to self contained bite-sized patches is better for reviewing it?
Depends on your defintion of self contained. If you actually have a first patch with a functional and working subset and just keep adding optimizations or new features that's okay, but otherwise it's poinless. If you submit a single driver / feature it needs to be a reviewed as a whole and not artifical pieces.
Re: [PATCH 10/50] pnfs_submit: register unregister pnfs module
In reply to [email protected]fs/nfs/inode.c static int __init init_nfs_fs(void) · line 1558
Quoted 5 lines
fs/nfs/inode.c +5
-0+#ifdef CONFIG_NFS_V4_1 + err =pnfs_initialize (); +if (err) + goto out00; +#endif /* CONFIG_NFS_V4_1 */
Unless the pnfs code goes into it's own module anyway this really screams for stubs for the !CONFIG_NFS_V4_1 case to avoid all the ifdef mess.
Re: [PATCH 10/50] pnfs_submit: register unregister pnfs module
Quoted 10 lines · Christoph Hellwig
fs/nfs/inode.c static int __init init_nfs_fs(void) · line 1558
Quoted 5 lines
fs/nfs/inode.c +5
-0+#ifdef CONFIG_NFS_V4_1 + err =pnfs_initialize (); +if (err) + goto out00; +#endif /* CONFIG_NFS_V4_1 */ Unless the pnfs code goes into it's own module anyway this really screams for stubs for the !CONFIG_NFS_V4_1 case to avoid all the ifdef mess.
In this case we followed the existing "style" in this function. That said, I agree that a stub for CONFIG_NFS_V4_1 will work better.
Benny
Re: [PATCH 09/50] pnfs_submit: introduce fs/nfs/pnfs.c
In reply to [email protected]This file uses a different license than the rest of Linux. I think you at least need to dual-license it under the GPLv2.
Re: [PATCH 09/50] pnfs_submit: introduce fs/nfs/pnfs.c
Quoted 2 lines · Christoph Hellwig
This file uses a different license than the rest of Linux. I think you at least need to dual-license it under the GPLv2.
It's a common BSD-like license, GPL-compatible, and already used elsewhere. There's no need to dual-license.
(Agreed with point elsewhere that this should be merged with another patch.)
--b.
Re: [PATCH 06/50] pnfs_submit: introduce include/linux/nfs4_pnfs.h
In reply to [email protected]include/linux/nfs4_pnfs.h line 2
Quoted 4 lines
+++
b/include/linux/nfs4_pnfs.hinclude/linux/nfs4_pnfs.h new file +2
-0@@ -0,0 +1,15 @@ +/* +* include/linux/nfs4_pnfs.h
Please don't include these kinds of comments, they only purpose they serve is frequently getting out of date. That applies to just about every file added in this series.
include/linux/nfs4_pnfs.h line 15
Quoted 13 lines
include/linux/nfs4_pnfs.h new file +13
-0+* +* Common data structures needed by the pnfs client and pnfs layout driver. +* +* Copyright (c) 2002 The Regents of the University of Michigan. +* All rights reserved. +* +* Dean Hildebrand <[email protected]> +*/ + +#ifndef LINUX_NFS4_PNFS_H +#define LINUX_NFS4_PNFS_H + +#endif /* LINUX_NFS4_PNFS_H */
Adding a file that only contains copyrights and inclusion headers is rather odd. I think you want your split a little more corse grained.
Re: [PATCH 06/50] pnfs_submit: introduce include/linux/nfs4_pnfs.h
Quoted 7 lines · On Wed, Aug 18, 2010 at 4:27 PM, Christoph Hellwig <[email protected]> = wrote:
Review line 2
Quoted 4 lines
+++
b/include/linux/nfs4_pnfs.h(quoted diff) +2
-0@@ -0,0 +1,15 @@ +/* + * =A0include/linux/nfs4_pnfs.hPlease don't include these kinds of comments, they only purpose they serve is frequently getting out of date. =A0That applies to just abou=
t
Quoted 4 lines
every file added in this series.
Quoted 2 lines
(quoted diff) +2
-0+ * + * =A0Common data structures needed by the pnfs client and pnfs lay=
out driver.
Quoted 6 lines
Quoted 6 lines
include/linux/nfs4_pnfs.h new file +6
-0+* +* =A0Copyright (c) 2002 The Regents of the University of Michigan. +* =A0All rights reserved. +* +* =A0Dean Hildebrand =A0 <[email protected]> +*/
Quoted 8 lines
include/linux/nfs4_pnfs.h line 15
Quoted 5 lines
include/linux/nfs4_pnfs.h new file +5
-0+ +#ifndef LINUX_NFS4_PNFS_H +#define LINUX_NFS4_PNFS_H + +#endif /* LINUX_NFS4_PNFS_H */ Adding a file that only contains copyrights and inclusion headers is rather odd. =A0I think you want your split a little more corse graine=
d.
Agreed. This patch set is really a first go at squashing 281 patches into 50. We have more know re-org and cleanup, just wanted to do an initial re-org keeping the tree the same as a first step.
Thanks for your comments.
-->Andy
Quoted 3 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" =
in
Quoted 3 lines
the body of a message to [email protected]
More majordomo info at =A0http://vger.kernel.org/majordomo-info.html
Re: [PATCH 06/50] pnfs_submit: introduce include/linux/nfs4_pnfs.h
In reply to Christoph HellwigQuoted 9 lines · Christoph Hellwig
include/linux/nfs4_pnfs.h line 2
Quoted 4 lines
+++
b/include/linux/nfs4_pnfs.hinclude/linux/nfs4_pnfs.h new file +2
-0@@ -0,0 +1,15 @@ +/* +* include/linux/nfs4_pnfs.h Please don't include these kinds of comments, they only purpose they serve is frequently getting out of date. That applies to just about every file added in this series.
Agreed.
Quoted 8 lines
Quoted 8 lines
include/linux/nfs4_pnfs.h new file +8
-0+* +* Common data structures needed by the pnfs client and pnfs layout driver. +* +* Copyright (c) 2002 The Regents of the University of Michigan. +* All rights reserved. +* +* Dean Hildebrand <[email protected]> +*/
Quoted 9 lines
include/linux/nfs4_pnfs.h line 15
Quoted 5 lines
include/linux/nfs4_pnfs.h new file +5
-0+ +#ifndef LINUX_NFS4_PNFS_H +#define LINUX_NFS4_PNFS_H + +#endif /* LINUX_NFS4_PNFS_H */ Adding a file that only contains copyrights and inclusion headers is rather odd. I think you want your split a little more corse grained.
Yup. This was originally done for patch mechanics reasons. It can be just part of the first patch that uses the file.
Benny
Re: [PATCH 05/50] pnfs_submit: pnfs and nfslayoutdriver kconfig
In reply to [email protected]Quoted 3 lines · On Fri, Aug 13, 2010 at 05:31:17PM -0400, [email protected] wrote:
From: The pNFS Team <[email protected]>
Signed-off-by Benny Halevy <[email protected]>
If you split out the Kconfig from the code it guards it should come last in the series so that the code can't be enabled until it's complete.
fs/nfs/Kconfig config NFS_V4_1 · line 85
Quoted 8 lines
fs/nfs/Kconfig +4
-1depends on NFS_V4 && EXPERIMENTAL help This option enables support for minor version 1 of the NFSv4 protocol - (draft-ietf-nfsv4-minorversion1) in the kernel's NFS client. + (RFC5661) including support for the parallel NFS (pNFS) features + in the kernel's NFS client. + + Unless you're an NFS developer, say N.
How much code does the pnfs support add to the nfs.ko module? Just including this unconditionally might not be an all that good idea.
Also Trond seemed to be pretty determined to split up nfs.ko into version specific modules, and pnfs and the various layout drivers are pretty good candidates for that. Maybe the pnfs patches should be ontop of that?
fs/nfs/Kconfig config NFS_V4_1 · line 89
Quoted 3 lines
fs/nfs/Kconfig +3
-0+config PNFS_FILE_LAYOUT + tristate "NFS client support for the pNFS nfs-files layout (DEVELOPER ONLY)" + depends on NFS_FS && NFS_V4_1
is it really developers-only at this point? And if it is so why doesn't it depend on EXPERIMENTAL
fs/nfs/Kconfig config NFS_V4_1 · line 90
Quoted 1 line
fs/nfs/Kconfig +1
-0+ default y
defaulting to y for random fringe features is frowned upon.
Re: [PATCH 05/50] pnfs_submit: pnfs and nfslayoutdriver kconfig
Quoted 8 lines · Christoph Hellwig
Quoted 3 lines · On Fri, Aug 13, 2010 at 05:31:17PM -0400, [email protected] wrote:
From: The pNFS Team <[email protected]>
Signed-off-by Benny Halevy <[email protected]>If you split out the
Kconfigfrom the code it guards it should come last in the series so that the code can't be enabled until it's complete.
But then it's harder to bisect it, or even make sure each patch compiles :-(
Quoted 12 lines
fs/nfs/Kconfig config NFS_V4_1 · line 85
Quoted 8 lines
fs/nfs/Kconfig +4
-1depends on NFS_V4 && EXPERIMENTAL help This option enables support for minor version 1 of the NFSv4 protocol - (draft-ietf-nfsv4-minorversion1) in the kernel's NFS client. + (RFC5661) including support for the parallel NFS (pNFS) features + in the kernel's NFS client. + + Unless you're an NFS developer, say N.How much code does the pnfs support add to the nfs.ko module? Just including this unconditionally might not be an all that good idea.
Quoted 5 lines
Also Trond seemed to be pretty determined to split up nfs.ko into version specific modules, and pnfs and the various layout drivers are pretty good candidates for that. Maybe the pnfs patches should be ontop of that?
Maybe. I guess it's up to Trond. But previously as the team discussed, we consider pNFS an integral part of NFSv4.1 and to reduce the number of possible configurations we would like to keep the core pnfs functionality on the same config option as NFS_V4_1. To disable pNFS at compile time, the user may still unconfig the layout modules.
Quoted 5 lines
fs/nfs/Kconfig config NFS_V4_1 · line 89
Quoted 3 lines
fs/nfs/Kconfig +3
-0+config PNFS_FILE_LAYOUT + tristate "NFS client support for the pNFS nfs-files layout (DEVELOPER ONLY)" + depends on NFS_FS && NFS_V4_1is it really developers-only at this point?
I think it should be this way, at least until we push the whole pnfs branch (not just the files-layout only part) upstream.
Quoted 3 lines
And if it is so why doesn't
it depend on EXPERIMENTAL
Good catch. It should depend on experimental.
Quoted 3 lines
fs/nfs/Kconfig config NFS_V4_1 · line 90
Quoted 1 line
fs/nfs/Kconfig +1
-0+ default ydefaulting to y for random fringe features is frowned upon.
The problem is that it will rot otherwise.
I'd rather disable it by default using a variable and provide a way to enable it at run time.
Benny
Quoted 5 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 05/50] pnfs_submit: pnfs and nfslayoutdriver kconfig
Quoted 7 lines · Benny Halevy
Quoted 3 lines
fs/nfs/Kconfig config NFS_V4_1 · line 90
Quoted 1 line
fs/nfs/Kconfig +1
-0+ default ydefaulting to y for random fringe features is frowned upon.
The problem is that it will rot otherwise.
I'd rather disable it by default using a variable and provide a way to enable it at run time.
That's unrelated. Features should not default to y in Kconfig except for very specific cases, e.g. when a new variable is required to be set to keep working from a previous setup. pNFS clearly does not fall into that category.
Re: [PATCH 04/50] nfsd: remove duplicate NFS4_STATEID_SIZE declaration
In reply to [email protected]Quoted 3 lines · On Fri, Aug 13, 2010 at 05:31:16PM -0400, [email protected] wrote:
From: Andy Adamson <[email protected]>
Use
NFS4_STATEID_SIZEfrominclude/linux/nfs4
Thanks, applying for 2.6.37.--b.
Quoted 25 lines
Signed-off-by Andy Adamson <[email protected]>--- fs/nfsd/nfs4callback.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)fs/nfsd/nfs4callback.c +0
-1@@ -41,7 +41,6 @@#define NFSPROC4_CB_NULL 0#define NFSPROC4_CB_COMPOUND 1 -#define NFS4_STATEID_SIZE 16/* Index of predefined Linux callback client operations */ Signature · 6 lines
1.6.2.5 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Andy, I merged these patches with restored sign-offs and a couple minor touch-ups to make sure all compile. There's still zero diff from the original pnfs-submit branch. The pnfs-all-latest tip is at pnfs-all-2.6.35-2010-08-19. With regards to the patch descriptions, we've changed the patcheset so much it just makes more sense to re-write the commentary when we're close to have the final version.
Let's get on with the renaming now and then we'll continue to rearrange the set for review and clean it up further.
Benny
Quoted 20 lines · On Aug. 14, 2010, 0:31 +0300, [email protected] wrote:
Here is the pnfs-submit tree all squashed and reorganized. The resultant tree is unchanged. The patch comments and Signed-off-by's need to be added.
We may want to split or re-order some of the patches. I left the "introduce new file" patches #6-9 unsquashed, but we probably want to squash them into the patch that uses them first.
Patches 1-4 are not pnfs patches, and should be submitted to Trond/Bruce.
Patch #50 "SQUASHME
pnfs_submit: remove this unused code" should not be squashed, but removed.Patches 47,-49 are for the post-submit trees.
-->Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html