Skip to content

Commit d4438a2

Browse files
committed
afs: Introduce an afs_get_read() refcount helper
Introduce an afs_get_read() helper to get a reference on an afs_read object. Signed-off-by: David Howells <[email protected]>
1 parent 0b9c017 commit d4438a2

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

fs/afs/fsclient.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ static int afs_fs_fetch_data64(struct afs_fs_cursor *fc,
490490
call->key = fc->key;
491491
call->out_scb = scb;
492492
call->out_volsync = NULL;
493-
call->read_request = req;
493+
call->read_request = afs_get_read(req);
494494

495495
/* marshall the parameters */
496496
bp = call->request;
@@ -503,7 +503,6 @@ static int afs_fs_fetch_data64(struct afs_fs_cursor *fc,
503503
bp[6] = 0;
504504
bp[7] = htonl(lower_32_bits(req->len));
505505

506-
refcount_inc(&req->usage);
507506
afs_use_fs_server(call, fc->cbi);
508507
trace_afs_make_fs_call(call, &vnode->fid);
509508
afs_set_fc_call(call, fc);
@@ -540,7 +539,7 @@ int afs_fs_fetch_data(struct afs_fs_cursor *fc,
540539
call->key = fc->key;
541540
call->out_scb = scb;
542541
call->out_volsync = NULL;
543-
call->read_request = req;
542+
call->read_request = afs_get_read(req);
544543

545544
/* marshall the parameters */
546545
bp = call->request;
@@ -551,7 +550,6 @@ int afs_fs_fetch_data(struct afs_fs_cursor *fc,
551550
bp[4] = htonl(lower_32_bits(req->pos));
552551
bp[5] = htonl(lower_32_bits(req->len));
553552

554-
refcount_inc(&req->usage);
555553
afs_use_fs_server(call, fc->cbi);
556554
trace_afs_make_fs_call(call, &vnode->fid);
557555
afs_set_fc_call(call, fc);

fs/afs/internal.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,12 @@ extern int afs_fetch_data(struct afs_vnode *, struct key *, struct afs_read *);
934934
extern int afs_page_filler(void *, struct page *);
935935
extern void afs_put_read(struct afs_read *);
936936

937+
static inline struct afs_read *afs_get_read(struct afs_read *req)
938+
{
939+
refcount_inc(&req->usage);
940+
return req;
941+
}
942+
937943
/*
938944
* flock.c
939945
*/

fs/afs/yfsclient.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ int yfs_fs_fetch_data(struct afs_fs_cursor *fc, struct afs_status_cb *scb,
605605
call->key = fc->key;
606606
call->out_scb = scb;
607607
call->out_volsync = NULL;
608-
call->read_request = req;
608+
call->read_request = afs_get_read(req);
609609

610610
/* marshall the parameters */
611611
bp = call->request;
@@ -616,7 +616,6 @@ int yfs_fs_fetch_data(struct afs_fs_cursor *fc, struct afs_status_cb *scb,
616616
bp = xdr_encode_u64(bp, req->len);
617617
yfs_check_req(call, bp);
618618

619-
refcount_inc(&req->usage);
620619
afs_use_fs_server(call, fc->cbi);
621620
trace_afs_make_fs_call(call, &vnode->fid);
622621
afs_set_fc_call(call, fc);

0 commit comments

Comments
 (0)