xref: /openbmc/linux/fs/nfs/pnfs.h (revision 9a87ffc99ec8eb8d35eed7c4f816d75f5cc9662e)
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 
382409a976SFred Isaman struct nfs4_opendata;
392409a976SFred Isaman 
404541d16cSFred Isaman enum {
414541d16cSFred Isaman 	NFS_LSEG_VALID = 0,	/* cleared when lseg is recalled/returned */
42f7e8917aSFred Isaman 	NFS_LSEG_ROC,		/* roc bit received from server */
43a9bae566SPeng Tao 	NFS_LSEG_LAYOUTCOMMIT,	/* layoutcommit bit set for layoutcommit */
44016256dfSPeng Tao 	NFS_LSEG_LAYOUTRETURN,	/* layoutreturn bit set for layoutreturn */
45b3dce6a2SBenjamin Coddington 	NFS_LSEG_UNAVAILABLE,	/* unavailable bit set for temporary problem */
464541d16cSFred Isaman };
474541d16cSFred Isaman 
48875ae069SPeng Tao /* Individual ip address */
49875ae069SPeng Tao struct nfs4_pnfs_ds_addr {
50875ae069SPeng Tao 	struct sockaddr_storage	da_addr;
51875ae069SPeng Tao 	size_t			da_addrlen;
52875ae069SPeng Tao 	struct list_head	da_node;  /* nfs4_pnfs_dev_hlist dev_dslist */
53875ae069SPeng Tao 	char			*da_remotestr;	/* human readable addr+port */
544be78d26STrond Myklebust 	const char		*da_netid;
554be78d26STrond Myklebust 	int			da_transport;
56875ae069SPeng Tao };
57875ae069SPeng Tao 
58875ae069SPeng Tao struct nfs4_pnfs_ds {
59875ae069SPeng Tao 	struct list_head	ds_node;  /* nfs4_pnfs_dev_hlist dev_dslist */
60875ae069SPeng Tao 	char			*ds_remotestr;	/* comma sep list of addrs */
61875ae069SPeng Tao 	struct list_head	ds_addrs;
62875ae069SPeng Tao 	struct nfs_client	*ds_clp;
63a2a5dea7SElena Reshetova 	refcount_t		ds_count;
64875ae069SPeng Tao 	unsigned long		ds_state;
65875ae069SPeng Tao #define NFS4DS_CONNECTING	0	/* ds is establishing connection */
6685e174baSRicardo Labiaga };
6785e174baSRicardo Labiaga 
68974cec8cSAndy Adamson struct pnfs_layout_segment {
69566052c5SFred Isaman 	struct list_head pls_list;
70a9bae566SPeng Tao 	struct list_head pls_lc_list;
71a9901899STrond Myklebust 	struct list_head pls_commits;
72566052c5SFred Isaman 	struct pnfs_layout_range pls_range;
73eba6dd69SElena Reshetova 	refcount_t pls_refcount;
7466755283SJeff Layton 	u32 pls_seq;
754541d16cSFred Isaman 	unsigned long pls_flags;
76566052c5SFred Isaman 	struct pnfs_layout_hdr *pls_layout;
77974cec8cSAndy Adamson };
78974cec8cSAndy Adamson 
7964419a9bSAndy Adamson enum pnfs_try_status {
8064419a9bSAndy Adamson 	PNFS_ATTEMPTED     = 0,
8164419a9bSAndy Adamson 	PNFS_NOT_ATTEMPTED = 1,
82ceb11e13SPeng Tao 	PNFS_TRY_AGAIN     = 2,
8364419a9bSAndy Adamson };
8464419a9bSAndy Adamson 
8585e174baSRicardo Labiaga #ifdef CONFIG_NFS_V4_1
8685e174baSRicardo Labiaga 
8785e174baSRicardo Labiaga #define LAYOUT_NFSV4_1_MODULE_PREFIX "nfs-layouttype4"
8885e174baSRicardo Labiaga 
8939280a5aSPeng Tao /*
9039280a5aSPeng Tao  * Default data server connection timeout and retrans vaules.
9139280a5aSPeng Tao  * Set by module parameters dataserver_timeo and dataserver_retrans.
9239280a5aSPeng Tao  */
9339280a5aSPeng Tao #define NFS4_DEF_DS_TIMEO   600 /* in tenths of a second */
9439280a5aSPeng Tao #define NFS4_DEF_DS_RETRANS 5
95b3dce6a2SBenjamin Coddington #define PNFS_DEVICE_RETRY_TIMEOUT (120*HZ)
9639280a5aSPeng Tao 
97e5e94017SBenny Halevy enum {
98e5e94017SBenny Halevy 	NFS_LAYOUT_RO_FAILED = 0,	/* get ro layout failed stop trying */
99e5e94017SBenny Halevy 	NFS_LAYOUT_RW_FAILED,		/* get rw layout failed stop trying */
10043f1b3daSFred Isaman 	NFS_LAYOUT_BULK_RECALL,		/* bulk recall affecting layout */
1012370abdaSTrond Myklebust 	NFS_LAYOUT_RETURN,		/* layoutreturn in progress */
1026604b203STrond Myklebust 	NFS_LAYOUT_RETURN_LOCK,		/* Serialise layoutreturn */
1032370abdaSTrond Myklebust 	NFS_LAYOUT_RETURN_REQUESTED,	/* Return this layout ASAP */
10447abadefSChristoph Hellwig 	NFS_LAYOUT_INVALID_STID,	/* layout stateid id is invalid */
1059bf87482SPeng Tao 	NFS_LAYOUT_FIRST_LAYOUTGET,	/* Serialize first layoutget */
1065085607dSTrond Myklebust 	NFS_LAYOUT_INODE_FREEING,	/* The inode is being freed */
107cf6605d1STrond Myklebust 	NFS_LAYOUT_HASHED,		/* The layout visible */
108880265c7STrond Myklebust 	NFS_LAYOUT_DRAIN,
109e5e94017SBenny Halevy };
110e5e94017SBenny Halevy 
1118a1636c4SBenny Halevy enum layoutdriver_policy_flags {
11288ac815cSPeng Tao 	/* Should the pNFS client commit and return the layout upon truncate to
11388ac815cSPeng Tao 	 * a smaller size */
1148a1636c4SBenny Halevy 	PNFS_LAYOUTRET_ON_SETATTR	= 1 << 0,
115fe0fe835SBoaz Harrosh 	PNFS_LAYOUTRET_ON_ERROR		= 1 << 1,
116612aa983SChristoph Hellwig 	PNFS_READ_WHOLE_PAGE		= 1 << 2,
117f86c3ac5SFred Isaman 	PNFS_LAYOUTGET_ON_OPEN		= 1 << 3,
1188a1636c4SBenny Halevy };
1198a1636c4SBenny Halevy 
1201775bc34SBenny Halevy struct nfs4_deviceid_node;
1211775bc34SBenny Halevy 
12285e174baSRicardo Labiaga /* Per-layout driver specific registration structure */
12385e174baSRicardo Labiaga struct pnfs_layoutdriver_type {
12402c35fcaSFred Isaman 	struct list_head pnfs_tblid;
12502c35fcaSFred Isaman 	const u32 id;
12602c35fcaSFred Isaman 	const char *name;
12702c35fcaSFred Isaman 	struct module *owner;
1288a1636c4SBenny Halevy 	unsigned flags;
129661373b1SChristoph Hellwig 	unsigned max_deviceinfo_size;
13028ced9a8STrond Myklebust 	unsigned max_layoutget_response;
131636fb9c8SBenny Halevy 
132738fd0f3SBenny Halevy 	int (*set_layoutdriver) (struct nfs_server *, const struct nfs_fh *);
133738fd0f3SBenny Halevy 	int (*clear_layoutdriver) (struct nfs_server *);
134738fd0f3SBenny Halevy 
135636fb9c8SBenny Halevy 	struct pnfs_layout_hdr * (*alloc_layout_hdr) (struct inode *inode, gfp_t gfp_flags);
136636fb9c8SBenny Halevy 	void (*free_layout_hdr) (struct pnfs_layout_hdr *);
137636fb9c8SBenny Halevy 
138a75b9df9STrond Myklebust 	struct pnfs_layout_segment * (*alloc_lseg) (struct pnfs_layout_hdr *layoutid, struct nfs4_layoutget_res *lgr, gfp_t gfp_flags);
139b1f69b75SAndy Adamson 	void (*free_lseg) (struct pnfs_layout_segment *lseg);
14003772d2fSTrond Myklebust 	void (*add_lseg) (struct pnfs_layout_hdr *layoutid,
14103772d2fSTrond Myklebust 			struct pnfs_layout_segment *lseg,
14203772d2fSTrond Myklebust 			struct list_head *free_me);
14394ad1c80SFred Isaman 
144c88953d8SChristoph Hellwig 	void (*return_range) (struct pnfs_layout_hdr *lo,
145c88953d8SChristoph Hellwig 			      struct pnfs_layout_range *range);
146c88953d8SChristoph Hellwig 
14794ad1c80SFred Isaman 	/* test for nfs page cache coalescing */
1481751c363STrond Myklebust 	const struct nfs_pageio_ops *pg_read_ops;
1491751c363STrond Myklebust 	const struct nfs_pageio_ops *pg_write_ops;
15064419a9bSAndy Adamson 
151ea2cf228SFred Isaman 	struct pnfs_ds_commit_info *(*get_ds_info) (struct inode *inode);
152a861a1e1SFred Isaman 
1535bb89b47STrond Myklebust 	int (*sync)(struct inode *inode, bool datasync);
1545bb89b47STrond Myklebust 
15564419a9bSAndy Adamson 	/*
15664419a9bSAndy Adamson 	 * Return PNFS_ATTEMPTED to indicate the layout code has attempted
15764419a9bSAndy Adamson 	 * I/O, else return PNFS_NOT_ATTEMPTED to fall back to normal NFS
15864419a9bSAndy Adamson 	 */
159d45f60c6SWeston Andros Adamson 	enum pnfs_try_status (*read_pagelist)(struct nfs_pgio_header *);
160d45f60c6SWeston Andros Adamson 	enum pnfs_try_status (*write_pagelist)(struct nfs_pgio_header *, int);
1611775bc34SBenny Halevy 
1621775bc34SBenny Halevy 	void (*free_deviceid_node) (struct nfs4_deviceid_node *);
163661373b1SChristoph Hellwig 	struct nfs4_deviceid_node * (*alloc_deviceid_node)
164661373b1SChristoph Hellwig 			(struct nfs_server *server, struct pnfs_device *pdev,
165661373b1SChristoph Hellwig 			gfp_t gfp_flags);
16604a55549SAndy Adamson 
167287bd3e9STrond Myklebust 	int (*prepare_layoutreturn) (struct nfs4_layoutreturn_args *);
168ac7db726SBenny Halevy 
169db29c089SAndy Adamson 	void (*cleanup_layoutcommit) (struct nfs4_layoutcommit_data *data);
1705f919c9fSChristoph Hellwig 	int (*prepare_layoutcommit) (struct nfs4_layoutcommit_args *args);
1718733408dSPeng Tao 	int (*prepare_layoutstats) (struct nfs42_layoutstat_args *args);
172b739a5bdSTrond Myklebust 
173b739a5bdSTrond Myklebust 	void (*cancel_io)(struct pnfs_layout_segment *lseg);
17485e174baSRicardo Labiaga };
17585e174baSRicardo Labiaga 
1769c455a8cSTrond Myklebust struct pnfs_commit_ops {
1779c455a8cSTrond Myklebust 	void (*setup_ds_info)(struct pnfs_ds_commit_info *,
1789c455a8cSTrond Myklebust 			      struct pnfs_layout_segment *);
1799c455a8cSTrond Myklebust 	void (*release_ds_info)(struct pnfs_ds_commit_info *,
1809c455a8cSTrond Myklebust 				struct inode *inode);
1819c455a8cSTrond Myklebust 	int (*commit_pagelist)(struct inode *inode,
1829c455a8cSTrond Myklebust 			       struct list_head *mds_pages,
1839c455a8cSTrond Myklebust 			       int how,
1849c455a8cSTrond Myklebust 			       struct nfs_commit_info *cinfo);
1859c455a8cSTrond Myklebust 	void (*mark_request_commit) (struct nfs_page *req,
1869c455a8cSTrond Myklebust 				     struct pnfs_layout_segment *lseg,
1879c455a8cSTrond Myklebust 				     struct nfs_commit_info *cinfo,
1889c455a8cSTrond Myklebust 				     u32 ds_commit_idx);
1899c455a8cSTrond Myklebust 	void (*clear_request_commit) (struct nfs_page *req,
1909c455a8cSTrond Myklebust 				      struct nfs_commit_info *cinfo);
1919c455a8cSTrond Myklebust 	int (*scan_commit_lists) (struct nfs_commit_info *cinfo,
1929c455a8cSTrond Myklebust 				  int max);
1939c455a8cSTrond Myklebust 	void (*recover_commit_reqs) (struct list_head *list,
1949c455a8cSTrond Myklebust 				     struct nfs_commit_info *cinfo);
1959c455a8cSTrond Myklebust 	struct nfs_page * (*search_commit_reqs)(struct nfs_commit_info *cinfo,
196*0c493b5cSTrond Myklebust 						struct folio *folio);
1979c455a8cSTrond Myklebust };
1989c455a8cSTrond Myklebust 
199e5e94017SBenny Halevy struct pnfs_layout_hdr {
2002b28a7beSElena Reshetova 	refcount_t		plh_refcount;
20182714bd1STrond Myklebust 	atomic_t		plh_outstanding; /* number of RPCs out */
202b7edfaa1SFred Isaman 	struct list_head	plh_layouts;   /* other client layouts */
203fd9a8d71STrond Myklebust 	struct list_head	plh_bulk_destroy;
204b7edfaa1SFred Isaman 	struct list_head	plh_segs;      /* layout segments list */
20568f74479STrond Myklebust 	struct list_head	plh_return_segs; /* invalid layout segments */
206f7e8917aSFred Isaman 	unsigned long		plh_block_lgets; /* block LAYOUTGET if >0 */
20725c75333STrond Myklebust 	unsigned long		plh_retry_timestamp;
208566052c5SFred Isaman 	unsigned long		plh_flags;
20982714bd1STrond Myklebust 	nfs4_stateid		plh_stateid;
21082714bd1STrond Myklebust 	u32			plh_barrier; /* ignore lower seqids */
2113982a6a2SJeff Layton 	u32			plh_return_seq;
212016256dfSPeng Tao 	enum pnfs_iomode	plh_return_iomode;
213acff5880SPeng Tao 	loff_t			plh_lwb; /* last write byte for layoutcommit */
214a52458b4SNeilBrown 	const struct cred	*plh_lc_cred; /* layoutcommit cred */
215b7edfaa1SFred Isaman 	struct inode		*plh_inode;
216cf6605d1STrond Myklebust 	struct rcu_head		plh_rcu;
217e5e94017SBenny Halevy };
218e5e94017SBenny Halevy 
219b1f69b75SAndy Adamson struct pnfs_device {
220b1f69b75SAndy Adamson 	struct nfs4_deviceid dev_id;
221b1f69b75SAndy Adamson 	unsigned int  layout_type;
222b1f69b75SAndy Adamson 	unsigned int  mincount;
223f1c097beSAndy Adamson 	unsigned int  maxcount;	/* gdia_maxcount */
224b1f69b75SAndy Adamson 	struct page **pages;
225b1f69b75SAndy Adamson 	unsigned int  pgbase;
226f1c097beSAndy Adamson 	unsigned int  pglen;	/* reply buffer length */
227df52699eSTrond Myklebust 	unsigned char nocache : 1;/* May not be cached */
228b1f69b75SAndy Adamson };
229b1f69b75SAndy Adamson 
2307f11d8d3SAndy Adamson #define NFS4_PNFS_GETDEVLIST_MAXNUM 16
2317f11d8d3SAndy Adamson 
2327f11d8d3SAndy Adamson struct pnfs_devicelist {
2337f11d8d3SAndy Adamson 	unsigned int		eof;
2347f11d8d3SAndy Adamson 	unsigned int		num_devs;
2357f11d8d3SAndy Adamson 	struct nfs4_deviceid	dev_id[NFS4_PNFS_GETDEVLIST_MAXNUM];
2367f11d8d3SAndy Adamson };
2377f11d8d3SAndy Adamson 
23802c35fcaSFred Isaman extern int pnfs_register_layoutdriver(struct pnfs_layoutdriver_type *);
23902c35fcaSFred Isaman extern void pnfs_unregister_layoutdriver(struct pnfs_layoutdriver_type *);
2407c9d845fSTrond Myklebust extern const struct pnfs_layoutdriver_type *pnfs_find_layoutdriver(u32 id);
2417c9d845fSTrond Myklebust extern void pnfs_put_layoutdriver(const struct pnfs_layoutdriver_type *ld);
24202c35fcaSFred Isaman 
243b1f69b75SAndy Adamson /* nfs4proc.c */
244dacb452dSFred Isaman extern size_t max_response_pages(struct nfs_server *server);
245b1f69b75SAndy Adamson extern int nfs4_proc_getdeviceinfo(struct nfs_server *server,
246cd5875feSTrond Myklebust 				   struct pnfs_device *dev,
247a52458b4SNeilBrown 				   const struct cred *cred);
248dacb452dSFred Isaman extern struct pnfs_layout_segment* nfs4_proc_layoutget(struct nfs4_layoutget *lgp, long *timeout);
2496c16605dSPeng Tao extern int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp, bool sync);
250b1f69b75SAndy Adamson 
251b1f69b75SAndy Adamson /* pnfs.c */
25270c3bd2bSTrond Myklebust void pnfs_get_layout_hdr(struct pnfs_layout_hdr *lo);
2539369a431STrond Myklebust void pnfs_put_lseg(struct pnfs_layout_segment *lseg);
2541751c363STrond Myklebust 
255ca440c38SJeff Layton void set_pnfs_layoutdriver(struct nfs_server *, const struct nfs_fh *, struct nfs_fsinfo *);
25685e174baSRicardo Labiaga void unset_pnfs_layoutdriver(struct nfs_server *);
257b3230e80STrond Myklebust void pnfs_generic_pg_check_layout(struct nfs_pageio_descriptor *pgio);
258e1e54ab7STrond Myklebust void pnfs_generic_pg_check_range(struct nfs_pageio_descriptor *pgio, struct nfs_page *req);
259d8007d4dSTrond Myklebust void pnfs_generic_pg_init_read(struct nfs_pageio_descriptor *, struct nfs_page *);
260493292ddSTrond Myklebust int pnfs_generic_pg_readpages(struct nfs_pageio_descriptor *desc);
2616296556fSPeng Tao void pnfs_generic_pg_init_write(struct nfs_pageio_descriptor *pgio,
2626296556fSPeng Tao 			        struct nfs_page *req, u64 wb_size);
263180bb5ecSWeston Andros Adamson void pnfs_generic_pg_cleanup(struct nfs_pageio_descriptor *);
264dce81290STrond Myklebust int pnfs_generic_pg_writepages(struct nfs_pageio_descriptor *desc);
265b4fdac1aSWeston Andros Adamson size_t pnfs_generic_pg_test(struct nfs_pageio_descriptor *pgio,
266b4fdac1aSWeston Andros Adamson 			    struct nfs_page *prev, struct nfs_page *req);
2671b0ae068SPeng Tao void pnfs_set_lo_fail(struct pnfs_layout_segment *lseg);
268a0b0a6e3STrond Myklebust struct pnfs_layout_segment *pnfs_layout_process(struct nfs4_layoutget *lgp);
26929a8bfe5STrond Myklebust void pnfs_layoutget_free(struct nfs4_layoutget *lgp);
27043f1b3daSFred Isaman void pnfs_free_lseg_list(struct list_head *tmp_list);
271e5e94017SBenny Halevy void pnfs_destroy_layout(struct nfs_inode *);
272b6d49ecdSTrond Myklebust void pnfs_destroy_layout_final(struct nfs_inode *);
273974cec8cSAndy Adamson void pnfs_destroy_all_layouts(struct nfs_client *);
274fd9a8d71STrond Myklebust int pnfs_destroy_layouts_byfsid(struct nfs_client *clp,
275fd9a8d71STrond Myklebust 		struct nfs_fsid *fsid,
276fd9a8d71STrond Myklebust 		bool is_recall);
277fd9a8d71STrond Myklebust int pnfs_destroy_layouts_byclid(struct nfs_client *clp,
278fd9a8d71STrond Myklebust 		bool is_recall);
27930cb3ee2STrond Myklebust bool nfs4_layout_refresh_old_stateid(nfs4_stateid *dst,
280ecf84026STrond Myklebust 		struct pnfs_layout_range *dst_range,
281ecf84026STrond Myklebust 		struct inode *inode);
28270c3bd2bSTrond Myklebust void pnfs_put_layout_hdr(struct pnfs_layout_hdr *lo);
28343f1b3daSFred Isaman void pnfs_set_layout_stateid(struct pnfs_layout_hdr *lo,
28443f1b3daSFred Isaman 			     const nfs4_stateid *new,
28559b56394STrond Myklebust 			     const struct cred *cred,
28643f1b3daSFred Isaman 			     bool update_barrier);
28749a85061STrond Myklebust int pnfs_mark_matching_lsegs_invalid(struct pnfs_layout_hdr *lo,
28843f1b3daSFred Isaman 				struct list_head *tmp_list,
2896d597e17SJeff Layton 				const struct pnfs_layout_range *recall_range,
2906d597e17SJeff Layton 				u32 seq);
29110335556STrond Myklebust int pnfs_mark_matching_lsegs_return(struct pnfs_layout_hdr *lo,
292fc7ff367STrond Myklebust 				struct list_head *tmp_list,
2936d597e17SJeff Layton 				const struct pnfs_layout_range *recall_range,
2946d597e17SJeff Layton 				u32 seq);
2955f46be04STrond Myklebust int pnfs_mark_layout_stateid_invalid(struct pnfs_layout_hdr *lo,
2965f46be04STrond Myklebust 		struct list_head *lseg_list);
2971c5bd76dSTrond Myklebust bool pnfs_roc(struct inode *ino,
2981c5bd76dSTrond Myklebust 		struct nfs4_layoutreturn_args *args,
2991c5bd76dSTrond Myklebust 		struct nfs4_layoutreturn_res *res,
300a52458b4SNeilBrown 		const struct cred *cred);
301078000d0STrond Myklebust int pnfs_roc_done(struct rpc_task *task, struct nfs4_layoutreturn_args **argpp,
302078000d0STrond Myklebust 		  struct nfs4_layoutreturn_res **respp, int *ret);
3031c5bd76dSTrond Myklebust void pnfs_roc_release(struct nfs4_layoutreturn_args *args,
3041c5bd76dSTrond Myklebust 		struct nfs4_layoutreturn_res *res,
3051c5bd76dSTrond Myklebust 		int ret);
306500d701fSPeng Tao bool pnfs_wait_on_layoutreturn(struct inode *ino, struct rpc_task *task);
30767af7611STrond Myklebust void pnfs_set_layoutcommit(struct inode *, struct pnfs_layout_segment *, loff_t);
308db29c089SAndy Adamson void pnfs_cleanup_layoutcommit(struct nfs4_layoutcommit_data *data);
309ef311537SAndy Adamson int pnfs_layoutcommit_inode(struct inode *inode, bool sync);
3105bb89b47STrond Myklebust int pnfs_generic_sync(struct inode *inode, bool datasync);
3115bb89b47STrond Myklebust int pnfs_nfs_generic_sync(struct inode *inode, bool datasync);
312cbe82603SBenny Halevy int _pnfs_return_layout(struct inode *);
31324028672STrond Myklebust int pnfs_commit_and_return_layout(struct inode *);
314d45f60c6SWeston Andros Adamson void pnfs_ld_write_done(struct nfs_pgio_header *);
315d45f60c6SWeston Andros Adamson void pnfs_ld_read_done(struct nfs_pgio_header *);
316563c53e7STrond Myklebust void pnfs_read_resend_pnfs(struct nfs_pgio_header *, unsigned int mirror_idx);
3177c24d948SAndy Adamson struct pnfs_layout_segment *pnfs_update_layout(struct inode *ino,
3187c24d948SAndy Adamson 					       struct nfs_open_context *ctx,
3197c24d948SAndy Adamson 					       loff_t pos,
3207c24d948SAndy Adamson 					       u64 count,
3217c24d948SAndy Adamson 					       enum pnfs_iomode iomode,
322c7d73af2STom Haynes 					       bool strict_iomode,
3237c24d948SAndy Adamson 					       gfp_t gfp_flags);
32468f74479STrond Myklebust void pnfs_layoutreturn_free_lsegs(struct pnfs_layout_hdr *lo,
3252a974425STrond Myklebust 		const nfs4_stateid *arg_stateid,
32668f74479STrond Myklebust 		const struct pnfs_layout_range *range,
32768f74479STrond Myklebust 		const nfs4_stateid *stateid);
328e5e94017SBenny Halevy 
32903772d2fSTrond Myklebust void pnfs_generic_layout_insert_lseg(struct pnfs_layout_hdr *lo,
33003772d2fSTrond Myklebust 		   struct pnfs_layout_segment *lseg,
33103772d2fSTrond Myklebust 		   bool (*is_after)(const struct pnfs_layout_range *lseg_range,
33203772d2fSTrond Myklebust 			   const struct pnfs_layout_range *old),
33303772d2fSTrond Myklebust 		   bool (*do_merge)(struct pnfs_layout_segment *lseg,
33403772d2fSTrond Myklebust 			   struct pnfs_layout_segment *old),
33503772d2fSTrond Myklebust 		   struct list_head *free_me);
33603772d2fSTrond Myklebust 
337c47abcf8SAndy Adamson void nfs4_deviceid_mark_client_invalid(struct nfs_client *clp);
33853113ad3SWeston Andros Adamson int pnfs_read_done_resend_to_mds(struct nfs_pgio_header *);
33953113ad3SWeston Andros Adamson int pnfs_write_done_resend_to_mds(struct nfs_pgio_header *);
34082be417aSAndy Adamson struct nfs4_threshold *pnfs_mdsthreshold_alloc(void);
341016256dfSPeng Tao void pnfs_error_mark_layout_for_return(struct inode *inode,
342016256dfSPeng Tao 				       struct pnfs_layout_segment *lseg);
343b5fdf841STrond Myklebust void pnfs_layout_return_unused_byclid(struct nfs_client *clp,
344b5fdf841STrond Myklebust 				      enum pnfs_iomode iomode);
345b5fdf841STrond Myklebust 
346c47abcf8SAndy Adamson /* nfs4_deviceid_flags */
347c47abcf8SAndy Adamson enum {
348c47abcf8SAndy Adamson 	NFS_DEVICEID_INVALID = 0,       /* set when MDS clientid recalled */
3491dfed273STrond Myklebust 	NFS_DEVICEID_UNAVAILABLE,	/* device temporarily unavailable */
350df52699eSTrond Myklebust 	NFS_DEVICEID_NOCACHE,		/* device may not be cached */
351c47abcf8SAndy Adamson };
352c47abcf8SAndy Adamson 
353a1eaecbcSBenny Halevy /* pnfs_dev.c */
354a1eaecbcSBenny Halevy struct nfs4_deviceid_node {
355a1eaecbcSBenny Halevy 	struct hlist_node		node;
3569e3bd4e2SWeston Andros Adamson 	struct hlist_node		tmpnode;
3571775bc34SBenny Halevy 	const struct pnfs_layoutdriver_type *ld;
358a1eaecbcSBenny Halevy 	const struct nfs_client		*nfs_client;
359c47abcf8SAndy Adamson 	unsigned long 			flags;
3601dfed273STrond Myklebust 	unsigned long			timestamp_unavailable;
361a1eaecbcSBenny Halevy 	struct nfs4_deviceid		deviceid;
36284a80f62STrond Myklebust 	struct rcu_head			rcu;
363a1eaecbcSBenny Halevy 	atomic_t			ref;
364a1eaecbcSBenny Halevy };
365a1eaecbcSBenny Halevy 
366661373b1SChristoph Hellwig struct nfs4_deviceid_node *
367661373b1SChristoph Hellwig nfs4_find_get_deviceid(struct nfs_server *server,
368a52458b4SNeilBrown 		const struct nfs4_deviceid *id, const struct cred *cred,
369661373b1SChristoph Hellwig 		gfp_t gfp_mask);
37035c8bb54SBenny Halevy void nfs4_delete_deviceid(const struct pnfs_layoutdriver_type *, const struct nfs_client *, const struct nfs4_deviceid *);
371661373b1SChristoph Hellwig void nfs4_init_deviceid_node(struct nfs4_deviceid_node *, struct nfs_server *,
372a1eaecbcSBenny Halevy 			     const struct nfs4_deviceid *);
373a1eaecbcSBenny Halevy bool nfs4_put_deviceid_node(struct nfs4_deviceid_node *);
37476c66905STrond Myklebust void nfs4_mark_deviceid_available(struct nfs4_deviceid_node *node);
3751dfed273STrond Myklebust void nfs4_mark_deviceid_unavailable(struct nfs4_deviceid_node *node);
3761dfed273STrond Myklebust bool nfs4_test_deviceid_unavailable(struct nfs4_deviceid_node *node);
3771775bc34SBenny Halevy void nfs4_deviceid_purge_client(const struct nfs_client *);
378a1eaecbcSBenny Halevy 
379f54bcf2eSTom Haynes /* pnfs_nfs.c */
380d7242c46STrond Myklebust struct pnfs_commit_array *pnfs_alloc_commit_array(size_t n, gfp_t gfp_flags);
381d7242c46STrond Myklebust void pnfs_free_commit_array(struct pnfs_commit_array *p);
382ba827c9aSTrond Myklebust struct pnfs_commit_array *pnfs_add_commit_array(struct pnfs_ds_commit_info *,
383ba827c9aSTrond Myklebust 						struct pnfs_commit_array *,
384ba827c9aSTrond Myklebust 						struct pnfs_layout_segment *);
385ba827c9aSTrond Myklebust 
386a9901899STrond Myklebust void pnfs_generic_ds_cinfo_release_lseg(struct pnfs_ds_commit_info *fl_cinfo,
387a9901899STrond Myklebust 		struct pnfs_layout_segment *lseg);
388a9901899STrond Myklebust void pnfs_generic_ds_cinfo_destroy(struct pnfs_ds_commit_info *fl_cinfo);
389d7242c46STrond Myklebust 
390f54bcf2eSTom Haynes void pnfs_generic_clear_request_commit(struct nfs_page *req,
391f54bcf2eSTom Haynes 				       struct nfs_commit_info *cinfo);
392f54bcf2eSTom Haynes void pnfs_generic_commit_release(void *calldata);
393f54bcf2eSTom Haynes void pnfs_generic_prepare_to_resend_writes(struct nfs_commit_data *data);
394f54bcf2eSTom Haynes void pnfs_generic_rw_release(void *data);
395f54bcf2eSTom Haynes void pnfs_generic_recover_commit_reqs(struct list_head *dst,
396f54bcf2eSTom Haynes 				      struct nfs_commit_info *cinfo);
397fb6b53baSTrond Myklebust struct nfs_page *pnfs_generic_search_commit_reqs(struct nfs_commit_info *cinfo,
398*0c493b5cSTrond Myklebust 						 struct folio *folio);
399f54bcf2eSTom Haynes int pnfs_generic_commit_pagelist(struct inode *inode,
400f54bcf2eSTom Haynes 				 struct list_head *mds_pages,
401f54bcf2eSTom Haynes 				 int how,
402f54bcf2eSTom Haynes 				 struct nfs_commit_info *cinfo,
403f54bcf2eSTom Haynes 				 int (*initiate_commit)(struct nfs_commit_data *data,
404f54bcf2eSTom Haynes 							int how));
405f54bcf2eSTom Haynes int pnfs_generic_scan_commit_lists(struct nfs_commit_info *cinfo, int max);
406f54bcf2eSTom Haynes void pnfs_generic_write_commit_done(struct rpc_task *task, void *data);
407875ae069SPeng Tao void nfs4_pnfs_ds_put(struct nfs4_pnfs_ds *ds);
408875ae069SPeng Tao struct nfs4_pnfs_ds *nfs4_pnfs_ds_add(struct list_head *dsaddrs,
409875ae069SPeng Tao 				      gfp_t gfp_flags);
4105f01d953SPeng Tao void nfs4_pnfs_v3_ds_connect_unload(void);
411a33e4b03SWeston Andros Adamson int nfs4_pnfs_ds_connect(struct nfs_server *mds_srv, struct nfs4_pnfs_ds *ds,
4127405f9e1SPeng Tao 			  struct nfs4_deviceid_node *devid, unsigned int timeo,
4137d38de3fSAnna Schumaker 			  unsigned int retrans, u32 version, u32 minor_version);
4146b7f3cf9SPeng Tao struct nfs4_pnfs_ds_addr *nfs4_decode_mp_ds_addr(struct net *net,
4156b7f3cf9SPeng Tao 						 struct xdr_stream *xdr,
4166b7f3cf9SPeng Tao 						 gfp_t gfp_flags);
417338d00cfSTom Haynes void pnfs_layout_mark_request_commit(struct nfs_page *req,
418338d00cfSTom Haynes 				     struct pnfs_layout_segment *lseg,
419338d00cfSTom Haynes 				     struct nfs_commit_info *cinfo,
420338d00cfSTom Haynes 				     u32 ds_commit_idx);
4212409a976SFred Isaman void pnfs_lgopen_prepare(struct nfs4_opendata *data,
4222409a976SFred Isaman 			 struct nfs_open_context *ctx);
4232409a976SFred Isaman void pnfs_parse_lgopen(struct inode *ino, struct nfs4_layoutget *lgp,
4242409a976SFred Isaman 		       struct nfs_open_context *ctx);
42530ae2412SFred Isaman void nfs4_lgopen_release(struct nfs4_layoutget *lgp);
426f54bcf2eSTom Haynes 
nfs_have_layout(struct inode * inode)42740dd4b7aSTrond Myklebust static inline bool nfs_have_layout(struct inode *inode)
42840dd4b7aSTrond Myklebust {
42940dd4b7aSTrond Myklebust 	return NFS_I(inode)->layout != NULL;
43040dd4b7aSTrond Myklebust }
43140dd4b7aSTrond Myklebust 
pnfs_layout_is_valid(const struct pnfs_layout_hdr * lo)43245fcc7bcSTrond Myklebust static inline bool pnfs_layout_is_valid(const struct pnfs_layout_hdr *lo)
43345fcc7bcSTrond Myklebust {
43445fcc7bcSTrond Myklebust 	return test_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags) == 0;
43545fcc7bcSTrond Myklebust }
43645fcc7bcSTrond Myklebust 
43730ff0603SChristoph Hellwig static inline struct nfs4_deviceid_node *
nfs4_get_deviceid(struct nfs4_deviceid_node * d)43830ff0603SChristoph Hellwig nfs4_get_deviceid(struct nfs4_deviceid_node *d)
43930ff0603SChristoph Hellwig {
44030ff0603SChristoph Hellwig 	atomic_inc(&d->ref);
44130ff0603SChristoph Hellwig 	return d;
44230ff0603SChristoph Hellwig }
44330ff0603SChristoph Hellwig 
444d684d2aeSFred Isaman static inline struct pnfs_layout_segment *
pnfs_get_lseg(struct pnfs_layout_segment * lseg)4459369a431STrond Myklebust pnfs_get_lseg(struct pnfs_layout_segment *lseg)
446d684d2aeSFred Isaman {
447d684d2aeSFred Isaman 	if (lseg) {
448eba6dd69SElena Reshetova 		refcount_inc(&lseg->pls_refcount);
4494e857c58SPeter Zijlstra 		smp_mb__after_atomic();
450d684d2aeSFred Isaman 	}
451d684d2aeSFred Isaman 	return lseg;
452d684d2aeSFred Isaman }
453d684d2aeSFred Isaman 
454b20135d0STrond Myklebust static inline bool
pnfs_is_valid_lseg(struct pnfs_layout_segment * lseg)455b20135d0STrond Myklebust pnfs_is_valid_lseg(struct pnfs_layout_segment *lseg)
456b20135d0STrond Myklebust {
457b20135d0STrond Myklebust 	return test_bit(NFS_LSEG_VALID, &lseg->pls_flags) != 0;
458b20135d0STrond Myklebust }
459b20135d0STrond Myklebust 
460e5e94017SBenny Halevy /* Return true if a layout driver is being used for this mountpoint */
pnfs_enabled_sb(struct nfs_server * nfss)461e5e94017SBenny Halevy static inline int pnfs_enabled_sb(struct nfs_server *nfss)
462e5e94017SBenny Halevy {
463e5e94017SBenny Halevy 	return nfss->pnfs_curr_ld != NULL;
464e5e94017SBenny Halevy }
46585e174baSRicardo Labiaga 
466a861a1e1SFred Isaman static inline int
pnfs_commit_list(struct inode * inode,struct list_head * mds_pages,int how,struct nfs_commit_info * cinfo)467ea2cf228SFred Isaman pnfs_commit_list(struct inode *inode, struct list_head *mds_pages, int how,
468ea2cf228SFred Isaman 		 struct nfs_commit_info *cinfo)
469a861a1e1SFred Isaman {
4709c455a8cSTrond Myklebust 	struct pnfs_ds_commit_info *fl_cinfo = cinfo->ds;
4719c455a8cSTrond Myklebust 
4729c455a8cSTrond Myklebust 	if (fl_cinfo == NULL || fl_cinfo->ncommitting == 0)
473a861a1e1SFred Isaman 		return PNFS_NOT_ATTEMPTED;
4749c455a8cSTrond Myklebust 	return fl_cinfo->ops->commit_pagelist(inode, mds_pages, how, cinfo);
475ea2cf228SFred Isaman }
476ea2cf228SFred Isaman 
477ea2cf228SFred Isaman static inline struct pnfs_ds_commit_info *
pnfs_get_ds_info(struct inode * inode)478ea2cf228SFred Isaman pnfs_get_ds_info(struct inode *inode)
479ea2cf228SFred Isaman {
480ea2cf228SFred Isaman 	struct pnfs_layoutdriver_type *ld = NFS_SERVER(inode)->pnfs_curr_ld;
481ea2cf228SFred Isaman 
482ea2cf228SFred Isaman 	if (ld == NULL || ld->get_ds_info == NULL)
483ea2cf228SFred Isaman 		return NULL;
484ea2cf228SFred Isaman 	return ld->get_ds_info(inode);
485a861a1e1SFred Isaman }
486a861a1e1SFred Isaman 
487f54bcf2eSTom Haynes static inline void
pnfs_init_ds_commit_info_ops(struct pnfs_ds_commit_info * fl_cinfo,struct inode * inode)4889c455a8cSTrond Myklebust pnfs_init_ds_commit_info_ops(struct pnfs_ds_commit_info *fl_cinfo, struct inode *inode)
4899c455a8cSTrond Myklebust {
4909c455a8cSTrond Myklebust 	struct pnfs_ds_commit_info *inode_cinfo = pnfs_get_ds_info(inode);
4919c455a8cSTrond Myklebust 	if (inode_cinfo != NULL)
4929c455a8cSTrond Myklebust 		fl_cinfo->ops = inode_cinfo->ops;
4939c455a8cSTrond Myklebust }
4949c455a8cSTrond Myklebust 
4959c455a8cSTrond Myklebust static inline void
pnfs_init_ds_commit_info(struct pnfs_ds_commit_info * fl_cinfo)496c21e7168STrond Myklebust pnfs_init_ds_commit_info(struct pnfs_ds_commit_info *fl_cinfo)
497c21e7168STrond Myklebust {
498c21e7168STrond Myklebust 	INIT_LIST_HEAD(&fl_cinfo->commits);
4999c455a8cSTrond Myklebust 	fl_cinfo->ops = NULL;
500c21e7168STrond Myklebust }
501c21e7168STrond Myklebust 
502c21e7168STrond Myklebust static inline void
pnfs_release_ds_info(struct pnfs_ds_commit_info * fl_cinfo,struct inode * inode)50318f41296STrond Myklebust pnfs_release_ds_info(struct pnfs_ds_commit_info *fl_cinfo, struct inode *inode)
50418f41296STrond Myklebust {
5059c455a8cSTrond Myklebust 	if (fl_cinfo->ops != NULL && fl_cinfo->ops->release_ds_info != NULL)
5069c455a8cSTrond Myklebust 		fl_cinfo->ops->release_ds_info(fl_cinfo, inode);
50718f41296STrond Myklebust }
50818f41296STrond Myklebust 
50918f41296STrond Myklebust static inline void
pnfs_generic_mark_devid_invalid(struct nfs4_deviceid_node * node)510f54bcf2eSTom Haynes pnfs_generic_mark_devid_invalid(struct nfs4_deviceid_node *node)
511f54bcf2eSTom Haynes {
512f54bcf2eSTom Haynes 	set_bit(NFS_DEVICEID_INVALID, &node->flags);
513f54bcf2eSTom Haynes }
514f54bcf2eSTom Haynes 
5158dd37758STrond 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)516ea2cf228SFred Isaman pnfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg,
517b57ff130SWeston Andros Adamson 			 struct nfs_commit_info *cinfo, u32 ds_commit_idx)
518a861a1e1SFred Isaman {
5199c455a8cSTrond Myklebust 	struct pnfs_ds_commit_info *fl_cinfo = cinfo->ds;
520a861a1e1SFred Isaman 
521f0caea88STrond Myklebust 	if (!lseg || !fl_cinfo->ops || !fl_cinfo->ops->mark_request_commit)
5228dd37758STrond Myklebust 		return false;
5239c455a8cSTrond Myklebust 	fl_cinfo->ops->mark_request_commit(req, lseg, cinfo, ds_commit_idx);
5248dd37758STrond Myklebust 	return true;
525a861a1e1SFred Isaman }
526a861a1e1SFred Isaman 
5278dd37758STrond Myklebust static inline bool
pnfs_clear_request_commit(struct nfs_page * req,struct nfs_commit_info * cinfo)528ea2cf228SFred Isaman pnfs_clear_request_commit(struct nfs_page *req, struct nfs_commit_info *cinfo)
529a861a1e1SFred Isaman {
5309c455a8cSTrond Myklebust 	struct pnfs_ds_commit_info *fl_cinfo = cinfo->ds;
531d6d6dc7cSFred Isaman 
5329c455a8cSTrond Myklebust 	if (!fl_cinfo || !fl_cinfo->ops || !fl_cinfo->ops->clear_request_commit)
5338dd37758STrond Myklebust 		return false;
5349c455a8cSTrond Myklebust 	fl_cinfo->ops->clear_request_commit(req, cinfo);
5358dd37758STrond Myklebust 	return true;
536d6d6dc7cSFred Isaman }
537d6d6dc7cSFred Isaman 
538d6d6dc7cSFred Isaman static inline int
pnfs_scan_commit_lists(struct inode * inode,struct nfs_commit_info * cinfo,int max)539ea2cf228SFred Isaman pnfs_scan_commit_lists(struct inode *inode, struct nfs_commit_info *cinfo,
540ea2cf228SFred Isaman 		       int max)
541d6d6dc7cSFred Isaman {
5429c455a8cSTrond Myklebust 	struct pnfs_ds_commit_info *fl_cinfo = cinfo->ds;
5439c455a8cSTrond Myklebust 
5449c455a8cSTrond Myklebust 	if (!fl_cinfo || fl_cinfo->nwritten == 0)
545d6d6dc7cSFred Isaman 		return 0;
5469c455a8cSTrond Myklebust 	return fl_cinfo->ops->scan_commit_lists(cinfo, max);
5479c455a8cSTrond Myklebust }
5489c455a8cSTrond Myklebust 
5499c455a8cSTrond Myklebust static inline void
pnfs_recover_commit_reqs(struct list_head * head,struct nfs_commit_info * cinfo)5509c455a8cSTrond Myklebust pnfs_recover_commit_reqs(struct list_head *head, struct nfs_commit_info *cinfo)
5519c455a8cSTrond Myklebust {
5529c455a8cSTrond Myklebust 	struct pnfs_ds_commit_info *fl_cinfo = cinfo->ds;
5539c455a8cSTrond Myklebust 
5549c455a8cSTrond Myklebust 	if (fl_cinfo && fl_cinfo->nwritten != 0)
5559c455a8cSTrond Myklebust 		fl_cinfo->ops->recover_commit_reqs(head, cinfo);
556a861a1e1SFred Isaman }
557a861a1e1SFred Isaman 
55802d1426cSWeston Andros Adamson static inline struct nfs_page *
pnfs_search_commit_reqs(struct inode * inode,struct nfs_commit_info * cinfo,struct folio * folio)55902d1426cSWeston Andros Adamson pnfs_search_commit_reqs(struct inode *inode, struct nfs_commit_info *cinfo,
560*0c493b5cSTrond Myklebust 			struct folio *folio)
56102d1426cSWeston Andros Adamson {
5629c455a8cSTrond Myklebust 	struct pnfs_ds_commit_info *fl_cinfo = cinfo->ds;
56302d1426cSWeston Andros Adamson 
5649c455a8cSTrond Myklebust 	if (!fl_cinfo->ops || !fl_cinfo->ops->search_commit_reqs)
56502d1426cSWeston Andros Adamson 		return NULL;
566*0c493b5cSTrond Myklebust 	return fl_cinfo->ops->search_commit_reqs(cinfo, folio);
56702d1426cSWeston Andros Adamson }
56802d1426cSWeston Andros Adamson 
5698a1636c4SBenny Halevy /* Should the pNFS client commit and return the layout upon a setattr */
5708a1636c4SBenny Halevy static inline bool
pnfs_ld_layoutret_on_setattr(struct inode * inode)5718a1636c4SBenny Halevy pnfs_ld_layoutret_on_setattr(struct inode *inode)
5728a1636c4SBenny Halevy {
5738a1636c4SBenny Halevy 	if (!pnfs_enabled_sb(NFS_SERVER(inode)))
5748a1636c4SBenny Halevy 		return false;
5758a1636c4SBenny Halevy 	return NFS_SERVER(inode)->pnfs_curr_ld->flags &
5768a1636c4SBenny Halevy 		PNFS_LAYOUTRET_ON_SETATTR;
5778a1636c4SBenny Halevy }
5788a1636c4SBenny Halevy 
579d8c951c3STrond Myklebust static inline bool
pnfs_ld_read_whole_page(struct inode * inode)580612aa983SChristoph Hellwig pnfs_ld_read_whole_page(struct inode *inode)
581612aa983SChristoph Hellwig {
582612aa983SChristoph Hellwig 	if (!pnfs_enabled_sb(NFS_SERVER(inode)))
583612aa983SChristoph Hellwig 		return false;
584612aa983SChristoph Hellwig 	return NFS_SERVER(inode)->pnfs_curr_ld->flags & PNFS_READ_WHOLE_PAGE;
585612aa983SChristoph Hellwig }
586612aa983SChristoph Hellwig 
5875bb89b47STrond Myklebust static inline int
pnfs_sync_inode(struct inode * inode,bool datasync)5885bb89b47STrond Myklebust pnfs_sync_inode(struct inode *inode, bool datasync)
5895bb89b47STrond Myklebust {
5905bb89b47STrond Myklebust 	if (!pnfs_enabled_sb(NFS_SERVER(inode)))
5915bb89b47STrond Myklebust 		return 0;
5925bb89b47STrond Myklebust 	return NFS_SERVER(inode)->pnfs_curr_ld->sync(inode, datasync);
5935bb89b47STrond Myklebust }
5945bb89b47STrond Myklebust 
595612aa983SChristoph Hellwig static inline bool
pnfs_layoutcommit_outstanding(struct inode * inode)596d8c951c3STrond Myklebust pnfs_layoutcommit_outstanding(struct inode *inode)
597d8c951c3STrond Myklebust {
598d8c951c3STrond Myklebust 	struct nfs_inode *nfsi = NFS_I(inode);
599d8c951c3STrond Myklebust 
600d8c951c3STrond Myklebust 	return test_bit(NFS_INO_LAYOUTCOMMIT, &nfsi->flags) != 0 ||
601d8c951c3STrond Myklebust 		test_bit(NFS_INO_LAYOUTCOMMITTING, &nfsi->flags) != 0;
602d8c951c3STrond Myklebust }
603d8c951c3STrond Myklebust 
pnfs_return_layout(struct inode * ino)604cbe82603SBenny Halevy static inline int pnfs_return_layout(struct inode *ino)
605cbe82603SBenny Halevy {
606cbe82603SBenny Halevy 	struct nfs_inode *nfsi = NFS_I(ino);
607cbe82603SBenny Halevy 	struct nfs_server *nfss = NFS_SERVER(ino);
608cbe82603SBenny Halevy 
609d78471d3SBenjamin Coddington 	if (pnfs_enabled_sb(nfss) && nfsi->layout) {
610d78471d3SBenjamin Coddington 		set_bit(NFS_LAYOUT_RETURN_REQUESTED, &nfsi->layout->plh_flags);
611cbe82603SBenny Halevy 		return _pnfs_return_layout(ino);
612d78471d3SBenjamin Coddington 	}
613cbe82603SBenny Halevy 
614cbe82603SBenny Halevy 	return 0;
615cbe82603SBenny Halevy }
616cbe82603SBenny Halevy 
61782be417aSAndy Adamson static inline bool
pnfs_use_threshold(struct nfs4_threshold ** dst,struct nfs4_threshold * src,struct nfs_server * nfss)61882be417aSAndy Adamson pnfs_use_threshold(struct nfs4_threshold **dst, struct nfs4_threshold *src,
61982be417aSAndy Adamson 		   struct nfs_server *nfss)
62082be417aSAndy Adamson {
621fb47ddc9SFred Isaman 	return (dst && src && src->bm != 0 && nfss->pnfs_curr_ld &&
62282be417aSAndy Adamson 					nfss->pnfs_curr_ld->id == src->l_type);
62382be417aSAndy Adamson }
62482be417aSAndy Adamson 
6250762ed2cSTrond Myklebust static inline u64
pnfs_calc_offset_end(u64 offset,u64 len)6260762ed2cSTrond Myklebust pnfs_calc_offset_end(u64 offset, u64 len)
6270762ed2cSTrond Myklebust {
6280762ed2cSTrond Myklebust 	if (len == NFS4_MAX_UINT64 || len >= NFS4_MAX_UINT64 - offset)
6290762ed2cSTrond Myklebust 		return NFS4_MAX_UINT64;
6300762ed2cSTrond Myklebust 	return offset + len - 1;
6310762ed2cSTrond Myklebust }
6320762ed2cSTrond Myklebust 
6330762ed2cSTrond Myklebust static inline u64
pnfs_calc_offset_length(u64 offset,u64 end)6340762ed2cSTrond Myklebust pnfs_calc_offset_length(u64 offset, u64 end)
6350762ed2cSTrond Myklebust {
6360762ed2cSTrond Myklebust 	if (end == NFS4_MAX_UINT64 || end <= offset)
6370762ed2cSTrond Myklebust 		return NFS4_MAX_UINT64;
6380762ed2cSTrond Myklebust 	return 1 + end - offset;
6390762ed2cSTrond Myklebust }
6400762ed2cSTrond Myklebust 
641e144e539STrond Myklebust static inline void
pnfs_copy_range(struct pnfs_layout_range * dst,const struct pnfs_layout_range * src)642e144e539STrond Myklebust pnfs_copy_range(struct pnfs_layout_range *dst,
643e144e539STrond Myklebust 		const struct pnfs_layout_range *src)
644e144e539STrond Myklebust {
645e144e539STrond Myklebust 	memcpy(dst, src, sizeof(*dst));
646e144e539STrond Myklebust }
647e144e539STrond Myklebust 
64817822b20STrond Myklebust static inline u64
pnfs_end_offset(u64 start,u64 len)64917822b20STrond Myklebust pnfs_end_offset(u64 start, u64 len)
65017822b20STrond Myklebust {
65117822b20STrond Myklebust 	if (NFS4_MAX_UINT64 - start <= len)
65217822b20STrond Myklebust 		return NFS4_MAX_UINT64;
65317822b20STrond Myklebust 	return start + len;
65417822b20STrond Myklebust }
65517822b20STrond Myklebust 
65617822b20STrond Myklebust /*
65717822b20STrond Myklebust  * Are 2 ranges intersecting?
65817822b20STrond Myklebust  *   start1                             end1
65917822b20STrond Myklebust  *   [----------------------------------)
66017822b20STrond Myklebust  *                                start2           end2
66117822b20STrond Myklebust  *                                [----------------)
66217822b20STrond Myklebust  */
66317822b20STrond Myklebust static inline bool
pnfs_is_range_intersecting(u64 start1,u64 end1,u64 start2,u64 end2)66417822b20STrond Myklebust pnfs_is_range_intersecting(u64 start1, u64 end1, u64 start2, u64 end2)
66517822b20STrond Myklebust {
66617822b20STrond Myklebust 	return (end1 == NFS4_MAX_UINT64 || start2 < end1) &&
66717822b20STrond Myklebust 		(end2 == NFS4_MAX_UINT64 || start1 < end2);
66817822b20STrond Myklebust }
66917822b20STrond Myklebust 
67017822b20STrond Myklebust static inline bool
pnfs_lseg_range_intersecting(const struct pnfs_layout_range * l1,const struct pnfs_layout_range * l2)67117822b20STrond Myklebust pnfs_lseg_range_intersecting(const struct pnfs_layout_range *l1,
67217822b20STrond Myklebust 		const struct pnfs_layout_range *l2)
67317822b20STrond Myklebust {
67417822b20STrond Myklebust 	u64 end1 = pnfs_end_offset(l1->offset, l1->length);
67517822b20STrond Myklebust 	u64 end2 = pnfs_end_offset(l2->offset, l2->length);
67617822b20STrond Myklebust 
67717822b20STrond Myklebust 	return pnfs_is_range_intersecting(l1->offset, end1, l2->offset, end2);
67817822b20STrond Myklebust }
67917822b20STrond Myklebust 
68008cb5b0fSBenjamin Coddington static inline bool
pnfs_lseg_request_intersecting(struct pnfs_layout_segment * lseg,struct nfs_page * req)68108cb5b0fSBenjamin Coddington pnfs_lseg_request_intersecting(struct pnfs_layout_segment *lseg, struct nfs_page *req)
68208cb5b0fSBenjamin Coddington {
68308cb5b0fSBenjamin Coddington 	u64 seg_last = pnfs_end_offset(lseg->pls_range.offset, lseg->pls_range.length);
68408cb5b0fSBenjamin Coddington 	u64 req_last = req_offset(req) + req->wb_bytes;
68508cb5b0fSBenjamin Coddington 
68608cb5b0fSBenjamin Coddington 	return pnfs_is_range_intersecting(lseg->pls_range.offset, seg_last,
68708cb5b0fSBenjamin Coddington 				req_offset(req), req_last);
68808cb5b0fSBenjamin Coddington }
68908cb5b0fSBenjamin Coddington 
pnfs_lseg_cancel_io(struct nfs_server * server,struct pnfs_layout_segment * lseg)690b739a5bdSTrond Myklebust static inline void pnfs_lseg_cancel_io(struct nfs_server *server,
691b739a5bdSTrond Myklebust 				       struct pnfs_layout_segment *lseg)
692b739a5bdSTrond Myklebust {
693b739a5bdSTrond Myklebust 	if (server->pnfs_curr_ld->cancel_io)
694b739a5bdSTrond Myklebust 		server->pnfs_curr_ld->cancel_io(lseg);
695b739a5bdSTrond Myklebust }
696b739a5bdSTrond Myklebust 
697bbf58bf3STrond Myklebust extern unsigned int layoutstats_timer;
698bbf58bf3STrond Myklebust 
6996f00866dSTrond Myklebust #ifdef NFS_DEBUG
7006f00866dSTrond Myklebust void nfs4_print_deviceid(const struct nfs4_deviceid *dev_id);
7016f00866dSTrond Myklebust #else
nfs4_print_deviceid(const struct nfs4_deviceid * dev_id)7026f00866dSTrond Myklebust static inline void nfs4_print_deviceid(const struct nfs4_deviceid *dev_id)
7036f00866dSTrond Myklebust {
7046f00866dSTrond Myklebust }
705bbf58bf3STrond Myklebust 
7066f00866dSTrond Myklebust #endif /* NFS_DEBUG */
70785e174baSRicardo Labiaga #else  /* CONFIG_NFS_V4_1 */
70885e174baSRicardo Labiaga 
nfs_have_layout(struct inode * inode)70940dd4b7aSTrond Myklebust static inline bool nfs_have_layout(struct inode *inode)
71040dd4b7aSTrond Myklebust {
71140dd4b7aSTrond Myklebust 	return false;
71240dd4b7aSTrond Myklebust }
71340dd4b7aSTrond Myklebust 
pnfs_destroy_all_layouts(struct nfs_client * clp)714974cec8cSAndy Adamson static inline void pnfs_destroy_all_layouts(struct nfs_client *clp)
715974cec8cSAndy Adamson {
716974cec8cSAndy Adamson }
717974cec8cSAndy Adamson 
pnfs_destroy_layout(struct nfs_inode * nfsi)718e5e94017SBenny Halevy static inline void pnfs_destroy_layout(struct nfs_inode *nfsi)
719e5e94017SBenny Halevy {
720e5e94017SBenny Halevy }
721e5e94017SBenny Halevy 
pnfs_destroy_layout_final(struct nfs_inode * nfsi)722b6d49ecdSTrond Myklebust static inline void pnfs_destroy_layout_final(struct nfs_inode *nfsi)
723b6d49ecdSTrond Myklebust {
724b6d49ecdSTrond Myklebust }
725b6d49ecdSTrond Myklebust 
726e5e94017SBenny Halevy static inline struct pnfs_layout_segment *
pnfs_get_lseg(struct pnfs_layout_segment * lseg)7279369a431STrond Myklebust pnfs_get_lseg(struct pnfs_layout_segment *lseg)
728d684d2aeSFred Isaman {
729d684d2aeSFred Isaman 	return NULL;
730d684d2aeSFred Isaman }
731d684d2aeSFred Isaman 
pnfs_put_lseg(struct pnfs_layout_segment * lseg)7329369a431STrond Myklebust static inline void pnfs_put_lseg(struct pnfs_layout_segment *lseg)
733d684d2aeSFred Isaman {
734d684d2aeSFred Isaman }
735d684d2aeSFred Isaman 
pnfs_return_layout(struct inode * ino)736cbe82603SBenny Halevy static inline int pnfs_return_layout(struct inode *ino)
737cbe82603SBenny Halevy {
738cbe82603SBenny Halevy 	return 0;
739cbe82603SBenny Halevy }
740cbe82603SBenny Halevy 
pnfs_commit_and_return_layout(struct inode * inode)74124028672STrond Myklebust static inline int pnfs_commit_and_return_layout(struct inode *inode)
74224028672STrond Myklebust {
74324028672STrond Myklebust 	return 0;
74424028672STrond Myklebust }
74524028672STrond Myklebust 
746f7e8917aSFred Isaman static inline bool
pnfs_ld_layoutret_on_setattr(struct inode * inode)7478a1636c4SBenny Halevy pnfs_ld_layoutret_on_setattr(struct inode *inode)
7488a1636c4SBenny Halevy {
7498a1636c4SBenny Halevy 	return false;
7508a1636c4SBenny Halevy }
7518a1636c4SBenny Halevy 
7528a1636c4SBenny Halevy static inline bool
pnfs_ld_read_whole_page(struct inode * inode)753612aa983SChristoph Hellwig pnfs_ld_read_whole_page(struct inode *inode)
754612aa983SChristoph Hellwig {
755612aa983SChristoph Hellwig 	return false;
756612aa983SChristoph Hellwig }
757612aa983SChristoph Hellwig 
7585bb89b47STrond Myklebust static inline int
pnfs_sync_inode(struct inode * inode,bool datasync)7595bb89b47STrond Myklebust pnfs_sync_inode(struct inode *inode, bool datasync)
7605bb89b47STrond Myklebust {
7615bb89b47STrond Myklebust 	return 0;
7625bb89b47STrond Myklebust }
7635bb89b47STrond Myklebust 
764612aa983SChristoph Hellwig static inline bool
pnfs_layoutcommit_outstanding(struct inode * inode)76510b7e9adSTrond Myklebust pnfs_layoutcommit_outstanding(struct inode *inode)
76610b7e9adSTrond Myklebust {
76710b7e9adSTrond Myklebust 	return false;
76810b7e9adSTrond Myklebust }
76910b7e9adSTrond Myklebust 
77010b7e9adSTrond Myklebust 
77110b7e9adSTrond Myklebust static inline bool
pnfs_roc(struct inode * ino,struct nfs4_layoutreturn_args * args,struct nfs4_layoutreturn_res * res,const struct cred * cred)7721c5bd76dSTrond Myklebust pnfs_roc(struct inode *ino,
7731c5bd76dSTrond Myklebust 		struct nfs4_layoutreturn_args *args,
7741c5bd76dSTrond Myklebust 		struct nfs4_layoutreturn_res *res,
775a52458b4SNeilBrown 		const struct cred *cred)
776f7e8917aSFred Isaman {
777f7e8917aSFred Isaman 	return false;
778f7e8917aSFred Isaman }
779f7e8917aSFred Isaman 
780287a9c55STrond Myklebust static inline int
pnfs_roc_done(struct rpc_task * task,struct nfs4_layoutreturn_args ** argpp,struct nfs4_layoutreturn_res ** respp,int * ret)781078000d0STrond Myklebust pnfs_roc_done(struct rpc_task *task,
782287a9c55STrond Myklebust 		struct nfs4_layoutreturn_args **argpp,
783287a9c55STrond Myklebust 		struct nfs4_layoutreturn_res **respp,
784287a9c55STrond Myklebust 		int *ret)
785287a9c55STrond Myklebust {
786287a9c55STrond Myklebust 	return 0;
787287a9c55STrond Myklebust }
788287a9c55STrond Myklebust 
789f7e8917aSFred Isaman static inline void
pnfs_roc_release(struct nfs4_layoutreturn_args * args,struct nfs4_layoutreturn_res * res,int ret)7901c5bd76dSTrond Myklebust pnfs_roc_release(struct nfs4_layoutreturn_args *args,
7911c5bd76dSTrond Myklebust 		struct nfs4_layoutreturn_res *res,
7921c5bd76dSTrond Myklebust 		int ret)
793f7e8917aSFred Isaman {
794f7e8917aSFred Isaman }
795f7e8917aSFred Isaman 
796500d701fSPeng Tao static inline bool
pnfs_wait_on_layoutreturn(struct inode * ino,struct rpc_task * task)797500d701fSPeng Tao pnfs_wait_on_layoutreturn(struct inode *ino, struct rpc_task *task)
798500d701fSPeng Tao {
799500d701fSPeng Tao 	return false;
800500d701fSPeng Tao }
801500d701fSPeng Tao 
set_pnfs_layoutdriver(struct nfs_server * s,const struct nfs_fh * mntfh,struct nfs_fsinfo * fsinfo)802738fd0f3SBenny Halevy static inline void set_pnfs_layoutdriver(struct nfs_server *s,
803ca440c38SJeff Layton 					 const struct nfs_fh *mntfh,
804ca440c38SJeff Layton 					 struct nfs_fsinfo *fsinfo)
80585e174baSRicardo Labiaga {
80685e174baSRicardo Labiaga }
80785e174baSRicardo Labiaga 
unset_pnfs_layoutdriver(struct nfs_server * s)80885e174baSRicardo Labiaga static inline void unset_pnfs_layoutdriver(struct nfs_server *s)
80985e174baSRicardo Labiaga {
81085e174baSRicardo Labiaga }
81185e174baSRicardo Labiaga 
812a861a1e1SFred Isaman static inline int
pnfs_commit_list(struct inode * inode,struct list_head * mds_pages,int how,struct nfs_commit_info * cinfo)813ea2cf228SFred Isaman pnfs_commit_list(struct inode *inode, struct list_head *mds_pages, int how,
814ea2cf228SFred Isaman 		 struct nfs_commit_info *cinfo)
815a861a1e1SFred Isaman {
816a861a1e1SFred Isaman 	return PNFS_NOT_ATTEMPTED;
817a861a1e1SFred Isaman }
818a861a1e1SFred Isaman 
819ea2cf228SFred Isaman static inline struct pnfs_ds_commit_info *
pnfs_get_ds_info(struct inode * inode)820ea2cf228SFred Isaman pnfs_get_ds_info(struct inode *inode)
821ea2cf228SFred Isaman {
822ea2cf228SFred Isaman 	return NULL;
823ea2cf228SFred Isaman }
824ea2cf228SFred Isaman 
825c21e7168STrond Myklebust static inline void
pnfs_init_ds_commit_info_ops(struct pnfs_ds_commit_info * fl_cinfo,struct inode * inode)8269c455a8cSTrond Myklebust pnfs_init_ds_commit_info_ops(struct pnfs_ds_commit_info *fl_cinfo, struct inode *inode)
8279c455a8cSTrond Myklebust {
8289c455a8cSTrond Myklebust }
8299c455a8cSTrond Myklebust 
8309c455a8cSTrond Myklebust static inline void
pnfs_init_ds_commit_info(struct pnfs_ds_commit_info * fl_cinfo)831c21e7168STrond Myklebust pnfs_init_ds_commit_info(struct pnfs_ds_commit_info *fl_cinfo)
832c21e7168STrond Myklebust {
833c21e7168STrond Myklebust }
834c21e7168STrond Myklebust 
83518f41296STrond Myklebust static inline void
pnfs_release_ds_info(struct pnfs_ds_commit_info * fl_cinfo,struct inode * inode)83618f41296STrond Myklebust pnfs_release_ds_info(struct pnfs_ds_commit_info *fl_cinfo, struct inode *inode)
83718f41296STrond Myklebust {
83818f41296STrond Myklebust }
83918f41296STrond Myklebust 
8408dd37758STrond 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)841ea2cf228SFred Isaman pnfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg,
842b57ff130SWeston Andros Adamson 			 struct nfs_commit_info *cinfo, u32 ds_commit_idx)
843a861a1e1SFred Isaman {
8448dd37758STrond Myklebust 	return false;
845a861a1e1SFred Isaman }
846a861a1e1SFred Isaman 
8478dd37758STrond Myklebust static inline bool
pnfs_clear_request_commit(struct nfs_page * req,struct nfs_commit_info * cinfo)848ea2cf228SFred Isaman pnfs_clear_request_commit(struct nfs_page *req, struct nfs_commit_info *cinfo)
849a861a1e1SFred Isaman {
8508dd37758STrond Myklebust 	return false;
851d6d6dc7cSFred Isaman }
852d6d6dc7cSFred Isaman 
853d6d6dc7cSFred Isaman static inline int
pnfs_scan_commit_lists(struct inode * inode,struct nfs_commit_info * cinfo,int max)854ea2cf228SFred Isaman pnfs_scan_commit_lists(struct inode *inode, struct nfs_commit_info *cinfo,
855ea2cf228SFred Isaman 		       int max)
856d6d6dc7cSFred Isaman {
857d6d6dc7cSFred Isaman 	return 0;
858a861a1e1SFred Isaman }
859a861a1e1SFred Isaman 
8609c455a8cSTrond Myklebust static inline void
pnfs_recover_commit_reqs(struct list_head * head,struct nfs_commit_info * cinfo)8619c455a8cSTrond Myklebust pnfs_recover_commit_reqs(struct list_head *head, struct nfs_commit_info *cinfo)
8629c455a8cSTrond Myklebust {
8639c455a8cSTrond Myklebust }
8649c455a8cSTrond Myklebust 
86502d1426cSWeston Andros Adamson static inline struct nfs_page *
pnfs_search_commit_reqs(struct inode * inode,struct nfs_commit_info * cinfo,struct folio * folio)86602d1426cSWeston Andros Adamson pnfs_search_commit_reqs(struct inode *inode, struct nfs_commit_info *cinfo,
867*0c493b5cSTrond Myklebust 			struct folio *folio)
86802d1426cSWeston Andros Adamson {
86902d1426cSWeston Andros Adamson 	return NULL;
87002d1426cSWeston Andros Adamson }
87102d1426cSWeston Andros Adamson 
pnfs_layoutcommit_inode(struct inode * inode,bool sync)872ef311537SAndy Adamson static inline int pnfs_layoutcommit_inode(struct inode *inode, bool sync)
873863a3c6cSAndy Adamson {
874863a3c6cSAndy Adamson 	return 0;
875863a3c6cSAndy Adamson }
8761775bc34SBenny Halevy 
87782be417aSAndy Adamson static inline bool
pnfs_use_threshold(struct nfs4_threshold ** dst,struct nfs4_threshold * src,struct nfs_server * nfss)87882be417aSAndy Adamson pnfs_use_threshold(struct nfs4_threshold **dst, struct nfs4_threshold *src,
87982be417aSAndy Adamson 		   struct nfs_server *nfss)
88082be417aSAndy Adamson {
88182be417aSAndy Adamson 	return false;
88282be417aSAndy Adamson }
88382be417aSAndy Adamson 
pnfs_mdsthreshold_alloc(void)88482be417aSAndy Adamson static inline struct nfs4_threshold *pnfs_mdsthreshold_alloc(void)
88582be417aSAndy Adamson {
88682be417aSAndy Adamson 	return NULL;
88782be417aSAndy Adamson }
88882be417aSAndy Adamson 
nfs4_pnfs_v3_ds_connect_unload(void)8895f01d953SPeng Tao static inline void nfs4_pnfs_v3_ds_connect_unload(void)
8905f01d953SPeng Tao {
8915f01d953SPeng Tao }
8925f01d953SPeng Tao 
nfs4_layout_refresh_old_stateid(nfs4_stateid * dst,struct pnfs_layout_range * dst_range,struct inode * inode)89330cb3ee2STrond Myklebust static inline bool nfs4_layout_refresh_old_stateid(nfs4_stateid *dst,
894ecf84026STrond Myklebust 		struct pnfs_layout_range *dst_range,
8957380020eSTrond Myklebust 		struct inode *inode)
8967380020eSTrond Myklebust {
8977380020eSTrond Myklebust 	return false;
8987380020eSTrond Myklebust }
8992409a976SFred Isaman 
pnfs_lgopen_prepare(struct nfs4_opendata * data,struct nfs_open_context * ctx)9002409a976SFred Isaman static inline void pnfs_lgopen_prepare(struct nfs4_opendata *data,
9012409a976SFred Isaman 		struct nfs_open_context *ctx)
9022409a976SFred Isaman {
9032409a976SFred Isaman }
9042409a976SFred Isaman 
pnfs_parse_lgopen(struct inode * ino,struct nfs4_layoutget * lgp,struct nfs_open_context * ctx)9052409a976SFred Isaman static inline void pnfs_parse_lgopen(struct inode *ino,
9062409a976SFred Isaman 		struct nfs4_layoutget *lgp,
9072409a976SFred Isaman 		struct nfs_open_context *ctx)
9082409a976SFred Isaman {
9092409a976SFred Isaman }
91030ae2412SFred Isaman 
nfs4_lgopen_release(struct nfs4_layoutget * lgp)91130ae2412SFred Isaman static inline void nfs4_lgopen_release(struct nfs4_layoutget *lgp)
91230ae2412SFred Isaman {
91330ae2412SFred Isaman }
91430ae2412SFred Isaman 
pnfs_layout_is_valid(const struct pnfs_layout_hdr * lo)915c8bf7073STrond Myklebust static inline bool pnfs_layout_is_valid(const struct pnfs_layout_hdr *lo)
916c8bf7073STrond Myklebust {
917c8bf7073STrond Myklebust 	return false;
918c8bf7073STrond Myklebust }
919c8bf7073STrond Myklebust 
92085e174baSRicardo Labiaga #endif /* CONFIG_NFS_V4_1 */
92185e174baSRicardo Labiaga 
922865a7ecbSPeng Tao #if IS_ENABLED(CONFIG_NFS_V4_2)
923c8ad8894STrond Myklebust int pnfs_report_layoutstat(struct inode *inode, gfp_t gfp_flags);
924865a7ecbSPeng Tao #else
925865a7ecbSPeng Tao static inline int
pnfs_report_layoutstat(struct inode * inode,gfp_t gfp_flags)926c8ad8894STrond Myklebust pnfs_report_layoutstat(struct inode *inode, gfp_t gfp_flags)
927865a7ecbSPeng Tao {
928865a7ecbSPeng Tao 	return 0;
929865a7ecbSPeng Tao }
930865a7ecbSPeng Tao #endif
931865a7ecbSPeng Tao 
93285e174baSRicardo Labiaga #endif /* FS_NFS_PNFS_H */
933