From 231731623392cdcf117ed5febe178b5d7c1fb9c0 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 23 May 2018 12:40:21 +0200 Subject: [PATCH] vfs_btrfs: update s/btrfs_cc_state/btrfs_offload_write_state/ s/cc_state/state/ This matches our naming conventions used for tevent_req based functions. Signed-off-by: Stefan Metzmacher Reviewed-by: Ralph Boehme --- source3/modules/vfs_btrfs.c | 60 +++++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/source3/modules/vfs_btrfs.c b/source3/modules/vfs_btrfs.c index 4c07ebd36ec..cc082f7fbbf 100644 --- a/source3/modules/vfs_btrfs.c +++ b/source3/modules/vfs_btrfs.c @@ -196,7 +196,7 @@ static NTSTATUS btrfs_offload_read_recv(struct tevent_req *req, return NT_STATUS_OK; } -struct btrfs_cc_state { +struct btrfs_offload_write_state { struct vfs_handle_struct *handle; off_t copied; struct tevent_req *subreq; /* non-null if passed to next VFS fn */ @@ -213,8 +213,8 @@ static struct tevent_req *btrfs_offload_write_send(struct vfs_handle_struct *han off_t dest_off, off_t num) { - struct tevent_req *req; - struct btrfs_cc_state *cc_state; + struct tevent_req *req = NULL; + struct btrfs_offload_write_state *state = NULL; struct btrfs_ioctl_clone_range_args cr_args; struct lock_struct src_lck; struct lock_struct dest_lck; @@ -225,12 +225,13 @@ static struct tevent_req *btrfs_offload_write_send(struct vfs_handle_struct *han bool do_locking = false; NTSTATUS status; - req = tevent_req_create(mem_ctx, &cc_state, struct btrfs_cc_state); + req = tevent_req_create(mem_ctx, &state, + struct btrfs_offload_write_state); if (req == NULL) { return NULL; } - cc_state->handle = handle; + state->handle = handle; status = vfs_offload_token_db_fetch_fsp(btrfs_offload_ctx, token, &src_fsp); @@ -263,18 +264,19 @@ static struct tevent_req *btrfs_offload_write_send(struct vfs_handle_struct *han } if (!handle_offload_write) { - cc_state->subreq = SMB_VFS_NEXT_OFFLOAD_WRITE_SEND(handle, - cc_state, ev, + state->subreq = SMB_VFS_NEXT_OFFLOAD_WRITE_SEND(handle, + state, + ev, fsctl, token, transfer_offset, dest_fsp, dest_off, num); - if (tevent_req_nomem(cc_state->subreq, req)) { + if (tevent_req_nomem(state->subreq, req)) { return tevent_req_post(req, ev); } - tevent_req_set_callback(cc_state->subreq, + tevent_req_set_callback(state->subreq, btrfs_offload_write_done, req); return req; @@ -343,19 +345,20 @@ static struct tevent_req *btrfs_offload_write_send(struct vfs_handle_struct *han (unsigned long long)cr_args.src_offset, dest_fsp->fh->fd, (unsigned long long)cr_args.dest_offset)); - cc_state->subreq = SMB_VFS_NEXT_OFFLOAD_WRITE_SEND(handle, - cc_state, ev, + state->subreq = SMB_VFS_NEXT_OFFLOAD_WRITE_SEND(handle, + state, + ev, fsctl, token, transfer_offset, dest_fsp, dest_off, num); - if (tevent_req_nomem(cc_state->subreq, req)) { + if (tevent_req_nomem(state->subreq, req)) { return tevent_req_post(req, ev); } /* wait for subreq completion */ - tevent_req_set_callback(cc_state->subreq, + tevent_req_set_callback(state->subreq, btrfs_offload_write_done, req); return req; @@ -363,7 +366,7 @@ static struct tevent_req *btrfs_offload_write_send(struct vfs_handle_struct *han DEBUG(5, ("BTRFS_IOC_CLONE_RANGE returned %d\n", ret)); /* BTRFS_IOC_CLONE_RANGE is all or nothing */ - cc_state->copied = num; + state->copied = num; tevent_req_done(req); return tevent_req_post(req, ev); } @@ -371,15 +374,17 @@ static struct tevent_req *btrfs_offload_write_send(struct vfs_handle_struct *han /* only used if the request is passed through to next VFS module */ static void btrfs_offload_write_done(struct tevent_req *subreq) { - struct tevent_req *req = tevent_req_callback_data( - subreq, struct tevent_req); - struct btrfs_cc_state *cc_state = tevent_req_data(req, - struct btrfs_cc_state); + struct tevent_req *req = + tevent_req_callback_data(subreq, + struct tevent_req); + struct btrfs_offload_write_state *state = + tevent_req_data(req, + struct btrfs_offload_write_state); NTSTATUS status; - status = SMB_VFS_NEXT_OFFLOAD_WRITE_RECV(cc_state->handle, - cc_state->subreq, - &cc_state->copied); + status = SMB_VFS_NEXT_OFFLOAD_WRITE_RECV(state->handle, + state->subreq, + &state->copied); if (tevent_req_nterror(req, status)) { return; } @@ -387,12 +392,13 @@ static void btrfs_offload_write_done(struct tevent_req *subreq) } static NTSTATUS btrfs_offload_write_recv(struct vfs_handle_struct *handle, - struct tevent_req *req, - off_t *copied) + struct tevent_req *req, + off_t *copied) { + struct btrfs_offload_write_state *state = + tevent_req_data(req, + struct btrfs_offload_write_state); NTSTATUS status; - struct btrfs_cc_state *cc_state = tevent_req_data(req, - struct btrfs_cc_state); if (tevent_req_is_nterror(req, &status)) { DEBUG(4, ("server side copy chunk failed: %s\n", @@ -402,8 +408,8 @@ static NTSTATUS btrfs_offload_write_recv(struct vfs_handle_struct *handle, } DEBUG(10, ("server side copy chunk copied %llu\n", - (unsigned long long)cc_state->copied)); - *copied = cc_state->copied; + (unsigned long long)state->copied)); + *copied = state->copied; tevent_req_received(req); return NT_STATUS_OK; } -- 2.11.4.GIT