History

Merge branch 'fscache-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs

Pull fscache cleanups from David Howells: - fix checker complaint in afs - two netfs cleanups: - netfs_inode calling convention cleanup plus the requisite documentation changes - replace the ->cleanup op with a ->free_request op. This is possible as the I/O request is now always available at the cleanup point as the stuff to be cleaned up is no longer passed into the API functions, but rather obtained by ->init_request. * 'fscache-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs: netfs: Rename the netfs_io_request cleanup op and give it an op pointer netfs: Further cleanups after struct netfs_inode wrapper introduced afs: Fix some checker issues

Linus Torvalds committed 4 years ago

Commit 045fb9c2 parents b098915 40a811017 files · +60 −62Browse files

Unified · Split

17 files
  1. Documentation/filesystems/netfs_library.rst +17 −16
  2. fs/9p/v9fs.h +1 −1
  3. fs/9p/vfs_addr.c +6 −7
  4. fs/9p/vfs_inode.c +2 −1
  5. fs/afs/dynroot.c +1 −1
  6. fs/afs/file.c +3 −3
  7. fs/afs/inode.c +1 −1
  8. fs/afs/internal.h +1 −1
  9. fs/afs/volume.c +1 −2
  10. fs/afs/write.c +1 −1
  11. fs/ceph/addr.c +6 −6
  12. fs/ceph/cache.h +1 −1
  13. fs/ceph/inode.c +1 −1
  14. fs/cifs/fscache.h +1 −1
  15. fs/netfs/buffered_read.c +3 −2
  16. fs/netfs/objects.c +3 −3
  17. include/linux/netfs.h +11 −14
