Skip to content

Commit 6a19114

Browse files
committed
netfs: Rename netfs_read_*request to netfs_io_*request
Rename netfs_read_*request to netfs_io_*request so that the same structures can be used for the write helpers too. perl -p -i -e 's/netfs_read_(request|subrequest)/netfs_io_$1/g' \ `git grep -l 'netfs_read_\(sub\|\)request'` perl -p -i -e 's/nr_rd_ops/nr_outstanding/g' \ `git grep -l nr_rd_ops` perl -p -i -e 's/nr_wr_ops/nr_copy_ops/g' \ `git grep -l nr_wr_ops` perl -p -i -e 's/netfs_read_source/netfs_io_source/g' \ `git grep -l 'netfs_read_source'` perl -p -i -e 's/netfs_io_request_ops/netfs_request_ops/g' \ `git grep -l 'netfs_io_request_ops'` perl -p -i -e 's/init_rreq/init_request/g' \ `git grep -l 'init_rreq'` Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> cc: linux-cachefs@redhat.com Link: https://lore.kernel.org/r/164622988070.3564931.7089670190434315183.stgit@warthog.procyon.org.uk/ # v1 Link: https://lore.kernel.org/r/164678195157.1200972.366609966927368090.stgit@warthog.procyon.org.uk/ # v2 Link: https://lore.kernel.org/r/164692891535.2099075.18435198075367420588.stgit@warthog.procyon.org.uk/ # v3
1 parent 5ac417d commit 6a19114

11 files changed

Lines changed: 177 additions & 177 deletions

File tree

Documentation/filesystems/netfs_library.rst

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ Read Helper Functions
7171
Three read helpers are provided::
7272

7373
void netfs_readahead(struct readahead_control *ractl,
74-
const struct netfs_read_request_ops *ops,
74+
const struct netfs_request_ops *ops,
7575
void *netfs_priv);
7676
int netfs_readpage(struct file *file,
7777
struct folio *folio,
78-
const struct netfs_read_request_ops *ops,
78+
const struct netfs_request_ops *ops,
7979
void *netfs_priv);
8080
int netfs_write_begin(struct file *file,
8181
struct address_space *mapping,
@@ -84,7 +84,7 @@ Three read helpers are provided::
8484
unsigned int flags,
8585
struct folio **_folio,
8686
void **_fsdata,
87-
const struct netfs_read_request_ops *ops,
87+
const struct netfs_request_ops *ops,
8888
void *netfs_priv);
8989

9090
Each corresponds to a VM operation, with the addition of a couple of parameters
@@ -116,7 +116,7 @@ occurs, the request will get partially completed if sufficient data is read.
116116

117117
Additionally, there is::
118118

