aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/internal.h')
-rw-r--r--fs/nfs/internal.h56
1 files changed, 47 insertions, 9 deletions
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index efaa31c70fbe..212b8c883d22 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -6,6 +6,7 @@
6#include <linux/mount.h> 6#include <linux/mount.h>
7#include <linux/security.h> 7#include <linux/security.h>
8#include <linux/crc32.h> 8#include <linux/crc32.h>
9#include <linux/nfs_page.h>
9 10
10#define NFS_MS_MASK (MS_RDONLY|MS_NOSUID|MS_NODEV|MS_NOEXEC|MS_SYNCHRONOUS) 11#define NFS_MS_MASK (MS_RDONLY|MS_NOSUID|MS_NODEV|MS_NOEXEC|MS_SYNCHRONOUS)
11 12
@@ -31,8 +32,6 @@ static inline int nfs_attr_use_mounted_on_fileid(struct nfs_fattr *fattr)
31 (((fattr->valid & NFS_ATTR_FATTR_MOUNTPOINT) == 0) && 32 (((fattr->valid & NFS_ATTR_FATTR_MOUNTPOINT) == 0) &&
32 ((fattr->valid & NFS_ATTR_FATTR_V4_REFERRAL) == 0))) 33 ((fattr->valid & NFS_ATTR_FATTR_V4_REFERRAL) == 0)))
33 return 0; 34 return 0;
34
35 fattr->fileid = fattr->mounted_on_fileid;
36 return 1; 35 return 1;
37} 36}
38 37
@@ -189,9 +188,15 @@ extern struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp,
189 const struct sockaddr *ds_addr, 188 const struct sockaddr *ds_addr,
190 int ds_addrlen, int ds_proto, 189 int ds_addrlen, int ds_proto,
191 unsigned int ds_timeo, 190 unsigned int ds_timeo,
192 unsigned int ds_retrans); 191 unsigned int ds_retrans,
192 u32 minor_version,
193 rpc_authflavor_t au_flavor);
193extern struct rpc_clnt *nfs4_find_or_create_ds_client(struct nfs_client *, 194extern struct rpc_clnt *nfs4_find_or_create_ds_client(struct nfs_client *,
194 struct inode *); 195 struct inode *);
196extern struct nfs_client *nfs3_set_ds_client(struct nfs_client *mds_clp,
197 const struct sockaddr *ds_addr, int ds_addrlen,
198 int ds_proto, unsigned int ds_timeo,
199 unsigned int ds_retrans, rpc_authflavor_t au_flavor);
195#ifdef CONFIG_PROC_FS 200#ifdef CONFIG_PROC_FS
196extern int __init nfs_fs_proc_init(void); 201extern int __init nfs_fs_proc_init(void);
197extern void nfs_fs_proc_exit(void); 202extern void nfs_fs_proc_exit(void);
@@ -244,9 +249,12 @@ struct nfs_pgio_header *nfs_pgio_header_alloc(const struct nfs_rw_ops *);
244void nfs_pgio_header_free(struct nfs_pgio_header *); 249void nfs_pgio_header_free(struct nfs_pgio_header *);
245void nfs_pgio_data_destroy(struct nfs_pgio_header *); 250void nfs_pgio_data_destroy(struct nfs_pgio_header *);
246int nfs_generic_pgio(struct nfs_pageio_descriptor *, struct nfs_pgio_header *); 251int nfs_generic_pgio(struct nfs_pageio_descriptor *, struct nfs_pgio_header *);
247int nfs_initiate_pgio(struct rpc_clnt *, struct nfs_pgio_header *, 252int nfs_initiate_pgio(struct rpc_clnt *clnt, struct nfs_pgio_header *hdr,
248 const struct rpc_call_ops *, int, int); 253 struct rpc_cred *cred, const struct nfs_rpc_ops *rpc_ops,
254 const struct rpc_call_ops *call_ops, int how, int flags);
249void nfs_free_request(struct nfs_page *req); 255void nfs_free_request(struct nfs_page *req);
256struct nfs_pgio_mirror *
257nfs_pgio_current_mirror(struct nfs_pageio_descriptor *desc);
250 258
251static inline void nfs_iocounter_init(struct nfs_io_counter *c) 259static inline void nfs_iocounter_init(struct nfs_io_counter *c)
252{ 260{
@@ -254,6 +262,12 @@ static inline void nfs_iocounter_init(struct nfs_io_counter *c)
254 atomic_set(&c->io_count, 0); 262 atomic_set(&c->io_count, 0);
255} 263}
256 264
265static inline bool nfs_pgio_has_mirroring(struct nfs_pageio_descriptor *desc)
266{
267 WARN_ON_ONCE(desc->pg_mirror_count < 1);
268 return desc->pg_mirror_count > 1;
269}
270
257/* nfs2xdr.c */ 271/* nfs2xdr.c */
258extern struct rpc_procinfo nfs_procedures[]; 272extern struct rpc_procinfo nfs_procedures[];
259extern int nfs2_decode_dirent(struct xdr_stream *, 273extern int nfs2_decode_dirent(struct xdr_stream *,
@@ -377,7 +391,7 @@ extern struct rpc_stat nfs_rpcstat;
377 391
378extern int __init register_nfs_fs(void); 392extern int __init register_nfs_fs(void);
379extern void __exit unregister_nfs_fs(void); 393extern void __exit unregister_nfs_fs(void);
380extern void nfs_sb_active(struct super_block *sb); 394extern bool nfs_sb_active(struct super_block *sb);
381extern void nfs_sb_deactive(struct super_block *sb); 395extern void nfs_sb_deactive(struct super_block *sb);
382 396
383/* namespace.c */ 397/* namespace.c */
@@ -416,7 +430,6 @@ int nfs_show_options(struct seq_file *, struct dentry *);
416int nfs_show_devname(struct seq_file *, struct dentry *); 430int nfs_show_devname(struct seq_file *, struct dentry *);
417int nfs_show_path(struct seq_file *, struct dentry *); 431int nfs_show_path(struct seq_file *, struct dentry *);
418int nfs_show_stats(struct seq_file *, struct dentry *); 432int nfs_show_stats(struct seq_file *, struct dentry *);
419void nfs_put_super(struct super_block *);
420int nfs_remount(struct super_block *sb, int *flags, char *raw_data); 433int nfs_remount(struct super_block *sb, int *flags, char *raw_data);
421 434
422/* write.c */ 435/* write.c */
@@ -429,6 +442,7 @@ extern void nfs_write_prepare(struct rpc_task *task, void *calldata);
429extern void nfs_commit_prepare(struct rpc_task *task, void *calldata); 442extern void nfs_commit_prepare(struct rpc_task *task, void *calldata);
430extern int nfs_initiate_commit(struct rpc_clnt *clnt, 443extern int nfs_initiate_commit(struct rpc_clnt *clnt,
431 struct nfs_commit_data *data, 444 struct nfs_commit_data *data,
445 const struct nfs_rpc_ops *nfs_ops,
432 const struct rpc_call_ops *call_ops, 446 const struct rpc_call_ops *call_ops,
433 int how, int flags); 447 int how, int flags);
434extern void nfs_init_commit(struct nfs_commit_data *data, 448extern void nfs_init_commit(struct nfs_commit_data *data,
@@ -442,13 +456,15 @@ int nfs_scan_commit(struct inode *inode, struct list_head *dst,
442 struct nfs_commit_info *cinfo); 456 struct nfs_commit_info *cinfo);
443void nfs_mark_request_commit(struct nfs_page *req, 457void nfs_mark_request_commit(struct nfs_page *req,
444 struct pnfs_layout_segment *lseg, 458 struct pnfs_layout_segment *lseg,
445 struct nfs_commit_info *cinfo); 459 struct nfs_commit_info *cinfo,
460 u32 ds_commit_idx);
446int nfs_write_need_commit(struct nfs_pgio_header *); 461int nfs_write_need_commit(struct nfs_pgio_header *);
447int nfs_generic_commit_list(struct inode *inode, struct list_head *head, 462int nfs_generic_commit_list(struct inode *inode, struct list_head *head,
448 int how, struct nfs_commit_info *cinfo); 463 int how, struct nfs_commit_info *cinfo);
449void nfs_retry_commit(struct list_head *page_list, 464void nfs_retry_commit(struct list_head *page_list,
450 struct pnfs_layout_segment *lseg, 465 struct pnfs_layout_segment *lseg,
451 struct nfs_commit_info *cinfo); 466 struct nfs_commit_info *cinfo,
467 u32 ds_commit_idx);
452void nfs_commitdata_release(struct nfs_commit_data *data); 468void nfs_commitdata_release(struct nfs_commit_data *data);
453void nfs_request_add_commit_list(struct nfs_page *req, struct list_head *dst, 469void nfs_request_add_commit_list(struct nfs_page *req, struct list_head *dst,
454 struct nfs_commit_info *cinfo); 470 struct nfs_commit_info *cinfo);
@@ -459,6 +475,7 @@ void nfs_init_cinfo(struct nfs_commit_info *cinfo,
459 struct nfs_direct_req *dreq); 475 struct nfs_direct_req *dreq);
460int nfs_key_timeout_notify(struct file *filp, struct inode *inode); 476int nfs_key_timeout_notify(struct file *filp, struct inode *inode);
461bool nfs_ctx_key_to_expire(struct nfs_open_context *ctx); 477bool nfs_ctx_key_to_expire(struct nfs_open_context *ctx);
478void nfs_pageio_stop_mirroring(struct nfs_pageio_descriptor *pgio);
462 479
463#ifdef CONFIG_MIGRATION 480#ifdef CONFIG_MIGRATION
464extern int nfs_migrate_page(struct address_space *, 481extern int nfs_migrate_page(struct address_space *,
@@ -482,6 +499,7 @@ static inline void nfs_inode_dio_wait(struct inode *inode)
482 inode_dio_wait(inode); 499 inode_dio_wait(inode);
483} 500}
484extern ssize_t nfs_dreq_bytes_left(struct nfs_direct_req *dreq); 501extern ssize_t nfs_dreq_bytes_left(struct nfs_direct_req *dreq);
502extern void nfs_direct_set_resched_writes(struct nfs_direct_req *dreq);
485 503
486/* nfs4proc.c */ 504/* nfs4proc.c */
487extern void __nfs4_read_done_cb(struct nfs_pgio_header *); 505extern void __nfs4_read_done_cb(struct nfs_pgio_header *);
@@ -495,6 +513,26 @@ extern int nfs41_walk_client_list(struct nfs_client *clp,
495 struct nfs_client **result, 513 struct nfs_client **result,
496 struct rpc_cred *cred); 514 struct rpc_cred *cred);
497 515
516static inline struct inode *nfs_igrab_and_active(struct inode *inode)
517{
518 inode = igrab(inode);
519 if (inode != NULL && !nfs_sb_active(inode->i_sb)) {
520 iput(inode);
521 inode = NULL;
522 }
523 return inode;
524}
525
526static inline void nfs_iput_and_deactive(struct inode *inode)
527{
528 if (inode != NULL) {
529 struct super_block *sb = inode->i_sb;
530
531 iput(inode);
532 nfs_sb_deactive(sb);
533 }
534}
535
498/* 536/*
499 * Determine the device name as a string 537 * Determine the device name as a string
500 */ 538 */