Documentation/filesystems/netfs_library.rst+17−16
@@ -79,7 +79,7 @@ To help deal with the per-inode context, a number helper functions are · 78 unmodified lines
79provided. Firstly, a function to perform basic initialisation on a context and79provided. Firstly, a function to perform basic initialisation on a context and
80set the operations table pointer::80set the operations table pointer::
81 81
82 void netfs_inode_init(struct inode *inode,82 void netfs_inode_init(struct netfs_inode *ctx,
83 const struct netfs_request_ops *ops);83 const struct netfs_request_ops *ops);
84 84
85then a function to cast from the VFS inode structure to the netfs context::85then 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:: · 3 unmodified lines
89and finally, a function to get the cache cookie pointer from the context89and finally, a function to get the cache cookie pointer from the context
90attached to an inode (or NULL if fscache is disabled)::90attached to an inode (or NULL if fscache is disabled)::
91 91
92 struct fscache_cookie *netfs_i_cookie(struct inode *inode);92 struct fscache_cookie *netfs_i_cookie(struct netfs_inode *ctx);
93 93
94 94
95Buffered Read Helpers95Buffered Read Helpers
@@ -136,8 +136,9 @@ Three read helpers are provided:: · 40 unmodified lines
136 136
137 void netfs_readahead(struct readahead_control *ractl);137 void netfs_readahead(struct readahead_control *ractl);
138 int netfs_read_folio(struct file *file,138 int netfs_read_folio(struct file *file,
139 struct folio *folio);139 struct folio *folio);
140 int netfs_write_begin(struct file *file,140 int netfs_write_begin(struct netfs_inode *ctx,
141 struct file *file,
141 struct address_space *mapping,142 struct address_space *mapping,
142 loff_t pos,143 loff_t pos,
143 unsigned int len,144 unsigned int len,
@@ -157,9 +158,10 @@ The helpers manage the read request, calling back into the network filesystem · 13 unmodified lines
157through the suppplied table of operations. Waits will be performed as158through the suppplied table of operations. Waits will be performed as
158necessary before returning for helpers that are meant to be synchronous.159necessary before returning for helpers that are meant to be synchronous.
159 160
160If an error occurs and netfs_priv is non-NULL, ops->cleanup() will be called to161If an error occurs, the ->free_request() will be called to clean up the
161deal with it. If some parts of the request are in progress when an error162netfs_io_request struct allocated. If some parts of the request are in
162occurs, the request will get partially completed if sufficient data is read.163progress when an error occurs, the request will get partially completed if
164sufficient data is read.
163 165
164Additionally, there is::166Additionally, there is::
165 167
@@ -207,8 +209,7 @@ The above fields are the ones the netfs can use. They are: · 41 unmodified lines
207 * ``netfs_priv``209 * ``netfs_priv``
208 210
209 The network filesystem's private data. The value for this can be passed in211 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 will212 to the helper functions or set during the request.
211 be called if this is non-NULL at the end.
212 213
213 * ``start``214 * ``start``
214 * ``len``215 * ``len``
@@ -293,6 +294,7 @@ through which it can issue requests and negotiate:: · 78 unmodified lines
293 294
294 struct netfs_request_ops {295 struct netfs_request_ops {
295 void (*init_request)(struct netfs_io_request *rreq, struct file *file);296 void (*init_request)(struct netfs_io_request *rreq, struct file *file);
297 void (*free_request)(struct netfs_io_request *rreq);
296 int (*begin_cache_operation)(struct netfs_io_request *rreq);298 int (*begin_cache_operation)(struct netfs_io_request *rreq);
297 void (*expand_readahead)(struct netfs_io_request *rreq);299 void (*expand_readahead)(struct netfs_io_request *rreq);
298 bool (*clamp_length)(struct netfs_io_subrequest *subreq);300 bool (*clamp_length)(struct netfs_io_subrequest *subreq);
@@ -301,7 +303,6 @@ through which it can issue requests and negotiate:: · 2 unmodified lines
301 int (*check_write_begin)(struct file *file, loff_t pos, unsigned len,303 int (*check_write_begin)(struct file *file, loff_t pos, unsigned len,
302 struct folio *folio, void **_fsdata);304 struct folio *folio, void **_fsdata);
303 void (*done)(struct netfs_io_request *rreq);305 void (*done)(struct netfs_io_request *rreq);
304 void (*cleanup)(struct address_space *mapping, void *netfs_priv);
305 };306 };
306 307
307The operations are as follows:308The operations are as follows:
@@ -309,7 +310,12 @@ The operations are as follows: · 1 unmodified line
309 * ``init_request()``310 * ``init_request()``
310 311
311 [Optional] This is called to initialise the request structure. It is given312 [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.
313 319
314 * ``begin_cache_operation()``320 * ``begin_cache_operation()``
315 321
@@ -383,11 +389,6 @@ The operations are as follows: · 67 unmodified lines
383 [Optional] This is called after the folios in the request have all been389 [Optional] This is called after the folios in the request have all been
384 unlocked (and marked uptodate if applicable).390 unlocked (and marked uptodate if applicable).
385 391
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
391 392
392 393
393Read Helper Procedure394Read Helper Procedure
fs/9p/v9fs.h+1−1
@@ -124,7 +124,7 @@ static inline struct v9fs_inode *V9FS_I(const struct inode *inode) · 123 unmodified lines
124static inline struct fscache_cookie *v9fs_inode_cookie(struct v9fs_inode *v9inode)124static inline struct fscache_cookie *v9fs_inode_cookie(struct v9fs_inode *v9inode)
125{125{
126#ifdef CONFIG_9P_FSCACHE126#ifdef CONFIG_9P_FSCACHE
127 return netfs_i_cookie(&v9inode->netfs.inode);127 return netfs_i_cookie(&v9inode->netfs);
128#else128#else
129 return NULL;129 return NULL;
130#endif130#endif
fs/9p/vfs_addr.c+6−7
@@ -66,13 +66,12 @@ static int v9fs_init_request(struct netfs_io_request *rreq, struct file *file) · 65 unmodified lines
66}66}
67 67
68/**68/**
69 * v9fs_req_cleanup - Cleanup request initialized by v9fs_init_request69 * v9fs_free_request - Cleanup request initialized by v9fs_init_rreq
70 * @mapping: unused mapping of request to cleanup70 * @rreq: The I/O request to clean up
71 * @priv: private data to cleanup, a fid, guaranted non-null.
72 */71 */
73static void v9fs_req_cleanup(struct address_space *mapping, void *priv)72static void v9fs_free_request(struct netfs_io_request *rreq)
74{73{
75 struct p9_fid *fid = priv;74 struct p9_fid *fid = rreq->netfs_priv;
76 75
77 p9_client_clunk(fid);76 p9_client_clunk(fid);
78}77}
@@ -94,9 +93,9 @@ static int v9fs_begin_cache_operation(struct netfs_io_request *rreq) · 15 unmodified lines
94 93
95const struct netfs_request_ops v9fs_req_ops = {94const struct netfs_request_ops v9fs_req_ops = {
96 .init_request = v9fs_init_request,95 .init_request = v9fs_init_request,
96 .free_request = v9fs_free_request,
97 .begin_cache_operation = v9fs_begin_cache_operation,97 .begin_cache_operation = v9fs_begin_cache_operation,
98 .issue_read = v9fs_issue_read,98 .issue_read = v9fs_issue_read,
99 .cleanup = v9fs_req_cleanup,
100};99};
101 100
102/**101/**
@@ -274,7 +273,7 @@ static int v9fs_write_begin(struct file *filp, struct address_space *mapping, · 171 unmodified lines
274 * file. We need to do this before we get a lock on the page in case273 * file. We need to do this before we get a lock on the page in case
275 * there's more than one writer competing for the same cache block.274 * there's more than one writer competing for the same cache block.
276 */275 */
277 retval = netfs_write_begin(filp, mapping, pos, len, &folio, fsdata);276 retval = netfs_write_begin(&v9inode->netfs, filp, mapping, pos, len, &folio, fsdata);
278 if (retval < 0)277 if (retval < 0)
279 return retval;278 return retval;
280 279
fs/9p/vfs_inode.c+2−1
@@ -252,7 +252,8 @@ void v9fs_free_inode(struct inode *inode) · 251 unmodified lines
252 */252 */
253static void v9fs_set_netfs_context(struct inode *inode)253static void v9fs_set_netfs_context(struct inode *inode)
254{254{
255 netfs_inode_init(inode, &v9fs_req_ops);255 struct v9fs_inode *v9inode = V9FS_I(inode);
256 netfs_inode_init(&v9inode->netfs, &v9fs_req_ops);
256}257}
257 258
258int v9fs_init_inode(struct v9fs_session_info *v9ses,259int v9fs_init_inode(struct v9fs_session_info *v9ses,
fs/afs/dynroot.c+1−1
@@ -76,7 +76,7 @@ struct inode *afs_iget_pseudo_dir(struct super_block *sb, bool root) · 75 unmodified lines
76 /* there shouldn't be an existing inode */76 /* there shouldn't be an existing inode */
77 BUG_ON(!(inode->i_state & I_NEW));77 BUG_ON(!(inode->i_state & I_NEW));
78 78
79 netfs_inode_init(inode, NULL);79 netfs_inode_init(&vnode->netfs, NULL);
80 inode->i_size = 0;80 inode->i_size = 0;
81 inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO;81 inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO;
82 if (root) {82 if (root) {
fs/afs/file.c+3−3
@@ -382,17 +382,17 @@ static int afs_check_write_begin(struct file *file, loff_t pos, unsigned len, · 381 unmodified lines
382 return test_bit(AFS_VNODE_DELETED, &vnode->flags) ? -ESTALE : 0;382 return test_bit(AFS_VNODE_DELETED, &vnode->flags) ? -ESTALE : 0;
383}383}
384 384
385static void afs_priv_cleanup(struct address_space *mapping, void *netfs_priv)385static void afs_free_request(struct netfs_io_request *rreq)
386{386{
387 key_put(netfs_priv);387 key_put(rreq->netfs_priv);
388}388}
389 389
390const struct netfs_request_ops afs_req_ops = {390const struct netfs_request_ops afs_req_ops = {
391 .init_request = afs_init_request,391 .init_request = afs_init_request,
392 .free_request = afs_free_request,
392 .begin_cache_operation = afs_begin_cache_operation,393 .begin_cache_operation = afs_begin_cache_operation,
393 .check_write_begin = afs_check_write_begin,394 .check_write_begin = afs_check_write_begin,
394 .issue_read = afs_issue_read,395 .issue_read = afs_issue_read,
395 .cleanup = afs_priv_cleanup,
396};396};
397 397
398int afs_write_inode(struct inode *inode, struct writeback_control *wbc)398int afs_write_inode(struct inode *inode, struct writeback_control *wbc)
fs/afs/inode.c+1−1
@@ -58,7 +58,7 @@ static noinline void dump_vnode(struct afs_vnode *vnode, struct afs_vnode *paren · 57 unmodified lines
58 */58 */
59static void afs_set_netfs_context(struct afs_vnode *vnode)59static void afs_set_netfs_context(struct afs_vnode *vnode)
60{60{
61 netfs_inode_init(&vnode->netfs.inode, &afs_req_ops);61 netfs_inode_init(&vnode->netfs, &afs_req_ops);
62}62}
63 63
64/*64/*
fs/afs/internal.h+1−1
@@ -670,7 +670,7 @@ struct afs_vnode { · 669 unmodified lines
670static inline struct fscache_cookie *afs_vnode_cache(struct afs_vnode *vnode)670static inline struct fscache_cookie *afs_vnode_cache(struct afs_vnode *vnode)
671{671{
672#ifdef CONFIG_AFS_FSCACHE672#ifdef CONFIG_AFS_FSCACHE
673 return netfs_i_cookie(&vnode->netfs.inode);673 return netfs_i_cookie(&vnode->netfs);
674#else674#else
675 return NULL;675 return NULL;
676#endif676#endif
fs/afs/volume.c+1−2
@@ -9,8 +9,7 @@ · 8 unmodified lines
9#include <linux/slab.h>9#include <linux/slab.h>
10#include "internal.h"10#include "internal.h"
11 11
12unsigned __read_mostly afs_volume_gc_delay = 10;12static unsigned __read_mostly afs_volume_record_life = 60 * 60;
13unsigned __read_mostly afs_volume_record_life = 60 * 60;
14 13
15/*14/*
16 * Insert a volume into a cell. If there's an existing volume record, that is15 * Insert a volume into a cell. If there's an existing volume record, that is
fs/afs/write.c+1−1
@@ -60,7 +60,7 @@ int afs_write_begin(struct file *file, struct address_space *mapping, · 59 unmodified lines
60 * file. We need to do this before we get a lock on the page in case60 * file. We need to do this before we get a lock on the page in case
61 * there's more than one writer competing for the same cache block.61 * there's more than one writer competing for the same cache block.
62 */62 */
63 ret = netfs_write_begin(file, mapping, pos, len, &folio, fsdata);63 ret = netfs_write_begin(&vnode->netfs, file, mapping, pos, len, &folio, fsdata);
64 if (ret < 0)64 if (ret < 0)
65 return ret;65 return ret;
66 66
fs/ceph/addr.c+6−6
@@ -394,11 +394,10 @@ static int ceph_init_request(struct netfs_io_request *rreq, struct file *file) · 393 unmodified lines
394 return 0;394 return 0;
395}395}
396 396
397static void ceph_readahead_cleanup(struct address_space *mapping, void *priv)397static void ceph_netfs_free_request(struct netfs_io_request *rreq)
398{398{
399 struct inode *inode = mapping->host;399 struct ceph_inode_info *ci = ceph_inode(rreq->inode);
400 struct ceph_inode_info *ci = ceph_inode(inode);400 int got = (uintptr_t)rreq->netfs_priv;
401 int got = (uintptr_t)priv;
402 401
403 if (got)402 if (got)
404 ceph_put_cap_refs(ci, got);403 ceph_put_cap_refs(ci, got);
@@ -406,12 +405,12 @@ static void ceph_readahead_cleanup(struct address_space *mapping, void *priv) · 1 unmodified line
406 405
407const struct netfs_request_ops ceph_netfs_ops = {406const struct netfs_request_ops ceph_netfs_ops = {
408 .init_request = ceph_init_request,407 .init_request = ceph_init_request,
408 .free_request = ceph_netfs_free_request,
409 .begin_cache_operation = ceph_begin_cache_operation,409 .begin_cache_operation = ceph_begin_cache_operation,
410 .issue_read = ceph_netfs_issue_read,410 .issue_read = ceph_netfs_issue_read,
411 .expand_readahead = ceph_netfs_expand_readahead,411 .expand_readahead = ceph_netfs_expand_readahead,
412 .clamp_length = ceph_netfs_clamp_length,412 .clamp_length = ceph_netfs_clamp_length,
413 .check_write_begin = ceph_netfs_check_write_begin,413 .check_write_begin = ceph_netfs_check_write_begin,
414 .cleanup = ceph_readahead_cleanup,
415};414};
416 415
417#ifdef CONFIG_CEPH_FSCACHE416#ifdef CONFIG_CEPH_FSCACHE
@@ -1322,10 +1321,11 @@ static int ceph_write_begin(struct file *file, struct address_space *mapping, · 904 unmodified lines
1322 struct page **pagep, void **fsdata)1321 struct page **pagep, void **fsdata)
1323{1322{
1324 struct inode *inode = file_inode(file);1323 struct inode *inode = file_inode(file);
1324 struct ceph_inode_info *ci = ceph_inode(inode);
1325 struct folio *folio = NULL;1325 struct folio *folio = NULL;
1326 int r;1326 int r;
1327 1327
1328 r = netfs_write_begin(file, inode->i_mapping, pos, len, &folio, NULL);1328 r = netfs_write_begin(&ci->netfs, file, inode->i_mapping, pos, len, &folio, NULL);
1329 if (r == 0)1329 if (r == 0)
1330 folio_wait_fscache(folio);1330 folio_wait_fscache(folio);
1331 if (r < 0) {1331 if (r < 0) {
fs/ceph/cache.h+1−1
@@ -28,7 +28,7 @@ void ceph_fscache_invalidate(struct inode *inode, bool dio_write); · 27 unmodified lines
28 28
29static inline struct fscache_cookie *ceph_fscache_cookie(struct ceph_inode_info *ci)29static inline struct fscache_cookie *ceph_fscache_cookie(struct ceph_inode_info *ci)
30{30{
31 return netfs_i_cookie(&ci->netfs.inode);31 return netfs_i_cookie(&ci->netfs);
32}32}
33 33
34static inline void ceph_fscache_resize(struct inode *inode, loff_t to)34static inline void ceph_fscache_resize(struct inode *inode, loff_t to)
fs/ceph/inode.c+1−1
@@ -460,7 +460,7 @@ struct inode *ceph_alloc_inode(struct super_block *sb) · 459 unmodified lines
460 dout("alloc_inode %p\n", &ci->netfs.inode);460 dout("alloc_inode %p\n", &ci->netfs.inode);
461 461
462 /* Set parameters for the netfs library */462 /* Set parameters for the netfs library */
463 netfs_inode_init(&ci->netfs.inode, &ceph_netfs_ops);463 netfs_inode_init(&ci->netfs, &ceph_netfs_ops);
464 464
465 spin_lock_init(&ci->i_ceph_lock);465 spin_lock_init(&ci->i_ceph_lock);
466 466
fs/cifs/fscache.h+1−1
@@ -61,7 +61,7 @@ void cifs_fscache_fill_coherency(struct inode *inode, · 60 unmodified lines
61 61
62static inline struct fscache_cookie *cifs_inode_cookie(struct inode *inode)62static inline struct fscache_cookie *cifs_inode_cookie(struct inode *inode)
63{63{
64 return netfs_i_cookie(inode);64 return netfs_i_cookie(&CIFS_I(inode)->netfs);
65}65}
66 66
67static inline void cifs_invalidate_cache(struct inode *inode, unsigned int flags)67static inline void cifs_invalidate_cache(struct inode *inode, unsigned int flags)
fs/netfs/buffered_read.c+3−2
@@ -297,6 +297,7 @@ zero_out: · 296 unmodified lines
297 297
298/**298/**
299 * netfs_write_begin - Helper to prepare for writing299 * netfs_write_begin - Helper to prepare for writing
300 * @ctx: The netfs context
300 * @file: The file to read from301 * @file: The file to read from
301 * @mapping: The mapping to read from302 * @mapping: The mapping to read from
302 * @pos: File position at which the write will begin303 * @pos: File position at which the write will begin
@@ -326,12 +327,12 @@ zero_out: · 23 unmodified lines
326 *327 *
327 * This is usable whether or not caching is enabled.328 * This is usable whether or not caching is enabled.
328 */329 */
329int netfs_write_begin(struct file *file, struct address_space *mapping,330int netfs_write_begin(struct netfs_inode *ctx,
331 struct file *file, struct address_space *mapping,
330 loff_t pos, unsigned int len, struct folio **_folio,332 loff_t pos, unsigned int len, struct folio **_folio,
331 void **_fsdata)333 void **_fsdata)
332{334{
333 struct netfs_io_request *rreq;335 struct netfs_io_request *rreq;
334 struct netfs_inode *ctx = netfs_inode(file_inode(file ));
335 struct folio *folio;336 struct folio *folio;
336 unsigned int fgp_flags = FGP_LOCK | FGP_WRITE | FGP_CREAT | FGP_STABLE;337 unsigned int fgp_flags = FGP_LOCK | FGP_WRITE | FGP_CREAT | FGP_STABLE;
337 pgoff_t index = pos >> PAGE_SHIFT;338 pgoff_t index = pos >> PAGE_SHIFT;
fs/netfs/objects.c+3−3
@@ -75,10 +75,10 @@ static void netfs_free_request(struct work_struct *work) · 74 unmodified lines
75 struct netfs_io_request *rreq =75 struct netfs_io_request *rreq =
76 container_of(work, struct netfs_io_request, work);76 container_of(work, struct netfs_io_request, work);
77 77
78 netfs_clear_subrequests(rreq, false);
79 if (rreq->netfs_priv)
80 rreq->netfs_ops->cleanup(rreq->mapping, rreq->netfs_priv);
81 trace_netfs_rreq(rreq, netfs_rreq_trace_free);78 trace_netfs_rreq(rreq, netfs_rreq_trace_free);
79 netfs_clear_subrequests(rreq, false);
80 if (rreq->netfs_ops->free_request)
81 rreq->netfs_ops->free_request(rreq);
82 if (rreq->cache_resources.ops)82 if (rreq->cache_resources.ops)
83 rreq->cache_resources.ops->end_operation(&rreq->cache_resources);83 rreq->cache_resources.ops->end_operation(&rreq->cache_resources);
84 kfree(rreq);84 kfree(rreq);
include/linux/netfs.h+11−14
@@ -206,7 +206,9 @@ struct netfs_io_request { · 205 unmodified lines
206 */206 */
207struct netfs_request_ops {207struct netfs_request_ops {
208 int (*init_request)(struct netfs_io_request *rreq, struct file *file);208 int (*init_request)(struct netfs_io_request *rreq, struct file *file);
209 void (*free_request)(struct netfs_io_request *rreq);
209 int (*begin_cache_operation)(struct netfs_io_request *rreq);210 int (*begin_cache_operation)(struct netfs_io_request *rreq);
211
210 void (*expand_readahead)(struct netfs_io_request *rreq);212 void (*expand_readahead)(struct netfs_io_request *rreq);
211 bool (*clamp_length)(struct netfs_io_subrequest *subreq);213 bool (*clamp_length)(struct netfs_io_subrequest *subreq);
212 void (*issue_read)(struct netfs_io_subrequest *subreq);214 void (*issue_read)(struct netfs_io_subrequest *subreq);
@@ -214,7 +216,6 @@ struct netfs_request_ops { · 1 unmodified line
214 int (*check_write_begin)(struct file *file, loff_t pos, unsigned len,216 int (*check_write_begin)(struct file *file, loff_t pos, unsigned len,
215 struct folio *folio, void **_fsdata);217 struct folio *folio, void **_fsdata);
216 void (*done)(struct netfs_io_request *rreq);218 void (*done)(struct netfs_io_request *rreq);
217 void (*cleanup)(struct address_space *mapping, void *netfs_priv);
218};219};
219 220
220/*221/*
@@ -277,7 +278,8 @@ struct netfs_cache_ops { · 56 unmodified lines
277struct readahead_control;278struct readahead_control;
278extern void netfs_readahead(struct readahead_control *);279extern void netfs_readahead(struct readahead_control *);
279int netfs_read_folio(struct file *, struct folio *);280int netfs_read_folio(struct file *, struct folio *);
280extern int netfs_write_begin(struct file *, struct address_space *,281extern int netfs_write_begin(struct netfs_inode *,
282 struct file *, struct address_space *,
281 loff_t, unsigned int, struct folio **,283 loff_t, unsigned int, struct folio **,
282 void **);284 void **);
283 285
@@ -302,19 +304,17 @@ static inline struct netfs_inode *netfs_inode(struct inode *inode) · 18 unmodified lines
302 304
303/**305/**
304 * netfs_inode_init - Initialise a netfslib inode context306 * netfs_inode_init - Initialise a netfslib inode context
305 * @inode: The inode with which the context is associated307 * @inode: The netfs inode to initialise
306 * @ops: The netfs's operations list308 * @ops: The netfs's operations list
307 *309 *
308 * Initialise the netfs library context struct. This is expected to follow on310 * Initialise the netfs library context struct. This is expected to follow on
309 * directly from the VFS inode struct.311 * directly from the VFS inode struct.
310 */312 */
311static inline void netfs_inode_init(struct inode *inode,313static inline void netfs_inode_init(struct netfs_inode *ctx,
312 const struct netfs_request_ops *ops)314 const struct netfs_request_ops *ops)
313{315{
314 struct netfs_inode *ctx = netfs_inode(inode);
315
316 ctx->ops = ops;316 ctx->ops = ops;
317 ctx->remote_i_size = i_size_read(inode);317 ctx->remote_i_size = i_size_read(&ctx->inode);
318#if IS_ENABLED(CONFIG_FSCACHE)318#if IS_ENABLED(CONFIG_FSCACHE)
319 ctx->cache = NULL;319 ctx->cache = NULL;
320#endif320#endif
@@ -322,28 +322,25 @@ static inline void netfs_inode_init(struct inode *inode, · 1 unmodified line
322 322
323/**323/**
324 * netfs_resize_file - Note that a file got resized324 * netfs_resize_file - Note that a file got resized
325 * @inode: The inode being resized325 * @ctx: The netfs inode being resized
326 * @new_i_size: The new file size326 * @new_i_size: The new file size
327 *327 *
328 * Inform the netfs lib that a file got resized so that it can adjust its state.328 * Inform the netfs lib that a file got resized so that it can adjust its state.
329 */329 */
330static inline void netfs_resize_file(struct inode *inode, loff_t new_i_size)330static inline void netfs_resize_file(struct netfs_inode *ctx, loff_t new_i_size)
331{331{
332 struct netfs_inode *ctx = netfs_inode(inode);
333
334 ctx->remote_i_size = new_i_size;332 ctx->remote_i_size = new_i_size;
335}333}
336 334
337/**335/**
338 * netfs_i_cookie - Get the cache cookie from the inode336 * netfs_i_cookie - Get the cache cookie from the inode
339 * @inode: The inode to query337 * @ctx: The netfs inode to query
340 *338 *
341 * Get the caching cookie (if enabled) from the network filesystem's inode.339 * Get the caching cookie (if enabled) from the network filesystem's inode.
342 */340 */
343static inline struct fscache_cookie *netfs_i_cookie(struct inode *inode)341static inline struct fscache_cookie *netfs_i_cookie(struct netfs_inode *ctx)
344{342{
345#if IS_ENABLED(CONFIG_FSCACHE)343#if IS_ENABLED(CONFIG_FSCACHE)
346 struct netfs_inode *ctx = netfs_inode(inode);
347 return ctx->cache;344 return ctx->cache;
348#else345#else
349 return NULL;346 return NULL;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t