119-
* void netfs_subreq_terminated(struct netfs_read_subrequest *subreq,
119+
* void netfs_subreq_terminated(struct netfs_io_subrequest *subreq,
120120
ssize_t transferred_or_error,
121121
bool was_async);
122122

@@ -132,15 +132,15 @@ Read Helper Structures
132132
The read helpers make use of a couple of structures to maintain the state of
133133
the read. The first is a structure that manages a read request as a whole::
134134

135-
struct netfs_read_request {
135+
struct netfs_io_request {
136136
struct inode *inode;
137137
struct address_space *mapping;
138138
struct netfs_cache_resources cache_resources;
139139
void *netfs_priv;
140140
loff_t start;
141141
size_t len;
142142
loff_t i_size;
143-
const struct netfs_read_request_ops *netfs_ops;
143+
const struct netfs_request_ops *netfs_ops;
144144
unsigned int debug_id;
145145
...
146146
};
@@ -187,8 +187,8 @@ The above fields are the ones the netfs can use. They are:
187187
The second structure is used to manage individual slices of the overall read
188188
request::
189189

190-
struct netfs_read_subrequest {
191-
struct netfs_read_request *rreq;
190+
struct netfs_io_subrequest {
191+
struct netfs_io_request *rreq;
192192
loff_t start;
193193
size_t len;
194194
size_t transferred;
@@ -244,23 +244,23 @@ Read Helper Operations
244244
The network filesystem must provide the read helpers with a table of operations
245245
through which it can issue requests and negotiate::
246246

247-
struct netfs_read_request_ops {
248-
void (*init_rreq)(struct netfs_read_request *rreq, struct file *file);
247+
struct netfs_request_ops {
248+
void (*init_request)(struct netfs_io_request *rreq, struct file *file);
249249
bool (*is_cache_enabled)(struct inode *inode);
250-
int (*begin_cache_operation)(struct netfs_read_request *rreq);
251-
void (*expand_readahead)(struct netfs_read_request *rreq);
252-
bool (*clamp_length)(struct netfs_read_subrequest *subreq);
253-
void (*issue_op)(struct netfs_read_subrequest *subreq);
254-
bool (*is_still_valid)(struct netfs_read_request *rreq);
250+
int (*begin_cache_operation)(struct netfs_io_request *rreq);
251+
void (*expand_readahead)(struct netfs_io_request *rreq);
252+
bool (*clamp_length)(struct netfs_io_subrequest *subreq);
253+
void (*issue_op)(struct netfs_io_subrequest *subreq);
254+
bool (*is_still_valid)(struct netfs_io_request *rreq);
255255
int (*check_write_begin)(struct file *file, loff_t pos, unsigned len,
256256
struct folio *folio, void **_fsdata);
257-
void (*done)(struct netfs_read_request *rreq);
257+
void (*done)(struct netfs_io_request *rreq);
258258
void (*cleanup)(struct address_space *mapping, void *netfs_priv);
259259
};
260260

261261
The operations are as follows:
262262

263-
* ``init_rreq()``
263+
* ``init_request()``
264264

265265
[Optional] This is called to initialise the request structure. It is given
266266
the file for reference and can modify the ->netfs_priv value.
@@ -420,12 +420,12 @@ The network filesystem's ->begin_cache_operation() method is called to set up a
420420
cache and this must call into the cache to do the work. If using fscache, for
421421
example, the cache would call::
422422

423-
int fscache_begin_read_operation(struct netfs_read_request *rreq,
423+
int fscache_begin_read_operation(struct netfs_io_request *rreq,
424424
struct fscache_cookie *cookie);
425425

426426
passing in the request pointer and the cookie corresponding to the file.
427427

428-
The netfs_read_request object contains a place for the cache to hang its
428+
The netfs_io_request object contains a place for the cache to hang its
429429
state::
430430

431431
struct netfs_cache_resources {
@@ -443,7 +443,7 @@ operation table looks like the following::
443443
void (*expand_readahead)(struct netfs_cache_resources *cres,
444444
loff_t *_start, size_t *_len, loff_t i_size);
445445

446-
enum netfs_read_source (*prepare_read)(struct netfs_read_subrequest *subreq,
446+
enum netfs_io_source (*prepare_read)(struct netfs_io_subrequest *subreq,
447447
loff_t i_size);
448448

449449
int (*read)(struct netfs_cache_resources *cres,

fs/9p/vfs_addr.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
* v9fs_req_issue_op - Issue a read from 9P
3232
* @subreq: The read to make
3333
*/
34-
static void v9fs_req_issue_op(struct netfs_read_subrequest *subreq)
34+
static void v9fs_req_issue_op(struct netfs_io_subrequest *subreq)
3535
{
36-
struct netfs_read_request *rreq = subreq->rreq;
36+
struct netfs_io_request *rreq = subreq->rreq;
3737
struct p9_fid *fid = rreq->netfs_priv;
3838
struct iov_iter to;
3939
loff_t pos = subreq->start + subreq->transferred;
@@ -52,11 +52,11 @@ static void v9fs_req_issue_op(struct netfs_read_subrequest *subreq)
5252
}
5353

5454
/**
55-
* v9fs_init_rreq - Initialise a read request
55+
* v9fs_init_request - Initialise a read request
5656
* @rreq: The read request
5757
* @file: The file being read from
5858
*/
59-
static void v9fs_init_rreq(struct netfs_read_request *rreq, struct file *file)
59+
static void v9fs_init_request(struct netfs_io_request *rreq, struct file *file)
6060
{
6161
struct p9_fid *fid = file->private_data;
6262

@@ -65,7 +65,7 @@ static void v9fs_init_rreq(struct netfs_read_request *rreq, struct file *file)
6565
}
6666

6767
/**
68-
* v9fs_req_cleanup - Cleanup request initialized by v9fs_init_rreq
68+
* v9fs_req_cleanup - Cleanup request initialized by v9fs_init_request
6969
* @mapping: unused mapping of request to cleanup
7070
* @priv: private data to cleanup, a fid, guaranted non-null.
7171
*/
@@ -91,7 +91,7 @@ static bool v9fs_is_cache_enabled(struct inode *inode)
9191
* v9fs_begin_cache_operation - Begin a cache operation for a read
9292
* @rreq: The read request
9393
*/
94-
static int v9fs_begin_cache_operation(struct netfs_read_request *rreq)
94+
static int v9fs_begin_cache_operation(struct netfs_io_request *rreq)
9595
{
9696
#ifdef CONFIG_9P_FSCACHE
9797
struct fscache_cookie *cookie = v9fs_inode_cookie(V9FS_I(rreq->inode));
@@ -102,8 +102,8 @@ static int v9fs_begin_cache_operation(struct netfs_read_request *rreq)
102102
#endif
103103
}
104104

105-
static const struct netfs_read_request_ops v9fs_req_ops = {
106-
.init_rreq = v9fs_init_rreq,
105+
static const struct netfs_request_ops v9fs_req_ops = {
106+
.init_request = v9fs_init_request,
107107
.is_cache_enabled = v9fs_is_cache_enabled,
108108
.begin_cache_operation = v9fs_begin_cache_operation,
109109
.issue_op = v9fs_req_issue_op,

fs/afs/file.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ void afs_put_read(struct afs_read *req)
240240
static void afs_fetch_data_notify(struct afs_operation *op)
241241
{
242242
struct afs_read *req = op->fetch.req;
243-
struct netfs_read_subrequest *subreq = req->subreq;
243+
struct netfs_io_subrequest *subreq = req->subreq;
244244
int error = op->error;
245245

246246
if (error == -ECONNABORTED)
@@ -310,7 +310,7 @@ int afs_fetch_data(struct afs_vnode *vnode, struct afs_read *req)
310310
return afs_do_sync_operation(op);
311311
}
312312

313-
static void afs_req_issue_op(struct netfs_read_subrequest *subreq)
313+
static void afs_req_issue_op(struct netfs_io_subrequest *subreq)
314314
{
315315
struct afs_vnode *vnode = AFS_FS_I(subreq->rreq->inode);
316316
struct afs_read *fsreq;
@@ -359,7 +359,7 @@ static int afs_symlink_readpage(struct file *file, struct page *page)
359359
return ret;
360360
}
361361

362-
static void afs_init_rreq(struct netfs_read_request *rreq, struct file *file)
362+
static void afs_init_request(struct netfs_io_request *rreq, struct file *file)
363363
{
364364
rreq->netfs_priv = key_get(afs_file_key(file));
365365
}
@@ -371,7 +371,7 @@ static bool afs_is_cache_enabled(struct inode *inode)
371371
return fscache_cookie_enabled(cookie) && cookie->cache_priv;
372372
}
373373

374-
static int afs_begin_cache_operation(struct netfs_read_request *rreq)
374+
static int afs_begin_cache_operation(struct netfs_io_request *rreq)
375375
{
376376
#ifdef CONFIG_AFS_FSCACHE
377377
struct afs_vnode *vnode = AFS_FS_I(rreq->inode);
@@ -396,8 +396,8 @@ static void afs_priv_cleanup(struct address_space *mapping, void *netfs_priv)
396396
key_put(netfs_priv);
397397
}
398398

399-
const struct netfs_read_request_ops afs_req_ops = {
400-
.init_rreq = afs_init_rreq,
399+
const struct netfs_request_ops afs_req_ops = {
400+
.init_request = afs_init_request,
401401
.is_cache_enabled = afs_is_cache_enabled,
402402
.begin_cache_operation = afs_begin_cache_operation,
403403
.check_write_begin = afs_check_write_begin,

fs/afs/internal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ struct afs_read {
207207
loff_t file_size; /* File size returned by server */
208208
struct key *key; /* The key to use to reissue the read */
209209
struct afs_vnode *vnode; /* The file being read into. */
210-
struct netfs_read_subrequest *subreq; /* Fscache helper read request this belongs to */
210+
struct netfs_io_subrequest *subreq; /* Fscache helper read request this belongs to */
211211
afs_dataversion_t data_version; /* Version number returned by server */
212212
refcount_t usage;
213213
unsigned int call_debug_id;
@@ -1063,7 +1063,7 @@ extern const struct address_space_operations afs_file_aops;
10631063
extern const struct address_space_operations afs_symlink_aops;
10641064
extern const struct inode_operations afs_file_inode_operations;
10651065
extern const struct file_operations afs_file_operations;
1066-
extern const struct netfs_read_request_ops afs_req_ops;
1066+
extern const struct netfs_request_ops afs_req_ops;
10671067

10681068
extern int afs_cache_wb_key(struct afs_vnode *, struct afs_file *);
10691069
extern void afs_put_wb_key(struct afs_wb_key *);

fs/cachefiles/io.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,18 +382,18 @@ static int cachefiles_write(struct netfs_cache_resources *cres,
382382
* Prepare a read operation, shortening it to a cached/uncached
383383
* boundary as appropriate.
384384
*/
385-
static enum netfs_read_source cachefiles_prepare_read(struct netfs_read_subrequest *subreq,
385+
static enum netfs_io_source cachefiles_prepare_read(struct netfs_io_subrequest *subreq,
386386
loff_t i_size)
387387
{
388388
enum cachefiles_prepare_read_trace why;
389-
struct netfs_read_request *rreq = subreq->rreq;
389+
struct netfs_io_request *rreq = subreq->rreq;
390390
struct netfs_cache_resources *cres = &rreq->cache_resources;
391391
struct cachefiles_object *object;
392392
struct cachefiles_cache *cache;
393393
struct fscache_cookie *cookie = fscache_cres_cookie(cres);
394394
const struct cred *saved_cred;
395395
struct file *file = cachefiles_cres_file(cres);
396-
enum netfs_read_source ret = NETFS_DOWNLOAD_FROM_SERVER;
396+
enum netfs_io_source ret = NETFS_DOWNLOAD_FROM_SERVER;
397397
loff_t off, to;
398398
ino_t ino = file ? file_inode(file)->i_ino : 0;
399399

fs/ceph/addr.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ static int ceph_releasepage(struct page *page, gfp_t gfp)
183183
return 1;
184184
}
185185

186-
static void ceph_netfs_expand_readahead(struct netfs_read_request *rreq)
186+
static void ceph_netfs_expand_readahead(struct netfs_io_request *rreq)
187187
{
188188
struct inode *inode = rreq->inode;
189189
struct ceph_inode_info *ci = ceph_inode(inode);
@@ -200,7 +200,7 @@ static void ceph_netfs_expand_readahead(struct netfs_read_request *rreq)
200200
rreq->len = roundup(rreq->len, lo->stripe_unit);
201201
}
202202

203-
static bool ceph_netfs_clamp_length(struct netfs_read_subrequest *subreq)
203+
static bool ceph_netfs_clamp_length(struct netfs_io_subrequest *subreq)
204204
{
205205
struct inode *inode = subreq->rreq->inode;
206206
struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
@@ -219,7 +219,7 @@ static void finish_netfs_read(struct ceph_osd_request *req)
219219
{
220220
struct ceph_fs_client *fsc = ceph_inode_to_client(req->r_inode);
221221
struct ceph_osd_data *osd_data = osd_req_op_extent_osd_data(req, 0);
222-
struct netfs_read_subrequest *subreq = req->r_priv;
222+
struct netfs_io_subrequest *subreq = req->r_priv;
223223
int num_pages;
224224
int err = req->r_result;
225225

@@ -245,9 +245,9 @@ static void finish_netfs_read(struct ceph_osd_request *req)
245245
iput(req->r_inode);
246246
}
247247

248-
static bool ceph_netfs_issue_op_inline(struct netfs_read_subrequest *subreq)
248+
static bool ceph_netfs_issue_op_inline(struct netfs_io_subrequest *subreq)
249249
{
250-
struct netfs_read_request *rreq = subreq->rreq;
250+
struct netfs_io_request *rreq = subreq->rreq;
251251
struct inode *inode = rreq->inode;
252252
struct ceph_mds_reply_info_parsed *rinfo;
253253
struct ceph_mds_reply_info_in *iinfo;
@@ -298,9 +298,9 @@ static bool ceph_netfs_issue_op_inline(struct netfs_read_subrequest *subreq)
298298
return true;
299299
}
300300

301-
static void ceph_netfs_issue_op(struct netfs_read_subrequest *subreq)
301+
static void ceph_netfs_issue_op(struct netfs_io_subrequest *subreq)
302302
{
303-
struct netfs_read_request *rreq = subreq->rreq;
303+
struct netfs_io_request *rreq = subreq->rreq;
304304
struct inode *inode = rreq->inode;
305305
struct ceph_inode_info *ci = ceph_inode(inode);
306306
struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
@@ -364,7 +364,7 @@ static void ceph_readahead_cleanup(struct address_space *mapping, void *priv)
364364
ceph_put_cap_refs(ci, got);
365365
}
366366

367-
static const struct netfs_read_request_ops ceph_netfs_read_ops = {
367+
static const struct netfs_request_ops ceph_netfs_read_ops = {
368368
.is_cache_enabled = ceph_is_cache_enabled,
369369
.begin_cache_operation = ceph_begin_cache_operation,
370370
.issue_op = ceph_netfs_issue_op,

fs/ceph/cache.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static inline int ceph_fscache_set_page_dirty(struct page *page)
6262
return fscache_set_page_dirty(page, ceph_fscache_cookie(ci));
6363
}
6464

65-
static inline int ceph_begin_cache_operation(struct netfs_read_request *rreq)
65+
static inline int ceph_begin_cache_operation(struct netfs_io_request *rreq)
6666
{
6767
struct fscache_cookie *cookie = ceph_fscache_cookie(ceph_inode(rreq->inode));
6868

@@ -143,7 +143,7 @@ static inline bool ceph_is_cache_enabled(struct inode *inode)
143143
return false;
144144
}
145145

146-
static inline int ceph_begin_cache_operation(struct netfs_read_request *rreq)
146+
static inline int ceph_begin_cache_operation(struct netfs_io_request *rreq)
147147
{
148148
return -ENOBUFS;
149149
}

0 commit comments

Comments
 (0)