xref: /linux/fs/nfs/pnfs.h (revision a1ff5a7d78a036d6c2178ee5acd6ba4946243800)
185e174baSRicardo Labiaga /*
285e174baSRicardo Labiaga  *  pNFS client data structures.
385e174baSRicardo Labiaga  *
485e174baSRicardo Labiaga  *  Copyright (c) 2002
585e174baSRicardo Labiaga  *  The Regents of the University of Michigan
685e174baSRicardo Labiaga  *  All Rights Reserved
785e174baSRicardo Labiaga  *
885e174baSRicardo Labiaga  *  Dean Hildebrand <dhildebz@umich.edu>
985e174baSRicardo Labiaga  *
1085e174baSRicardo Labiaga  *  Permission is granted to use, copy, create derivative works, and
1185e174baSRicardo Labiaga  *  redistribute this software and such derivative works for any purpose,
1285e174baSRicardo Labiaga  *  so long as the name of the University of Michigan is not used in
1385e174baSRicardo Labiaga  *  any advertising or publicity pertaining to the use or distribution
1485e174baSRicardo Labiaga  *  of this software without specific, written prior authorization. If
1585e174baSRicardo Labiaga  *  the above copyright notice or any other identification of the
1685e174baSRicardo Labiaga  *  University of Michigan is included in any copy of any portion of
1785e174baSRicardo Labiaga  *  this software, then the disclaimer below must also be included.
1885e174baSRicardo Labiaga  *
1985e174baSRicardo Labiaga  *  This software is provided as is, without representation or warranty
2085e174baSRicardo Labiaga  *  of any kind either express or implied, including without limitation
2185e174baSRicardo Labiaga  *  the implied warranties of merchantability, fitness for a particular
2285e174baSRicardo Labiaga  *  purpose, or noninfringement.  The Regents of the University of
2385e174baSRicardo Labiaga  *  Michigan shall not be liable for any damages, including special,
2485e174baSRicardo Labiaga  *  indirect, incidental, or consequential damages, with respect to any
2585e174baSRicardo Labiaga  *  claim arising out of or in connection with the use of the software,
2685e174baSRicardo Labiaga  *  even if it has been or is hereafter advised of the possibility of
2785e174baSRicardo Labiaga  *  such damages.
2885e174baSRicardo Labiaga  */
2985e174baSRicardo Labiaga 
3085e174baSRicardo Labiaga #ifndef FS_NFS_PNFS_H
3185e174baSRicardo Labiaga #define FS_NFS_PNFS_H
3285e174baSRicardo Labiaga 
33a2a5dea7SElena Reshetova #include <linux/refcount.h>
3445df3c8bSBenny Halevy #include <linux/nfs_fs.h>
3594ad1c80SFred Isaman #include <linux/nfs_page.h>
36e6cf82d1SWeston Andros Adamson #include <linux/workqueue.h>
3794ad1c80SFred Isaman 
386e7434abSTrond Myklebust struct nfs4_exception;
392409a976SFred Isaman struct nfs4_opendata;
402409a976SFred Isaman 
414541d16cSFred Isaman enum {
424541d16cSFred Isaman 	NFS_LSEG_VALID = 0,	/* cleared when lseg is recalled/returned */
43f7e8917aSFred Isaman 	NFS_LSEG_ROC,		/* roc bit received from server */
44a9bae566SPeng Tao 	NFS_LSEG_LAYOUTCOMMIT,	/* layoutcommit bit set for layoutcommit */
45016256dfSPeng Tao 	NFS_LSEG_LAYOUTRETURN,	/* layoutreturn bit set for layoutreturn */
46b3dce6a2SBenjamin Coddington 	NFS_LSEG_UNAVAILABLE,	/* unavailable bit set for temporary problem */
474541d16cSFred Isaman };
484541d16cSFred Isaman 
49875ae069SPeng Tao /* Individual ip address */
50875ae069SPeng Tao struct nfs4_pnfs_ds_addr {
51875ae069SPeng Tao 	struct sockaddr_storage	da_addr;
52875ae069SPeng Tao 	size_t			da_addrlen;
53875ae069SPeng Tao 	struct list_head	da_node;  /* nfs4_pnfs_dev_hlist dev_dslist */
54875ae069SPeng Tao 	char			*da_remotestr;	/* human readable addr+port */
554be78d26STrond Myklebust 	const char		*da_netid;
564be78d26STrond Myklebust 	int			da_transport;
57875ae069SPeng Tao };
58875ae069SPeng Tao 
59875ae069SPeng Tao struct nfs4_pnfs_ds {
60875ae069SPeng Tao 	struct list_head	ds_node;  /* nfs4_pnfs_dev_hlist dev_dslist */
61875ae069SPeng Tao 	char			*ds_remotestr;	/* comma sep list of addrs */
62875ae069SPeng Tao 	struct list_head	ds_addrs;
63875ae069SPeng Tao 	struct nfs_client	*ds_clp;
64a2a5dea7SElena Reshetova 	refcount_t		ds_count;
65875ae069SPeng Tao 	unsigned long		ds_state;
66875ae069SPeng Tao #define NFS4DS_CONNECTING	0	/* ds is establishing connection */
6785e174baSRicardo Labiaga };
6885e174baSRicardo Labiaga 
69974cec8cSAndy Adamson struct pnfs_layout_segment {
70566052c5SFred Isaman 	struct list_head pls_list;
71a9bae566SPeng Tao 	struct list_head pls_lc_list;
72a9901899STrond Myklebust 	struct list_head pls_commits;
73566052c5SFred Isaman 	struct pnfs_layout_range pls_range;
74eba6dd69SElena Reshetova 	refcount_t pls_refcount;
7566755283SJeff Layton 	u32 pls_seq;
764541d16cSFred Isaman 	unsigned long pls_flags;
77566052c5SFred Isaman 	struct pnfs_layout_hdr *pls_layout;
78974cec8cSAndy Adamson };
79974cec8cSAndy Adamson 
8064419a9bSAndy Adamson enum pnfs_try_status {
8164419a9bSAndy Adamson 	PNFS_ATTEMPTED     = 0,
8264419a9bSAndy Adamson 	PNFS_NOT_ATTEMPTED = 1,
83ceb11e13SPeng Tao 	PNFS_TRY_AGAIN     = 2,
8464419a9bSAndy Adamson };
8564419a9bSAndy Adamson 
8685e174baSRicardo Labiaga #ifdef CONFIG_NFS_V4_1
8785e174baSRicardo Labiaga 
8885e174baSRicardo Labiaga #define LAYOUT_NFSV4_1_MODULE_PREFIX "nfs-layouttype4"
8985e174baSRicardo Labiaga 
9039280a5aSPeng Tao /*
9139280a5aSPeng Tao  * Default data server connection timeout and retrans vaules.
9239280a5aSPeng Tao  * Set by module parameters dataserver_timeo and dataserver_retrans.
9339280a5aSPeng Tao  */
9439280a5aSPeng Tao #define NFS4_DEF_DS_TIMEO   600 /* in tenths of a second */
9539280a5aSPeng Tao #define NFS4_DEF_DS_RETRANS 5
96b3dce6a2SBenjamin Coddington #define PNFS_DEVICE_RETRY_TIMEOUT (120*HZ)
9739280a5aSPeng Tao 
98e5e94017SBenny Halevy enum {
99e5e94017SBenny Halevy 	NFS_LAYOUT_RO_FAILED = 0,	/* get ro layout failed stop trying */
100e5e94017SBenny Halevy 	NFS_LAYOUT_RW_FAILED,		/* get rw layout failed stop trying */
10143f1b3daSFred Isaman 	NFS_LAYOUT_BULK_RECALL,		/* bulk recall affecting layout */
1022370abdaSTrond Myklebust 	NFS_LAYOUT_RETURN,		/* layoutreturn in progress */
1036604b203STrond Myklebust 	NFS_LAYOUT_RETURN_LOCK,		/* Serialise layoutreturn */
1042370abdaSTrond Myklebust 	NFS_LAYOUT_RETURN_REQUESTED,	/* Return this layout ASAP */
10547abadefSChristoph Hellwig 	NFS_LAYOUT_INVALID_STID,	/* layout stateid id is invalid */
1069bf87482SPeng Tao 	NFS_LAYOUT_FIRST_LAYOUTGET,	/* Serialize first layoutget */
1075085607dSTrond Myklebust 	NFS_LAYOUT_INODE_FREEING,	/* The inode is being freed */
108cf6605d1STrond Myklebust 	NFS_LAYOUT_HASHED,		/* The layout visible */
109880265c7STrond Myklebust 	NFS_LAYOUT_DRAIN,
110e5e94017SBenny Halevy };
111e5e94017SBenny Halevy 
1128a1636c4SBenny Halevy enum layoutdriver_policy_flags {
11388ac815cSPeng Tao 	/* Should the pNFS client commit and return the layout upon truncate to
11488ac815cSPeng Tao 	 * a smaller size */
1158a1636c4SBenny Halevy 	PNFS_LAYOUTRET_ON_SETATTR	= 1 << 0,
116fe0fe835SBoaz Harrosh 	PNFS_LAYOUTRET_ON_ERROR		= 1 << 1,
117612aa983SChristoph Hellwig 	PNFS_READ_WHOLE_PAGE		= 1 << 2,
118f86c3ac5SFred Isaman 	PNFS_LAYOUTGET_ON_OPEN		= 1 << 3,
1198a1636c4SBenny Halevy };
1208a1636c4SBenny Halevy 
1218adc8302STrond Myklebust enum pnfs_layout_destroy_mode {
1228adc8302STrond Myklebust 	PNFS_LAYOUT_INVALIDATE = 0,
1238adc8302STrond Myklebust 	PNFS_LAYOUT_BULK_RETURN,
12441d0a8eaSTrond Myklebust 	PNFS_LAYOUT_FILE_BULK_RETURN,
1258adc8302STrond Myklebust };
1268adc8302STrond Myklebust 
1271775bc34SBenny Halevy struct nfs4_deviceid_node;
1281775bc34SBenny Halevy 
12985e174baSRicardo Labiaga /* Per-layout driver specific registration structure */
13085e174baSRicardo Labiaga struct pnfs_layoutdriver_type {
13102c35fcaSFred Isaman 	struct list_head pnfs_tblid;
13202c35fcaSFred Isaman 	const u32 id;
13302c35fcaSFred Isaman 	const char *name;
13402c35fcaSFred Isaman 	struct module *owner;
1358a1636c4SBenny Halevy 	unsigned flags;
13628ced9a8STrond Myklebust 	unsigned max_layoutget_response;
137636fb9c8SBenny Halevy 
138738fd0f3SBenny Halevy 	int (*set_layoutdriver) (struct nfs_server *, const struct nfs_fh *);
139738fd0f3SBenny Halevy 	int (*clear_layoutdriver) (struct nfs_server *);
140738fd0f3SBenny Halevy 
141636fb9c8SBenny Halevy 	struct pnfs_layout_hdr * (*alloc_layout_hdr) (struct inode *inode, gfp_t gfp_flags);
142636fb9c8SBenny Halevy 	void (*free_layout_hdr) (struct pnfs_layout_hdr *);
143636fb9c8SBenny Halevy 
144a75b9df9STrond Myklebust 	struct pnfs_layout_segment * (*alloc_lseg) (struct pnfs_layout_hdr *layoutid, struct nfs4_layoutget_res *lgr, gfp_t gfp_flags);
145b1f69b75SAndy Adamson 	void (*free_lseg) (struct pnfs_layout_segment *lseg);
14603772d2fSTrond Myklebust 	void (*add_lseg) (struct pnfs_layout_hdr *layoutid,
14703772d2fSTrond Myklebust 			struct pnfs_layout_segment *lseg,
14803772d2fSTrond Myklebust 			struct list_head *free_me);
14994ad1c80SFred Isaman 
150c88953d8SChristoph Hellwig 	void (*return_range) (struct pnfs_layout_hdr *lo,
151c88953d8SChristoph Hellwig 			      struct pnfs_layout_range *range);
152c88953d8SChristoph Hellwig 
15394ad1c80SFred Isaman 	/* test for nfs page cache coalescing */
1541751c363STrond Myklebust 	const struct nfs_pageio_ops *pg_read_ops;
1551751c363STrond Myklebust 	const struct nfs_pageio_ops *pg_write_ops;
15664419a9bSAndy Adamson 
157ea2cf228SFred Isaman 	struct pnfs_ds_commit_info *(*get_ds_info) (struct inode *inode);
158a861a1e1SFred Isaman 
1595bb89b47STrond Myklebust 	int (*sync)(struct inode *inode, bool datasync);
1605bb89b47STrond Myklebust 
16164419a9bSAndy Adamson 	/*
16264419a9bSAndy Adamson 	 * Return PNFS_ATTEMPTED to indicate the layout code has attempted
16364419a9bSAndy Adamson 	 * I/O, else return PNFS_NOT_ATTEMPTED to fall back to normal NFS
16464419a9bSAndy Adamson 	 */
165d45f60c6SWeston Andros Adamson 	enum pnfs_try_status (*read_pagelist)(struct nfs_pgio_header *);
166d45f60c6SWeston Andros Adamson 	enum pnfs_try_status (*write_pagelist)(struct nfs_pgio_header *, int);
1671775bc34SBenny Halevy 
1681775bc34SBenny Halevy 	void (*free_deviceid_node) (struct nfs4_deviceid_node *);
169661373b1SChristoph Hellwig 	struct nfs4_deviceid_node * (*alloc_deviceid_node)
170661373b1SChristoph Hellwig 			(struct nfs_server *server, struct pnfs_device *pdev,
171661373b1SChristoph Hellwig 			gfp_t gfp_flags);
17204a55549SAndy Adamson 
173287bd3e9STrond Myklebust 	int (*prepare_layoutreturn) (struct nfs4_layoutreturn_args *);
174ac7db726SBenny Halevy 
175db29c089SAndy Adamson 	void (*cleanup_layoutcommit) (struct nfs4_layoutcommit_data *data);
1765f919c9fSChristoph Hellwig 	int (*prepare_layoutcommit) (struct nfs4_layoutcommit_args *args);
1778733408dSPeng Tao 	int (*prepare_layoutstats) (struct nfs42_layoutstat_args *args);
178b739a5bdSTrond Myklebust 
179b739a5bdSTrond Myklebust 	void (*cancel_io)(struct pnfs_layout_segment *lseg);
18085e174baSRicardo Labiaga };
18185e174baSRicardo Labiaga 
1829c455a8cSTrond Myklebust struct pnfs_commit_ops {
1839c455a8cSTrond Myklebust 	void (*setup_ds_info)(struct pnfs_ds_commit_info *,
1849c455a8cSTrond Myklebust 			      struct pnfs_layout_segment *);
1859c455a8cSTrond Myklebust 	void (*release_ds_info)(struct pnfs_ds_commit_info *,
1869c455a8cSTrond Myklebust 				struct inode *inode);
1879c455a8cSTrond Myklebust 	int (*commit_pagelist)(struct inode *inode,
1889c455a8cSTrond Myklebust 			       struct list_head *mds_pages,
1899c455a8cSTrond Myklebust 			       int how,
1909c455a8cSTrond Myklebust 			       struct nfs_commit_info *cinfo);
1919c455a8cSTrond Myklebust 	void (*mark_request_commit) (struct nfs_page *req,
1929c455a8cSTrond Myklebust 				     struct pnfs_layout_segment *lseg,
1939c455a8cSTrond Myklebust 				     struct nfs_commit_info *cinfo,
1949c455a8cSTrond Myklebust 				     u32 ds_commit_idx);
1959c455a8cSTrond Myklebust 	void (*clear_request_commit) (struct nfs_page *req,
1969c455a8cSTrond Myklebust 				      struct nfs_commit_info *cinfo);
1979c455a8cSTrond Myklebust 	int (*scan_commit_lists) (struct nfs_commit_info *cinfo,
1989c455a8cSTrond Myklebust 				  int max);
1999c455a8cSTrond Myklebust 	void (*recover_commit_reqs) (struct list_head *list,
2009c455a8cSTrond Myklebust 				     struct nfs_commit_info *cinfo);
2019c455a8cSTrond Myklebust };
2029c455a8cSTrond Myklebust 
203e5e94017SBenny Halevy struct pnfs_layout_hdr {
2042b28a7beSElena Reshetova 	refcount_t		plh_refcount;
20582714bd1STrond Myklebust 	atomic_t		plh_outstanding; /* number of RPCs out */
206b7edfaa1SFred Isaman 	struct list_head	plh_layouts;   /* other client layouts */
207fd9a8d71STrond Myklebust 	struct list_head	plh_bulk_destroy;
208b7edfaa1SFred Isaman 	struct list_head	plh_segs;      /* layout segments list */
20968f74479STrond Myklebust 	struct list_head	plh_return_segs; /* invalid layout segments */
210f7e8917aSFred Isaman 	unsigned long		plh_block_lgets; /* block LAYOUTGET if >0 */
21125c75333STrond Myklebust 	unsigned long		plh_retry_timestamp;
212566052c5SFred Isaman 	unsigned long		plh_flags;
21382714bd1STrond Myklebust 	nfs4_stateid		plh_stateid;
21482714bd1STrond Myklebust 	u32			plh_barrier; /* ignore lower seqids */
2153982a6a2SJeff Layton 	u32			plh_return_seq;
216016256dfSPeng Tao 	enum pnfs_iomode	plh_return_iomode;
217acff5880SPeng Tao 	loff_t			plh_lwb; /* last write byte for layoutcommit */
218a52458b4SNeilBrown 	const struct cred	*plh_lc_cred; /* layoutcommit cred */
219b7edfaa1SFred Isaman 	struct inode		*plh_inode;
220cf6605d1STrond Myklebust 	struct rcu_head		plh_rcu;
221e5e94017SBenny Halevy };
222e5e94017SBenny Halevy 
223b1f69b75SAndy Adamson struct pnfs_device {
224b1f69b75SAndy Adamson 	struct nfs4_deviceid dev_id;
225b1f69b75SAndy Adamson 	unsigned int  layout_type;
226b1f69b75SAndy Adamson 	unsigned int  mincount;
227f1c097beSAndy Adamson 	unsigned int  maxcount;	/* gdia_maxcount */
228b1f69b75SAndy Adamson 	struct page **pages;
229b1f69b75SAndy Adamson 	unsigned int  pgbase;
230f1c097beSAndy Adamson 	unsigned int  pglen;	/* reply buffer length */
231df52699eSTrond Myklebust 	unsigned char nocache : 1;/* May not be cached */
232b1f69b75SAndy Adamson };
233b1f69b75SAndy Adamson 
2347f11d8d3SAndy Adamson #define NFS4_PNFS_GETDEVLIST_MAXNUM 16
2357f11d8d3SAndy Adamson 
2367f11d8d3SAndy Adamson struct pnfs_devicelist {
2377f11d8d3SAndy Adamson 	unsigned int		eof;
2387f11d8d3SAndy Adamson 	unsigned int		num_devs;
2397f11d8d3SAndy Adamson 	struct nfs4_deviceid	dev_id[NFS4_PNFS_GETDEVLIST_MAXNUM];
2407f11d8d3SAndy Adamson };
2417f11d8d3SAndy Adamson 
24202c35fcaSFred Isaman extern int pnfs_register_layoutdriver(struct pnfs_layoutdriver_type *);
24302c35fcaSFred Isaman extern void pnfs_unregister_layoutdriver(struct pnfs_layoutdriver_type *);
2447c9d845fSTrond Myklebust extern const struct pnfs_layoutdriver_type *pnfs_find_layoutdriver(u32 id);
2457c9d845fSTrond Myklebust extern void pnfs_put_layoutdriver(const struct pnfs_layoutdriver_type *ld);
24602c35fcaSFred Isaman 
247b1f69b75SAndy Adamson /* nfs4proc.c */
24842375c2bSTrond Myklebust #define PNFS_FL_LAYOUTRETURN_ASYNC (1U << 0)
24942375c2bSTrond Myklebust #define PNFS_FL_LAYOUTRETURN_PRIVILEGED (1U << 1)
25042375c2bSTrond Myklebust 
251dacb452dSFred Isaman extern size_t max_response_pages(struct nfs_server *server);
252b1f69b75SAndy Adamson extern int nfs4_proc_getdeviceinfo(struct nfs_server *server,
253cd5875feSTrond Myklebust 				   struct pnfs_device *dev,
254a52458b4SNeilBrown 				   const struct cred *cred);
2556e7434abSTrond Myklebust extern struct pnfs_layout_segment *
2566e7434abSTrond Myklebust nfs4_proc_layoutget(struct nfs4_layoutget *lgp,
2576e7434abSTrond Myklebust 		    struct nfs4_exception *exception);
25842375c2bSTrond Myklebust extern int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp,
25942375c2bSTrond Myklebust 				  unsigned int flags);
260b1f69b75SAndy Adamson 
261b1f69b75SAndy Adamson /* pnfs.c */
26270c3bd2bSTrond Myklebust void pnfs_get_layout_hdr(struct pnfs_layout_hdr *lo);
2639369a431STrond Myklebust void pnfs_put_lseg(struct pnfs_layout_segment *lseg);
2641751c363STrond Myklebust 
265ca440c38SJeff Layton void set_pnfs_layoutdriver(struct nfs_server *, const struct nfs_fh *, struct nfs_fsinfo *);
26685e174baSRicardo Labiaga void unset_pnfs_layoutdriver(struct nfs_server *);
267a01b077aSOlga Kornievskaia void pnfs_generic_pg_check_layout(struct nfs_pageio_descriptor *pgio, struct nfs_page *req);
268d8007d4dSTrond Myklebust void pnfs_generic_pg_init_read(struct nfs_pageio_descriptor *, struct nfs_page *);
269493292ddSTrond Myklebust int pnfs_generic_pg_readpages(struct nfs_pageio_descriptor *desc);
2706296556fSPeng Tao void pnfs_generic_pg_init_write(struct nfs_pageio_descriptor *pgio,
2716296556fSPeng Tao 			        struct nfs_page *req, u64 wb_size);
272180bb5ecSWeston Andros Adamson void pnfs_generic_pg_cleanup(struct nfs_pageio_descriptor *);
273dce81290STrond Myklebust int pnfs_generic_pg_writepages(struct nfs_pageio_descriptor *desc);
274b4fdac1aSWeston Andros Adamson size_t pnfs_generic_pg_test(struct nfs_pageio_descriptor *pgio,
275b4fdac1aSWeston Andros Adamson 			    struct nfs_page *prev, struct nfs_page *req);
2761b0ae068SPeng Tao void pnfs_set_lo_fail(struct pnfs_layout_segment *lseg);
277a0b0a6e3STrond Myklebust struct pnfs_layout_segment *pnfs_layout_process(struct nfs4_layoutget *lgp);
27829a8bfe5STrond Myklebust void pnfs_layoutget_free(struct nfs4_layoutget *lgp);
27943f1b3daSFred Isaman void pnfs_free_lseg_list(struct list_head *tmp_list);
280e5e94017SBenny Halevy void pnfs_destroy_layout(struct nfs_inode *);
281b6d49ecdSTrond Myklebust void pnfs_destroy_layout_final(struct nfs_inode *);
282974cec8cSAndy Adamson void pnfs_destroy_all_layouts(struct nfs_client *);
2838adc8302STrond Myklebust int pnfs_layout_destroy_byfsid(struct nfs_client *clp, struct nfs_fsid *fsid,
2848adc8302STrond Myklebust 			       enum pnfs_layout_destroy_mode mode);
2858adc8302STrond Myklebust int pnfs_layout_destroy_byclid(struct nfs_client *clp,
2868adc8302STrond Myklebust 			       enum pnfs_layout_destroy_mode mode);
28730cb3ee2STrond Myklebust bool nfs4_layout_refresh_old_stateid(nfs4_stateid *dst,
288ecf84026STrond Myklebust 		struct pnfs_layout_range *dst_range,
289ecf84026STrond Myklebust 		struct inode *inode);
29070c3bd2bSTrond Myklebust void pnfs_put_layout_hdr(struct pnfs_layout_hdr *lo);
29143f1b3daSFred Isaman void pnfs_set_layout_stateid(struct pnfs_layout_hdr *lo,
29243f1b3daSFred Isaman 			     const nfs4_stateid *new,
29359b56394STrond Myklebust 			     const struct cred *cred,
29443f1b3daSFred Isaman 			     bool update_barrier);
29549a85061STrond Myklebust int pnfs_mark_matching_lsegs_invalid(struct pnfs_layout_hdr *lo,
29643f1b3daSFred Isaman 				struct list_head *tmp_list,
2976d597e17SJeff Layton 				const struct pnfs_layout_range *recall_range,
2986d597e17SJeff Layton 				u32 seq);
29910335556STrond Myklebust int pnfs_mark_matching_lsegs_return(struct pnfs_layout_hdr *lo,
300fc7ff367STrond Myklebust 				struct list_head *tmp_list,
3016d597e17SJeff Layton 				const struct pnfs_layout_range *recall_range,
3026d597e17SJeff Layton 				u32 seq);
3035f46be04STrond Myklebust int pnfs_mark_layout_stateid_invalid(struct pnfs_layout_hdr *lo,
3045f46be04STrond Myklebust 		struct list_head *lseg_list);
3051c5bd76dSTrond Myklebust bool pnfs_roc(struct inode *ino,
3061c5bd76dSTrond Myklebust 		struct nfs4_layoutreturn_args *args,
3071c5bd76dSTrond Myklebust 		struct nfs4_layoutreturn_res *res,
308a52458b4SNeilBrown 		const struct cred *cred);
309078000d0STrond Myklebust int pnfs_roc_done(struct rpc_task *task, struct nfs4_layoutreturn_args **argpp,
310078000d0STrond Myklebust 		  struct nfs4_layoutreturn_res **respp, int *ret);
3111c5bd76dSTrond Myklebust void pnfs_roc_release(struct nfs4_layoutreturn_args *args,
3121c5bd76dSTrond Myklebust 		struct nfs4_layoutreturn_res *res,
3131c5bd76dSTrond Myklebust 		int ret);
314500d701fSPeng Tao bool pnfs_wait_on_layoutreturn(struct inode *ino, struct rpc_task *task);
31567af7611STrond Myklebust void pnfs_set_layoutcommit(struct inode *, struct pnfs_layout_segment *, loff_t);
316db29c089SAndy Adamson void pnfs_cleanup_layoutcommit(struct nfs4_layoutcommit_data *data);
317ef311537SAndy Adamson int pnfs_layoutcommit_inode(struct inode *inode, bool sync);
3185bb89b47STrond Myklebust int pnfs_generic_sync(struct inode *inode, bool datasync);
3195bb89b47STrond Myklebust int pnfs_nfs_generic_sync(struct inode *inode, bool datasync);
320cbe82603SBenny Halevy int _pnfs_return_layout(struct inode *);
32124028672STrond Myklebust int pnfs_commit_and_return_layout(struct inode *);
322d45f60c6SWeston Andros Adamson void pnfs_ld_write_done(struct nfs_pgio_header *);
323d45f60c6SWeston Andros Adamson void pnfs_ld_read_done(struct nfs_pgio_header *);
324563c53e7STrond Myklebust void pnfs_read_resend_pnfs(struct nfs_pgio_header *, unsigned int mirror_idx);
3257c24d948SAndy Adamson struct pnfs_layout_segment *pnfs_update_layout(struct inode *ino,
3267c24d948SAndy Adamson 					       struct nfs_open_context *ctx,
3277c24d948SAndy Adamson 					       loff_t pos,
3287c24d948SAndy Adamson 					       u64 count,
3297c24d948SAndy Adamson 					       enum pnfs_iomode iomode,
330c7d73af2STom Haynes 					       bool strict_iomode,
3317c24d948SAndy Adamson 					       gfp_t gfp_flags);
332bbbff6d5STrond Myklebust void pnfs_layoutreturn_retry_later(struct pnfs_layout_hdr *lo,
333bbbff6d5STrond Myklebust 				   const nfs4_stateid *arg_stateid,
334bbbff6d5STrond Myklebust 				   const struct pnfs_layout_range *range);
33568f74479STrond Myklebust void pnfs_layoutreturn_free_lsegs(struct pnfs_layout_hdr *lo,
3362a974425STrond Myklebust 		const nfs4_stateid *arg_stateid,
33768f74479STrond Myklebust 		const struct pnfs_layout_range *range,
33868f74479STrond Myklebust 		const nfs4_stateid *stateid);
339e5e94017SBenny Halevy 
34003772d2fSTrond Myklebust void pnfs_generic_layout_insert_lseg(struct pnfs_layout_hdr *lo,
34103772d2fSTrond Myklebust 		   struct pnfs_layout_segment *lseg,
34203772d2fSTrond Myklebust 		   bool (*is_after)(const struct pnfs_layout_range *lseg_range,
34303772d2fSTrond Myklebust 			   const struct pnfs_layout_range *old),
34403772d2fSTrond Myklebust 		   bool (*do_merge)(struct pnfs_layout_segment *lseg,
34503772d2fSTrond Myklebust 			   struct pnfs_layout_segment *old),
34603772d2fSTrond Myklebust 		   struct list_head *free_me);
34703772d2fSTrond Myklebust 
348c47abcf8SAndy Adamson void nfs4_deviceid_mark_client_invalid(struct nfs_client *clp);
34953113ad3SWeston Andros Adamson int pnfs_read_done_resend_to_mds(struct nfs_pgio_header *);
35053113ad3SWeston Andros Adamson int pnfs_write_done_resend_to_mds(struct nfs_pgio_header *);
35182be417aSAndy Adamson struct nfs4_threshold *pnfs_mdsthreshold_alloc(void);
352016256dfSPeng Tao void pnfs_error_mark_layout_for_return(struct inode *inode,
353016256dfSPeng Tao 				       struct pnfs_layout_segment *lseg);
354b5fdf841STrond Myklebust void pnfs_layout_return_unused_byclid(struct nfs_client *clp,
355b5fdf841STrond Myklebust 				      enum pnfs_iomode iomode);
356*5468fc82STrond Myklebust int pnfs_layout_handle_reboot(struct nfs_client *clp);
357b5fdf841STrond Myklebust 
358c47abcf8SAndy Adamson /* nfs4_deviceid_flags */
359c47abcf8SAndy Adamson enum {
360c47abcf8SAndy Adamson 	NFS_DEVICEID_INVALID = 0,       /* set when MDS clientid recalled */
3611dfed273STrond Myklebust 	NFS_DEVICEID_UNAVAILABLE,	/* device temporarily unavailable */
362df52699eSTrond Myklebust 	NFS_DEVICEID_NOCACHE,		/* device may not be cached */
363c47abcf8SAndy Adamson };
364c47abcf8SAndy Adamson 
365a1eaecbcSBenny Halevy /* pnfs_dev.c */
366a1eaecbcSBenny Halevy struct nfs4_deviceid_node {
367a1eaecbcSBenny Halevy 	struct hlist_node		node;
3689e3bd4e2SWeston Andros Adamson 	struct hlist_node		tmpnode;
3691775bc34SBenny Halevy 	const struct pnfs_layoutdriver_type *ld;
370a1eaecbcSBenny Halevy 	const struct nfs_client		*nfs_client;
371c47abcf8SAndy Adamson 	unsigned long 			flags;
3721dfed273STrond Myklebust 	unsigned long			timestamp_unavailable;
373a1eaecbcSBenny Halevy 	struct nfs4_deviceid		deviceid;
37484a80f62STrond Myklebust 	struct rcu_head			rcu;
375a1eaecbcSBenny Halevy 	atomic_t			ref;
376a1eaecbcSBenny Halevy };
377a1eaecbcSBenny Halevy 
378661373b1SChristoph Hellwig struct nfs4_deviceid_node *
379661373b1SChristoph Hellwig nfs4_find_get_deviceid(struct nfs_server *server,
380a52458b4SNeilBrown 		const struct nfs4_deviceid *id, const struct cred *cred,
381661373b1SChristoph Hellwig 		gfp_t gfp_mask);
38235c8bb54SBenny Halevy void nfs4_delete_deviceid(const struct pnfs_layoutdriver_type *, const struct nfs_client *, const struct nfs4_deviceid *);
383661373b1SChristoph Hellwig void nfs4_init_deviceid_node(struct nfs4_deviceid_node *, struct nfs_server *,
384a1eaecbcSBenny Halevy 			     const struct nfs4_deviceid *);
385a1eaecbcSBenny Halevy bool nfs4_put_deviceid_node(struct nfs4_deviceid_node *);
38676c66905STrond Myklebust void nfs4_mark_deviceid_available(struct nfs4_deviceid_node *node);
3871dfed273STrond Myklebust void nfs4_mark_deviceid_unavailable(struct nfs4_deviceid_node *node);
3881dfed273STrond Myklebust bool nfs4_test_deviceid_unavailable(struct nfs4_deviceid_node *node);
3891775bc34SBenny Halevy void nfs4_deviceid_purge_client(const struct nfs_client *);
390a1eaecbcSBenny Halevy 
391f54bcf2eSTom Haynes /* pnfs_nfs.c */
392d7242c46STrond Myklebust struct pnfs_commit_array *pnfs_alloc_commit_array(size_t n, gfp_t gfp_flags);
393d7242c46STrond Myklebust void pnfs_free_commit_array(struct pnfs_commit_array *p);
394ba827c9aSTrond Myklebust struct pnfs_commit_array *pnfs_add_commit_array(struct pnfs_ds_commit_info *,
395ba827c9aSTrond Myklebust 						struct pnfs_commit_array *,
396ba827c9aSTrond Myklebust 						struct pnfs_layout_segment *);
397ba827c9aSTrond Myklebust 
398a9901899STrond Myklebust void pnfs_generic_ds_cinfo_release_lseg(struct pnfs_ds_commit_info *fl_cinfo,
399a9901899STrond Myklebust 		struct pnfs_layout_segment *lseg);
400a9901899STrond Myklebust void pnfs_generic_ds_cinfo_destroy(struct pnfs_ds_commit_info *fl_cinfo);
401d7242c46STrond Myklebust 
402f54bcf2eSTom Haynes void pnfs_generic_clear_request_commit(struct nfs_page *req,
403f54bcf2eSTom Haynes 				       struct nfs_commit_info *cinfo);
404f54bcf2eSTom Haynes void pnfs_generic_commit_release(void *calldata);
405f54bcf2eSTom Haynes void pnfs_generic_prepare_to_resend_writes(struct nfs_commit_data *data);
406f54bcf2eSTom Haynes void pnfs_generic_rw_release(void *data);
407f54bcf2eSTom Haynes void pnfs_generic_recover_commit_reqs(struct list_head *dst,
408f54bcf2eSTom Haynes 				      struct nfs_commit_info *cinfo);
409f54bcf2eSTom Haynes int pnfs_generic_commit_pagelist(struct inode *inode,
410f54bcf2eSTom Haynes 				 struct list_head *mds_pages,
411f54bcf2eSTom Haynes 				 int how,
412f54bcf2eSTom Haynes 				 struct nfs_commit_info *cinfo,
413f54bcf2eSTom Haynes 				 int (*initiate_commit)(struct nfs_commit_data *data,
414f54bcf2eSTom Haynes 							int how));
415f54bcf2eSTom Haynes int pnfs_generic_scan_commit_lists(struct nfs_commit_info *cinfo, int max);
416f54bcf2eSTom Haynes void pnfs_generic_write_commit_done(struct rpc_task *task, void *data);
417875ae069SPeng Tao void nfs4_pnfs_ds_put(struct nfs4_pnfs_ds *ds);
418875ae069SPeng Tao struct nfs4_pnfs_ds *nfs4_pnfs_ds_add(struct list_head *dsaddrs,
419875ae069SPeng Tao 				      gfp_t gfp_flags);
4205f01d953SPeng Tao void nfs4_pnfs_v3_ds_connect_unload(void);
421a33e4b03SWeston Andros Adamson int nfs4_pnfs_ds_connect(struct nfs_server *mds_srv, struct nfs4_pnfs_ds *ds,
4227405f9e1SPeng Tao 			  struct nfs4_deviceid_node *devid, unsigned int timeo,
4237d38de3fSAnna Schumaker 			  unsigned int retrans, u32 version, u32 minor_version);
4246b7f3cf9SPeng Tao struct nfs4_pnfs_ds_addr *nfs4_decode_mp_ds_addr(struct net *net,
4256b7f3cf9SPeng Tao 						 struct xdr_stream *xdr,
4266b7f3cf9SPeng Tao 						 gfp_t gfp_flags);
427338d00cfSTom Haynes void pnfs_layout_mark_request_commit(struct nfs_page *req,
428338d00cfSTom Haynes 				     struct pnfs_layout_segment *lseg,
429338d00cfSTom Haynes 				     struct nfs_commit_info *cinfo,
430338d00cfSTom Haynes 				     u32 ds_commit_idx);
4312409a976SFred Isaman void pnfs_lgopen_prepare(struct nfs4_opendata *data,
4322409a976SFred Isaman 			 struct nfs_open_context *ctx);
4332409a976SFred Isaman void pnfs_parse_lgopen(struct inode *ino, struct nfs4_layoutget *lgp,
4342409a976SFred Isaman 		       struct nfs_open_context *ctx);
43530ae2412SFred Isaman void nfs4_lgopen_release(struct nfs4_layoutget *lgp);
436f54bcf2eSTom Haynes 
nfs_have_layout(struct inode * inode)43740dd4b7aSTrond Myklebust static inline bool nfs_have_layout(struct inode *inode)
43840dd4b7aSTrond Myklebust {
43940dd4b7aSTrond Myklebust 	return NFS_I(inode)->layout != NULL;
44040dd4b7aSTrond Myklebust }
44140dd4b7aSTrond Myklebust 
pnfs_layout_is_valid(const struct pnfs_layout_hdr * lo)44245fcc7bcSTrond Myklebust static inline bool pnfs_layout_is_valid(const struct pnfs_layout_hdr *lo)
44345fcc7bcSTrond Myklebust {
44445fcc7bcSTrond Myklebust 	return test_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags) == 0;
44545fcc7bcSTrond Myklebust }
44645fcc7bcSTrond Myklebust 
44730ff0603SChristoph Hellwig static inline struct nfs4_deviceid_node *
nfs4_get_deviceid(struct nfs4_deviceid_node * d)44830ff0603SChristoph Hellwig nfs4_get_deviceid(struct nfs4_deviceid_node *d)
44930ff0603SChristoph Hellwig {
45030ff0603SChristoph Hellwig 	atomic_inc(&d->ref);
45130ff0603SChristoph Hellwig 	return d;
45230ff0603SChristoph Hellwig }
45330ff0603SChristoph Hellwig 
454d684d2aeSFred Isaman static inline struct pnfs_layout_segment *
pnfs_get_lseg(struct pnfs_layout_segment * lseg)4559369a431STrond Myklebust pnfs_get_lseg(struct pnfs_layout_segment *lseg)
456d684d2aeSFred Isaman {
457d684d2aeSFred Isaman 	if (lseg) {
458eba6dd69SElena Reshetova 		refcount_inc(&lseg->pls_refcount);
4594e857c58SPeter Zijlstra 		smp_mb__after_atomic();
460d684d2aeSFred Isaman 	}
461d684d2aeSFred Isaman 	return lseg;
462d684d2aeSFred Isaman }
463d684d2aeSFred Isaman 
464b20135d0STrond Myklebust static inline bool
pnfs_is_valid_lseg(struct pnfs_layout_segment * lseg)465b20135d0STrond Myklebust pnfs_is_valid_lseg(struct pnfs_layout_segment *lseg)
466b20135d0STrond Myklebust {
467b20135d0STrond Myklebust 	return test_bit(NFS_LSEG_VALID, &lseg->pls_flags) != 0;
468b20135d0STrond Myklebust }
469b20135d0STrond Myklebust 
470e5e94017SBenny Halevy /* Return true if a layout driver is being used for this mountpoint */
pnfs_enabled_sb(struct nfs_server * nfss)471e5e94017SBenny Halevy static inline int pnfs_enabled_sb(struct nfs_server *nfss)
472e5e94017SBenny Halevy {
473e5e94017SBenny Halevy 	return nfss->pnfs_curr_ld != NULL;
474e5e94017SBenny Halevy }
47585e174baSRicardo Labiaga 
476a861a1e1SFred Isaman static inline int
pnfs_commit_list(struct inode * inode,struct list_head * mds_pages,int how,struct nfs_commit_info * cinfo)477ea2cf228SFred Isaman pnfs_commit_list(struct inode *inode, struct list_head *mds_pages, int how,
478ea2cf228SFred Isaman 		 struct nfs_commit_info *cinfo)
479a861a1e1SFred Isaman {
4809c455a8cSTrond Myklebust 	struct pnfs_ds_commit_info *fl_cinfo = cinfo->ds;
4819c455a8cSTrond Myklebust 
4829c455a8cSTrond Myklebust 	if (fl_cinfo == NULL || fl_cinfo->ncommitting == 0)
483a861a1e1SFred Isaman 		return PNFS_NOT_ATTEMPTED;
4849c455a8cSTrond Myklebust 	return fl_cinfo->ops->commit_pagelist(inode, mds_pages, how, cinfo);
485ea2cf228SFred Isaman }
486ea2cf228SFred Isaman 
487ea2cf228SFred Isaman static inline struct pnfs_ds_commit_info *
pnfs_get_ds_info(struct inode * inode)488ea2cf228SFred Isaman pnfs_get_ds_info(struct inode *inode)
489ea2cf228SFred Isaman {
490ea2cf228SFred Isaman 	struct pnfs_layoutdriver_type *ld = NFS_SERVER(inode)->pnfs_curr_ld;
491ea2cf228SFred Isaman 
492ea2cf228SFred Isaman 	if (ld == NULL || ld->get_ds_info == NULL)
493ea2cf228SFred Isaman 		return NULL;
494ea2cf228SFred Isaman 	return ld->get_ds_info(inode);
495a861a1e1SFred Isaman }
496a861a1e1SFred Isaman 
497f54bcf2eSTom Haynes static inline void
pnfs_init_ds_commit_info_ops(struct pnfs_ds_commit_info * fl_cinfo,struct inode * inode)4989c455a8cSTrond Myklebust pnfs_init_ds_commit_info_ops(struct pnfs_ds_commit_info *fl_cinfo, struct inode *inode)
4999c455a8cSTrond Myklebust {
5009c455a8cSTrond Myklebust 	struct pnfs_ds_commit_info *inode_cinfo = pnfs_get_ds_info(inode);
5019c455a8cSTrond Myklebust 	if (inode_cinfo != NULL)
5029c455a8cSTrond Myklebust 		fl_cinfo->ops = inode_cinfo->ops;
5039c455a8cSTrond Myklebust }
5049c455a8cSTrond Myklebust 
5059c455a8cSTrond Myklebust static inline void
pnfs_init_ds_commit_info(struct pnfs_ds_commit_info * fl_cinfo)506c21e7168STrond Myklebust pnfs_init_ds_commit_info(struct pnfs_ds_commit_info *fl_cinfo)
507c21e7168STrond Myklebust {
508c21e7168STrond Myklebust 	INIT_LIST_HEAD(&fl_cinfo->commits);
5099c455a8cSTrond Myklebust 	fl_cinfo->ops = NULL;
510c21e7168STrond Myklebust }
511c21e7168STrond Myklebust 
512c21e7168STrond Myklebust static inline void
pnfs_release_ds_info(struct pnfs_ds_commit_info * fl_cinfo,struct inode * inode)51318f41296STrond Myklebust pnfs_release_ds_info(struct pnfs_ds_commit_info *fl_cinfo, struct inode *inode)
51418f41296STrond Myklebust {
5159c455a8cSTrond Myklebust 	if (fl_cinfo->ops != NULL && fl_cinfo->ops->release_ds_info != NULL)
5169c455a8cSTrond Myklebust 		fl_cinfo->ops->release_ds_info(fl_cinfo, inode);
51718f41296STrond Myklebust }
51818f41296STrond Myklebust 
51918f41296STrond Myklebust static inline void
pnfs_generic_mark_devid_invalid(struct nfs4_deviceid_node * node)520f54bcf2eSTom Haynes pnfs_generic_mark_devid_invalid(struct nfs4_deviceid_node *node)
521f54bcf2eSTom Haynes {
522f54bcf2eSTom Haynes 	set_bit(NFS_DEVICEID_INVALID, &node->flags);
523f54bcf2eSTom Haynes }
524f54bcf2eSTom Haynes 
5258dd37758STrond Myklebust static inline bool
pnfs_mark_request_commit(struct nfs_page * req,struct pnfs_layout_segment * lseg,struct nfs_commit_info * cinfo,u32 ds_commit_idx)526ea2cf228SFred Isaman pnfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg,
527b57ff130SWeston Andros Adamson 			 struct nfs_commit_info *cinfo, u32 ds_commit_idx)
528a861a1e1SFred Isaman {
5299c455a8cSTrond Myklebust 	struct pnfs_ds_commit_info *fl_cinfo = cinfo->ds;
530a861a1e1SFred Isaman 
531f0caea88STrond Myklebust 	if (!lseg || !fl_cinfo->ops || !fl_cinfo->ops->mark_request_commit)
5328dd37758STrond Myklebust 		return false;
5339c455a8cSTrond Myklebust 	fl_cinfo->ops->mark_request_commit(req, lseg, cinfo, ds_commit_idx);
5348dd37758STrond Myklebust 	return true;
535a861a1e1SFred Isaman }
536a861a1e1SFred Isaman 
5378dd37758STrond Myklebust static inline bool
pnfs_clear_request_commit(struct nfs_page * req,struct nfs_commit_info * cinfo)538ea2cf228SFred Isaman pnfs_clear_request_commit(struct nfs_page *req, struct nfs_commit_info *cinfo)
539a861a1e1SFred Isaman {
5409c455a8cSTrond Myklebust 	struct pnfs_ds_commit_info *fl_cinfo = cinfo->ds;
541d6d6dc7cSFred Isaman 
5429c455a8cSTrond Myklebust 	if (!fl_cinfo || !fl_cinfo->ops || !fl_cinfo->ops->clear_request_commit)
5438dd37758STrond Myklebust 		return false;
5449c455a8cSTrond Myklebust 	fl_cinfo->ops->clear_request_commit(req, cinfo);
5458dd37758STrond Myklebust 	return true;
546d6d6dc7cSFred Isaman }
547d6d6dc7cSFred Isaman 
548d6d6dc7cSFred Isaman static inline int
pnfs_scan_commit_lists(struct inode * inode,struct nfs_commit_info * cinfo,int max)549ea2cf228SFred Isaman pnfs_scan_commit_lists(struct inode *inode, struct nfs_commit_info *cinfo,
550ea2cf228SFred Isaman 		       int max)
551d6d6dc7cSFred Isaman {
5529c455a8cSTrond Myklebust 	struct pnfs_ds_commit_info *fl_cinfo = cinfo->ds;
5539c455a8cSTrond Myklebust 
5549c455a8cSTrond Myklebust 	if (!fl_cinfo || fl_cinfo->nwritten == 0)
555d6d6dc7cSFred Isaman 		return 0;
5569c455a8cSTrond Myklebust 	return fl_cinfo->ops->scan_commit_lists(cinfo, max);
5579c455a8cSTrond Myklebust }
5589c455a8cSTrond Myklebust 
5599c455a8cSTrond Myklebust static inline void
pnfs_recover_commit_reqs(struct list_head * head,struct nfs_commit_info * cinfo)5609c455a8cSTrond Myklebust pnfs_recover_commit_reqs(struct list_head *head, struct nfs_commit_info *cinfo)
5619c455a8cSTrond Myklebust {
5629c455a8cSTrond Myklebust 	struct pnfs_ds_commit_info *fl_cinfo = cinfo->ds;
5639c455a8cSTrond Myklebust 
5649c455a8cSTrond Myklebust 	if (fl_cinfo && fl_cinfo->nwritten != 0)
5659c455a8cSTrond Myklebust 		fl_cinfo->ops->recover_commit_reqs(head, cinfo);
566a861a1e1SFred Isaman }
567a861a1e1SFred Isaman 
5688a1636c4SBenny Halevy /* Should the pNFS client commit and return the layout upon a setattr */
5698a1636c4SBenny Halevy static inline bool
pnfs_ld_layoutret_on_setattr(struct inode * inode)5708a1636c4SBenny Halevy pnfs_ld_layoutret_on_setattr(struct inode *inode)
5718a1636c4SBenny Halevy {
5728a1636c4SBenny Halevy 	if (!pnfs_enabled_sb(NFS_SERVER(inode)))
5738a1636c4SBenny Halevy 		return false;
5748a1636c4SBenny Halevy 	return NFS_SERVER(inode)->pnfs_curr_ld->flags &
5758a1636c4SBenny Halevy 		PNFS_LAYOUTRET_ON_SETATTR;
5768a1636c4SBenny Halevy }
5778a1636c4SBenny Halevy 
578d8c951c3STrond Myklebust static inline bool
pnfs_ld_read_whole_page(struct inode * inode)579612aa983SChristoph Hellwig pnfs_ld_read_whole_page(struct inode *inode)
580612aa983SChristoph Hellwig {
581612aa983SChristoph Hellwig 	if (!pnfs_enabled_sb(NFS_SERVER(inode)))
582612aa983SChristoph Hellwig 		return false;
583612aa983SChristoph Hellwig 	return NFS_SERVER(inode)->pnfs_curr_ld->flags & PNFS_READ_WHOLE_PAGE;
584612aa983SChristoph Hellwig }
585612aa983SChristoph Hellwig 
5865bb89b47STrond Myklebust static inline int
pnfs_sync_inode(struct inode * inode,bool datasync)5875bb89b47STrond Myklebust pnfs_sync_inode(struct inode *inode, bool datasync)
5885bb89b47STrond Myklebust {
5895bb89b47STrond Myklebust 	if (!pnfs_enabled_sb(NFS_SERVER(inode)))
5905bb89b47STrond Myklebust 		return 0;
5915bb89b47STrond Myklebust 	return NFS_SERVER(inode)->pnfs_curr_ld->sync(inode, datasync);
5925bb89b47STrond Myklebust }
5935bb89b47STrond Myklebust 
594612aa983SChristoph Hellwig static inline bool
pnfs_layoutcommit_outstanding(struct inode * inode)595d8c951c3STrond Myklebust pnfs_layoutcommit_outstanding(struct inode *inode)
596d8c951c3STrond Myklebust {
597d8c951c3STrond Myklebust 	struct nfs_inode *nfsi = NFS_I(inode);
598d8c951c3STrond Myklebust 
599d8c951c3STrond Myklebust 	return test_bit(NFS_INO_LAYOUTCOMMIT, &nfsi->flags) != 0 ||
600d8c951c3STrond Myklebust 		test_bit(NFS_INO_LAYOUTCOMMITTING, &nfsi->flags) != 0;
601d8c951c3STrond Myklebust }
602d8c951c3STrond Myklebust 
pnfs_return_layout(struct inode * ino)603cbe82603SBenny Halevy static inline int pnfs_return_layout(struct inode *ino)
604cbe82603SBenny Halevy {
605cbe82603SBenny Halevy 	struct nfs_inode *nfsi = NFS_I(ino);
606cbe82603SBenny Halevy 	struct nfs_server *nfss = NFS_SERVER(ino);
607cbe82603SBenny Halevy 
608d78471d3SBenjamin Coddington 	if (pnfs_enabled_sb(nfss) && nfsi->layout) {
609d78471d3SBenjamin Coddington 		set_bit(NFS_LAYOUT_RETURN_REQUESTED, &nfsi->layout->plh_flags);
610cbe82603SBenny Halevy 		return _pnfs_return_layout(ino);
611d78471d3SBenjamin Coddington 	}
612cbe82603SBenny Halevy 
613cbe82603SBenny Halevy 	return 0;
614cbe82603SBenny Halevy }
615cbe82603SBenny Halevy 
61682be417aSAndy Adamson static inline bool
pnfs_use_threshold(struct nfs4_threshold ** dst,struct nfs4_threshold * src,struct nfs_server * nfss)61782be417aSAndy Adamson pnfs_use_threshold(struct nfs4_threshold **dst, struct nfs4_threshold *src,
61882be417aSAndy Adamson 		   struct nfs_server *nfss)
61982be417aSAndy Adamson {
620fb47ddc9SFred Isaman 	return (dst && src && src->bm != 0 && nfss->pnfs_curr_ld &&
62182be417aSAndy Adamson 					nfss->pnfs_curr_ld->id == src->l_type);
62282be417aSAndy Adamson }
62382be417aSAndy Adamson 
6240762ed2cSTrond Myklebust static inline u64
pnfs_calc_offset_end(u64 offset,u64 len)6250762ed2cSTrond Myklebust pnfs_calc_offset_end(u64 offset, u64 len)
6260762ed2cSTrond Myklebust {
6270762ed2cSTrond Myklebust 	if (len == NFS4_MAX_UINT64 || len >= NFS4_MAX_UINT64 - offset)
6280762ed2cSTrond Myklebust 		return NFS4_MAX_UINT64;
6290762ed2cSTrond Myklebust 	return offset + len - 1;
6300762ed2cSTrond Myklebust }
6310762ed2cSTrond Myklebust 
6320762ed2cSTrond Myklebust static inline u64
pnfs_calc_offset_length(u64 offset,u64 end)6330762ed2cSTrond Myklebust pnfs_calc_offset_length(u64 offset, u64 end)
6340762ed2cSTrond Myklebust {
6350762ed2cSTrond Myklebust 	if (end == NFS4_MAX_UINT64 || end <= offset)
6360762ed2cSTrond Myklebust 		return NFS4_MAX_UINT64;
6370762ed2cSTrond Myklebust 	return 1 + end - offset;
6380762ed2cSTrond Myklebust }
6390762ed2cSTrond Myklebust 
640e144e539STrond Myklebust static inline void
pnfs_copy_range(struct pnfs_layout_range * dst,const struct pnfs_layout_range * src)641e144e539STrond Myklebust pnfs_copy_range(struct pnfs_layout_range *dst,
642e144e539STrond Myklebust 		const struct pnfs_layout_range *src)
643e144e539STrond Myklebust {
644e144e539STrond Myklebust 	memcpy(dst, src, sizeof(*dst));
645e144e539STrond Myklebust }
646e144e539STrond Myklebust 
64717822b20STrond Myklebust static inline u64
pnfs_end_offset(u64 start,u64 len)64817822b20STrond Myklebust pnfs_end_offset(u64 start, u64 len)
64917822b20STrond Myklebust {
65017822b20STrond Myklebust 	if (NFS4_MAX_UINT64 - start <= len)
65117822b20STrond Myklebust 		return NFS4_MAX_UINT64;
65217822b20STrond Myklebust 	return start + len;
65317822b20STrond Myklebust }
65417822b20STrond Myklebust 
65517822b20STrond Myklebust /*
65617822b20STrond Myklebust  * Are 2 ranges intersecting?
65717822b20STrond Myklebust  *   start1                             end1
65817822b20STrond Myklebust  *   [----------------------------------)
65917822b20STrond Myklebust  *                                start2           end2
66017822b20STrond Myklebust  *                                [----------------)
66117822b20STrond Myklebust  */
66217822b20STrond Myklebust static inline bool
pnfs_is_range_intersecting(u64 start1,u64 end1,u64 start2,u64 end2)66317822b20STrond Myklebust pnfs_is_range_intersecting(u64 start1, u64 end1, u64 start2, u64 end2)
66417822b20STrond Myklebust {
66517822b20STrond Myklebust 	return (end1 == NFS4_MAX_UINT64 || start2 < end1) &&
66617822b20STrond Myklebust 		(end2 == NFS4_MAX_UINT64 || start1 < end2);
66717822b20STrond Myklebust }
66817822b20STrond Myklebust 
66917822b20STrond Myklebust static inline bool
pnfs_lseg_range_intersecting(const struct pnfs_layout_range * l1,const struct pnfs_layout_range * l2)67017822b20STrond Myklebust pnfs_lseg_range_intersecting(const struct pnfs_layout_range *l1,
67117822b20STrond Myklebust 		const struct pnfs_layout_range *l2)
67217822b20STrond Myklebust {
67317822b20STrond Myklebust 	u64 end1 = pnfs_end_offset(l1->offset, l1->length);
67417822b20STrond Myklebust 	u64 end2 = pnfs_end_offset(l2->offset, l2->length);
67517822b20STrond Myklebust 
67617822b20STrond Myklebust 	return pnfs_is_range_intersecting(l1->offset, end1, l2->offset, end2);
67717822b20STrond Myklebust }
67817822b20STrond Myklebust 
67908cb5b0fSBenjamin Coddington static inline bool
pnfs_lseg_request_intersecting(struct pnfs_layout_segment * lseg,struct nfs_page * req)68008cb5b0fSBenjamin Coddington pnfs_lseg_request_intersecting(struct pnfs_layout_segment *lseg, struct nfs_page *req)
68108cb5b0fSBenjamin Coddington {
68208cb5b0fSBenjamin Coddington 	u64 seg_last = pnfs_end_offset(lseg->pls_range.offset, lseg->pls_range.length);
68308cb5b0fSBenjamin Coddington 	u64 req_last = req_offset(req) + req->wb_bytes;
68408cb5b0fSBenjamin Coddington 
68508cb5b0fSBenjamin Coddington 	return pnfs_is_range_intersecting(lseg->pls_range.offset, seg_last,
68608cb5b0fSBenjamin Coddington 				req_offset(req), req_last);
68708cb5b0fSBenjamin Coddington }
68808cb5b0fSBenjamin Coddington 
pnfs_lseg_cancel_io(struct nfs_server * server,struct pnfs_layout_segment * lseg)689b739a5bdSTrond Myklebust static inline void pnfs_lseg_cancel_io(struct nfs_server *server,
690b739a5bdSTrond Myklebust 				       struct pnfs_layout_segment *lseg)
691b739a5bdSTrond Myklebust {
692b739a5bdSTrond Myklebust 	if (server->pnfs_curr_ld->cancel_io)
693b739a5bdSTrond Myklebust 		server->pnfs_curr_ld->cancel_io(lseg);
694b739a5bdSTrond Myklebust }
695b739a5bdSTrond Myklebust 
696bbf58bf3STrond Myklebust extern unsigned int layoutstats_timer;
697bbf58bf3STrond Myklebust 
6986f00866dSTrond Myklebust #ifdef NFS_DEBUG
6996f00866dSTrond Myklebust void nfs4_print_deviceid(const struct nfs4_deviceid *dev_id);
7006f00866dSTrond Myklebust #else
nfs4_print_deviceid(const struct nfs4_deviceid * dev_id)7016f00866dSTrond Myklebust static inline void nfs4_print_deviceid(const struct nfs4_deviceid *dev_id)
7026f00866dSTrond Myklebust {
7036f00866dSTrond Myklebust }
704bbf58bf3STrond Myklebust 
7056f00866dSTrond Myklebust #endif /* NFS_DEBUG */
70685e174baSRicardo Labiaga #else  /* CONFIG_NFS_V4_1 */
70785e174baSRicardo Labiaga 
nfs_have_layout(struct inode * inode)70840dd4b7aSTrond Myklebust static inline bool nfs_have_layout(struct inode *inode)
70940dd4b7aSTrond Myklebust {
71040dd4b7aSTrond Myklebust 	return false;
71140dd4b7aSTrond Myklebust }
71240dd4b7aSTrond Myklebust 
pnfs_destroy_all_layouts(struct nfs_client * clp)713974cec8cSAndy Adamson static inline void pnfs_destroy_all_layouts(struct nfs_client *clp)
714974cec8cSAndy Adamson {
715974cec8cSAndy Adamson }
716974cec8cSAndy Adamson 
pnfs_destroy_layout(struct nfs_inode * nfsi)717e5e94017SBenny Halevy static inline void pnfs_destroy_layout(struct nfs_inode *nfsi)
718e5e94017SBenny Halevy {
719e5e94017SBenny Halevy }
720e5e94017SBenny Halevy 
pnfs_destroy_layout_final(struct nfs_inode * nfsi)721b6d49ecdSTrond Myklebust static inline void pnfs_destroy_layout_final(struct nfs_inode *nfsi)
722b6d49ecdSTrond Myklebust {
723b6d49ecdSTrond Myklebust }
724b6d49ecdSTrond Myklebust 
pnfs_layout_handle_reboot(struct nfs_client * clp)725*5468fc82STrond Myklebust static inline int pnfs_layout_handle_reboot(struct nfs_client *clp)
726*5468fc82STrond Myklebust {
727*5468fc82STrond Myklebust 	return 0;
728*5468fc82STrond Myklebust }
729*5468fc82STrond Myklebust 
730e5e94017SBenny Halevy static inline struct pnfs_layout_segment *
pnfs_get_lseg(struct pnfs_layout_segment * lseg)7319369a431STrond Myklebust pnfs_get_lseg(struct pnfs_layout_segment *lseg)
732d684d2aeSFred Isaman {
733d684d2aeSFred Isaman 	return NULL;
734d684d2aeSFred Isaman }
735d684d2aeSFred Isaman 
pnfs_put_lseg(struct pnfs_layout_segment * lseg)7369369a431STrond Myklebust static inline void pnfs_put_lseg(struct pnfs_layout_segment *lseg)
737d684d2aeSFred Isaman {
738d684d2aeSFred Isaman }
739d684d2aeSFred Isaman 
pnfs_return_layout(struct inode * ino)740cbe82603SBenny Halevy static inline int pnfs_return_layout(struct inode *ino)
741cbe82603SBenny Halevy {
742cbe82603SBenny Halevy 	return 0;
743cbe82603SBenny Halevy }
744cbe82603SBenny Halevy 
pnfs_commit_and_return_layout(struct inode * inode)74524028672STrond Myklebust static inline int pnfs_commit_and_return_layout(struct inode *inode)
74624028672STrond Myklebust {
74724028672STrond Myklebust 	return 0;
74824028672STrond Myklebust }
74924028672STrond Myklebust 
750f7e8917aSFred Isaman static inline bool
pnfs_ld_layoutret_on_setattr(struct inode * inode)7518a1636c4SBenny Halevy pnfs_ld_layoutret_on_setattr(struct inode *inode)
7528a1636c4SBenny Halevy {
7538a1636c4SBenny Halevy 	return false;
7548a1636c4SBenny Halevy }
7558a1636c4SBenny Halevy 
7568a1636c4SBenny Halevy static inline bool
pnfs_ld_read_whole_page(struct inode * inode)757612aa983SChristoph Hellwig pnfs_ld_read_whole_page(struct inode *inode)
758612aa983SChristoph Hellwig {
759612aa983SChristoph Hellwig 	return false;
760612aa983SChristoph Hellwig }
761612aa983SChristoph Hellwig 
7625bb89b47STrond Myklebust static inline int
pnfs_sync_inode(struct inode * inode,bool datasync)7635bb89b47STrond Myklebust pnfs_sync_inode(struct inode *inode, bool datasync)
7645bb89b47STrond Myklebust {
7655bb89b47STrond Myklebust 	return 0;
7665bb89b47STrond Myklebust }
7675bb89b47STrond Myklebust 
768612aa983SChristoph Hellwig static inline bool
pnfs_layoutcommit_outstanding(struct inode * inode)76910b7e9adSTrond Myklebust pnfs_layoutcommit_outstanding(struct inode *inode)
77010b7e9adSTrond Myklebust {
77110b7e9adSTrond Myklebust 	return false;
77210b7e9adSTrond Myklebust }
77310b7e9adSTrond Myklebust 
77410b7e9adSTrond Myklebust 
77510b7e9adSTrond Myklebust static inline bool
pnfs_roc(struct inode * ino,struct nfs4_layoutreturn_args * args,struct nfs4_layoutreturn_res * res,const struct cred * cred)7761c5bd76dSTrond Myklebust pnfs_roc(struct inode *ino,
7771c5bd76dSTrond Myklebust 		struct nfs4_layoutreturn_args *args,
7781c5bd76dSTrond Myklebust 		struct nfs4_layoutreturn_res *res,
779a52458b4SNeilBrown 		const struct cred *cred)
780f7e8917aSFred Isaman {
781f7e8917aSFred Isaman 	return false;
782f7e8917aSFred Isaman }
783f7e8917aSFred Isaman 
784287a9c55STrond Myklebust static inline int
pnfs_roc_done(struct rpc_task * task,struct nfs4_layoutreturn_args ** argpp,struct nfs4_layoutreturn_res ** respp,int * ret)785078000d0STrond Myklebust pnfs_roc_done(struct rpc_task *task,
786287a9c55STrond Myklebust 		struct nfs4_layoutreturn_args **argpp,
787287a9c55STrond Myklebust 		struct nfs4_layoutreturn_res **respp,
788287a9c55STrond Myklebust 		int *ret)
789287a9c55STrond Myklebust {
790287a9c55STrond Myklebust 	return 0;
791287a9c55STrond Myklebust }
792287a9c55STrond Myklebust 
793f7e8917aSFred Isaman static inline void
pnfs_roc_release(struct nfs4_layoutreturn_args * args,struct nfs4_layoutreturn_res * res,int ret)7941c5bd76dSTrond Myklebust pnfs_roc_release(struct nfs4_layoutreturn_args *args,
7951c5bd76dSTrond Myklebust 		struct nfs4_layoutreturn_res *res,
7961c5bd76dSTrond Myklebust 		int ret)
797f7e8917aSFred Isaman {
798f7e8917aSFred Isaman }
799f7e8917aSFred Isaman 
800500d701fSPeng Tao static inline bool
pnfs_wait_on_layoutreturn(struct inode * ino,struct rpc_task * task)801500d701fSPeng Tao pnfs_wait_on_layoutreturn(struct inode *ino, struct rpc_task *task)
802500d701fSPeng Tao {
803500d701fSPeng Tao 	return false;
804500d701fSPeng Tao }
805500d701fSPeng Tao 
set_pnfs_layoutdriver(struct nfs_server * s,const struct nfs_fh * mntfh,struct nfs_fsinfo * fsinfo)806738fd0f3SBenny Halevy static inline void set_pnfs_layoutdriver(struct nfs_server *s,
807ca440c38SJeff Layton 					 const struct nfs_fh *mntfh,
808ca440c38SJeff Layton 					 struct nfs_fsinfo *fsinfo)
80985e174baSRicardo Labiaga {
81085e174baSRicardo Labiaga }
81185e174baSRicardo Labiaga 
unset_pnfs_layoutdriver(struct nfs_server * s)81285e174baSRicardo Labiaga static inline void unset_pnfs_layoutdriver(struct nfs_server *s)
81385e174baSRicardo Labiaga {
81485e174baSRicardo Labiaga }
81585e174baSRicardo Labiaga 
816a861a1e1SFred Isaman static inline int
pnfs_commit_list(struct inode * inode,struct list_head * mds_pages,int how,struct nfs_commit_info * cinfo)817ea2cf228SFred Isaman pnfs_commit_list(struct inode *inode, struct list_head *mds_pages, int how,
818ea2cf228SFred Isaman 		 struct nfs_commit_info *cinfo)
819a861a1e1SFred Isaman {
820a861a1e1SFred Isaman 	return PNFS_NOT_ATTEMPTED;
821a861a1e1SFred Isaman }
822a861a1e1SFred Isaman 
823ea2cf228SFred Isaman static inline struct pnfs_ds_commit_info *
pnfs_get_ds_info(struct inode * inode)824ea2cf228SFred Isaman pnfs_get_ds_info(struct inode *inode)
825ea2cf228SFred Isaman {
826ea2cf228SFred Isaman 	return NULL;
827ea2cf228SFred Isaman }
828ea2cf228SFred Isaman 
829c21e7168STrond Myklebust static inline void
pnfs_init_ds_commit_info_ops(struct pnfs_ds_commit_info * fl_cinfo,struct inode * inode)8309c455a8cSTrond Myklebust pnfs_init_ds_commit_info_ops(struct pnfs_ds_commit_info *fl_cinfo, struct inode *inode)
8319c455a8cSTrond Myklebust {
8329c455a8cSTrond Myklebust }
8339c455a8cSTrond Myklebust 
8349c455a8cSTrond Myklebust static inline void
pnfs_init_ds_commit_info(struct pnfs_ds_commit_info * fl_cinfo)835c21e7168STrond Myklebust pnfs_init_ds_commit_info(struct pnfs_ds_commit_info *fl_cinfo)
836c21e7168STrond Myklebust {
837c21e7168STrond Myklebust }
838c21e7168STrond Myklebust 
83918f41296STrond Myklebust static inline void
pnfs_release_ds_info(struct pnfs_ds_commit_info * fl_cinfo,struct inode * inode)84018f41296STrond Myklebust pnfs_release_ds_info(struct pnfs_ds_commit_info *fl_cinfo, struct inode *inode)
84118f41296STrond Myklebust {
84218f41296STrond Myklebust }
84318f41296STrond Myklebust 
8448dd37758STrond Myklebust static inline bool
pnfs_mark_request_commit(struct nfs_page * req,struct pnfs_layout_segment * lseg,struct nfs_commit_info * cinfo,u32 ds_commit_idx)845ea2cf228SFred Isaman pnfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg,
846b57ff130SWeston Andros Adamson 			 struct nfs_commit_info *cinfo, u32 ds_commit_idx)
847a861a1e1SFred Isaman {
8488dd37758STrond Myklebust 	return false;
849a861a1e1SFred Isaman }
850a861a1e1SFred Isaman 
8518dd37758STrond Myklebust static inline bool
pnfs_clear_request_commit(struct nfs_page * req,struct nfs_commit_info * cinfo)852ea2cf228SFred Isaman pnfs_clear_request_commit(struct nfs_page *req, struct nfs_commit_info *cinfo)
853a861a1e1SFred Isaman {
8548dd37758STrond Myklebust 	return false;
855d6d6dc7cSFred Isaman }
856d6d6dc7cSFred Isaman 
857d6d6dc7cSFred Isaman static inline int
pnfs_scan_commit_lists(struct inode * inode,struct nfs_commit_info * cinfo,int max)858ea2cf228SFred Isaman pnfs_scan_commit_lists(struct inode *inode, struct nfs_commit_info *cinfo,
859ea2cf228SFred Isaman 		       int max)
860d6d6dc7cSFred Isaman {
861d6d6dc7cSFred Isaman 	return 0;
862a861a1e1SFred Isaman }
863a861a1e1SFred Isaman 
8649c455a8cSTrond Myklebust static inline void
pnfs_recover_commit_reqs(struct list_head * head,struct nfs_commit_info * cinfo)8659c455a8cSTrond Myklebust pnfs_recover_commit_reqs(struct list_head *head, struct nfs_commit_info *cinfo)
8669c455a8cSTrond Myklebust {
8679c455a8cSTrond Myklebust }
8689c455a8cSTrond Myklebust 
pnfs_layoutcommit_inode(struct inode * inode,bool sync)869ef311537SAndy Adamson static inline int pnfs_layoutcommit_inode(struct inode *inode, bool sync)
870863a3c6cSAndy Adamson {
871863a3c6cSAndy Adamson 	return 0;
872863a3c6cSAndy Adamson }
8731775bc34SBenny Halevy 
87482be417aSAndy Adamson static inline bool
pnfs_use_threshold(struct nfs4_threshold ** dst,struct nfs4_threshold * src,struct nfs_server * nfss)87582be417aSAndy Adamson pnfs_use_threshold(struct nfs4_threshold **dst, struct nfs4_threshold *src,
87682be417aSAndy Adamson 		   struct nfs_server *nfss)
87782be417aSAndy Adamson {
87882be417aSAndy Adamson 	return false;
87982be417aSAndy Adamson }
88082be417aSAndy Adamson 
pnfs_mdsthreshold_alloc(void)88182be417aSAndy Adamson static inline struct nfs4_threshold *pnfs_mdsthreshold_alloc(void)
88282be417aSAndy Adamson {
88382be417aSAndy Adamson 	return NULL;
88482be417aSAndy Adamson }
88582be417aSAndy Adamson 
nfs4_pnfs_v3_ds_connect_unload(void)8865f01d953SPeng Tao static inline void nfs4_pnfs_v3_ds_connect_unload(void)
8875f01d953SPeng Tao {
8885f01d953SPeng Tao }
8895f01d953SPeng Tao 
nfs4_layout_refresh_old_stateid(nfs4_stateid * dst,struct pnfs_layout_range * dst_range,struct inode * inode)89030cb3ee2STrond Myklebust static inline bool nfs4_layout_refresh_old_stateid(nfs4_stateid *dst,
891ecf84026STrond Myklebust 		struct pnfs_layout_range *dst_range,
8927380020eSTrond Myklebust 		struct inode *inode)
8937380020eSTrond Myklebust {
8947380020eSTrond Myklebust 	return false;
8957380020eSTrond Myklebust }
8962409a976SFred Isaman 
pnfs_lgopen_prepare(struct nfs4_opendata * data,struct nfs_open_context * ctx)8972409a976SFred Isaman static inline void pnfs_lgopen_prepare(struct nfs4_opendata *data,
8982409a976SFred Isaman 		struct nfs_open_context *ctx)
8992409a976SFred Isaman {
9002409a976SFred Isaman }
9012409a976SFred Isaman 
pnfs_parse_lgopen(struct inode * ino,struct nfs4_layoutget * lgp,struct nfs_open_context * ctx)9022409a976SFred Isaman static inline void pnfs_parse_lgopen(struct inode *ino,
9032409a976SFred Isaman 		struct nfs4_layoutget *lgp,
9042409a976SFred Isaman 		struct nfs_open_context *ctx)
9052409a976SFred Isaman {
9062409a976SFred Isaman }
90730ae2412SFred Isaman 
nfs4_lgopen_release(struct nfs4_layoutget * lgp)90830ae2412SFred Isaman static inline void nfs4_lgopen_release(struct nfs4_layoutget *lgp)
90930ae2412SFred Isaman {
91030ae2412SFred Isaman }
91130ae2412SFred Isaman 
pnfs_layout_is_valid(const struct pnfs_layout_hdr * lo)912c8bf7073STrond Myklebust static inline bool pnfs_layout_is_valid(const struct pnfs_layout_hdr *lo)
913c8bf7073STrond Myklebust {
914c8bf7073STrond Myklebust 	return false;
915c8bf7073STrond Myklebust }
916c8bf7073STrond Myklebust 
91785e174baSRicardo Labiaga #endif /* CONFIG_NFS_V4_1 */
91885e174baSRicardo Labiaga 
919865a7ecbSPeng Tao #if IS_ENABLED(CONFIG_NFS_V4_2)
920c8ad8894STrond Myklebust int pnfs_report_layoutstat(struct inode *inode, gfp_t gfp_flags);
921865a7ecbSPeng Tao #else
922865a7ecbSPeng Tao static inline int
pnfs_report_layoutstat(struct inode * inode,gfp_t gfp_flags)923c8ad8894STrond Myklebust pnfs_report_layoutstat(struct inode *inode, gfp_t gfp_flags)
924865a7ecbSPeng Tao {
925865a7ecbSPeng Tao 	return 0;
926865a7ecbSPeng Tao }
927865a7ecbSPeng Tao #endif
928865a7ecbSPeng Tao 
92985e174baSRicardo Labiaga #endif /* FS_NFS_PNFS_H */
930