@@ -79,7 +79,7 @@ To help deal with the per-inode context, a number helper functions are
7979provided. Firstly, a function to perform basic initialisation on a context and
8080set the operations table pointer::
8181
82- void netfs_inode_init(struct inode *inode ,
82+ void netfs_inode_init(struct netfs_inode *ctx ,
8383 const struct netfs_request_ops *ops);
8484
8585then a function to cast from the VFS inode structure to the netfs context::
@@ -89,7 +89,7 @@ then a function to cast from the VFS inode structure to the netfs context::
8989and finally, a function to get the cache cookie pointer from the context
9090attached to an inode (or NULL if fscache is disabled)::
9191
92- struct fscache_cookie *netfs_i_cookie(struct inode *inode );
92+ struct fscache_cookie *netfs_i_cookie(struct netfs_inode *ctx );
9393
9494
9595Buffered Read Helpers
@@ -136,8 +136,9 @@ Three read helpers are provided::
136136
137137 void netfs_readahead(struct readahead_control *ractl);
138138 int netfs_read_folio(struct file *file,
139- struct folio *folio);
140- int netfs_write_begin(struct file *file,
139+ struct folio *folio);
140+ int netfs_write_begin(struct netfs_inode *ctx,
141+ struct file *file,
141142 struct address_space *mapping,
142143 loff_t pos,
143144 unsigned int len,
@@ -157,9 +158,10 @@ The helpers manage the read request, calling back into the network filesystem
157158through the suppplied table of operations. Waits will be performed as
158159necessary before returning for helpers that are meant to be synchronous.
159160
160- If an error occurs and netfs_priv is non-NULL, ops->cleanup() will be called to
161- deal with it. If some parts of the request are in progress when an error
162- occurs, the request will get partially completed if sufficient data is read.
161+ If an error occurs, the ->free_request() will be called to clean up the
162+ netfs_io_request struct allocated. If some parts of the request are in
163+ progress when an error occurs, the request will get partially completed if
164+ sufficient data is read.
163165
164166Additionally, there is::
165167
@@ -207,8 +209,7 @@ The above fields are the ones the netfs can use. They are:
207209 * ``netfs_priv ``
208210
209211 The network filesystem's private data. The value for this can be passed in
210- to the helper functions or set during the request. The ->cleanup() op will
211- be called if this is non-NULL at the end.
212+ to the helper functions or set during the request.
212213
213214 * ``start ``
214215 * ``len ``
@@ -293,6 +294,7 @@ through which it can issue requests and negotiate::
293294
294295 struct netfs_request_ops {
295296 void (*init_request)(struct netfs_io_request *rreq, struct file *file);
297+ void (*free_request)(struct netfs_io_request *rreq);
296298 int (*begin_cache_operation)(struct netfs_io_request *rreq);
297299 void (*expand_readahead)(struct netfs_io_request *rreq);
298300 bool (*clamp_length)(struct netfs_io_subrequest *subreq);
@@ -301,15 +303,19 @@ through which it can issue requests and negotiate::
301303 int (*check_write_begin)(struct file *file, loff_t pos, unsigned len,
302304 struct folio *folio, void **_fsdata);
303305 void (*done)(struct netfs_io_request *rreq);
304- void (*cleanup)(struct address_space *mapping, void *netfs_priv);
305306 };
306307
307308The operations are as follows:
308309
309310 * ``init_request() ``
310311
311312 [Optional] This is called to initialise the request structure. It is given
312- the file for reference and can modify the ->netfs_priv value.
313+ the file for reference.
314+
315+ * ``free_request() ``
316+
317+ [Optional] This is called as the request is being deallocated so that the
318+ filesystem can clean up any state it has attached there.
313319
314320 * ``begin_cache_operation() ``
315321
@@ -383,11 +389,6 @@ The operations are as follows:
383389 [Optional] This is called after the folios in the request have all been
384390 unlocked (and marked uptodate if applicable).
385391
386- * ``cleanup ``
387-
388- [Optional] This is called as the request is being deallocated so that the
389- filesystem can clean up ->netfs_priv.
390-
391392
392393
393394Read Helper Procedure
0 commit comments